|
@@ -1483,6 +1483,8 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
Map<CustomFlowTypeEnum, CustomFlowDto> customFlowTypeEnumCustomFlowDtoMap = new HashMap<>();
|
|
|
FlowTaskLink flowTaskLink = new FlowTaskLink();
|
|
|
Map<String, Object> flowProcessVarMap = new HashMap<>();
|
|
|
+ String exclusiveGatewayId = null;
|
|
|
+ Map<String, Map<String, List<String>>> gatewayMap = new HashMap<>();
|
|
|
for (int i = 0; i < customFlowLists.size(); i++) {
|
|
|
CustomFlowDto customFlowDto = customFlowLists.get(i);
|
|
|
FlowTaskNode node = new FlowTaskNode(customFlowDto);
|
|
@@ -1535,6 +1537,15 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
//驳回属性
|
|
|
switch (customFlowPropertyDto.getRejectType()) {
|
|
|
case PREV://上一节点
|
|
|
+ exclusiveGatewayId = DefaultInstanceConvertToMultiInstance.GATEWAY_NAME + multiWorkFlow.getAndIncrement(DefaultInstanceConvertToMultiInstance.GATEWAY_ID);
|
|
|
+ CustomFlowDto customFlowExclusiveGatewayDto = new CustomFlowDto(exclusiveGatewayId, CustomFlowTypeEnum.EXCLUSIVE_GATE_WAY, CustomFlowTypeEnum.EXCLUSIVE_GATE_WAY.getTitle(), CustomFlowDynamicBuildEnum.EXCLUSIVE_GATE_WAY.getId() + exclusiveGatewayId);
|
|
|
+ FlowTaskNode exclusiveGatewayNode = new FlowTaskNode(customFlowExclusiveGatewayDto);
|
|
|
+ flowTaskLink.add(exclusiveGatewayNode);
|
|
|
+ Map<String, List<String>> sequenceFlowMap = new HashMap<>();
|
|
|
+ sequenceFlowMap.put(CustomFlowElementEnum.REJECT.getId(), Arrays.asList(node.getBefore().getTask().getFlowTaskId()));
|
|
|
+ sequenceFlowMap.put(CustomFlowTypeEnum.EXCLUSIVE_GATE_WAY.name(), Arrays.asList(customFlowExclusiveGatewayDto.getFlowTaskId()));
|
|
|
+ gatewayMap.put(customFlowDto.getFlowTaskId(), sequenceFlowMap);
|
|
|
+ process.addFlowElement(createExclusiveGateway(customFlowExclusiveGatewayDto.getFlowTaskId(), CustomFlowTypeEnum.EXCLUSIVE_GATE_WAY.getTitle()));
|
|
|
break;
|
|
|
case START://发起人节点
|
|
|
break;
|
|
@@ -1558,7 +1569,6 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
}
|
|
|
}
|
|
|
process.addFlowElement(createUserTask(CustomFlowDynamicBuildEnum.USER_TASK.getId() + i, Objects.nonNull(customFlowDto.getContent()) && !Objects.equals(customFlowDto.getContent(), "") ? customFlowDto.getContent() : DefaultInstanceConvertToMultiInstance.USER_TASK_APPROVE_NAME, approveUserIds, customFlowPropertyDto.getMultipleUserApproveType()));
|
|
|
- //提取过程节点属性
|
|
|
break;
|
|
|
case END://结束节点
|
|
|
if (customFlowTypeEnumCustomFlowDtoMap.containsKey(CustomFlowTypeEnum.END)) {
|
|
@@ -1574,11 +1584,30 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- for (int i = 1; i < flowTaskLink.size() - 1; i++) {
|
|
|
+ String normalSequenceId = null;
|
|
|
+ for (int i = 1; i < flowTaskLink.size(); i++) {
|
|
|
FlowTaskNode flowTaskNode = flowTaskLink.get(i);
|
|
|
- process.addFlowElement(createSequenceFlow(flowTaskNode.getBefore().getTask().getFlowTaskId(), flowTaskNode.getTask().getFlowTaskId(), "", ""));
|
|
|
+ normalSequenceId = DefaultInstanceConvertToMultiInstance.SEQUENCE_NAME + multiWorkFlow.getAndIncrement(DefaultInstanceConvertToMultiInstance.SEQUENCE_ID);
|
|
|
+ log.info("start:{},end:{}", flowTaskNode.getBefore().getTask().getFlowTaskId(), flowTaskNode.getTask().getFlowTaskId());
|
|
|
+ process.addFlowElement(createSequenceFlow(flowTaskNode.getBefore().getTask().getFlowTaskId(), flowTaskNode.getTask().getFlowTaskId(), normalSequenceId, normalSequenceId, null));
|
|
|
+ if (Objects.nonNull(gatewayMap.get(flowTaskNode.getTask().getFlowTaskId()))) {
|
|
|
+ Map<String, List<String>> map = gatewayMap.get(flowTaskNode.getTask().getFlowTaskId());
|
|
|
+ List<String> gatewayList = map.get(CustomFlowTypeEnum.EXCLUSIVE_GATE_WAY.name());
|
|
|
+ map.remove(CustomFlowTypeEnum.EXCLUSIVE_GATE_WAY.name());
|
|
|
+ if (Objects.nonNull(map) && map.size() > 0) {
|
|
|
+ map.forEach((k, v) -> {
|
|
|
+ String gatewaySequenceId = null;
|
|
|
+ if (Objects.equals(k, CustomFlowElementEnum.REJECT.getId())) {
|
|
|
+ for (String s : v) {
|
|
|
+ gatewaySequenceId = DefaultInstanceConvertToMultiInstance.SEQUENCE_NAME + multiWorkFlow.getAndIncrement(DefaultInstanceConvertToMultiInstance.SEQUENCE_ID);
|
|
|
+ log.info("start:{},end:{}", gatewayList.get(0), s);
|
|
|
+ process.addFlowElement(createSequenceFlow(gatewayList.get(0), s, gatewaySequenceId, gatewaySequenceId, null));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- process.addFlowElement(createSequenceFlow(flowTaskLink.getLast().getBefore().getTask().getFlowTaskId(), flowTaskLink.getLast().getTask().getFlowTaskId(), "", ""));
|
|
|
|
|
|
//生成图像信息
|
|
|
new BpmnAutoLayout(model).execute();
|
|
@@ -1676,26 +1705,46 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @param id 网关id
|
|
|
+ * 排他网关
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @param name
|
|
|
* @return
|
|
|
*/
|
|
|
- protected ExclusiveGateway createExclusiveGateway(String id) {
|
|
|
+ protected ExclusiveGateway createExclusiveGateway(String id, String name) {
|
|
|
ExclusiveGateway exclusiveGateway = new ExclusiveGateway();
|
|
|
exclusiveGateway.setId(id);
|
|
|
+ exclusiveGateway.setName(name);
|
|
|
return exclusiveGateway;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 并行网关
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @param name
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ protected ParallelGateway createParallelGateway(String id, String name) {
|
|
|
+ ParallelGateway parallelGateway = new ParallelGateway();
|
|
|
+ parallelGateway.setId(id);
|
|
|
+ parallelGateway.setName(name);
|
|
|
+ return parallelGateway;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @param from 连线来源节点
|
|
|
* @param to 连线目标节点
|
|
|
+ * @param id
|
|
|
* @param name 连线名称(可不填)
|
|
|
* @param conditionExpression 网关每一种线路走向的条件表达式
|
|
|
* @return
|
|
|
*/
|
|
|
- protected SequenceFlow createSequenceFlow(String from, String to, String name, String conditionExpression) {
|
|
|
+ protected SequenceFlow createSequenceFlow(String from, String to, String id, String name, String conditionExpression) {
|
|
|
SequenceFlow flow = new SequenceFlow();
|
|
|
flow.setSourceRef(from);
|
|
|
flow.setTargetRef(to);
|
|
|
+ flow.setId(id);
|
|
|
flow.setName(name);
|
|
|
if (Objects.nonNull(conditionExpression)) {
|
|
|
flow.setConditionExpression(conditionExpression);
|