Commit 95a34de3 authored by hongguangwu's avatar hongguangwu

MVP1.5-薪资导入优化

parent b42cb475
...@@ -135,7 +135,7 @@ public class SalaryAccountUtil implements Serializable { ...@@ -135,7 +135,7 @@ public class SalaryAccountUtil implements Serializable {
// 连接查询的数据集合 // 连接查询的数据集合
List<TSalaryEmployee> updateEmpList = new ArrayList<>(); List<TSalaryEmployee> updateEmpList = new ArrayList<>();
List<TSalaryEmployee> checkBankInfoEmpList = new ArrayList<>(); List<TSalaryEmployee> checkBankInfoEmpList = new ArrayList<>();
Map<Integer, TSalaryEmployee> newEmpMap = new HashMap<>(); List<TSalaryEmployee> newEmpList = new ArrayList<>();
Map<String, TSalaryAccountVo> entityMap = new HashMap<>(); Map<String, TSalaryAccountVo> entityMap = new HashMap<>();
List<String> otherIdCard = new ArrayList<>(); List<String> otherIdCard = new ArrayList<>();
for (int i = 0; i < rows; i++) { for (int i = 0; i < rows; i++) {
...@@ -396,7 +396,7 @@ public class SalaryAccountUtil implements Serializable { ...@@ -396,7 +396,7 @@ public class SalaryAccountUtil implements Serializable {
emp.setLineNums(i); emp.setLineNums(i);
} }
} else if (emp == null) { } else if (emp == null) {
newEmpMap.put((i + 2), newEmp); newEmpList.add(newEmp);
entityMap.put(newEmp.getEmpIdcard(), entity); entityMap.put(newEmp.getEmpIdcard(), entity);
otherIdCard.add(newEmp.getEmpIdcard()); otherIdCard.add(newEmp.getEmpIdcard());
} }
...@@ -461,25 +461,29 @@ public class SalaryAccountUtil implements Serializable { ...@@ -461,25 +461,29 @@ public class SalaryAccountUtil implements Serializable {
TSalaryEmployee otherEmp; TSalaryEmployee otherEmp;
List<TSalaryEmployee> saveNewEmpList = new ArrayList<>(); List<TSalaryEmployee> saveNewEmpList = new ArrayList<>();
List<String> checkTaxMonthList = new ArrayList<>(); List<String> checkTaxMonthList = new ArrayList<>();
for (Map.Entry<Integer, TSalaryEmployee> newEmps : newEmpMap.entrySet()) { if (!newEmpList.isEmpty()) {
TSalaryEmployee newEmps;
entity = entityMap.get(newEmps.getValue().getEmpIdcard()); for (int i = 0; i < newEmpList.size(); i++) {
newEmps = newEmpList.get(i);
entity = entityMap.get(newEmps.getEmpIdcard());
// 先按照身份证查询 // 先按照身份证查询
otherEmp = otherEmpMap.get(newEmps.getValue().getEmpIdcard()); otherEmp = otherEmpMap.get(newEmps.getEmpIdcard());
if (otherEmp == null) { if (otherEmp == null) {
if (CommonConstants.ONE_STRING.equals(entity.getIsNewEmployee())) { if (CommonConstants.ONE_STRING.equals(entity.getIsNewEmployee())) {
this.setNewEmpBase(newEmps.getValue(), newEmps.getKey() - 2, errorList, notLabour if (!this.setNewEmpBase(newEmps, newEmps.getLineNums(), errorList, notLabour
, entity, salaryType, dept, user, entity.getSalaryStyle() , entity, salaryType, dept, user, entity.getSalaryStyle()
, CommonConstants.ZERO_STRING.equals(entity.getSalaryGiveTime()), invoiceTitle); , CommonConstants.ZERO_STRING.equals(entity.getSalaryGiveTime()), invoiceTitle)) {
saveNewEmpList.add(newEmps.getValue()); continue;
checkTaxMonthList.add(newEmps.getValue().getEmpIdcard()); }
saveNewEmpList.add(newEmps);
checkTaxMonthList.add(newEmps.getEmpIdcard());
} else { } else {
if ("4".equals(salaryType)) { if ("4".equals(salaryType)) {
error = "第" + newEmps.getKey() + "行:薪酬人员查询菜单无此员工,请添加<是否新员工(默认否)>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、手机号码!"; error = "第" + (newEmps.getLineNums() + 2) + "行:薪酬人员查询菜单无此员工,请添加<是否新员工(默认否)>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、手机号码!";
errorList.add(new ErrorMessage(newEmps.getKey(), error)); errorList.add(new ErrorMessage(newEmps.getLineNums() + 2, error));
} else if (notLabour) { } else if (notLabour) {
error = "第" + newEmps.getKey() + "行:薪酬人员查询菜单无此员工,请添加<是否新员工(默认否)>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、计税月份、手机号码!"; error = "第" + (newEmps.getLineNums() + 2) + "行:薪酬人员查询菜单无此员工,请添加<是否新员工(默认否)>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、计税月份、手机号码!";
errorList.add(new ErrorMessage(newEmps.getKey(), error)); errorList.add(new ErrorMessage(newEmps.getLineNums() + 2, error));
} }
} }
} else { } else {
...@@ -489,14 +493,18 @@ public class SalaryAccountUtil implements Serializable { ...@@ -489,14 +493,18 @@ public class SalaryAccountUtil implements Serializable {
, CommonConstants.ZERO_STRING.equals(entity.getSalaryGiveTime()) , CommonConstants.ZERO_STRING.equals(entity.getSalaryGiveTime())
, CommonConstants.ONE_STRING.equals(entity.getIsNewEmployee()) , CommonConstants.ONE_STRING.equals(entity.getIsNewEmployee())
, otherEmp.getEmpName(), entity.getSalaryStyle() , otherEmp.getEmpName(), entity.getSalaryStyle()
, nowMonth, updateEmpList, checkBankInfoEmpList, newEmps.getKey() - 2)) return; , nowMonth, updateEmpList, checkBankInfoEmpList, newEmps.getLineNums())) return;
}
} }
} }
int nowYear = Integer.parseInt(nowMonth.substring(0, 4)); int nowYear = Integer.parseInt(nowMonth.substring(0, 4));
Map<String, String> minTaxMonthMap = tSalaryAccountService.getMinTaxMonthByNowYearAndList(checkTaxMonthList, nowYear); Map<String, String> minTaxMonthMap = tSalaryAccountService.getMinTaxMonthByNowYearAndList(checkTaxMonthList, nowYear);
String minTaxMonth; String minTaxMonth;
boolean canSave = true; boolean canSave = true;
for (TSalaryEmployee saveNewEmp : saveNewEmpList) { if (!saveNewEmpList.isEmpty()) {
TSalaryEmployee saveNewEmp;
for (int i = 0; i < saveNewEmpList.size(); i++) {
saveNewEmp = saveNewEmpList.get(i);
// 新员工校验计税月 // 新员工校验计税月
if (!"3".equals(salaryType) && !"4".equals(salaryType)) { if (!"3".equals(salaryType) && !"4".equals(salaryType)) {
entity = entityMap.get(saveNewEmp.getEmpIdcard()); entity = entityMap.get(saveNewEmp.getEmpIdcard());
...@@ -509,6 +517,7 @@ public class SalaryAccountUtil implements Serializable { ...@@ -509,6 +517,7 @@ public class SalaryAccountUtil implements Serializable {
} }
} }
} }
}
if (canSave) { if (canSave) {
// 新增 // 新增
tSalaryEmployeeService.saveNewEmployeeList(saveNewEmpList, errorList); tSalaryEmployeeService.saveNewEmployeeList(saveNewEmpList, errorList);
......
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