gaoluyang
2 小时以前 ef3cbc1c6882786e8218b08be3e52ea44587f03b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package cn.iocoder.yudao.module.hrm.controller.admin.attendance;
 
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.hrm.controller.admin.attendance.vo.HrmEmployeeScheduleBatchSaveReqVO;
import cn.iocoder.yudao.module.hrm.controller.admin.attendance.vo.HrmEmployeeScheduleBatchSaveRespVO;
import cn.iocoder.yudao.module.hrm.controller.admin.attendance.vo.HrmEmployeeScheduleListReqVO;
import cn.iocoder.yudao.module.hrm.controller.admin.attendance.vo.HrmEmployeeScheduleRespVO;
import cn.iocoder.yudao.module.hrm.controller.admin.attendance.vo.HrmEmployeeScheduleSaveReqVO;
import cn.iocoder.yudao.module.hrm.service.attendance.HrmEmployeeScheduleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
 
@Tag(name = "管理后台 - HRM 员工排班")
@RestController
@RequestMapping("/hrm/employee-schedule")
@Validated
public class HrmEmployeeScheduleController {
 
    @Resource
    private HrmEmployeeScheduleService employeeScheduleService;
 
    @GetMapping("/list")
    @Operation(summary = "获得某月员工排班列表")
    @PreAuthorize("@ss.hasPermission('hrm:employee-schedule:query')")
    public CommonResult<List<HrmEmployeeScheduleRespVO>> getEmployeeScheduleList(
            @Valid HrmEmployeeScheduleListReqVO reqVO) {
        return success(employeeScheduleService.getScheduleList(reqVO));
    }
 
    @PostMapping("/save")
    @Operation(summary = "批量保存员工排班(整月覆盖式)")
    @PreAuthorize("@ss.hasPermission('hrm:employee-schedule:save')")
    public CommonResult<Boolean> saveEmployeeSchedule(
            @Valid @RequestBody List<@Valid HrmEmployeeScheduleSaveReqVO> saveReqVOList) {
        employeeScheduleService.saveSchedule(saveReqVOList);
        return success(true);
    }
 
    @PostMapping("/batch-save")
    @Operation(summary = "按部门+岗位批量排班(一类人一次排完)")
    @PreAuthorize("@ss.hasPermission('hrm:employee-schedule:save')")
    public CommonResult<HrmEmployeeScheduleBatchSaveRespVO> batchSaveEmployeeSchedule(
            @Valid @RequestBody HrmEmployeeScheduleBatchSaveReqVO reqVO) {
        return success(employeeScheduleService.batchSaveSchedule(reqVO));
    }
 
}