Просмотр исходного кода

fix(导入导出):
修复导入完成后没有删除缓存的问题

18339543638 2 лет назад
Родитель
Сommit
586fb6292a

+ 7 - 3
tr-modules/tr-module-export/src/main/java/cn/tr/module/excel/core/service/ExcelSheetManage.java

@@ -73,9 +73,9 @@ public class ExcelSheetManage {
     }
     }
 
 
     public void clear(String sheetId){
     public void clear(String sheetId){
-        Cache cache = cacheMap.remove(sheetId);
+        Cache cache = cacheMap.remove(getKey(sheetId));
         if(cache!=null){
         if(cache!=null){
-            cache.clear();
+            cache.invalidate();
         }
         }
     }
     }
 
 
@@ -91,6 +91,10 @@ public class ExcelSheetManage {
 
 
 
 
     private Cache getCache(String sheetId){
     private Cache getCache(String sheetId){
-        return cacheMap.computeIfAbsent("excel-sheet:"+sheetId, k -> cacheManager.getCache(k));
+        return cacheMap.computeIfAbsent(getKey(sheetId), k -> cacheManager.getCache(k));
+    }
+
+    private String getKey(String sheetId){
+        return "excel-sheet:"+sheetId;
     }
     }
 }
 }

+ 1 - 1
tr-plugins/tr-spring-boot-starter-plugin-eventbus/src/main/java/cn/tr/plugin/eventbus/constant/ExEventBusConstant.java

@@ -22,7 +22,7 @@ public interface ExEventBusConstant {
     /**
     /**
      * 目的地名称
      * 目的地名称
      */
      */
-    String DESTINATION = "exEventBus";
+    String DESTINATION = "exEventBus2222";
 
 
     /**
     /**
      * 排他消息总线消费者
      * 排他消息总线消费者

+ 1 - 1
tr-test/src/test/java/cn/tr/module/excel/CompositeExcelTemplateFacadeTest.java

@@ -50,7 +50,7 @@ public class CompositeExcelTemplateFacadeTest {
         TenantContextHolder.setIgnore(false);
         TenantContextHolder.setIgnore(false);
         FileInputStream fileInputStream = new FileInputStream(FileUtil.touch("C:\\Users\\JR\\Desktop\\test1.xlsx"));
         FileInputStream fileInputStream = new FileInputStream(FileUtil.touch("C:\\Users\\JR\\Desktop\\test1.xlsx"));
         byte[] bytes = IoUtil.readBytes(fileInputStream);
         byte[] bytes = IoUtil.readBytes(fileInputStream);
-        for (int i = 0; i < 1000; i++) {
+        for (int i = 0; i < 1; i++) {
             String sss = excelService.importExcel("test.xlsx", IoUtil.toStream(bytes), User.class);
             String sss = excelService.importExcel("test.xlsx", IoUtil.toStream(bytes), User.class);
             System.out.println(sss);
             System.out.println(sss);
         }
         }