From 883987ed1c165ccf0fbfc54f228ca65b4e6fc2b9 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期三, 19 二月 2025 10:53:10 +0800
Subject: [PATCH] bug

---
 business/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/business/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java b/business/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java
index ca2edcc..f4234ee 100644
--- a/business/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java
+++ b/business/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java
@@ -15,6 +15,7 @@
 import com.ycl.common.core.domain.entity.SysUser;
 import com.ycl.common.enums.FlowComment;
 import com.ycl.common.enums.business.ProcessLogEventTypeEnum;
+import com.ycl.common.enums.business.TaskStatusEnum;
 import com.ycl.common.exception.CustomException;
 import com.ycl.common.utils.SecurityUtils;
 import com.ycl.domain.dto.FlowCommentDto;
@@ -149,6 +150,7 @@
         if (Objects.isNull(projectProcess)) {
             return AjaxResult.error("椤圭洰娴佺▼鏈粦瀹�");
         }
+
         Map<String, Object> processVariables = new HashMap<>();
         //鏌ュ嚭瀛楀吀涓渶瑕佹敞鍏ョ殑瀛楁淇℃伅
         List<String> dictList = sysDictDService.selectDictDataByType("flow_variables").stream().map(SysDictData::getDictValue).collect(Collectors.toList());
@@ -178,6 +180,7 @@
                 projectProcess.getProjectId(),
                 projectProcess.getProcessInsId(),
                 taskId,
+                task.getName(),
                 ProcessLogEventTypeEnum.FINISHED,
                 null));
         return AjaxResult.success("鎻愪氦鎴愬姛");
@@ -318,6 +321,7 @@
                 projectProcess.getProjectId(),
                 projectProcess.getProcessInsId(),
                 flowTaskVo.getTaskId(),
+                task.getName(),
                 ProcessLogEventTypeEnum.REJECT,
                 new RejectData(flowTaskVo.getComment())));
     }
@@ -1252,6 +1256,18 @@
             parameters = taskService.getVariables(taskId);
         }
         List<FormDetailVO> beforeNodes = this.getBeforeNodeForm(parameters, task.getFormKey(), task.getName(), task.getProcessDefinitionId(), task.getTaskDefinitionKey(), Boolean.FALSE);
+        // 鍒ゆ柇鍓嶇疆浠诲姟鏄笉鏄拰褰撳墠浠诲姟涓哄悓涓�涓猠xecuteId
+        // 鍒ゆ柇褰撳墠浠诲姟鏄惁琚寕璧蜂腑
+        beforeNodes.stream().filter(node -> {
+            HistoricTaskInstance beforeTask = historyService.createHistoricTaskInstanceQuery().processInstanceId(task.getProcessInstanceId()).finished().taskDefinitionKey(node.getBeforeNodeDefId()).singleResult();
+            return Objects.isNull(beforeTask);
+        }).forEach(node -> {
+            if (node.getCurrent()) {
+                if (processLogService.taskIsHangup(taskId, task.getProcessInstanceId())) {
+                    node.setTaskStatus(TaskStatusEnum.HANGUP);
+                }
+            }
+        });
         return AjaxResult.success(beforeNodes);
     }
 
@@ -1268,11 +1284,19 @@
             }
             parameters = hisTask.getProcessVariables();
             List<FormDetailVO> beforeNodes = this.getBeforeNodeForm(parameters, hisTask.getFormKey(), hisTask.getName(), hisTask.getProcessDefinitionId(), hisTask.getTaskDefinitionKey(), Boolean.TRUE);
-            return AjaxResult.success(beforeNodes);
+            List<FormDetailVO> dataList = beforeNodes.stream().filter(node -> {
+                HistoricTaskInstance beforeTask = historyService.createHistoricTaskInstanceQuery().processInstanceId(task.getProcessInstanceId()).finished().taskDefinitionKey(node.getBeforeNodeDefId()).singleResult();
+                return Objects.isNull(beforeTask);
+            }).collect(Collectors.toList());
+            return AjaxResult.success(dataList);
         } else {
             parameters = taskService.getVariables(taskId);
             List<FormDetailVO> beforeNodes = this.getBeforeNodeForm(parameters, task.getFormKey(), task.getName(), task.getProcessDefinitionId(), task.getTaskDefinitionKey(), Boolean.TRUE);
-            return AjaxResult.success(beforeNodes);
+            List<FormDetailVO> dataList = beforeNodes.stream().filter(node -> {
+                HistoricTaskInstance beforeTask = historyService.createHistoricTaskInstanceQuery().processInstanceId(task.getProcessInstanceId()).finished().taskDefinitionKey(node.getBeforeNodeDefId()).singleResult();
+                return Objects.isNull(beforeTask);
+            }).collect(Collectors.toList());
+            return AjaxResult.success(dataList);
         }
     }
 

--
Gitblit v1.8.0