| | |
| | | import cn.iocoder.yudao.module.hrm.service.employee.HrmEmployeeService; |
| | | 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.storage.StorageAttachmentApi; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | private HrmEmployeeService employeeService; |
| | | @Resource |
| | | private DeptApi deptApi; |
| | | @Resource |
| | | private StorageAttachmentApi storageAttachmentApi; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "新增考勤异常申请") |
| | |
| | | return success(null); |
| | | } |
| | | HrmAttendanceExceptionRespVO respVO = BeanUtils.toBean(attendanceException, HrmAttendanceExceptionRespVO.class); |
| | | // 填充员工和部门信息(userId 是员工ID) |
| | | // 填充员工和部门信息(userId 是系统账号 ID,不是员工档案 ID) |
| | | if (attendanceException.getUserId() != null) { |
| | | HrmEmployeeDO employee = employeeService.getEmployee(attendanceException.getUserId()); |
| | | HrmEmployeeDO employee = employeeService.getEmployeeByUserId(attendanceException.getUserId()); |
| | | if (employee != null) { |
| | | respVO.setUserName(employee.getName()); |
| | | } |
| | |
| | | respVO.setDeptName(dept.getName()); |
| | | } |
| | | } |
| | | respVO.setAttachmentList(storageAttachmentApi.listAttachments("hrm_attendance_exception", id)); |
| | | return success(respVO); |
| | | } |
| | | |
| | |
| | | * 填充员工和部门信息(userId 是员工ID) |
| | | */ |
| | | private void fillUserInfo(List<HrmAttendanceExceptionRespVO> respList, List<HrmAttendanceExceptionDO> exceptionList) { |
| | | // 批量获取员工信息 |
| | | // 批量获取员工信息(userId 是系统账号 ID,需按 getEmployeeByUserId 查) |
| | | Set<Long> employeeIds = exceptionList.stream() |
| | | .map(HrmAttendanceExceptionDO::getUserId) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toSet()); |
| | | Map<Long, HrmEmployeeDO> employeeMap = new HashMap<>(); |
| | | for (Long employeeId : employeeIds) { |
| | | HrmEmployeeDO employee = employeeService.getEmployee(employeeId); |
| | | for (Long userId : employeeIds) { |
| | | HrmEmployeeDO employee = employeeService.getEmployeeByUserId(userId); |
| | | if (employee != null) { |
| | | employeeMap.put(employeeId, employee); |
| | | employeeMap.put(userId, employee); |
| | | } |
| | | } |
| | | // 批量获取部门信息 |