Commit 5da06006 authored by hongguangwu's avatar hongguangwu

MVP1.7.14-薪资人员导入校验优化

parent 214c3da1
......@@ -320,6 +320,11 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
List<TCheckBankNo> bankList = new ArrayList<>();
List<String> phoneList = new ArrayList<>();
TCheckBankNo checkBankNo;
// 查本表重
Map<String, Integer> phoneExcelMap = new HashMap<>();
// 本表重复的手机号,不允许导入该行
Map<String, Integer> phoneRepeatMap = new HashMap<>();
Integer phoneCount;
for (TSalaryEmployee employee : saveNewEmpList) {
// cyx-mvp1.7.0:调整 代发户的新员工也校验银行卡号
if (Common.isNotNull(employee.getBankNo())
......@@ -332,14 +337,19 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
checkBankNo.setBankNo(employee.getBankNo());
bankList.add(checkBankNo);
}
// 将重复的手机号组装到map里,下面去拦截
if (Common.isNotNull(employee.getEmpPhone())) {
phoneList.add(employee.getEmpPhone());
phoneCount = phoneExcelMap.get(employee.getEmpPhone());
if (phoneCount == null) {
phoneExcelMap.put(employee.getEmpPhone(), CommonConstants.ONE_INT);
phoneList.add(employee.getEmpPhone());
} else {
phoneRepeatMap.put(employee.getEmpPhone(), CommonConstants.ONE_INT);
}
}
}
// 批量校验 卡号与手机号
Map<String, Boolean> bankMap = new HashMap<>();
Map<String, Boolean> phoneMap = new HashMap<>();
if (!bankList.isEmpty()) {
R<CheckBatchVo> checkListR = HttpDaprUtil.invokeMethodPost(checkProperties.getAppUrl(), checkProperties.getAppId()
, "/tcheckbankno/inner/checkBankNoBatch", bankList, CheckBatchVo.class, SecurityConstants.FROM_IN);
......@@ -347,15 +357,29 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
bankMap = checkListR.getData().getCheckMap();
}
}
Map<String, Boolean> phoneMap = new HashMap<>();
// 系统已有人员手机号Map
Map<String, List<String>> empPhoneMap = new HashMap<>();
List<String> phoneIdCardList;
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) {
phoneMap = phoneR.getData().getCheckMap();
}
List<TSalaryEmployee> empPhoneList = baseMapper.getListByPhone(phoneList);
for (TSalaryEmployee e : empPhoneList) {
phoneIdCardList = empPhoneMap.get(e.getEmpPhone());
if (phoneIdCardList == null) {
phoneIdCardList = new ArrayList<>();
}
phoneIdCardList.add(e.getEmpIdcard());
empPhoneMap.put(e.getEmpPhone(), phoneIdCardList);
}
}
boolean isFalse = false;
boolean phoneFlag;
for (TSalaryEmployee employee : saveNewEmpList) {
// cyx-mvp1.7.0:调整 代发户的新员工也校验银行卡号
if (Common.isNotNull(employee.getBankNo())
......@@ -374,14 +398,41 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
isFalse = true;
}
}
if (phoneMap.get(employee.getEmpPhone()) != null) {
if (Boolean.FALSE.equals(phoneMap.get(employee.getEmpPhone()))) {
errorList.add(new ErrorMessage((employee.getLineNums() ), "第" + (employee.getLineNums() ) + "行:该员工新建失败:【手机号验证:手机号错误】"));
if (Common.isNotNull(employee.getEmpPhone())) {
// 手机号本表重复,该条直接不给导入
if (phoneRepeatMap.get(employee.getEmpPhone()) != null) {
errorList.add(new ErrorMessage((employee.getLineNums()), "第" + (employee.getLineNums()) + "行:该员工新建失败:【该手机号在本次导入表中有重复,请检查并修改后重新导入】"));
isFalse = true;
continue;
}
// 手机号与系统里重复
phoneIdCardList = empPhoneMap.get(employee.getEmpPhone());
if (phoneIdCardList != null) {
phoneFlag = false;
for (String phoneIdCard : phoneIdCardList) {
if (!phoneIdCard.equals(employee.getEmpIdcard())) {
phoneFlag = true;
break;
}
}
if (phoneFlag) {
errorList.add(new ErrorMessage((employee.getLineNums()), "第" + (employee.getLineNums()) + "行:该员工新建失败:【手机号已被占用,请更改手机号后重试】"));
isFalse = true;
continue;
}
}
// 手机号校验
if (phoneMap.get(employee.getEmpPhone()) != null) {
if (Boolean.FALSE.equals(phoneMap.get(employee.getEmpPhone()))) {
errorList.add(new ErrorMessage((employee.getLineNums()), "第" + (employee.getLineNums()) + "行:该员工新建失败:【手机号校验不通过,请更改手机号后重试!】"));
isFalse = true;
}
} else {
errorList.add(new ErrorMessage((employee.getLineNums()), "第" + (employee.getLineNums()) + "行:该员工新建失败:【手机号验证:" + SalaryConstants.CHECK_NO_RESPONSE + "】"));
isFalse = true;
}
} else {
errorList.add(new ErrorMessage((employee.getLineNums() ), "第" + (employee.getLineNums() ) + "行:该员工新建失败:【手机号验证:" + SalaryConstants.CHECK_NO_RESPONSE + "】"));
isFalse = true;
}
}
if (isFalse) {
......@@ -400,6 +451,14 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
// 银行卡
List<TCheckBankNo> bankList = new ArrayList<>();
TCheckBankNo checkBankNo;
List<String> phoneList = new ArrayList<>();
// 查本表重
Map<String, Integer> phoneExcelMap = new HashMap<>();
// 本表重复的手机号,不允许导入该行
Map<String, Integer> phoneRepeatMap = new HashMap<>();
Integer phoneCount;
for (TSalaryEmployee employee : updateEmployeeBankList) {
// cyx-mvp1.7.0:调整 代发户的新员工也校验银行卡号
if (Common.isNotNull(employee.getBankNo())
......@@ -410,6 +469,36 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
checkBankNo.setBankNo(employee.getBankNo());
bankList.add(checkBankNo);
}
// 将重复的手机号组装到map里,下面去拦截
if (Common.isNotNull(employee.getEmpPhone())) {
phoneCount = phoneExcelMap.get(employee.getEmpPhone());
if (phoneCount == null) {
phoneExcelMap.put(employee.getEmpPhone(), CommonConstants.ONE_INT);
phoneList.add(employee.getEmpPhone());
} else {
phoneRepeatMap.put(employee.getEmpPhone(), CommonConstants.ONE_INT);
}
}
}
Map<String, Boolean> phoneMap = new HashMap<>();
// 系统已有人员手机号Map
Map<String, List<String>> empPhoneMap = new HashMap<>();
List<String> phoneIdCardList;
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) {
phoneMap = phoneR.getData().getCheckMap();
}
List<TSalaryEmployee> empPhoneList = baseMapper.getListByPhone(phoneList);
for (TSalaryEmployee e : empPhoneList) {
phoneIdCardList = empPhoneMap.get(e.getEmpPhone());
if (phoneIdCardList == null) {
phoneIdCardList = new ArrayList<>();
}
phoneIdCardList.add(e.getEmpIdcard());
empPhoneMap.put(e.getEmpPhone(), phoneIdCardList);
}
}
// 批量校验 卡号与手机号
Map<String, Boolean> bankMap = new HashMap<>();
......@@ -421,6 +510,7 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
}
}
boolean isFalse = false;
boolean phoneFlag;
String areaProvince;
String areaCity;
TSalaryEmployee oldEmp;
......@@ -498,6 +588,42 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
// }
// }
}
if (Common.isNotNull(employee.getEmpPhone())) {
// 手机号本表重复,该条直接不给导入
if (phoneRepeatMap.get(employee.getEmpPhone()) != null) {
errorList.add(new ErrorMessage((employee.getLineNums()), "第" + (employee.getLineNums()) + "行:该员工更新失败:【该手机号在本次导入表中有重复,请检查并修改后重新导入】"));
isFalse = true;
continue;
}
// 手机号与系统里重复
phoneIdCardList = empPhoneMap.get(employee.getEmpPhone());
if (phoneIdCardList != null) {
phoneFlag = false;
for (String phoneIdCard : phoneIdCardList) {
if (!phoneIdCard.equals(employee.getEmpIdcard())) {
phoneFlag = true;
break;
}
}
if (phoneFlag) {
errorList.add(new ErrorMessage((employee.getLineNums()), "第" + (employee.getLineNums()) + "行:该员工更新失败:【手机号已被占用,请更改手机号后重试】"));
isFalse = true;
continue;
}
}
// 手机号校验
if (phoneMap.get(employee.getEmpPhone()) != null) {
if (Boolean.FALSE.equals(phoneMap.get(employee.getEmpPhone()))) {
errorList.add(new ErrorMessage((employee.getLineNums()), "第" + (employee.getLineNums()) + "行:该员工更新失败:【手机号校验不通过,请更改手机号后重试!】"));
isFalse = true;
}
} else {
errorList.add(new ErrorMessage((employee.getLineNums()), "第" + (employee.getLineNums()) + "行:该员工更新失败:【手机号验证:" + SalaryConstants.CHECK_NO_RESPONSE + "】"));
isFalse = true;
}
}
}
if (isFalse) {
return null;
......@@ -750,18 +876,7 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
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;
// 开户行省市的区域暂存
......@@ -781,7 +896,9 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
bankCheckMap = checkListR.getData().getCheckMap();
}
}
// 系统已有人员手机号Map
Map<String, List<String>> empPhoneMap = new HashMap<>();
List<String> phoneIdCardList;
Map<String, Boolean> phoneCheckMap = new HashMap<>();
if (!phoneList.isEmpty()) {
R<CheckBatchVo> phoneR = HttpDaprUtil.invokeMethodPost(checkProperties.getAppUrl(), checkProperties.getAppId()
......@@ -789,6 +906,15 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
if (phoneR != null && phoneR.getData() != null) {
phoneCheckMap = phoneR.getData().getCheckMap();
}
List<TSalaryEmployee> empPhoneList = baseMapper.getListByPhone(phoneList);
for (TSalaryEmployee e : empPhoneList) {
phoneIdCardList = empPhoneMap.get(e.getEmpPhone());
if (phoneIdCardList == null) {
phoneIdCardList = new ArrayList<>();
}
phoneIdCardList.add(e.getEmpIdcard());
empPhoneMap.put(e.getEmpPhone(), phoneIdCardList);
}
}
for (int i = 0; i < excelVOList.size(); i++) {
excel = excelVOList.get(i);
......
......@@ -830,6 +830,10 @@ public class SalaryAccountUtil implements Serializable {
String areaInt = ExcelUtil.getRedisAreaValue(CacheConstants.AREA_VALUE + emp.getBankProvince().trim());
if (Common.isNotNull(areaInt)) {
entity.setBankProvince(areaInt);
} else {
error = "第" + i + SalaryConstants.LINE_EMP + emp.getEmpIdcard() + "-开户行省错误,请在工资模板正确填写!";
errorList.add(new ErrorMessage(i, error));
return true;
}
String areaCityInt = null;
if (Common.isNotNull(emp.getBankCity())) {
......@@ -837,6 +841,10 @@ public class SalaryAccountUtil implements Serializable {
+ CommonConstants.DOWN_LINE_STRING + emp.getBankProvince().trim());
if (Common.isNotNull(areaCityInt)) {
entity.setBankCity(areaCityInt);
} else {
error = "第" + i + SalaryConstants.LINE_EMP + emp.getEmpIdcard() + "-开户行市错误或开户行市不在开户行省内,请在工资模板正确填写!";
errorList.add(new ErrorMessage(i, error));
return true;
}
}
}
......
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