| | |
| | | import cn.iocoder.yudao.module.hrm.service.salary.HrmSalaryPaymentService; |
| | | 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; |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "获得薪资发放分页") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary:query')") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary-payment:query')") |
| | | public CommonResult<PageResult<HrmSalaryPaymentRespVO>> getSalaryPaymentPage(@Valid HrmSalaryPaymentPageReqVO pageReqVO) { |
| | | PageResult<HrmSalaryPaymentDO> pageResult = salaryPaymentService.getSalaryPaymentPage(pageReqVO); |
| | | return success(BeanUtils.toBean(pageResult, HrmSalaryPaymentRespVO.class)); |
| | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "获得薪资发放") |
| | | @Parameter(name = "id", description = "发放ID", required = true) |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary:query')") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary-payment:query')") |
| | | public CommonResult<HrmSalaryPaymentRespVO> getSalaryPayment(@RequestParam("id") Long id) { |
| | | HrmSalaryPaymentDO salaryPayment = salaryPaymentService.getSalaryPayment(id); |
| | | return success(BeanUtils.toBean(salaryPayment, HrmSalaryPaymentRespVO.class)); |
| | | HrmSalaryPaymentRespVO respVO = BeanUtils.toBean(salaryPayment, HrmSalaryPaymentRespVO.class); |
| | | respVO.setAttachmentList(storageAttachmentApi.listAttachments("hrm_salary_payment", id)); |
| | | return success(respVO); |
| | | } |
| | | |
| | | @PostMapping("/generate") |
| | | @Operation(summary = "生成薪资发放台账") |
| | | @Parameter(name = "period", description = "核算周期", required = true, example = "2024-01") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary:generate')") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary-payment:generate')") |
| | | public CommonResult<Long> generatePayment(@RequestParam("period") String period) { |
| | | return success(salaryPaymentService.generatePayment(period)); |
| | | } |
| | |
| | | @PostMapping("/pay") |
| | | @Operation(summary = "发放薪资(整个台账)") |
| | | @Parameter(name = "id", description = "发放台账ID", required = true) |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary:pay')") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary-payment:pay')") |
| | | public CommonResult<Boolean> paySalary(@RequestParam("id") Long id) { |
| | | salaryPaymentService.paySalary(id); |
| | | return success(true); |
| | |
| | | |
| | | @PostMapping("/pay-detail") |
| | | @Operation(summary = "批量发放薪资明细") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary:pay')") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary-payment:pay')") |
| | | public CommonResult<Boolean> paySalaryDetail(@RequestBody Map<String, List<Long>> request) { |
| | | List<Long> detailIds = request.get("detailIds"); |
| | | salaryPaymentService.paySalaryDetail(detailIds); |
| | |
| | | |
| | | @PostMapping("/revoke-detail") |
| | | @Operation(summary = "批量撤销薪资发放明细") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary:pay')") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary-payment:pay')") |
| | | public CommonResult<Boolean> revokeSalaryPaymentDetail(@RequestBody Map<String, List<Long>> request) { |
| | | List<Long> detailIds = request.get("detailIds"); |
| | | salaryPaymentService.revokeSalaryPaymentDetail(detailIds); |
| | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "删除薪资发放台账") |
| | | @Parameter(name = "id", description = "发放台账ID", required = true) |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary:delete')") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary-payment:delete')") |
| | | public CommonResult<Boolean> deleteSalaryPayment(@RequestParam("id") Long id) { |
| | | salaryPaymentService.deleteSalaryPayment(id); |
| | | return success(true); |
| | |
| | | |
| | | @GetMapping("/detail/page") |
| | | @Operation(summary = "获得薪资发放明细分页") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary:query')") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary-payment:query')") |
| | | public CommonResult<PageResult<HrmSalaryPaymentDetailRespVO>> getSalaryPaymentDetailPage(@Valid HrmSalaryPaymentDetailPageReqVO pageReqVO) { |
| | | PageResult<HrmSalaryPaymentDetailDO> pageResult = salaryPaymentService.getSalaryPaymentDetailPage(pageReqVO); |
| | | List<HrmSalaryPaymentDetailRespVO> list = BeanUtils.toBean(pageResult.getList(), HrmSalaryPaymentDetailRespVO.class); |
| | |
| | | @GetMapping("/detail/list") |
| | | @Operation(summary = "获得薪资发放明细列表") |
| | | @Parameter(name = "paymentId", description = "发放台账ID", required = true) |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary:query')") |
| | | @PreAuthorize("@ss.hasPermission('hrm:salary-payment:query')") |
| | | public CommonResult<List<HrmSalaryPaymentDetailRespVO>> getSalaryPaymentDetailList(@RequestParam("paymentId") Long paymentId) { |
| | | List<HrmSalaryPaymentDetailDO> detailList = salaryPaymentService.getSalaryPaymentDetailListByPaymentId(paymentId); |
| | | List<HrmSalaryPaymentDetailRespVO> list = BeanUtils.toBean(detailList, HrmSalaryPaymentDetailRespVO.class); |