/*
|
* Copyright 2019-2020 Zheng Jie
|
*
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
* you may not use this file except in compliance with the License.
|
* You may obtain a copy of the License at
|
*
|
* http://www.apache.org/licenses/LICENSE-2.0
|
*
|
* Unless required by applicable law or agreed to in writing, software
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* See the License for the specific language governing permissions and
|
* limitations under the License.
|
*/
|
package me.zhengjie.modules.attendance.rest;
|
|
import me.zhengjie.annotation.Log;
|
import me.zhengjie.modules.attendance.domain.OvertimeConsumedRecord;
|
import me.zhengjie.modules.attendance.service.OvertimeConsumedRecordService;
|
import me.zhengjie.modules.attendance.service.dto.OvertimeConsumedRecordQueryCriteria;
|
import org.springframework.data.domain.Pageable;
|
import lombok.RequiredArgsConstructor;
|
import org.springframework.http.HttpStatus;
|
import org.springframework.http.ResponseEntity;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.*;
|
import io.swagger.annotations.*;
|
import java.io.IOException;
|
import javax.servlet.http.HttpServletResponse;
|
|
/**
|
* @website https://eladmin.vip
|
* @author baolh
|
* @date 2025-09-28
|
**/
|
@RestController
|
@RequiredArgsConstructor
|
@Api(tags = "调休额度消耗记录管理")
|
@RequestMapping("/api/overtimeConsumedRecord")
|
public class OvertimeConsumedRecordController {
|
|
private final OvertimeConsumedRecordService overtimeConsumedRecordService;
|
|
@Log("导出数据")
|
@ApiOperation("导出数据")
|
@GetMapping(value = "/download")
|
@PreAuthorize("@el.check('overtimeConsumedRecord:list')")
|
public void exportOvertimeConsumedRecord(HttpServletResponse response, OvertimeConsumedRecordQueryCriteria criteria) throws IOException {
|
overtimeConsumedRecordService.download(overtimeConsumedRecordService.queryAll(criteria), response);
|
}
|
|
@GetMapping
|
@Log("查询调休额度消耗记录")
|
@ApiOperation("查询调休额度消耗记录")
|
@PreAuthorize("@el.check('overtimeConsumedRecord:list')")
|
public ResponseEntity<Object> queryOvertimeConsumedRecord(OvertimeConsumedRecordQueryCriteria criteria, Pageable pageable){
|
return new ResponseEntity<>(overtimeConsumedRecordService.queryAll(criteria,pageable),HttpStatus.OK);
|
}
|
|
@PostMapping
|
@Log("新增调休额度消耗记录")
|
@ApiOperation("新增调休额度消耗记录")
|
@PreAuthorize("@el.check('overtimeConsumedRecord:add')")
|
public ResponseEntity<Object> createOvertimeConsumedRecord(@Validated @RequestBody OvertimeConsumedRecord resources){
|
return new ResponseEntity<>(overtimeConsumedRecordService.create(resources),HttpStatus.CREATED);
|
}
|
|
@PutMapping
|
@Log("修改调休额度消耗记录")
|
@ApiOperation("修改调休额度消耗记录")
|
@PreAuthorize("@el.check('overtimeConsumedRecord:edit')")
|
public ResponseEntity<Object> updateOvertimeConsumedRecord(@Validated @RequestBody OvertimeConsumedRecord resources){
|
overtimeConsumedRecordService.update(resources);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
}
|
|
@DeleteMapping
|
@Log("删除调休额度消耗记录")
|
@ApiOperation("删除调休额度消耗记录")
|
@PreAuthorize("@el.check('overtimeConsumedRecord:del')")
|
public ResponseEntity<Object> deleteOvertimeConsumedRecord(@RequestBody Long[] ids) {
|
overtimeConsumedRecordService.deleteAll(ids);
|
return new ResponseEntity<>(HttpStatus.OK);
|
}
|
|
@PostMapping(value = "/allConsumedDeduction")
|
@Log("整理全部调休扣除")
|
@ApiOperation("整理全部调休扣除")
|
public ResponseEntity<Object> allConsumedDeduction(){
|
overtimeConsumedRecordService.allConsumedDeduction();
|
return new ResponseEntity<>(HttpStatus.OK);
|
}
|
}
|