Commit 10ec917dce01f9e761a58a1147f0be041b0d9752
1 parent
3c0d0640
三海道路重新发起 ai 和 督察员 选择非三海的道路 找不到养护组长问题
Showing
5 changed files
with
55 additions
and
2 deletions
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/AppGardenWorkOrderAIController.java
| ... | ... | @@ -234,6 +234,7 @@ public class AppGardenWorkOrderAIController { |
| 234 | 234 | reStartReqVO.setReason(reqVO.getReason()); |
| 235 | 235 | reStartReqVO.setId(reqVO.getTaskId()); |
| 236 | 236 | reStartReqVO.setRoadId(reqVO.getRoadId()); |
| 237 | + reStartReqVO.setBusiLine(reqVO.getBusiLine()); | |
| 237 | 238 | aiService.approveTask(reStartReqVO); |
| 238 | 239 | log.info("当前操作:"+AIOperateTypeEnum.YL_INSPECTOR_START_RELAUNCH.getDesc()+"<--结束"); |
| 239 | 240 | return success(true); | ... | ... |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/AppGardenWorkOrderInspectorController.java
| ... | ... | @@ -235,6 +235,7 @@ public class AppGardenWorkOrderInspectorController { |
| 235 | 235 | reStartReqVO.setReason(reqVO.getReason()); |
| 236 | 236 | reStartReqVO.setId(reqVO.getTaskId()); |
| 237 | 237 | reStartReqVO.setRoadId(reqVO.getRoadId()); |
| 238 | + reStartReqVO.setBusiLine(reqVO.getBusiLine()); | |
| 238 | 239 | inspectorService.approveTask(reStartReqVO); |
| 239 | 240 | log.info("当前操作:"+InspectorOperateTypeEnum.YL_INSPECTOR_START_RELAUNCH.getDesc()+"<--结束"); |
| 240 | 241 | return success(true); | ... | ... |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/vo/task/AppGardenTaskInspectorApproveReqVO.java
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmAIServiceImpl.java
| ... | ... | @@ -295,6 +295,31 @@ public class BpmAIServiceImpl implements BpmAIService{ |
| 295 | 295 | //重新发起判断 三海区域 |
| 296 | 296 | boolean isSanhai = isSanhaiByRoadId(reqVO.getRoadId()); |
| 297 | 297 | variables.put(BPM_COMMON_PROD_ISSANHAI,isSanhai); |
| 298 | + if(!isSanhai){//非三海的到养护组长 | |
| 299 | + String instanceId = taskService.getTask(reqVO.getId()).getProcessInstanceId(); | |
| 300 | + ProcessInstance processInstance = processInstanceService.getProcessInstance(instanceId); | |
| 301 | + Map<String, Object> processInstanceVariables = processInstance.getProcessVariables(); | |
| 302 | + String busiLine = reqVO.getBusiLine(); | |
| 303 | + String roadId = reqVO.getRoadId(); | |
| 304 | + String roleCode = BusiLineTeamLeaderRoleCodeEnum.getByCode(busiLine).getRoleCode(); | |
| 305 | + | |
| 306 | + if(StringUtil.isEmpty(roleCode)){// 找不到 默认为园林组长的角色 | |
| 307 | + roleCode = BpmCommonConstant.TEAM_LEADER_YL; | |
| 308 | + } | |
| 309 | + List<AdminUserRespDTO> userList = workOrderExtMapper.getUserByRoadIdAndRoleCode(roadId,roleCode,busiLine); | |
| 310 | + if(org.springframework.util.ObjectUtils.isEmpty(userList)){ | |
| 311 | + throw exception(TEAM_LEADER_YL_NOT_EXISTS); | |
| 312 | + } | |
| 313 | + // 提取id到List<Long> | |
| 314 | + List<Long> idList = userList.stream() | |
| 315 | + // 映射:将AdminUserRespDTO对象转为其id属性 | |
| 316 | + .map(AdminUserRespDTO::getId) | |
| 317 | + // 收集结果到List | |
| 318 | + .collect(Collectors.toList()); | |
| 319 | + processInstanceVariables.put(BPM_COMMON_PROD_LEADERID, idList.get(0));//养护组长分配 | |
| 320 | + //流程变量重新赋值 | |
| 321 | + runtimeService.setVariables(instanceId,processInstanceVariables); | |
| 322 | + } | |
| 298 | 323 | } |
| 299 | 324 | //TODO 重新发起需更新工单数据库 |
| 300 | 325 | ... | ... |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmInspectorServiceImpl.java
| ... | ... | @@ -287,9 +287,32 @@ public class BpmInspectorServiceImpl implements BpmInspectorService{ |
| 287 | 287 | //重新发起判断 三海区域 |
| 288 | 288 | boolean isSanhai = isSanhaiByRoadId(reqVO.getRoadId()); |
| 289 | 289 | variables.put(BPM_COMMON_PROD_ISSANHAI,isSanhai); |
| 290 | - } | |
| 291 | - //TODO 重新发起需更新工单数据库 | |
| 290 | + if(!isSanhai){//非三海的到养护组长 | |
| 291 | + String instanceId = taskService.getTask(reqVO.getId()).getProcessInstanceId(); | |
| 292 | + ProcessInstance processInstance = processInstanceService.getProcessInstance(instanceId); | |
| 293 | + Map<String, Object> processInstanceVariables = processInstance.getProcessVariables(); | |
| 294 | + String busiLine = reqVO.getBusiLine(); | |
| 295 | + String roadId = reqVO.getRoadId(); | |
| 296 | + String roleCode = BusiLineTeamLeaderRoleCodeEnum.getByCode(busiLine).getRoleCode(); | |
| 292 | 297 | |
| 298 | + if(StringUtil.isEmpty(roleCode)){// 找不到 默认为园林组长的角色 | |
| 299 | + roleCode = BpmCommonConstant.TEAM_LEADER_YL; | |
| 300 | + } | |
| 301 | + List<AdminUserRespDTO> userList = workOrderExtMapper.getUserByRoadIdAndRoleCode(roadId,roleCode,busiLine); | |
| 302 | + if(org.springframework.util.ObjectUtils.isEmpty(userList)){ | |
| 303 | + throw exception(TEAM_LEADER_YL_NOT_EXISTS); | |
| 304 | + } | |
| 305 | + // 提取id到List<Long> | |
| 306 | + List<Long> idList = userList.stream() | |
| 307 | + // 映射:将AdminUserRespDTO对象转为其id属性 | |
| 308 | + .map(AdminUserRespDTO::getId) | |
| 309 | + // 收集结果到List | |
| 310 | + .collect(Collectors.toList()); | |
| 311 | + processInstanceVariables.put(BPM_COMMON_PROD_LEADERID, idList.get(0));//养护组长分配 | |
| 312 | + //流程变量重新赋值 | |
| 313 | + runtimeService.setVariables(instanceId,processInstanceVariables); | |
| 314 | + } | |
| 315 | + } | |
| 293 | 316 | targetVO.setVariables(variables); |
| 294 | 317 | //TODO 审批候选人需要赋值 |
| 295 | 318 | Map<String, List<Long>> nextAssignees = new HashMap<>(); | ... | ... |