Browse Source

# 消缺消息推送taskId为空的情况处理

zhongwei
haungxing 1 year ago
parent
commit
257de68668
  1. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java

@ -258,7 +258,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
*/ */
@Override @Override
public R listenAndUpdateDefect(ProcessWorkFlowResponse processWorkFlowResponse) { public R listenAndUpdateDefect(ProcessWorkFlowResponse processWorkFlowResponse) {
long taskId;
OperPhenomenonEntity operPhenomenonEntity; OperPhenomenonEntity operPhenomenonEntity;
log.info("消缺消息开始转换"); log.info("消缺消息开始转换");
try { try {
@ -291,6 +291,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
Long differTime = TimeUtils.getDifferTime(operPhenomenonEntity.getPlanStartTime(), operPhenomenonEntity.getPlanEndTime()); Long differTime = TimeUtils.getDifferTime(operPhenomenonEntity.getPlanStartTime(), operPhenomenonEntity.getPlanEndTime());
operPhenomenonEntity.setPlanHours(differTime.intValue()); operPhenomenonEntity.setPlanHours(differTime.intValue());
} }
taskId = operPhenomenonEntity.getId();
//缺陷库记录 //缺陷库记录
if (ObjectUtil.isNotEmpty(operPhenomenonEntity.getIsWarehousing()) && 1==(operPhenomenonEntity.getIsWarehousing())) { if (ObjectUtil.isNotEmpty(operPhenomenonEntity.getIsWarehousing()) && 1==(operPhenomenonEntity.getIsWarehousing())) {
OperDefectEntity operDefectEntity = new OperDefectEntity(); OperDefectEntity operDefectEntity = new OperDefectEntity();
@ -300,6 +301,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
operDefectEntity.setActHours(operPhenomenonEntity.getCheckHours()); operDefectEntity.setActHours(operPhenomenonEntity.getCheckHours());
} }
defectService.save(operDefectEntity); defectService.save(operDefectEntity);
taskId = operDefectEntity.getId();
log.info("缺陷ID:" + operPhenomenonEntity.getDefectCode() + "入库成功"); log.info("缺陷ID:" + operPhenomenonEntity.getDefectCode() + "入库成功");
operPhenomenonEntity.setCurrentOperator("流程结束"); operPhenomenonEntity.setCurrentOperator("流程结束");
operPhenomenonEntity.setCurrentLinkHandler(null); operPhenomenonEntity.setCurrentLinkHandler(null);
@ -317,19 +319,19 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper
statisticsService.updateById(statisticsEntity); statisticsService.updateById(statisticsEntity);
operAppearanceService.updateById(appearanceEntity); operAppearanceService.updateById(appearanceEntity);
//推送消息中心相关消息 //推送消息中心相关消息
sendMessage(processWorkFlowResponse, operPhenomenonEntity); sendMessage(processWorkFlowResponse, operPhenomenonEntity,taskId);
log.info("消缺消息转换结束"); log.info("消缺消息转换结束");
return R.success("消息保存成功"); return R.success("消息保存成功");
} }
private void sendMessage(ProcessWorkFlowResponse processWorkFlowResponse, OperPhenomenonEntity operPhenomenonEntity) { private void sendMessage(ProcessWorkFlowResponse processWorkFlowResponse, OperPhenomenonEntity operPhenomenonEntity,Long taskId) {
//推送消息 //推送消息
if (processWorkFlowResponse.getTaskId() != null) { if (processWorkFlowResponse.getTaskId() != null) {
BusinessMessageDTO message = new BusinessMessageDTO(); BusinessMessageDTO message = new BusinessMessageDTO();
message.setBusinessClassify("business"); message.setBusinessClassify("business");
message.setBusinessKey(MessageConstants.BusinessClassifyEnum.OPERATIONDEFECTMESSAGE.getKey()); message.setBusinessKey(MessageConstants.BusinessClassifyEnum.OPERATIONDEFECTMESSAGE.getKey());
message.setSubject(MessageConstants.BusinessClassifyEnum.OPERATIONDEFECTMESSAGE.getDescription()); message.setSubject(MessageConstants.BusinessClassifyEnum.OPERATIONDEFECTMESSAGE.getDescription());
message.setTaskId(operPhenomenonEntity.getId()); message.setTaskId(Optional.ofNullable(taskId).orElse(System.currentTimeMillis()));
message.setTenantId("200000"); message.setTenantId("200000");
String countent = String countent =
"您的消缺流程待审批!现象名称:".concat(Optional.ofNullable(operPhenomenonEntity.getFaultName()).orElse("")) "您的消缺流程待审批!现象名称:".concat(Optional.ofNullable(operPhenomenonEntity.getFaultName()).orElse(""))

Loading…
Cancel
Save