Commit 02b99fa2 authored by hongguangwu's avatar hongguangwu

MVP1.7.14-手机号导入校验

parent 3baf1f8a
...@@ -712,28 +712,112 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe ...@@ -712,28 +712,112 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
/// 个性化校验逻辑 /// 个性化校验逻辑
TSalaryEmployeeUpdateVo excel; TSalaryEmployeeUpdateVo excel;
List<String> idCardList = new ArrayList<>(); List<String> idCardList = new ArrayList<>();
// 查重,查非自己的手机号是否存在
List<String> phoneList = new ArrayList<>();
// 查本表重
Map<String, Integer> phoneMap = new HashMap<>();
// 本表重复的手机号,不允许导入该行
Map<String, Integer> phoneRepeatMap = new HashMap<>();
Integer phoneCount;
TCheckBankNo checkBankNo;
List<TCheckBankNo> bankList = new ArrayList<>();
// 执行数据插入操作 组装 // 执行数据插入操作 组装
for (TSalaryEmployeeUpdateVo vo : excelVOList) { for (TSalaryEmployeeUpdateVo vo : excelVOList) {
idCardList.add(vo.getEmpIdcard()); idCardList.add(vo.getEmpIdcard());
if (Common.isNotNull(vo.getEmpPhone())) {
phoneCount = phoneMap.get(vo.getEmpPhone());
if (phoneCount == null) {
phoneMap.put(vo.getEmpPhone(), CommonConstants.ONE_INT);
phoneList.add(vo.getEmpPhone());
} else {
phoneRepeatMap.put(vo.getEmpPhone(), CommonConstants.ONE_INT);
}
}
if (Common.isNotNull(vo.getBankNo()) && Common.isNotNull(vo.getEmpName())) {
checkBankNo = new TCheckBankNo();
checkBankNo.setName(vo.getEmpName());
checkBankNo.setBankNo(vo.getBankNo());
bankList.add(checkBankNo);
}
} }
List<TSalaryEmployee> empList = baseMapper.getListByIdCard(idCardList); List<TSalaryEmployee> empList = baseMapper.getListByIdCard(idCardList);
// 人员Map // 人员Map
Map<String, TSalaryEmployee> empMap = new HashMap<>(); Map<String, TSalaryEmployee> empMap = new HashMap<>();
for (TSalaryEmployee e : empList) { for (TSalaryEmployee e : empList) {
empMap.put(e.getEmpIdcard(), e); empMap.put(e.getEmpIdcard(), e);
} }
List<TSalaryEmployee> empPhoneList = baseMapper.getListByPhone(phoneList);
// 人员手机号Map
Map<String, List<String>> empPhoneMap = new HashMap<>();
List<String> phoneIdCardList;
for (TSalaryEmployee e : empPhoneList) {
phoneIdCardList = empPhoneMap.get(e.getEmpPhone());
if (phoneIdCardList == null) {
phoneIdCardList = new ArrayList<>();
}
phoneIdCardList.add(e.getEmpIdcard());
empPhoneMap.put(e.getEmpPhone(), phoneIdCardList);
}
TSalaryEmployee emp; TSalaryEmployee emp;
// 开户行省市的区域暂存 // 开户行省市的区域暂存
String areaStr; String areaStr;
boolean curTaxMonth; boolean curTaxMonth;
Map<String, String> bankMap = tBankSetService.getBankMap(null); Map<String, String> bankMap = tBankSetService.getBankMap(null);
ExcelUtil<TSalaryEmployee> util = new ExcelUtil<>(TSalaryEmployee.class); ExcelUtil<TSalaryEmployee> util = new ExcelUtil<>(TSalaryEmployee.class);
TSalaryEmployee old =null; TSalaryEmployee old;
String idCard;
boolean phoneFlag;
// 校验卡号所用的
Map<String, Boolean> bankCheckMap = new HashMap<>();
if (!bankList.isEmpty()) {
R<CheckBatchVo> checkListR = HttpDaprUtil.invokeMethodPost(checkProperties.getAppUrl(), checkProperties.getAppId()
, "/tcheckbankno/inner/checkBankNoBatch", bankList, CheckBatchVo.class, SecurityConstants.FROM_IN);
if (checkListR != null && checkListR.getData() != null) {
bankCheckMap = checkListR.getData().getCheckMap();
}
}
Map<String, Boolean> phoneCheckMap = new HashMap<>();
if (!phoneList.isEmpty()) {
R<CheckBatchVo> phoneR = HttpDaprUtil.invokeMethodPost(checkProperties.getAppUrl(), checkProperties.getAppId()
, "/tcheckmobile/inner/checkMobileBatch", phoneList, CheckBatchVo.class, SecurityConstants.FROM_IN);
if (phoneR != null && phoneR.getData() != null) {
phoneCheckMap = phoneR.getData().getCheckMap();
}
}
for (int i = 0; i < excelVOList.size(); i++) { for (int i = 0; i < excelVOList.size(); i++) {
excel = excelVOList.get(i); excel = excelVOList.get(i);
if (excel != null) { if (excel != null) {
if (Common.isNotNull(excel.getEmpIdcard())) { idCard = excel.getEmpIdcard();
emp = empMap.get(excel.getEmpIdcard()); if (Common.isNotNull(idCard)) {
if (Common.isNotNull(excel.getEmpPhone())) {
// 手机号本表重复,该条直接不给导入
if (phoneRepeatMap.get(excel.getEmpPhone()) != null) {
errorMessageList.add(new ErrorMessage((i), "该手机号在本次导入表中有重复,请检查并修改后重新导入"));
continue;
}
// 手机号与系统里重复
phoneIdCardList = empPhoneMap.get(excel.getEmpPhone());
if (phoneIdCardList != null) {
phoneFlag = false;
for (String phoneIdCard : phoneIdCardList) {
if (!idCard.equals(phoneIdCard)) {
phoneFlag = true;
break;
}
}
if (phoneFlag) {
errorMessageList.add(new ErrorMessage((i), "手机号已被占用,请更改手机号后重试"));
continue;
}
}
}
emp = empMap.get(idCard);
old = new TSalaryEmployee(); old = new TSalaryEmployee();
if (Common.isNotNull(emp) && Common.isNotNull(emp.getId())) { if (Common.isNotNull(emp) && Common.isNotNull(emp.getId())) {
BeanUtil.copyProperties(emp,old); BeanUtil.copyProperties(emp,old);
...@@ -782,9 +866,17 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe ...@@ -782,9 +866,17 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
emp.setEmpName(excel.getEmpName()); emp.setEmpName(excel.getEmpName());
} }
// 2024-2-4 16:05:56 hgw 银行卡需要校验 // 2024-2-4 16:05:56 hgw 银行卡需要校验
String pre = getCheckBankNo(emp, old); // 改为批量
if (pre != null) { if (Common.isNotNull(emp.getBankNo()) && !emp.getBankNo().equals(old.getBankNo())
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), pre)); && bankCheckMap.get(emp.getBankNo()) != null
&& Boolean.FALSE.equals(bankCheckMap.get(emp.getBankNo()))) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "【姓名与卡号】校验结果:不匹配。请更改卡号或姓名后重试!!"));
continue;
}
if (Common.isNotNull(emp.getEmpPhone()) && phoneCheckMap.get(emp.getEmpPhone()) != null
&& Boolean.FALSE.equals(phoneCheckMap.get(emp.getEmpPhone()))) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "手机号校验不通过,请更改手机号后重试!"));
continue; continue;
} }
// 变更日志 fxj 2023-10-24 // 变更日志 fxj 2023-10-24
......
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