|
|
|
@ -69,24 +69,18 @@ public class InnerDangerFlowServiceImpl extends ServiceImpl<InnerDangerMapper, I
|
|
|
|
|
return this.baseMapper.selectPage(Condition.getPage(query), Condition.getQueryWrapper(innerDangerEntity)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
// @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
@Override |
|
|
|
|
public R startHiddenDanger(InnerDangerVo hiddenDangerVo) { |
|
|
|
|
InnerDangerEntity innerDangerEntity = new InnerDangerEntity(); |
|
|
|
|
BeanUtil.copy(hiddenDangerVo, innerDangerEntity); |
|
|
|
|
saveEntity(JSONObject.toJSONString(innerDangerEntity)); |
|
|
|
|
InnerDangerEntity saveEntity = this.getOne(new LambdaQueryWrapper<InnerDangerEntity>() {{ |
|
|
|
|
eq(InnerDangerEntity::getCode, innerDangerEntity.getCode()); |
|
|
|
|
last("limit 1"); |
|
|
|
|
}}); |
|
|
|
|
BeanUtil.copy(saveEntity,hiddenDangerVo); |
|
|
|
|
R r = this.startProcess(JSONObject.toJSONString(hiddenDangerVo), HIDDEN_DANGER_CHECK); |
|
|
|
|
String saved = saveEntity(JSONObject.toJSONString(hiddenDangerVo)); |
|
|
|
|
R r = this.startProcess(saved, HIDDEN_DANGER_CHECK); |
|
|
|
|
return r; |
|
|
|
|
} |
|
|
|
|
@Override |
|
|
|
|
@Transactional |
|
|
|
|
public String saveEntity(String entity) { |
|
|
|
|
InnerDangerEntity innerDangerEntity= JSONObject.parseObject(entity, InnerDangerEntity.class); |
|
|
|
|
InnerDangerVo hiddenDangerVo= JSONObject.parseObject(entity, InnerDangerVo.class); |
|
|
|
|
InnerDangerEntity innerDangerEntity = new InnerDangerEntity(); |
|
|
|
|
BeanUtil.copy(hiddenDangerVo, innerDangerEntity); |
|
|
|
|
if (Func.isEmpty(innerDangerEntity.getCode())) { |
|
|
|
|
innerDangerEntity.setCode(UUID.randomUUID().toString()); |
|
|
|
|
} |
|
|
|
@ -114,7 +108,8 @@ public class InnerDangerFlowServiceImpl extends ServiceImpl<InnerDangerMapper, I
|
|
|
|
|
if (!save) { |
|
|
|
|
throw new ServiceException("隐患保存失败,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
return JSON.toJSONString(innerDangerEntity); |
|
|
|
|
BeanUtil.copy(innerDangerEntity, hiddenDangerVo); |
|
|
|
|
return JSON.toJSONString(hiddenDangerVo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -128,21 +123,21 @@ public class InnerDangerFlowServiceImpl extends ServiceImpl<InnerDangerMapper, I
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public R startProcess(String entity, String dictValue) { |
|
|
|
|
InnerDangerVo innerDangerVo = JSONObject.parseObject(entity, InnerDangerVo.class); |
|
|
|
|
InnerDangerVo innerDangerVo= JSONObject.parseObject(entity, InnerDangerVo.class); |
|
|
|
|
InnerDangerEntity innerDangerEntity = new InnerDangerEntity(); |
|
|
|
|
BeanUtil.copy(innerDangerVo, innerDangerEntity); |
|
|
|
|
// 隐患处理名字
|
|
|
|
|
String userName = Optional.ofNullable(AuthUtil.getUserName()).orElse(""); |
|
|
|
|
// 流程名称
|
|
|
|
|
String processName = "[" + userName + "] 发起 " + "【风险点:" + innerDangerVo.getRiskPointName() + "】隐患处理流程" + "——>" + innerDangerVo.getHiddenDangerName(); |
|
|
|
|
String processName = "[" + userName + "] 发起 " + "【风险点:" + innerDangerVo.getRiskPointName() + "】隐患处理流程" + "——>" + innerDangerEntity.getHiddenDangerName(); |
|
|
|
|
// 开启新的隐患处理流程
|
|
|
|
|
Map<String, Object> variable = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(innerDangerVo, DateUtil.PATTERN_DATETIME), Map.class); |
|
|
|
|
R<BladeFlow> result = processClient.startProcessInstanceContainNameByKey(HIDDEN_DANGER_CHECK, innerDangerVo.getId().toString(), processName, variable); |
|
|
|
|
R<BladeFlow> result = processClient.startProcessInstanceContainNameByKey(dictValue, innerDangerVo.getId().toString(), processName, variable); |
|
|
|
|
// 流程开启失败
|
|
|
|
|
if (!result.isSuccess()) { |
|
|
|
|
innerDangerEntity.setIsNormal(false); |
|
|
|
|
innerDangerEntity.setRemark(JSONObject.toJSONString(variable)); |
|
|
|
|
this.baseMapper.updateById(innerDangerEntity); |
|
|
|
|
this.baseMapper.updateById(innerDangerVo); |
|
|
|
|
log.error("隐患处理流程开启失败,错误描述 : {}", result); |
|
|
|
|
R r=new R(); |
|
|
|
|
r.setCode(result.getCode()); |
|
|
|
|