Przeglądaj źródła

bug 时间问题

hongchuangyanfa 2 lat temu
rodzic
commit
83d6cb4808

+ 36 - 22
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -640,11 +640,11 @@ public class ExcelTabController extends BladeController {
     }
 
 
-/*    public static void main(String[] args) throws FileNotFoundException {
+    public static void main(String[] args) throws FileNotFoundException {
 
         String thmlUrl = "/Users/hongchuangyanfa/Desktop/1234567890.html";
 
-        File file1 = ResourceUtil.getFile("/Users/hongchuangyanfa/Downloads/D9.11表-顶进施工的涵洞质量检验单.xlsx");
+        File file1 = ResourceUtil.getFile("/Users/hongchuangyanfa/Downloads/G4.xlsx");
 
         Workbook wb = new Workbook();
         wb.loadFromMHtml(new FileInputStream(file1));
@@ -653,7 +653,7 @@ public class ExcelTabController extends BladeController {
 
         sheet.saveToHtml(thmlUrl);
         expailHtmlInfo(thmlUrl,1L);
-    }*/
+    }
 
 
     // 上传解析 html
@@ -737,15 +737,21 @@ public class ExcelTabController extends BladeController {
                     int y2 = 0;
 
                     String textInfo = data.text().trim().replaceAll(" ", "");
-                    System.out.println(textInfo);
+
                     y1 = i + 1;
                     //x 移位 算法
                     String getRowInfo = rowData[y1];
+
+                    if(i==10){
+
+                        System.out.println("");
+                    }
+
                     if (getRowInfo != null) {
                         String[] dataInfo2 = getRowInfo.split(",");
-                        // 先逻辑处理 连续时,归一
 
-                        if (getRowInfo.indexOf("1") >= 0 && j == 0) {
+                        // 先逻辑处理 连续时,归一
+                        if ((dataInfo2[0].split(":")[0]).equals("1") && j == 0) {
                             x = Integer.parseInt(dataInfo2[0].split(":")[1]);
                         } else {
                             for (int m = 0; m < dataInfo2.length; m++) {
@@ -760,8 +766,14 @@ public class ExcelTabController extends BladeController {
 
                     // X 坐标
                     if (tds.size() == 1) {
-                        x1 = 1;
-                        x2 = colspan;
+                        if (colspan == 0) {
+                            x1 =x+1;
+                            x2 = x+1;
+                        }else{
+                            x1 = 1;
+                            x2 = colspan;
+                        }
+
                     } else {
                         if (colspan == 0) {
                             x1 = x + 1;
@@ -879,6 +891,11 @@ public class ExcelTabController extends BladeController {
                             }
                         }
 
+                        if(i==9){
+                            System.out.println();
+                            System.out.println(zikey);
+                        }
+
                         if (inputText != null && inputText != "" && inputText.indexOf("_") >= 0) {
                             inputText = inputText.substring(0, inputText.lastIndexOf("_"));
                         }
@@ -938,9 +955,8 @@ public class ExcelTabController extends BladeController {
             }
         }
         System.out.println(zikey);
-        // 去掉重复的数据
-
-/*        Map<String, String> groupMap2 = colTitle.stream()
+        // 去掉重复的数
+/*       Map<String, String> groupMap2 = colTitle.stream()
                 .collect(Collectors.groupingBy(ExctabCell::getTextInfo, Collectors.mapping(ExctabCell::getXys, Collectors.joining(","))));
 
         exctabCellService.DeletExcelByTableId(excelId + "");
@@ -1001,7 +1017,7 @@ public class ExcelTabController extends BladeController {
             }
 
             // 计算线开始
-            if (classInfo.indexOf("border-left-style") >= 0 && classInfo.indexOf("border-top-style") >= 0 && classInfo.indexOf("border-bottom-style") >= 0 && classInfo.indexOf("border-right-style") >= 0) {
+            if (classInfo.indexOf("border-left-style") >= 0 && classInfo.indexOf("border-top-style") >= 0  && classInfo.indexOf("border-right-style") >= 0) {
                 x_width += colspan;
             }
 
@@ -1010,7 +1026,7 @@ public class ExcelTabController extends BladeController {
                 y_width += colspan;
             }
 
-            String name = data.text().replaceAll("[^\u4E00-\u9FA5]", "");
+            String name = data.text();
             if (!name.isEmpty()) {
                 text_width += colspan;
             }
@@ -1024,19 +1040,16 @@ public class ExcelTabController extends BladeController {
         }
 
         // 在区域内
+      //  System.out.println(index_state+"——"+y+"__"+x_width);
+
         if (index_state) {
             //是否需要改变
-            if (maxCol == y_width) {
+            if (maxCol == y_width) { // 是否结束区域值
                 index_state = false;
-                if (maxCol != top1_max) {
-                    xy_type += 1;
-                }
-
+                xy_type += 1;
             }
-            if (maxCol == text_width) {
-                if (maxCol != top1_max) {
-                    xy_type += 1;
-                }
+            if (maxCol == text_width && top1_max !=text_width) { // 是否区域开始时
+                xy_type += 1;
             }
         } else { // 区域外
             if (maxCol == x_width) {
@@ -1045,6 +1058,7 @@ public class ExcelTabController extends BladeController {
             }
         }
 
+        // 空是否等于值的个数
         if (null_count == val_count) {
             istrue = true;
         } else {