|
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.employee.controller.admin.info;
|
|
|
|
|
|
import java.util.*;
|
|
|
import java.io.IOException;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
@@ -10,6 +11,7 @@ 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;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
+import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
import cn.iocoder.yudao.module.employee.controller.admin.info.vo.*;
|
|
@@ -17,7 +19,9 @@ import cn.iocoder.yudao.module.employee.convert.info.EmployeeConvert;
|
|
|
import cn.iocoder.yudao.module.employee.dal.dataobject.info.EmployeeInfoDO;
|
|
|
import cn.iocoder.yudao.module.employee.service.info.EmployeeInfoService;
|
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
|
|
+import cn.iocoder.yudao.module.system.dal.dataobject.dept.PostDO;
|
|
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
|
+import cn.iocoder.yudao.module.system.service.dept.PostService;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
@@ -44,6 +48,9 @@ public class EmployeeInfoController {
|
|
|
@Resource
|
|
|
private DeptService deptService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private PostService postService;
|
|
|
+
|
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建员工信息")
|
|
|
@PreAuthorize("@ss.hasPermission('employee:info:create')")
|
|
@@ -88,10 +95,49 @@ public class EmployeeInfoController {
|
|
|
// 拼接数据
|
|
|
Map<Long, DeptDO> deptMap = deptService.getDeptMap(
|
|
|
convertList(pageResult.getList(), EmployeeInfoDO::getDeptId));
|
|
|
- return success(new PageResult<>(EmployeeConvert.INSTANCE.convertList(pageResult.getList(), deptMap),
|
|
|
+ return success(new PageResult<>(EmployeeConvert.INSTANCE.convertList(pageResult.getList(), deptMap, null),
|
|
|
pageResult.getTotal()));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @GetMapping("/listForSelectEmployee")
|
|
|
+ @Operation(summary = "获得可选择的员工信息列表用于选择业务人")
|
|
|
+ // @PreAuthorize("@ss.hasPermission('employee:info:listForSelectEmployee')")
|
|
|
+ public CommonResult<List<EmployeeInfoRespVO>> getInfoListForSelectEmployee() {
|
|
|
+ List<EmployeeInfoDO> listResult = infoService.getInfoListForSelectEmployee();
|
|
|
+ if (CollUtil.isEmpty(listResult)) {
|
|
|
+ return success(new ArrayList<>());
|
|
|
+ }
|
|
|
+ // 拼接数据
|
|
|
+ Map<Long, DeptDO> deptMap = deptService.getDeptMap(
|
|
|
+ convertList(listResult, EmployeeInfoDO::getDeptId));
|
|
|
+
|
|
|
+ List<Long> postIdList = listResult.stream().map(EmployeeInfoDO::getPostId).collect(Collectors.toList());
|
|
|
+ List<PostDO> postList = postService.getPostList(postIdList);
|
|
|
+ Map<Long, PostDO> postMap = CollectionUtils.convertMap(postList, PostDO::getId);
|
|
|
+
|
|
|
+ return success(EmployeeConvert.INSTANCE.convertList(listResult, deptMap, postMap));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/listForSelectAssigns")
|
|
|
+ @Operation(summary = "获得员工信息列表用于选择审批人")
|
|
|
+ // @PreAuthorize("@ss.hasPermission('employee:info:listForSelectAssigns')")
|
|
|
+ public CommonResult<List<EmployeeInfoRespVO>> getInfoListForSelectAssigns() {
|
|
|
+ List<EmployeeInfoDO> listResult = infoService.getInfoListForSelectAssigns();
|
|
|
+ if (CollUtil.isEmpty(listResult)) {
|
|
|
+ return success(new ArrayList<>());
|
|
|
+ }
|
|
|
+ // 拼接数据
|
|
|
+ Map<Long, DeptDO> deptMap = deptService.getDeptMap(
|
|
|
+ convertList(listResult, EmployeeInfoDO::getDeptId));
|
|
|
+
|
|
|
+ List<Long> postIdList = listResult.stream().map(EmployeeInfoDO::getPostId).collect(Collectors.toList());
|
|
|
+ List<PostDO> postList = postService.getPostList(postIdList);
|
|
|
+ Map<Long, PostDO> postMap = CollectionUtils.convertMap(postList, PostDO::getId);
|
|
|
+
|
|
|
+ return success(EmployeeConvert.INSTANCE.convertList(listResult, deptMap, postMap));
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/export-excel")
|
|
|
@Operation(summary = "导出员工信息 Excel")
|
|
|
@PreAuthorize("@ss.hasPermission('employee:info:export')")
|