Browse Source

1、7594会议预定列表-导出字段问题

dongpo 1 year ago
parent
commit
00db359a0c

+ 67 - 1
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/meeting/reserve/OaMeetingReserveController.java

@@ -234,9 +234,75 @@ public class OaMeetingReserveController {
               HttpServletResponse response) throws IOException {
               HttpServletResponse response) throws IOException {
         pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
         pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
         List<OaMeetingReserveDO> list = oaMeetingReserveService.getOaMeetingReservePage(pageReqVO).getList();
         List<OaMeetingReserveDO> list = oaMeetingReserveService.getOaMeetingReservePage(pageReqVO).getList();
+        List<OaMeetingReserveRespVO> oaMeetingReserveRespVOList = BeanUtils.toBean(list, OaMeetingReserveRespVO.class);
+        if (oaMeetingReserveRespVOList.size() > 0) {
+            // 申请人
+            List<Long> applyEmployeeIds = oaMeetingReserveRespVOList.stream().map(OaMeetingReserveRespVO::getApplyEmployeeId).collect(Collectors.toList());
+            List<EmployeeRespDTO> employeeRespDTOList = employeeApi.getEmployeeListByIds(applyEmployeeIds);
+            Map<Long, EmployeeRespDTO> employeeRespDTOMap = CollectionUtils.convertMap(employeeRespDTOList, EmployeeRespDTO::getId, Function.identity());
+
+            // // 参与人
+            // List<Long> participantEmployeeIds = new ArrayList<>();
+            // for (OaMeetingReserveDO oaMeetingReserveDO : oaMeetingReserveDOList) {
+            //     String participants = oaMeetingReserveDO.getParticipants();
+            //     if (StrUtil.isNotBlank(participants)) {
+            //         String[] participantsStringArray = participants.split(",");
+            //         List<Long> participantsLongList = Arrays.stream(participantsStringArray).map(Long::valueOf).collect(Collectors.toList());
+            //         participantEmployeeIds.addAll(participantsLongList);
+            //     }
+            // }
+            // List<AdminUserRespDTO> participantUserList = adminUserApi.getUserList(participantEmployeeIds);
+            // Map<Long, AdminUserRespDTO> participantUserMap = participantUserList.stream().collect(Collectors.toMap(AdminUserRespDTO::getId, Function.identity()));
+
+            // 状态描述
+            Map<String, String> enumsMap = Arrays.stream(MeetingReserveStatusEnum.values())
+                    .collect(Collectors.toMap(MeetingReserveStatusEnum::getStatus, MeetingReserveStatusEnum::getDesc));
+
+            // 部门名称
+            List<Long> deptIds = oaMeetingReserveRespVOList.stream().map(OaMeetingReserveRespVO::getDeptId).collect(Collectors.toList());
+            List<DeptRespDTO> deptList = deptApi.getDeptList(deptIds);
+            Map<Long, DeptRespDTO> deptMap = deptList.stream().collect(Collectors.toMap(DeptRespDTO::getId, Function.identity()));
+
+            // 会议室名称
+            List<Long> roomIds = oaMeetingReserveRespVOList.stream().map(OaMeetingReserveRespVO::getRoomId).collect(Collectors.toList());
+            List<OaMeetingRoomRespDTO> roomList = oaMeetingRoomService.getOaMeetingRoomList(roomIds);
+            Map<Long, OaMeetingRoomRespDTO> roomRespDTOMap = roomList.stream().collect(Collectors.toMap(OaMeetingRoomRespDTO::getId, Function.identity()));
+
+            for (OaMeetingReserveRespVO oaMeetingReserveRespVO : oaMeetingReserveRespVOList) {
+                // 申请人姓名
+                Long applyEmployeeId = oaMeetingReserveRespVO.getApplyEmployeeId();
+                if (applyEmployeeId != null) {
+                    EmployeeRespDTO employeeRespDTO = employeeRespDTOMap.get(applyEmployeeId);
+                    if (employeeRespDTO != null) {
+                        oaMeetingReserveRespVO.setApplyEmployeeName(employeeRespDTO.getName());
+                    }
+                }
+                // // 参与人姓名
+                // String participants = oaMeetingReserveRespVO.getParticipants();
+                // 状态描述
+                String status = oaMeetingReserveRespVO.getStatus();
+                oaMeetingReserveRespVO.setStatusDesc(enumsMap.get(status));
+                // 部门名称
+                Long deptId = oaMeetingReserveRespVO.getDeptId();
+                if (deptId != null) {
+                    DeptRespDTO dept = deptMap.get(deptId);
+                    if (dept != null) {
+                        oaMeetingReserveRespVO.setDepName(dept.getName());
+                    }
+                }
+                // 会议室名称
+                Long roomId = oaMeetingReserveRespVO.getRoomId();
+                if (roomId != null) {
+                    OaMeetingRoomRespDTO room = roomRespDTOMap.get(roomId);
+                    if (room != null) {
+                        oaMeetingReserveRespVO.setRoomName(room.getName());
+                    }
+                }
+            }
+        }
         // 导出 Excel
         // 导出 Excel
         ExcelUtils.write(response, "会议室预定管理信息.xls", "数据", OaMeetingReserveRespVO.class,
         ExcelUtils.write(response, "会议室预定管理信息.xls", "数据", OaMeetingReserveRespVO.class,
-                        BeanUtils.toBean(list, OaMeetingReserveRespVO.class));
+                oaMeetingReserveRespVOList);
     }
     }
 
 
     @GetMapping("/cancel")
     @GetMapping("/cancel")

+ 9 - 9
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/meeting/reserve/vo/OaMeetingReserveRespVO.java

@@ -14,15 +14,15 @@ import com.alibaba.excel.annotation.*;
 public class OaMeetingReserveRespVO {
 public class OaMeetingReserveRespVO {
 
 
     @Schema(description = "主键id")
     @Schema(description = "主键id")
-    @ExcelProperty("主键id")
+    // @ExcelProperty("主键id")
     private Long id;
     private Long id;
 
 
     @Schema(description = "预定uuid")
     @Schema(description = "预定uuid")
-    @ExcelProperty("预定uuid")
+    // @ExcelProperty("预定uuid")
     private String reserveUuid;
     private String reserveUuid;
 
 
     @Schema(description = "会议室id")
     @Schema(description = "会议室id")
-    @ExcelProperty("会议室id")
+    // @ExcelProperty("会议室id")
     private Long roomId;
     private Long roomId;
 
 
     @Schema(description = "会议室名称", example = "上海会议室")
     @Schema(description = "会议室名称", example = "上海会议室")
@@ -42,7 +42,7 @@ public class OaMeetingReserveRespVO {
     private String endTime;
     private String endTime;
 
 
     @Schema(description = "申请人id")
     @Schema(description = "申请人id")
-    @ExcelProperty("申请人id")
+    // @ExcelProperty("申请人id")
     private Long applyEmployeeId;
     private Long applyEmployeeId;
 
 
     @Schema(description = "申请人名字")
     @Schema(description = "申请人名字")
@@ -54,7 +54,7 @@ public class OaMeetingReserveRespVO {
     private String applyEmployeePhone;
     private String applyEmployeePhone;
 
 
     @Schema(description = "申请人部门")
     @Schema(description = "申请人部门")
-    @ExcelProperty("申请人部门")
+    // @ExcelProperty("申请人部门")
     private Long deptId;
     private Long deptId;
 
 
     @Schema(description = "申请人部门名称")
     @Schema(description = "申请人部门名称")
@@ -66,19 +66,19 @@ public class OaMeetingReserveRespVO {
     private String number;
     private String number;
 
 
     @Schema(description = "参会人员id集合")
     @Schema(description = "参会人员id集合")
-    @ExcelProperty("参会人员id集合")
+    // @ExcelProperty("参会人员id集合")
     private List<Long> participants;
     private List<Long> participants;
 
 
     @Schema(description = "参会人员名字,逗号分隔")
     @Schema(description = "参会人员名字,逗号分隔")
-    @ExcelProperty("参会人员名字,逗号分隔")
+    // @ExcelProperty("参会人员名字,逗号分隔")
     private String participantsName;
     private String participantsName;
 
 
     @Schema(description = "发送类型:1站内信 2短信 3邮件,目前仅1启用")
     @Schema(description = "发送类型:1站内信 2短信 3邮件,目前仅1启用")
-    @ExcelProperty("发送类型:1站内信 2短信 3邮件,目前仅1启用")
+    // @ExcelProperty("发送类型:1站内信 2短信 3邮件,目前仅1启用")
     private String sendType;
     private String sendType;
 
 
     @Schema(description = "会议预定状态:1未开始 2进行中 3已结束 4已取消", example = "2")
     @Schema(description = "会议预定状态:1未开始 2进行中 3已结束 4已取消", example = "2")
-    @ExcelProperty("会议预定状态:1未开始 2进行中 3已结束 4已取消")
+    // @ExcelProperty("会议预定状态:1未开始 2进行中 3已结束 4已取消")
     private String status;
     private String status;
 
 
     @Schema(description = "会议预定状态描述:1未开始 2进行中 3已结束 4已取消", example = "2")
     @Schema(description = "会议预定状态描述:1未开始 2进行中 3已结束 4已取消", example = "2")