package me.zhengjie.modules.attendance.rest;
|
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.RequiredArgsConstructor;
|
import me.zhengjie.annotation.Log;
|
import me.zhengjie.modules.attendance.service.AttendanceLeaveFlowableService;
|
import me.zhengjie.modules.attendance.service.dto.AttendanceLeaveDto;
|
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.*;
|
|
|
@RestController
|
@RequiredArgsConstructor
|
@Api(tags = "请假(Flowable)")
|
@RequestMapping("/api/attendanceLeaveFlowable")
|
public class AttendanceLeaveFlowableController {
|
|
private final AttendanceLeaveFlowableService attendanceLeaveFlowableService;
|
|
@GetMapping(value = "/report")
|
@Log("查询我发起的请假(Flowable)")
|
@ApiOperation("查询我发起的请假(Flowable)")
|
@PreAuthorize("@el.check('attendanceLeaveFlowable:list')")
|
public ResponseEntity<Object> reportAttendanceLeave() throws Exception {
|
return new ResponseEntity<>(attendanceLeaveFlowableService.report(), HttpStatus.OK);
|
}
|
|
@GetMapping(value = "/approve")
|
@Log("查询待审批的请假(Flowable)")
|
@ApiOperation("查询待审批的请假(Flowable)")
|
@PreAuthorize("@el.check('attendanceLeaveFlowable:list')")
|
public ResponseEntity<Object> approveAttendanceLeave() throws Exception {
|
return new ResponseEntity<>(attendanceLeaveFlowableService.approve(),HttpStatus.OK);
|
}
|
|
@PostMapping
|
@Log("新增请假(Flowable)")
|
@ApiOperation("新增请假(Flowable)")
|
@PreAuthorize("@el.check('attendanceLeaveFlowable:add')")
|
public ResponseEntity<Object> createAttendanceLeave(@Validated @RequestBody AttendanceLeaveDto resources) throws Exception {
|
attendanceLeaveFlowableService.create(resources);
|
return new ResponseEntity<>(HttpStatus.CREATED);
|
}
|
|
@PostMapping(value = "/agree")
|
@Log("同意请假(Flowable)")
|
@ApiOperation("同意请假(Flowable)")
|
public ResponseEntity<Object> agreeAttendanceLeave(@RequestBody String processInstanceId) throws Exception {
|
attendanceLeaveFlowableService.agree(processInstanceId);
|
return new ResponseEntity<>(HttpStatus.OK);
|
}
|
|
@PostMapping(value = "/reject")
|
@Log("拒绝请假(Flowable)")
|
@ApiOperation("拒绝请假(Flowable)")
|
public ResponseEntity<Object> rejectAttendanceLeave(@RequestBody String processInstanceId) throws Exception {
|
attendanceLeaveFlowableService.reject(processInstanceId);
|
return new ResponseEntity<>(HttpStatus.OK);
|
}
|
}
|