Browse Source

:white_check_mark: 测试导入excel逻辑修改

Twelve615 1 năm trước cách đây
mục cha
commit
2b0f090a69

+ 4 - 3
suyuan/jeecg-boot-module-system/src/test/java/org/jeecg/modules/system/test/ExcelTest.java

@@ -52,7 +52,8 @@ public class ExcelTest {
             try {
                 List<AdminRscode> adminRscodeArrayList = new ArrayList<>(  );
 
-                List<SYMCode> list = ExcelImportUtil.importExcel( file, SYMCode.class, params );
+                List<SYMCode> excelDataList = ExcelImportUtil.importExcel( file, SYMCode.class, params );
+                List<SYMCode> list = new ArrayList<>();
                 List<SYMCode> list3 = new ArrayList<>(  );
                 if (list.size() == 0) {
                     System.out.println(("文件导入失败:查不到了文件数据,或者文件数据格式错误!"));
@@ -62,10 +63,10 @@ public class ExcelTest {
 //                        int finalIa = ia;
 //                        boolean b = list.stream().allMatch( list2 -> list2.getRetrospectiveSourceCode().equals( list.get( finalIa ).getRetrospectiveSourceCode() ) );
                     // 去除空的对象
-                    List<SYMCode> collect = list.stream().filter(item -> item != null && !Strings.isNullOrEmpty(item.getRetrospectiveSourceCode()) && !Strings.isNullOrEmpty(item.getName())).collect(Collectors.toList());
+                    list = excelDataList.stream().filter(item -> item != null && !Strings.isNullOrEmpty(item.getRetrospectiveSourceCode()) && !Strings.isNullOrEmpty(item.getName())).collect(Collectors.toList());
                     // 根据指定属性分组,并统计数量(key:指定属性,value:数量)
                     Map<String, Long> mapGroup =
-                            collect.stream().filter(item -> item!=null&&item.getRetrospectiveSourceCode()!=null).collect(Collectors.groupingBy(lists -> lists.getRetrospectiveSourceCode(),
+                            list.stream().filter(item -> item!=null&&item.getRetrospectiveSourceCode()!=null).collect(Collectors.groupingBy(lists -> lists.getRetrospectiveSourceCode(),
                                     Collectors.counting()));
                     //重新改一下list的长度
                     int listSize3 = list3.size();