From 4e55bd9cee8e44f7a7a0d9185d8323fc7be9193d Mon Sep 17 00:00:00 2001
From: yubo <autumnal_wind@yeah.net>
Date: 星期六, 11 四月 2026 21:14:01 +0800
Subject: [PATCH] fix(hr): 修正员工基础信息字典字段的大小写问题
---
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/controller/EmpBaseInfoController.java | 78 +++++++++++++++++++++++++++++----------
1 files changed, 58 insertions(+), 20 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 13202f2..821ecba 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
@@ -27,6 +27,7 @@
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
+import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
@@ -283,6 +284,12 @@
@PostMapping("addInEmp")
@PreAuthorize("hasAuthority('empBaseinfo:add')")
public FebsResponse addInEmpBaseInfo(@Valid EmpBaseInfo empBaseinfo) throws FebsException {
+ if(this.empBaseInfoService.verifyEmpNumb(empBaseinfo)){
+ throw new FebsException("已存在此员工编号:" + empBaseinfo.getEmpNumb());
+ }
+ if(this.empBaseInfoService.verifyCertificateNumb(empBaseinfo)){
+ throw new FebsException("已存在此身份证号:" + empBaseinfo.getCertificateNumb());
+ }
try {
return new FebsResponse().data(empBaseInfoService.addInEmpBaseInfo(empBaseinfo));
} catch (Exception e) {
@@ -337,45 +344,76 @@
public void probationChangeEmpBaseInfo(EmpBaseInfo empBaseinfo) {
this.empBaseInfoService.probationEmpBaseInfo(empBaseinfo);
}
- @ApiOperation(value = "导出员工")
+
+ @ApiOperation(value = "导出社保四险员工")
@PostMapping(value = "export/insurance")
- @ControllerEndpoint(operation = "导出社保提醒数据", exceptionMessage = "导出Excel失败")
- public void exportInsuranceWithField(QueryRequest request, HttpServletResponse response, String exportField,EmpBaseInfo empBaseinfo) throws IOException {
+ @ControllerEndpoint(operation = "导出社保四险数据", exceptionMessage = "导出 Excel 失败")
+ public void exportInsuranceWithField(QueryRequest request, HttpServletRequest httpRequest, HttpServletResponse response, EmpBaseInfo empBaseinfo) throws IOException {
+ String exportField = httpRequest.getParameter("exportField");
+ log.info("exportField: {}", exportField);
request.setPageSize(25535);
request.setPageNum(1);
List<EmpBaseInfo> exportList = this.empBaseInfoService.findInsuranceEmpBaseInfos(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);
+ exportExcel(response, exportField, exportList, "社保四险员工列表");
}
@ApiOperation(value = "导出退休提醒员工")
@PostMapping(value = "export/retirement")
- @ControllerEndpoint(operation = "导出退休提醒数据", exceptionMessage = "导出Excel失败")
+ @ControllerEndpoint(operation = "导出退休提醒数据", exceptionMessage = "导出 Excel 失败")
public void exportRetirementWithField(QueryRequest request, HttpServletResponse response, String exportField, EmpBaseInfo empBaseinfo) throws IOException {
request.setPageSize(25535);
request.setPageNum(1);
List<EmpBaseInfo> exportList = this.empBaseInfoService.findRetirementEmpBaseInfos(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);
+ exportExcel(response, exportField, exportList, "退休提醒员工列表");
}
+
@ApiOperation(value = "导出转正提醒员工")
@PostMapping(value = "export/probation")
- @ControllerEndpoint(operation = "导出转正提醒数据", exceptionMessage = "导出Excel失败")
+ @ControllerEndpoint(operation = "导出转正提醒数据", exceptionMessage = "导出 Excel 失败")
public void exportProbationWithField(QueryRequest request, HttpServletResponse response, String exportField, EmpBaseInfo empBaseinfo) throws IOException {
request.setPageSize(25535);
request.setPageNum(1);
List<EmpBaseInfo> exportList = this.empBaseInfoService.findProbationEmpBaseInfos(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);
+ exportExcel(response, exportField, exportList, "转正提醒员工列表");
}
+ @ApiOperation(value = "导出身份证到期员工")
+ @PostMapping(value = "export/sfz")
+ @ControllerEndpoint(operation = "导出身份证到期员工", exceptionMessage = "导出 Excel 失败")
+ public void exportIdNumberWithField(QueryRequest request, HttpServletResponse response, String exportField, EmpBaseInfo empBaseinfo) throws IOException {
+ request.setPageSize(25535);
+ request.setPageNum(1);
+ String index = empBaseinfo.getTimeRange().toString();
+ List<EmpBaseInfo> exportList = this.empBaseInfoService.baseInfoList(index, null, null, "25535", "1", "11", null).getRecords();
+ exportExcel(response, exportField, exportList, "身份证到期员工列表");
+ }
+
+ @ApiOperation(value = "导出合同到期员工")
+ @PostMapping(value = "export/expireHt")
+ @ControllerEndpoint(operation = "导出合同证到期员工", exceptionMessage = "导出 Excel 失败")
+ public void exportExpireHtWithField(QueryRequest request, HttpServletResponse response, String exportField, EmpBaseInfo empBaseinfo) throws IOException {
+ request.setPageSize(25535);
+ request.setPageNum(1);
+ String index = empBaseinfo.getTimeRange().toString();
+ List<EmpBaseInfo> exportList = this.empBaseInfoService.baseInfoHeList(index, null, null, "25535", "1", "12", null).getRecords();
+ exportExcel(response, exportField, exportList, "合同到期员工列表");
+ }
+
+ /**
+ * 通用 Excel 导出方法
+ *
+ * @param response HTTP 响应对象
+ * @param exportField 导出字段
+ * @param exportList 导出数据列表
+ * @param fileName 文件名(不含日期)
+ * @throws IOException IO 异常
+ */
+ private void exportExcel(HttpServletResponse response, String exportField, List<EmpBaseInfo> exportList, String fileName) throws IOException {
+ log.info("导出Excel - exportField: {}", exportField);
+ log.info("导出Excel - exportList size: {}", exportList != null ? exportList.size() : 0);
+ List<Map<String, Object>> allList = PoiExportExcel.getDataList(exportField, exportList, null);
+ Date currentDate = new Date();
+ String dateStr = DateUtil.formatDate(currentDate);
+ PoiExportExcel.exportCommonExcel(response, fileName + dateStr, fileName, allList);
+ }
}
--
Gitblit v1.8.0