chendayu il y a 2 ans
Parent
commit
f111b8477f

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

@@ -46,6 +46,10 @@ public class TaskAddNewDTO {
      */
     private List<String> isAddPatentNos;
     /**
+     * isAddPatentNos中的多个专利或申请号的下载任务类型(1.检索页面手动勾选的专利下载任务 2.多个专利号导入的下载任务)
+     */
+    private Integer isAddType;
+    /**
      * 起止条数中不需要下载的专利
      */
     private List<String> isDeletePatentNos;

+ 1 - 2
PAS/src/main/java/cn/cslg/pas/common/utils/RemoveHtmlTagsUtils.java

@@ -21,7 +21,6 @@ public class RemoveHtmlTagsUtils {
         String htmlRegex = "<[^>]+>";
         //定义空格,回车,换行符,制表符
         //String spaceRegex = "\\s*|\t|\r|\n";
-        String spaceRegex = "\\s*|\t";
         // 过滤script标签
         xmlText = xmlText.replaceAll(scriptRegex, "");
         // 过滤style标签
@@ -29,7 +28,7 @@ public class RemoveHtmlTagsUtils {
         // 过滤html标签
         xmlText = xmlText.replaceAll(htmlRegex, "");
         // 过滤空格,回车,换行符,制表符等
-        xmlText = xmlText.replaceAll(spaceRegex, "");
+        //instructionText = instructionText.replaceAll(spaceRegex, "");
         // 过滤空格&nbsp;、&nbsp、&NBSP
         xmlText = xmlText.replace("&nbsp;", "");
         xmlText = xmlText.replace("&nbsp", " ");

+ 5 - 0
PAS/src/main/java/cn/cslg/pas/domain/Task.java

@@ -199,5 +199,10 @@ public class Task extends BaseEntity<Task> {
      */
     @TableField(exist = false)
     private String continueLastInformation;
+    /**
+     * isAddPatentNos中的多个专利或申请号的下载任务类型(1.检索页面手动勾选的专利下载任务 2.多个专利号导入的下载任务)
+     */
+    @TableField(exist = false)
+    private Integer isAddType;
 
 }

+ 5 - 0
PAS/src/main/java/cn/cslg/pas/domain/asso/TaskCondition.java

@@ -111,5 +111,10 @@ public class TaskCondition implements Serializable {
      */
     @TableField(value = "continue_last_information")
     private String continueLastInformation;
+    /**
+     * isAddPatentNos中的多个专利或申请号的下载任务类型(1.检索页面手动勾选的专利下载任务 2.多个专利号导入的下载任务)
+     */
+    @TableField(value = "isadd_type")
+    private Integer isAddType;
 
 }

+ 5 - 5
PAS/src/main/java/cn/cslg/pas/service/outApi/PatentStarApiService.java

@@ -333,7 +333,7 @@ public class PatentStarApiService {
                 Map<String, Object> reMap = new HashMap<>();
                 reMap.put("size", patentStarListDto.getRowCount());
                 reMap.put("current", patentStarListDto.getPageNum());
-                reMap.put("records", Data.get("List"));
+                reMap.put("records", starPatentVOS);
                 reMap.put("total", Data.get("HitCount"));
                 return reMap;
             }
@@ -659,10 +659,10 @@ public class PatentStarApiService {
      */
     public String getEnPdfApi(String patentNo) {
         String url = "  https://api.patentstar.com.cn/api/Patent/EnPdf/" + patentNo;
-        //String appId = "2000041";
-        //String appkey = "F0E183D5F02C48E391F5FADF1B646F54";
-        String appId = "1000046";
-        String appkey = "6AE6D4DC6AF94F26862501EDEE9E27A2";
+        String appId = "2000041";
+        String appkey = "F0E183D5F02C48E391F5FADF1B646F54";
+//        String appId = "1000046";
+//        String appkey = "6AE6D4DC6AF94F26862501EDEE9E27A2";
         Long currentTimeMillis = System.currentTimeMillis() / 1000;
         String Sign = appId + appkey + currentTimeMillis.toString();
         String signMd5 = FormatUtil.MD5(Sign);

+ 47 - 29
PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/ExcutePatentDataStar.java

@@ -315,12 +315,14 @@ public class ExcutePatentDataStar implements IExcutePatentData {
                 } else if (fromIndex == isAddPatentNos.size() - 1) {
                     isAddPatentNos = Arrays.asList(isAddPatentNos.get(isAddPatentNos.size() - 1));
                 }
-                //若是检索页面网站导入,则isAddPatentNos是前台传的多个申请号,即包含"."
-                if (isAddPatentNos.get(0).contains(".")) {
-                    downLoadIsAddPatentNos(isAddPatentNos, task, orderBy, orderByType, dbType, cells, null);
-                } else {
-                    //若是多个专利号导入的下载,则isAddPatentNos是多个专利号,不包含"."
+
+                //判断isAdd中的多个专利号或申请号,即判断是检索页面手动勾选的多个专利下载/还是多个专利号导入的下载任务
+                if (task.getIsAddType() != null && task.getIsAddType().equals(2)) {
+                    //若是多个专利号导入的下载
                     downLoadIsAddPatentNos(isAddPatentNos, task, orderBy, orderByType, dbType, cells, conditions);
+                } else {
+                    //若是检索页面手动勾选的多个专利的下载
+                    downLoadIsAddPatentNos(isAddPatentNos, task, orderBy, orderByType, dbType, cells, null);
                 }
             }
 
@@ -579,41 +581,57 @@ public class ExcutePatentDataStar implements IExcutePatentData {
         String cnFullXmlStr = patentStarApiService.getCnFullXmlApi(appNo);
 
         //使用正则表达式拼接出说明书文本全文
-        String regex = "(?<=<p id=\"p)[\\w\\W]+?(?=</p>)";
+        String regex = "(?<=<description>)[\\w\\W]+?(?=</description>)";
         Pattern compile = Pattern.compile(regex);
         Matcher matcher = compile.matcher(cnFullXmlStr);
-        StringBuilder builder = new StringBuilder();
+//        StringBuilder builder = new StringBuilder();
+//        String regexTable = "(?<=<tables[^>]{1,50}>)[\\w\\W]+?(?=</tables>)";
+//        Pattern compileTable = Pattern.compile(regexTable);
+        String text = "";
         while (matcher.find()) {
-            String oldRow = matcher.group();
-//            if (oldRow.contains("\r\n")) {
-//                oldRow = oldRow.replace("\r\n", "");
+            text = matcher.group();
+            text = text.replaceAll("<invention-title(.*?)</invention-title>", "");
+            text = text.replaceAll("<br/>", "");
+            text = text.replaceAll("\\s", "");
+        }
+//        String oldRow = matcher.group();
+//        oldRow = oldRow.replaceAll("\\s", "");
+//        if (oldRow.contains("num=\"n")) {
+//            oldRow = oldRow.substring(oldRow.indexOf("num=\"n") + 6);
+//            oldRow = "[" + oldRow;
+//            oldRow = oldRow.replace("\">", "]");
+//        } else if (oldRow.contains("num=")) {
+//            oldRow = oldRow.substring(oldRow.indexOf("num=") + 5);
+//            oldRow = "[" + oldRow;
+//            oldRow = oldRow.replace("\">", "]");
+//        } else {
+//            oldRow = oldRow.substring(oldRow.indexOf("\">") + 2);
+//        }
+//            Matcher matcherTable = compileTable.matcher(oldRow);
+//            StringBuilder builder1 = new StringBuilder();
+//            while (matcherTable.find()) {
+//                String tableGroup = matcherTable.group();
+//                tableGroup = tableGroup.replaceAll("<tgroup[^>]*>", "").replaceAll("</tgroup >", "").replaceAll("<colspec[^>]*>", "").
+//                        replaceAll("</colspec>", "").replaceAll("<colspec", "<td").replaceAll("row", "tr").
+//                        replaceAll("entry", "td");
+//                builder1.append(tableGroup);
 //            }
-//            if (oldRow.contains("\n")) {
-//                oldRow = oldRow.replace("\n", "");
+//            if ((builder1 + "").length() > 0) {
+//                oldRow = builder1 + "";
 //            }
-            if (oldRow.contains("num=\"n")) {
-                oldRow = oldRow.substring(oldRow.indexOf("num=\"n") + 6);
-                oldRow = "[" + oldRow;
-                oldRow = oldRow.replace("\">", "]");
-            } else if (oldRow.contains("num=")) {
-                oldRow = oldRow.substring(oldRow.indexOf("num=") + 5);
-                oldRow = "[" + oldRow;
-                oldRow = oldRow.replace("\">", "]");
-            } else {
-                oldRow = oldRow.substring(oldRow.indexOf("\">") + 2);
-            }
-            builder.append(oldRow).append("\r\n");
-        }
 
-        String instructionText = builder + "";
+//            builder.append(oldRow).append("\r\n");
+//        }
+
+//        String instructionText = builder + "";
 
         //使用工具类去除字符串文本中的所有HTML格式标签
-        instructionText = RemoveHtmlTagsUtils.removeHtmlTags(instructionText);
-        instructionText = instructionText.trim();
+//        instructionText = RemoveHtmlTagsUtils.removeHtmlTags(instructionText);
+//        instructionText = instructionText.trim();
 
         //装载说明书文本全文
         PatentInstructionText patentInstructionText = new PatentInstructionText();
-        patentInstructionText.setManual(instructionText);
+        patentInstructionText.setManual(text.trim());
         uploadParamsVO.setPatentInstructionText(patentInstructionText);
 
     }

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

@@ -123,6 +123,7 @@ public class PantentQueueService {
                         }
                         task.setConditions(taskCondition.getConditions());
                         task.setContinueLastInformation(taskCondition.getContinueLastInformation());
+                        task.setIsAddType(taskCondition.getIsAddType());
                     }
 
                     //TODO 调用工厂方法,工厂方法会根据任务类型创建并返回对应的生产专利方法的对象

+ 5 - 11
PAS/src/main/java/cn/cslg/pas/service/upLoadPatent/UploadTaskService.java

@@ -82,15 +82,7 @@ public class UploadTaskService {
             }
         }
 
-        //检查任务合法性2(根据网站配置id和登陆人所属租户id,看是否有网站导入任务的权限)
-        Integer webId = taskAddNewDTO.getConfigId();
-        PersonnelVO personnelVO = cacheUtils.getLoginUserPersonnel(loginUtils.getId());  //获取登陆人信息
-        WebLoginConfig webLoginConfig = webLoginConfigService.getLoginConfig(webId, personnelVO.getTenantId());  //根据网站id获得配置
-        if (webLoginConfig == null) {
-            ThrowException.throwXiaoShiException("未配置网站登录信息");
-        }
-
-        //检查任务合法性3(根据检索式信息调用一般检索接口,看是否能检索出专利)
+        //检查任务合法性2(根据检索式信息调用一般检索接口,看是否能检索出专利)
         PatentStarListDto patentStarListDto = new PatentStarListDto()
                 .setCurrentQuery(taskAddNewDTO.getConditions())
                 .setOrderBy(taskAddNewDTO.getOrderBy())
@@ -132,7 +124,8 @@ public class UploadTaskService {
                 .setOrderByType(taskAddNewDTO.getOrderByType())
                 .setDBType(taskAddNewDTO.getDBType())
                 .setStartNumber(taskAddNewDTO.getStartNumber())
-                .setEndNumber(taskAddNewDTO.getEndNumber());
+                .setEndNumber(taskAddNewDTO.getEndNumber())
+                .setIsAddType(taskAddNewDTO.getIsAddType());
         if (taskAddNewDTO.getIsAddPatentNos() != null && taskAddNewDTO.getIsAddPatentNos().size() > 0) {
             taskCondition.setIsAddPatentNos(StringUtils.join(taskAddNewDTO.getIsAddPatentNos(), ","));
         }
@@ -245,7 +238,8 @@ public class UploadTaskService {
                 .setConfigId(2)
                 .setTaskName("多个专利号导入方式任务")
                 .setTaskType(0)
-                .setTaskType2(4);
+                .setTaskType2(4)
+                .setIsAddType(2);
 
         //根据下载的网站类型新增任务
         if (taskAddNewDTO.getTaskType2().equals(3)) {