Selaa lähdekoodia

bug 时间问题

hongchuangyanfa 2 vuotta sitten
vanhempi
commit
bb5ee6551b

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

@@ -18,6 +18,7 @@ import com.spire.xls.core.IStyle;
 import com.spire.xls.core.spreadsheet.HTMLOptions;
 import com.spire.xls.core.spreadsheet.pivottables.PivotStyle;
 import com.spire.xls.core.spreadsheet.shapes.XlsTextBoxShape;
+import io.reactivex.Single;
 import io.swagger.annotations.*;
 import lombok.AllArgsConstructor;
 import lombok.SneakyThrows;
@@ -488,7 +489,7 @@ public class ExcelTabController extends BladeController {
                     String filedType = "";
 
                     for (WbsFormElement elementInfo : elementList) {
-                        String ysName = elementInfo.getEName().replaceAll("[^\u4E00-\u9FA5_]", "");
+                        String ysName = elementInfo.getEName();
                         if (titleName.equals(ysName)) {
                             lastName = elementInfo.getEName();
                             attrInfo = elementInfo.getEKey() + "__" + i + "_" + j;
@@ -656,12 +657,13 @@ 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/G4.xlsx");
+        File file1 = ResourceUtil.getFile("/Users/hongchuangyanfa/Downloads/5cadb3f4ed3bb15a14fb770117ca7f2b.xlsx");
 
         Workbook wb = new Workbook();
         wb.loadFromMHtml(new FileInputStream(file1));
@@ -670,12 +672,13 @@ public class ExcelTabController extends BladeController {
 
         sheet.saveToHtml(thmlUrl);
         expailHtmlInfo(thmlUrl,1L);
-    }
-*/
+    }*/
+
+
 
 
     // 上传解析 html
-    public static void expailHtmlInfo(String thmlUrl, Long excelId) throws FileNotFoundException {
+    public void  expailHtmlInfo(String thmlUrl, Long excelId) throws FileNotFoundException {
 
         // 读取
         File file1 = ResourceUtil.getFile(thmlUrl);
@@ -760,14 +763,37 @@ public class ExcelTabController extends BladeController {
                     //x 移位 算法
                     String getRowInfo = rowData[y1];
 
-                    if(i==10){
 
-                        System.out.println("");
-                    }
 
                     if (getRowInfo != null) {
                         String[] dataInfo2 = getRowInfo.split(",");
 
+                        // 排序
+                        int lastMax = 0;
+                        List<String> datax = Arrays.stream(dataInfo2).sorted((a,b)->Integer.parseInt(a.split(":")[1])-Integer.parseInt(b.split(":")[1])).collect(Collectors.toList());
+                        List<String> lastdata = new ArrayList<>();
+                        //组合
+                        for (int h = 0; h < datax.size() ; h++) {
+                            int mx1 = Integer.parseInt(datax.get(h).split(":")[0]);
+                            int mx2 = Integer.parseInt(datax.get(h).split(":")[1]);
+                            if(lastdata.size()==0){
+                                lastdata.add(datax.get(0));
+
+                            }else{
+                                if(lastMax+1==mx1){
+                                    int minVal =  Integer.parseInt(lastdata.get(lastdata.size()-1).split(":")[0]);
+                                    lastdata.remove(lastdata.size()-1);
+                                    lastdata.add(minVal+":"+mx2);
+                                }else{
+                                    lastdata.add(datax.get(h));
+                                }
+                            }
+                            lastMax = mx2;
+                        }
+                        dataInfo2 = lastdata.stream().toArray(String[]::new);
+
+
+
                         // 先逻辑处理 连续时,归一
                         if ((dataInfo2[0].split(":")[0]).equals("1") && j == 0) {
                             x = Integer.parseInt(dataInfo2[0].split(":")[1]);
@@ -804,6 +830,10 @@ public class ExcelTabController extends BladeController {
                         }
                     }
 
+                    if(i==13){
+                        System.out.println("");
+                    }
+
                     //x y 坐标
                     if (rowspan == 0) {
                         y2 = i + 1;
@@ -835,7 +865,7 @@ public class ExcelTabController extends BladeController {
                     }
 
                     data.text(textInfo.replaceAll(" ", ""));
-                    if (!textInfo.isEmpty() && !textInfo.equals("/") && !(textInfo.indexOf("年") >= 0 && textInfo.indexOf("月") >= 0 && textInfo.indexOf("日") >= 0) && !textInfo.equals("—") && !textInfo.equals("-")) {  // 标题区域
+                    if (textInfo.indexOf("□")<0 && !textInfo.isEmpty() && !textInfo.equals("/") && !(textInfo.indexOf("年") >= 0 && textInfo.indexOf("月") >= 0 && textInfo.indexOf("日") >= 0) && !textInfo.equals("—") && !textInfo.equals("-")) {  // 标题区域
                         Map<String, String> dataInfo = new HashMap<String, String>();
                         dataInfo.put("name", textInfo);
                         dataInfo.put("x1", x1 + "");
@@ -843,9 +873,15 @@ public class ExcelTabController extends BladeController {
                         dataInfo.put("y1", y1 + "");
                         dataInfo.put("y2", y2 + "");
                         dataInfo.put("xytype", xy_type + "");
-                        zikey.add(dataInfo);
-
+                        if(textInfo.indexOf("/")<0){ // 带/为分割数据
+                            zikey.add(dataInfo);
+                        }
                     } else { //空行
+
+                        if(i==20){
+                            System.out.println("");
+                        }
+
                         List<Map<String, String>> left = new ArrayList<>();
                         List<Map<String, String>> top = new ArrayList<>();
                         for (int k = 0; k < zikey.size(); k++) {
@@ -868,6 +904,9 @@ public class ExcelTabController extends BladeController {
                                 }
                             }
                         }
+                        if(i==9 && j==2){
+                            System.out.println();
+                        }
 
                         String inputText = "";
                         // 特征值赛选 规则
@@ -878,19 +917,21 @@ public class ExcelTabController extends BladeController {
                             int yy1 = Integer.parseInt(left.get(k).get("y1"));
                             int yy2 = Integer.parseInt(left.get(k).get("y2"));
 
-                            if (index_state && !StringUtil.isNumeric(name) && name.length() <= 20) { // 正向规则匹配
-                                if (istrue) {
-                                    if (x1 - xx2 <= 1 && y1 == yy2) {
-                                        inputText = name;
+                            if(!StringUtil.isNumeric(name) && name.length() <= 20){ // 数字不匹配
+                                if (index_state ) { // 正向规则匹配
+                                    if (istrue) { // 是否空格等于值
+                                        if (x1 - xx2 <= 1 && y1 == yy2) {
+                                            inputText = name;
+                                        } else {
+                                            inputText += name + "_";
+                                        }
                                     } else {
                                         inputText += name + "_";
                                     }
                                 } else {
-                                    inputText += name + "_";
-                                }
-                            } else {
-                                if (x1 - xx2 <= 1 && y1 == yy2) {
-                                    inputText = name;
+                                    if (x1 - xx2 <= 1 && y1 == yy2) {
+                                        inputText = name;
+                                    }
                                 }
                             }
                         }
@@ -909,10 +950,6 @@ 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("_"));
@@ -931,6 +968,8 @@ public class ExcelTabController extends BladeController {
                             colTitle.add(exctabCell);
                             data.attr("title", inputText);
 
+                        }else if(textInfo.indexOf("□")>=0){
+                            data.attr("title", inputText);
                         } else {
                             if (index_state) {
                                 if (rowspan >= 1) {
@@ -974,7 +1013,7 @@ 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 + "");
@@ -988,7 +1027,7 @@ public class ExcelTabController extends BladeController {
             exctabCell.setXys(groupMap2.get(title));
             colTitle2.add(exctabCell);
         }
-        exctabCellService.saveBatch(colTitle2);*/
+        exctabCellService.saveBatch(colTitle2);
 
         // 保存
         File writefile = new File(thmlUrl);
@@ -1003,7 +1042,6 @@ public class ExcelTabController extends BladeController {
         int text_width = 0;
         int width = 0;
 
-
         int null_count = 0;
         int val_count = 0;
 
@@ -1077,7 +1115,7 @@ public class ExcelTabController extends BladeController {
         }
 
         // 空是否等于值的个数
-        if (null_count == val_count) {
+        if (null_count == val_count && width==maxCol) {
             istrue = true;
         } else {
             istrue = false;

+ 165 - 135
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExpaileHtml.java

@@ -10,6 +10,9 @@ import com.spire.xls.ExcelVersion;
 import com.spire.xls.Workbook;
 import com.spire.xls.Worksheet;
 import com.spire.xls.core.spreadsheet.HTMLOptions;
+import io.swagger.models.auth.In;
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
@@ -26,13 +29,42 @@ import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-public  class ExpaileHtml {
+public class ExpaileHtml {
 
-   // private final IExctabCellService exctabCellService;
+    // private final IExctabCellService exctabCellService;
 
     public static void main11(String[] args) throws IOException {
-        String dataInfo ="-";
 
+        List<String> data = new ArrayList<>();
+        List<String> data2 = new ArrayList<>();
+        data.add("1:2");
+
+
+        String[] intArray = new String[data.size()];
+        int lastMax = 0;
+        for (int h = 0; h < data.size() ; h++) {
+            int mx1 = Integer.parseInt(data.get(h).split(":")[0]);
+            int mx2 = Integer.parseInt(data.get(h).split(":")[1]);
+            if(data2.size()==0){
+                data2.add(data.get(0));
+
+            }else{
+                if(lastMax+1==mx1){
+                  int minVal =  Integer.parseInt(data2.get(data2.size()-1).split(":")[0]);
+                    data2.remove(data2.size()-1);
+                    data2.add(minVal+":"+mx2);
+                }else{
+                    data2.add(data.get(h));
+                }
+            }
+            lastMax = mx2;
+        }
+
+
+        System.out.println("开始");
+        for (String s : data2) {
+            System.out.println(s);
+        }
 
 
        /* String  thmlUrl = "/Users/hongchuangyanfa/Desktop/C10.1.xlsx" ;
@@ -53,21 +85,21 @@ public  class ExpaileHtml {
         //String url = "/Users/hongchuangyanfa/Desktop/privateUrl/1560108472350015488.html";
 
         //指定输出文档路径
-       // String fileName = "/Users/hongchuangyanfa/Desktop/pdf/UrlToPdf.pdf";
+        // String fileName = "/Users/hongchuangyanfa/Desktop/pdf/UrlToPdf.pdf";
 
         //指定插件路径
-     //   String pluginPath = "/Users/hongchuangyanfa/tool/plugins_mac";
+        //   String pluginPath = "/Users/hongchuangyanfa/tool/plugins_mac";
 
         //设置插件路径
-     //   HtmlConverter.setPluginPath(pluginPath);
+        //   HtmlConverter.setPluginPath(pluginPath);
         //将URL转换为PDF595×842
-       // HtmlConverter.convert(url, fileName, true, 1000000, new Size(842,595), new PdfMargins(0));
-     //   HtmlConverter.convert(url, fileName, true, 1000000, new Size(595,842), new PdfMargins(50,0,50,50 ));
+        // HtmlConverter.convert(url, fileName, true, 1000000, new Size(842,595), new PdfMargins(0));
+        //   HtmlConverter.convert(url, fileName, true, 1000000, new Size(595,842), new PdfMargins(50,0,50,50 ));
 
 
         //
-       // HTMLOptions options = new HTMLOptions();
-       // options.setTextMode();
+        // HTMLOptions options = new HTMLOptions();
+        // options.setTextMode();
 /*        Workbook wb = new Workbook();
         wb.loadFromMHtml(file.getInputStream());
         //获取工作表
@@ -87,11 +119,11 @@ public  class ExpaileHtml {
     }
 
     // 清表上传解析方案
-    public  static void expailHtmlInfo(String thmlUrl) throws FileNotFoundException {
+    public static void expailHtmlInfo(String thmlUrl) throws FileNotFoundException {
 
         // 读取
         File file1 = ResourceUtil.getFile(thmlUrl);
-        String htmlString =  IoUtil.readToString(new FileInputStream(file1));
+        String htmlString = IoUtil.readToString(new FileInputStream(file1));
 
         /*
            解析
@@ -102,7 +134,7 @@ public  class ExpaileHtml {
         // 样式集合
         Document doc = Jsoup.parse(htmlString);
         // 解析 style
-        Map<String ,String > styleMap = getHtmlStyle(doc);
+        Map<String, String> styleMap = getHtmlStyle(doc);
 
         //解析
         Element table = doc.select("table").first();
@@ -110,28 +142,28 @@ public  class ExpaileHtml {
 
         // 获取总行列数
         int maxCol = doc.select("Col").size();
-        String [] rowData = new String[trs.size()+1];
+        String[] rowData = new String[trs.size() + 1];
 
         // 行的状态
         boolean index_state = false;
         // 区域划分表示
-        int xy_type = 1  ;
+        int xy_type = 1;
 
         // 解析 excel元素集合
         Set<String> colTitleSet = new HashSet<>();
 
 //      标题集合信息
-        List<Map<String,String>> zikey = new ArrayList<>();
-        for(int i = 0 ;i <=trs.size()-1 ;i++) {
+        List<Map<String, String>> zikey = new ArrayList<>();
+        for (int i = 0; i <= trs.size() - 1; i++) {
             Element tr = trs.get(i);
             Elements tds = tr.select("td");
-            String xyInof = getTrInfo(tds,styleMap,index_state,xy_type,maxCol);
+            String xyInof = getTrInfo(tds, styleMap, index_state, xy_type, maxCol);
             xy_type = Integer.parseInt(xyInof.split(",")[0]);
-            tr.attr("xy_type",xyInof);
+            tr.attr("xy_type", xyInof);
             index_state = Boolean.parseBoolean(xyInof.split(",")[1]);
-           boolean isMaxCol = Integer.parseInt(xyInof.split(",")[2])==maxCol;
+            boolean isMaxCol = Integer.parseInt(xyInof.split(",")[2]) == maxCol;
             // 计算单元格坐标
-            int x= 0;
+            int x = 0;
             for (int j = 0; j < tds.size(); j++) {
                 {
                     Element data = tds.get(j);
@@ -139,141 +171,141 @@ public  class ExpaileHtml {
                     int rowspan = data.attr("ROWSPAN").equals("") ? 0 : Integer.parseInt(data.attr("ROWSPAN"));
                     Map<String, String> textObject = new HashMap<>();
                     // 计算
-                    int x1 =0;
-                    int x2 =0;
-                    int y1 =0;
-                    int y2 =0;
+                    int x1 = 0;
+                    int x2 = 0;
+                    int y1 = 0;
+                    int y2 = 0;
 
-                    String textInfo = data.text().trim().replaceAll(" ","");
+                    String textInfo = data.text().trim().replaceAll(" ", "");
 
-                    y1=i+1;
+                    y1 = i + 1;
                     //x 移位 算法
                     String getRowInfo = rowData[y1];
-                    if(getRowInfo!=null){
-                        String [] dataInfo2 = getRowInfo.split(",");
-                        if(getRowInfo.indexOf("1")>=0 && j==0){
-                            x= Integer.parseInt(dataInfo2[0].split(":")[1]);
-                        }else{
-                            for(int m =0;m<dataInfo2.length ;m++){
+                    if (getRowInfo != null) {
+                        String[] dataInfo2 = getRowInfo.split(",");
+                        if (getRowInfo.indexOf("1") >= 0 && j == 0) {
+                            x = Integer.parseInt(dataInfo2[0].split(":")[1]);
+                        } else {
+                            for (int m = 0; m < dataInfo2.length; m++) {
                                 int mx1 = Integer.parseInt(dataInfo2[m].split(":")[0]);
                                 int mx2 = Integer.parseInt(dataInfo2[m].split(":")[1]);
-                                if((mx1-x)==1 && mx1>x){
-                                    x = mx2 ;
+                                if ((mx1 - x) == 1 && mx1 > x) {
+                                    x = mx2;
                                 }
                             }
                         }
                     }
 
                     // X 坐标
-                    if(colspan==0){
-                        x1 = x+1;
-                        x2 = x+1;
-                        x= x +1;
-                    }else{
-                        x1 = x+1;
-                        x2 = x+colspan;
-                        x = x+colspan;
+                    if (colspan == 0) {
+                        x1 = x + 1;
+                        x2 = x + 1;
+                        x = x + 1;
+                    } else {
+                        x1 = x + 1;
+                        x2 = x + colspan;
+                        x = x + colspan;
                     }
 
                     //x y 坐标
-                    if(rowspan==0){
-                        y2 = i+1;
-                    }else{
-                        y2 = i+rowspan;
-                        for(int k=0;k<rowspan-1;k++){
-                            String dataInfo = rowData[k+2+i];
-                            if(dataInfo==null){
-                                dataInfo = x1+":"+x2;
-                            }else{
-                                String [] dataInfo2 = dataInfo.split(",");
-                                String dataInfo3 = dataInfo2[dataInfo2.length-1];
+                    if (rowspan == 0) {
+                        y2 = i + 1;
+                    } else {
+                        y2 = i + rowspan;
+                        for (int k = 0; k < rowspan - 1; k++) {
+                            String dataInfo = rowData[k + 2 + i];
+                            if (dataInfo == null) {
+                                dataInfo = x1 + ":" + x2;
+                            } else {
+                                String[] dataInfo2 = dataInfo.split(",");
+                                String dataInfo3 = dataInfo2[dataInfo2.length - 1];
                                 int mx1 = Integer.parseInt(dataInfo3.split(":")[0]);
                                 int mx2 = Integer.parseInt(dataInfo3.split(":")[1]);
-                                if(mx2+1==x1){
-                                    dataInfo = dataInfo+","+mx1+":"+x2;
-                                }else{
-                                    dataInfo = dataInfo+","+x1+":"+x2;
+                                if (mx2 + 1 == x1) {
+                                    dataInfo = dataInfo + "," + mx1 + ":" + x2;
+                                } else {
+                                    dataInfo = dataInfo + "," + x1 + ":" + x2;
                                 }
                             }
-                            rowData[k+2+i] = dataInfo;
+                            rowData[k + 2 + i] = dataInfo;
                         }
                     }
 
 
-                  //  System.out.println(x1+"_"+x2+"_"+y1+"_"+y2+"_"+textInfo);
-                  //  data.text(textInfo.replaceAll(" ",""));
-                    if(!textInfo.isEmpty() && !textInfo.equals("/") && !(textInfo.indexOf("年")>=0 && textInfo.indexOf("月")>=0&& textInfo.indexOf("日")>=0)&& !textInfo.equals("—") && !textInfo.equals("-") ){  // 标题区域
-                        Map<String,String> dataInfo =new HashMap<String,String>();
-                        dataInfo.put("name",textInfo);
-                        dataInfo.put("x1",x1+"");
-                        dataInfo.put("x2",x2+"");
-                        dataInfo.put("y1",y1+"");
-                        dataInfo.put("y2",y2+"");
-                        dataInfo.put("xytype",xy_type+"");
+                    //  System.out.println(x1+"_"+x2+"_"+y1+"_"+y2+"_"+textInfo);
+                    //  data.text(textInfo.replaceAll(" ",""));
+                    if (!textInfo.isEmpty() && !textInfo.equals("/") && !(textInfo.indexOf("年") >= 0 && textInfo.indexOf("月") >= 0 && textInfo.indexOf("日") >= 0) && !textInfo.equals("—") && !textInfo.equals("-")) {  // 标题区域
+                        Map<String, String> dataInfo = new HashMap<String, String>();
+                        dataInfo.put("name", textInfo);
+                        dataInfo.put("x1", x1 + "");
+                        dataInfo.put("x2", x2 + "");
+                        dataInfo.put("y1", y1 + "");
+                        dataInfo.put("y2", y2 + "");
+                        dataInfo.put("xytype", xy_type + "");
                         zikey.add(dataInfo);
-                    }else{ //空行
-                        List<Map<String,String>> left = new ArrayList<>();
-                        List<Map<String,String>> top = new ArrayList<>();
-                        for(int k=0 ; k< zikey.size() ;k++){
+                    } else { //空行
+                        List<Map<String, String>> left = new ArrayList<>();
+                        List<Map<String, String>> top = new ArrayList<>();
+                        for (int k = 0; k < zikey.size(); k++) {
                             String name = zikey.get(k).get("name");
-                          //  String name2 = zikey.get(k).get("name").replaceAll("[^\u4E00-\u9FA5]", "");
-                            int xx1 = Integer.parseInt( zikey.get(k).get("x1"));
-                            int xx2 = Integer.parseInt( zikey.get(k).get("x2"));
-                            int yy1 = Integer.parseInt( zikey.get(k).get("y1"));
-                            int yy2 = Integer.parseInt( zikey.get(k).get("y2"));
-                            int xytype2 = Integer.parseInt( zikey.get(k).get("xytype"));
+                            //  String name2 = zikey.get(k).get("name").replaceAll("[^\u4E00-\u9FA5]", "");
+                            int xx1 = Integer.parseInt(zikey.get(k).get("x1"));
+                            int xx2 = Integer.parseInt(zikey.get(k).get("x2"));
+                            int yy1 = Integer.parseInt(zikey.get(k).get("y1"));
+                            int yy2 = Integer.parseInt(zikey.get(k).get("y2"));
+                            int xytype2 = Integer.parseInt(zikey.get(k).get("xytype"));
                             // 左匹配
-                            if( yy1<=y1 && yy2>=y2 && xx2<x1 && xytype2==xy_type){
+                            if (yy1 <= y1 && yy2 >= y2 && xx2 < x1 && xytype2 == xy_type) {
                                 left.add(zikey.get(k));
                             }
                             //向 上 匹配
-                            if(index_state){
-                                if( xx1<=x1 && xx2 >=x2 && yy2<y1 && xytype2==xy_type){
+                            if (index_state) {
+                                if (xx1 <= x1 && xx2 >= x2 && yy2 < y1 && xytype2 == xy_type) {
                                     top.add(zikey.get(k));
                                 }
                             }
                         }
-                        String inputText ="";
+                        String inputText = "";
                         // 特征值赛选 规则
-                        for(int k=0 ; k< left.size() ;k++){ // 左计算
-                            String name = left.get(k).get("name") ;//.replaceAll("[^\u4E00-\u9FA5]", "");
-                            int xx1 = Integer.parseInt( left.get(k).get("x1"));
-                            int xx2 = Integer.parseInt( left.get(k).get("x2"));
-                            int yy1 = Integer.parseInt( left.get(k).get("y1"));
-                            int yy2 = Integer.parseInt( left.get(k).get("y2"));
-                            if(index_state){ // 正向规则匹配
-                                inputText+=name+"_";
-                            }else{
-                                if(x1-xx2<=1 && y1==yy2){
+                        for (int k = 0; k < left.size(); k++) { // 左计算
+                            String name = left.get(k).get("name");//.replaceAll("[^\u4E00-\u9FA5]", "");
+                            int xx1 = Integer.parseInt(left.get(k).get("x1"));
+                            int xx2 = Integer.parseInt(left.get(k).get("x2"));
+                            int yy1 = Integer.parseInt(left.get(k).get("y1"));
+                            int yy2 = Integer.parseInt(left.get(k).get("y2"));
+                            if (index_state) { // 正向规则匹配
+                                inputText += name + "_";
+                            } else {
+                                if (x1 - xx2 <= 1 && y1 == yy2) {
                                     inputText = name;
                                 }
                             }
                         }
 
                         // 特征值赛选 规则
-                        if(top!=null && top.size()>=1){
-                            for(int k=0 ; k< top.size() ;k++){ // 向上计算
-                                String name = top.get(k).get("name") ;//.replaceAll("[^\u4E00-\u9FA5]", "");
-                                int xx1 = Integer.parseInt( top.get(k).get("x1"));
-                                int xx2 = Integer.parseInt( top.get(k).get("x2"));
-                                int yy1 = Integer.parseInt( top.get(k).get("y1"));
-                                int yy2 = Integer.parseInt( top.get(k).get("y2"));
-                                inputText+=name+"_";
+                        if (top != null && top.size() >= 1) {
+                            for (int k = 0; k < top.size(); k++) { // 向上计算
+                                String name = top.get(k).get("name");//.replaceAll("[^\u4E00-\u9FA5]", "");
+                                int xx1 = Integer.parseInt(top.get(k).get("x1"));
+                                int xx2 = Integer.parseInt(top.get(k).get("x2"));
+                                int yy1 = Integer.parseInt(top.get(k).get("y1"));
+                                int yy2 = Integer.parseInt(top.get(k).get("y2"));
+                                inputText += name + "_";
                             }
                         }
 
-                        if(inputText!=null && inputText!="" && inputText.indexOf("_")>=0){
-                            inputText = inputText.substring(0,inputText.lastIndexOf("_"));
+                        if (inputText != null && inputText != "" && inputText.indexOf("_") >= 0) {
+                            inputText = inputText.substring(0, inputText.lastIndexOf("_"));
                         }
 
                         // 计算当前 输入框 标题匹配原则(左 - 上- 下)
-                      //  System.out.println(x1+"_"+x2+","+y1+"_"+y2+"=="+textInfo+"=left"+left.toString() +"===top"+top.toString()+"__index_state="+index_state+"inputtext="+inputText);
+                        //  System.out.println(x1+"_"+x2+","+y1+"_"+y2+"=="+textInfo+"=left"+left.toString() +"===top"+top.toString()+"__index_state="+index_state+"inputtext="+inputText);
 
                         // 设置文本信息
-                        if(textInfo.indexOf("年")>=0 && textInfo.indexOf("月")>=0&& textInfo.indexOf("日")>=0){
+                        if (textInfo.indexOf("年") >= 0 && textInfo.indexOf("月") >= 0 && textInfo.indexOf("日") >= 0) {
                             data.empty().append("<input type='time' style='width:100%;height:100%' placeholder=''> </input>");
-                            colTitleSet.add(inputText+"签字时间");
-                        }else {
+                            colTitleSet.add(inputText + "签字时间");
+                        } else {
                             if (index_state) {
                                 data.empty().append("<input type='text' style='width:100%;height:100%' placeholder='" + inputText + "' > </input>");
                             } else {
@@ -291,12 +323,12 @@ public  class ExpaileHtml {
                             colTitleSet.add(inputText);
                         }
                     }
-                   // data.text(textInfo.replaceAll(" ",""));
+                    // data.text(textInfo.replaceAll(" ",""));
                 }
             }
         }
 
-        for (String keys:colTitleSet){
+        for (String keys : colTitleSet) {
             System.out.println(keys.replaceAll("[^(\u4E00-\u9FA5_)]", ""));
         }
 
@@ -306,13 +338,11 @@ public  class ExpaileHtml {
     }
 
 
-
-
     //计算区域坐标
-    public static String getTrInfo(Elements tds,Map<String ,String > styleMap,boolean index_state,Integer xy_type,int maxCol){
+    public static String getTrInfo(Elements tds, Map<String, String> styleMap, boolean index_state, Integer xy_type, int maxCol) {
 
-        int x_width = 0 ;
-        int y_width = 0 ;
+        int x_width = 0;
+        int y_width = 0;
         int text_width = 0;
         int width = 0;
 
@@ -323,56 +353,56 @@ public  class ExpaileHtml {
 
             int colspan = data.attr("COLSPAN").equals("") ? 1 : Integer.parseInt(data.attr("COLSPAN"));
             String classInfo = styleMap.get(keyId);
-            if(classInfo ==null){
+            if (classInfo == null) {
                 classInfo = data.attr("style");
-            }else{
+            } else {
                 data.removeAttr("class");
-                data.attr("style",styleMap.get(keyId).replaceAll("break-word","inherit"));
+                data.attr("style", styleMap.get(keyId).replaceAll("break-word", "inherit"));
             }
 
             // 计算线开始
-            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-bottom-style") >= 0 && classInfo.indexOf("border-right-style") >= 0) {
                 x_width += colspan;
             }
 
             // 计算结束
-            if(classInfo.indexOf("border-left-style")< 0 && (classInfo.indexOf("border-top-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-top-style") >= 0) && classInfo.indexOf("border-bottom-style") < 0 && classInfo.indexOf("border-right-style") < 0) {
                 y_width += colspan;
             }
 
             String name = data.text().replaceAll("[^\u4E00-\u9FA5]", "");
-            if(!name.isEmpty()){
+            if (!name.isEmpty()) {
                 text_width += colspan;
             }
-            width +=colspan;
+            width += colspan;
         }
 
         // 在区域内
-        if(index_state){
+        if (index_state) {
             //是否需要改变
-            if(maxCol == y_width ){
-                index_state =  false ;
-                xy_type+=1;
+            if (maxCol == y_width) {
+                index_state = false;
+                xy_type += 1;
             }
-            if(maxCol == text_width){
-                xy_type+=1;
+            if (maxCol == text_width) {
+                xy_type += 1;
             }
-        }else{ // 区域外
-            if(maxCol == x_width ){
-                index_state =  true ;
-                xy_type+=1;
+        } else { // 区域外
+            if (maxCol == x_width) {
+                index_state = true;
+                xy_type += 1;
             }
         }
-        return xy_type+","+index_state+","+width;
+        return xy_type + "," + index_state + "," + width;
     }
 
     // 获取解析样式
-    public static   Map<String ,String > getHtmlStyle(Document doc){
-        Map<String ,String > styleMap = new HashMap<>();
+    public static Map<String, String> getHtmlStyle(Document doc) {
+        Map<String, String> styleMap = new HashMap<>();
         Element style = doc.select("style").first();
         Matcher cssMatcher = Pattern.compile("(\\w+)\\s*[{]([^}]+)[}]").matcher(style.html());
         while (cssMatcher.find()) {
-            styleMap.put(cssMatcher.group(1),cssMatcher.group(2));
+            styleMap.put(cssMatcher.group(1), cssMatcher.group(2));
         }
         return styleMap;
     }