|
|
@@ -751,6 +751,9 @@ public class WbsTreeContractController extends BladeController {
|
|
|
// 读取临时文件作为输入流,调用单表单导入逻辑
|
|
|
tempInputStream = new FileInputStream(tempFile);
|
|
|
Map<String, Object> sheetResult = processSingleSheetImport(pkeyId, tempInputStream);
|
|
|
+ if(sheetResult.isEmpty()){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
Map<String, String> dataMap = getDataMap(sheetResult);
|
|
|
String delSql = "delete from " + matchedContract.getInitTableName() + " where p_key_id=" + matchedContract.getPKeyId();
|
|
|
dataMap.put("p_key_id", matchedContract.getPKeyId()+"");
|
|
|
@@ -758,6 +761,7 @@ public class WbsTreeContractController extends BladeController {
|
|
|
jdbcTemplate.execute(delSql);
|
|
|
jdbcTemplate.execute(sqlInfo);
|
|
|
} catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
throw new ServiceException("处理sheet[" + sheetName + "]失败:" + e.getMessage());
|
|
|
} finally {
|
|
|
// 关闭流并删除临时文件
|
|
|
@@ -1009,18 +1013,6 @@ public class WbsTreeContractController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- // 排序结果(复用原逻辑)
|
|
|
- if (!resultMap.isEmpty()) {
|
|
|
- List<Map.Entry<String, Object>> entryList = new ArrayList<>(resultMap.entrySet());
|
|
|
- entryList.sort(new KeyComparator());
|
|
|
- LinkedHashMap<String, Object> sortedMap = new LinkedHashMap<>();
|
|
|
- for (Map.Entry<String, Object> entry : entryList) {
|
|
|
- sortedMap.put(entry.getKey(), entry.getValue());
|
|
|
- }
|
|
|
- resultMap = sortedMap;
|
|
|
- }
|
|
|
-
|
|
|
} finally {
|
|
|
if (workbook != null) {
|
|
|
workbook.dispose();
|
|
|
@@ -1039,7 +1031,7 @@ public class WbsTreeContractController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return resultMap.isEmpty() ? Collections.singletonMap("message", "未获取到有效数据") : resultMap;
|
|
|
+ return resultMap;
|
|
|
}
|
|
|
/**
|
|
|
* 客户端-导入excel数据到对应元素表中
|