liu
2 天以前 a67dab8161c7428aa7cbd6f9051dd5ae77af4ed8
yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/controller/admin/attendance/HrmAttendanceExceptionController.java
@@ -4,6 +4,7 @@
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.hrm.controller.admin.attendance.vo.HrmAttendanceExceptionAuditReqVO;
import cn.iocoder.yudao.module.hrm.controller.admin.attendance.vo.HrmAttendanceExceptionPageReqVO;
import cn.iocoder.yudao.module.hrm.controller.admin.attendance.vo.HrmAttendanceExceptionRespVO;
import cn.iocoder.yudao.module.hrm.controller.admin.attendance.vo.HrmAttendanceExceptionSaveReqVO;
@@ -13,6 +14,7 @@
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;
@@ -39,6 +41,8 @@
    private HrmEmployeeService employeeService;
    @Resource
    private DeptApi deptApi;
    @Resource
    private StorageAttachmentApi storageAttachmentApi;
    @PostMapping("/create")
    @Operation(summary = "新增考勤异常申请")
@@ -67,7 +71,6 @@
    @GetMapping("/get")
    @Operation(summary = "获得考勤异常申请")
    @Parameter(name = "id", description = "申请ID", required = true)
    @PreAuthorize("@ss.hasPermission('hrm:attendance:query')")
    public CommonResult<HrmAttendanceExceptionRespVO> getAttendanceException(@RequestParam("id") Long id) {
        HrmAttendanceExceptionDO attendanceException = attendanceExceptionService.getAttendanceException(id);
        if (attendanceException == null) {
@@ -87,12 +90,12 @@
                respVO.setDeptName(dept.getName());
            }
        }
        respVO.setAttachmentList(storageAttachmentApi.listAttachments("hrm_attendance_exception", id));
        return success(respVO);
    }
    @GetMapping("/page")
    @Operation(summary = "获得考勤异常申请分页")
    @PreAuthorize("@ss.hasPermission('hrm:attendance:query')")
    public CommonResult<PageResult<HrmAttendanceExceptionRespVO>> getAttendanceExceptionPage(@Valid HrmAttendanceExceptionPageReqVO pageReqVO) {
        PageResult<HrmAttendanceExceptionDO> pageResult = attendanceExceptionService.getAttendanceExceptionPage(pageReqVO);
        List<HrmAttendanceExceptionRespVO> list = BeanUtils.toBean(pageResult.getList(), HrmAttendanceExceptionRespVO.class);
@@ -139,16 +142,27 @@
        }
    }
    @PostMapping("/submit")
    @Operation(summary = "提交考勤异常申请")
    @PreAuthorize("@ss.hasPermission('hrm:attendance:submit')")
    public CommonResult<Boolean> submitAttendanceException(
            @RequestParam("id") Long id,
            @RequestParam("processDefinitionKey") String processDefinitionKey) {
        // 获取当前登录用户ID
        Long userId = cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId();
        attendanceExceptionService.submitAttendanceException(id, processDefinitionKey, userId);
    @PutMapping("/submit")
    @Operation(summary = "提交审批(草稿/审核不通过→审批中),审批人由审批配置统一指定")
    @Parameter(name = "id", description = "申请ID", required = true)
    @PreAuthorize("@ss.hasPermission('hrm:attendance-exception:submit')")
    public CommonResult<Boolean> submitAttendanceException(@RequestParam("id") Long id) {
        attendanceExceptionService.submitAttendanceException(id);
        return success(true);
    }
}
    @PutMapping("/audit")
    @Operation(summary = "审核(审批中→审核通过/审核不通过),仅审批人本人可操作")
    @PreAuthorize("@ss.hasPermission('hrm:attendance-exception:audit')")
    public CommonResult<Boolean> auditAttendanceException(@Valid @RequestBody HrmAttendanceExceptionAuditReqVO auditReqVO) {
        attendanceExceptionService.auditAttendanceException(auditReqVO.getId(), auditReqVO.getPass(), auditReqVO.getReviewRemark());
        return success(true);
    }
    @GetMapping("/approver-ids")
    @Operation(summary = "获得审批人编号集合,供前端判断是否展示审核按钮")
    public CommonResult<Set<Long>> getApproverUserIds() {
        return success(attendanceExceptionService.getAttendanceExceptionApproverUserIds());
    }
}