|
@@ -56,7 +56,7 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
|
|
|
List<FinancialExpenditure> financialExpenditures = new ArrayList<>();
|
|
|
Map<String, Integer> organMap = getMap("organization", "name_", "id_", true, String.class, Integer.class);
|
|
|
Map<String, Integer> cooperationOrganMap = getMap("cooperation_organ", "name_", "id_", true, String.class, Integer.class);
|
|
|
-// Map<String, Integer> phoneMap = getMap("sys_user", "phone_", "id_", true, String.class, Integer.class);
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
for (String e : sheetsListMap.keySet()) {
|
|
|
List<Map<String, Object>> sheet = sheetsListMap.get(e);
|
|
|
List<Object> collect = sheet.stream().map(m -> m.get("钉钉流程编号")).collect(Collectors.toList());
|
|
@@ -68,9 +68,10 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
|
|
|
throw new BizException("导入数据错误 重复的钉钉流程编号:{}",list.get(0));
|
|
|
}
|
|
|
|
|
|
- valueIsNull: for (Map<String, Object> row : sheet) {
|
|
|
-
|
|
|
- if (row.size() == 0){
|
|
|
+ valueIsNull: for (int j = 0; j < sheet.size(); j++) {
|
|
|
+ int rowNum = j + 2;
|
|
|
+ Map<String, Object> row = sheet.get(j);
|
|
|
+ if (row.size() == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
JSONObject objectMap = new JSONObject();
|
|
@@ -89,9 +90,11 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
|
|
|
continue;
|
|
|
}
|
|
|
if (columnValue.equals("dingtalkProcessNo")) {
|
|
|
- if(StringUtils.isEmpty(row.get(s).toString())){
|
|
|
- LOGGER.error("支出记录导入异常:钉钉流程编号不可为空 param:{}",objectMap);
|
|
|
+ if (StringUtils.isEmpty(row.get(s).toString())) {
|
|
|
+ sb.append("第" + rowNum).append("行数据导入失败:钉钉流程编号不可为空;");
|
|
|
continue valueIsNull;
|
|
|
+ } else {
|
|
|
+ objectMap.put("incomeType", row.get(s));
|
|
|
}
|
|
|
}
|
|
|
if (columnValue.equals("feeProject")) {
|
|
@@ -105,7 +108,7 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
|
|
|
}
|
|
|
if (columnValue.equals("amount")) {
|
|
|
if(StringUtils.isEmpty(row.get(s).toString())){
|
|
|
- LOGGER.error("支出记录导入异常:费用不可为空 param:{}",objectMap);
|
|
|
+ sb.append("第" + rowNum).append("行数据导入失败:费用不可为空;");
|
|
|
continue valueIsNull;
|
|
|
}else {
|
|
|
objectMap.put("amount", row.get(s));
|
|
@@ -115,7 +118,7 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
|
|
|
if (columnValue.equals("organName") && StringUtils.isNotEmpty(row.get(s).toString())) {
|
|
|
Integer integer = organMap.get(row.get(s));
|
|
|
if(integer == null){
|
|
|
- LOGGER.error("支出记录导入异常:分部校验失败 param:{}",objectMap);
|
|
|
+ sb.append("第" + rowNum).append("行数据导入失败:分部校验失败;");
|
|
|
continue valueIsNull;
|
|
|
}else {
|
|
|
objectMap.put("organId", integer);
|
|
@@ -125,7 +128,8 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
|
|
|
if (columnValue.equals("cooperationOrganName") && StringUtils.isNotEmpty(row.get(s).toString())) {
|
|
|
Integer integer = cooperationOrganMap.get(row.get(s));
|
|
|
if(integer == null){
|
|
|
- LOGGER.error("支出记录导入异常:合作单位校验失败 param:{}",objectMap);
|
|
|
+ sb.append("第" + rowNum).append("行数据导入失败:合作单位校验失败;");
|
|
|
+ continue valueIsNull;
|
|
|
}else {
|
|
|
objectMap.put("cooperationOrganId", integer);
|
|
|
}
|
|
@@ -154,6 +158,9 @@ public class FinancialExpenditureServiceImpl extends BaseServiceImpl<Long, Finan
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if(sb.length() > 0){
|
|
|
+ throw new BizException(sb.toString());
|
|
|
+ }
|
|
|
if(financialExpenditures.size() != 0){
|
|
|
financialExpenditureDao.batchInsert(financialExpenditures);
|
|
|
}
|