| | |
| | | package cc.mrbird.febs.server.hr.controller; |
| | | |
| | | import cc.mrbird.febs.server.hr.annotation.ControllerEndpoint; |
| | | import cc.mrbird.febs.server.hr.entity.EmpAccidentCases; |
| | | import cc.mrbird.febs.server.hr.entity.EmpContractInfo; |
| | | import cc.mrbird.febs.server.hr.service.IEmpContractInfoService; |
| | | import cc.mrbird.febs.common.core.entity.FebsResponse; |
| | | 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 com.wuwenze.poi.ExcelKit; |
| | | import cc.mrbird.febs.server.hr.annotation.ControllerEndpoint; |
| | | import cc.mrbird.febs.server.hr.entity.EmpContractInfo; |
| | | import cc.mrbird.febs.server.hr.service.IEmpContractInfoService; |
| | | import cc.mrbird.febs.server.hr.util.PoiExportExcel; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.IOException; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | @GetMapping("list") |
| | | @PreAuthorize("hasAuthority('empContractinfo:list')") |
| | | public FebsResponse empContractinfoList(QueryRequest request, EmpContractInfo empContractinfo) { |
| | | public FebsResponse getEmpContractList(QueryRequest request, EmpContractInfo empContractinfo) { |
| | | Map<String, Object> dataTable = FebsUtil.getDataTable(this.empContractinfoService.findEmpContractinfos(request, empContractinfo)); |
| | | return new FebsResponse().data(dataTable); |
| | | } |
| | | |
| | | @RequestMapping(value = "remind/list", method = RequestMethod.GET) |
| | | @PreAuthorize("hasAuthority('empContractinfo:list')") |
| | | public FebsResponse empRemindContractList(QueryRequest request, EmpContractInfo empContractinfo) { |
| | | Map<String, Object> dataTable = FebsUtil.getDataTable(this.empContractinfoService.findRemindContractinfos(request, empContractinfo)); |
| | | return new FebsResponse().data(dataTable); |
| | | } |
| | | |
| | | @ApiOperation(value = "导出员工") |
| | | @RequestMapping(value = "export", method = RequestMethod.POST) |
| | | @ControllerEndpoint(operation = "导出用户数据", exceptionMessage = "导出Excel失败") |
| | | public void export(QueryRequest request, EmpContractInfo empBaseinfo, HttpServletResponse response) { |
| | | request.setPageSize(this.empContractinfoService.count()); |
| | | List<EmpContractInfo> records = this.empContractinfoService.findEmpContractinfos(request, empBaseinfo).getRecords(); |
| | | ExcelKit.$Export(EmpContractInfo.class, response).downXlsx(records, false); |
| | | public void export(QueryRequest request, HttpServletResponse response,String exportField, EmpContractInfo empBaseInfo) throws IOException { |
| | | // request.setPageSize(this.empContractinfoService.count()); |
| | | // List<EmpContractInfo> records = this.empContractinfoService.findEmpContractinfos(request, empBaseinfo).getRecords(); |
| | | // ExcelKit.$Export(EmpContractInfo.class, response).downXlsx(records, false); |
| | | request.setPageSize(25535); |
| | | request.setPageNum(1); |
| | | List<EmpContractInfo> exportList = this.empContractinfoService.findRemindContractinfos(request, empBaseInfo).getRecords(); |
| | | List<Map<String, Object>> allList = PoiExportExcel.getDataList(exportField, exportList, null); |
| | | String fileName = "合同到期提醒员工列表"; |
| | | Date currentDate = new Date(); |
| | | String dateStr = DateUtil.formatDate(currentDate); |
| | | boolean result = PoiExportExcel.exportCommonExcel(response, fileName + dateStr, fileName, allList); |
| | | } |
| | | |
| | | @PostMapping |
| | |
| | | this.empContractinfoService.createEmpContractinfo(empContractinfo); |
| | | } catch (Exception e) { |
| | | String message = "新增员工合同信息失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "remind/not", method = RequestMethod.POST) |
| | | @PreAuthorize("hasAuthority('empContractinfo:update')") |
| | | public void updateEmpContractRemind(@Valid EmpContractInfo empContractinfo) throws FebsException { |
| | | try { |
| | | this.empContractinfoService.updateEmpContractRemind(empContractinfo); |
| | | } catch (Exception e) { |
| | | String message = "不续签员工合同操作失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | @RequestMapping(value = "remind/continue", method = RequestMethod.POST) |
| | | @PreAuthorize("hasAuthority('empContractinfo:add')") |
| | | public void continueEmpContract(@Valid EmpContractInfo empContractinfo) throws FebsException { |
| | | try { |
| | | this.empContractinfoService.continueEmpContract(empContractinfo); |
| | | } catch (Exception e) { |
| | | String message = "续签员工合同信息失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | @RequestMapping(value = "retire/rehire", method = RequestMethod.POST) |
| | | @PreAuthorize("hasAuthority('empContractinfo:add')") |
| | | public void retireRehireEmpContract(@Valid EmpContractInfo empContractinfo) throws FebsException { |
| | | try { |
| | | this.empContractinfoService.retireRehireEmpContract(empContractinfo); |
| | | } catch (Exception e) { |
| | | String message = "续签员工合同信息失败"; |
| | | log.error(message, e); |
| | | throw new FebsException(message); |
| | | } |
| | | } |
| | | |
| | | } |