Browse Source

1、印章创建人名字回显

dongpo 6 months ago
parent
commit
98bbb74c8f

+ 42 - 16
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/stamp/stampseal/OaStampSealController.java

@@ -11,15 +11,22 @@ import cn.iocoder.yudao.module.bpm.controller.admin.stamp.stampseal.vo.OaStampSe
 import cn.iocoder.yudao.module.bpm.controller.admin.stamp.stampseal.vo.OaStampSealSaveReqVO;
 import cn.iocoder.yudao.module.bpm.dal.dataobject.stamp.stampseal.OaStampSealDO;
 import cn.iocoder.yudao.module.bpm.service.stamp.stampseal.OaStampSealService;
+import cn.iocoder.yudao.module.employee.api.EmployeeApi;
+import cn.iocoder.yudao.module.employee.api.dto.EmployeeRespDTO;
 import cn.iocoder.yudao.module.infra.api.file.FileApi;
 import cn.iocoder.yudao.module.infra.api.file.dto.FileDTO;
-import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
-import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
@@ -42,8 +49,10 @@ public class OaStampSealController {
     @Resource
     private OaStampSealService oaStampSealService;
 
+    // @Resource
+    // private AdminUserApi adminUserApi;
     @Resource
-    private AdminUserApi adminUserApi;
+    private EmployeeApi employeeApi;
 
     @Resource
     private FileApi fileApi;
@@ -112,10 +121,14 @@ public class OaStampSealController {
         }
         // 创建者姓名
         Long creator = oaStampSealRespVO.getCreator();
-        AdminUserRespDTO user = adminUserApi.getUser(creator);
-        if (user != null) {
-            oaStampSealRespVO.setCreateEmployeeName(user.getNickname());
+        EmployeeRespDTO employee = employeeApi.getEmployeeByUserId(creator);
+        if (employee != null) {
+            oaStampSealRespVO.setCreateEmployeeName(employee.getName());
         }
+        // AdminUserRespDTO user = adminUserApi.getUser(creator);
+        // if (user != null) {
+        //     oaStampSealRespVO.setCreateEmployeeName(user.getNickname());
+        // }
         // 附件列表
         List<FileDTO> fileList = fileApi.getFileDTOListByBiz(oaStampSeal.getSealUuid());
         oaStampSealRespVO.setFileList(fileList);
@@ -134,8 +147,11 @@ public class OaStampSealController {
 
         List<OaStampSealRespVO> voPageResultList = voPageResult.getList();
         List<Long> creatorList = voPageResultList.stream().map(OaStampSealRespVO::getCreator).collect(Collectors.toList());
-        List<AdminUserRespDTO> adminUserList = adminUserApi.getUserList(creatorList);
-        Map<Long, AdminUserRespDTO> adminUserMap = adminUserList.stream().collect(Collectors.toMap(AdminUserRespDTO::getId, Function.identity()));
+        Map<Long, EmployeeRespDTO> employeeMap = employeeApi.getEmployeeListByUserIds(creatorList)
+                .stream()
+                .collect(Collectors.toMap(EmployeeRespDTO::getUserId, Function.identity()));
+        // List<AdminUserRespDTO> adminUserList = adminUserApi.getUserList(creatorList);
+        // Map<Long, AdminUserRespDTO> adminUserMap = adminUserList.stream().collect(Collectors.toMap(AdminUserRespDTO::getId, Function.identity()));
 
         for (OaStampSealRespVO oaStampSealRespVO : voPageResultList) {
             String status = oaStampSealRespVO.getStatus();
@@ -150,10 +166,14 @@ public class OaStampSealController {
                     oaStampSealRespVO.setStatusDesc("未知");
                     break;
             }
-            AdminUserRespDTO adminUserRespDTO = adminUserMap.get(oaStampSealRespVO.getCreator());
-            if (adminUserRespDTO != null) {
-                oaStampSealRespVO.setCreateEmployeeName(adminUserRespDTO.getNickname());
+            EmployeeRespDTO employeeRespDTO = employeeMap.get(oaStampSealRespVO.getCreator());
+            if (employeeRespDTO != null) {
+                oaStampSealRespVO.setCreateEmployeeName(employeeRespDTO.getName());
             }
+            // AdminUserRespDTO adminUserRespDTO = adminUserMap.get(oaStampSealRespVO.getCreator());
+            // if (adminUserRespDTO != null) {
+            //     oaStampSealRespVO.setCreateEmployeeName(adminUserRespDTO.getNickname());
+            // }
         }
         return success(voPageResult);
     }
@@ -176,8 +196,11 @@ public class OaStampSealController {
         List<OaStampSealRespVO> stampSealRespVOList = BeanUtils.toBean(list, OaStampSealRespVO.class);
 
         List<Long> creatorList = stampSealRespVOList.stream().map(OaStampSealRespVO::getCreator).collect(Collectors.toList());
-        List<AdminUserRespDTO> adminUserList = adminUserApi.getUserList(creatorList);
-        Map<Long, AdminUserRespDTO> adminUserMap = adminUserList.stream().collect(Collectors.toMap(AdminUserRespDTO::getId, Function.identity()));
+        Map<Long, EmployeeRespDTO> employeeMap = employeeApi.getEmployeeListByUserIds(creatorList)
+                .stream()
+                .collect(Collectors.toMap(EmployeeRespDTO::getUserId, Function.identity()));
+        // List<AdminUserRespDTO> adminUserList = adminUserApi.getUserList(creatorList);
+        // Map<Long, AdminUserRespDTO> adminUserMap = adminUserList.stream().collect(Collectors.toMap(AdminUserRespDTO::getId, Function.identity()));
 
         for (OaStampSealRespVO oaStampSealRespVO : stampSealRespVOList) {
             String status = oaStampSealRespVO.getStatus();
@@ -191,8 +214,11 @@ public class OaStampSealController {
                 default:
                     oaStampSealRespVO.setStatusDesc("未知");
             }
-
-            oaStampSealRespVO.setCreateEmployeeName(adminUserMap.get(oaStampSealRespVO.getCreator()).getNickname());
+            EmployeeRespDTO employeeRespDTO = employeeMap.get(oaStampSealRespVO.getCreator());
+            if (employeeRespDTO != null) {
+                oaStampSealRespVO.setCreateEmployeeName(employeeRespDTO.getName());
+            }
+            // oaStampSealRespVO.setCreateEmployeeName(adminUserMap.get(oaStampSealRespVO.getCreator()).getNickname());
         }
         // 导出 Excel
         ExcelUtils.write(response, "用印印章信息.xls", "数据", OaStampSealRespVO.class,