From 1a6bab03d498682807f80ee8eee0b16c3b735500 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Tue, 28 May 2024 10:37:52 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20IT=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?-=E5=BD=93=E7=AD=89=E5=BE=85=E8=81=9A=E5=90=88=E7=9A=84?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E8=A2=AB=E6=94=BE=E5=BC=83=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E6=97=B6=E9=9C=80=E9=87=8D=E6=96=B0=E8=81=9A=E5=90=88=E6=AD=A5?= =?UTF-8?q?=E9=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1165959513997312]IT服务-当等待聚合的路径被放弃执行时需重新聚合步骤 http://192.168.0.96:8090/demo/rdm.html#/bug-detail/939050947543040/939050947543057/1165959513997312 --- .../core/ProcessStepHandlerBase.java | 106 +++++++++++++++++- 1 file changed, 104 insertions(+), 2 deletions(-) diff --git a/src/main/java/neatlogic/framework/process/stephandler/core/ProcessStepHandlerBase.java b/src/main/java/neatlogic/framework/process/stephandler/core/ProcessStepHandlerBase.java index b578f34b..36a35e95 100644 --- a/src/main/java/neatlogic/framework/process/stephandler/core/ProcessStepHandlerBase.java +++ b/src/main/java/neatlogic/framework/process/stephandler/core/ProcessStepHandlerBase.java @@ -219,6 +219,16 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { break; } } + if (!hasDoingStep) { + for (ProcessTaskStepRelVo fromProcessTaskStepRelVo : fromProcessTaskStepRelList) { + if (Objects.equals(fromProcessTaskStepRelVo.getType(), ProcessFlowDirection.FORWARD.getValue())) { + if (fromProcessTaskStepRelVo.getIsHit().equals(0)) { + hasDoingStep = true; + } + } + } + System.out.println("hasDoingStep = " + hasDoingStep); + } if (!hasDoingStep) { canFire = true; } @@ -937,6 +947,48 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { // }); } } + // 默认是向前流转 + ProcessFlowDirection direction = ProcessFlowDirection.FORWARD; + // 判断是向前流转还是向后回退,向后回退时nextStepIdSet大小一定是1,因为条件节点和分流节点都不能向后回退 + if (nextStepIdSet.size() == 1) { + // 找出当前步骤的所有正向的下一个步骤列表,如果nextStepIdSet不包含下一个步骤id,则是向后回退 + boolean isForward = false; + List toProcessTaskStepList = processTaskCrossoverMapper.getToProcessTaskStepByFromIdAndType(currentProcessTaskStepVo.getId(), ProcessFlowDirection.FORWARD.getValue()); + for (ProcessTaskStepVo toProcessTaskStep : toProcessTaskStepList) { + if (nextStepIdSet.contains(toProcessTaskStep.getId())) { + isForward = true; + break; + } + } + if (!isForward) { + direction = ProcessFlowDirection.BACKWARD; + } + } + // 如果是向前流转时,需要找出不流转的路经,判断是否有聚合步骤在等待该条路径到达才能前进,如果有,则激活该聚合步骤 + if (direction == ProcessFlowDirection.FORWARD) { + List awaitAdvanceStepIdList = getAwaitAdvanceStepIdList(currentProcessTaskStepVo.getProcessTaskId(), currentProcessTaskStepVo.getId()); + if (CollectionUtils.isNotEmpty(awaitAdvanceStepIdList)) { + List awaitAdvanceStepList = processTaskCrossoverMapper.getProcessTaskStepListByIdList(awaitAdvanceStepIdList); + for (ProcessTaskStepVo awaitAdvanceStep : awaitAdvanceStepList) { + IProcessStepHandler awaitAdvanceStepHandler = ProcessStepHandlerFactory.getHandler(awaitAdvanceStep.getHandler()); + if (awaitAdvanceStepHandler != null) { + awaitAdvanceStep.setFromProcessTaskStepId(currentProcessTaskStepVo.getId()); + awaitAdvanceStep.setStartProcessTaskStepId(currentProcessTaskStepVo.getStartProcessTaskStepId()); + awaitAdvanceStep.setParallelActivateStepIdList(new ArrayList<>()); + ProcessTaskStepThread thread = new ProcessTaskStepThread(ProcessTaskOperationType.STEP_ACTIVE, awaitAdvanceStep, awaitAdvanceStepHandler.getMode()) { + @Override + protected void myExecute(ProcessTaskStepVo processTaskStepVo) { + IProcessStepHandler processStepHandler = ProcessStepHandlerFactory.getHandler(processTaskStepVo.getHandler()); + if (processStepHandler != null) { + processStepHandler.active(processTaskStepVo); + } + } + }; + processTaskStepThreadList.add(thread); + } + } + } + } doNext(processTaskStepThreadList); /* 触发通知 **/ @@ -989,6 +1041,58 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { return 1; } + /** + * 获取等待前进的聚合步骤列表 + */ + private List getAwaitAdvanceStepIdList(Long processTaskId, Long currentProcessTaskStepId) { + IProcessTaskCrossoverMapper processTaskCrossoverMapper = CrossoverServiceFactory.getApi(IProcessTaskCrossoverMapper.class); + List allProcessTaskStepRelList = processTaskCrossoverMapper.getProcessTaskStepRelByProcessTaskId(processTaskId); + return doGetAwaitAdvanceStepIdList(currentProcessTaskStepId, allProcessTaskStepRelList); + } + + private List doGetAwaitAdvanceStepIdList(Long currentProcessTaskStepId, List allProcessTaskStepRelList) { + List awaitAdvanceStepIdList = new ArrayList<>(); + // 失效步骤ID列表 + List invalidStepIdList = new ArrayList<>(); + for (ProcessTaskStepRelVo processTaskStepRelVo : allProcessTaskStepRelList) { + if (Objects.equals(processTaskStepRelVo.getFromProcessTaskStepId(), currentProcessTaskStepId) + && Objects.equals(processTaskStepRelVo.getType(), ProcessFlowDirection.FORWARD.getValue())) { + if (Objects.equals(processTaskStepRelVo.getIsHit(), -1)) { + invalidStepIdList.add(processTaskStepRelVo.getToProcessTaskStepId()); + } + } + } + // 需要进一步下探的步骤ID列表 + List needExploreStepIdList = new ArrayList<>(); + for (Long invalidStepId : invalidStepIdList) { + int isHit0Count = 0; + int isHit1Count = 0; + for (ProcessTaskStepRelVo processTaskStepRelVo : allProcessTaskStepRelList) { + if (Objects.equals(processTaskStepRelVo.getToProcessTaskStepId(), invalidStepId) + && Objects.equals(processTaskStepRelVo.getType(), ProcessFlowDirection.FORWARD.getValue())) { + if (Objects.equals(processTaskStepRelVo.getIsHit(), 0)) { + isHit0Count++; + break; + } else if (Objects.equals(processTaskStepRelVo.getIsHit(), 1)) { + isHit1Count++; + } + } + } + if (isHit0Count > 0) { + continue; + } + if (isHit1Count > 0) { + awaitAdvanceStepIdList.add(invalidStepId); + } else { + needExploreStepIdList.add(invalidStepId); + } + } + for (Long stepId : needExploreStepIdList) { + List list = doGetAwaitAdvanceStepIdList(stepId, allProcessTaskStepRelList); + awaitAdvanceStepIdList.addAll(list); + } + return awaitAdvanceStepIdList; + } protected abstract int myComplete(ProcessTaskStepVo currentProcessTaskStepVo) throws ProcessTaskException; protected int myBeforeComplete(ProcessTaskStepVo currentProcessTaskStepVo) throws ProcessTaskException { @@ -2226,8 +2330,6 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { * @param needProcessTaskStepRelList 需要更新isHit值为-1的连线列表 */ private void doIdentifyPostInvalidStepRelIsHit(Long currentProcessTaskStepId, Set activeStepIdSet, List allProcessTaskStepRelList, List needProcessTaskStepRelList) { - IProcessTaskCrossoverMapper processTaskCrossoverMapper = CrossoverServiceFactory.getApi(IProcessTaskCrossoverMapper.class); - ProcessTaskStepVo processTaskStep = processTaskCrossoverMapper.getProcessTaskStepBaseInfoById(currentProcessTaskStepId); List unactiveStepIdList = null; List allNextStepIdList = new ArrayList<>(); for (ProcessTaskStepRelVo processTaskStepRelVo : allProcessTaskStepRelList) { -- Gitee From 2941f38d1358ed1e279a9ae1d099914a3a060ec8 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Tue, 28 May 2024 11:33:54 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20IT=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?-=E5=BD=93=E7=AD=89=E5=BE=85=E8=81=9A=E5=90=88=E7=9A=84?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E8=A2=AB=E6=94=BE=E5=BC=83=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E6=97=B6=E9=9C=80=E9=87=8D=E6=96=B0=E8=81=9A=E5=90=88=E6=AD=A5?= =?UTF-8?q?=E9=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1165959513997312]IT服务-当等待聚合的路径被放弃执行时需重新聚合步骤 http://192.168.0.96:8090/demo/rdm.html#/bug-detail/939050947543040/939050947543057/1165959513997312 --- .../stephandler/core/ProcessStepHandlerBase.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/neatlogic/framework/process/stephandler/core/ProcessStepHandlerBase.java b/src/main/java/neatlogic/framework/process/stephandler/core/ProcessStepHandlerBase.java index 36a35e95..7e4f5aae 100644 --- a/src/main/java/neatlogic/framework/process/stephandler/core/ProcessStepHandlerBase.java +++ b/src/main/java/neatlogic/framework/process/stephandler/core/ProcessStepHandlerBase.java @@ -1047,11 +1047,15 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { private List getAwaitAdvanceStepIdList(Long processTaskId, Long currentProcessTaskStepId) { IProcessTaskCrossoverMapper processTaskCrossoverMapper = CrossoverServiceFactory.getApi(IProcessTaskCrossoverMapper.class); List allProcessTaskStepRelList = processTaskCrossoverMapper.getProcessTaskStepRelByProcessTaskId(processTaskId); - return doGetAwaitAdvanceStepIdList(currentProcessTaskStepId, allProcessTaskStepRelList); + return doGetAwaitAdvanceStepIdList(currentProcessTaskStepId, allProcessTaskStepRelList, new ArrayList<>()); } - private List doGetAwaitAdvanceStepIdList(Long currentProcessTaskStepId, List allProcessTaskStepRelList) { + private List doGetAwaitAdvanceStepIdList(Long currentProcessTaskStepId, List allProcessTaskStepRelList, List passedStepIdList) { List awaitAdvanceStepIdList = new ArrayList<>(); + if (passedStepIdList.contains(currentProcessTaskStepId)) { + return awaitAdvanceStepIdList; + } + passedStepIdList.add(currentProcessTaskStepId); // 失效步骤ID列表 List invalidStepIdList = new ArrayList<>(); for (ProcessTaskStepRelVo processTaskStepRelVo : allProcessTaskStepRelList) { @@ -1088,7 +1092,7 @@ public abstract class ProcessStepHandlerBase implements IProcessStepHandler { } } for (Long stepId : needExploreStepIdList) { - List list = doGetAwaitAdvanceStepIdList(stepId, allProcessTaskStepRelList); + List list = doGetAwaitAdvanceStepIdList(stepId, allProcessTaskStepRelList, passedStepIdList); awaitAdvanceStepIdList.addAll(list); } return awaitAdvanceStepIdList; -- Gitee