Pārlūkot izejas kodu

select collect patent

zero 1 gadu atpakaļ
vecāks
revīzija
0d6c9aed27

+ 11 - 1
src/main/java/com/example/xiaoshiweixinback/controller/PatentController.java

@@ -5,10 +5,12 @@ import com.example.xiaoshiweixinback.business.common.Constants;
 import com.example.xiaoshiweixinback.business.common.Response;
 import com.example.xiaoshiweixinback.business.common.base.Records;
 import com.example.xiaoshiweixinback.business.utils.FileUtils;
+import com.example.xiaoshiweixinback.checkLogin.checkLogin;
 import com.example.xiaoshiweixinback.entity.dto.esPicture.EsPictureNoDTO;
 import com.example.xiaoshiweixinback.entity.dto.esPicture.EsPatentVectorDTO;
 import com.example.xiaoshiweixinback.entity.dto.patent.CollectPatentDTO;
 import com.example.xiaoshiweixinback.entity.dto.patent.ImportTaskAMVO;
+import com.example.xiaoshiweixinback.entity.dto.patent.SelectCollectPatentDTO;
 import com.example.xiaoshiweixinback.entity.vo.esPicture.EsPictureNoVo;
 import com.example.xiaoshiweixinback.service.importPatent.EsDenseVectorService;
 import com.example.xiaoshiweixinback.service.importPatent.EsPatentService;
@@ -85,9 +87,10 @@ public class PatentController {
     }
 
     //--------------------------- 收藏专利相关  --------------------------
+    @checkLogin
     @Operation(summary = "收藏专利--zero")
     @PostMapping(value = "/collectPatent")
-    public Response collectPatent(@RequestBody CollectPatentDTO patentDTO) throws Exception {
+    public Response collectPatent(@RequestBody CollectPatentDTO patentDTO) {
         boolean b = false;
         try {
             b = esPatentService.collectPatent(patentDTO);
@@ -97,5 +100,12 @@ public class PatentController {
         return Response.success(b);
     }
 
+    @Operation(summary = "查询收藏专利--zero")
+    @PostMapping(value = "/selectCollectPatent")
+    public Response selectCollectPatent(@RequestBody SelectCollectPatentDTO patentDTO) throws Exception {
+        Records records = esPatentService.selectCollectPatent(patentDTO);
+        return Response.success(records);
+    }
+
     //--------------------------- 其他  --------------------------
 }

+ 2 - 2
src/main/java/com/example/xiaoshiweixinback/entity/dto/esPicture/EsPatentVectorDTO.java

@@ -13,7 +13,7 @@ public class EsPatentVectorDTO {
 
     private String description;
 
-    private Long pageNum = 1l;
+    private Long pageNum;
 
-    private Long pageSize = 10l;
+    private Long pageSize;
 }

+ 1 - 1
src/main/java/com/example/xiaoshiweixinback/entity/dto/patent/CollectPatentDTO.java

@@ -9,5 +9,5 @@ public class CollectPatentDTO {
 
     private Integer productId;
 
-        private List<String> patentNos;
+    private List<String> patentNos;
 }

+ 399 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/patent/PatentColumnDTO.java

@@ -0,0 +1,399 @@
+package com.example.xiaoshiweixinback.entity.dto.patent;
+
+import com.example.xiaoshiweixinback.domain.es.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class PatentColumnDTO {
+    /**
+     * 专利号
+     */
+    private String patentNo;
+
+    /**
+     * 标题
+     */
+    private List<Text> title;
+
+    /**
+     * 公开说明书文本
+     */
+    private List<Text> publicFullText;
+
+    /**
+     * 授权说明书文本
+     */
+    private List<Text> grantFullText;
+
+    /**
+     * 摘要
+     */
+    private List<Text> abstractStr;
+
+    /**
+     * 申请人地址
+     */
+    private PersonAddress applicantAddr;
+
+    //申请人地址
+    private String appAddress;
+    //申请人国家
+    private String applicantCountry;
+    //申请人省份
+    private String appProvince;
+    //申请人市
+    private String appCity;
+    //申请人县
+    private String appDistrict;
+
+    //权利人地址
+    private String rightAddress;
+    //权利人国家
+    private String rightCountry;
+    //权利人省份
+    private String rightProvince;
+    //权利人市
+    private String rightCity;
+    //权利人县
+    private String rightDistrict;
+
+    /**
+     * 权利人地址
+     */
+    private PersonAddress rightHolderAddr;
+
+    /**
+     * 审查员
+     */
+    private String examiner;
+
+    /**
+     * 助理审查员
+     */
+    private String aidExaminer;
+
+    /**
+     * 实审日
+     */
+    @JsonFormat(
+            pattern = "yyyy-MM-dd",
+            timezone = "GMT+8"
+    )
+    private Date examinationDate;
+
+    /**
+     * 公开号
+     */
+    private String publicNo;
+
+    /**
+     * 公开日
+     */
+    @JsonFormat(
+            pattern = "yyyy-MM-dd",
+            timezone = "GMT+8"
+    )
+    private Date publicDate;
+
+    /**
+     * 申请号
+     */
+    private String appNo;
+
+    /**
+     * 申请日
+     */
+    @JsonFormat(
+            pattern = "yyyy-MM-dd",
+            timezone = "GMT+8"
+    )
+    private Date appDate;
+
+    /**
+     * 授权号
+     */
+    private String grantNo;
+
+    /**
+     * 授权日
+     */
+    @JsonFormat(
+            pattern = "yyyy-MM-dd",
+            timezone = "GMT+8"
+    )
+    private Date grantDate;
+
+    /**
+     * 优先权
+     */
+    private List<Priorities> priorities;
+
+    /**
+     * 申请国家
+     */
+    private String appCountry;
+
+    /**
+     * IPC分类号(主)
+     */
+    private PatentClassify mipc;
+
+    /**
+     * ipc集合
+     */
+    private List<PatentClassify> ipc;
+
+    /**
+     * CPC分类号(主)
+     */
+    private PatentClassify mcpc;
+
+    /**
+     * cpc集合
+     */
+    private List<PatentClassify> cpc;
+
+    /**
+     * UPC分类号(主)
+     */
+    private PatentClassify mupc;
+
+
+    /**
+     * UPC集合
+     */
+    private List<PatentClassify> upc;
+
+    /**
+     * UPC分类号(主)
+     */
+    private PatentClassify mloc;
+
+
+    /**
+     * UPC集合
+     */
+    private List<PatentClassify> loc;
+
+    /**
+     * 专利状态
+     */
+    private String simpleStatus;
+
+    /**
+     * 类型
+     */
+    private String patentType;
+
+
+    /**
+     * 权利要求
+     */
+    private List<Text> claim;
+
+    /**
+     * pct申请号
+     */
+    private Integer pctAppDate;
+
+    /**
+     * pct申请日
+     */
+    private String pctAppNo;
+
+    /**
+     * pct进入日期
+     */
+    private Integer pctEnterDate;
+
+    /**
+     * pct公开日
+     */
+    private Integer pctPubDate;
+
+    /**
+     * pct公开号
+     */
+    private String pctPubNo;
+
+    /**
+     * wo指定国
+     */
+    private String wo;
+
+    /**
+     * ep申请号
+     */
+    private String epNo;
+
+    /**
+     * ep申请日
+     */
+    private String epDate;
+
+
+    /**
+     * EP指定国状态
+     */
+    private String epCountry;
+
+    /**
+     * 申请人
+     */
+    private List<String> applicant;
+
+    /**
+     * 标准申请人
+     */
+    private List<PatentPerson> standerApplicant;
+
+    /**
+     * 合并申请人
+     */
+    private List<String> mergeApplicant;
+
+    /**
+     * 申请人数量
+     */
+    private Integer applicantsNum;
+
+    /**
+     * 权利人
+     */
+    private List<String> rightHolder;
+    /**
+     * 标准权利人
+     */
+    private List<PatentPerson> standerRightHolder;
+
+    /**
+     * 合并权利人
+     */
+    private List<String> mergeRightHolder;
+
+    /**
+     * 权利人数量
+     */
+    private Integer rightHolderNum;
+
+    /**
+     * 发明人
+     */
+    private List<String> inventor;
+    /**
+     * 合并发明人
+     */
+    private List<String> mergeInventor;
+
+
+    /**
+     * 发明人数量
+     */
+    private Integer inventor_num;
+
+    /**
+     * 代理机构
+     */
+    private String agency;
+
+    /**
+     * 代理机构编号
+     */
+    private String agencyNo;
+
+    /**
+     * 代理人
+     */
+    private List<String> agent;
+
+    /**
+     * 引用专利数量
+     */
+    private Integer quotePatentNoNum;
+
+    /**
+     * 被引用专利数量
+     */
+    private Integer quotedPatentNoNum;
+
+    /**
+     * 自定义栏位
+     */
+    List<ESCustomField> ESCustomField;
+    /**
+     * 扩展同族数量
+     */
+    private Integer patsnapFamilyNum;
+    /**
+     * 扩展同族id
+     */
+    private String patsnapFamilyId;
+
+    /**
+     * INPADOC同族数量
+     */
+    private Integer inpadocFamilyNum;
+    /**
+     * INPADOC同族id
+     */
+    private String inpadocFamilyId;
+
+    /**
+     * 简单同族数量
+     */
+    private Integer simpleFamilyNum;
+    /**
+     * 简单同族id
+     */
+    private String simpleFamilyId;
+
+    /**
+     * 专题库或报告id
+     */
+    private Integer projectId;
+
+    /**
+     * 专题库或报告id
+     */
+    private String productId;
+
+    /**
+     * 专题库或报告的任务
+     */
+    EsProjectTask projectTask;
+
+    /**
+     * 导入任务
+     */
+    ESImportTask importTask;
+
+    /**
+     * 法律状态
+     */
+    List<String> legalStatus;
+
+    /**
+     * 标注
+     */
+    List<Marking> markings;
+
+    PatentJoin patentJoin;
+
+   private String pictureGuid;
+
+    /**
+     * 法律事件
+     */
+    private List<LegalEvent> legalEvents;
+
+    //外部专利的原始申请号
+    private String rowApplicationNo;
+}

+ 13 - 0
src/main/java/com/example/xiaoshiweixinback/entity/dto/patent/SelectCollectPatentDTO.java

@@ -0,0 +1,13 @@
+package com.example.xiaoshiweixinback.entity.dto.patent;
+
+import lombok.Data;
+
+@Data
+public class SelectCollectPatentDTO {
+
+    private Integer assoPersonProductId;
+
+    private Long current;
+
+    private Long size;
+}

+ 51 - 4
src/main/java/com/example/xiaoshiweixinback/service/importPatent/EsPatentService.java

@@ -7,8 +7,10 @@ import co.elastic.clients.elasticsearch.core.SearchRequest;
 import co.elastic.clients.elasticsearch.core.SearchResponse;
 import co.elastic.clients.elasticsearch.core.search.Hit;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.example.xiaoshiweixinback.business.common.base.Records;
 import com.example.xiaoshiweixinback.business.exception.BusinessException;
 import com.example.xiaoshiweixinback.business.exception.ExceptionEnum;
+import com.example.xiaoshiweixinback.business.utils.BeanUtil;
 import com.example.xiaoshiweixinback.business.utils.CacheUtil;
 import com.example.xiaoshiweixinback.business.utils.LoginUtils;
 import com.example.xiaoshiweixinback.business.utils.ToolUtil;
@@ -17,6 +19,8 @@ import com.example.xiaoshiweixinback.domain.es.Patent;
 import com.example.xiaoshiweixinback.domain.es.PatentJoin;
 import com.example.xiaoshiweixinback.domain.es.PatentVector;
 import com.example.xiaoshiweixinback.entity.dto.patent.CollectPatentDTO;
+import com.example.xiaoshiweixinback.entity.dto.patent.PatentColumnDTO;
+import com.example.xiaoshiweixinback.entity.dto.patent.SelectCollectPatentDTO;
 import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
 import com.example.xiaoshiweixinback.entity.vo.esPicture.EsPictureNoVo;
 import com.example.xiaoshiweixinback.mapper.AssoPersonProductMapper;
@@ -46,7 +50,7 @@ public class EsPatentService {
     private AssoPersonProductMapper assoPersonProductMapper;
 
     /**
-     *
+     * 收藏专利
      * @param patentDTO
      * @return
      */
@@ -64,9 +68,9 @@ public class EsPatentService {
         AssoPersonProduct assoPersonProduct = assoPersonProductMapper.selectOne(new LambdaQueryWrapper<AssoPersonProduct>()
                 .eq(AssoPersonProduct::getProductId, productId)
                 .eq(AssoPersonProduct::getPersonUuid, uuid));
-        Integer personProductId = assoPersonProduct.getId();
+        Integer assoPersonProductId = assoPersonProduct.getId();
         //判断该专利是否已经被收藏
-        List<String> patentNoList = this.selectPatentByProductId(personProductId);
+        List<String> patentNoList = this.selectPatentByProductId(assoPersonProductId);
         patentNos.removeAll(patentNoList);
         //根据专利号获取专利id
         List<String> list = new ArrayList<>();
@@ -74,7 +78,7 @@ public class EsPatentService {
             for (String patentNo : patentNos) {
                 String patentId = this.selectPatentByPatentNo(patentNo);
                 Patent patent = new Patent();
-                patent.setProductId(personProductId);
+                patent.setProductId(assoPersonProductId);
                 PatentJoin patentJoin = new PatentJoin();
                 patentJoin.setParent(patentId);
                 patentJoin.setName("product");
@@ -93,6 +97,49 @@ public class EsPatentService {
     }
 
     /**
+     * 查询收藏专利
+     * @param dto
+     * @return
+     * @throws IOException
+     */
+    public Records selectCollectPatent(SelectCollectPatentDTO dto) throws IOException {
+        Integer assoPersonProductId = dto.getAssoPersonProductId();
+        Long pageNum = dto.getCurrent();
+        Long pageSize = dto.getSize();
+
+        List<PatentColumnDTO> list = new ArrayList<>();
+
+        SearchRequest.Builder builder = new SearchRequest.Builder();
+        //设置查询索引
+        builder.index("wxpatent");
+        Query q = QueryBuilders.term(i -> i.field("product_id").value(assoPersonProductId));
+        Query query = QueryBuilders.hasChild(i -> i.type("product").query(q));
+        builder.query(query);
+        //分页
+        if (pageNum != null && pageSize != null && pageNum > 0 && pageSize > 0) {
+            builder.from((pageNum.intValue() - 1) * pageSize.intValue()).size(pageSize.intValue());
+        }
+        //解除最大条数限制
+        builder.trackTotalHits(i -> i.enabled(true));
+        SearchResponse<Patent> response = client.search(builder.build(), Patent.class);
+        List<Hit<Patent>> hits = response.hits().hits();
+        long total = response.hits().total().value();
+        for (Hit<Patent> hit : hits) {
+            Patent patent = hit.source();
+            PatentColumnDTO columnDTO = new PatentColumnDTO();
+            BeanUtil.copy(patent, columnDTO);
+            list.add(columnDTO);
+        }
+
+        Records records = new Records();
+        records.setCurrent(pageNum);
+        records.setSize(pageSize);
+        records.setData(list);
+        records.setTotal(total);
+        return records;
+    }
+
+    /**
      * 根据专利号获取专利id
      * @param patentNo
      * @return