From 6b13839488edcd06046e26a41fe897358176689c Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期五, 13 十二月 2024 17:56:41 +0800
Subject: [PATCH] 采集质量

---
 iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/service/task/BpmProcessInstanceCopyServiceImpl.java |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/service/task/BpmProcessInstanceCopyServiceImpl.java b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/service/task/BpmProcessInstanceCopyServiceImpl.java
index f78ce88..48414cb 100644
--- a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/service/task/BpmProcessInstanceCopyServiceImpl.java
+++ b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/service/task/BpmProcessInstanceCopyServiceImpl.java
@@ -22,6 +22,7 @@
 import static com.iailab.framework.common.exception.util.ServiceExceptionUtil.exception;
 import static com.iailab.framework.common.util.collection.CollectionUtils.convertList;
 
+
 /**
  * 流程抄送 Service 实现类
  *
@@ -47,19 +48,25 @@
     private BpmProcessDefinitionService processDefinitionService;
 
     @Override
-    public void createProcessInstanceCopy(Collection<Long> userIds, String taskId) {
-        // 1.1 校验任务存在
+    public void createProcessInstanceCopy(Collection<Long> userIds, String reason, String taskId) {
         Task task = taskService.getTask(taskId);
         if (ObjectUtil.isNull(task)) {
             throw exception(ErrorCodeConstants.TASK_NOT_EXISTS);
         }
-        // 1.2 校验流程实例存在
-        String processInstanceId = task.getProcessInstanceId();
+        // 执行抄送
+        createProcessInstanceCopy(userIds, reason,
+                task.getProcessInstanceId(), task.getTaskDefinitionKey(), task.getId(), task.getName());
+    }
+
+    @Override
+    public void createProcessInstanceCopy(Collection<Long> userIds, String reason, String processInstanceId,
+                                          String activityId, String activityName, String taskId) {
+        // 1.1 校验流程实例存在
         ProcessInstance processInstance = processInstanceService.getProcessInstance(processInstanceId);
         if (processInstance == null) {
             throw exception(ErrorCodeConstants.PROCESS_INSTANCE_NOT_EXISTS);
         }
-        // 1.3 校验流程定义存在
+        // 1.2 校验流程定义存在
         ProcessDefinition processDefinition = processDefinitionService.getProcessDefinition(
                 processInstance.getProcessDefinitionId());
         if (processDefinition == null) {
@@ -68,9 +75,10 @@
 
         // 2. 创建抄送流程
         List<BpmProcessInstanceCopyDO> copyList = convertList(userIds, userId -> new BpmProcessInstanceCopyDO()
-                .setUserId(userId).setStartUserId(Long.valueOf(processInstance.getStartUserId()))
+                .setUserId(userId).setReason(reason).setStartUserId(Long.valueOf(processInstance.getStartUserId()))
                 .setProcessInstanceId(processInstanceId).setProcessInstanceName(processInstance.getName())
-                .setCategory(processDefinition.getCategory()).setTaskId(taskId).setTaskName(task.getName()));
+                .setCategory(processDefinition.getCategory()).setTaskId(taskId)
+                .setActivityId(activityId).setActivityName(activityName));
         processInstanceCopyMapper.insertBatch(copyList);
     }
 
@@ -80,4 +88,5 @@
         return processInstanceCopyMapper.selectPage(userId, pageReqVO);
     }
 
+
 }

--
Gitblit v1.9.3