Browse Source

1、7589导出字段调整

dongpo 6 months ago
parent
commit
eb10cf8aa7

+ 16 - 1
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/meeting/room/OaMeetingRoomController.java

@@ -17,6 +17,7 @@ import cn.iocoder.yudao.module.employee.api.dto.EmployeeRespDTO;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.tags.Tag;
+import liquibase.pro.packaged.R;
 import org.springdoc.api.annotations.ParameterObject;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
@@ -128,9 +129,23 @@ public class OaMeetingRoomController {
               HttpServletResponse response) throws IOException {
         pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
         List<OaMeetingRoomDO> list = oaMeetingRoomService.getOaMeetingRoomPage(pageReqVO).getList();
+        List<OaMeetingRoomRespVO> respVOList = BeanUtils.toBean(list, OaMeetingRoomRespVO.class);
+        if (CollUtil.isNotEmpty(respVOList)) {
+            List<Long> managerIdList = respVOList.stream().map(OaMeetingRoomRespVO::getManagerId).collect(Collectors.toList());
+            Map<Long, EmployeeRespDTO> employeeManagerMap = employeeApi.getEmployeeListByIds(managerIdList)
+                    .stream()
+                    .collect(Collectors.toMap(EmployeeRespDTO::getId, Function.identity()));
+            for (OaMeetingRoomRespVO oaMeetingRoomRespVO : respVOList) {
+                EmployeeRespDTO employeeRespDTO = employeeManagerMap.get(oaMeetingRoomRespVO.getManagerId());
+                if (employeeRespDTO != null) {
+                    oaMeetingRoomRespVO.setManagerName(employeeRespDTO.getName());
+                }
+            }
+
+        }
         // 导出 Excel
         ExcelUtils.write(response, "会议室信息管理.xls", "数据", OaMeetingRoomRespVO.class,
-                        BeanUtils.toBean(list, OaMeetingRoomRespVO.class));
+                        respVOList);
     }
 
 }

+ 0 - 3
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/meeting/room/vo/OaMeetingRoomRespVO.java

@@ -13,11 +13,9 @@ import java.time.LocalDateTime;
 public class OaMeetingRoomRespVO {
 
     @Schema(description = "主键id", example = "2")
-    @ExcelProperty("主键id")
     private Long id;
 
     @Schema(description = "会议室uuid", example = "788dcb3483d54782bc71875e523e8deb")
-    @ExcelProperty("会议室uuid")
     private String roomUuid;
 
     @Schema(description = "会议室名称", example = "上海会议室")
@@ -29,7 +27,6 @@ public class OaMeetingRoomRespVO {
     private String size;
 
     @Schema(description = "管理员id", example = "1")
-    @ExcelProperty("管理员id")
     private Long managerId;
 
     @Schema(description = "管理员姓名")

+ 2 - 0
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/meeting/room/vo/OaMeetingRoomSaveReqVO.java

@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.bpm.controller.admin.meeting.room.vo;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
+import javax.validation.constraints.Min;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 
@@ -19,6 +20,7 @@ public class OaMeetingRoomSaveReqVO {
 
     @Schema(description = "可容纳人数")
     @NotBlank(message = "可容纳人数不能为空")
+    @Min(value = 1, message = "可容纳人数最小值为 1")
     private String size;
 
     @Schema(description = "管理员id", example = "1")

+ 14 - 14
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/meeting/room/OaMeetingRoomServiceImpl.java

@@ -44,13 +44,13 @@ public class OaMeetingRoomServiceImpl implements OaMeetingRoomService {
         // 插入
         OaMeetingRoomDO oaMeetingRoom = BeanUtils.toBean(createReqVO, OaMeetingRoomDO.class);
         oaMeetingRoom.setRoomUuid(IdUtil.fastSimpleUUID());
-        Long managerId = createReqVO.getManagerId();
-        if (managerId != null) {
-            AdminUserRespDTO user = adminUserApi.getUser(managerId);
-            if (user != null) {
-                oaMeetingRoom.setManagerName(user.getNickname());
-            }
-        }
+        // Long managerId = createReqVO.getManagerId();
+        // if (managerId != null) {
+        //     AdminUserRespDTO user = adminUserApi.getUser(managerId);
+        //     if (user != null) {
+        //         oaMeetingRoom.setManagerName(user.getNickname());
+        //     }
+        // }
         oaMeetingRoomMapper.insert(oaMeetingRoom);
         // 返回
         return oaMeetingRoom.getId();
@@ -62,13 +62,13 @@ public class OaMeetingRoomServiceImpl implements OaMeetingRoomService {
         validateOaMeetingRoomExists(updateReqVO.getId());
         // 更新
         OaMeetingRoomDO updateObj = BeanUtils.toBean(updateReqVO, OaMeetingRoomDO.class);
-        Long managerId = updateObj.getManagerId();
-        if (managerId != null) {
-            AdminUserRespDTO user = adminUserApi.getUser(managerId);
-            if (user != null) {
-                updateObj.setManagerName(user.getNickname());
-            }
-        }
+        // Long managerId = updateObj.getManagerId();
+        // if (managerId != null) {
+        //     AdminUserRespDTO user = adminUserApi.getUser(managerId);
+        //     if (user != null) {
+        //         updateObj.setManagerName(user.getNickname());
+        //     }
+        // }
         oaMeetingRoomMapper.updateById(updateObj);
     }