导入校验

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