From ed8fc5f674544d3af63c6f68093ffc038385c493 Mon Sep 17 00:00:00 2001
From: dongyukun <1208714201@qq.com>
Date: 星期一, 16 十二月 2024 09:30:04 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/controller/admin/task/BpmProcessInstanceCopyController.java |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/controller/admin/task/BpmProcessInstanceCopyController.java b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/controller/admin/task/BpmProcessInstanceCopyController.java
index a45ac46..f2f1efe 100644
--- a/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/controller/admin/task/BpmProcessInstanceCopyController.java
+++ b/iailab-module-bpm/iailab-module-bpm-biz/src/main/java/com/iailab/module/bpm/controller/admin/task/BpmProcessInstanceCopyController.java
@@ -6,12 +6,12 @@
 import com.iailab.framework.common.util.collection.MapUtils;
 import com.iailab.framework.common.util.date.DateUtils;
 import com.iailab.framework.common.util.object.BeanUtils;
+import com.iailab.module.bpm.controller.admin.base.user.UserSimpleBaseVO;
 import com.iailab.module.bpm.controller.admin.task.vo.cc.BpmProcessInstanceCopyRespVO;
 import com.iailab.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceCopyPageReqVO;
 import com.iailab.module.bpm.dal.dataobject.task.BpmProcessInstanceCopyDO;
 import com.iailab.module.bpm.service.task.BpmProcessInstanceCopyService;
 import com.iailab.module.bpm.service.task.BpmProcessInstanceService;
-import com.iailab.module.bpm.service.task.BpmTaskService;
 import com.iailab.module.system.api.user.AdminUserApi;
 import com.iailab.module.system.api.user.dto.AdminUserRespDTO;
 import io.swagger.v3.oas.annotations.Operation;
@@ -29,9 +29,9 @@
 import java.util.stream.Stream;
 
 import static com.iailab.framework.common.pojo.CommonResult.success;
-import static com.iailab.framework.common.util.collection.CollectionUtils.convertListByFlatMap;
-import static com.iailab.framework.common.util.collection.CollectionUtils.convertSet;
+import static com.iailab.framework.common.util.collection.CollectionUtils.*;
 import static com.iailab.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
+
 
 @Tag(name = "管理后台 - 流程实例抄送")
 @RestController
@@ -43,8 +43,6 @@
     private BpmProcessInstanceCopyService processInstanceCopyService;
     @Resource
     private BpmProcessInstanceService processInstanceService;
-    @Resource
-    private BpmTaskService taskService;
 
     @Resource
     private AdminUserApi adminUserApi;
@@ -61,18 +59,19 @@
         }
 
         // 拼接返回
-        Map<String, String> taskNameMap = taskService.getTaskNameByTaskIds(
-                convertSet(pageResult.getList(), BpmProcessInstanceCopyDO::getTaskId));
         Map<String, HistoricProcessInstance> processInstanceMap = processInstanceService.getHistoricProcessInstanceMap(
                 convertSet(pageResult.getList(), BpmProcessInstanceCopyDO::getProcessInstanceId));
         Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertListByFlatMap(pageResult.getList(),
                 copy -> Stream.of(copy.getStartUserId(), Long.parseLong(copy.getCreator()))));
-        return success(BeanUtils.toBean(pageResult, BpmProcessInstanceCopyRespVO.class, copyVO -> {
-            MapUtils.findAndThen(userMap, Long.valueOf(copyVO.getCreator()), user -> copyVO.setCreatorName(user.getNickname()));
-            MapUtils.findAndThen(userMap, copyVO.getStartUserId(), user -> copyVO.setStartUserName(user.getNickname()));
-            MapUtils.findAndThen(taskNameMap, copyVO.getTaskId(), copyVO::setTaskName);
+        return success(convertPage(pageResult, copy -> {
+            BpmProcessInstanceCopyRespVO copyVO = BeanUtils.toBean(copy, BpmProcessInstanceCopyRespVO.class);
+            MapUtils.findAndThen(userMap, Long.valueOf(copy.getCreator()),
+                    user -> copyVO.setStartUser(BeanUtils.toBean(user, UserSimpleBaseVO.class)));
+            MapUtils.findAndThen(userMap, copy.getStartUserId(),
+                    user -> copyVO.setCreateUser(BeanUtils.toBean(user, UserSimpleBaseVO.class)));
             MapUtils.findAndThen(processInstanceMap, copyVO.getProcessInstanceId(),
                     processInstance -> copyVO.setProcessInstanceStartTime(DateUtils.of(processInstance.getStartTime())));
+            return copyVO;
         }));
     }
 

--
Gitblit v1.9.3