Commit 95a34de3 authored by hongguangwu's avatar hongguangwu

MVP1.5-薪资导入优化

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