导入校验

master
OathK1per 2022-09-07 16:40:04 +08:00
parent edf92a4de8
commit 765091e18b
1 changed files with 62 additions and 44 deletions

View File

@ -979,7 +979,7 @@ public class ProjectBudgetService {
return msg;
}
private void saveIncomeTemp(Map m, Integer id, List<ProjectBudgetIncomeDetailTemp> incomeDetailTempList) {
private void saveIncomeTemp(Map m, Integer id, List<ProjectBudgetIncomeDetailTemp> incomeDetailTempList) throws Exception {
ProjectBudgetIncomeDetailTemp temp = new ProjectBudgetIncomeDetailTemp();
String key;
Object o1;
@ -993,6 +993,8 @@ public class ProjectBudgetService {
temp.setType(2);
} else if ("服务类".equals(type)) {
temp.setType(3);
} else {
throw new Exception("该类别不存在");
}
key = "名称";
o1 = m.get(key);
@ -1000,20 +1002,24 @@ public class ProjectBudgetService {
key = "单位";
o1 = m.get(key);
temp.setUnit((String) o1);
key = "数量";
o1 = m.get(key);
if (o1 != null) {
temp.setAmount(Integer.parseInt((String) o1));
}
key = "单价";
o1 = m.get(key);
if (o1 != null) {
temp.setPrice(new BigDecimal((String) o1));
}
key = "税率(%)";
o1 = m.get(key);
if (o1 != null) {
temp.setTaxRate(new BigDecimal((String) o1));
try {
key = "数量";
o1 = m.get(key);
if (o1 != null) {
temp.setAmount(Integer.parseInt((String) o1));
}
key = "单价";
o1 = m.get(key);
if (o1 != null) {
temp.setPrice(new BigDecimal((String) o1));
}
key = "税率(%)";
o1 = m.get(key);
if (o1 != null) {
temp.setTaxRate(new BigDecimal((String) o1));
}
} catch (Exception e) {
throw new Exception("数量、单价、税率需为数字");
}
incomeDetailTempList.add(temp);
}
@ -1048,7 +1054,7 @@ public class ProjectBudgetService {
return msg;
}
private void saveCostTemp(Map m, Integer id, List<ProjectBudgetCostDetailTemp> costDetailTempList) {
private void saveCostTemp(Map m, Integer id, List<ProjectBudgetCostDetailTemp> costDetailTempList) throws Exception {
ProjectBudgetCostDetailTemp temp = new ProjectBudgetCostDetailTemp();
String key;
Object o1;
@ -1064,6 +1070,8 @@ public class ProjectBudgetService {
temp.setType(3);
} else if ("其他".equals(type)) {
temp.setType(4);
} else {
throw new Exception("该大类不存在");
}
key = "类别";
o1 = m.get(key);
@ -1071,6 +1079,8 @@ public class ProjectBudgetService {
ProcurementType procurementType = procurementTypeRepository.findByName(category);
if (procurementType != null && procurementType.getType() == temp.getType()) {
temp.setCategory(procurementType.getId());
} else {
throw new Exception("该类别不存在或者与大类不匹配");
}
key = "名称";
o1 = m.get(key);
@ -1078,21 +1088,6 @@ public class ProjectBudgetService {
key = "单位";
o1 = m.get(key);
temp.setUnit((String) o1);
key = "数量";
o1 = m.get(key);
if (o1 != null) {
temp.setAmount(Integer.parseInt((String) o1));
}
key = "单价";
o1 = m.get(key);
if (o1 != null) {
temp.setPrice(new BigDecimal((String) o1));
}
key = "税率(%)";
o1 = m.get(key);
if (o1 != null) {
temp.setTaxRate(new BigDecimal((String) o1));
}
key = "签约方";
o1 = m.get(key);
temp.setContractParty((String) o1);
@ -1106,20 +1101,43 @@ public class ProjectBudgetService {
} else {
temp.setIsUnderwritten(0);
}
key = "预估垫资金额(元)";
o1 = m.get(key);
if (o1 != null) {
temp.setUnderwrittenAmount(new BigDecimal((String) o1));
try {
key = "数量";
o1 = m.get(key);
if (o1 != null) {
temp.setAmount(Integer.parseInt((String) o1));
}
key = "单价";
o1 = m.get(key);
if (o1 != null) {
temp.setPrice(new BigDecimal((String) o1));
}
key = "税率(%)";
o1 = m.get(key);
if (o1 != null) {
temp.setTaxRate(new BigDecimal((String) o1));
}
key = "预估垫资金额(元)";
o1 = m.get(key);
if (o1 != null) {
temp.setUnderwrittenAmount(new BigDecimal((String) o1));
}
key = "支出金额(元)";
o1 = m.get(key);
if (o1 != null) {
temp.setPayAmount(new BigDecimal((String) o1));
}
} catch (Exception e) {
throw new Exception("数量、单价、税率、预估垫资金额和支出金额需为数字");
}
key = "支出时间";
o1 = m.get(key);
if (o1 != null) {
temp.setPayTime(DateKit.getDate((String) o1, DateKit.DATE_FORMAT));
}
key = "支出金额(元)";
o1 = m.get(key);
if (o1 != null) {
temp.setPayAmount(new BigDecimal((String) o1));
try {
key = "支出时间";
o1 = m.get(key);
if (o1 != null) {
temp.setPayTime(DateKit.getDate((String) o1, DateKit.DATE_FORMAT));
}
} catch (Exception e) {
throw new Exception("支出时间需为时间格式yyyy-MM-dd");
}
key = "付款方式";
o1 = m.get(key);