Преглед на файлове

Merge remote-tracking branch 'origin/dev2' into dev2

lwhhszx преди 2 години
родител
ревизия
854d2d054f
променени са 26 файла, в които са добавени 326 реда и са изтрити 250 реда
  1. 4 0
      PAS/src/main/java/cn/cslg/pas/common/model/dto/QueryTaskDTO.java
  2. 10 0
      PAS/src/main/java/cn/cslg/pas/common/model/dto/TaskWebSocketDTO.java
  3. 4 0
      PAS/src/main/java/cn/cslg/pas/common/model/vo/ProjectImportPatentVO.java
  4. 8 0
      PAS/src/main/java/cn/cslg/pas/common/model/vo/QueryTaskVO.java
  5. 1 0
      PAS/src/main/java/cn/cslg/pas/common/model/vo/UploadParamsVO.java
  6. 35 26
      PAS/src/main/java/cn/cslg/pas/common/utils/PatentRightUtils.java
  7. 15 6
      PAS/src/main/java/cn/cslg/pas/common/utils/ReadExcelUtils.java
  8. 7 0
      PAS/src/main/java/cn/cslg/pas/controller/TaskController.java
  9. 12 12
      PAS/src/main/java/cn/cslg/pas/service/PatentRightService.java
  10. 1 3
      PAS/src/main/java/cn/cslg/pas/service/ProjectService.java
  11. 29 27
      PAS/src/main/java/cn/cslg/pas/service/TaskService.java
  12. 7 4
      PAS/src/main/java/cn/cslg/pas/service/impl/ProductServiceImpl.java
  13. 12 16
      PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/ExcutePatentDataStar.java
  14. 1 0
      PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/MessageService.java
  15. 38 15
      PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/PantentQueueService.java
  16. 16 23
      PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/UploadTaskService.java
  17. 13 5
      PAS/src/main/resources/mapper/TaskMapper.xml
  18. 0 38
      PAS/src/test/java/cn/cslg/pas/domain/FileSource.java
  19. 0 35
      PAS/src/test/java/cn/cslg/pas/mapper/AssoProductPatentMapperTests.java
  20. 0 40
      PAS/src/test/java/cn/cslg/pas/service/ProductServiceImplTests.java
  21. 113 0
      PAS/src/test/java/cn/cslg/pas/service/TextExcelTests.java
  22. BIN
      单元测试用例专用文件/1件CN专利 - 单元格行数不大于1.XLSX
  23. BIN
      单元测试用例专用文件/1件CN专利 - 抬头没有公开公告号.XLSX
  24. BIN
      单元测试用例专用文件/1件CN专利 - 抬头没有申请号.XLSX
  25. BIN
      单元测试用例专用文件/1件CN专利.XLSX
  26. BIN
      单元测试用例专用文件/FTO风险排查报告用户操作手册.pptx

+ 4 - 0
PAS/src/main/java/cn/cslg/pas/common/model/dto/QueryTaskDTO.java

@@ -24,6 +24,10 @@ public class QueryTaskDTO extends PageDTO2 implements Serializable {
      */
     private Integer reportId;
     /**
+     * 产品id
+     */
+    private Integer productId;
+    /**
      * 创建人名称
      */
     private String createName;

+ 10 - 0
PAS/src/main/java/cn/cslg/pas/common/model/dto/TaskWebSocketDTO.java

@@ -6,8 +6,18 @@ import lombok.experimental.Accessors;
 @Data
 @Accessors(chain = true)
 public class TaskWebSocketDTO {
+    /**
+     * 专题库id
+     */
     private Integer projectId;
+    /**
+     * 报告id
+     */
     private Integer reportId;
+    /**
+     * 产品id
+     */
+    private Integer productId;
     private Integer total;
     private Integer index;
     private Integer taskId;

+ 4 - 0
PAS/src/main/java/cn/cslg/pas/common/model/vo/ProjectImportPatentVO.java

@@ -19,6 +19,10 @@ public class ProjectImportPatentVO {
      * 报告id
      */
     private Integer reportId;
+    /**
+     * 产品id
+     */
+    private Integer productId;
 
     private Integer asCompare;
     /**

+ 8 - 0
PAS/src/main/java/cn/cslg/pas/common/model/vo/QueryTaskVO.java

@@ -41,6 +41,10 @@ public class QueryTaskVO implements Serializable {
      */
     private Integer reportId;
     /**
+     * 产品id
+     */
+    private Integer productId;
+    /**
      * 专利总数量
      */
     private Integer total;
@@ -154,6 +158,10 @@ public class QueryTaskVO implements Serializable {
      * 报告名称
      */
     private String reportName;
+    /**
+     * 产品名称
+     */
+    private String productName;
 
     //以下属性是两张表都没有的(值为:任务表使用的oldName、任务条件表由手动装载生成)
     /**

+ 1 - 0
PAS/src/main/java/cn/cslg/pas/common/model/vo/UploadParamsVO.java

@@ -13,6 +13,7 @@ import java.util.List;
  * @date 2022/7/1
  * @description 用于批量导入数据的工具类
  */
+@Accessors(chain = true)
 @Data
 public class UploadParamsVO {
     /**

+ 35 - 26
PAS/src/main/java/cn/cslg/pas/common/utils/PatentRightUtils.java

@@ -28,19 +28,19 @@ public class PatentRightUtils {
             //译文
             String contentOut = params.getContentOut();
 
-            //创建一个权要集合用于返回结果
+            //创建一个权要集合
             ArrayList<PatentRight> patentRights = new ArrayList<>();
 
-            //若原文为null或空串,则直接结束并返回空集合;
+            //若原文为null或空串,则直接结束并返回空集合;若译文为null,则置为空串
             if (content == null || content.equals("")) {
                 return patentRights;
             }
-            //若译文为null,则置为空串
+
             if (contentOut == null) {
                 contentOut = "";
             }
 
-            //将原文和译文的所有换行符 "\r\n"或是"\n" 替换成 "@"(先使得全文连在一起,再根据特殊符号@拆分权要)
+            //将原文和译文的所有换行符 "\r\n"或是"\n" 替换成 "@",这样首先可以使得全文连在一起,其次再根据特殊符号@拆分权要
             if (content.contains("\r\n")) {
                 content = content.replaceAll("\r\n", "@");
             }
@@ -62,13 +62,13 @@ public class PatentRightUtils {
             if (country.equals("CN") || country.equals("JP") || country.equals("KR") || content.contains("权利要求")) {
                 String regex;
                 if (content.contains("@2")) {
-                    regex = "@[1-9]+";
+                    regex = "@[0-9]+";
                 } else if (content.contains("@[00")) {
                     regex = "@\\[[0-9]+]";
                 } else if (content.contains("@請求項")) {
-                    regex = "@【請求項[1-9]+】";
+                    regex = "@【請求項[0-9]+】";
                 } else if (content.contains("@청구항")) {
-                    regex = "@청구항 [1-9]+";
+                    regex = "@청구항 [0-9]+";
                 } else {
                     regex = "";
                 }
@@ -183,8 +183,8 @@ public class PatentRightUtils {
                 }
 
                 String regex;
-                if (content.contains("@")) {
-                    regex = "@[1-9]+";
+                if (content.contains("@2")) {
+                    regex = "@[0-9]+";
                 } else if (content.contains("[001]")) {
                     regex = "\\[[0-9]+]";
                 } else {
@@ -192,7 +192,7 @@ public class PatentRightUtils {
                 }
 
                 Matcher matcher = Pattern.compile(regex).matcher(content);
-                Matcher matcherOut = Pattern.compile("@[0-9]+").matcher(contentOut);
+                Matcher matcherOut = Pattern.compile(regex).matcher(contentOut);
                 while (matcher.find()) {
                     content = content.replaceFirst(matcher.group(), "\n" + matcher.group().substring(matcher.group().indexOf("@") + 1));
                 }
@@ -258,11 +258,13 @@ public class PatentRightUtils {
                                     .setContent(strs[i])
                                     .setSort(i)
                                     .setParentSort((Integer.parseInt(parentNum) - 1) + "");
-                            //当翻译的长度大于原文权要的长度时,将剩下所有的译文给最后一条原文
-                            if (strsOut.length > strs.length && strs.length == (i + 1)) {
-                                patentRight.setContentOut(String.join(" ", Arrays.copyOfRange(strsOut, i, strsOut.length)));
-                            } else {
-                                patentRight.setContentOut(strsOut[i]);
+                            if (strsOut.length - 1 >= i) {
+                                //当翻译的长度大于原文权要的长度时,将剩下所有的译文给最后一条原文
+                                if (strsOut.length > strs.length && strs.length == (i + 1)) {
+                                    patentRight.setContentOut(String.join(" ", Arrays.copyOfRange(strsOut, i, strsOut.length)));
+                                } else {
+                                    patentRight.setContentOut(strsOut[i]);
+                                }
                             }
                             patentRights.add(patentRight);
                         } else if (matcher3.find()) {
@@ -279,11 +281,13 @@ public class PatentRightUtils {
                                     .setContent(strs[i])
                                     .setSort(i)
                                     .setParentSort(builder.substring(0, builder.lastIndexOf(",")));
-                            //当翻译的长度大于原文权要的长度时,将剩下所有的译文给最后一条原文
-                            if (strsOut.length > strs.length && strs.length == (i + 1)) {
-                                patentRight.setContentOut(String.join(" ", Arrays.copyOfRange(strsOut, i, strsOut.length)));
-                            } else {
-                                patentRight.setContentOut(strsOut[i]);
+                            if (strsOut.length - 1 >= i) {
+                                //当翻译的长度大于原文权要的长度时,将剩下所有的译文给最后一条原文
+                                if (strsOut.length > strs.length && strs.length == (i + 1)) {
+                                    patentRight.setContentOut(String.join(" ", Arrays.copyOfRange(strsOut, i, strsOut.length)));
+                                } else {
+                                    patentRight.setContentOut(strsOut[i]);
+                                }
                             }
                             patentRights.add(patentRight);
                         }
@@ -295,11 +299,13 @@ public class PatentRightUtils {
                                 .setContent(strs[i])
                                 .setSort(i)
                                 .setParentSort("-1");
-                        //当翻译的长度大于原文权要的长度时,将剩下所有的译文给最后一条原文
-                        if (strsOut.length > strs.length && strs.length == (i + 1)) {
-                            patentRight.setContentOut(String.join(" ", Arrays.copyOfRange(strsOut, i, strsOut.length)));
-                        } else {
-                            patentRight.setContentOut(strsOut[i]);
+                        if (strsOut.length - 1 >= i) {
+                            //当翻译的长度大于原文权要的长度时,将剩下所有的译文给最后一条原文
+                            if (strsOut.length > strs.length && strs.length == (i + 1)) {
+                                patentRight.setContentOut(String.join(" ", Arrays.copyOfRange(strsOut, i, strsOut.length)));
+                            } else {
+                                patentRight.setContentOut(strsOut[i]);
+                            }
                         }
                         patentRights.add(patentRight);
                     }
@@ -308,7 +314,10 @@ public class PatentRightUtils {
 
             return patentRights;
         } catch (Exception e) {
-            return new ArrayList<>();
+            e.printStackTrace();
+            ArrayList<PatentRight> patentRights = new ArrayList<>();
+            patentRights.add(new PatentRight().setPatentId(params.getPatentId()).setContent(params.getContent()).setContentOut(params.getContentOut()).setType(1).setSort(0).setParentSort("-1"));
+            return patentRights;
         }
     }
 

+ 15 - 6
PAS/src/main/java/cn/cslg/pas/common/utils/ReadExcelUtils.java

@@ -3,10 +3,7 @@ package cn.cslg.pas.common.utils;
 import cn.cslg.pas.domain.PatentData;
 import org.apache.poi.hssf.usermodel.*;
 import org.apache.poi.ooxml.POIXMLDocumentPart;
-import org.apache.poi.ss.usermodel.PictureData;
-import org.apache.poi.ss.usermodel.Row;
-import org.apache.poi.ss.usermodel.Sheet;
-import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.xssf.usermodel.*;
 import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker;
 import org.springframework.stereotype.Service;
@@ -61,9 +58,21 @@ public class ReadExcelUtils {
             ThrowException.throwXiaoShiException("文件内容格式不正确,请检查总行数是否有专利内容");
         }
 
+        //获取第一行抬头
         Row firstRow = sheet.getRow(0);
-        if (!firstRow.getCell(0).getStringCellValue().equals("公开(公告)号")) {
-            ThrowException.throwXiaoShiException("文件内容格式不正确,第一列应为【公开(公告)号】");
+        boolean flag1 = false;  //是否有 "公开(公告)号"
+        boolean flag2 = false;  //是否有 "申请号"
+        //遍历第一行单元格抬头
+        for (Cell cell : firstRow) {
+            if (cell.getStringCellValue().equals("公开(公告)号")) {
+                flag1 = true;
+            }
+            if (cell.getStringCellValue().equals("申请号")) {
+                flag2 = true;
+            }
+        }
+        if (!flag1 || !flag2) {
+            ThrowException.throwXiaoShiException("文件内容格式不正确,第一行抬头必须有【公开(公告)号】和【申请号】");
         }
 
         //返回文件总行数-1(即专利总数量)

+ 7 - 0
PAS/src/main/java/cn/cslg/pas/controller/TaskController.java

@@ -115,6 +115,13 @@ public class TaskController {
         return taskService.delete(id);
     }
 
+    @Operation(summary = "删除报告的所有任务(供报告系统调用)")
+    @GetMapping("/deleteReportTasks")
+    public String deleteReportTasks(Integer reportId) {
+        taskService.deleteReportTasks(reportId);
+        return Response.success();
+    }
+
     @GetMapping("queue")
     @Operation(summary = "获取进行中的任务")
     public String getQueueList(Integer type, Integer projectId, Integer productId) {

+ 12 - 12
PAS/src/main/java/cn/cslg/pas/service/PatentRightService.java

@@ -45,18 +45,18 @@ public class PatentRightService extends ServiceImpl<PatentRightMapper, PatentRig
         LambdaQueryWrapper<PatentRight> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(PatentRight::getPatentId, patentId);
         queryWrapper.orderByAsc(PatentRight::getSort);
-        List<PatentRight> patentRights = this.list(queryWrapper);
-        if (patentRights != null && patentRights.size() > 0) {
-            PatentRight patentRight = patentRights.get(0);
-            //创建PatentRightParams对象保存权要基本信息
-            PatentRightParams patentRightParams = new PatentRightParams();
-            patentRightParams.setPatentId(patentId);  //装载专利id
-            patentRightParams.setPatentNo(patentService.getById(patentId).getPatentNo());
-            patentRightParams.setContent(patentRight.getContent());  //装载权利要求原文
-            patentRightParams.setContentOut(patentRight.getContentOut());  //装载权利要求译文
-            patentRights = PatentRightUtils.formatPatentRight(patentRightParams);
-            return patentRights;
-        }
+//        List<PatentRight> patentRights = this.list(queryWrapper);
+//        if (patentRights != null && patentRights.size() > 0) {
+//            PatentRight patentRight = patentRights.get(0);
+//            //创建PatentRightParams对象保存权要基本信息
+//            PatentRightParams patentRightParams = new PatentRightParams();
+//            patentRightParams.setPatentId(patentId);  //装载专利id
+//            patentRightParams.setPatentNo(patentService.getById(patentId).getPatentNo());
+//            patentRightParams.setContent(patentRight.getContent());  //装载权利要求原文
+//            patentRightParams.setContentOut(patentRight.getContentOut());  //装载权利要求译文
+//            patentRights = PatentRightUtils.formatPatentRight(patentRightParams);
+//            return patentRights;
+//        }
         return this.list(queryWrapper);
     }
 

+ 1 - 3
PAS/src/main/java/cn/cslg/pas/service/ProjectService.java

@@ -532,9 +532,6 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
 
     @Transactional
     public String delete(Integer id) {
-        //专题库表删除数据
-        log.info("专题库表删除数据");
-        this.removeById(id);
         this.deleteProjectUser(id, loginUtils.getId());
         projectPatentLinkService.deleteByProjectId(id);
         projectFolderService.deleteByProjectId(id);
@@ -553,6 +550,7 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
         if (taskConditionIds.size() > 0) {
             taskConditionService.removeByIds(taskConditionIds);
         }
+        this.removeById(id);
 
         return Response.success();
     }

+ 29 - 27
PAS/src/main/java/cn/cslg/pas/service/TaskService.java

@@ -10,14 +10,14 @@ import cn.cslg.pas.common.model.vo.*;
 import cn.cslg.pas.common.utils.*;
 import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
 
-import cn.cslg.pas.domain.Personnel;
-import cn.cslg.pas.domain.Project;
-import cn.cslg.pas.domain.Report;
-import cn.cslg.pas.domain.Task;
+import cn.cslg.pas.domain.*;
+import cn.cslg.pas.domain.asso.AssoProductPatent;
 import cn.cslg.pas.domain.asso.TaskCondition;
 import cn.cslg.pas.mapper.TaskMapper;
 import cn.cslg.pas.common.model.dto.UploadFileDTO;
+import cn.cslg.pas.service.asso.AssoProductPatentService;
 import cn.cslg.pas.service.asso.TaskConditionService;
+import cn.cslg.pas.service.impl.ProductServiceImpl;
 import cn.cslg.pas.service.upLoadPatent.*;
 
 import cn.hutool.core.io.FileUtil;
@@ -65,6 +65,7 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
     private final TaskConditionService taskConditionService;
     private final ProjectService projectService;
     private final ReportService reportService;
+    private final ProductServiceImpl productService;
     private final JobService jobService;
     private final TaskMapper taskMapper;
 
@@ -136,6 +137,9 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
         } else if (projectImportPatentVO.getProjectId() == null && projectImportPatentVO.getReportId() != null) {
             //若是和报告关联
             task.setReportId(projectImportPatentVO.getReportId());
+        } else if (projectImportPatentVO.getProductId() != null) {
+            //若是和产品关联
+            task.setProductId(projectImportPatentVO.getProductId());
         }
         //文件名称
         task.setFileName(fileDTO.getFileName());
@@ -188,6 +192,9 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
         } else if (taskAddNewDTO.getProjectId() == null && taskAddNewDTO.getReportId() != null) {
             //报告id
             task.setReportId(taskAddNewDTO.getReportId());
+        } else if (taskAddNewDTO.getProductId() != null) {
+            //产品id
+            task.setProductId(taskAddNewDTO.getProductId());
         }
         //专利总数量
         task.setTotal(total);
@@ -235,6 +242,10 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
         return Response.success(true);
     }
 
+    public void deleteReportTasks(Integer reportId) {
+        this.remove(new LambdaQueryWrapper<Task>().eq(Task::getReportId, reportId));
+    }
+
     public void deleteTask(Integer taskId) {
         log.info("开始处理【删除任务】的业务,参数为:id={}", taskId);
 
@@ -322,7 +333,7 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
                 }
             }
 
-            //装载任务名称(专利号/检索式 导入到 某某 专题库/报告中)
+            //装载任务名称(专利号/检索式 导入到 某某 专题库/报告中/产品
             if (queryTaskDTO.getProjectId() != null) {  //若当前查询是查询所有导入专题库的任务,则装载专题库名称
                 List<Integer> projectIds = tasks.stream().map(QueryTaskVO::getProjectId).collect(Collectors.toList());
                 List<Project> projects = projectService.list(new LambdaQueryWrapper<Project>().in(Project::getId, projectIds));
@@ -345,6 +356,16 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
                         }
                     });
                 });
+            } else if (queryTaskDTO.getProductId() != null) {  //若当前查询是查询所有导入产品的任务,则装载报告名称
+                List<Integer> productIds = tasks.stream().map(QueryTaskVO::getProductId).collect(Collectors.toList());
+                List<Product> products = productService.list(new LambdaQueryWrapper<Product>().in(Product::getId, productIds));
+                tasks.forEach(task -> {
+                    products.forEach(product -> {
+                        if (task.getProductId().equals(product.getId())) {
+                            task.setProductName(product.getProductName());
+                        }
+                    });
+                });
             }
 
             for (QueryTaskVO task : tasks) {
@@ -365,6 +386,9 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
                 } else if (task.getReportName() != null) {
                     to = "报告";
                     toName = task.getReportName();
+                } else if (task.getProductName() != null) {
+                    to = "产品";
+                    toName = task.getProductName();
                 }
                 if (task.getType().equals(2)) {  //导出任务
                     taskName = to + "【" + toName + "】导出 - " + task.getCreateName();
@@ -372,28 +396,6 @@ public class TaskService extends ServiceImpl<TaskMapper, Task> implements ITaskS
                     taskName = type + "导入到" + to + "【" + toName + "】 - " + task.getCreateName();
                 }
                 task.setTaskName(taskName);
-//                if (task.getType().equals(5)) {  //若是专利号导入任务
-//                    if (task.getProjectName() != null) {  //专题库
-//                        taskName = "专利号导入到专题库【" + task.getProjectName() + "】中 - " + task.getCreateName();
-//                    } else if (task.getReportName() != null) {  //报告
-//                        taskName = "专利号导入到报告【" + task.getReportName() + "】中 - " + task.getCreateName();
-//                    }
-//                    task.setTaskName(taskName);
-//                } else if (task.getType().equals(3) || task.getType().equals(4)) {  //若是检索式导入(欧专局或专利之星)
-//                    if (task.getProjectName() != null) {
-//                        taskName = "检索式导入到专题库【" + task.getProjectName() + "】中 - " + task.getCreateName();
-//                    } else if (task.getReportName() != null) {
-//                        taskName = "检索式导入到报告【" + task.getReportName() + "】中 - " + task.getCreateName();
-//                    }
-//                    task.setTaskName(taskName);
-//                } else if (task.getType().equals(2)) {  //若是导出
-//                    if (task.getProjectName() != null) {
-//                        taskName = "专题库【" + task.getProjectName() + "】导出 - " + task.getCreateName();
-//                    } else if (task.getReportName() != null) {
-//                        taskName = "报告【" + task.getReportName() + "】导出 - " + task.getCreateName();
-//                    }
-//                    task.setTaskName(taskName);
-//                }
 
             }
         }

+ 7 - 4
PAS/src/main/java/cn/cslg/pas/service/impl/ProductServiceImpl.java

@@ -11,6 +11,7 @@ import cn.cslg.pas.common.utils.ThrowException;
 import cn.cslg.pas.domain.Product;
 import cn.cslg.pas.domain.ProductMarketData;
 import cn.cslg.pas.domain.Structure;
+import cn.cslg.pas.domain.Task;
 import cn.cslg.pas.domain.asso.AssoProductPatent;
 import cn.cslg.pas.domain.asso.AssoProductPicture;
 import cn.cslg.pas.domain.asso.AssoStructurePatent;
@@ -21,10 +22,7 @@ import cn.cslg.pas.mapper.asso.AssoProductPictureMapper;
 import cn.cslg.pas.mapper.ProductMapper;
 import cn.cslg.pas.mapper.asso.AssoProductPatentMapper;
 import cn.cslg.pas.mapper.asso.AssoStructurePatentMapper;
-import cn.cslg.pas.service.IAssoStructurePictureService;
-import cn.cslg.pas.service.IProductMarketDataService;
-import cn.cslg.pas.service.IProductService;
-import cn.cslg.pas.service.IStructureService;
+import cn.cslg.pas.service.*;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.PageHelper;
@@ -59,9 +57,11 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
     private final IStructureService structureService;
     private final IAssoStructurePictureService assoStructurePictureService;
     private final IProductMarketDataService productMarketDataService;
+    private final TaskService taskService;
     private final CacheUtils cacheUtils;
     private final LoginUtils loginUtils;
     private final FileUtils fileUtils;
+
     /**
      * 新增产品
      *
@@ -331,6 +331,9 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
         log.info("产品的营销数据表删除数据");
         productMarketDataService.remove(wrapper2);
 
+        //删除产品的所有任务
+        taskService.remove(new LambdaQueryWrapper<Task>().eq(Task::getProductId, id));
+
         //删除产品数据
         log.info("产品表删除数据");
         int rows = productMapper.deleteById(id);

+ 12 - 16
PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/ExcutePatentDataStar.java

@@ -1,6 +1,5 @@
 package cn.cslg.pas.service.upLoadPatent;
 
-import cn.cslg.pas.common.model.dto.PatentDTO;
 import cn.cslg.pas.common.model.dto.UploadFileDTO;
 import cn.cslg.pas.common.model.outApi.PatentStarListDto;
 import cn.cslg.pas.common.model.vo.KeyValueVO;
@@ -10,11 +9,11 @@ import cn.cslg.pas.common.utils.FileUtils;
 import cn.cslg.pas.common.utils.RemoveHtmlTagsUtils;
 import cn.cslg.pas.common.utils.ThrowException;
 import cn.cslg.pas.domain.*;
-import cn.cslg.pas.domain.asso.TaskCondition;
+import cn.cslg.pas.service.OutInterfaceService;
+import cn.cslg.pas.service.PatentService;
 import cn.cslg.pas.service.TaskService;
 import cn.cslg.pas.service.UploadPatentBatchService;
 import cn.cslg.pas.service.asso.TaskConditionService;
-import cn.cslg.pas.service.getPatentStarPart.GetPatentStarPartService;
 import cn.cslg.pas.service.outApi.PatentStarApiService;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson2.JSONObject;
@@ -29,14 +28,12 @@ import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.commons.CommonsMultipartFile;
 
 import java.io.*;
-import java.net.MalformedURLException;
 import java.net.URL;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-import java.util.stream.Collectors;
 
 /**
  * 专利之星类型任务解析获取专利类
@@ -55,6 +52,9 @@ public class ExcutePatentDataStar implements IExcutePatentData {
     private final TaskService taskService;
     private final TaskConditionService taskConditionService;
     private final QuestionRecordService questionRecordService;
+    private final PatentService patentService;
+    private final UploadPatentToDBService uploadPatentToDBService;
+    private final OutInterfaceService outInterfaceService;
     private Integer pTaskId = 0;
     private Integer pTaskStatus = 0;
 
@@ -313,17 +313,17 @@ public class ExcutePatentDataStar implements IExcutePatentData {
                 }
             }
 
-            //下载isAdd中的专利 / 下载多个专利号导入接口的专利
+            //下载 isAdd中的专利/多个专利号导入的专利
             if (isAddPatentNos != null && isAddPatentNos.size() > 0) {
-                //判断isAdd中的多个专利号或申请号,即判断是检索页面手动勾选的多个专利下载/还是多个专利号导入的下载任务
+                String patentNoCondition = StringUtils.join(isAddPatentNos, " OR ");
+                //若是多个专利号导入的下载
                 if (task.getIsAddType() != null && task.getIsAddType().equals(2)) {
-                    //若是多个专利号导入的下载
-                    String patentNoCondition = StringUtils.join(isAddPatentNos, " OR ");
                     conditions = "AN=(" + patentNoCondition + ") OR PN=(" + patentNoCondition + ") OR GN=(" + patentNoCondition + ")";
                     downLoadIsAddPatentNos(isAddPatentNos, task, orderBy, orderByType, dbType, cells, conditions);
-                } else {
                     //若是检索页面手动勾选的多个专利的下载
-                    downLoadIsAddPatentNos(isAddPatentNos, task, orderBy, orderByType, dbType, cells, null);
+                } else {
+                    conditions = "AN=(" + patentNoCondition + ")";
+                    downLoadIsAddPatentNos(isAddPatentNos, task, orderBy, orderByType, dbType, cells, conditions);
                 }
             }
 
@@ -632,7 +632,7 @@ public class ExcutePatentDataStar implements IExcutePatentData {
         try {
             if (starPatent.getPatentNo() != null && !starPatent.getPatentNo().equals("")) {
                 String familyPatentNoStr = patentStarApiService.getFamilyByPubNoApi(usedPatentNo);
-                if (!familyPatentNoStr.equals("no data") && !familyPatentNoStr.equals("{}")) {
+                if (!familyPatentNoStr.equals("no data") && !familyPatentNoStr.equals("{}") && !familyPatentNoStr.trim().equals("")) {
                     FamilyPatentNo familyPatentNo = JSON.parseObject(familyPatentNoStr, FamilyPatentNo.class);
                     List<String> familyPatentNos = Arrays.asList(familyPatentNo.getFamilyinfo().split(";"));
                     uploadParamsVO.setSimpleFamily(familyPatentNos);
@@ -927,10 +927,6 @@ public class ExcutePatentDataStar implements IExcutePatentData {
      * @param isAddPatentNos 起止条数以外,用户手动勾选的多个专利号
      */
     public void downLoadIsAddPatentNos(List<String> isAddPatentNos, Task task, String orderBy, String orderByType, String dbType, List<String> cells, String conditions) throws IOException {
-        if (conditions == null) {
-            conditions = "AN=(" + StringUtils.join(isAddPatentNos, " OR ") + ")";
-        }
-
         int pageNum = 1;
         for (int i = 0; i < isAddPatentNos.size(); i += 50) {
             PatentStarListDto patentStarListDto = new PatentStarListDto()

+ 1 - 0
PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/MessageService.java

@@ -36,6 +36,7 @@ public class MessageService {
                 .setTaskStatus(task.getStatus())
                 .setProjectId(task.getProjectId())
                 .setReportId(task.getReportId())
+                .setProductId(task.getProductId())
                 .setComplete(flag)
                 .setIndex(i)
                 .setTaskType(task.getType())

+ 38 - 15
PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/PantentQueueService.java

@@ -6,12 +6,14 @@ import cn.cslg.pas.common.utils.DateUtils;
 import cn.cslg.pas.common.utils.JsonUtils;
 import cn.cslg.pas.common.utils.StringUtils;
 import cn.cslg.pas.domain.*;
+import cn.cslg.pas.domain.asso.AssoProductPatent;
 import cn.cslg.pas.domain.asso.TaskCondition;
 import cn.cslg.pas.mapper.QuestionRecordMapper;
 import cn.cslg.pas.service.OutInterfaceService;
 import cn.cslg.pas.service.PatentInstructionService;
 import cn.cslg.pas.service.TaskService;
 import cn.cslg.pas.service.UploadPatentBatchService;
+import cn.cslg.pas.service.asso.AssoProductPatentService;
 import cn.cslg.pas.service.asso.TaskConditionService;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import lombok.RequiredArgsConstructor;
@@ -19,7 +21,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
-import java.util.*;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
@@ -44,6 +50,7 @@ public class PantentQueueService {
     private final PatentInstructionService patentInstructionService;
     private final OutInterfaceService outInterfaceService;
     private final QuestionRecordService questionRecordService;
+    private final AssoProductPatentService assoProductPatentService;
     private final QuestionRecordMapper questionRecordMapper;
     private final List<Integer> taskQueueList = new ArrayList<>();
     private final List<PQueueData> setPatentImageQueueList = new ArrayList<>();
@@ -382,19 +389,6 @@ public class PantentQueueService {
                     queueData = patentZhuluQueueList.remove(0);
                     //著录项目入库
                     uploadPatentToDBService.uploadPatentZhulu(queueData.getUploadParamsVO());
-                    //判断是与专题库关联还是与报告关联
-                    if (queueData.getTask().getProjectId() != null && !queueData.getTask().getProjectId().equals(0)) {
-                        //与专题库关联入库
-                        uploadPatentToDBService.uploadAssoThemaPat(queueData.getUploadParamsVO(), queueData.getTask().getProjectId());
-                    } else if (queueData.getTask().getReportId() != null && !queueData.getTask().getReportId().equals(0)) {
-                        //与报告关联入库(调用报告系统接口)
-                        ImportTaskPatent importTaskPatent = new ImportTaskPatent();
-                        importTaskPatent.setImportTaskId(queueData.getTask().getId());
-                        importTaskPatent.setPatentNo(queueData.getUploadParamsVO().getPatent().getPatentNo());
-                        importTaskPatent.setReportId(queueData.getTask().getReportId());
-                        importTaskPatent.insert();
-                        outInterfaceService.importAssoReportPatentNo(queueData.getTask().getReportId(), queueData.getUploadParamsVO().getPatent().getPatentNo(), queueData.getUploadParamsVO().getPatent().getName(), queueData.getTask().getAsCompare());
-                    }
                     if (queueData.getTask().getPramJson() != null && !queueData.getTask().getPramJson().equals("")) {
                         ProjectImportPatentVO projectImportPatentVO = JsonUtils.jsonToPojo(queueData.getTask().getPramJson(), ProjectImportPatentVO.class);
                         //自定义字段标引与专利关联入库
@@ -563,7 +557,7 @@ public class PantentQueueService {
             String currentPatent = task.getId() + "|" + queueData.getUploadParamsVO().getPatent().getId();
             Integer num = patentIdMap.get(currentPatent);
             int needNum = 3;  //临界默认设为4(即Excel导入任务默认使用5个消费者)
-            if (task.getType().equals(3) || task.getType().equals(4)) {  //若是网站导入任务,则临界默认设为下载字段类型数量 - 1
+            if (task.getType().equals(3) || task.getType().equals(4) || task.getType().equals(5)) {  //若是网站导入任务,则临界默认设为下载字段类型数量 - 1
                 needNum = task.getConfigCellsNum() - 1;
             }
             if (num == null && needNum > 0) {
@@ -578,6 +572,35 @@ public class PantentQueueService {
                     taskService.updateById(task);
                 }
                 patentIdMap.remove(currentPatent);
+
+                //与专题库/报告/产品关联
+                if (queueData.getTask().getProjectId() != null && !queueData.getTask().getProjectId().equals(0)) {
+                    //与专题库关联入库
+                    uploadPatentToDBService.uploadAssoThemaPat(queueData.getUploadParamsVO(), queueData.getTask().getProjectId());
+                } else if (queueData.getTask().getReportId() != null && !queueData.getTask().getReportId().equals(0)) {
+                    //与报告关联入库(调用报告系统接口)
+                    ImportTaskPatent importTaskPatent = new ImportTaskPatent();
+                    importTaskPatent.setImportTaskId(queueData.getTask().getId());
+                    importTaskPatent.setPatentNo(queueData.getUploadParamsVO().getPatent().getPatentNo());
+                    importTaskPatent.setReportId(queueData.getTask().getReportId());
+                    importTaskPatent.insert();
+                    try {
+                        outInterfaceService.importAssoReportPatentNo(queueData.getTask().getReportId(), queueData.getUploadParamsVO().getPatent().getPatentNo(), queueData.getUploadParamsVO().getPatent().getName(), queueData.getTask().getAsCompare());
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    }
+                } else if (queueData.getTask().getProductId() != null) {
+                    //与产品关联入库(调用报告系统接口)
+                    List<AssoProductPatent> assoProductPatents = assoProductPatentService.list(new LambdaQueryWrapper<AssoProductPatent>().eq(AssoProductPatent::getProductId, queueData.getTask().getProductId()).eq(AssoProductPatent::getPatentNo, queueData.getUploadParamsVO().getPatent().getPatentNo()));
+                    if (assoProductPatents == null || assoProductPatents.size() == 0) {
+                        AssoProductPatent assoProductPatent = new AssoProductPatent()
+                                .setProductId(queueData.getTask().getProductId())
+                                .setPatentNo(queueData.getUploadParamsVO().getPatent().getPatentNo());
+                        assoProductPatentService.save(assoProductPatent);
+                    }
+                }
+
+
                 //任务表更新 完成条数+1
                 task.setSuccessNum(task.getSuccessNum() + 1);
                 //根据专利号查询专利是否有导入失败记录

+ 16 - 23
PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/UploadTaskService.java

@@ -6,12 +6,16 @@ import cn.cslg.pas.common.model.dto.UploadFileDTO;
 import cn.cslg.pas.common.model.outApi.PatentStarListDto;
 import cn.cslg.pas.common.utils.*;
 import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
-import cn.cslg.pas.domain.*;
+import cn.cslg.pas.domain.Project;
+import cn.cslg.pas.domain.SerachBiblioData;
+import cn.cslg.pas.domain.WebLoginConfig;
 import cn.cslg.pas.domain.asso.TaskCondition;
-import cn.cslg.pas.service.*;
+import cn.cslg.pas.service.PatentService;
+import cn.cslg.pas.service.ProjectService;
+import cn.cslg.pas.service.TaskService;
+import cn.cslg.pas.service.WebLoginConfigService;
 import cn.cslg.pas.service.asso.TaskConditionService;
 import cn.cslg.pas.service.outApi.PatentStarApiService;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.context.annotation.Lazy;
@@ -23,7 +27,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
-import java.util.function.Function;
 
 /**
  * 导入专利任务的业务层
@@ -116,6 +119,11 @@ public class UploadTaskService {
             total = taskAddNewDTO.getIsAddPatentNos().size();
         }
 
+        //如果是多个专利号导入,总数量改为实际检索到的数量
+        if (taskAddNewDTO.getTaskType2().equals(5)) {
+            total = (Integer) resultMap.get("total");
+        }
+
         //任务条件表("task_condition")新增数据
         TaskCondition taskCondition = new TaskCondition();
         taskCondition
@@ -210,7 +218,7 @@ public class UploadTaskService {
     }
 
     public void addPatentNoTask(TaskAddNewDTO taskAddNewDTO) throws IOException {
-        log.info("开始处理【根据专利号导入专利任务】的业务,参数为:{}", taskAddNewDTO);
+        log.info("开始处理【根据专利号导入专利】的业务,参数为:{}", taskAddNewDTO);
 
         //检查合法性
         if (taskAddNewDTO == null || taskAddNewDTO.getConditions() == null || taskAddNewDTO.getConditions().trim().equals("")) {
@@ -222,12 +230,10 @@ public class UploadTaskService {
 
         //根据专利号生成检索式
         String condition = this.setPatentNosToCondition(taskAddNewDTO.getConditions());
-        if (condition == null) {
-            ThrowException.throwXiaoShiException("尝试导入的专利号在本系统中均已存在");
-        }
         taskAddNewDTO
                 .setProjectId(taskAddNewDTO.getProjectId())
                 .setReportId(taskAddNewDTO.getReportId())
+                .setProductId(taskAddNewDTO.getProductId())
                 .setConditions(condition)
                 .setEndNumber(0)
                 .setIsAddPatentNos(Arrays.asList(isAddPatentNosStr.split("[,|,]")))
@@ -248,28 +254,15 @@ public class UploadTaskService {
             this.addPatentStarTask(taskAddNewDTO);
         }
 
-
     }
 
     public String setPatentNosToCondition(String patentNosStr) {
-        String[] patentNo = patentNosStr.split("[,|,]");
-        List<String> patentNoList = Arrays.asList(patentNo);
-        ArrayList<String> patentNos = new ArrayList<>(patentNoList);
+        String[] patentNosArr = patentNosStr.split("[,|,]");
+        ArrayList<String> patentNos = new ArrayList<>(Arrays.asList(patentNosArr));
         //判断若用户输入的多个专利号字符长度超过了一个专利号长度,而拆分后专利号集合只有一个元素,则定义为用户输入的格式不正确
         if (patentNosStr.length() > 24 && patentNos.size() == 1) {
             ThrowException.throwXiaoShiException("请按照格式要求正确输入专利号(注意:不允许出现空格)");
         }
-        //根据专利号从本数据库中查找专利
-        LambdaQueryWrapper<Patent> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.select(Patent::getPatentNo);
-        queryWrapper.in(Patent::getPatentNo, patentNos);
-        Function<Object, String> f = (o -> o.toString());
-        List<String> dbPatentNos = patentService.listObjs(queryWrapper, f);
-        //去除所有查到的专利,若没有剩余则表示要检索的这批专利在本系统数据库中都已存在
-        patentNos.removeAll(dbPatentNos);
-        if (patentNos.size() == 0) {
-            return null;
-        }
         //将本系统不包含的专利拼接成条件
         String patentNoCondition = StringUtils.join(patentNos, " OR ");
         String conditions = "AN=(" + patentNoCondition + ") OR PN=(" + patentNoCondition + ") OR GN=(" + patentNoCondition + ")";

+ 13 - 5
PAS/src/main/resources/mapper/TaskMapper.xml

@@ -37,7 +37,8 @@
     <!--List<QueryTaskVO> queryTasks(QueryTaskDTO queryTaskDTO);-->
     <select id="queryTasks" resultMap="queryTasksMap">
         select tas.id tas_id, tas.type tas_type, tas.uid tas_uid, tas.ctime tas_ctime, tas.tid tas_tid,
-        tas.report_id tas_report_id, tas.mfields tas_mfields, tas.mun tas_mun, tas.onmun tas_onmun, tas.endtime
+        tas.report_id tas_report_id, tas.product_id tas_product_id, tas.mfields tas_mfields, tas.mun tas_mun, tas.onmun
+        tas_onmun, tas.endtime
         tas_endtime,
         tas.status tas_status, tas.filename tas_filename, tas.filesize tas_filesize, tas.loadtime tas_loadtime, tas.main
         tas_main,
@@ -60,15 +61,21 @@
             <if test="reportId != null and reportId != 0">
                 and tas.report_id = #{reportId}
             </if>
-            <if test="projectId == null and reportId == null">
-                and tas.uid = #{createId}
+            <if test="productId != null and productId != 0">
+                and tas.product_id = #{productId}
             </if>
-            <if test="projectId == 0 and reportId == null">
+            <if test="projectId == 0 and reportId == null and productId == null">
                 and tas.tid != 0
             </if>
-            <if test="reportId == 0 and projectId == null">
+            <if test="reportId == 0 and projectId == null and productId == null">
                 and tas.report_id is not null
             </if>
+            <if test="productId == 0 and projectId == null and reportId == null">
+                and tas.product_id is not null
+            </if>
+            <if test="projectId == null and reportId == null">
+                and tas.uid = #{createId}
+            </if>
             <if test="personIds != null and personIds.size > 0">
                 and tas.uid in
                 <foreach collection="personIds" item="n" separator="," open="(" close=")">
@@ -109,6 +116,7 @@
         <result column="tas_ctime" property="startTime"/>
         <result column="tas_tid" property="projectId"/>
         <result column="tas_report_id" property="reportId"/>
+        <result column="tas_product_id" property="productId"/>
         <result column="tas_mun" property="total"/>
         <result column="tas_endtime" property="endTime"/>
         <result column="tas_status" property="status"/>

+ 0 - 38
PAS/src/test/java/cn/cslg/pas/domain/FileSource.java

@@ -1,38 +0,0 @@
-package cn.cslg.pas.domain;
-
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-
-/**
- * @author 沈永艺
- * @date 2022-8-12
- * @description 数据权限类 数据库对应实体
- */
-
-@Data
-@Accessors(chain = true)
-
-public class FileSource  {
-    /**
-     * 数据字典名字
-     */
-    private String patentNo;
-
-    /**
-     * 数据字典描述
-     */
-    private String pic;
-
-    /**
-     * 数据字典数据库
-     */
-    private String type;
-
-    /**
-     * 数据字典表格
-     */
-    private String url;
-
-
-}

+ 0 - 35
PAS/src/test/java/cn/cslg/pas/mapper/AssoProductPatentMapperTests.java

@@ -1,35 +0,0 @@
-package cn.cslg.pas.mapper;
-
-import cn.cslg.pas.domain.asso.AssoProductPatent;
-import cn.cslg.pas.mapper.asso.AssoProductPatentMapper;
-import lombok.extern.slf4j.Slf4j;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-/**
- * @Author chenyu
- * @Date 2023/3/16
- */
-@Slf4j
-@SpringBootTest
-public class AssoProductPatentMapperTests {
-    @Autowired
-    private AssoProductPatentMapper assoProductPatentMapper;
-
-    @Test
-    void insert() {
-        AssoProductPatent assoProductPatent = new AssoProductPatent()
-                .setPatentNo("dsadsa3213SD")
-                .setProductId(2);
-        int rows = assoProductPatentMapper.insert(assoProductPatent);
-        log.info("插入数据完成,返回受影响的行数:{}", rows);
-    }
-
-    @Test
-    void deleteByProductId() {
-        int rows = assoProductPatentMapper.deleteByProductId(2);
-        log.info("根据产品id删除数据完成,返回受影响的行数:{}", rows);
-    }
-
-}

+ 0 - 40
PAS/src/test/java/cn/cslg/pas/service/ProductServiceImplTests.java

@@ -1,40 +0,0 @@
-package cn.cslg.pas.service;
-
-import cn.cslg.pas.common.JsonPage;
-import cn.cslg.pas.common.model.dto.ProductQueryPageDTO;
-import lombok.extern.slf4j.Slf4j;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import java.util.List;
-
-/**
- * 产品的Service层接口实现类的测试类
- *
- * @Author chenyu
- * @Date 2023/3/16
- */
-@Slf4j
-@SpringBootTest
-public class ProductServiceImplTests {
-    @Autowired
-    private IProductService productService;
-
-    @Test
-    void query() {
-        ProductQueryPageDTO productQueryPageDTO = new ProductQueryPageDTO()
-                //.setProductName("手")
-                //.setCompanyName("世博")
-                //.setProductCategoryId(16)
-                .setPatentNo("CN202674151U");
-        JsonPage jsonPage = productService.query(productQueryPageDTO);
-        List<Object> list = jsonPage.getList();
-        log.info("根据专利号查询产品完成,数据信息为:");
-        for (Object o : list) {
-            log.info("{}", o);
-        }
-    }
-
-
-}

+ 113 - 0
PAS/src/test/java/cn/cslg/pas/service/TextExcelTests.java

@@ -0,0 +1,113 @@
+package cn.cslg.pas.service;
+
+import cn.cslg.pas.common.utils.ReadExcelUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.context.SpringBootTest;
+
+/**
+ * 检测文件合法性方法单元测试
+ *
+ * @Author chenyu
+ * @Date 2023/8/22
+ */
+@Slf4j
+@SpringBootTest
+public class TextExcelTests {
+    private String filePath;
+
+    /**
+     * 测试用例1:上传的文件丢失或不存在
+     */
+    @Test
+    void addNotFoundFileTask() {
+        filePath = "文件丢失或不存在路径";
+
+        try {
+            ReadExcelUtils.textExcel(filePath);
+
+        } catch (Exception e) {
+            Assertions.assertEquals("文件上传失败,服务器忙请稍后再试!", e.getMessage(), "测试用例1不通过");
+        }
+    }
+
+    /**
+     * 测试用例2:上传非Excel文件
+     */
+    @Test
+    void addNotExcelTask() {
+        filePath = ".\\单元测试用例专用文件\\FTO风险排查报告用户操作手册.pptx";
+
+        try {
+            ReadExcelUtils.textExcel(filePath);
+
+        } catch (Exception e) {
+            Assertions.assertEquals("文件格式错误,请上传Excel文件!", e.getMessage(), "测试用例2不通过");
+        }
+    }
+
+    /**
+     * 测试用例3:上传Excel文件,单元格行数 <= 1
+     */
+    @Test
+    void addRowLessThan1ExcelTask() {
+        filePath = ".\\单元测试用例专用文件\\1件CN专利 - 单元格行数不大于1.XLSX";
+
+        try {
+            ReadExcelUtils.textExcel(filePath);
+
+        } catch (Exception e) {
+            Assertions.assertEquals("文件内容格式不正确,请检查总行数是否有专利内容", e.getMessage(), "测试用例3不通过");
+        }
+    }
+
+    /**
+     * 测试用例4:上传Excel文件,抬头没有申请号
+     */
+    @Test
+    void addFalseTitleExcelTask() {
+        filePath = ".\\单元测试用例专用文件\\1件CN专利 - 抬头没有申请号.XLSX";
+
+        try {
+            ReadExcelUtils.textExcel(filePath);
+
+        } catch (Exception e) {
+            Assertions.assertEquals("文件内容格式不正确,第一行抬头必须有【公开(公告)号】和【申请号】", e.getMessage(), "测试用例4不通过");
+        }
+
+    }
+
+    /**
+     * 测试用例5:上传Excel文件,抬头没有公开公告号
+     */
+    @Test
+    void addFalseTitleExcelTask2() {
+        filePath = ".\\单元测试用例专用文件\\1件CN专利 - 抬头没有公开公告号.XLSX";
+
+        try {
+            ReadExcelUtils.textExcel(filePath);
+
+        } catch (Exception e) {
+            Assertions.assertEquals("文件内容格式不正确,第一行抬头必须有【公开(公告)号】和【申请号】", e.getMessage(), "测试用例5不通过");
+        }
+
+    }
+
+    /**
+     * 测试用例6:上传Excel文件,格式内容符合标准
+     */
+    @Test
+    void addExcelTask() {
+        filePath = ".\\单元测试用例专用文件\\1件CN专利.XLSX";
+
+        try {
+            ReadExcelUtils.textExcel(filePath);
+
+        } catch (Exception e) {
+            Assertions.assertEquals("文件内容格式不正确,第一行抬头必须有【公开(公告)号】和【申请号】", e.getMessage(), "测试用例5不通过");
+        }
+
+    }
+
+}

BIN
单元测试用例专用文件/1件CN专利 - 单元格行数不大于1.XLSX


BIN
单元测试用例专用文件/1件CN专利 - 抬头没有公开公告号.XLSX


BIN
单元测试用例专用文件/1件CN专利 - 抬头没有申请号.XLSX


BIN
单元测试用例专用文件/1件CN专利.XLSX


BIN
单元测试用例专用文件/FTO风险排查报告用户操作手册.pptx