Commit 10ec917dce01f9e761a58a1147f0be041b0d9752

Authored by 颜惠青
1 parent 3c0d0640

三海道路重新发起 ai 和 督察员 选择非三海的道路 找不到养护组长问题

urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/AppGardenWorkOrderAIController.java
@@ -234,6 +234,7 @@ public class AppGardenWorkOrderAIController { @@ -234,6 +234,7 @@ public class AppGardenWorkOrderAIController {
234 reStartReqVO.setReason(reqVO.getReason()); 234 reStartReqVO.setReason(reqVO.getReason());
235 reStartReqVO.setId(reqVO.getTaskId()); 235 reStartReqVO.setId(reqVO.getTaskId());
236 reStartReqVO.setRoadId(reqVO.getRoadId()); 236 reStartReqVO.setRoadId(reqVO.getRoadId());
  237 + reStartReqVO.setBusiLine(reqVO.getBusiLine());
237 aiService.approveTask(reStartReqVO); 238 aiService.approveTask(reStartReqVO);
238 log.info("当前操作:"+AIOperateTypeEnum.YL_INSPECTOR_START_RELAUNCH.getDesc()+"<--结束"); 239 log.info("当前操作:"+AIOperateTypeEnum.YL_INSPECTOR_START_RELAUNCH.getDesc()+"<--结束");
239 return success(true); 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,6 +235,7 @@ public class AppGardenWorkOrderInspectorController {
235 reStartReqVO.setReason(reqVO.getReason()); 235 reStartReqVO.setReason(reqVO.getReason());
236 reStartReqVO.setId(reqVO.getTaskId()); 236 reStartReqVO.setId(reqVO.getTaskId());
237 reStartReqVO.setRoadId(reqVO.getRoadId()); 237 reStartReqVO.setRoadId(reqVO.getRoadId());
  238 + reStartReqVO.setBusiLine(reqVO.getBusiLine());
238 inspectorService.approveTask(reStartReqVO); 239 inspectorService.approveTask(reStartReqVO);
239 log.info("当前操作:"+InspectorOperateTypeEnum.YL_INSPECTOR_START_RELAUNCH.getDesc()+"<--结束"); 240 log.info("当前操作:"+InspectorOperateTypeEnum.YL_INSPECTOR_START_RELAUNCH.getDesc()+"<--结束");
240 return success(true); 241 return success(true);
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/vo/task/AppGardenTaskInspectorApproveReqVO.java
@@ -48,4 +48,7 @@ public class AppGardenTaskInspectorApproveReqVO { @@ -48,4 +48,7 @@ public class AppGardenTaskInspectorApproveReqVO {
48 @Schema(description = "退回时的拍照图片") 48 @Schema(description = "退回时的拍照图片")
49 private List<String> returnImgs; 49 private List<String> returnImgs;
50 50
  51 + @Schema(description = "业务线")
  52 + private String busiLine;
  53 +
51 } 54 }
52 \ No newline at end of file 55 \ No newline at end of file
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,6 +295,31 @@ public class BpmAIServiceImpl implements BpmAIService{
295 //重新发起判断 三海区域 295 //重新发起判断 三海区域
296 boolean isSanhai = isSanhaiByRoadId(reqVO.getRoadId()); 296 boolean isSanhai = isSanhaiByRoadId(reqVO.getRoadId());
297 variables.put(BPM_COMMON_PROD_ISSANHAI,isSanhai); 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 //TODO 重新发起需更新工单数据库 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,9 +287,32 @@ public class BpmInspectorServiceImpl implements BpmInspectorService{
287 //重新发起判断 三海区域 287 //重新发起判断 三海区域
288 boolean isSanhai = isSanhaiByRoadId(reqVO.getRoadId()); 288 boolean isSanhai = isSanhaiByRoadId(reqVO.getRoadId());
289 variables.put(BPM_COMMON_PROD_ISSANHAI,isSanhai); 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 targetVO.setVariables(variables); 316 targetVO.setVariables(variables);
294 //TODO 审批候选人需要赋值 317 //TODO 审批候选人需要赋值
295 Map<String, List<Long>> nextAssignees = new HashMap<>(); 318 Map<String, List<Long>> nextAssignees = new HashMap<>();