From 62036cc09bbe5346868b98fcc373910b55da08b9 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期五, 06 十二月 2024 14:04:49 +0800
Subject: [PATCH] bug修改
---
flowable/src/main/java/com/ycl/service/common/TaskCommonService.java | 72 ++++++++++++++++++++++++++----------
1 files changed, 52 insertions(+), 20 deletions(-)
diff --git a/flowable/src/main/java/com/ycl/service/common/TaskCommonService.java b/flowable/src/main/java/com/ycl/service/common/TaskCommonService.java
index 5335db3..f95cdaf 100644
--- a/flowable/src/main/java/com/ycl/service/common/TaskCommonService.java
+++ b/flowable/src/main/java/com/ycl/service/common/TaskCommonService.java
@@ -36,7 +36,7 @@
* @param currentNodeDefId
* @return
*/
- public List<FormDetailVO> getBeforeNodeDefId(String processDefId, String currentNodeDefId, ISysFormService sysFormService) {
+ public List<FormDetailVO> getBeforeNodeDefId(String processDefId, String currentNodeDefId, ISysFormService sysFormService, Boolean needInitCurrentForm) {
// 鑾峰彇娴佺▼瀹氫箟
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
.processDefinitionId(processDefId)
@@ -75,14 +75,17 @@
formDetailVO.setBeforeNodeName(currentElement.getName());
formDetailVO.setCurrent(Boolean.TRUE);
- SysForm sysForm = sysFormService.selectSysFormById(Long.parseLong(currentElement.getFormKey()));
- if (Objects.isNull(sysForm)) {
- throw new RuntimeException("璇ユ祦绋嬬粦瀹氱殑琛ㄥ崟涓嶅瓨鍦ㄦ垨宸茶鍒犻櫎");
- }
- Map<String, Object> data = new HashMap<>(1);
- data.put(ProcessConstants.TASK_FORM_KEY, JSONObject.parseObject(sysForm.getFormContent()));
+ if (needInitCurrentForm) {
+ SysForm sysForm = sysFormService.selectSysFormById(Long.parseLong(currentElement.getFormKey()));
+ if (Objects.isNull(sysForm)) {
+ throw new RuntimeException("璇ユ祦绋嬬粦瀹氱殑琛ㄥ崟涓嶅瓨鍦ㄦ垨宸茶鍒犻櫎");
+ }
+ Map<String, Object> data = new HashMap<>(1);
+ data.put(ProcessConstants.TASK_FORM_KEY, JSONObject.parseObject(sysForm.getFormContent()));
- formDetailVO.setFormJsonObj(data);
+ formDetailVO.setFormJsonObj(data);
+ }
+
defKeys.add(formDetailVO);
}
this.before(currentElement, defKeys);
@@ -96,22 +99,51 @@
* @param currentElement
* @param defKeys
*/
- private void before(UserTask currentElement, List<FormDetailVO> defKeys) {
- if (! CollectionUtils.isEmpty(currentElement.getIncomingFlows())) {
- for (SequenceFlow incomingFlow : currentElement.getIncomingFlows()) {
- if (! (incomingFlow.getSourceFlowElement() instanceof UserTask)) {
- // 涓嶅寘鍚紑濮嬭妭鐐�
- if (! (incomingFlow.getSourceFlowElement() instanceof StartEvent)) {
- before((UserTask) (incomingFlow.getSourceFlowElement()), defKeys);
+ private void before(FlowElement currentElement, List<FormDetailVO> defKeys) {
+ if (currentElement instanceof UserTask) {
+ UserTask userTask = (UserTask) currentElement;
+ if (! CollectionUtils.isEmpty(userTask.getIncomingFlows())) {
+ for (SequenceFlow incomingFlow : userTask.getIncomingFlows()) {
+ if (incomingFlow.getSourceFlowElement() instanceof UserTask) {
+ FormDetailVO formDetailVO = new FormDetailVO();
+ formDetailVO.setBeforeNodeDefId(incomingFlow.getSourceFlowElement().getId());
+ formDetailVO.setBeforeNodeName(incomingFlow.getSourceFlowElement().getName());
+ defKeys.add(formDetailVO);
+ } else {
+ before(incomingFlow.getSourceFlowElement(), defKeys);
}
- } else {
- FormDetailVO formDetailVO = new FormDetailVO();
- formDetailVO.setBeforeNodeDefId(incomingFlow.getSourceFlowElement().getId());
- formDetailVO.setBeforeNodeName(incomingFlow.getSourceFlowElement().getName());
- defKeys.add(formDetailVO);
+ }
+ }
+ } else if (currentElement instanceof Gateway ){
+ Gateway gateway = (Gateway) currentElement;
+ if (! CollectionUtils.isEmpty(gateway.getIncomingFlows())) {
+ for (SequenceFlow incomingFlow : gateway.getIncomingFlows()) {
+ if (incomingFlow.getSourceFlowElement() instanceof UserTask) {
+ FormDetailVO formDetailVO = new FormDetailVO();
+ formDetailVO.setBeforeNodeDefId(incomingFlow.getSourceFlowElement().getId());
+ formDetailVO.setBeforeNodeName(incomingFlow.getSourceFlowElement().getName());
+ defKeys.add(formDetailVO);
+ } else {
+ before(incomingFlow.getSourceFlowElement(), defKeys);
+ }
}
}
}
+// if (! CollectionUtils.isEmpty(currentElement.getIncomingFlows())) {
+// for (SequenceFlow incomingFlow : currentElement.getIncomingFlows()) {
+// if (! (incomingFlow.getSourceFlowElement() instanceof UserTask)) {
+// // 涓嶅寘鍚紑濮嬭妭鐐广�佸苟琛岀綉鍏炽�佷簰鏂ョ綉鍏筹紝// TODO 杩橀渶瑕佹帓闄ゅ叾瀹冪壒娈婄被鍨�
+// if (! (incomingFlow.getSourceFlowElement() instanceof StartEvent) && ! (incomingFlow.getSourceFlowElement() instanceof ParallelGateway) && ! (incomingFlow.getSourceFlowElement() instanceof ExclusiveGateway)) {
+// before((UserTask) (incomingFlow.getSourceFlowElement()), defKeys);
+// }
+// } else {
+// FormDetailVO formDetailVO = new FormDetailVO();
+// formDetailVO.setBeforeNodeDefId(incomingFlow.getSourceFlowElement().getId());
+// formDetailVO.setBeforeNodeName(incomingFlow.getSourceFlowElement().getName());
+// defKeys.add(formDetailVO);
+// }
+// }
+// }
}
}
--
Gitblit v1.8.0