|
@@ -54,41 +54,43 @@ public class MyJobListener implements JobListener {
|
|
|
try {
|
|
|
JobDataMap map = context.getJobDetail().getJobDataMap();
|
|
|
TSJobRemindService tsJobRemindService = SpringContextHolder.getBean(TSJobRemindService.class);
|
|
|
- TSJobRemind tsJobRemind = (TSJobRemind) map.get(SystemConstant.JOB_DATA);
|
|
|
- tsJobRemind = tsJobRemindService.getById(tsJobRemind.getId());
|
|
|
- if (Objects.nonNull(tsJobRemind)) {
|
|
|
- tsJobRemind.setEnable(false);
|
|
|
- tsJobRemindService.updateById(tsJobRemind);
|
|
|
- TSJobLogService tsJobLogService = SpringContextHolder.getBean(TSJobLogService.class);
|
|
|
- TSJobLog tsJobLog = new TSJobLog(tsJobRemind);
|
|
|
- tsJobLogService.save(tsJobLog);
|
|
|
+ TSJobRemind tsJobRemindTask = (TSJobRemind) map.get(SystemConstant.JOB_DATA);
|
|
|
+ if (Objects.nonNull(tsJobRemindTask)) {
|
|
|
+ TSJobRemind tsJobRemind = tsJobRemindService.getById(tsJobRemindTask.getId());
|
|
|
+ if (Objects.nonNull(tsJobRemind)) {//数据还在则说明要发送提醒短信
|
|
|
+ tsJobRemind.setEnable(false);
|
|
|
+ tsJobRemindService.updateById(tsJobRemind);
|
|
|
+ TSJobLogService tsJobLogService = SpringContextHolder.getBean(TSJobLogService.class);
|
|
|
+ TSJobLog tsJobLog = new TSJobLog(tsJobRemind);
|
|
|
+ tsJobLogService.save(tsJobLog);
|
|
|
|
|
|
- //往延期预警表插数据
|
|
|
- if (tsJobRemind.getType() == JobQuartzTypeEnum.FLOW
|
|
|
- && tsJobRemind.getRemindType() == JobTypeEnum.AFTER) {
|
|
|
- TFCustomFlowEntityService tfCustomFlowEntityService = SpringContextHolder.getBean(
|
|
|
- TFCustomFlowEntityService.class);
|
|
|
- TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
|
|
|
- new QueryWrapper<TFCustomFlowEntity>().lambda()
|
|
|
- .eq(TFCustomFlowEntity::getCode, tsJobRemind.getCode()));
|
|
|
- Optional.ofNullable(tfCustomFlowEntity)
|
|
|
- .orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
|
|
|
+ //往延期预警表插数据
|
|
|
+ if (tsJobRemind.getType() == JobQuartzTypeEnum.FLOW
|
|
|
+ && tsJobRemind.getRemindType() == JobTypeEnum.AFTER) {
|
|
|
+ TFCustomFlowEntityService tfCustomFlowEntityService = SpringContextHolder.getBean(
|
|
|
+ TFCustomFlowEntityService.class);
|
|
|
+ TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(
|
|
|
+ new QueryWrapper<TFCustomFlowEntity>().lambda()
|
|
|
+ .eq(TFCustomFlowEntity::getCode, tsJobRemind.getCode()));
|
|
|
+ Optional.ofNullable(tfCustomFlowEntity)
|
|
|
+ .orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
|
|
|
|
|
|
- if (tsJobRemind.getCode().contains(SystemConstant.SOP)) {
|
|
|
- TBDelayWarnService tbDelayWarnService = SpringContextHolder.getBean(
|
|
|
- TBDelayWarnService.class);
|
|
|
- SequenceService sequenceService = SpringContextHolder.getBean(SequenceService.class);
|
|
|
+ if (tsJobRemind.getCode().contains(SystemConstant.SOP)) {
|
|
|
+ TBDelayWarnService tbDelayWarnService = SpringContextHolder.getBean(
|
|
|
+ TBDelayWarnService.class);
|
|
|
+ SequenceService sequenceService = SpringContextHolder.getBean(SequenceService.class);
|
|
|
|
|
|
- TBSopInfoService tbSopInfoService = SpringContextHolder.getBean(TBSopInfoService.class);
|
|
|
- TBSopInfo tbSopInfo = tbSopInfoService.getById(tfCustomFlowEntity.getObjId());
|
|
|
- Optional.ofNullable(tbSopInfo)
|
|
|
- .orElseThrow(() -> ExceptionResultEnum.SOP_INFO_NO_DATA.exception());
|
|
|
+ TBSopInfoService tbSopInfoService = SpringContextHolder.getBean(TBSopInfoService.class);
|
|
|
+ TBSopInfo tbSopInfo = tbSopInfoService.getById(tfCustomFlowEntity.getObjId());
|
|
|
+ Optional.ofNullable(tbSopInfo)
|
|
|
+ .orElseThrow(() -> ExceptionResultEnum.SOP_INFO_NO_DATA.exception());
|
|
|
|
|
|
- String code = DelayWarnSeqTypeEnum.DELAY_WARN.getMark() + sequenceService.createCode(
|
|
|
- DelayWarnSeqTypeEnum.DELAY_WARN.getCode());
|
|
|
- tbDelayWarnService.save(new TBDelayWarn(tbSopInfo.getCrmNo(), tbSopInfo.getSopNo(),
|
|
|
- tbSopInfo.getServiceId(), code, tsJobLog.getCreateTime(),
|
|
|
- tsJobRemind.getReceiveUserId(), tsJobRemind.getExecField()));
|
|
|
+ String code = DelayWarnSeqTypeEnum.DELAY_WARN.getMark() + sequenceService.createCode(
|
|
|
+ DelayWarnSeqTypeEnum.DELAY_WARN.getCode());
|
|
|
+ tbDelayWarnService.save(new TBDelayWarn(tbSopInfo.getCrmNo(), tbSopInfo.getSopNo(),
|
|
|
+ tbSopInfo.getServiceId(), code, tsJobLog.getCreateTime(),
|
|
|
+ tsJobRemind.getReceiveUserId(), tsJobRemind.getExecField()));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|