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,51 +461,60 @@ public class SalaryAccountUtil implements Serializable { ...@@ -461,51 +461,60 @@ 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);
otherEmp = otherEmpMap.get(newEmps.getValue().getEmpIdcard()); entity = entityMap.get(newEmps.getEmpIdcard());
if (otherEmp == null) { // 先按照身份证查询
if (CommonConstants.ONE_STRING.equals(entity.getIsNewEmployee())) { otherEmp = otherEmpMap.get(newEmps.getEmpIdcard());
this.setNewEmpBase(newEmps.getValue(), newEmps.getKey() - 2, errorList, notLabour if (otherEmp == null) {
, entity, salaryType, dept, user, entity.getSalaryStyle() if (CommonConstants.ONE_STRING.equals(entity.getIsNewEmployee())) {
, CommonConstants.ZERO_STRING.equals(entity.getSalaryGiveTime()), invoiceTitle); if (!this.setNewEmpBase(newEmps, newEmps.getLineNums(), errorList, notLabour
saveNewEmpList.add(newEmps.getValue()); , entity, salaryType, dept, user, entity.getSalaryStyle()
checkTaxMonthList.add(newEmps.getValue().getEmpIdcard()); , CommonConstants.ZERO_STRING.equals(entity.getSalaryGiveTime()), invoiceTitle)) {
} else { continue;
if ("4".equals(salaryType)) { }
error = "第" + newEmps.getKey() + "行:薪酬人员查询菜单无此员工,请添加<是否新员工(默认否)>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、手机号码!"; saveNewEmpList.add(newEmps);
errorList.add(new ErrorMessage(newEmps.getKey(), error)); checkTaxMonthList.add(newEmps.getEmpIdcard());
} else if (notLabour) { } else {
error = "第" + newEmps.getKey() + "行:薪酬人员查询菜单无此员工,请添加<是否新员工(默认否)>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、计税月份、手机号码!"; if ("4".equals(salaryType)) {
errorList.add(new ErrorMessage(newEmps.getKey(), error)); error = "第" + (newEmps.getLineNums() + 2) + "行:薪酬人员查询菜单无此员工,请添加<是否新员工(默认否)>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、手机号码!";
errorList.add(new ErrorMessage(newEmps.getLineNums() + 2, error));
} else if (notLabour) {
error = "第" + (newEmps.getLineNums() + 2) + "行:薪酬人员查询菜单无此员工,请添加<是否新员工(默认否)>列,并录入身份证号、开户行总行、开户行省、开户行市、银行卡号、计税月份、手机号码!";
errorList.add(new ErrorMessage(newEmps.getLineNums() + 2, error));
}
} }
} else {
// 使用emp信息
if (setEntityByEmpInfo(dept, ownEmployeeMap, ownDeptMap, salaryType, isIssue, errorList
, entity, otherEmp, entity.getSaiList()
, CommonConstants.ZERO_STRING.equals(entity.getSalaryGiveTime())
, CommonConstants.ONE_STRING.equals(entity.getIsNewEmployee())
, otherEmp.getEmpName(), entity.getSalaryStyle()
, nowMonth, updateEmpList, checkBankInfoEmpList, newEmps.getLineNums())) return;
} }
} else {
// 使用emp信息
if (setEntityByEmpInfo(dept, ownEmployeeMap, ownDeptMap, salaryType, isIssue, errorList
, entity, otherEmp, entity.getSaiList()
, CommonConstants.ZERO_STRING.equals(entity.getSalaryGiveTime())
, CommonConstants.ONE_STRING.equals(entity.getIsNewEmployee())
, otherEmp.getEmpName(), entity.getSalaryStyle()
, nowMonth, updateEmpList, checkBankInfoEmpList, newEmps.getKey() - 2)) 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;
if (!"3".equals(salaryType) && !"4".equals(salaryType)) { for (int i = 0; i < saveNewEmpList.size(); i++) {
entity = entityMap.get(saveNewEmp.getEmpIdcard()); saveNewEmp = saveNewEmpList.get(i);
minTaxMonth = minTaxMonthMap.get(saveNewEmp.getEmpIdcard()); // 新员工校验计税月
if (Common.isNotNull(minTaxMonth) if (!"3".equals(salaryType) && !"4".equals(salaryType)) {
&& !minTaxMonth.equals(entity.getTaxMonth())) { entity = entityMap.get(saveNewEmp.getEmpIdcard());
error = "第" + (saveNewEmp.getLineNums() + 2) + "行:该员工已有发薪记录,计税月份请填写:【" + minTaxMonth + "】" + ",你填写了计税月:【" + entity.getTaxMonth() + "】"; minTaxMonth = minTaxMonthMap.get(saveNewEmp.getEmpIdcard());
errorList.add(new ErrorMessage((saveNewEmp.getLineNums() + 2), error)); if (Common.isNotNull(minTaxMonth)
canSave = false; && !minTaxMonth.equals(entity.getTaxMonth())) {
error = "第" + (saveNewEmp.getLineNums() + 2) + "行:该员工已有发薪记录,计税月份请填写:【" + minTaxMonth + "】" + ",你填写了计税月:【" + entity.getTaxMonth() + "】";
errorList.add(new ErrorMessage((saveNewEmp.getLineNums() + 2), error));
canSave = false;
}
} }
} }
} }
......
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