Commit 381b8847 authored by suhuiguang's avatar suhuiguang

1.自动任务调用规则,送token-tzs

parent 82d69dd9
...@@ -17,9 +17,9 @@ public class CylinderSchedulerJob { ...@@ -17,9 +17,9 @@ public class CylinderSchedulerJob {
private CylinderInfoServiceImpl cylinderInfoService; private CylinderInfoServiceImpl cylinderInfoService;
/** /**
* 每天凌晨0点-日报生成 * 每天9点-日报生成
*/ */
@Scheduled(cron = "0 0 8 * * ?") @Scheduled(cron = "0 0 9 * * ?")
public void dayReport() { public void dayReport() {
cylinderInfoService.calEarlyWarningLevel(); cylinderInfoService.calEarlyWarningLevel();
} }
......
...@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.CylWarningMsgDto; ...@@ -9,6 +9,7 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.CylWarningMsgDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.MsgLog; import com.yeejoin.amos.boot.module.tzs.api.entity.MsgLog;
import com.yeejoin.amos.boot.module.tzs.api.enums.EarlyWarningLevelEnum; import com.yeejoin.amos.boot.module.tzs.api.enums.EarlyWarningLevelEnum;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.MsgLogServiceImpl; import com.yeejoin.amos.boot.module.tzs.biz.service.impl.MsgLogServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TzsAuthServiceImpl;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.*; import com.yeejoin.amos.boot.module.tzs.flc.api.dto.*;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.*; import com.yeejoin.amos.boot.module.tzs.flc.api.entity.*;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderInfoMapper; import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderInfoMapper;
...@@ -96,6 +97,12 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -96,6 +97,12 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
@Autowired @Autowired
private RuleTrigger ruleTrigger; private RuleTrigger ruleTrigger;
@Autowired
TzsAuthServiceImpl tzsAuthService;
@Value("${cylinder-early-warning-packageId:气瓶监管/cylwarningmsg}")
private String packageId;
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -607,6 +614,9 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -607,6 +614,9 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
wrapper.orderByDesc(CylinderInfo::getSequenceNbr); wrapper.orderByDesc(CylinderInfo::getSequenceNbr);
IPage<CylinderInfo> result = this.page(page, wrapper); IPage<CylinderInfo> result = this.page(page, wrapper);
for (CylinderInfo r : result.getRecords()) { for (CylinderInfo r : result.getRecords()) {
// 设置token
tzsAuthService.setRequestContext();
// 调用规则
this.touchRuleToCalLevel(r); this.touchRuleToCalLevel(r);
} }
} }
...@@ -635,7 +645,7 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -635,7 +645,7 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
if (log.isInfoEnabled()) { if (log.isInfoEnabled()) {
log.info("调用规则对象!+:{}", JSON.toJSONString(cylWarningMsgDto)); log.info("调用规则对象!+:{}", JSON.toJSONString(cylWarningMsgDto));
} }
ruleTrigger.publish(cylWarningMsgDto, "气瓶监管/cylwarningmsg", null); ruleTrigger.publish(cylWarningMsgDto, packageId, null);
} catch (Exception e) { } catch (Exception e) {
log.error("调用规则失败!:{}", JSON.toJSONString(cylinderInfoDto)); log.error("调用规则失败!:{}", JSON.toJSONString(cylinderInfoDto));
} }
...@@ -655,6 +665,12 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind ...@@ -655,6 +665,12 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
return msgLogService.list(wrapper); return msgLogService.list(wrapper);
} }
/**
* 更新气瓶等级
* @param sequenceCode 唯一表设
* @param level 等级
* @return CylinderInfo
*/
public CylinderInfo updateEarlyWarningLevel(String sequenceCode, String level) { public CylinderInfo updateEarlyWarningLevel(String sequenceCode, String level) {
CylinderInfo cylinderInfo = this.getOne(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, sequenceCode)); CylinderInfo cylinderInfo = this.getOne(new LambdaQueryWrapper<CylinderInfo>().eq(CylinderInfo::getSequenceCode, sequenceCode));
cylinderInfo.setEarlyWarningLevel(level); cylinderInfo.setEarlyWarningLevel(level);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment