Commit ed66d6b8 authored by hongguangwu's avatar hongguangwu

MVP1.7.14-手机号导入校验

parent efa04039
......@@ -48,6 +48,7 @@ public interface TSalaryEmployeeMapper extends BaseMapper<TSalaryEmployee> {
List<TSalaryEmployeeExportVo> noPageDiy( @Param("tSalaryEmployee") TSalaryEmployeeSearchVo searchVo, @Param("idList")List<String> idList);
List<TSalaryEmployee> getListByIdCard(@Param("idCardList") List<String> idCardList);
List<TSalaryEmployee> getListByPhone(@Param("phoneList") List<String> phoneList);
TSalaryEmployee getByEmpIdCard(@Param("empIdCard") String empIdCard);
......
......@@ -903,15 +903,46 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
List<String> idCardList = new ArrayList<>();
// 执行数据插入操作 组装
List<TSalaryEmployee> excelVOList = vo.getEmpList();
// 查重,查非自己的手机号是否存在
List<String> phoneList = new ArrayList<>();
// 查本表重
Map<String, Integer> phoneMap = new HashMap<>();
// 本表重复的手机号,不允许导入该行
Map<String, Integer> phoneRepeatMap = new HashMap<>();
Integer phoneCount;
for (TSalaryEmployee emp : excelVOList) {
idCardList.add(emp.getEmpIdcard());
if (Common.isNotNull(emp.getEmpPhone())) {
phoneCount = phoneMap.get(emp.getEmpPhone());
if (phoneCount == null) {
phoneMap.put(emp.getEmpPhone(), CommonConstants.ONE_INT);
phoneList.add(emp.getEmpPhone());
} else {
phoneRepeatMap.put(emp.getEmpPhone(), CommonConstants.ONE_INT);
}
}
}
List<TSalaryEmployee> empList = baseMapper.getListByIdCard(idCardList);
// 人员Map
Map<String, TSalaryEmployee> empMap = new HashMap<>();
for (TSalaryEmployee e : empList) {
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;
// 开户行省市的区域暂存
String areaProvince;
......@@ -930,11 +961,36 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
List<TCheckBankNo> bankList = new ArrayList<>();
TCheckBankNo checkBankNo;
String idCard;
boolean phoneFlag;
for (int i = 0; i < excelVOList.size(); i++) {
excel = excelVOList.get(i);
if (excel != null) {
if (Common.isNotNull(excel.getEmpIdcard())) {
emp = empMap.get(excel.getEmpIdcard());
idCard = 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);
if (Common.isNotNull(emp)) {
if (canUpdate) {
curTaxMonth = false;
......@@ -1019,7 +1075,7 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
}
} else {
// 新增人员
if (Common.isEmpty(excel.getEmpName()) || Common.isEmpty(excel.getEmpIdcard())
if (Common.isEmpty(excel.getEmpName()) || Common.isEmpty(idCard)
|| Common.isEmpty(excel.getEmpPhone()) || Common.isEmpty(excel.getBankName())
|| Common.isEmpty(excel.getBankNo()) || Common.isEmpty(excel.getBankProvince())
|| Common.isEmpty(excel.getBankCity()) || Common.isEmpty(excel.getTaxMonth())) {
......@@ -1087,8 +1143,16 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
errorMessageList.add(new ErrorMessage(CommonConstants.ZERO_INT, SalaryConstants.DATA_MUST));
}
}
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();
}
}
if (bankList != null && !bankList.isEmpty()) {
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) {
......@@ -1096,13 +1160,23 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
}
}
boolean isCanSave;
if (!updateList.isEmpty()) {
List<TSalaryEmployee> newUpdateList = new ArrayList<>();
for (TSalaryEmployee employee : updateList) {
if (bankCheckMap.get(employee.getBankNo()) != null && Boolean.FALSE.equals(bankCheckMap.get(employee.getBankNo()))) {
isCanSave = true;
if (Common.isNotNull(employee.getBankNo()) && bankCheckMap.get(employee.getBankNo()) != null && Boolean.FALSE.equals(bankCheckMap.get(employee.getBankNo()))) {
errorMessageList.add(new ErrorMessage(employee.getLineNums(), "第" + employee.getLineNums()
+ "行:-上次代发户未校验【姓名与卡号】,本次校验结果:不匹配。请去薪酬人员查询处更新卡号信息!!"));
} else {
isCanSave = false;
}
if (Common.isNotNull(employee.getEmpPhone()) && phoneCheckMap.get(employee.getEmpPhone()) != null
&& Boolean.FALSE.equals(phoneCheckMap.get(employee.getEmpPhone()))) {
errorMessageList.add(new ErrorMessage(employee.getLineNums(), "第" + employee.getLineNums()
+ "行:手机号校验不通过,请更改手机号后重试"));
isCanSave = false;
}
if (isCanSave) {
employee.setIssueStatus(CommonConstants.ZERO_INT);
employee.setLineNums(null);
newUpdateList.add(employee);
......@@ -1114,10 +1188,19 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
if (!saveList.isEmpty()) {
List<TSalaryEmployee> newSaveList = new ArrayList<>();
for (TSalaryEmployee employee : saveList) {
if (bankCheckMap.get(employee.getBankNo()) != null && Boolean.FALSE.equals(bankCheckMap.get(employee.getBankNo()))) {
isCanSave = true;
if (Common.isNotNull(employee.getBankNo()) && bankCheckMap.get(employee.getBankNo()) != null && Boolean.FALSE.equals(bankCheckMap.get(employee.getBankNo()))) {
errorMessageList.add(new ErrorMessage(employee.getLineNums(), "第" + employee.getLineNums()
+ "行:-上次代发户未校验【姓名与卡号】,本次校验结果:不匹配。请去薪酬人员查询处更新卡号信息!!!"));
} else {
isCanSave = false;
}
if (Common.isNotNull(employee.getEmpPhone()) && phoneCheckMap.get(employee.getEmpPhone()) != null
&& Boolean.FALSE.equals(phoneCheckMap.get(employee.getEmpPhone()))) {
errorMessageList.add(new ErrorMessage(employee.getLineNums(), "第" + employee.getLineNums()
+ "行:手机号校验不通过,请更改手机号后重试!"));
isCanSave = false;
}
if (isCanSave) {
employee.setIssueStatus(CommonConstants.ZERO_INT);
employee.setLineNums(null);
newSaveList.add(employee);
......
......@@ -256,6 +256,19 @@
</if>
</select>
<!-- 按手机号查询全部人员 -->
<select id="getListByPhone" resultMap="tSalaryEmployeeMap" >
<if test="phoneList != null and phoneList.size>0">
SELECT
<include refid="Base_Column_List"/>
FROM t_salary_employee a
where a.EMP_PHONE in
<foreach item="idStr" index="index" collection="phoneList" open="(" separator="," close=")">
#{idStr}
</foreach>
</if>
</select>
<!-- 按身份证查询人员 -->
<select id="getByEmpIdCard" resultMap="tSalaryEmployeeMap" >
SELECT
......
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