Преглед изворни кода

元素识别初始化类型

liuyc пре 2 година
родитељ
комит
f00b3dd492

+ 30 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -963,6 +963,15 @@ public class ExcelTabController extends BladeController {
                             data.empty().append("<el-input type='text'  @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + i + " tdIndex=" + j + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%;' placeholder='年月日'> </el-input>");
                             exctabCell.setExctabId(excelId);
                             exctabCell.setTextInfo(inputText);
+
+                            if (inputText.contains("日期") || inputText.contains("年") || inputText.contains("月") || inputText.contains("日")){
+                                //日期
+                                exctabCell.setTextElementType(4);
+                            }else {
+                                //字符串
+                                exctabCell.setTextElementType(1);
+                            }
+
                             exctabCell.setIsDeleted(0);
                             exctabCell.setXys(i + "_" + j);
                             colTitle.add(exctabCell);
@@ -1001,6 +1010,15 @@ public class ExcelTabController extends BladeController {
                             if (!inputText.equals("")) {
                                 exctabCell.setExctabId(excelId);
                                 exctabCell.setTextInfo(inputText);
+
+                                if (inputText.contains("日期") || inputText.contains("年") || inputText.contains("月") || inputText.contains("日")){
+                                    //日期
+                                    exctabCell.setTextElementType(4);
+                                }else {
+                                    //字符串
+                                    exctabCell.setTextElementType(1);
+                                }
+
                                 exctabCell.setIsDeleted(0);
                                 exctabCell.setXys(i + "_" + j);
                                 colTitle.add(exctabCell);
@@ -1011,12 +1029,12 @@ public class ExcelTabController extends BladeController {
                 }
             }
         }
-        System.out.println(zikey);
+        //System.out.println(zikey);
         // 去掉重复的数
        Map<String, String> groupMap2 = colTitle.stream()
                 .collect(Collectors.groupingBy(ExctabCell::getTextInfo, Collectors.mapping(ExctabCell::getXys, Collectors.joining(","))));
 
-      //  exctabCellService.DeletExcelByTableId(excelId + "");
+        exctabCellService.DeletExcelByTableId(excelId + "");
 
         List<ExctabCell> colTitle2 = new ArrayList<>();
         for (String title : groupMap2.keySet()) {
@@ -1024,10 +1042,19 @@ public class ExcelTabController extends BladeController {
             exctabCell.setExctabId(excelId);
             exctabCell.setIsDeleted(0);
             exctabCell.setTextInfo(title);
+
+            if (title.contains("日期") || title.contains("年") || title.contains("月") || title.contains("日")){
+                //日期
+                exctabCell.setTextElementType(4);
+            }else {
+                //字符串
+                exctabCell.setTextElementType(1);
+            }
+
             exctabCell.setXys(groupMap2.get(title));
             colTitle2.add(exctabCell);
         }
-     //   exctabCellService.saveBatch(colTitle2);
+        exctabCellService.saveBatch(colTitle2);
 
         // 保存
         File writefile = new File(thmlUrl);