| | |
| | | import cn.iocoder.yudao.module.hrm.dal.dataobject.salary.HrmSalaryCalculationDO; |
| | | import cn.iocoder.yudao.module.hrm.service.employee.HrmEmployeeService; |
| | | import cn.iocoder.yudao.module.hrm.service.salary.HrmSalaryCalculationService; |
| | | import cn.iocoder.yudao.module.mes.api.feedback.dto.MesProFeedbackWageDetailRespDTO; |
| | | import cn.iocoder.yudao.module.system.api.dept.DeptApi; |
| | | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "获得薪酬核算分页") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary:query')") |
| | | public CommonResult<PageResult<HrmSalaryCalculationRespVO>> getSalaryCalculationPage(@Valid HrmSalaryCalculationPageReqVO pageReqVO) { |
| | | PageResult<HrmSalaryCalculationDO> pageResult = salaryCalculationService.getSalaryCalculationPage(pageReqVO); |
| | | // 转换为 VO |
| | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "获得薪酬核算") |
| | | @Parameter(name = "id", description = "核算ID", required = true) |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary:query')") |
| | | public CommonResult<HrmSalaryCalculationRespVO> getSalaryCalculation(@RequestParam("id") Long id) { |
| | | HrmSalaryCalculationDO salaryCalculation = salaryCalculationService.getSalaryCalculation(id); |
| | | if (salaryCalculation == null) { |
| | |
| | | return success(respVO); |
| | | } |
| | | |
| | | @GetMapping("/work-wage-detail") |
| | | @Operation(summary = "获得员工某核算周期的报工工资明细", |
| | | description = "按报工人汇总口径返回每条报工单的主工资、辅助工资、自定义工资字段、质量调整与最终工资") |
| | | @Parameter(name = "period", description = "核算周期,格式 2024-01", required = true, example = "2026-11") |
| | | @Parameter(name = "userId", description = "员工编号(薪酬核算记录中的 userId)", required = true, example = "1024") |
| | | public CommonResult<List<MesProFeedbackWageDetailRespDTO>> getWorkWageDetail( |
| | | @RequestParam("period") String period, |
| | | @RequestParam("userId") Long userId) { |
| | | return success(salaryCalculationService.getWorkWageDetailList(period, userId)); |
| | | } |
| | | |
| | | @PostMapping("/calculate") |
| | | @Operation(summary = "执行薪酬核算") |
| | | @Parameter(name = "period", description = "核算周期", required = true, example = "2024-01") |
| | | @Parameter(name = "deptId", description = "部门ID,为空则核算所有部门", example = "1") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary:calculate')") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary-calculation:calculate')") |
| | | public CommonResult<Boolean> calculateSalary(@RequestParam("period") String period, |
| | | @RequestParam(value = "deptId", required = false) Long deptId) { |
| | | salaryCalculationService.calculateSalary(period, deptId); |
| | |
| | | |
| | | @PostMapping("/confirm") |
| | | @Operation(summary = "批量确认薪酬核算") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary:confirm')") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary-calculation:confirm')") |
| | | public CommonResult<Boolean> confirmSalaryCalculation(@RequestBody Map<String, List<Long>> request) { |
| | | List<Long> ids = request.get("ids"); |
| | | salaryCalculationService.confirmSalaryCalculation(ids); |
| | |
| | | |
| | | @PostMapping("/revoke") |
| | | @Operation(summary = "批量撤销薪酬核算确认") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary:confirm')") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary-calculation:confirm')") |
| | | public CommonResult<Boolean> revokeSalaryCalculation(@RequestBody Map<String, List<Long>> request) { |
| | | List<Long> ids = request.get("ids"); |
| | | salaryCalculationService.revokeSalaryCalculation(ids); |
| | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "删除薪酬核算记录") |
| | | @Parameter(name = "id", description = "核算ID", required = true) |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary:delete')") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary-calculation:delete')") |
| | | public CommonResult<Boolean> deleteSalaryCalculation(@RequestParam("id") Long id) { |
| | | salaryCalculationService.deleteSalaryCalculation(id); |
| | | return success(true); |
| | |
| | | |
| | | @GetMapping("/export-excel") |
| | | @Operation(summary = "导出薪酬核算 Excel") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary:export')") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary-calculation:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportSalaryCalculationExcel(@Valid HrmSalaryCalculationPageReqVO pageReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | |
| | | @Operation(summary = "预览部门下所有员工的薪资核算信息") |
| | | @Parameter(name = "period", description = "核算周期", required = true, example = "2024-01") |
| | | @Parameter(name = "deptId", description = "部门ID,为空则查询全部", example = "1") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary:query')") |
| | | public CommonResult<List<HrmSalaryCalculationRespVO>> previewSalaryCalculation( |
| | | @RequestParam("period") String period, |
| | | @RequestParam(value = "deptId", required = false) Long deptId) { |
| | |
| | | |
| | | @PostMapping("/save") |
| | | @Operation(summary = "批量保存薪酬核算记录") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary:calculate')") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary-calculation:save')") |
| | | public CommonResult<Boolean> saveSalaryCalculation(@Valid @RequestBody HrmSalaryCalculationSaveReqVO saveReqVO) { |
| | | // 转换为 DO 列表 |
| | | List<HrmSalaryCalculationDO> calculationList = saveReqVO.getList().stream() |