Commit 48801cac authored by hongguangwu's avatar hongguangwu

批量导入档案

parent b2f5ac30
......@@ -248,7 +248,7 @@ public class TEmployeeInfoController {
* @Date: 2022/6/21 19:42
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(summary = "通过id减档人员档案表", description = "通过id减档人员档案表")
@Operation(summary = "通过id减档人员档案表temployeeinfo_minus", description = "通过id减档人员档案表")
@SysLog("通过id减档人员档案表")
@GetMapping("/minusEmployee")
@PreAuthorize("@pms.hasPermission('temployeeinfo_minus')")
......@@ -263,7 +263,7 @@ public class TEmployeeInfoController {
* @Date: 2022/6/21 19:42
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(summary = "批量减档人员档案表", description = "批量减档人员档案表")
@Operation(summary = "批量减档人员档案表temployeeinfo_batch_minus", description = "批量减档人员档案表")
@SysLog("批量减档人员档案表")
@PostMapping("/batchMinusEmployee")
@PreAuthorize("@pms.hasPermission('temployeeinfo_batch_minus')")
......
......@@ -587,23 +587,27 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
return null;
}
private R<TEmployeeInfo> checkEmployeeVOR(EmployeeVO employeeInfo) {
private void checkEmployeeVOR(long lineNum, EmployeeVO employeeInfo, Map<Long, ErrorMessage> errorMsgMap, Set<String> errorMsg) {
if (Common.isEmpty(employeeInfo.getEmpIdcard())) {
return R.failed("员工身份证必填!");
errorMsg.add("员工身份证必填!");
errorMsgMap.put(lineNum, new ErrorMessage("员工身份证必填!"));
}
if (Common.isEmpty(employeeInfo.getDeptNo())) {
return R.failed("项目编码必填!");
errorMsg.add("项目编码必填!");
errorMsgMap.put(lineNum, new ErrorMessage("项目编码必填!"));
}
if (Common.isEmpty(employeeInfo.getEmpName())) {
return R.failed("员工姓名必填!");
errorMsg.add("员工姓名必填!");
errorMsgMap.put(lineNum, new ErrorMessage("员工姓名必填!"));
}
if (Common.isEmpty(employeeInfo.getEmpPhone())) {
return R.failed("手机号必填!");
errorMsg.add("手机号必填!");
errorMsgMap.put(lineNum, new ErrorMessage("手机号必填!"));
}
if (Common.isEmpty(employeeInfo.getEmpNatrue())) {
return R.failed("员工类型必填!");
errorMsg.add("员工类型必填!");
errorMsgMap.put(lineNum, new ErrorMessage("员工类型必填!"));
}
return null;
}
@Override
......@@ -629,26 +633,35 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
List<String> phoneList = new ArrayList<>();
Map<String, Integer> idCardMap = new HashMap<>();
String idCard;
ErrorMessage errorMessage;
// 个性化校验逻辑
Set<String> errorMsg;
for (int i = 0; i < excelVOList.size(); i++) {
errorMsg = new HashSet<>();
// 判空
R<TEmployeeInfo> failed = this.checkEmployeeVOR(excelVOList.get(i));
if (failed != null) errorMsgMap.put((i + 2L), new ErrorMessage(failed.getMsg()));
this.checkEmployeeVOR((i+2L), excelVOList.get(i), errorMsgMap, errorMsg);
idCard = excelVOList.get(i).getEmpIdcard();
if (Common.isEmpty(idCard)) {
errorMsg.add("第" + (i + 2) + "行身份证号为空!");
errorMsgMap.put((i + 2L), new ErrorMessage("第" + (i + 2) + "行身份证号为空!"));
} else {
if (idCardMap.get(idCard) != null) {
errorMsg.add("第" + (i + 2) + "行身份证号与第" + idCardMap.get(idCard) + "行重复!");
errorMsgMap.put((i + 2L), new ErrorMessage("第" + (i + 2) + "行身份证号与第" + idCardMap.get(idCard) + "行重复!"));
} else {
idCardMap.put(idCard, i + 2);
idCardList.add(idCard);
}
}
if (Common.isEmpty(excelVOList.get(i).getEmpPhone())) {
errorMsgMap.put((i + 2L), new ErrorMessage("第" + (i + 2) + "行手机号码为空!"));
} else {
if (Common.isNotNull(excelVOList.get(i).getEmpPhone())) {
phoneList.add(excelVOList.get(i).getEmpPhone());
}
// 数据合法情况
if (!CollUtil.isEmpty(errorMsg)) {
// 数据不合法
errorMessageList.add(new ErrorMessage((i + 2L), errorMsg));
}
}
// 查找档案库
Map<String, TEmployeeInfo> existEmpMap = new HashMap<>();
......@@ -666,8 +679,6 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
}
// 个性化校验逻辑
Set<String> errorMsg;
EmployeeVO excel;
// 已存在的档案信息
TEmployeeInfo existEmp;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment