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

Loading…
Cancel
Save