Browse Source

修正:工作流补偿

zhongwei
ty 4 months ago
parent
commit
256d8d6aaf
  1. 40
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java

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

@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -335,6 +337,10 @@ public class DefectCheckServiceImpl extends ServiceImpl<OperPhenomenonMapper, Op
long taskId; long taskId;
OperPhenomenonEntity operPhenomenonEntity; OperPhenomenonEntity operPhenomenonEntity;
log.info("消缺消息开始转换"+processWorkFlowResponse); log.info("消缺消息开始转换"+processWorkFlowResponse);
//流程找不到下一个审批人处理
if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
return handException(processWorkFlowResponse);
}
try { try {
Map<String, Object> variables = (Map<String, Object>) processWorkFlowResponse.getVariables(); Map<String, Object> variables = (Map<String, Object>) processWorkFlowResponse.getVariables();
//现象缺陷全表更新 //现象缺陷全表更新
@ -368,7 +374,6 @@ public class DefectCheckServiceImpl extends ServiceImpl<OperPhenomenonMapper, Op
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();
@ -384,14 +389,7 @@ public class DefectCheckServiceImpl extends ServiceImpl<OperPhenomenonMapper, Op
log.info("缺陷ID:" + operPhenomenonEntity.getDefectCode() + "入库成功"); log.info("缺陷ID:" + operPhenomenonEntity.getDefectCode() + "入库成功");
} }
//流程找不到下一个审批人处理
if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
operPhenomenonEntity.setIsNormal(false);
operPhenomenonEntity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
}else {
//推送消息中心相关消息
sendMessage(processWorkFlowResponse, operPhenomenonEntity,taskId);
}
//更新数据库 //更新数据库
Long statisticsEntityId = statisticsEntity.getId(); Long statisticsEntityId = statisticsEntity.getId();
Long appearanceEntityId = appearanceEntity.getId(); Long appearanceEntityId = appearanceEntity.getId();
@ -405,6 +403,30 @@ public class DefectCheckServiceImpl extends ServiceImpl<OperPhenomenonMapper, Op
statisticsService.updateById(statisticsEntity); statisticsService.updateById(statisticsEntity);
operAppearanceService.updateById(appearanceEntity); operAppearanceService.updateById(appearanceEntity);
log.info("消缺消息转换结束"+processWorkFlowResponse); log.info("消缺消息转换结束"+processWorkFlowResponse);
log.info("推送给用户消息"+processWorkFlowResponse);
//推送消息中心相关消息
sendMessage(processWorkFlowResponse, operPhenomenonEntity,operPhenomenonEntity.getId());
log.info("推送给消息结束");
return R.success("消息保存成功");
}
private R handException(ProcessWorkFlowResponse processWorkFlowResponse) {
String[] split = processWorkFlowResponse.getBusinessKey().split("hzims_oper_phenomenon");
if (StringUtils.isBlank(split[1])){
log.error("消缺异常处理失败,未找到"+ processWorkFlowResponse);
return R.fail("消缺异常处理失败");
}
OperPhenomenonEntity operPhenomenonEntity = this.baseMapper.selectOne(new LambdaQueryWrapper<OperPhenomenonEntity>() {{
eq(OperPhenomenonEntity::getCheckProcessInstanceId, split[1]);
}});
operPhenomenonEntity.setIsNormal(false);
operPhenomenonEntity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
operPhenomenonEntity.setCurrentOperator("流程异常");
operPhenomenonEntity.setCurrentLinkHandler("");
this.baseMapper.update(operPhenomenonEntity, new LambdaUpdateWrapper<OperPhenomenonEntity>() {{
eq(OperPhenomenonEntity::getDefectCode, operPhenomenonEntity.getDefectCode());
}});
log.info("消缺消息转换结束"+ processWorkFlowResponse);
return R.success("消息保存成功"); return R.success("消息保存成功");
} }

Loading…
Cancel
Save