|
@@ -1,5 +1,6 @@
|
|
|
package cn.iocoder.yudao.module.bpm.controller.admin.meeting.room;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
@@ -11,6 +12,8 @@ import cn.iocoder.yudao.module.bpm.controller.admin.meeting.room.vo.OaMeetingRoo
|
|
|
import cn.iocoder.yudao.module.bpm.controller.admin.meeting.room.vo.OaMeetingRoomSaveReqVO;
|
|
|
import cn.iocoder.yudao.module.bpm.dal.dataobject.meeting.room.OaMeetingRoomDO;
|
|
|
import cn.iocoder.yudao.module.bpm.service.meeting.room.OaMeetingRoomService;
|
|
|
+import cn.iocoder.yudao.module.employee.api.EmployeeApi;
|
|
|
+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;
|
|
@@ -23,6 +26,9 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
|
import java.io.IOException;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.function.Function;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
@@ -36,6 +42,9 @@ public class OaMeetingRoomController {
|
|
|
@Resource
|
|
|
private OaMeetingRoomService oaMeetingRoomService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private EmployeeApi employeeApi;
|
|
|
+
|
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建会议室信息管理")
|
|
|
// @PreAuthorize("@ss.hasPermission('bpm:oa-meeting-room:create')")
|
|
@@ -66,7 +75,16 @@ public class OaMeetingRoomController {
|
|
|
// @PreAuthorize("@ss.hasPermission('bpm:oa-meeting-room:query')")
|
|
|
public CommonResult<OaMeetingRoomRespVO> getOaMeetingRoom(@RequestParam("id") Long id) {
|
|
|
OaMeetingRoomDO oaMeetingRoom = oaMeetingRoomService.getOaMeetingRoom(id);
|
|
|
- return success(BeanUtils.toBean(oaMeetingRoom, OaMeetingRoomRespVO.class));
|
|
|
+ OaMeetingRoomRespVO oaMeetingRoomRespVO = BeanUtils.toBean(oaMeetingRoom, OaMeetingRoomRespVO.class);
|
|
|
+
|
|
|
+ // 设置管理员名称
|
|
|
+ if (oaMeetingRoomRespVO != null) {
|
|
|
+ EmployeeRespDTO employee = employeeApi.getEmployeeById(oaMeetingRoomRespVO.getManagerId());
|
|
|
+ if (employee != null) {
|
|
|
+ oaMeetingRoomRespVO.setManagerName(employee.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return success(oaMeetingRoomRespVO);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/page")
|
|
@@ -74,7 +92,24 @@ public class OaMeetingRoomController {
|
|
|
// @PreAuthorize("@ss.hasPermission('bpm:oa-meeting-room:query')")
|
|
|
public CommonResult<PageResult<OaMeetingRoomRespVO>> getOaMeetingRoomPage(@Valid @ParameterObject OaMeetingRoomPageReqVO pageReqVO) {
|
|
|
PageResult<OaMeetingRoomDO> pageResult = oaMeetingRoomService.getOaMeetingRoomPage(pageReqVO);
|
|
|
- return success(BeanUtils.toBean(pageResult, OaMeetingRoomRespVO.class));
|
|
|
+ PageResult<OaMeetingRoomRespVO> voPageResult = BeanUtils.toBean(pageResult, OaMeetingRoomRespVO.class);
|
|
|
+
|
|
|
+ // 设置管理员名称
|
|
|
+ List<OaMeetingRoomRespVO> list = voPageResult.getList();
|
|
|
+ if (CollUtil.isNotEmpty(list)) {
|
|
|
+ List<Long> managerIdList = list.stream().map(OaMeetingRoomRespVO::getManagerId).collect(Collectors.toList());
|
|
|
+ List<EmployeeRespDTO> employeeList = employeeApi.getEmployeeListByIds(managerIdList);
|
|
|
+ Map<Long, EmployeeRespDTO> employeeManagerMap = employeeList.stream().collect(Collectors.toMap(EmployeeRespDTO::getId, Function.identity()));
|
|
|
+
|
|
|
+ for (OaMeetingRoomRespVO oaMeetingRoomRespVO : list) {
|
|
|
+ EmployeeRespDTO employeeRespDTO = employeeManagerMap.get(oaMeetingRoomRespVO.getManagerId());
|
|
|
+ if (employeeRespDTO != null) {
|
|
|
+ oaMeetingRoomRespVO.setManagerName(employeeRespDTO.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return success(voPageResult);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/list")
|