Browse Source

feature 增加提示信息

xiahan 2 months ago
parent
commit
b5f6e180a9

+ 5 - 0
zhsw-common/pom.xml

@@ -75,6 +75,11 @@
             <artifactId>transmittable-thread-local</artifactId>
             <version>2.14.4</version>
         </dependency>
+        <dependency>
+            <groupId>xerces</groupId>
+            <artifactId>xercesImpl</artifactId>
+            <version>2.12.2</version>
+        </dependency>
         <!--        <dependency>-->
 <!--            <groupId>org.docx4j</groupId>-->
 <!--            <artifactId>docx4j</artifactId>-->

+ 19 - 14
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/impl/ImportExcelServiceImpl.java

@@ -88,23 +88,28 @@ public class ImportExcelServiceImpl implements ImportExcelService {
     public void dataSaveAndPostProcessing(List<SwWaterUsageEntryDo> saveList, String dskey, Map<String, SwUserManagementDo> ownerMap) {
         long asyncTasksStart = System.currentTimeMillis();
         List<List<SwWaterUsageEntryDo>> partition = Lists.partition(saveList, 1000); // 动态分片
-        CompletableFuture<Void> allFutures = CompletableFuture.allOf(
-                partition.stream()
-                        .map(data ->
-                                CompletableFuture.runAsync(() -> {
-                                            long startTime = System.currentTimeMillis();
-                                            waterUsageEntryService.getBaseMapper().ListBatchSave(data, dskey);
-                                            log.debug("数据保存耗时: {}ms,总条数:{}", System.currentTimeMillis() - startTime, data.size());
-                                        },
-                                        asyncTaskExecutor).whenComplete((result, ex) -> {
-                                }))
-                        .toArray(CompletableFuture[]::new)
-        );
-        allFutures.thenRun(() -> {
+        for (List<SwWaterUsageEntryDo> data : partition) {
+            long startTime = System.currentTimeMillis();
+            waterUsageEntryService.getBaseMapper().ListBatchSave(data, dskey);
+            log.debug("数据保存耗时: {}ms,总条数:{}", System.currentTimeMillis() - startTime, data.size());
+        }
+        // CompletableFuture<Void> allFutures = CompletableFuture.allOf(
+        //         partition.stream()
+        //                 .map(data ->
+        //                         CompletableFuture.runAsync(() -> {
+        //                                     long startTime = System.currentTimeMillis();
+        //                                     waterUsageEntryService.getBaseMapper().ListBatchSave(data, dskey);
+        //                                     log.debug("数据保存耗时: {}ms,总条数:{}", System.currentTimeMillis() - startTime, data.size());
+        //                                 },
+        //                                 asyncTaskExecutor).whenComplete((result, ex) -> {
+        //                         }))
+        //                 .toArray(CompletableFuture[]::new)
+        // );
+        // allFutures.thenRun(() -> {
             ContextHolder.setValue("dsKey", dskey);
             billGenerationService.asyncGenerateBill(saveList, ownerMap); // 同步生成账单
             log.debug("数据保存总耗时: {}ms", System.currentTimeMillis() - asyncTasksStart);
-        });
+        // });
     }
 
     public File readFile(String fileId) {