Commit 3ed31d95 authored by hongguangwu's avatar hongguangwu

errorFlag = false;

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