From ffab76344576bdd096fbe1b0c9fb31bd110c41ca Mon Sep 17 00:00:00 2001
From: yz <yz_0812@outlook.com>
Date: 星期二, 09 三月 2021 01:05:50 +0800
Subject: [PATCH] 修改bug
---
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/controller/EmpBaseInfoController.java | 104 +++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 82 insertions(+), 22 deletions(-)
diff --git a/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/controller/EmpBaseInfoController.java b/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/controller/EmpBaseInfoController.java
index 9decba8..33d0676 100644
--- a/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/controller/EmpBaseInfoController.java
+++ b/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/controller/EmpBaseInfoController.java
@@ -11,10 +11,13 @@
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
+import cc.mrbird.febs.common.core.annotation.FieldInfo;
import cc.mrbird.febs.common.core.entity.system.SystemUser;
import cc.mrbird.febs.server.hr.annotation.ControllerEndpoint;
import cc.mrbird.febs.server.hr.entity.EmpDimissionLog;
import cc.mrbird.febs.server.hr.entity.EmpJobChange;
+import cn.hutool.core.annotation.AnnotationUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wuwenze.poi.ExcelKit;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -98,7 +101,7 @@
Map<String, Object> dataTable = FebsUtil.getDataTable(this.empBaseInfoService.findEmpBaseInfos(request, empBaseinfo));
return new FebsResponse().data(dataTable);
}
-
+
@ApiOperation(value = "智搜人员基本信息翻页列表")
@GetMapping("zslist")
@PreAuthorize("hasAuthority('empBaseinfo:list')")
@@ -112,10 +115,9 @@
@PreAuthorize("hasAuthority('empBaseinfo:add')")
public void addEmpBaseInfo(@Valid EmpBaseInfo empBaseinfo) throws FebsException {
if(this.empBaseInfoService.verifyEmpNumb(empBaseinfo)){
- throw new FebsException("已存在此员工编号");
+ throw new FebsException("已存在此员工编号:" + empBaseinfo.getEmpNumb());
}
try {
- //EmpBaseInfo tempInfo = this.empBaseInfoService.
this.empBaseInfoService.createEmpBaseInfo(empBaseinfo);
} catch (Exception e) {
String message = "新增员工基本信息失败";
@@ -177,44 +179,77 @@
throw new FebsException(message);
}
}
-
+ @GetMapping("options")
+ public FebsResponse roles() {
+ QueryWrapper<EmpBaseInfo> wrapper=new QueryWrapper();
+ wrapper.eq("empStatus",0);
+ wrapper.eq("delFlag",0);
+ wrapper.orderByDesc("createTime");
+ List<EmpBaseInfo> allRoles = empBaseInfoService.list(wrapper);
+ return new FebsResponse().data(allRoles);
+ }
+
@ApiOperation(value = "导出员工")
@RequestMapping(value = "export",method= RequestMethod.POST)
@ControllerEndpoint(operation = "导出用户数据", exceptionMessage = "导出Excel失败")
public void export(QueryRequest request, EmpBaseInfo empBaseinfo, HttpServletResponse response) throws IOException {
-
+ request.setPageSize(this.empBaseInfoService.count());
List<EmpBaseInfo> records = this.empBaseInfoService.findZsEmpBaseInfos(request, empBaseinfo).getRecords();
ExcelKit.$Export(EmpBaseInfo.class, response).downXlsx(records, false);
}
+ @ApiOperation(value = "导出员工")
+ @RequestMapping(value = "exportWithField",method= RequestMethod.POST)
+ @ControllerEndpoint(operation = "导出用户数据", exceptionMessage = "导出Excel失败")
+ public void exportWithField(QueryRequest request, HttpServletResponse response, String exportField,EmpBaseInfo empBaseinfo) throws IOException {
+ request.setPageSize(25535);
+ request.setPageNum(1);
+ List<EmpBaseInfo> exportList = this.empBaseInfoService.findZsEmpBaseInfos(request, empBaseinfo).getRecords();
+ List<Map<String, Object>> listMapDicItem = new ArrayList();
+ List<Map<String, Object>> allList = PoiExportExcel.getDataList(exportField, exportList, listMapDicItem);
+ String fileName = "在职员工列表";
+ Date currentDate = new Date();
+ String dateStr = DateUtil.formatDate(currentDate);
+ boolean result = PoiExportExcel.exportCommonExcel(response, fileName + dateStr, fileName, allList);
+ }
+
+ @ApiOperation(value = "导出员工")
+ @RequestMapping(value = "exportEmpAll",method= RequestMethod.POST)
+ @ControllerEndpoint(operation = "导出用户数据", exceptionMessage = "导出Excel失败")
+ public void exportEmpAll(HttpServletResponse response,EmpBaseInfo empBaseinfo) throws IOException {
+ this.empBaseInfoService.exportEmpAll(response,empBaseinfo);
+ }
+
@ApiOperation(value = "导入员工")
@PostMapping("importEmp")
- public void importEmp(MultipartFile file) throws IOException {
- InputStream in = null;
- List<List<List<Object>>> listObject = null;
+ public FebsResponse importEmp(MultipartFile file) {
+ InputStream in;
+ List<List<List<Object>>> listObject;
+ List<String> returnList = new ArrayList<>();
try {
if (!file.isEmpty()) {
in = file.getInputStream();
listObject = PoiImportExcel.getMulitListByExcel(in, file.getOriginalFilename());
in.close();
- empBaseInfoService.importEmpBaseInfo(listObject.get(0));
- empWorkExperienceService.importEmpWorkExperience(listObject.get(1));
- empPhysicalExamService.importEmpPhysicalExam(listObject.get(2));
- empContractInfoService.importEmpContractInfo(listObject.get(3));
- empDimissionAttendService.importEmpDimissionAttend(listObject.get(4));
- empLeaveInfoService.importEmpLeaveInfo(listObject.get(5));
- empResignService.importEmpResign(listObject.get(6));
- empUnemploymentService.importEmpUnemployment(listObject.get(7));
- empInsuranceService.importEmpInsurance(listObject.get(8));
- empAccidentCasesService.importEmpAccidentCases(listObject.get(9));
- empOccupationalService.importEmpOccupational(listObject.get(10));
- empLaborTroubleService.importEmpLaborTrouble(listObject.get(11));
- empBadRecordService.importEmpBadRecord(listObject.get(12));
- empRemarkinfoService.importEmpBadRecord(listObject.get(13));
+ empBaseInfoService.importEmpBaseInfo(listObject.get(0),returnList);
+ empWorkExperienceService.importEmpWorkExperience(listObject.get(1),returnList);
+ empPhysicalExamService.importEmpPhysicalExam(listObject.get(2),returnList);
+ empContractInfoService.importEmpContractInfo(listObject.get(3),returnList);
+ empDimissionAttendService.importEmpDimissionAttend(listObject.get(4),returnList);
+ empLeaveInfoService.importEmpLeaveInfo(listObject.get(5),returnList);
+ empResignService.importEmpResign(listObject.get(6),returnList);
+ empUnemploymentService.importEmpUnemployment(listObject.get(7),returnList);
+ empInsuranceService.importEmpInsurance(listObject.get(8),returnList);
+ empAccidentCasesService.importEmpAccidentCases(listObject.get(9),returnList);
+ empOccupationalService.importEmpOccupational(listObject.get(10),returnList);
+ empLaborTroubleService.importEmpLaborTrouble(listObject.get(11),returnList);
+ empBadRecordService.importEmpBadRecord(listObject.get(12),returnList);
+ empRemarkinfoService.importEmpRemarkInfo(listObject.get(13),returnList);
}
} catch (Exception e) {
log.error("导入员工", e);
}
+ return new FebsResponse().data(returnList);
}
@ApiOperation(value = "关闭员工档案")
@@ -239,4 +274,29 @@
throw new FebsException(message);
}
}
+
+ @GetMapping("image/{empId}")
+ public void getImage(@PathVariable String empId, HttpServletResponse response) throws FebsException {
+ try {
+ this.empBaseInfoService.getImage(empId,response);
+ } catch (Exception e) {
+ String message = "获取员工图片异常";
+ log.error(message, e);
+ throw new FebsException(message);
+ }
+
+ }
+
+ @ApiOperation(value = "在职人员基本信息增加")
+ @PostMapping("addInEmp")
+ @PreAuthorize("hasAuthority('empBaseinfo:add')")
+ public FebsResponse addInEmpBaseInfo(@Valid EmpBaseInfo empBaseinfo) throws FebsException {
+ try {
+ return new FebsResponse().data(empBaseInfoService.addInEmpBaseInfo(empBaseinfo));
+ } catch (Exception e) {
+ String message = "新增员工基本信息失败";
+ log.error(message, e);
+ throw new FebsException(message);
+ }
+ }
}
--
Gitblit v1.8.0