| | |
| | | import cc.mrbird.febs.common.core.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.core.exception.FebsException; |
| | | import cc.mrbird.febs.common.core.utils.FebsUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * |
| | | * name:EmpResign |
| | | * package:cc.mrbird.febs.server.hr.controller |
| | | * description:员工辞职申请控制器 |
| | | * |
| | | * @author luoyibo |
| | | * @date 2021-01-24 20:35:08 |
| | | * @since JDK1.8 |
| | | */ |
| | | * name:EmpResign |
| | | * package:cc.mrbird.febs.server.hr.controller |
| | | * description:员工辞职申请控制器 |
| | | * |
| | | * @author luoyibo |
| | | * @date 2021-01-31 11:26:18 |
| | | * @since JDK1.8 |
| | | */ |
| | | @Api(tags = "人员辞职申请信息录入接口") |
| | | @Slf4j |
| | | @Validated |
| | | @RestController |
| | |
| | | @RequiredArgsConstructor |
| | | public class EmpResignController { |
| | | |
| | | private final IEmpResignService empResignService; |
| | | private final IEmpResignService empResignService; |
| | | |
| | | @GetMapping |
| | | @PreAuthorize("hasAuthority('empResign:list')") |
| | | public FebsResponse getAllEmpResigns(EmpResign empResign) { |
| | | return new FebsResponse().data(empResignService.findEmpResigns(empResign)); |
| | | } |
| | | @GetMapping |
| | | @PreAuthorize("hasAuthority('empResign:list')") |
| | | public FebsResponse getAllEmpResigns(EmpResign empResign) { |
| | | return new FebsResponse().data(empResignService.findEmpResigns(empResign)); |
| | | } |
| | | |
| | | @GetMapping("list") |
| | | @PreAuthorize("hasAuthority('empResign:list')") |
| | | public FebsResponse empResignList(QueryRequest request, EmpResign empResign) { |
| | | Map<String, Object> dataTable = FebsUtil.getDataTable(this.empResignService.findEmpResigns(request, empResign)); |
| | | return new FebsResponse().data(dataTable); |
| | | } |
| | | @GetMapping("list") |
| | | @PreAuthorize("hasAuthority('empResign:list')") |
| | | public FebsResponse empResignList(QueryRequest request, EmpResign empResign) { |
| | | Map<String, Object> dataTable = FebsUtil.getDataTable(this.empResignService.findEmpResigns(request, empResign)); |
| | | return new FebsResponse().data(dataTable); |
| | | } |
| | | |
| | | @PostMapping |
| | | @PreAuthorize("hasAuthority('empResign:add')") |
| | | public void addEmpResign(@Valid EmpResign empResign) throws FebsException { |
| | | try { |
| | | this.empResignService.createEmpResign(empResign); |
| | | } catch (Exception e) { |
| | | String message = "新增EmpResign失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | @PostMapping |
| | | @PreAuthorize("hasAuthority('empResign:add')") |
| | | public void addEmpResign(@Valid EmpResign empResign) throws FebsException { |
| | | try { |
| | | this.empResignService.createEmpResign(empResign); |
| | | } catch (Exception e) { |
| | | String message = "新增员工辞职申请失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @PreAuthorize("hasAuthority('empResign:delete')") |
| | | public void deleteEmpResign(EmpResign empResign) throws FebsException { |
| | | try { |
| | | this.empResignService.deleteEmpResign(empResign); |
| | | } catch (Exception e) { |
| | | String message = "删除EmpResign失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | @DeleteMapping |
| | | @PreAuthorize("hasAuthority('empResign:delete')") |
| | | public void deleteEmpResign(EmpResign empResign) throws FebsException { |
| | | try { |
| | | this.empResignService.deleteEmpResign(empResign); |
| | | } catch (Exception e) { |
| | | String message = "删除员工辞职申请失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @PutMapping |
| | | @PreAuthorize("hasAuthority('empResign:update')") |
| | | public void updateEmpResign(EmpResign empResign) throws FebsException { |
| | | try { |
| | | this.empResignService.updateEmpResign(empResign); |
| | | } catch (Exception e) { |
| | | String message = "修改EmpResign失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | @DeleteMapping("{ids}") |
| | | @PreAuthorize("hasAuthority('empResign:delete')") |
| | | public void logicDeleteEmpResign(@PathVariable("ids") String ids) throws FebsException { |
| | | try { |
| | | this.empResignService.logicDelEmpResign(ids); |
| | | } catch (Exception e) { |
| | | String message = "逻辑删除员工辞职申请失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @PutMapping |
| | | @PreAuthorize("hasAuthority('empResign:update')") |
| | | public void updateEmpResign(EmpResign empResign) throws FebsException { |
| | | try { |
| | | this.empResignService.updateEmpResign(empResign); |
| | | } catch (Exception e) { |
| | | String message = "修改员工辞职申请失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "辞职申请信息提交") |
| | | @DeleteMapping("toNormal/{ids}") |
| | | @PreAuthorize("hasAuthority('empResign:delete')") |
| | | public void momentToNormal(@NotBlank(message = "{required}") @PathVariable("ids") String ids) throws FebsException { |
| | | try { |
| | | this.empResignService.momentToNormal(ids); |
| | | } catch (Exception e) { |
| | | String message = "辞职申请信息提交失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | } |