| @@ -384,7 +384,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| map.put("flowType",flowType); | |||
| map.put("variables",variables); | |||
| map.put("supplement",supplement); | |||
| map.put("taskAssignee",flowModel.getLists()); | |||
| map.put("taskAssignee",flowModel.getFlow()); | |||
| ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(flowModel.getFlowId(), map); | |||
| logger.debug("流程启动,流程id:{}",processInstance.getId()); | |||
| @@ -622,41 +622,87 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| } | |||
| Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult(); | |||
| Map<String,Object> mapInfo = taskService.getVariables(task.getId()); | |||
| List<UserTaskVo> taskAssigneeList = (List)mapInfo.get("taskAssignee"); | |||
| Integer flowType = (Integer)mapInfo.get("flowType"); | |||
| for (int i = 0; i < taskAssigneeList.size(); i++) { | |||
| UserTaskVo assignee = taskAssigneeList.get(i); | |||
| if(task.getTaskDefinitionKey().equals(assignee.getKey())){ | |||
| //设置当前节点代办人信息 | |||
| String userName = ""; | |||
| for (FlowUserVo userVo:assignee.getUserList()) { | |||
| userName += userVo.getName()+" "; | |||
| } | |||
| WxFlowRecord wxFlowRecord = new WxFlowRecord(); | |||
| wxFlowRecord.setUserName(userName.trim()); | |||
| wxFlowRecord.setStatus(EnumFlowRecordStatus.ASSIGNEE.getCode()); | |||
| resultList.add(0,wxFlowRecord); | |||
| //不是最后一个节点,设置下一个待审批节点代办人 | |||
| if(i != taskAssigneeList.size()-1){ | |||
| assignee = taskAssigneeList.get(i+1); | |||
| // 下一个节点没设置代办人 | |||
| if(CollectionUtils.isEmpty(assignee.getUserList())){ | |||
| continue; | |||
| if(flowType.intValue() <= EnumFlowKey.END_CONTRACT.getCode().intValue()){ | |||
| //老数据 | |||
| List<Map<String,String>> taskAssigneeList = (List)mapInfo.get("taskAssignee"); | |||
| for (int i = 0; i < taskAssigneeList.size(); i++) { | |||
| Map<String,String> assignee = taskAssigneeList.get(i); | |||
| if(task.getTaskDefinitionKey().equals(assignee.get("taskKey"))){ | |||
| //设置当前节点代办人信息 | |||
| String[] assigneeArray = assignee.get("assignee").split(","); | |||
| String userName = ""; | |||
| for (String userid:assigneeArray) { | |||
| MallUserInfo mallUserInfo = this.mallUserInfoService.getById(Long.parseLong(userid)); | |||
| userName += mallUserInfo.getName()+" "; | |||
| } | |||
| WxFlowRecord wxFlowRecord = new WxFlowRecord(); | |||
| wxFlowRecord.setUserName(userName.trim()); | |||
| wxFlowRecord.setStatus(EnumFlowRecordStatus.ASSIGNEE.getCode()); | |||
| resultList.add(0,wxFlowRecord); | |||
| //不是最后一个节点,设置下一个待审批节点代办人 | |||
| if(i != taskAssigneeList.size()-1){ | |||
| assignee = taskAssigneeList.get(i+1); | |||
| // 下一个节点没设置代办人 | |||
| if(StringUtils.isBlank(assignee.get("assignee"))){ | |||
| continue; | |||
| } | |||
| assigneeArray = assignee.get("assignee").split(","); | |||
| userName = ""; | |||
| for (String userid:assigneeArray) { | |||
| MallUserInfo mallUserInfo = this.mallUserInfoService.getById(Long.parseLong(userid)); | |||
| userName += mallUserInfo.getName()+" "; | |||
| } | |||
| wxFlowRecord = new WxFlowRecord(); | |||
| wxFlowRecord.setUserName(userName.trim()); | |||
| wxFlowRecord.setStatus(EnumFlowRecordStatus.ASSIGNEE.getCode()); | |||
| resultList.add(0,wxFlowRecord); | |||
| break; | |||
| } | |||
| userName = ""; | |||
| }else{ | |||
| continue; | |||
| } | |||
| } | |||
| }else{ | |||
| WxFlowModel flowModel = (WxFlowModel)JsonUtil.readValue((String)mapInfo.get("taskAssignee"),WxFlowModel.class); | |||
| List<UserTaskVo> taskAssigneeList = flowModel.getLists(); | |||
| for (int i = 0; i < taskAssigneeList.size(); i++) { | |||
| UserTaskVo assignee = taskAssigneeList.get(i); | |||
| if(task.getTaskDefinitionKey().equals(assignee.getKey())){ | |||
| //设置当前节点代办人信息 | |||
| String userName = ""; | |||
| for (FlowUserVo userVo:assignee.getUserList()) { | |||
| userName += userVo.getName()+" "; | |||
| } | |||
| wxFlowRecord = new WxFlowRecord(); | |||
| WxFlowRecord wxFlowRecord = new WxFlowRecord(); | |||
| wxFlowRecord.setUserName(userName.trim()); | |||
| wxFlowRecord.setStatus(EnumFlowRecordStatus.ASSIGNEE.getCode()); | |||
| resultList.add(0,wxFlowRecord); | |||
| break; | |||
| //不是最后一个节点,设置下一个待审批节点代办人 | |||
| if(i != taskAssigneeList.size()-1){ | |||
| assignee = taskAssigneeList.get(i+1); | |||
| // 下一个节点没设置代办人 | |||
| if(CollectionUtils.isEmpty(assignee.getUserList())){ | |||
| continue; | |||
| } | |||
| userName = ""; | |||
| for (FlowUserVo userVo:assignee.getUserList()) { | |||
| userName += userVo.getName()+" "; | |||
| } | |||
| wxFlowRecord = new WxFlowRecord(); | |||
| wxFlowRecord.setUserName(userName.trim()); | |||
| wxFlowRecord.setStatus(EnumFlowRecordStatus.ASSIGNEE.getCode()); | |||
| resultList.add(0,wxFlowRecord); | |||
| break; | |||
| } | |||
| }else{ | |||
| continue; | |||
| } | |||
| }else{ | |||
| continue; | |||
| } | |||
| } | |||
| // 设置最后一个发起节点 | |||