Browse Source

任务部分接口 2022/11/15

lwhhszx 2 years ago
parent
commit
6ee76a96e7

+ 346 - 0
RMS/src/main/java/cn/cslg/report/common/model/dto/PatentDTO.java

@@ -0,0 +1,346 @@
+package cn.cslg.report.common.model.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+//@Data
+//public class PatentDTO {
+//    private Integer id;
+//    private List<PatentLabel> label;
+//    private List<PatentApplicant> applicant;
+//    private List<PatentInventor> inventor;
+//    private PatentAgency agency;
+//    private List<PatentAgent> agent;
+//    private List<PatentAffair> affair;
+//    private List<Field> field;
+//    private Integer read;
+//    private List<String> ipcList;
+//    private List<String> cpcList;
+//    private List<String> upcList;
+//    private List<String> locList;
+//    private List<PatentImage> image;
+//    private List<PatentInstruction> pdf;
+//    private Integer simpleFamily;
+//    private Integer inpadocFamily;
+//    private Integer patSnapFamily;
+//    private PatentFamily family;
+//    private List<PatentRight> rights;
+//    private PatentInstructionText instruction;
+//    private List<String> priorityCountry;
+//
+//    @Data
+//    public static class PatentFamily {
+//        private List<String> simple;
+//        private List<String> inpadoc;
+//        private List<String> patSnap;
+//    }
+//
+//    @Data
+//    public static class Field {
+//        private Integer id;
+//        private Integer type;
+//        private String name;
+//        private List<String> selected;
+//    }
+//
+//    /**
+//     * 专利名称(标题)
+//     */
+//    private String name;
+//
+//    /**
+//     * 专利名称(标题)(译)
+//     */
+//    private String nameOut;
+//
+//    /**
+//     * 专利号
+//     */
+//    private String patentNo;
+//
+//    /**
+//     * 摘要
+//     */
+//    private String abstractStr;
+//
+//    /**
+//     * 摘要(译)
+//     */
+//    private String abstractOut;
+//
+//    /**
+//     * 申请号
+//     */
+//    private String applicationNo;
+//
+//    /**
+//     * 申请日
+//     */
+//    private String applicationDate;
+//
+//    /**
+//     * 公开号
+//     */
+//    private String publicNo;
+//
+//    /**
+//     * 公开日
+//     */
+//    private String publicDate;
+//
+//    /**
+//     * 首次公开日
+//     */
+//    private String firstPublicDate;
+//
+//    /**
+//     * 公开授权号
+//     */
+//    private String publicAccreditNo;
+//
+//    /**
+//     * 公开授权日
+//     */
+//    private String publicAccreditDate;
+//
+//    /**
+//     * 受理局
+//     */
+//    private String bureau;
+//
+//    /**
+//     * IPC国际分类号(主)
+//     */
+//    private String ipc;
+//
+//    /**
+//     * CPC国际分类号(主)
+//     */
+//    private String cpc;
+//
+//    /**
+//     * UPC国际分类号(主)
+//     */
+//    private String upc;
+//
+//    /**
+//     * LOC国际分类号(主)
+//     */
+//    private String loc;
+//
+//    /**
+//     * 专利状态【有权、审中、无权、PCT状态】
+//     */
+//    private String simpleStatus;
+//
+//    /**
+//     * 专利类型【发明、新型、外观】
+//     */
+//    private String type;
+//
+//    /**
+//     * 授权文档名称
+//     */
+//    private String authDocName;
+//
+//    /**
+//     * 授权文档文件地址
+//     */
+//    private String authDocUrl;
+//
+//    /**
+//     * 公开文档名称
+//     */
+//    private String publicDocName;
+//
+//    /**
+//     * 公开文档文件地址
+//     */
+//    private String publicDocUrl;
+//
+//    /**
+//     * 文献代码
+//     */
+//    private String code;
+//
+//    /**
+//     * 说明书
+//     */
+//    private String manual;
+//
+//    /**
+//     * 说明书(译)
+//     */
+//    private String manualOut;
+//
+//    /**
+//     * 文献页数
+//     */
+//    private Integer docPage;
+//
+//    /**
+//     * 发明人数量
+//     */
+//    private Integer inventorNum;
+//
+//    /**
+//     * 主权项数量
+//     */
+//    private Integer mainRightNum;
+//
+//    /**
+//     * 权利要求数量
+//     */
+//    private Integer rightNum;
+//
+//    /**
+//     * 权利要求
+//     */
+//    private String rightContent;
+//
+//    /**
+//     * 独立权力要求
+//     */
+//    private String selfRightContent;
+//
+//    /**
+//     * 权利要求(译)
+//     */
+//    private String rightContentOut;
+//
+//    /**
+//     * 优先权号
+//     */
+//    private String priorityNo;
+//
+//    /**
+//     * 优先权日
+//     */
+//    private String priorityDate;
+//
+//    /**
+//     * 简单同族数量
+//     */
+//    private Integer simpleFamilyNum;
+//
+//    /**
+//     * INPADOC同族数量
+//     */
+//    private Integer inpadocFamilyNum;
+//
+//    private Integer patSnapFamilyNum;
+//
+//    /**
+//     * 引用专利数量
+//     */
+//    private Integer quoteNum;
+//
+//    /**
+//     * 被引用次数
+//     */
+//    private Integer quotedNum;
+//
+//    /**
+//     * 3年内被引用次数
+//     */
+//    private Integer quotedNum3;
+//
+//    /**
+//     * 5年内被引用次数
+//     */
+//    private Integer quotedNum5;
+//
+//    /**
+//     * 非专利引用文献数量
+//     */
+//    private Integer notPatentQuoteNum;
+//
+//    /**
+//     * WO国家阶段
+//     */
+//    private String wo;
+//
+//    /**
+//     * 代理机构ID
+//     */
+//    private String agencyId;
+//
+//    /**
+//     * 代理人ID
+//     */
+//    private String agentId;
+//
+//    /**
+//     * 审查员
+//     */
+//    private String examiner;
+//
+//    /**
+//     * 助理审查员
+//     */
+//    private String aidExaminer;
+//
+//    /**
+//     * 引用专利
+//     */
+//    private String quote;
+//
+//    /**
+//     * 被引用专利
+//     */
+//    private String quoted;
+//
+//    /**
+//     * 非专利引用文献
+//     */
+//    private String notPatentQuote;
+//
+//    /**
+//     * 摘要附图
+//     */
+//    private String abstractPath;
+//
+//    /**
+//     * 当前第一申请人
+//     */
+//    private String firstApplicant;
+//
+//    /**
+//     * 当前第一申请人地址
+//     */
+//    private String firstApplicantAddress;
+//
+//    /**
+//     * 申请人数量
+//     */
+//    private Integer applicantNum;
+//
+//    /**
+//     * 第一发明人
+//     */
+//    private String firstInventor;
+//
+//    /**
+//     * 第一发明人地址
+//     */
+//    private String firstInventorAddress;
+//
+//    private Integer selfRightContentNum;
+//
+//    /**
+//     * 简单同族
+//     */
+//    private String simpleFamilyStr;
+//
+//    /**
+//     * INPADOC同族
+//     */
+//    private String inpadocFamilyStr;
+//
+//    /**
+//     * EP指定国状态
+//     */
+//    private String epStatus;
+//
+//}

+ 8 - 0
RMS/src/main/java/cn/cslg/report/common/model/vo/CompareFilesVO.java

@@ -21,5 +21,13 @@ public class CompareFilesVO extends BaseVO {
     private List<String> patentNos;
     @Schema(description = "报告Id")
     private Integer reportId;
+    @Schema(description = "起始条数")
+    private Integer startNumber;
+    @Schema(description = "结束条数")
+    private Integer endNumber;
+    @Schema(description = "添加的专利号列表",required = true)
+    private List<String> isAdd;
+    @Schema(description = "减少的专利号列表",required = true)
+    private List<String> isDelete;
 
 }

+ 1 - 1
RMS/src/main/java/cn/cslg/report/controller/BaseController.java

@@ -145,7 +145,7 @@ public class BaseController {
     @PostMapping("/getPatentFromPAS")
     @Operation(summary = "根据报告Id查询对比文件(分页)")
     public String getPatentNos(@RequestBody PatentVO patentVO) throws IOException {
-        return  outInterfaceService.getPatentFromPAS(patentVO);
+        return  outInterfaceService.getPatentFromPAS(patentVO,0);
     }
 
     @PostMapping("/getComPatentNos")

+ 7 - 1
RMS/src/main/java/cn/cslg/report/controller/CompareController.java

@@ -21,10 +21,16 @@ import java.io.IOException;
 public class CompareController {
     private final CompareFilesService compareFilesService;
 
+//    @RequestMapping(value = "/addCompareFile", method = RequestMethod.POST)
+//    @Operation(summary = "添加对比文件")
+//    public String addCompareFile(@RequestBody CompareFilesVO compareFilesVO) throws IOException {
+//     String res =   compareFilesService.addCompareFile(compareFilesVO);
+//        return res;
+//    }
     @RequestMapping(value = "/addCompareFile", method = RequestMethod.POST)
     @Operation(summary = "添加对比文件")
     public String addCompareFile(@RequestBody CompareFilesVO compareFilesVO) throws IOException {
-     String res =   compareFilesService.addCompareFile(compareFilesVO);
+        String res =   compareFilesService.addCompareFile(compareFilesVO);
         return res;
     }
 

+ 4 - 3
RMS/src/main/java/cn/cslg/report/controller/FeatureController.java

@@ -2,6 +2,7 @@ package cn.cslg.report.controller;
 
 import cn.cslg.report.common.core.base.Constants;
 import cn.cslg.report.common.model.vo.PatentRightVo;
+import cn.cslg.report.common.model.vo.PatentVO;
 import cn.cslg.report.common.utils.Response;
 import cn.cslg.report.entity.Features;
 import cn.cslg.report.entity.Report;
@@ -47,10 +48,10 @@ public class FeatureController {
         return res;
     }
 
-    @RequestMapping(value = "/querySimFeaturePatent", method = RequestMethod.GET)
+    @RequestMapping(value = "/querySimFeaturePatent", method = RequestMethod.POST)
     @Operation(summary = "获得相似特征的专利号")
-    public String querySimFeaturePatent(Integer ReportId ,String patentNo) throws IOException {
-        String res =  featureService.querySimFeaturePatent(ReportId,patentNo);
+    public String querySimFeaturePatent(@RequestBody PatentVO patentVO) throws IOException {
+        String res =  featureService.querySimFeaturePatent(patentVO);
         return res;
     }
 

+ 0 - 1
RMS/src/main/java/cn/cslg/report/controller/PatentFiledController.java

@@ -1,7 +1,6 @@
 package cn.cslg.report.controller;
 
 import cn.cslg.report.common.core.base.Constants;
-import cn.cslg.report.common.model.vo.CompareFilesVO;
 import cn.cslg.report.entity.ReportField;
 import cn.cslg.report.service.business.CompareFilesService;
 import cn.cslg.report.service.business.ReportFieldService;

+ 1 - 1
RMS/src/main/java/cn/cslg/report/controller/ReportController.java

@@ -24,7 +24,7 @@ import java.io.IOException;
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
 public class ReportController {
     private final ReportService reportService;
-    private final CompareFilesService compareFilesService;
+
 
     /**
      * @param report 报告类

+ 11 - 8
RMS/src/main/java/cn/cslg/report/service/OutInterfaceService.java

@@ -313,19 +313,20 @@ if(personnelVO.getName()==null)
         return Objects.requireNonNull(okHttpClient.newCall(request).execute().body()).string();
     }
 
-    public String getPatentFromPAS(PatentVO patentVO) throws IOException {
+    public String getPatentFromPAS(PatentVO patentVO,int type) throws IOException {
         LambdaQueryWrapper<ImportTask> queryWrapper =new LambdaQueryWrapper<>();
         queryWrapper.eq(ImportTask::getReportId,patentVO.getReportId());
         List<ImportTask> importTasks =importTaskService.list(queryWrapper);
         List<Integer> taskIds= importTasks.stream().map(ImportTask::getId).collect(Collectors.toList());
         Map<String,Object> map =new HashMap<>();
          Report report = reportService.getById(patentVO.getReportId());
+         if(type ==0){
         map.put("projectId", report.getProjectId());
         map.put("importTaskId", taskIds);
+        map.put("startNumber",patentVO.getStartNumber());
+        map.put("endNumber",patentVO.getEndNumber());}
         map.put("size", patentVO.getSize());
         map.put("current", patentVO.getCurrent());
-        map.put("startNumber",patentVO.getStartNumber());
-        map.put("endNumber",patentVO.getEndNumber());
         map.put("patentNos",patentVO.getPatentNos());
         JSONObject json = new JSONObject(map);
         RequestBody requestBody = RequestBody.create(JSON, String.valueOf(json));
@@ -340,14 +341,16 @@ if(personnelVO.getName()==null)
     public String getComPatentNos(PatentVO patentVO) throws IOException {
         LambdaQueryWrapper<ImportTask> queryWrapper =new LambdaQueryWrapper<>();
         queryWrapper.eq(ImportTask::getReportId,patentVO.getReportId());
-        List<ImportTask> importTasks =importTaskService.list(queryWrapper);
-        List<Integer> taskIds= importTasks.stream().map(ImportTask::getId).collect(Collectors.toList());
         Map<String,Object> map =new HashMap<>();
-        Report report = reportService.getById(patentVO.getReportId());
-        map.put("projectId", report.getProjectId());
-        map.put("importTaskId", taskIds);
+            Report report = reportService.getById(patentVO.getReportId());
+            map.put("projectId", report.getProjectId());
+            List<ImportTask> importTasks = importTaskService.list(queryWrapper);
+            List<Integer> taskIds = importTasks.stream().map(ImportTask::getId).collect(Collectors.toList());
+            map.put("importTaskId", taskIds);
+
         map.put("startNumber",patentVO.getStartNumber());
         map.put("endNumber",patentVO.getEndNumber());
+        map.put("patentNos",patentVO.getPatentNos());
         JSONObject json = new JSONObject(map);
         RequestBody requestBody = RequestBody.create(JSON, String.valueOf(json));
         OkHttpClient okHttpClient = new OkHttpClient();

+ 53 - 15
RMS/src/main/java/cn/cslg/report/service/business/CompareFilesService.java

@@ -1,15 +1,11 @@
 package cn.cslg.report.service.business;
 
-import cn.cslg.report.common.core.base.Constants;
 import cn.cslg.report.common.model.vo.CompareFilesVO;
 import cn.cslg.report.common.model.vo.PatentVO;
-import cn.cslg.report.common.model.vo.SystemDictVO;
-import cn.cslg.report.common.utils.LogExceptionUtil;
+
 import cn.cslg.report.common.utils.Response;
 import cn.cslg.report.entity.CompareFiles;
-import cn.cslg.report.entity.SysDictItem;
 import cn.cslg.report.mapper.CompareFilesMapper;
-import cn.cslg.report.mapper.SystemDictItemMapper;
 import cn.cslg.report.service.OutInterfaceService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -19,6 +15,7 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -32,25 +29,66 @@ import java.util.stream.Collectors;
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
 public class CompareFilesService extends ServiceImpl<CompareFilesMapper, CompareFiles> {
       private final OutInterfaceService outInterfaceService;
-    public String addCompareFile(CompareFilesVO compareFilesVO){
-     List<CompareFiles> compareFiles =new ArrayList<>();
-     compareFilesVO.getPatentNos().forEach(item->{
-         CompareFiles compareFiles1 =new CompareFiles();
-         compareFiles1.setPatentNo(item);
-         compareFiles1.setReportId(compareFilesVO.getReportId());
-         compareFiles.add(compareFiles1);
-     });
-      this.saveBatch(compareFiles);
+//    public String addCompareFile(CompareFilesVO compareFilesVO){
+//     List<CompareFiles> compareFiles =new ArrayList<>();
+//     compareFilesVO.getPatentNos().forEach(item->{
+//         CompareFiles compareFiles1 =new CompareFiles();
+//         compareFiles1.setPatentNo(item);
+//         compareFiles1.setReportId(compareFilesVO.getReportId());
+//         compareFiles.add(compareFiles1);
+//     });
+//      this.saveBatch(compareFiles);
+//        return  Response.success();
+//    }
+     @Transactional(rollbackFor = Exception.class)
+    public String addCompareFile(CompareFilesVO compareFilesVO) throws IOException {
+        LambdaQueryWrapper<CompareFiles> queryWrapper =new LambdaQueryWrapper<>();
+        queryWrapper.eq(CompareFiles::getReportId,compareFilesVO.getReportId());
+        List<CompareFiles> compareFile1 =this.list(queryWrapper);
+        List<String> patentNoList =compareFile1.stream().map(CompareFiles::getPatentNo).collect(Collectors.toList());
+        List<CompareFiles> compareFiles =new ArrayList<>();
+        PatentVO patentVO =new PatentVO();
+        patentVO.setStartNumber(compareFilesVO.getStartNumber()-1);
+        patentVO.setEndNumber(compareFilesVO.getEndNumber());
+        patentVO.setReportId(compareFilesVO.getReportId());
+        patentVO.setPatentNos(patentNoList);
+     String res = outInterfaceService.getComPatentNos(patentVO);
+       JSONObject jsonObject =JSONObject.parseObject(res);
+       List<String> patentNos =JSONArray.parseArray(jsonObject.get("data").toString(),String.class);
+       patentNos.removeAll(compareFilesVO.getIsDelete());
+       patentNos.addAll(compareFilesVO.getIsAdd());
+       patentNos.removeAll(patentNoList);
+        patentNos.forEach(item->{
+            CompareFiles compareFiles1 =new CompareFiles();
+            compareFiles1.setPatentNo(item);
+            compareFiles1.setReportId(compareFilesVO.getReportId());
+            compareFiles.add(compareFiles1);
+        });
+        this.saveBatch(compareFiles);
         return  Response.success();
     }
 
     public String getCompareFile(PatentVO patentVO) throws IOException {
+
         LambdaQueryWrapper<CompareFiles> queryWrapper =new LambdaQueryWrapper<>();
         queryWrapper.eq(CompareFiles::getReportId,patentVO.getReportId());
         List<CompareFiles> compareFiles =this.list(queryWrapper);
         List<String> patentNos =compareFiles.stream().map(CompareFiles::getPatentNo).collect(Collectors.toList());
         patentVO.setPatentNos(patentNos);
-        return  outInterfaceService.getPatentFromPAS(patentVO);
+        String res =outInterfaceService.getPatentFromPAS(patentVO,0);
+        JSONObject jsonObject = JSONObject.parseObject(res);
+       JSONObject resData = JSONObject.parseObject(jsonObject.getString("data"));
+       List<JSONObject>     list=   JSONArray.parseArray(resData.getString("records"),JSONObject.class);
+        List<String> temNos =new ArrayList<>();
+   for(int i=0;i<list.size(); i++){
+       if(patentNos.contains(list.get(i).get("patentNo").toString())){
+       temNos.add(list.get(i).get("patentNo").toString());}
+
+   }
+    Map<String,Object> map =new HashMap<>();
+   map.put("datas",resData);
+           map.put("select",temNos);
+        return Response.success(map) ;
     }
 
     public String getCompareNos(Integer reportId) throws IOException {

+ 18 - 6
RMS/src/main/java/cn/cslg/report/service/business/FeatureService.java

@@ -1,6 +1,7 @@
 package cn.cslg.report.service.business;
 
 import cn.cslg.report.common.model.vo.PatentRightVo;
+import cn.cslg.report.common.model.vo.PatentVO;
 import cn.cslg.report.common.model.vo.PersonnelVO;
 import cn.cslg.report.common.utils.CacheUtils;
 import cn.cslg.report.common.utils.Response;
@@ -36,6 +37,7 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
     private final CacheUtils cacheUtils;
     private final ReportService reportService;
     private final LoginUtils loginUtils;
+    private final FeatureMapper featureMapper;
 
     //对权要进行合并操作
     private List<PatentRight> FormatPatentRights(List<PatentRight> patentRights) {
@@ -252,18 +254,28 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
         return Response.success();
     }
 
-    public String querySimFeaturePatent(Integer reportId, String patentNo) {
+    public String querySimFeaturePatent(PatentVO patentVO) throws IOException {
         //获得当前用户信息
-        PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+       PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
         //根据报告Id,拆分人Id,标的专利号获得特征。
         LambdaQueryWrapper<Features> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(Features::getReportId, reportId)
-                .eq(Features::getSignPatentNo, patentNo)
-                .eq(Features::getPartnerId, personnelVO.getId());
+        queryWrapper.eq(Features::getReportId, patentVO.getReportId())
+             .eq(Features::getPartnerId, personnelVO.getId());
         List<Features> features = this.list(queryWrapper);
+        LambdaQueryWrapper<Report> lambdaQueryWrapper =new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.eq(Report::getId,patentVO.getReportId());
+        List<Report> reports =reportService.list(lambdaQueryWrapper);
+        List<String> signPatentNos =reports.stream().map(Report::getSignPatentNo).collect(Collectors.toList());
         //获得特征内容
         List<String> contents = features.stream().map(Features::getContent).collect(Collectors.toList());
-        return Response.success();
+        List<String> patentNos = featureMapper.getSignPatentNo(contents);
+        patentNos.removeAll(signPatentNos);
+        if(patentNos.size()==0)
+        {return Response.success();}
+
+        patentVO.setPatentNos(patentNos);
+      String res=  outInterfaceService.getPatentFromPAS(patentVO,1);
+        return res;
 
 
     }

+ 16 - 0
RMS/src/main/resources/mapper/FeatureMapper.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="cn.cslg.report.mapper.FeatureMapper">
+    <select id="getSignPatentNo" resultType="java.lang.String" >
+        select DISTINCT SIGN_PATENT_NO from FEATURES
+        <where>
+            SIGN_PATENT_NO="0"
+        <if test="contents!=null and contents.size()!=0">
+       or CONTENT in
+        <foreach item="item" collection="contents" index="index" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        </if>
+        </where>
+    </select>
+</mapper>