|
@@ -2,6 +2,7 @@ package com.qmth.distributed.print.business.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
+import com.google.common.reflect.TypeToken;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.qmth.boot.api.exception.ApiException;
|
|
|
import com.qmth.distributed.print.business.activiti.custom.service.DefaultInstanceConvertToMultiInstance;
|
|
@@ -33,6 +34,7 @@ import org.activiti.engine.RepositoryService;
|
|
|
import org.activiti.engine.RuntimeService;
|
|
|
import org.activiti.engine.TaskService;
|
|
|
import org.activiti.engine.impl.RepositoryServiceImpl;
|
|
|
+import org.activiti.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior;
|
|
|
import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
|
|
|
import org.activiti.engine.repository.Deployment;
|
|
|
import org.activiti.engine.repository.DeploymentBuilder;
|
|
@@ -417,51 +419,56 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
Gson gson = new Gson();
|
|
|
String usertaskId = null;
|
|
|
Map<String, CustomFlowVarDto> agginessMap = (Map<String, CustomFlowVarDto>) flowProcessVarMap.get(SystemConstant.AGGINESS_MAP);
|
|
|
-// Map<String, CustomFlowGatewayDto> approveDataMap = (Map<String, CustomFlowGatewayDto>) flowProcessVarMap.get(SystemConstant.APPROVE_DATA_MAP);
|
|
|
-// if (approvePass == FlowApprovePassEnum.PASS) {
|
|
|
-// Map<String, List<CustomFlowGatewayDto>> approvePassMap = (Map<String, List<CustomFlowGatewayDto>>) flowProcessVarMap.get(SystemConstant.APPROVE_PASS_MAP);
|
|
|
-// if (Objects.nonNull(approvePassMap.get(userTask.getId())) && !Objects.equals(approvePassMap.get(userTask.getId()), "")) {
|
|
|
-// List<CustomFlowGatewayDto> customFlowGatewayDtoList = gson.fromJson(gson.toJson(approvePassMap.get(userTask.getId())), new TypeToken<List<CustomFlowGatewayDto>>() {
|
|
|
-// }.getType());
|
|
|
-//// boolean pass = false;
|
|
|
-//// for (CustomFlowGatewayDto c : customFlowGatewayDtoList) {
|
|
|
-//// if (Objects.equals(c.getFlowTaskId(), userTask.getId())) {
|
|
|
-//// usertaskId = c.getConditionExp().substring(c.getConditionExp().indexOf("'") + 1, c.getConditionExp().lastIndexOf("'"));
|
|
|
-//// pass = true;
|
|
|
-//// break;
|
|
|
-//// }
|
|
|
-//// }
|
|
|
-//// if (!pass) {
|
|
|
-//// throw ExceptionResultEnum.ERROR.exception("该节点不能通过");
|
|
|
-//// }
|
|
|
-// map.put(SystemConstant.APPROVE, usertaskId);
|
|
|
-// if (currFlow.getBehavior() instanceof MultiInstanceActivityBehavior) {
|
|
|
-// map.computeIfAbsent(CustomFlowElementEnum.REJECT.getId() + id, v -> 0);
|
|
|
+ if (approvePass == FlowApprovePassEnum.PASS) {
|
|
|
+ Map<String, List<CustomFlowSequenceDto>> approvePassMap = (Map<String, List<CustomFlowSequenceDto>>) flowProcessVarMap.get(SystemConstant.APPROVE_PASS_MAP);
|
|
|
+ if (Objects.nonNull(approvePassMap.get(userTask.getId())) && !Objects.equals(approvePassMap.get(userTask.getId()), "")) {
|
|
|
+ List<CustomFlowSequenceDto> customFlowSequenceDtoList = gson.fromJson(gson.toJson(approvePassMap.get(userTask.getId())), new TypeToken<List<CustomFlowSequenceDto>>() {
|
|
|
+ }.getType());
|
|
|
+// boolean pass = false;
|
|
|
+// for (CustomFlowSequenceDto c : customFlowSequenceDtoList) {
|
|
|
+// if (Objects.equals(c.getFlowTaskId(), userTask.getId())) {
|
|
|
+// usertaskId = c.getConditionExp().substring(c.getConditionExp().indexOf("'") + 1, c.getConditionExp().lastIndexOf("'"));
|
|
|
+// pass = true;
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (!pass) {
|
|
|
+// throw ExceptionResultEnum.ERROR.exception("该节点不能通过");
|
|
|
+// }
|
|
|
+ map.put(SystemConstant.APPROVE, usertaskId);
|
|
|
+ if (currFlow.getBehavior() instanceof MultiInstanceActivityBehavior) {
|
|
|
+ map.computeIfAbsent(CustomFlowElementEnum.REJECT.getId() + id, v -> 0);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("该节点不能通过");
|
|
|
+ }
|
|
|
+ } else if (approvePass == FlowApprovePassEnum.REJECT) {
|
|
|
+ if (Objects.isNull(map.get(SystemConstant.USER_TASK_ID)) || Objects.equals(map.get(SystemConstant.USER_TASK_ID), "")) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("流转节点不能为空");
|
|
|
+ }
|
|
|
+ usertaskId = (String) map.get(SystemConstant.USER_TASK_ID);
|
|
|
+ Map<String, List<CustomFlowSequenceDto>> approveRejectMap = (Map<String, List<CustomFlowSequenceDto>>) flowProcessVarMap.get(SystemConstant.APPROVE_REJECT_MAP);
|
|
|
+ if (Objects.nonNull(approveRejectMap.get(userTask.getId())) && !Objects.equals(approveRejectMap.get(userTask.getId()), "")) {
|
|
|
+ List<CustomFlowSequenceDto> customFlowSequenceDtoList = gson.fromJson(gson.toJson(approveRejectMap.get(userTask.getId())), new TypeToken<List<CustomFlowSequenceDto>>() {
|
|
|
+ }.getType());
|
|
|
+// boolean reject = false;
|
|
|
+// for (CustomFlowGatewayDto c : customFlowGatewayDtoList) {
|
|
|
+// if (Objects.equals(c.getFlowTaskId(), usertaskId)) {
|
|
|
+// reject = true;
|
|
|
+// break;
|
|
|
// }
|
|
|
// }
|
|
|
-// } else if (approvePass == FlowApprovePassEnum.REJECT) {
|
|
|
-// if (Objects.isNull(map.get(SystemConstant.USER_TASK_ID)) || Objects.equals(map.get(SystemConstant.USER_TASK_ID), "")) {
|
|
|
-// throw ExceptionResultEnum.ERROR.exception("流转节点不能为空");
|
|
|
-// }
|
|
|
-// usertaskId = (String) map.get(SystemConstant.USER_TASK_ID);
|
|
|
-// Map<String, List<CustomFlowGatewayDto>> approveRejectMap = (Map<String, List<CustomFlowGatewayDto>>) flowProcessVarMap.get(SystemConstant.APPROVE_REJECT_MAP);
|
|
|
-// List<CustomFlowGatewayDto> customFlowGatewayDtoList = gson.fromJson(gson.toJson(approveRejectMap.get(userTask.getId())), new TypeToken<List<CustomFlowGatewayDto>>() {
|
|
|
-// }.getType());
|
|
|
-//// boolean reject = false;
|
|
|
-//// for (CustomFlowGatewayDto c : customFlowGatewayDtoList) {
|
|
|
-//// if (Objects.equals(c.getFlowTaskId(), usertaskId)) {
|
|
|
-//// reject = true;
|
|
|
-//// break;
|
|
|
-//// }
|
|
|
-//// }
|
|
|
-//// if (!reject) {
|
|
|
-//// throw ExceptionResultEnum.ERROR.exception("该节点不能驳回");
|
|
|
-//// }
|
|
|
-// map.put(SystemConstant.APPROVE, usertaskId);
|
|
|
-// if (currFlow.getBehavior() instanceof MultiInstanceActivityBehavior) {
|
|
|
-// map.computeIfAbsent(CustomFlowElementEnum.REJECT.getId() + id, v -> 1);
|
|
|
+// if (!reject) {
|
|
|
+// throw ExceptionResultEnum.ERROR.exception("该节点不能驳回");
|
|
|
// }
|
|
|
-// }
|
|
|
+ map.put(SystemConstant.APPROVE, usertaskId);
|
|
|
+ if (currFlow.getBehavior() instanceof MultiInstanceActivityBehavior) {
|
|
|
+ map.computeIfAbsent(CustomFlowElementEnum.REJECT.getId() + id, v -> 1);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("该节点不能驳回");
|
|
|
+ }
|
|
|
+ }
|
|
|
//获取流程变量
|
|
|
if (Objects.nonNull(agginessMap.get(usertaskId))) {
|
|
|
CustomFlowVarDto customFlowVarDto = gson.fromJson(gson.toJson(agginessMap.get(usertaskId)), CustomFlowVarDto.class);
|
|
@@ -1529,18 +1536,20 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
|
|
|
List<CustomFlowDto> customFlowLists = customFlowSaveDto.getCustomFlowLists();
|
|
|
Map<CustomFlowTypeEnum, CustomFlowDto> customFlowTypeEnumCustomFlowDtoMap = new HashMap<>();
|
|
|
- FlowTaskLink flowTaskLink = new FlowTaskLink();
|
|
|
- Map<String, Object> flowProcessVarMap = new HashMap<>();
|
|
|
- Map<String, CustomFlowVarDto> agginessMap = new HashMap<>();
|
|
|
- Map<String, CustomFlowGatewayDto> approveDataMap = new HashMap<>();
|
|
|
- LinkedMultiValueMap<String, CustomFlowSequenceDto> approvePassMap = new LinkedMultiValueMap<>();
|
|
|
- LinkedMultiValueMap<String, CustomFlowSequenceDto> approveRejectMap = new LinkedMultiValueMap<>();
|
|
|
+ FlowTaskLink flowTaskLink = new FlowTaskLink();//流程双向链表
|
|
|
+ Map<String, Object> flowProcessVarMap = new HashMap<>();//流程变量
|
|
|
+ Map<String, CustomFlowVarDto> agginessMap = new HashMap<>();//流程审核人数据
|
|
|
+ Map<String, CustomFlowGatewayDto> approveDataMap = new HashMap<>();//流程审批数据
|
|
|
+ Map<String, Integer> setupMap = new HashMap<>();//流程审批步骤map
|
|
|
+ LinkedMultiValueMap<String, CustomFlowSequenceDto> approvePassMap = new LinkedMultiValueMap<>();//流程审批通过数据
|
|
|
+ LinkedMultiValueMap<String, CustomFlowSequenceDto> approveRejectMap = new LinkedMultiValueMap<>();//流程审批驳回数据
|
|
|
flowProcessVarMap.computeIfAbsent(SystemConstant.AGGINESS_MAP, v -> agginessMap);
|
|
|
-// flowProcessVarMap.computeIfAbsent(SystemConstant.APPROVE_DATA_MAP, v -> approveDataMap);
|
|
|
- flowProcessVarMap.computeIfAbsent(SystemConstant.AGGINESS_PASS_MAP, v -> approvePassMap);
|
|
|
- flowProcessVarMap.computeIfAbsent(SystemConstant.AGGINESS_REJECT_MAP, v -> approveRejectMap);
|
|
|
- AtomicInteger gatewayId = new AtomicInteger(1);
|
|
|
- AtomicInteger sequenceId = new AtomicInteger(1);
|
|
|
+ flowProcessVarMap.computeIfAbsent(SystemConstant.APPROVE_PASS_MAP, v -> approvePassMap);
|
|
|
+ flowProcessVarMap.computeIfAbsent(SystemConstant.APPROVE_REJECT_MAP, v -> approveRejectMap);
|
|
|
+ flowProcessVarMap.computeIfAbsent(SystemConstant.SETUP_MAP, v -> setupMap);
|
|
|
+ AtomicInteger gatewayId = new AtomicInteger(1);//流程网关id
|
|
|
+ AtomicInteger sequenceId = new AtomicInteger(1);//流程连接id
|
|
|
+ AtomicInteger setup = new AtomicInteger(2);//流程步骤id
|
|
|
CustomFlowDto customFlowDefaultDto = null;
|
|
|
for (int i = 0; i < customFlowLists.size(); i++) {
|
|
|
CustomFlowDto customFlowDto = customFlowLists.get(i);
|
|
@@ -1557,11 +1566,14 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
process.addFlowElement(createStartEvent());
|
|
|
//默认在开始节点后新增一个审批节点
|
|
|
customFlowDefaultDto = multiWorkFlow.createDefaultUserTask(customFlowDto, flowTaskLink, DefaultInstanceConvertToMultiInstance.DEFAULT_USER_TASK);
|
|
|
+ setupMap.put(customFlowDefaultDto.getFlowTaskId(), customFlowDefaultDto.getSetup());
|
|
|
agginessMap.computeIfAbsent(customFlowDefaultDto.getFlowTaskId(), v -> new CustomFlowVarDto(SystemConstant.APPROVE_ID, new ArrayList(Arrays.asList(""))));
|
|
|
process.addFlowElement(createUserTask(CustomFlowDynamicBuildEnum.USER_TASK.getId() + DefaultInstanceConvertToMultiInstance.DEFAULT_USER_TASK, Objects.nonNull(flowTaskLink.getLast().getTask().getContent()) && !Objects.equals(flowTaskLink.getLast().getTask().getContent(), "") ? flowTaskLink.getLast().getTask().getContent() : DefaultInstanceConvertToMultiInstance.DEFAULT_USER_TASK_NAME, DefaultInstanceConvertToMultiInstance.APPROVE_ID_EXP));
|
|
|
break;
|
|
|
case PROCESS://过程节点
|
|
|
+ customFlowDto.setSetup(setup.getAndIncrement());
|
|
|
customFlowDto.setFlowTaskId(CustomFlowDynamicBuildEnum.USER_TASK.getId() + i);
|
|
|
+ setupMap.put(customFlowDto.getFlowTaskId(), customFlowDto.getSetup());
|
|
|
CustomFlowPropertyDto customFlowPropertyDto = customFlowDto.getProperty();
|
|
|
List<String> approveUserIds = new ArrayList<>();//审批用户
|
|
|
List<String> copyUserIds = new ArrayList<>();//抄送用户
|
|
@@ -1596,12 +1608,14 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
switch (customFlowPropertyDto.getRejectType()) {
|
|
|
case PREV://上一节点
|
|
|
String flowTaskId = null;
|
|
|
+ Integer flowSetup = null;
|
|
|
FlowTaskNode flowTaskNode = node.getBefore();
|
|
|
boolean isProcess = false;
|
|
|
while (!isProcess) {
|
|
|
if (flowTaskNode.getTask().getType() == CustomFlowTypeEnum.PROCESS) {
|
|
|
isProcess = true;
|
|
|
flowTaskId = flowTaskNode.getTask().getFlowTaskId();
|
|
|
+ flowSetup = flowTaskNode.getTask().getSetup();
|
|
|
}
|
|
|
flowTaskNode = flowTaskNode.getBefore();
|
|
|
}
|
|
@@ -1611,7 +1625,8 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
process,
|
|
|
gatewayId,
|
|
|
flowTaskId,
|
|
|
- false);
|
|
|
+ false,
|
|
|
+ flowSetup);
|
|
|
break;
|
|
|
case START://发起人节点
|
|
|
this.createCustomFlowExclusiveGatewayAfter(node,
|
|
@@ -1620,20 +1635,23 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
process,
|
|
|
gatewayId,
|
|
|
customFlowDefaultDto.getFlowTaskId(),
|
|
|
- false);
|
|
|
+ false,
|
|
|
+ customFlowDefaultDto.getSetup());
|
|
|
break;
|
|
|
case PREV_ALL://该节点前全部节点
|
|
|
flowTaskNode = node.getBefore();
|
|
|
while (Objects.nonNull(flowTaskNode)) {
|
|
|
if (flowTaskNode.getTask().getType() == CustomFlowTypeEnum.PROCESS) {
|
|
|
flowTaskId = flowTaskNode.getTask().getFlowTaskId();
|
|
|
+ flowSetup = flowTaskNode.getTask().getSetup();
|
|
|
this.createCustomFlowExclusiveGatewayAfter(node,
|
|
|
flowTaskLink,
|
|
|
approveDataMap,
|
|
|
process,
|
|
|
gatewayId,
|
|
|
flowTaskId,
|
|
|
- false);
|
|
|
+ false,
|
|
|
+ flowSetup);
|
|
|
}
|
|
|
flowTaskNode = flowTaskNode.getBefore();
|
|
|
}
|
|
@@ -1660,7 +1678,8 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
gatewayId,
|
|
|
node.getTask().getFlowTaskId(),
|
|
|
true,
|
|
|
- nodeTemp.getNext());
|
|
|
+ nodeTemp.getNext(),
|
|
|
+ node.getTask().getSetup());
|
|
|
} else {
|
|
|
this.createCustomFlowExclusiveGatewayBefore(node,
|
|
|
flowTaskLink,
|
|
@@ -1670,7 +1689,8 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
gatewayId,
|
|
|
node.getTask().getFlowTaskId(),
|
|
|
true,
|
|
|
- null);
|
|
|
+ null,
|
|
|
+ node.getTask().getSetup());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1693,7 +1713,10 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
} else {
|
|
|
customFlowTypeEnumCustomFlowDtoMap.computeIfAbsent(CustomFlowTypeEnum.END, v -> customFlowDto);
|
|
|
}
|
|
|
+ customFlowDto.setSetup(0);
|
|
|
customFlowDto.setFlowTaskId(CustomFlowDynamicBuildEnum.END.getId());
|
|
|
+ setupMap.put(customFlowDto.getFlowTaskId(), customFlowDto.getSetup());
|
|
|
+ setupMap.put(SystemConstant.SIZE, setup.get() - 1);
|
|
|
process.addFlowElement(createEndEvent());
|
|
|
break;
|
|
|
default:
|
|
@@ -1701,43 +1724,35 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Map<String, String> flowExecMap = new HashMap<>();
|
|
|
for (int i = 1; i < flowTaskLink.size(); i++) {
|
|
|
FlowTaskNode flowTaskNode = flowTaskLink.get(i);
|
|
|
- log.info("1 start:{},end:{}", flowTaskNode.getBefore().getTask().getFlowTaskId(), flowTaskNode.getTask().getFlowTaskId());
|
|
|
String normalSequenceId = DefaultInstanceConvertToMultiInstance.SEQUENCE_NAME + sequenceId.getAndIncrement();
|
|
|
if (flowTaskNode.getBefore().getTask().getType() == CustomFlowTypeEnum.EXCLUSIVE_GATE_WAY) {
|
|
|
- SequenceFlow sequenceFlow = createSequenceFlow(flowTaskNode.getBefore().getTask().getFlowTaskId(), flowTaskNode.getTask().getFlowTaskId(), normalSequenceId, FlowApprovePassEnum.PASS.getTitle(), DefaultInstanceConvertToMultiInstance.EXP_PREFIX + SystemConstant.APPROVE + DefaultInstanceConvertToMultiInstance.EXP_EQUAL + "'" + flowTaskNode.getTask().getFlowTaskId() + "'" + DefaultInstanceConvertToMultiInstance.EXP_SUFFIX, flowExecMap);
|
|
|
- if (Objects.nonNull(sequenceFlow)) {
|
|
|
- if (flowTaskNode.getBefore().getTask().getType() == CustomFlowTypeEnum.EXCLUSIVE_GATE_WAY) {
|
|
|
- approvePassMap.add(flowTaskNode.getBefore().getBefore().getTask().getFlowTaskId(), new CustomFlowSequenceDto(flowTaskNode.getTask().getFlowTaskId(), sequenceFlow.getConditionExpression(), true));
|
|
|
- } else {
|
|
|
- approvePassMap.add(flowTaskNode.getBefore().getTask().getFlowTaskId(), new CustomFlowSequenceDto(flowTaskNode.getTask().getFlowTaskId(), sequenceFlow.getConditionExpression(), true));
|
|
|
- }
|
|
|
- process.addFlowElement(sequenceFlow);
|
|
|
+ String conditionExp = DefaultInstanceConvertToMultiInstance.EXP_PREFIX + SystemConstant.APPROVE + DefaultInstanceConvertToMultiInstance.EXP_EQUAL + "'" + flowTaskNode.getTask().getFlowTaskId() + "'" + DefaultInstanceConvertToMultiInstance.EXP_SUFFIX;
|
|
|
+ if (flowTaskNode.getBefore().getTask().getType() == CustomFlowTypeEnum.EXCLUSIVE_GATE_WAY) {
|
|
|
+ approvePassMap.add(flowTaskNode.getBefore().getBefore().getTask().getFlowTaskId(), new CustomFlowSequenceDto(flowTaskNode.getTask().getFlowTaskId(), conditionExp, true, flowTaskNode.getTask().getSetup()));
|
|
|
+ } else {
|
|
|
+ approvePassMap.add(flowTaskNode.getBefore().getTask().getFlowTaskId(), new CustomFlowSequenceDto(flowTaskNode.getTask().getFlowTaskId(), conditionExp, true, flowTaskNode.getTask().getSetup()));
|
|
|
}
|
|
|
+ log.info("1 start:{},end:{}", flowTaskNode.getBefore().getTask().getFlowTaskId(), flowTaskNode.getTask().getFlowTaskId());
|
|
|
+ process.addFlowElement(createSequenceFlow(flowTaskNode.getBefore().getTask().getFlowTaskId(), flowTaskNode.getTask().getFlowTaskId(), normalSequenceId, FlowApprovePassEnum.PASS.getTitle(), conditionExp));
|
|
|
} else {
|
|
|
- SequenceFlow sequenceFlow = createSequenceFlow(flowTaskNode.getBefore().getTask().getFlowTaskId(), flowTaskNode.getTask().getFlowTaskId(), normalSequenceId, FlowApprovePassEnum.PASS.getTitle(), null, flowExecMap);
|
|
|
- if (Objects.nonNull(sequenceFlow)) {
|
|
|
- if (flowTaskNode.getBefore().getTask().getType() == CustomFlowTypeEnum.EXCLUSIVE_GATE_WAY) {
|
|
|
- approvePassMap.add(flowTaskNode.getBefore().getBefore().getTask().getFlowTaskId(), new CustomFlowSequenceDto(flowTaskNode.getTask().getFlowTaskId(), true));
|
|
|
- } else {
|
|
|
- approvePassMap.add(flowTaskNode.getBefore().getTask().getFlowTaskId(), new CustomFlowSequenceDto(flowTaskNode.getTask().getFlowTaskId(), true));
|
|
|
- }
|
|
|
- process.addFlowElement(sequenceFlow);
|
|
|
+ if (flowTaskNode.getBefore().getTask().getType() == CustomFlowTypeEnum.EXCLUSIVE_GATE_WAY) {
|
|
|
+ approvePassMap.add(flowTaskNode.getBefore().getBefore().getTask().getFlowTaskId(), new CustomFlowSequenceDto(flowTaskNode.getTask().getFlowTaskId(), true, flowTaskNode.getTask().getSetup()));
|
|
|
+ } else {
|
|
|
+ approvePassMap.add(flowTaskNode.getBefore().getTask().getFlowTaskId(), new CustomFlowSequenceDto(flowTaskNode.getTask().getFlowTaskId(), true, flowTaskNode.getTask().getSetup()));
|
|
|
}
|
|
|
+ log.info("2 start:{},end:{}", flowTaskNode.getBefore().getTask().getFlowTaskId(), flowTaskNode.getTask().getFlowTaskId());
|
|
|
+ process.addFlowElement(createSequenceFlow(flowTaskNode.getBefore().getTask().getFlowTaskId(), flowTaskNode.getTask().getFlowTaskId(), normalSequenceId, FlowApprovePassEnum.PASS.getTitle(), null));
|
|
|
}
|
|
|
List<CustomFlowSequenceDto> beforeFlowTaskIdsList = flowTaskNode.getTask().getBeforeFlowTaskIds();
|
|
|
if (Objects.nonNull(beforeFlowTaskIdsList)) {
|
|
|
for (CustomFlowSequenceDto c : beforeFlowTaskIdsList) {
|
|
|
String gatewaySequenceId = DefaultInstanceConvertToMultiInstance.SEQUENCE_NAME + sequenceId.getAndIncrement();
|
|
|
if (Objects.nonNull(c.getBeforeFlowTaskId())) {
|
|
|
- log.info("2 start:{},end:{}", flowTaskNode.getTask().getFlowTaskId(), c.getBeforeFlowTaskId());
|
|
|
- SequenceFlow sequenceFlow = createSequenceFlow(flowTaskNode.getTask().getFlowTaskId(), c.getBeforeFlowTaskId(), gatewaySequenceId, FlowApprovePassEnum.PASS.getTitle(), c.getConditionExp(), flowExecMap);
|
|
|
- if (Objects.nonNull(sequenceFlow)) {
|
|
|
- approvePassMap.add(flowTaskNode.getBefore().getTask().getFlowTaskId(), c);
|
|
|
- process.addFlowElement(sequenceFlow);
|
|
|
- }
|
|
|
+ approvePassMap.add(flowTaskNode.getBefore().getTask().getFlowTaskId(), c);
|
|
|
+ log.info("3 start:{},end:{}", flowTaskNode.getTask().getFlowTaskId(), c.getBeforeFlowTaskId());
|
|
|
+ process.addFlowElement(createSequenceFlow(flowTaskNode.getTask().getFlowTaskId(), c.getBeforeFlowTaskId(), gatewaySequenceId, FlowApprovePassEnum.PASS.getTitle(), c.getConditionExp()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1746,17 +1761,13 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
for (CustomFlowSequenceDto c : afterFlowTaskIdsList) {
|
|
|
String gatewaySequenceId = DefaultInstanceConvertToMultiInstance.SEQUENCE_NAME + sequenceId.getAndIncrement();
|
|
|
if (Objects.nonNull(c.getAfterFlowTaskId())) {
|
|
|
- log.info("3 start:{},end:{}", flowTaskNode.getTask().getFlowTaskId(), c.getAfterFlowTaskId());
|
|
|
- SequenceFlow sequenceFlow = createSequenceFlow(flowTaskNode.getTask().getFlowTaskId(), c.getAfterFlowTaskId(), gatewaySequenceId, FlowApprovePassEnum.REJECT.getTitle(), c.getConditionExp(), flowExecMap);
|
|
|
- if (Objects.nonNull(sequenceFlow)) {
|
|
|
- approveRejectMap.add(flowTaskNode.getBefore().getTask().getFlowTaskId(), c);
|
|
|
- process.addFlowElement(sequenceFlow);
|
|
|
- }
|
|
|
+ approveRejectMap.add(flowTaskNode.getBefore().getTask().getFlowTaskId(), c);
|
|
|
+ log.info("4 start:{},end:{}", flowTaskNode.getTask().getFlowTaskId(), c.getAfterFlowTaskId());
|
|
|
+ process.addFlowElement(createSequenceFlow(flowTaskNode.getTask().getFlowTaskId(), c.getAfterFlowTaskId(), gatewaySequenceId, FlowApprovePassEnum.REJECT.getTitle(), c.getConditionExp()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
//生成图像信息
|
|
|
new BpmnAutoLayout(model).execute();
|
|
|
|
|
@@ -1785,7 +1796,8 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
Process process,
|
|
|
AtomicInteger gatewayId,
|
|
|
String flowTaskId,
|
|
|
- boolean pass) {
|
|
|
+ boolean pass,
|
|
|
+ Integer setup) {
|
|
|
CustomFlowGatewayDto customFlowGatewayDto = null;
|
|
|
FlowTaskNode customFlowExclusiveGatewayTaskNode = null;
|
|
|
List<CustomFlowSequenceDto> customFlowSequenceDtoList = null;
|
|
@@ -1801,7 +1813,7 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
} else {
|
|
|
customFlowExclusiveGatewayTaskNode = node.getNext();
|
|
|
}
|
|
|
- CustomFlowSequenceDto customFlowSequenceRejectDto = new CustomFlowSequenceDto(flowTaskId, DefaultInstanceConvertToMultiInstance.EXP_PREFIX + SystemConstant.APPROVE + DefaultInstanceConvertToMultiInstance.EXP_EQUAL + "'" + flowTaskId + "'" + DefaultInstanceConvertToMultiInstance.EXP_SUFFIX, pass);
|
|
|
+ CustomFlowSequenceDto customFlowSequenceRejectDto = new CustomFlowSequenceDto(flowTaskId, DefaultInstanceConvertToMultiInstance.EXP_PREFIX + SystemConstant.APPROVE + DefaultInstanceConvertToMultiInstance.EXP_EQUAL + "'" + flowTaskId + "'" + DefaultInstanceConvertToMultiInstance.EXP_SUFFIX, pass, setup);
|
|
|
Map<String, List<CustomFlowSequenceDto>> flowTaskIds = customFlowGatewayDto.getFlowTaskIds();
|
|
|
flowTaskIds = Objects.isNull(flowTaskIds) ? new HashMap<>() : flowTaskIds;
|
|
|
if (flowTaskIds.containsKey(customFlowGatewayDto.getAfterExclusiveGatewayId())) {
|
|
@@ -1828,6 +1840,7 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
* @param flowTaskId
|
|
|
* @param pass
|
|
|
* @param exclusiveGatewayTaskNode
|
|
|
+ * @param setup
|
|
|
*/
|
|
|
protected void createCustomFlowExclusiveGatewayBefore(FlowTaskNode node,
|
|
|
FlowTaskLink flowTaskLink,
|
|
@@ -1837,7 +1850,8 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
AtomicInteger gatewayId,
|
|
|
String flowTaskId,
|
|
|
boolean pass,
|
|
|
- FlowTaskNode exclusiveGatewayTaskNode) {
|
|
|
+ FlowTaskNode exclusiveGatewayTaskNode,
|
|
|
+ Integer setup) {
|
|
|
CustomFlowGatewayDto customFlowGatewayDto = null;
|
|
|
FlowTaskNode customFlowExclusiveGatewayTaskNode = exclusiveGatewayTaskNode;
|
|
|
List<CustomFlowSequenceDto> customFlowSequenceDtoList = null;
|
|
@@ -1852,7 +1866,7 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
}
|
|
|
customFlowGatewayDto.setBeforeExclusiveGatewayId(customFlowExclusiveGatewayTaskNode.getTask().getFlowTaskId());
|
|
|
|
|
|
- CustomFlowSequenceDto customFlowSequenceRejectDto = new CustomFlowSequenceDto(flowTaskId, DefaultInstanceConvertToMultiInstance.EXP_PREFIX + SystemConstant.APPROVE + DefaultInstanceConvertToMultiInstance.EXP_EQUAL + "'" + flowTaskId + "'" + DefaultInstanceConvertToMultiInstance.EXP_SUFFIX, pass);
|
|
|
+ CustomFlowSequenceDto customFlowSequenceRejectDto = new CustomFlowSequenceDto(flowTaskId, DefaultInstanceConvertToMultiInstance.EXP_PREFIX + SystemConstant.APPROVE + DefaultInstanceConvertToMultiInstance.EXP_EQUAL + "'" + flowTaskId + "'" + DefaultInstanceConvertToMultiInstance.EXP_SUFFIX, pass, setup);
|
|
|
Map<String, List<CustomFlowSequenceDto>> flowTaskIds = customFlowGatewayDto.getFlowTaskIds();
|
|
|
flowTaskIds = Objects.isNull(flowTaskIds) ? new HashMap<>() : flowTaskIds;
|
|
|
if (flowTaskIds.containsKey(customFlowGatewayDto.getBeforeExclusiveGatewayId())) {
|
|
@@ -2026,23 +2040,17 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
* @param id
|
|
|
* @param name 连线名称(可不填)
|
|
|
* @param conditionExpression 网关每一种线路走向的条件表达式
|
|
|
- * @param map
|
|
|
* @return
|
|
|
*/
|
|
|
- protected SequenceFlow createSequenceFlow(String from, String to, String id, String name, String conditionExpression, Map<String, String> map) {
|
|
|
- if (!map.containsKey(from + "_" + to)) {
|
|
|
- SequenceFlow flow = new SequenceFlow();
|
|
|
- flow.setSourceRef(from);
|
|
|
- flow.setTargetRef(to);
|
|
|
- flow.setId(id);
|
|
|
- flow.setName(name);
|
|
|
- if (Objects.nonNull(conditionExpression)) {
|
|
|
- flow.setConditionExpression(conditionExpression);
|
|
|
- }
|
|
|
- map.put(from + "_" + to, from + "_" + to);
|
|
|
- return flow;
|
|
|
- } else {
|
|
|
- return null;
|
|
|
+ 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);
|
|
|
}
|
|
|
+ return flow;
|
|
|
}
|
|
|
}
|