| | |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.attendance.vo.HrmAttendanceExceptionPageReqVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.attendance.vo.HrmAttendanceExceptionSaveReqVO; |
| | | import cn.iocoder.yudao.module.hrm.dal.dataobject.attendance.HrmAttendanceExceptionDO; |
| | | import cn.iocoder.yudao.module.hrm.dal.dataobject.employee.HrmEmployeeDO; |
| | | import cn.iocoder.yudao.module.hrm.dal.mysql.attendance.HrmAttendanceExceptionMapper; |
| | | import cn.iocoder.yudao.module.hrm.service.employee.HrmEmployeeService; |
| | | import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| | | import cn.iocoder.yudao.module.hrm.dal.redis.HrmNoRedisDAO; |
| | | import cn.iocoder.yudao.module.hrm.enums.HrmAuditStatusEnum; |
| | | import jakarta.annotation.Resource; |
| | |
| | | /** |
| | | * 考勤异常申请 Service 实现类 |
| | | * |
| | | * @author 芋道源码 |
| | | * @author 超级管理员 |
| | | */ |
| | | @Service |
| | | @Validated |
| | |
| | | |
| | | @Resource |
| | | private HrmAttendanceExceptionMapper attendanceExceptionMapper; |
| | | @Resource |
| | | private HrmEmployeeService employeeService; |
| | | @Resource |
| | | private AdminUserApi adminUserApi; |
| | | @Resource |
| | | private HrmNoRedisDAO noRedisDAO; |
| | | @Resource |
| | |
| | | public Long createAttendanceException(HrmAttendanceExceptionSaveReqVO createReqVO) { |
| | | HrmAttendanceExceptionDO attendanceException = BeanUtils.toBean(createReqVO, HrmAttendanceExceptionDO.class); |
| | | attendanceException.setNo(generateNo()); |
| | | // 申请人默认为当前登录用户对应的员工,前端表单不选择申请人 |
| | | Long loginUserId = cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId(); |
| | | HrmEmployeeDO employee = employeeService.getEmployeeByUserId(loginUserId); |
| | | if (employee == null) { |
| | | AdminUserRespDTO loginUser = adminUserApi.getUser(loginUserId); |
| | | throw exception(ATTENDANCE_EXCEPTION_EMPLOYEE_NOT_EXISTS, |
| | | loginUser != null ? loginUser.getNickname() : String.valueOf(loginUserId)); |
| | | } |
| | | attendanceException.setUserId(employee.getId()); |
| | | if (attendanceException.getDeptId() == null) { |
| | | attendanceException.setDeptId(employee.getDeptId()); |
| | | } |
| | | attendanceException.setStatus(HrmAuditStatusEnum.DRAFT.getStatus()); |
| | | attendanceExceptionMapper.insert(attendanceException); |
| | | storageAttachmentApi.bindAttachments("file", "hrm_attendance_exception", |