Browse Source

20250922-生成专利申请文档

lrj 1 month ago
parent
commit
f58145b8a7
1 changed files with 30 additions and 4 deletions
  1. 30 4
      src/main/java/cn/cslg/pas/common/utils/ReadExcelUtils.java

+ 30 - 4
src/main/java/cn/cslg/pas/common/utils/ReadExcelUtils.java

@@ -56,6 +56,27 @@ public class ReadExcelUtils {
         Sheet sheet = workbook.getSheetAt(0);
         //读取总行数
         int rows = sheet.getPhysicalNumberOfRows();
+        for(int i=0;i<rows-1;i++){
+           Row row =sheet.getRow(i);
+           Boolean  ifAllNull=true;
+           if(row==null){
+               System.out.println(rows);
+               rows=i;
+               break;
+
+           }
+           for (int t=0;t<row.getLastCellNum();t++){
+               Cell cell = row.getCell(t);
+               if(cell!=null&& cell.getCellType() != CellType.BLANK){
+                   ifAllNull=false;
+                    break;
+               }
+           }
+           if(ifAllNull){
+               rows=i;
+               break;
+           }
+        }
         if (rows <= 1) {
             //删除临时文件tempFile
             fis.close();
@@ -270,19 +291,24 @@ public class ReadExcelUtils {
             if (ANOCellId != null) {
                 if (row.getCell(ANOCellId) != null) {
                     String appNo = row.getCell(ANOCellId).toString();
-                    appNos.add(appNo);
+                    if(appNo!=null&&!appNo.trim().equals("")){
+                    appNos.add(appNo);}
                 }
             }
             if (PNOCellId != null) {
                 if (row.getCell(PNOCellId) != null) {
                     String publicNo = row.getCell(PNOCellId).toString();
-                    publicNos.add(publicNo);
+                    if(publicNo!=null&&!publicNo.trim().equals("")){
+                    publicNos.add(publicNo);}
                 }
             }
             if (PANOCellId != null) {
                 if (row.getCell(PANOCellId) != null) {
-                    String patentNo = row.getCell(PANOCellId).toString();
-                    patentNos.add(patentNo);
+
+                        String patentNo = row.getCell(PANOCellId).toString();
+                    if(patentNo!=null&&!patentNo.trim().equals("")) {
+                        patentNos.add(patentNo);
+                    }
                 }
             }