Browse Source

新增:补偿流程修改

zhongwei
ty 5 months ago
parent
commit
6ccdd59d76
  1. 27
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleFlowServiceImpl.java
  2. 4
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java
  3. 2
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java
  4. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/feign/CompensateProcessClient.java
  5. 16
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/abstracts/ProcessAbstractService.java
  6. 2
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/service/ProcessService.java
  7. 27
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java
  8. 29
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java
  9. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/DefectCheckServiceImpl.java
  10. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/feign/DutyRecClient.java
  11. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyRecService.java
  12. 49
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java
  13. 2
      hzims-service/operational/src/main/resources/db/3.0.1.sql
  14. 32
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardTaskServiceImpl.java

27
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleFlowServiceImpl.java

@ -2,6 +2,8 @@ package com.hnac.hzims.alarm.show.service.impl;
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.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;
import com.hnac.hzims.alarm.config.constants.AlarmHandleConstant; import com.hnac.hzims.alarm.config.constants.AlarmHandleConstant;
@ -13,6 +15,7 @@ import com.hnac.hzims.alarm.show.service.AlarmHandleFlowService;
import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.fdp.feign.IFdpDiagnoseClient; import com.hnac.hzims.fdp.feign.IFdpDiagnoseClient;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
@ -63,6 +66,9 @@ public class AlarmHandleFlowServiceImpl extends ServiceImpl<AlarmHandleFlowMappe
log.info("告警消息转换失败:" + e.getMessage()); log.info("告警消息转换失败:" + e.getMessage());
return R.fail("告警消息转换失败"); return R.fail("告警消息转换失败");
} }
if (ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
return handException(processWorkFlowResponse);
}
taskId = alarmHandleFlowEntity.getId(); taskId = alarmHandleFlowEntity.getId();
alarmHandleFlowEntity.setIsNormal(true); alarmHandleFlowEntity.setIsNormal(true);
if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){ if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
@ -122,14 +128,29 @@ public class AlarmHandleFlowServiceImpl extends ServiceImpl<AlarmHandleFlowMappe
} }
this.updateById(alarmHandleFlowEntity); this.updateById(alarmHandleFlowEntity);
//推送消息中心相关消息 //推送消息中心相关消息
if(ObjectUtils.isEmpty(processWorkFlowResponse.getCode())||700!=processWorkFlowResponse.getCode()) {
sendMessage(processWorkFlowResponse, alarmHandleFlowEntity, taskId); sendMessage(processWorkFlowResponse, alarmHandleFlowEntity, taskId);
}
log.info("告警消息转换结束" + processWorkFlowResponse); log.info("告警消息转换结束" + processWorkFlowResponse);
return R.success("消息保存成功"); return R.success("消息保存成功");
} }
private R handException(ProcessWorkFlowResponse processWorkFlowResponse) {
String[] split = processWorkFlowResponse.getBusinessKey().split(":");
if (StringUtils.isBlank(split[1])){
log.error("补偿流程处理失败,未找到BusinessKey:"+ processWorkFlowResponse);
return R.fail("补偿流程处理失败");
}
AlarmHandleFlowEntity alarmHandleFlowEntity = this.baseMapper.selectOne(new LambdaQueryWrapper<AlarmHandleFlowEntity>() {{
eq(AlarmHandleFlowEntity::getId, split[1]);
}});
alarmHandleFlowEntity.setIsNormal(false);
alarmHandleFlowEntity.setProcessInstanceId(processWorkFlowResponse.getTaskId());
alarmHandleFlowEntity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
alarmHandleFlowEntity.setCurrentOperator(processWorkFlowResponse.getTaskName());
alarmHandleFlowEntity.setCurrentLinkHandler("");
this.baseMapper.updateById(alarmHandleFlowEntity);
log.info("补偿流程消息转换结束"+ processWorkFlowResponse);
return R.success("补偿流程消息保存成功");
}
private void sendMessage(ProcessWorkFlowResponse processWorkFlowResponse, AlarmHandleFlowEntity alarmHandleFlowEntity, Long taskId) { private void sendMessage(ProcessWorkFlowResponse processWorkFlowResponse, AlarmHandleFlowEntity alarmHandleFlowEntity, Long taskId) {
//推送消息 //推送消息
if (processWorkFlowResponse.getTaskId() != null) { if (processWorkFlowResponse.getTaskId() != null) {

4
hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java

@ -159,9 +159,9 @@ public class AlarmHandleServiceImpl extends ServiceImpl<AlarmHandleMapper, Alarm
} }
R result = compensateProcessClient.startFlow(AuthUtil.getUserId().toString(),AlarmHandleConstant.dealAlarm, businessKey, processName, variables); R result = compensateProcessClient.startFlow(AuthUtil.getUserId().toString(),AlarmHandleConstant.dealAlarm, businessKey, processName, variables);
// 流程开启失败 // 流程开启失败
if (200!=result.getCode()) { if (ObjectUtils.isNotEmpty(result.getCode())&&200!=result.getCode()) {
param.setIsNormal(false); param.setIsNormal(false);
param.setRemark(JSONObject.toJSONString(variable)); param.setRemark(variable);
alarmHandleFlowMapper.updateById(param); alarmHandleFlowMapper.updateById(param);
R r=new R(); R r=new R();
r.setCode(result.getCode()); r.setCode(result.getCode());

2
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/consumer/StandardWorkTicketConsumer.java

@ -49,7 +49,7 @@ public class StandardWorkTicketConsumer implements IQueueConsume {
throw new ServiceException("消息转换失败,消息内容为:" + message); throw new ServiceException("消息转换失败,消息内容为:" + message);
}); });
if (ObjectUtils.isNotEmpty(response.getCode())&&700==response.getCode()){ if (ObjectUtils.isNotEmpty(response.getCode())&&700==response.getCode()){
ticketServiceList.get(0).pushFailMessage(response.getTaskId(),response.getProcessDefinitionKey(), ticketServiceList.get(0).pushFailMessage(response.getBusinessKey(),response.getProcessDefinitionKey(),
response.getTaskName(),response.getResult(),response.getDeptId()); response.getTaskName(),response.getResult(),response.getDeptId());
} }
// 保存日志 // 保存日志

4
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/feign/CompensateProcessClient.java

@ -33,9 +33,9 @@ public class CompensateProcessClient implements ICompensateProcessClient {
@PostMapping("/startFlow") @PostMapping("/startFlow")
public R startFlow(@RequestParam("userId") String userId, public R startFlow(@RequestParam("userId") String userId,
@RequestParam("dictValue")String dictValue, @RequestParam("dictValue")String dictValue,
@RequestParam("taskId")String taskId, @RequestParam("businessKey")String businessKey,
@RequestParam("processName")String processName, @RequestParam("processName")String processName,
@RequestBody Map<String, Object> variables) { @RequestBody Map<String, Object> variables) {
return processService.startFlow(userId,dictValue,taskId,processName,variables); return processService.startFlow(userId,dictValue,businessKey,processName,variables);
} }
} }

16
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/abstracts/ProcessAbstractService.java

@ -44,11 +44,11 @@ public abstract class ProcessAbstractService implements ProcessService {
private ProcessDictService processDictService; private ProcessDictService processDictService;
@Override @Override
public R startFlow(String userId, String dictValue, String taskId, String processName, Map<String, Object> variables) { public R startFlow(String userId, String dictValue, String businessKey, String processName, Map<String, Object> variables) {
log.info("开启流程....."); log.info("开启流程.....");
R r = new R(); R r = new R();
try { try {
R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey(dictValue, taskId, processName, variables); R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey(dictValue, businessKey, processName, variables);
r.setSuccess(result.isSuccess()); r.setSuccess(result.isSuccess());
r.setCode(result.getCode()); r.setCode(result.getCode());
r.setMsg(result.getMsg()); r.setMsg(result.getMsg());
@ -61,7 +61,7 @@ public abstract class ProcessAbstractService implements ProcessService {
log.error("开启流程失败:{}",result); log.error("开启流程失败:{}",result);
log.error("流程信息为{}",variables); log.error("流程信息为{}",variables);
r.setData(variables); r.setData(variables);
pushStartFailMessage(dictValue,taskId,userId,processName,result.getMsg()); pushStartFailMessage(dictValue,businessKey,userId,processName,result.getMsg());
} }
return r; return r;
}catch (Exception e){ }catch (Exception e){
@ -86,11 +86,11 @@ public abstract class ProcessAbstractService implements ProcessService {
// return r; // return r;
// } // }
public void pushStartFailMessage(String dictValue,String taskId, String userId, String content,String reason) { public void pushStartFailMessage(String dictValue,String businessKey, String userId, String content,String reason) {
ProcessDict processDict = processDictService.selectDictLabelByKey(dictValue); ProcessDict processDict = processDictService.selectDictLabelByKey(dictValue);
BusinessMessageFlowDTO message = new BusinessMessageFlowDTO(); BusinessMessageFlowDTO message = new BusinessMessageFlowDTO();
// 计划Id // 计划Id
message.setTaskId(taskId); message.setTaskId(businessKey);
message.setBusinessClassify(MessageConstants.BusinessClassifyEnum.BUSINESS.getKey()); message.setBusinessClassify(MessageConstants.BusinessClassifyEnum.BUSINESS.getKey());
message.setBusinessKey(MessageConstants.BusinessClassifyEnum.BUSINESS.getKey()); message.setBusinessKey(MessageConstants.BusinessClassifyEnum.BUSINESS.getKey());
// 主题 // 主题
@ -113,18 +113,18 @@ public abstract class ProcessAbstractService implements ProcessService {
} }
@Override @Override
public void pushFailMessage(String taskId, String proessKey, String content,String reason,String deptId) { public void pushFailMessage(String businessKey, String proessKey, String content,String reason,String deptId) {
ProcessDict processDict = processDictService.selectDictLabelByKey(proessKey); ProcessDict processDict = processDictService.selectDictLabelByKey(proessKey);
BusinessMessageFlowDTO message = new BusinessMessageFlowDTO(); BusinessMessageFlowDTO message = new BusinessMessageFlowDTO();
// BusinessMessageDTO message = new BusinessMessageDTO(); // BusinessMessageDTO message = new BusinessMessageDTO();
// 计划Id // 计划Id
message.setTaskId(taskId); message.setTaskId(businessKey);
message.setBusinessClassify(MessageConstants.BusinessClassifyEnum.BUSINESS.getKey()); message.setBusinessClassify(MessageConstants.BusinessClassifyEnum.BUSINESS.getKey());
message.setBusinessKey(MessageConstants.BusinessClassifyEnum.BUSINESS.getKey()); message.setBusinessKey(MessageConstants.BusinessClassifyEnum.BUSINESS.getKey());
// 主题 // 主题
message.setSubject(MessageConstants.BusinessClassifyEnum.BUSINESS.getDescription()); message.setSubject(MessageConstants.BusinessClassifyEnum.BUSINESS.getDescription());
// 内容 // 内容
String res= StringUtil.format("你有一个{}的{}流程流转失败,失败原因为:{}",content, String res= StringUtil.format("你有一个流程环节为{}的{}流转失败,失败原因为:{}",content,
processDict.getDictLabel(), reason); processDict.getDictLabel(), reason);
message.setContent(res); message.setContent(res);
message.setTenantId("200000"); message.setTenantId("200000");

2
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/service/ProcessService.java

@ -14,7 +14,7 @@ import java.util.Map;
*/ */
public interface ProcessService { public interface ProcessService {
R startFlow(String userId, String dictValue, String taskId, String processName, Map<String, Object> variables) ; R startFlow(String userId, String dictValue, String businessKey, String processName, Map<String, Object> variables) ;
void pushFailMessage(String taskId, String proessKey, String content,String reason,String deptId); void pushFailMessage(String taskId, String proessKey, String content,String reason,String deptId);
/** /**

27
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java

@ -121,7 +121,6 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service, StartProces
private final TransactionTemplate transactionTemplate; private final TransactionTemplate transactionTemplate;
@Override @Override
public String saveEntity(String entity) { public String saveEntity(String entity) {
transactionTemplate.setTransactionManager(transactionManager); transactionTemplate.setTransactionManager(transactionManager);
String res = transactionTemplate.execute(status -> { String res = transactionTemplate.execute(status -> {
AccessPlanV4DTO accessPlanV4DTO = JSONObject.parseObject(entity, AccessPlanV4DTO.class); AccessPlanV4DTO accessPlanV4DTO = JSONObject.parseObject(entity, AccessPlanV4DTO.class);
@ -289,8 +288,8 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service, StartProces
entity.setNextStepOperator(processWorkFlowResponse.getNextStepOperator()); entity.setNextStepOperator(processWorkFlowResponse.getNextStepOperator());
entity.setIsNormal(true); entity.setIsNormal(true);
if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){ if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
entity.setIsNormal(false); handException(processWorkFlowResponse);
entity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables())); return false;
} }
if(ObjectUtil.isNotEmpty(variables.get("examine")) && (Boolean) variables.get("examine")){ if(ObjectUtil.isNotEmpty(variables.get("examine")) && (Boolean) variables.get("examine")){
entity.setTaskName("流程结束"); entity.setTaskName("流程结束");
@ -322,7 +321,27 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service, StartProces
} }
return true; return true;
} }
private R handException(ProcessWorkFlowResponse processWorkFlowResponse) {
String[] split = processWorkFlowResponse.getBusinessKey().split(":");
if (StringUtils.isBlank(split[1])){
log.error("异常消息转换失败,未找到BusinessKey:"+ processWorkFlowResponse);
return R.fail("异常消息处理失败");
}
OperAccessPlanEntity operAccessPlanEntity = planService.getOne(new LambdaQueryWrapper<OperAccessPlanEntity>() {{
eq(OperAccessPlanEntity::getId, split[1]);
}});
operAccessPlanEntity.setIsNormal(false);
operAccessPlanEntity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
operAccessPlanEntity.setTaskName(processWorkFlowResponse.getTaskName());
operAccessPlanEntity.setProcessInstanceId(processWorkFlowResponse.getTaskId());
operAccessPlanEntity.setNextStepOperator("");
boolean flag = planService.updateById(operAccessPlanEntity);
if (!flag){
log.info("异常状态消息保存失败"+ processWorkFlowResponse);
return R.success("消息保存失败");
}
return R.fail("消息保存成功");
}
/** /**
* 开启检修任务 * 开启检修任务

29
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java

@ -131,7 +131,7 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service, StartProces
String.valueOf(accessTaskV4DTO.getId())), accessTaskV4DTO.getName(),variables); String.valueOf(accessTaskV4DTO.getId())), accessTaskV4DTO.getName(),variables);
log.error("开启检修任务流程失败{}" + result); log.error("开启检修任务流程失败{}" + result);
// 更新任务流程Id // 更新任务流程Id
if (200==result.getCode()) { if (200==result.getCode()&&ObjectUtil.isNotEmpty(result.getData())) {
accessTaskV4DTO.setProcessInstanceId(result.getData().toString()); accessTaskV4DTO.setProcessInstanceId(result.getData().toString());
accessTaskV4DTO.setIsNormal(true); accessTaskV4DTO.setIsNormal(true);
taskService.updateById(accessTaskV4DTO); taskService.updateById(accessTaskV4DTO);
@ -237,8 +237,8 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service, StartProces
AccessTaskV4DTO entity = JSONObject.parseObject(JSONObject.toJSONString(variables), new TypeReference<AccessTaskV4DTO>(){}); AccessTaskV4DTO entity = JSONObject.parseObject(JSONObject.toJSONString(variables), new TypeReference<AccessTaskV4DTO>(){});
entity.setIsNormal(true); entity.setIsNormal(true);
if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){ if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
entity.setIsNormal(false); handException(processWorkFlowResponse);
entity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables())); return false;
} }
// 当前流程名称 // 当前流程名称
entity.setTaskName(processWorkFlowResponse.getTaskName()); entity.setTaskName(processWorkFlowResponse.getTaskName());
@ -266,12 +266,31 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service, StartProces
String content = "您有一条检修任务待处理/审核,检修任务名称:".concat(entity.getName()) String content = "您有一条检修任务待处理/审核,检修任务名称:".concat(entity.getName())
.concat(",当前环节:") .concat(",当前环节:")
.concat(processWorkFlowResponse.getTaskName()); .concat(processWorkFlowResponse.getTaskName());
if(ObjectUtils.isEmpty(processWorkFlowResponse.getCode())||700!=processWorkFlowResponse.getCode()){
this.sendMessage(entity,processWorkFlowResponse.getUserId(),content); this.sendMessage(entity,processWorkFlowResponse.getUserId(),content);
}
return true; return true;
} }
private R handException(ProcessWorkFlowResponse processWorkFlowResponse) {
String[] split = processWorkFlowResponse.getBusinessKey().split(":");
if (StringUtils.isBlank(split[1])){
log.error("异常消息转换失败,未找到BusinessKey:"+ processWorkFlowResponse);
return R.fail("异常消息处理失败");
}
OperAccessTaskEntity operAccessTaskEntity = taskService.getOne(new LambdaQueryWrapper<OperAccessTaskEntity>() {{
eq(OperAccessTaskEntity::getId, split[1]);
}});
operAccessTaskEntity.setIsNormal(false);
operAccessTaskEntity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
operAccessTaskEntity.setTaskName(processWorkFlowResponse.getTaskName());
operAccessTaskEntity.setProcessInstanceId(processWorkFlowResponse.getTaskId());
operAccessTaskEntity.setNextStepOperator("");
boolean flag = taskService.updateById(operAccessTaskEntity);
if (!flag){
log.info("异常状态消息保存失败"+ processWorkFlowResponse);
return R.success("消息保存失败");
}
return R.fail("消息保存成功");
}
/** /**
* 推送业务流程消息 * 推送业务流程消息

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

@ -411,17 +411,18 @@ public class DefectCheckServiceImpl extends ServiceImpl<OperPhenomenonMapper, Op
} }
private R handException(ProcessWorkFlowResponse processWorkFlowResponse) { private R handException(ProcessWorkFlowResponse processWorkFlowResponse) {
String[] split = processWorkFlowResponse.getBusinessKey().split("hzims_oper_phenomenon"); String[] split = processWorkFlowResponse.getBusinessKey().split(":");
if (StringUtils.isBlank(split[1])){ if (StringUtils.isBlank(split[1])){
log.error("消缺异常处理失败,未找到"+ processWorkFlowResponse); log.error("消缺异常处理失败,未找到BusinessKey:"+ processWorkFlowResponse);
return R.fail("消缺异常处理失败"); return R.fail("消缺异常处理失败");
} }
OperPhenomenonEntity operPhenomenonEntity = this.baseMapper.selectOne(new LambdaQueryWrapper<OperPhenomenonEntity>() {{ OperPhenomenonEntity operPhenomenonEntity = this.baseMapper.selectOne(new LambdaQueryWrapper<OperPhenomenonEntity>() {{
eq(OperPhenomenonEntity::getCheckProcessInstanceId, split[1]); eq(OperPhenomenonEntity::getId, split[1]);
}}); }});
operPhenomenonEntity.setIsNormal(false); operPhenomenonEntity.setIsNormal(false);
operPhenomenonEntity.setCheckProcessInstanceId(processWorkFlowResponse.getTaskId());
operPhenomenonEntity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables())); operPhenomenonEntity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
operPhenomenonEntity.setCurrentOperator("流程异常"); operPhenomenonEntity.setCurrentOperator(processWorkFlowResponse.getTaskName());
operPhenomenonEntity.setCurrentLinkHandler(""); operPhenomenonEntity.setCurrentLinkHandler("");
this.baseMapper.update(operPhenomenonEntity, new LambdaUpdateWrapper<OperPhenomenonEntity>() {{ this.baseMapper.update(operPhenomenonEntity, new LambdaUpdateWrapper<OperPhenomenonEntity>() {{
eq(OperPhenomenonEntity::getDefectCode, operPhenomenonEntity.getDefectCode()); eq(OperPhenomenonEntity::getDefectCode, operPhenomenonEntity.getDefectCode());

14
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/feign/DutyRecClient.java

@ -32,18 +32,6 @@ public class DutyRecClient implements IDutyRecClient {
@Override @Override
public R dealDutyRecFlow(ProcessWorkFlowResponse processWorkFlowResponse) { public R dealDutyRecFlow(ProcessWorkFlowResponse processWorkFlowResponse) {
log.info("operational:duty:rec:dealDutyRecFlow","接受到消息:消息内容为:"+ JSON.toJSONString(processWorkFlowResponse)); return service.dealDutyRecFlow(processWorkFlowResponse);
//ImsDutyRecDTO recDTO = BeanUtil.copy(processWorkFlowResponse.getVariables(),ImsDutyRecDTO.class);
ImsDutyRecDTO recDTO = JSONObject.parseObject(JSON.toJSONString(processWorkFlowResponse.getVariables()),ImsDutyRecDTO.class);
Assert.isTrue(ObjectUtil.isNotEmpty(recDTO),() -> {
throw new RuntimeException("未接收到交接班信息!");
});
recDTO.setDealChain(processWorkFlowResponse.getTaskName());
recDTO.setIsNormal(true);
if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
recDTO.setIsNormal(false);
recDTO.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
}
return R.status(service.dealDutyRecFlow(recDTO));
} }
} }

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyRecService.java

@ -2,6 +2,7 @@ package com.hnac.hzims.operational.duty.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.duty.dto.ChangeShiftsReqDTO; import com.hnac.hzims.operational.duty.dto.ChangeShiftsReqDTO;
import com.hnac.hzims.operational.duty.dto.ChangeShiftsRspDTO; import com.hnac.hzims.operational.duty.dto.ChangeShiftsRspDTO;
import com.hnac.hzims.operational.duty.dto.ImsDutyRecDTO; import com.hnac.hzims.operational.duty.dto.ImsDutyRecDTO;
@ -130,7 +131,7 @@ public interface IImsDutyRecService extends IService<ImsDutyRecEntity> {
* @param recDTO 交接班信息 * @param recDTO 交接班信息
* @return * @return
*/ */
Boolean dealDutyRecFlow(ImsDutyRecDTO recDTO); R dealDutyRecFlow(ProcessWorkFlowResponse processWorkFlowResponse);
R<ImsDutyLogEntity> getDutyLog(ImsDutyLogEntity imsDutyLogEntity); R<ImsDutyLogEntity> getDutyLog(ImsDutyLogEntity imsDutyLogEntity);

49
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyRecServiceImpl.java

@ -10,10 +10,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.hnac.hzims.common.flow.StartProcessService; import com.hnac.hzims.common.flow.StartProcessService;
import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.middle.process.feign.ICompensateProcessClient; import com.hnac.hzims.middle.process.feign.ICompensateProcessClient;
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.monitor.utils.DateUtils; import com.hnac.hzims.monitor.utils.DateUtils;
import com.hnac.hzims.operational.OperationalConstants; import com.hnac.hzims.operational.OperationalConstants;
import com.hnac.hzims.operational.access.dto.AccessTaskV4DTO; import com.hnac.hzims.operational.access.dto.AccessTaskV4DTO;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.defect.constants.TreatMethodConstant; import com.hnac.hzims.operational.defect.constants.TreatMethodConstant;
import com.hnac.hzims.operational.defect.entity.OperAppearanceEntity; import com.hnac.hzims.operational.defect.entity.OperAppearanceEntity;
import com.hnac.hzims.operational.defect.entity.OperDefectStatisticsEntity; import com.hnac.hzims.operational.defect.entity.OperDefectStatisticsEntity;
@ -1321,8 +1324,19 @@ public class ImsDutyRecServiceImpl extends ServiceImpl<ImsDutyRecMapper, ImsDuty
} }
@Override @Override
//@Transactional public R dealDutyRecFlow(ProcessWorkFlowResponse processWorkFlowResponse) {
public Boolean dealDutyRecFlow(ImsDutyRecDTO recDTO) { log.info("operational:duty:rec:dealDutyRecFlow","接受到消息:消息内容为:"+ JSON.toJSONString(processWorkFlowResponse));
//ImsDutyRecDTO recDTO = BeanUtil.copy(processWorkFlowResponse.getVariables(),ImsDutyRecDTO.class);
ImsDutyRecDTO recDTO = JSONObject.parseObject(JSON.toJSONString(processWorkFlowResponse.getVariables()),ImsDutyRecDTO.class);
Assert.isTrue(ObjectUtil.isNotEmpty(recDTO),() -> {
throw new RuntimeException("未接收到交接班信息!");
});
recDTO.setDealChain(processWorkFlowResponse.getTaskName());
recDTO.setIsNormal(true);
if(ObjectUtil.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
handException(processWorkFlowResponse);
}
ImsDutyMainEntity headDutyMain = BeanUtil.copy(recDTO.getHeadDutyMainVo(), ImsDutyMainEntity.class); ImsDutyMainEntity headDutyMain = BeanUtil.copy(recDTO.getHeadDutyMainVo(), ImsDutyMainEntity.class);
ImsDutyMainEntity carryDutyMain = BeanUtil.copy(recDTO.getCarryDutyMainVo(), ImsDutyMainEntity.class); ImsDutyMainEntity carryDutyMain = BeanUtil.copy(recDTO.getCarryDutyMainVo(), ImsDutyMainEntity.class);
if(StringUtil.isBlank(recDTO.getDealChain())) { if(StringUtil.isBlank(recDTO.getDealChain())) {
@ -1366,13 +1380,36 @@ public class ImsDutyRecServiceImpl extends ServiceImpl<ImsDutyRecMapper, ImsDuty
} }
// 更新交接班 // 更新交接班
if (ObjectUtil.isNotEmpty(dutyRec)&&ObjectUtil.isNotEmpty(dutyRec.getId())) { if (ObjectUtil.isNotEmpty(dutyRec)&&ObjectUtil.isNotEmpty(dutyRec.getId())) {
return this.updateById(dutyRec); boolean b = this.updateById(dutyRec);
}else { if (b){
log.error("更新交接班记录失败"+dutyRec.toString()); return R.success("更新交接班记录成功");
return false;
} }
} }
log.error("更新交接班记录失败"+dutyRec.toString());
return R.fail("更新交接班记录失败");
}
private R handException(ProcessWorkFlowResponse processWorkFlowResponse) {
String[] split = processWorkFlowResponse.getBusinessKey().split(":");
if (StringUtils.isBlank(split[1])){
log.error("异常消息转换失败,未找到BusinessKey:"+ processWorkFlowResponse);
return R.fail("异常消息处理失败");
}
ImsDutyRecEntity imsDutyRecEntity = this.getOne(new LambdaQueryWrapper<ImsDutyRecEntity>() {{
eq(ImsDutyRecEntity::getId, split[1]);
}});
imsDutyRecEntity.setIsNormal(false);
imsDutyRecEntity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
imsDutyRecEntity.setDealChain(processWorkFlowResponse.getTaskName());
imsDutyRecEntity.setProcessInstanceId(processWorkFlowResponse.getTaskId());
boolean flag = this.updateById(imsDutyRecEntity);
if (!flag){
log.info("异常状态消息保存失败"+ processWorkFlowResponse);
return R.success("消息保存失败");
}
return R.fail("消息保存成功");
}
/** /**
* 计算交接班状态 * 计算交接班状态
* @param duty 值班信息 * @param duty 值班信息

2
hzims-service/operational/src/main/resources/db/3.0.1.sql

@ -1,5 +1,7 @@
ALTER TABLE `hzims_oper_phenomenon` ALTER TABLE `hzims_oper_phenomenon`
MODIFY COLUMN `REMARK` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '冗余字段' ; MODIFY COLUMN `REMARK` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '冗余字段' ;
ALTER TABLE `hzims_oper_phenomenon`
ADD COLUMN `is_normal` tinyint(2) NULL DEFAULT 1 ;
ALTER TABLE `hz_ims_duty_rec` ALTER TABLE `hz_ims_duty_rec`
ADD COLUMN `is_normal` tinyint(2) NULL DEFAULT 1 ; ADD COLUMN `is_normal` tinyint(2) NULL DEFAULT 1 ;
ALTER TABLE `hzims_oper_access_task` ALTER TABLE `hzims_oper_access_task`

32
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/risk/service/impl/HazardTaskServiceImpl.java

@ -3,6 +3,7 @@ package com.hnac.hzims.safeproduct.risk.service.impl;
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.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
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;
@ -216,6 +217,12 @@ public class HazardTaskServiceImpl extends ServiceImpl<HazardTaskMapper, HazardT
public boolean listener(ProcessWorkFlowResponse processWorkFlowResponse) { public boolean listener(ProcessWorkFlowResponse processWorkFlowResponse) {
// 流程参数获取 // 流程参数获取
Map<String, Object> variables = (Map<String, Object>) processWorkFlowResponse.getVariables(); Map<String, Object> variables = (Map<String, Object>) processWorkFlowResponse.getVariables();
//流程找不到下一个审批人处理
if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
handException(processWorkFlowResponse);
log.info("风险排查流程补偿流程处理完毕");
return false;
}
// 对象转换 // 对象转换
HazardRiskProcessDTO entity = JSONObject.parseObject(JSONObject.toJSONString(variables), new TypeReference<HazardRiskProcessDTO>(){}); HazardRiskProcessDTO entity = JSONObject.parseObject(JSONObject.toJSONString(variables), new TypeReference<HazardRiskProcessDTO>(){});
try{ try{
@ -238,11 +245,7 @@ public class HazardTaskServiceImpl extends ServiceImpl<HazardTaskMapper, HazardT
entity.setNextStepOperator("流程结束,无需人员处理"); entity.setNextStepOperator("流程结束,无需人员处理");
} }
entity.setIsNormal(true); entity.setIsNormal(true);
//流程找不到下一个审批人处理
if(ObjectUtils.isNotEmpty(processWorkFlowResponse.getCode())&&700==processWorkFlowResponse.getCode()){
entity.setIsNormal(false);
entity.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
}
// 更新风险排查任务信息 // 更新风险排查任务信息
this.updateById(entity); this.updateById(entity);
if(HazardRiskConstants.HAZARD_RISK_NEW_PROPERTY_1.equals(variables.get(HazardRiskConstants.HAZARD_RISK_NEW_PROPERTY)) || if(HazardRiskConstants.HAZARD_RISK_NEW_PROPERTY_1.equals(variables.get(HazardRiskConstants.HAZARD_RISK_NEW_PROPERTY)) ||
@ -259,7 +262,24 @@ public class HazardTaskServiceImpl extends ServiceImpl<HazardTaskMapper, HazardT
} }
return true; return true;
} }
private R handException(ProcessWorkFlowResponse processWorkFlowResponse) {
String[] split = processWorkFlowResponse.getBusinessKey().split(":");
if (StringUtils.isBlank(split[1])){
log.error("补偿流程处理失败,未找到BusinessKey:"+ processWorkFlowResponse);
return R.fail("补偿流程处理失败");
}
HazardTask hazardTask = this.baseMapper.selectOne(new LambdaQueryWrapper<HazardTask>() {{
eq(HazardTask::getId, split[1]);
}});
hazardTask.setIsNormal(false);
hazardTask.setProcessInstanceId(processWorkFlowResponse.getTaskId());
hazardTask.setRemark(JSONObject.toJSONString(processWorkFlowResponse.getVariables()));
hazardTask.setProcessSteps(processWorkFlowResponse.getTaskName());
hazardTask.setNextStepOperator("");
this.baseMapper.updateById(hazardTask);
log.info("补偿流程消息转换结束"+ processWorkFlowResponse);
return R.success("补偿流程消息保存成功");
}
/** /**
* 风险评估变量值流程穿插 * 风险评估变量值流程穿插
* @param processWorkFlowResponse * @param processWorkFlowResponse

Loading…
Cancel
Save