|
@@ -1,10 +1,15 @@
|
|
package cn.iocoder.yudao.module.attendance.controller.admin.leave;
|
|
package cn.iocoder.yudao.module.attendance.controller.admin.leave;
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
|
+import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
|
import cn.iocoder.yudao.module.attendance.controller.admin.business.vo.AttendanceBusinessRespVO;
|
|
import cn.iocoder.yudao.module.attendance.controller.admin.business.vo.AttendanceBusinessRespVO;
|
|
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
|
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
|
import cn.iocoder.yudao.module.infra.api.file.dto.FileDTO;
|
|
import cn.iocoder.yudao.module.infra.api.file.dto.FileDTO;
|
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
|
|
+import cn.iocoder.yudao.module.system.api.dicttenant.DictDataTenantApi;
|
|
|
|
+import cn.iocoder.yudao.module.system.api.dicttenant.dto.DictDataTenantRespDTO;
|
|
|
|
+import cn.iocoder.yudao.module.system.enums.dicttenant.DictTypeTenantEnum;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
@@ -48,6 +53,8 @@ public class AttendanceLeaveController {
|
|
private DeptApi deptApi;
|
|
private DeptApi deptApi;
|
|
@Resource
|
|
@Resource
|
|
private FileApi fileApi;
|
|
private FileApi fileApi;
|
|
|
|
+ @Resource
|
|
|
|
+ private DictDataTenantApi dictDataTenantApi;
|
|
|
|
|
|
@PostMapping("/create")
|
|
@PostMapping("/create")
|
|
@Operation(summary = "创建请假信息")
|
|
@Operation(summary = "创建请假信息")
|
|
@@ -88,6 +95,15 @@ public class AttendanceLeaveController {
|
|
respVO.setDeptName(dept.getName());
|
|
respVO.setDeptName(dept.getName());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // 请假类型
|
|
|
|
+ if (StrUtil.isNotBlank(respVO.getLeaveType())) {
|
|
|
|
+ List<DictDataTenantRespDTO> dictDataList = dictDataTenantApi.getDictDataList(DictTypeTenantEnum.TENANT_LEAVE_TYPE.getType());
|
|
|
|
+ Map<String, String> dictDataMap = CollectionUtils.convertMap(dictDataList, DictDataTenantRespDTO::getValue, DictDataTenantRespDTO::getLabel);
|
|
|
|
+ String leaveTypeDesc = dictDataMap.get(respVO.getLeaveType());
|
|
|
|
+ if (StrUtil.isNotBlank(leaveTypeDesc)) {
|
|
|
|
+ respVO.setLeaveTypeDesc(leaveTypeDesc);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// 附件列表
|
|
// 附件列表
|
|
List<FileDTO> fileList = fileApi.getFileDTOListByBiz(respVO.getLeaveId());
|
|
List<FileDTO> fileList = fileApi.getFileDTOListByBiz(respVO.getLeaveId());
|
|
respVO.setFileList(fileList);
|
|
respVO.setFileList(fileList);
|
|
@@ -102,6 +118,9 @@ public class AttendanceLeaveController {
|
|
public CommonResult<PageResult<AttendanceLeaveRespVO>> getLeavePage(@Valid AttendanceLeavePageReqVO pageReqVO) {
|
|
public CommonResult<PageResult<AttendanceLeaveRespVO>> getLeavePage(@Valid AttendanceLeavePageReqVO pageReqVO) {
|
|
PageResult<AttendanceLeaveDO> pageResult = leaveService.getLeavePage(pageReqVO);
|
|
PageResult<AttendanceLeaveDO> pageResult = leaveService.getLeavePage(pageReqVO);
|
|
PageResult<AttendanceLeaveRespVO> result = BeanUtils.toBean(pageResult, AttendanceLeaveRespVO.class);
|
|
PageResult<AttendanceLeaveRespVO> result = BeanUtils.toBean(pageResult, AttendanceLeaveRespVO.class);
|
|
|
|
+ // 请假类型
|
|
|
|
+ List<DictDataTenantRespDTO> dictDataList = dictDataTenantApi.getDictDataList(DictTypeTenantEnum.TENANT_LEAVE_TYPE.getType());
|
|
|
|
+ Map<String, String> dictDataMap = CollectionUtils.convertMap(dictDataList, DictDataTenantRespDTO::getValue, DictDataTenantRespDTO::getLabel);
|
|
if (result != null && result.getList() != null && result.getList().size() > 0) {
|
|
if (result != null && result.getList() != null && result.getList().size() > 0) {
|
|
result.getList().forEach(respVO -> {
|
|
result.getList().forEach(respVO -> {
|
|
// 部门
|
|
// 部门
|
|
@@ -111,6 +130,13 @@ public class AttendanceLeaveController {
|
|
respVO.setDeptName(dept.getName());
|
|
respVO.setDeptName(dept.getName());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // 请假类型
|
|
|
|
+ if (StrUtil.isNotBlank(respVO.getLeaveType())) {
|
|
|
|
+ String leaveTypeDesc = dictDataMap.get(respVO.getLeaveType());
|
|
|
|
+ if (StrUtil.isNotBlank(leaveTypeDesc)) {
|
|
|
|
+ respVO.setLeaveTypeDesc(leaveTypeDesc);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
});
|
|
});
|
|
}
|
|
}
|
|
return success(result);
|
|
return success(result);
|