|
@@ -230,11 +230,12 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
protected Deployment flowDeployment(Map<String, Object> map) {
|
|
|
String id = (String) map.get(SystemConstant.ID);
|
|
|
BpmnModel model = (BpmnModel) map.get(SystemConstant.MODEL);
|
|
|
+ Integer version = (Integer) map.get(SystemConstant.VERSION);
|
|
|
|
|
|
|
|
|
String bpmnName = id + DefaultInstanceConvertToMultiInstance.FLOW_BPMN_MODEL_NAME;
|
|
|
String bpmnDeploymentName = id + DefaultInstanceConvertToMultiInstance.FLOW_BPMN_DEPLOYMENT_NAME;
|
|
|
- String bpmnProcessName = id + DefaultInstanceConvertToMultiInstance.FLOW_BPMN_PROCESS_NAME;
|
|
|
+ String bpmnProcessName = id + "_v" + version + DefaultInstanceConvertToMultiInstance.FLOW_BPMN_PROCESS_NAME;
|
|
|
|
|
|
Deployment deployment = repositoryService.createDeployment().addBpmnModel(bpmnName, model).name(bpmnDeploymentName).deploy();
|
|
|
map.remove(SystemConstant.MODEL);
|
|
@@ -410,62 +411,40 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
if (approvePass == FlowApprovePassEnum.PASS) {
|
|
|
int currSetup = currFlowTaskResult.getSetup().intValue();
|
|
|
currSetup = currSetup == setupMap.size() - 1 ? 0 : currSetup + 1;
|
|
|
-
|
|
|
- if (tfFlowApprove.getStatus() == FlowStatusEnum.REJECT) {
|
|
|
-
|
|
|
- FlowTaskResult flowTaskResultRejectLinkDto = null;
|
|
|
- Map<String, FlowTaskResult> rejectLinkMap = null;
|
|
|
- if (Objects.nonNull(tfFlowApprove.getRejectLink())) {
|
|
|
- rejectLinkMap = JacksonUtil.readJson(tfFlowApprove.getRejectLink(), Map.class);
|
|
|
- if (Objects.nonNull(rejectLinkMap.get(userTask.getId()))) {
|
|
|
- flowTaskResultRejectLinkDto = gson.fromJson(gson.toJson(rejectLinkMap.get(userTask.getId())), FlowTaskResult.class);
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+ FlowTaskResult flowTaskResultRejectLinkDto = null;
|
|
|
+ Map<String, FlowTaskResult> rejectLinkMap = null;
|
|
|
+ if (Objects.nonNull(tfFlowApprove.getRejectLink())) {
|
|
|
+ rejectLinkMap = JacksonUtil.readJson(tfFlowApprove.getRejectLink(), Map.class);
|
|
|
+ if (Objects.nonNull(rejectLinkMap.get(userTask.getId()))) {
|
|
|
+ flowTaskResultRejectLinkDto = gson.fromJson(gson.toJson(rejectLinkMap.get(userTask.getId())), FlowTaskResult.class);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- nextFlowTaskResult = this.getNextFlowTaskResult(nrOfCompletedInstances,
|
|
|
- nrOfInstances,
|
|
|
- currFlowTaskResult,
|
|
|
- nextFlowTaskResult,
|
|
|
- Objects.nonNull(flowTaskResultRejectLinkDto) ? flowTaskResultRejectLinkDto.getSetup() : currSetup,
|
|
|
- setupMap,
|
|
|
- gson,
|
|
|
- approvePass);
|
|
|
-
|
|
|
- this.approvePass(currFlowTaskResult,
|
|
|
- setupMap,
|
|
|
- multiInstance,
|
|
|
- nrOfCompletedInstances,
|
|
|
- nrOfInstances,
|
|
|
- tfFlowApprove,
|
|
|
- tfFlowLog,
|
|
|
- nextFlowTaskResult,
|
|
|
- map,
|
|
|
- id);
|
|
|
-
|
|
|
- if (Objects.nonNull(flowTaskResultRejectLinkDto)) {
|
|
|
- rejectLinkMap.remove(userTask.getId());
|
|
|
- tfFlowApprove.setRejectLink(rejectLinkMap.size() == 0 ? null : JacksonUtil.parseJson(rejectLinkMap));
|
|
|
- }
|
|
|
- } else {
|
|
|
- nextFlowTaskResult = this.getNextFlowTaskResult(nrOfCompletedInstances,
|
|
|
- nrOfInstances,
|
|
|
- currFlowTaskResult,
|
|
|
- nextFlowTaskResult,
|
|
|
- currSetup,
|
|
|
- setupMap,
|
|
|
- gson,
|
|
|
- approvePass);
|
|
|
-
|
|
|
- this.approvePass(currFlowTaskResult,
|
|
|
- setupMap,
|
|
|
- multiInstance,
|
|
|
- nrOfCompletedInstances,
|
|
|
- nrOfInstances,
|
|
|
- tfFlowApprove,
|
|
|
- tfFlowLog,
|
|
|
- nextFlowTaskResult,
|
|
|
- map,
|
|
|
- id);
|
|
|
+ nextFlowTaskResult = this.getNextFlowTaskResult(nrOfCompletedInstances,
|
|
|
+ nrOfInstances,
|
|
|
+ currFlowTaskResult,
|
|
|
+ nextFlowTaskResult,
|
|
|
+ Objects.nonNull(flowTaskResultRejectLinkDto) ? flowTaskResultRejectLinkDto.getSetup() : currSetup,
|
|
|
+ setupMap,
|
|
|
+ gson,
|
|
|
+ approvePass);
|
|
|
+
|
|
|
+ this.approvePass(currFlowTaskResult,
|
|
|
+ setupMap,
|
|
|
+ multiInstance,
|
|
|
+ nrOfCompletedInstances,
|
|
|
+ nrOfInstances,
|
|
|
+ tfFlowApprove,
|
|
|
+ tfFlowLog,
|
|
|
+ nextFlowTaskResult,
|
|
|
+ map,
|
|
|
+ id);
|
|
|
+
|
|
|
+ if (Objects.nonNull(flowTaskResultRejectLinkDto)) {
|
|
|
+ rejectLinkMap.remove(userTask.getId());
|
|
|
+ tfFlowApprove.setRejectLink(rejectLinkMap.size() == 0 ? null : JacksonUtil.parseJson(rejectLinkMap));
|
|
|
}
|
|
|
} else if (approvePass == FlowApprovePassEnum.REJECT) {
|
|
|
Optional.ofNullable(map.get(SystemConstant.APPROVE_SETUP)).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("流程驳回节点不能为空"));
|
|
@@ -1831,12 +1810,13 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
*
|
|
|
* @param customFlowSaveDto
|
|
|
* @param id
|
|
|
+ * @param version
|
|
|
* @return
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Map<String, Object> dynamicBuildBpmn(CustomFlowSaveDto customFlowSaveDto, String id) throws IOException {
|
|
|
+ public Map<String, Object> dynamicBuildBpmn(CustomFlowSaveDto customFlowSaveDto, String id, Integer version) throws IOException {
|
|
|
BpmnModel model = new BpmnModel();
|
|
|
Process process = new Process();
|
|
|
model.addProcess(process);
|
|
@@ -2074,6 +2054,7 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
map.computeIfAbsent(SystemConstant.ID, v -> id);
|
|
|
map.computeIfAbsent(SystemConstant.MODEL, v -> model);
|
|
|
map.computeIfAbsent(SystemConstant.FLOW_PROCESS_VAR_MAP, v -> flowProcessVarMap);
|
|
|
+ map.computeIfAbsent(SystemConstant.VERSION, v -> version);
|
|
|
this.flowDeployment(map);
|
|
|
return map;
|
|
|
}
|
|
@@ -2160,10 +2141,12 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
customFlowGatewayDto = new CustomFlowGatewayDto();
|
|
|
}
|
|
|
|
|
|
- if (Objects.isNull(customFlowExclusiveGatewayTaskNode) && Objects.isNull(customFlowGatewayDto.getBeforeExclusiveGatewayId())) {
|
|
|
+ if (Objects.isNull(customFlowExclusiveGatewayTaskNode) && (Objects.isNull(customFlowGatewayDto.getBeforeExclusiveGatewayId()) || customFlowGatewayDto.getBeforeExclusiveGatewayId().size() == 0)) {
|
|
|
customFlowExclusiveGatewayTaskNode = createCustomFlowExclusiveGateway(flowTaskLink, index, process, gatewayId);
|
|
|
}
|
|
|
- customFlowGatewayDto.setBeforeExclusiveGatewayId(customFlowExclusiveGatewayTaskNode.getTask().getFlowTaskId());
|
|
|
+ List<String> beforeExclusiveGatewayIdList = customFlowGatewayDto.getBeforeExclusiveGatewayId();
|
|
|
+ beforeExclusiveGatewayIdList.add(customFlowExclusiveGatewayTaskNode.getTask().getFlowTaskId());
|
|
|
+ customFlowGatewayDto.setBeforeExclusiveGatewayId(beforeExclusiveGatewayIdList);
|
|
|
|
|
|
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();
|
|
@@ -2174,10 +2157,12 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
|
customFlowSequenceDtoList = new ArrayList<>();
|
|
|
}
|
|
|
customFlowSequenceDtoList.add(customFlowSequenceRejectDto);
|
|
|
- flowTaskIds.put(customFlowGatewayDto.getBeforeExclusiveGatewayId(), customFlowSequenceDtoList);
|
|
|
+ flowTaskIds.put(customFlowExclusiveGatewayTaskNode.getTask().getFlowTaskId(), customFlowSequenceDtoList);
|
|
|
customFlowGatewayDto.setFlowTaskIds(flowTaskIds);
|
|
|
approveDataMap.put(node.getTask().getFlowTaskId(), customFlowGatewayDto);
|
|
|
- customFlowExclusiveGatewayTaskNode.getTask().setBeforeFlowTaskIds(flowTaskIds.get(customFlowExclusiveGatewayTaskNode.getTask().getFlowTaskId()));
|
|
|
+ List<CustomFlowSequenceDto> customFlowSequenceGateWayDtoList = customFlowExclusiveGatewayTaskNode.getTask().getBeforeFlowTaskIds();
|
|
|
+ customFlowSequenceGateWayDtoList.addAll(flowTaskIds.get(customFlowExclusiveGatewayTaskNode.getTask().getFlowTaskId()));
|
|
|
+ customFlowExclusiveGatewayTaskNode.getTask().setBeforeFlowTaskIds(customFlowSequenceGateWayDtoList);
|
|
|
}
|
|
|
|
|
|
|