From 4ed0390da011027b646d907d8b8ad625bb8d4518 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期三, 05 三月 2025 20:53:34 +0800
Subject: [PATCH] 跳过不添加完成的日志

---
 business/src/main/java/com/ycl/service/impl/ProjectProcessServiceImpl.java |    3 +--
 business/src/main/java/com/ycl/controller/FlowTaskController.java          |    2 +-
 business/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java       |   25 +++++++++++++------------
 business/src/main/java/com/ycl/service/IFlowTaskService.java               |    3 ++-
 4 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/business/src/main/java/com/ycl/controller/FlowTaskController.java b/business/src/main/java/com/ycl/controller/FlowTaskController.java
index 9eca0d4..9bc8d62 100644
--- a/business/src/main/java/com/ycl/controller/FlowTaskController.java
+++ b/business/src/main/java/com/ycl/controller/FlowTaskController.java
@@ -109,7 +109,7 @@
     @PostMapping("/complete/form/{taskId}")
     public AjaxResult completeSubmitForm(@ApiParam(value = "娴佺▼瀹氫箟id") @PathVariable(value = "taskId") String taskId,
                             @ApiParam(value = "鍙橀噺闆嗗悎,json瀵硅薄") @RequestBody Map<String, Object> variables) {
-        return flowTaskService.completeSubmitForm(taskId, variables);
+        return flowTaskService.completeSubmitForm(taskId, variables, Boolean.TRUE);
     }
 
     @ApiOperation(value = "瀹屾垚瀹℃壒浠诲姟")
diff --git a/business/src/main/java/com/ycl/service/IFlowTaskService.java b/business/src/main/java/com/ycl/service/IFlowTaskService.java
index 393fc17..ae25511 100644
--- a/business/src/main/java/com/ycl/service/IFlowTaskService.java
+++ b/business/src/main/java/com/ycl/service/IFlowTaskService.java
@@ -220,9 +220,10 @@
      *
      * @param taskId  浠诲姟id
      * @param variables  琛ㄥ崟鏁版嵁
+     * @param addLog
      * @return
      */
-    AjaxResult completeSubmitForm(String taskId, Map<String, Object> variables);
+    AjaxResult completeSubmitForm(String taskId, Map<String, Object> variables, Boolean addLog);
 
     /**
      * 鏌ョ湅浠诲姟
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 c41b7db..b39a37e 100644
--- a/business/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java
+++ b/business/src/main/java/com/ycl/service/impl/FlowTaskServiceImpl.java
@@ -24,7 +24,6 @@
 import com.ycl.domain.dto.FlowTaskDto;
 import com.ycl.domain.dto.FlowViewerDto;
 import com.ycl.domain.entity.ProcessCoding;
-import com.ycl.domain.entity.ProcessLog;
 import com.ycl.domain.entity.ProjectProcess;
 import com.ycl.domain.entity.SysForm;
 import com.ycl.domain.json.RejectData;
@@ -76,7 +75,6 @@
 
 import java.io.InputStream;
 import java.lang.reflect.Field;
-import java.math.BigDecimal;
 import java.nio.charset.StandardCharsets;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
@@ -137,11 +135,12 @@
      *
      * @param taskId    浠诲姟id
      * @param variables 琛ㄥ崟鏁版嵁
+     * @param addLog
      * @return
      */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public AjaxResult completeSubmitForm(String taskId, Map<String, Object> variables) {
+    public AjaxResult completeSubmitForm(String taskId, Map<String, Object> variables, Boolean addLog) {
         Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
         if (Objects.isNull(task)) {
             return AjaxResult.error("浠诲姟涓嶅瓨鍦�");
@@ -175,15 +174,17 @@
             taskService.complete(taskId, newV);
         }
         // 淇濆瓨鏃ュ織
-        publisher.publishEvent(new TaskLogEvent(this, null,
-                SecurityUtils.getUserId(),
-                projectProcess.getProjectId(),
-                projectProcess.getProcessInsId(),
-                taskId,
-                task.getTaskDefinitionKey(),
-                task.getName(),
-                ProcessLogEventTypeEnum.FINISHED,
-                null));
+        if (addLog) {
+            publisher.publishEvent(new TaskLogEvent(this, null,
+                    SecurityUtils.getUserId(),
+                    projectProcess.getProjectId(),
+                    projectProcess.getProcessInsId(),
+                    taskId,
+                    task.getTaskDefinitionKey(),
+                    task.getName(),
+                    ProcessLogEventTypeEnum.FINISHED,
+                    null));
+        }
         return AjaxResult.success("鎻愪氦鎴愬姛");
     }
 
diff --git a/business/src/main/java/com/ycl/service/impl/ProjectProcessServiceImpl.java b/business/src/main/java/com/ycl/service/impl/ProjectProcessServiceImpl.java
index f20ff2b..2d93321 100644
--- a/business/src/main/java/com/ycl/service/impl/ProjectProcessServiceImpl.java
+++ b/business/src/main/java/com/ycl/service/impl/ProjectProcessServiceImpl.java
@@ -3,7 +3,6 @@
 
 import com.alibaba.fastjson2.JSONArray;
 import com.alibaba.fastjson2.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
 import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
@@ -738,7 +737,7 @@
                 }
             }
             // 瀹屾垚浠诲姟
-            flowTaskService.completeSubmitForm(form.getTaskId(), data);
+            flowTaskService.completeSubmitForm(form.getTaskId(), data, Boolean.FALSE);
         }
         return Result.ok("鎿嶄綔鎴愬姛");
     }

--
Gitblit v1.8.0