| @@ -210,6 +210,24 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| return new HashMap<>(); | |||
| } | |||
| /** | |||
| * 设置会签代办人 | |||
| */ | |||
| public void setSignAssignee(Map<String, Object> map, String flowJsoin){ | |||
| WxFlowModel flowModel = (WxFlowModel)JsonUtil.readValue(flowJsoin,WxFlowModel.class); | |||
| List<UserTaskVo> taskAssigneeList = flowModel.getLists(); | |||
| for (UserTaskVo userTaskVo:taskAssigneeList) { | |||
| if(EnumTaskType.AND.getCode().equals(userTaskVo.getType())){ | |||
| List<String> assigneeList = new ArrayList<>(); | |||
| for (FlowUserVo flowUserVo:userTaskVo.getUserList()) { | |||
| assigneeList.add(flowUserVo.getId()); | |||
| } | |||
| map.put(userTaskVo.getKey()+"_signAssignee",assigneeList); | |||
| } | |||
| } | |||
| } | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class}) | |||
| public ResultData start(Map<String, Object> params,Long userId,String userName,String tenantId) { | |||
| @@ -237,10 +255,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| map.put("variables",variables); | |||
| map.put("supplement",supplement); | |||
| map.put("taskAssignee",flowModel.getFlow()); | |||
| List<String> assigneeList = new ArrayList<>(); | |||
| assigneeList.add("243650055783841792"); | |||
| assigneeList.add("204398756307664896"); | |||
| map.put("assigneeList",assigneeList); | |||
| setSignAssignee(map,flowModel.getFlow()); | |||
| ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(flowModel.getFlowId(), map); | |||
| logger.debug("流程启动,流程id:{}",processInstance.getId()); | |||
| @@ -1109,17 +1124,9 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| userTask.setName("节点" + (i + 1)); | |||
| userTask.setId("userTask" + (i + 1)); | |||
| List<String> userIdList = new ArrayList<>(); | |||
| String collection = ""; | |||
| for (int j = 0; j < taskVo.getUserList().size(); j++) { | |||
| FlowUserVo userVo = taskVo.getUserList().get(j); | |||
| for (FlowUserVo userVo:taskVo.getUserList()) { | |||
| userIdList.add(userVo.getId() + ""); | |||
| if(j==taskVo.getUserList().size()-1){ | |||
| collection += userVo.getId(); | |||
| }else{ | |||
| collection += userVo.getId()+","; | |||
| } | |||
| } | |||
| collection += ""; | |||
| if(EnumTaskType.NORMAL.getCode().equals(taskVo.getType()) || EnumTaskType.OR.getCode().equals(taskVo.getType())){ | |||
| userTask.setCandidateUsers(userIdList); | |||
| @@ -1127,7 +1134,7 @@ public class WxFlowServiceImpl implements WxFlowService { | |||
| userTask.setAssignee("${assignee}"); | |||
| MultiInstanceLoopCharacteristics mi = new MultiInstanceLoopCharacteristics(); | |||
| mi.setLoopCardinality(userIdList.size()+""); | |||
| mi.setInputDataItem("${assigneeList}"); | |||
| mi.setInputDataItem("${"+userTask.getId()+"_signAssignee}"); | |||
| mi.setElementVariable("assignee"); | |||
| userTask.setLoopCharacteristics(mi); | |||
| } | |||