|
|
|
@@ -1145,20 +1145,31 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
Process process = new Process(); |
|
|
|
BpmnModel bpmnModel = new BpmnModel(); |
|
|
|
|
|
|
|
StartEvent start = new StartEvent(); |
|
|
|
start.setId("start"); |
|
|
|
start.setName("开始节点"); |
|
|
|
|
|
|
|
SequenceFlow sequenceFlow = new SequenceFlow(); |
|
|
|
sequenceFlow.setId("sf1"); |
|
|
|
sequenceFlow.setName("开始节点"); |
|
|
|
sequenceFlow.setSourceRef("start"); |
|
|
|
sequenceFlow.setTargetRef("userTask1"); |
|
|
|
|
|
|
|
start.setOutgoingFlows(Arrays.asList(sequenceFlow)); |
|
|
|
List<SequenceFlow> flowList = createFlow(wxFlowModel.getLists().size()); |
|
|
|
|
|
|
|
for (int i = 0; i < wxFlowModel.getLists().size(); i++){ |
|
|
|
if(i==0){ |
|
|
|
StartEvent start = new StartEvent(); |
|
|
|
start.setId("start"); |
|
|
|
start.setName("开始节点"); |
|
|
|
start.setOutgoingFlows(Arrays.asList(flowList.get(0))); |
|
|
|
process.addFlowElement(start); |
|
|
|
process.addFlowElement(flowList.get(0)); |
|
|
|
}else if(i==wxFlowModel.getLists().size()-1){ |
|
|
|
EndEvent endEvent = new EndEvent(); |
|
|
|
endEvent.setId("end"); |
|
|
|
endEvent.setName("结束节点"); |
|
|
|
endEvent.setIncomingFlows(Arrays.asList(flowList.get(i+1))); |
|
|
|
} |
|
|
|
|
|
|
|
process.addFlowElement(start); |
|
|
|
process.addFlowElement(sequenceFlow); |
|
|
|
UserTask userTask = new UserTask(); |
|
|
|
userTask.setName("节点"+i); |
|
|
|
userTask.setId("userTask"+i); |
|
|
|
userTask.setIncomingFlows(Arrays.asList(flowList.get(i))); |
|
|
|
userTask.setOutgoingFlows(Arrays.asList(flowList.get(i+1))); |
|
|
|
process.addFlowElement(userTask); |
|
|
|
process.addFlowElement(flowList.get(i+1)); |
|
|
|
} |
|
|
|
|
|
|
|
wxFlowModel.setFlow(JsonUtil.obj2Json(wxFlowModel)); |
|
|
|
if(wxFlowModel.getId() == null) { |
|
|
|
@@ -1172,51 +1183,30 @@ public class WxFlowServiceImpl implements WxFlowService { |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
public UserTask draw(Process process,SequenceFlow incoming,List<UserTaskVo> lists,int count){ |
|
|
|
if(CollectionUtils.isNotEmpty(lists)){ |
|
|
|
UserTaskVo taskVo = lists.get(0); |
|
|
|
lists.remove(0); |
|
|
|
|
|
|
|
UserTask userTask = new UserTask(); |
|
|
|
if(taskVo.getType().equals(EnumTaskType.NORMAL.getCode())){ |
|
|
|
userTask.setName(count+"级审批"); |
|
|
|
userTask.setId("userTask"+count); |
|
|
|
userTask.setIncomingFlows(Arrays.asList(incoming)); |
|
|
|
List<String> userIdList = new ArrayList<>(); |
|
|
|
for (FlowUserVo userVo:taskVo.getUserList()) { |
|
|
|
userIdList.add(userVo.getId()+""); |
|
|
|
} |
|
|
|
userTask.setCandidateUsers(userIdList); |
|
|
|
}else if(taskVo.getType().equals(EnumTaskType.AND.getCode())){ |
|
|
|
MultiInstanceLoopCharacteristics mi = new MultiInstanceLoopCharacteristics(); |
|
|
|
|
|
|
|
userTask.setLoopCharacteristics(mi); |
|
|
|
}else if(taskVo.getType().equals(EnumTaskType.OR.getCode())){ |
|
|
|
|
|
|
|
public List<SequenceFlow> createFlow(int size){ |
|
|
|
List<SequenceFlow> result = new ArrayList<>(); |
|
|
|
for (int i = 0; i < size+1; i++) { |
|
|
|
SequenceFlow sequenceFlow = new SequenceFlow(); |
|
|
|
sequenceFlow.setId("sf"+i); |
|
|
|
if(i==0){ |
|
|
|
sequenceFlow.setName("开始"); |
|
|
|
sequenceFlow.setSourceRef("start"); |
|
|
|
sequenceFlow.setTargetRef("userTask"+i); |
|
|
|
}else if(i == size){ |
|
|
|
sequenceFlow.setName("结束"); |
|
|
|
sequenceFlow.setSourceRef("userTask"+i); |
|
|
|
sequenceFlow.setTargetRef("end"); |
|
|
|
}else{ |
|
|
|
sequenceFlow.setName("sf"+i); |
|
|
|
sequenceFlow.setSourceRef("userTask"+i); |
|
|
|
sequenceFlow.setTargetRef("userTask"+i); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SequenceFlow out = new SequenceFlow(); |
|
|
|
out.setId("sf"+count); |
|
|
|
out.setName("节点"+count); |
|
|
|
out.setSourceRef(userTask.getId()); |
|
|
|
|
|
|
|
userTask.setOutgoingFlows(Arrays.asList(out)); |
|
|
|
|
|
|
|
UserTask next = draw(process,out,lists,count++); |
|
|
|
|
|
|
|
out.setTargetFlowElement(next); |
|
|
|
return next; |
|
|
|
}else{ |
|
|
|
return null; |
|
|
|
result.add(sequenceFlow); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public PageInfo<WxFlowModel> modelList(WxFlowModel wxFlowModel,Integer pageIndex, Integer pageSize) { |
|
|
|
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxFlowModelMapper.findList(wxFlowModel)); |
|
|
|
|