Commit 3ed31d95 authored by hongguangwu's avatar hongguangwu

errorFlag = false;

parent d8a7dca0
......@@ -123,8 +123,11 @@ public class SalaryAccountUtil implements Serializable {
String areaStr;
// 员工新建保存的反馈,null 保存成功,其他,保存失败,反馈原因
String saveNewEmpReturn;
// 每一行是否有错误 true : 无错误
boolean errorFlag;
for (int i = 0; i < rows; i++) {
error = "";
errorFlag = true;
temp = list.get(i);
entity = new TSalaryAccountVo();
emp = null;
......@@ -144,6 +147,7 @@ public class SalaryAccountUtil implements Serializable {
if (cellValueObj != null && scs != null) {
cellValueStr = getStringValByObject(cellValueObj);
if (!StringUtils.isNotBlank(cellValueStr)) {
errorFlag = false;
error = "第" + (i + 2) + "行:" + entry.getKey() + "列_不识别对象类型";
errorList.add(new ErrorMessage((i + 2), error));
continue;
......@@ -165,6 +169,7 @@ public class SalaryAccountUtil implements Serializable {
sai.setSalaryMoney(relaySalary);
saiList.add(sai);
} catch (Exception e) {
errorFlag = false;
error = "第" + (i + 2) + "行:应发工资:'" + cellValueStr + "'错误,请检查数据";
errorList.add(new ErrorMessage((i + 2), error));
continue;
......@@ -175,6 +180,7 @@ public class SalaryAccountUtil implements Serializable {
actualSalarySum = new BigDecimal(cellValueStr);
entity.setActualSalary(actualSalarySum);
} catch (Exception e) {
errorFlag = false;
error = "第" + (i + 2) + "行:实发工资:'" + cellValueStr + "'错误,请检查数据";
errorList.add(new ErrorMessage((i + 2), error));
continue;
......@@ -185,6 +191,7 @@ public class SalaryAccountUtil implements Serializable {
try {
new BigDecimal(cellValueStr);
} catch (Exception ex) {
errorFlag = false;
error = "第" + (i + 2) + "行:个人、单位代扣,只能是金额!";
errorList.add(new ErrorMessage((i + 2), error));
continue;
......@@ -205,6 +212,7 @@ public class SalaryAccountUtil implements Serializable {
if (checkIdNumberMap.get(cellValueStr) == null) {
checkIdNumberMap.put(cellValueStr, (i + 2));
} else {
errorFlag = false;
error = "第" + (i + 2) + "行与第:" + checkIdNumberMap.get(cellValueStr) + "行身份证重复:" + cellValueStr;
errorList.add(new ErrorMessage((i + 2), error));
break;
......@@ -239,7 +247,6 @@ public class SalaryAccountUtil implements Serializable {
}
} catch (NumberFormatException e) {
sai.setTextValue(cellValueStr);
//非数字,不保存
}
saiList.add(sai);
} else {
......@@ -251,6 +258,7 @@ public class SalaryAccountUtil implements Serializable {
setFields(field, cellValueStr, attr, fieldType, entity);
error = validateUtil(cellValueStr, attr, (i + 2));
if (null != error) {
errorFlag = false;
errorList.add(new ErrorMessage((i + 2), error));
continue;
}
......@@ -268,17 +276,20 @@ public class SalaryAccountUtil implements Serializable {
}
}
if (Common.isNotNull(must)) {
errorFlag = false;
error = "第" + (i + 2) + "行:" + must + "列_不可缺少";
errorList.add(new ErrorMessage((i + 2), error));
continue;
}
if ("3".equals(salaryType) && actualSalarySum == null) {
errorFlag = false;
error = "第" + (i + 2) + "行:【实发劳务费】列_不可缺少";
errorList.add(new ErrorMessage((i + 2), error));
continue;
}
if ("4".equals(salaryType) && actualSalarySum == null) {
errorFlag = false;
error = "第" + (i + 2) + "行:【稿酬】列_不可缺少";
errorList.add(new ErrorMessage((i + 2), error));
continue;
......@@ -286,6 +297,7 @@ public class SalaryAccountUtil implements Serializable {
// 应发、实发、实发劳务费不可都为空
if (relaySalary == null && actualSalarySum == null) {
errorFlag = false;
error = "第" + (i + 2) + "行:【应发工资】列_不可缺少";
errorList.add(new ErrorMessage((i + 2), error));
continue;
......@@ -308,7 +320,7 @@ public class SalaryAccountUtil implements Serializable {
if (Common.isNotNull(checkListY) && checkListY.contains(entity.getEmpIdcard())) {
entity.setHaveSalaryFlag(CommonConstants.ONE_INT);
}
if (!Common.isNotNull(errorList)) {
if (errorFlag) {
if (Common.isNotNull(entity.getSalaryStyle())) {
salaryStyle = entity.getSalaryStyle();
} else if (configSalary.getGrantType() != null) {
......
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