浏览代码

4/26 XIEXIANG

xiexiang 2 年之前
父节点
当前提交
9be4b72a46

+ 55 - 0
PAS/src/main/java/cn/cslg/pas/common/config/SSLSocketClient.java

@@ -0,0 +1,55 @@
+package cn.cslg.pas.common.config;
+
+
+
+
+import javax.net.ssl.*;
+import java.security.SecureRandom;
+import java.security.cert.X509Certificate;
+
+public class SSLSocketClient {
+ 
+    //获取这个SSLSocketFactory
+    public static SSLSocketFactory getSSLSocketFactory() {
+        try {
+            SSLContext sslContext = SSLContext.getInstance("SSL");
+            sslContext.init(null, getTrustManager(), new SecureRandom());
+            return sslContext.getSocketFactory();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+ 
+    //获取TrustManager
+    private static TrustManager[] getTrustManager() {
+        TrustManager[] trustAllCerts = new TrustManager[]{
+                new X509TrustManager() {
+                    @Override
+                    public void checkClientTrusted(X509Certificate[] chain, String authType) {
+                    }
+ 
+                    @Override
+                    public void checkServerTrusted(X509Certificate[] chain, String authType) {
+                    }
+ 
+                    @Override
+                    public X509Certificate[] getAcceptedIssuers() {
+                        return new X509Certificate[]{};
+                    }
+                }
+        };
+        return trustAllCerts;
+    }
+
+    //获取HostnameVerifier
+    public static HostnameVerifier getHostnameVerifier() {
+        HostnameVerifier hostnameVerifier = new HostnameVerifier() {
+            @Override
+            public boolean verify(String s, SSLSession sslSession) {
+                return true;
+            }
+        };
+        return hostnameVerifier;
+    }
+
+}

+ 45 - 0
PAS/src/main/java/cn/cslg/pas/common/config/XDns.java

@@ -0,0 +1,45 @@
+package cn.cslg.pas.common.config;
+
+import okhttp3.Dns;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.*;
+
+public class XDns implements Dns {
+    private long timeout;
+
+    public XDns(long timeout) {
+        this.timeout = timeout;
+    }
+
+    @Override
+    public List<InetAddress> lookup(final String hostname) throws UnknownHostException {
+        if (hostname == null) {
+            throw new UnknownHostException("hostname == null");
+        } else {
+            List<InetAddress> inetAddresses =new ArrayList<>();
+            Boolean falg =true;
+            while (falg){
+                try {
+                    FutureTask<List<InetAddress>>  task = new FutureTask<>(
+                            new Callable<List<InetAddress>>() {
+                                @Override
+                                public List<InetAddress> call() throws Exception {
+                                    return Arrays.asList(InetAddress.getAllByName(hostname));
+                                }
+                            });
+                    new Thread(task).start();
+                    inetAddresses=task.get(timeout, TimeUnit.MILLISECONDS);
+                    falg =false;
+                } catch (Exception var4) {
+                  continue;
+                }
+            }
+                return inetAddresses;
+        }
+    }
+}

+ 56 - 0
PAS/src/main/java/cn/cslg/pas/common/model/dto/CniprFrontDTO.java

@@ -0,0 +1,56 @@
+package cn.cslg.pas.common.model.dto;
+
+import cn.cslg.pas.domain.PatentCell;
+import cn.cslg.pas.domain.PatentCnipr;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+/**
+ * @Author xiexiang
+ * @Date 2023/4/23
+ */
+@Accessors(chain = true)
+@Data
+public class CniprFrontDTO {
+    /**
+     * 表达式
+     */
+    private String exp;
+
+    /**
+     * 数据库
+     */
+    private List<String> dbs;
+
+    /**
+     * 当前页数
+     */
+    private Integer current;
+
+    /**
+     * 每页条数
+     */
+    private Integer size;
+
+    /**
+     * 总条数
+     */
+    private Integer total;
+
+    /**
+     * 排序字段
+     */
+    private String order;
+
+    /**
+     * 检索返回字段
+     */
+    private String displayCols;
+
+    /**
+     * 返回专利集合
+     */
+    private List<PatentCnipr> patentCniprList;
+}

+ 45 - 0
PAS/src/main/java/cn/cslg/pas/common/model/dto/CniprLoginDTO.java

@@ -0,0 +1,45 @@
+package cn.cslg.pas.common.model.dto;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+/**
+ * Cnipr平台的Password Grand方法需要的数据dto
+ * @Author xiexiang
+ * @Date 2023/4/17
+ */
+@Accessors(chain = true)
+@Data
+@NoArgsConstructor
+public class CniprLoginDTO {
+    /**
+     * 用户登陆名(必须)
+     */
+    public String user_account;
+
+    /**
+     * 用户登陆密码(必须)
+     */
+    public String user_password;
+
+    /**
+     * 用户登录后,接入应用成功后,分配的client_id(必须)
+     */
+    public String client_id;
+
+    /**
+     * 用户登录后,接入应用成功后,分配的client_secret(必须)
+     */
+    public String client_secret;
+
+    /**
+     *  是否返回刷新token,1表示返回,其他值表示不返回,默认不返回(可选)
+     */
+    public Integer return_refresh_token;
+
+    /**
+     * 授权类型,此值固定为"password"(必须)
+     */
+    public String grant_type;
+}

+ 42 - 0
PAS/src/main/java/cn/cslg/pas/common/model/dto/CniprRetData.java

@@ -0,0 +1,42 @@
+package cn.cslg.pas.common.model.dto;
+
+import cn.cslg.pas.common.model.vo.CniprVO;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+/**
+ * Cnipr平台检索数据string无法强转list 用一个对象来承接
+ *
+ * @Author xiexiang
+ * @Date 2023/4/20
+ */
+@Accessors(chain = true)
+@Data
+public class CniprRetData {
+    /**
+     * status
+     */
+    private Integer status;
+    /**
+     * message
+     */
+    private String message;
+    /**
+     * from
+     */
+    private Integer from;
+    /**
+     * size
+     */
+    private Integer size;
+    /**
+     * totals
+     */
+    private Integer total;
+    /**
+     * results
+     */
+    private List<CniprVO> results;
+}

+ 78 - 0
PAS/src/main/java/cn/cslg/pas/common/model/dto/CniprSf1V1DTO.java

@@ -0,0 +1,78 @@
+package cn.cslg.pas.common.model.dto;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+/**
+ * Cnipr平台sf1-v1所需要数据dto
+ *
+ * @Author xiexiang
+ * @Date 2023/4/17
+ */
+@Accessors(chain = true)
+@Data
+public class CniprSf1V1DTO {
+    /**
+     * 应用id(必须)
+     */
+    public String client_id;
+
+    /**
+     * 用户id(必须)
+     */
+    public String openid;
+
+    /**
+     * 访问令牌(必须)
+     */
+    public String access_token;
+
+    /**
+     * 表达式,例:公开(公告)号='CN101770823B'(必须)
+     */
+    public String exp;
+
+    /**
+     * 数据库,多值用数组或使用英文逗号分隔,例:FMZL,FMSQ,WGZL,SYXX(必须)
+     */
+    public List<String> dbs;
+
+    /**
+     * 检索类型,默认值:2 (按字检索)
+     */
+    public Integer option;
+
+    /**
+     * 排序字段,字段前加+号表示升序,加-号表示降序。多个字段排序以逗号分隔,优先级按字段先后顺序。
+     * 使用示例:+appDate表示按申请日升序,-appDate表示按申请日降序;
+     */
+    public String order;
+
+    /**
+     * 返回值起始坐标,默认为0,不能为负数。from:0表示从第1条开始取数据(必须)
+     */
+    public Integer from;
+
+    /**
+     * 返回数量,默认为10,最小值为1,每次检索数量上限为50。size:5表示获取5条数据(必须)
+     */
+    public Integer size;
+
+    /**
+     * 检索返回字段,多个字段以逗号分隔。例:title,appNumber,pubNumber / basic,extend
+     * 未填写则返回默认字段(pid,appNumber,pubNumber,dbName)
+     */
+    public String displayCols;
+
+    /**
+     * 是否高亮显示,默认值 false (不设置高亮)
+     */
+    public Boolean highLight;
+
+    /**
+     * 是否按照数据库分类统计,默认值 false (不做分类统计)
+     */
+    public Boolean isDbAgg;
+}

+ 0 - 2
PAS/src/main/java/cn/cslg/pas/common/model/dto/PatentDTO.java

@@ -347,6 +347,4 @@ public class PatentDTO {
      */
     private String epStatus;
 
-
-
 }

+ 241 - 0
PAS/src/main/java/cn/cslg/pas/common/model/vo/CniprVO.java

@@ -0,0 +1,241 @@
+package cn.cslg.pas.common.model.vo;
+
+import cn.cslg.pas.domain.Priority;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @Author xiexiang
+ * @Date 2023/4/19
+ */
+@Accessors(chain = true)
+@Data
+public class CniprVO {
+    /**
+     * 名称√
+     */
+    private String title;
+
+    /**
+     * 摘要√
+     */
+    private String abs;
+
+    /**
+     * 申请号√
+     */
+    private String[] appNumber;
+
+    /**
+     * 申请日√
+     */
+    private String appDate;
+
+    /**
+     * 公开(公告)号√
+     */
+    private String[] pubNumber;
+
+    /**
+     * 公开(公告)日√
+     */
+    private String pubDate;
+
+    /**
+     * 授权日√
+     */
+    private String grantDate;
+
+    /**
+     * 失效日
+     */
+    private String expireDate;
+
+    /**
+     * 申请(专利权)人√
+     */
+    private List<String> applicantName;
+
+    /**
+     * 申请人类型
+     */
+    private List<String> applicantType;
+
+    /**
+     * 发明(设计)人√
+     */
+    private List<String> inventorName;
+
+    /**
+     * 专利权人
+     */
+    private List<String> patentee;
+
+    /**
+     * 第一专利权人地址
+     */
+    private String patenteeAddr;
+    /**
+     * 第一专利权人省
+     */
+    private String patenteeAddrProvince;
+    /**
+     * 第一专利权人市
+     */
+    private String patenteeAddrCity;
+    /**
+     * 第一专利权人区
+     */
+    private String patenteeAddrCounty;
+
+    /**
+     * 第一专利权人类型
+     */
+    private Set<String> patenteType	;
+    /**
+     * 主分类号√
+     */
+    private String mainIpc;
+    /**
+     * 分类号√
+     */
+    private List<String> ipc;
+
+    /**
+     * 联合分类
+     */
+    private List<String> cpc;
+
+    /**
+     * 专利代理机构√
+     */
+    private String agencyName;
+
+    /**
+     * 代理人√
+     */
+    private List<String> agentName;
+
+    /**
+     * 说明书
+     */
+    private String instrPath;
+
+    /**
+     * 说明书附图
+     */
+    private String instrTif;
+
+    /**
+     * 优先权国家√
+     */
+    private List<String> priorityCountry;
+
+    /**
+     * 优先权号√
+     */
+    private String[][] priorityNo;
+
+    /**
+     * 优先权√
+     */
+    private String[][] priority;
+
+    /**
+     * 最早优先权
+     */
+    private String[][] firstPriority;
+
+    /**
+     * 法律状态√
+     */
+    private String legalStatus;
+
+    /**
+     * 专利权状态
+     */
+    private String lprs;
+
+    /**
+     * 国家名√
+     */
+    private String countryName;
+
+    /**
+     * 权利要求书√
+     */
+    private String claimsPath;
+
+    /**
+     * 主权项√
+     */
+    private String cl;
+
+    /**
+     * 简单同族数量
+     */
+    private String simpleFamilyQuantity;
+
+    /**
+     * 简单同族
+     */
+    private String[][] simpleFamily;
+
+    /**
+     * 专利类型
+     */
+    private String patType;
+
+    /**
+     * 被引证次数
+     */
+    private String fwCitQuantity;
+
+    /**
+     * 引证次数
+     */
+    private String patCitedQuantity;
+
+    /**
+     * 第一申请人地址
+     */
+    private String address;
+    /**
+     * 第一申请人地址
+     */
+    private String addrProvince;
+    /**
+     * 第一申请人地址
+     */
+    private String addrCity;
+    /**
+     * 第一申请人地址
+     */
+    private String addrCounty;
+
+    /**
+     * 申请人信息
+     */
+    private List<ApplicantInfoPojo> applicantInfo;
+
+    @Data
+    public static class ApplicantInfoPojo{
+        /**
+         * 申请人姓名
+         */
+        private String applicantInfoName;
+        /**
+         * 申请人类型
+         */
+        private String applicantInfoType;
+        /**
+         * 申请人国家
+         */
+        private String applicantInfoCountry;
+
+    }
+
+}

+ 88 - 0
PAS/src/main/java/cn/cslg/pas/controller/CniprController.java

@@ -0,0 +1,88 @@
+package cn.cslg.pas.controller;
+
+import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.model.dto.CniprFrontDTO;
+import cn.cslg.pas.common.model.dto.CniprSf1V1DTO;
+import cn.cslg.pas.common.utils.Response;
+import cn.cslg.pas.service.CniprService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import java.io.IOException;
+
+/**
+ * 对接Cnipr平台的controller层
+ *
+ * @Author xiexiang
+ * @Date 2023/4/17
+ */
+@Tag(name = "Cnipr平台")
+@Slf4j
+@RestController
+@RequiredArgsConstructor
+@RequestMapping(Constants.API_VERSION_V2 + "/Cnipr")
+public class CniprController {
+    private final CniprService cniprService;
+
+    @Operation(summary = "测试Cnipr检索")
+    @GetMapping("/test")
+    public String testCnipr() throws IOException {
+        String res = cniprService.getAccessTokenAndOpenId();
+        return Response.success(res);
+    }
+
+    @Operation(summary = "测试Cnipr sf1v1检索")
+    @PostMapping("/search")
+    public String SearchCnipr(@RequestBody CniprSf1V1DTO cniprSf1V1DTO) throws IOException {
+        String res = cniprService.searchSf1V1(cniprSf1V1DTO);
+        return Response.success(res);
+    }
+
+    @Operation(summary = "测试数据装载")
+    @PostMapping("/to")
+    public String CniprToXiaoShi(@RequestBody CniprFrontDTO cniprFrontDTO) throws IOException {
+        CniprFrontDTO cniprFrontDTO1 = cniprService.CniprToXiaoShi(cniprFrontDTO);
+        return Response.success(cniprFrontDTO1);
+    }
+
+    @Operation(summary = "测试pi11")
+    @GetMapping("/pi11")
+    public String CniprPi11(String pid) throws IOException {
+        String res = cniprService.GetPicturePdf(pid);
+        return Response.success(res);
+    }
+
+    @Operation(summary = "测试pi12")
+    @GetMapping("/pi12")
+    public String CniprPi12(String pid) throws IOException {
+        String res = cniprService.GetAbsPicture(pid);
+        return Response.success(res);
+    }
+
+    @Operation(summary = "测试pi13")
+    @GetMapping("/pi13")
+    public String CniprPi13(String pid,String target) throws IOException {
+        String res = cniprService.GetPatentInstructionText(pid,target);
+        return Response.success(res);
+    }
+
+    @Operation(summary = "测试pi14")
+    @GetMapping("/pi14")
+    public String CniprPi14(String pid,String target) throws IOException {
+        String res = cniprService.GetPatentAppPicture(pid,target);
+        return Response.success(res);
+    }
+
+    @Operation(summary = "测试pi16")
+    @GetMapping("/pi16")
+    public String CniprPi16(String pid,String resource_name) throws IOException {
+        String res = cniprService.GetPatentIllustration(pid,resource_name);
+        return Response.success(res);
+    }
+
+
+}
+

+ 186 - 0
PAS/src/main/java/cn/cslg/pas/domain/PatentCell.java

@@ -0,0 +1,186 @@
+package cn.cslg.pas.domain;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+/**
+ * @Author xiexiang
+ * @Date 2023/4/19
+ */
+@Accessors(chain = true)
+@Data
+public class PatentCell {
+    /**
+     * 专利号√
+     */
+    private String patentNo;
+    /**
+     * 著录标题√
+     */
+    private String title;
+    /**
+     * 申请地址
+     */
+    private String applications;
+    private String legal;
+    private String url;
+    private String abstrc;
+    /**
+     * 摘要附图路径
+     */
+    private String picUrl;
+    /**
+     * 其他附图路径
+     */
+    private List<String> otherUrls;
+    /**
+     * 申请号√
+     */
+    private String applicationNo;
+    /**
+     * 专题库id
+     */
+    private Integer projectId;
+    /**
+     * 报告id
+     */
+    private Integer reportId;
+    /**
+     * 国家/省市√
+     */
+    private String country;
+    /**
+     * 申请日√
+     */
+    private String applicationDate;
+    /**
+     * 公开日√
+     */
+    private String pubilcDate;
+    /**
+     * 公开授权号/授权公告号√
+     */
+    private String publicAccreditNo;
+    /**
+     * 公开授权日/授权公告日√
+     */
+    private String publicAccreditDate;
+    /**
+     * 主分类号√
+     */
+    private String mainIpc;
+    /**
+     * 分类号√
+     */
+    private List<String> ipc;
+    /**
+     * 申请人√
+     */
+    private List<String> applicationPersons;
+    /**
+     * 申请人地址
+     */
+    private List<String> applicationAddress;
+    /**
+     * 发明人√
+     */
+    private List<String> inventors;
+    /**
+     * 当前权利人
+     */
+    private List<String> applicationCurrents;
+    private List<String> applicationCurrentAddress;
+    /**
+     * 范畴分类
+     */
+    private String classical;
+    /**
+     * 状态/当前状态
+     */
+    private String statue;
+    /**
+     * 摘要√
+     */
+    private String abstrText;
+    /**
+     * 主权要√
+     */
+    private String mainRight;
+    /**
+     * 权要√
+     */
+    private List<String> rights;
+    /**
+     * PDF文档路径
+     */
+    private String PDFUrl;
+    /**
+     * PDF文档大小
+     */
+    private Long PDFSize;
+    /**
+     * PDF文档名称
+     */
+    private String PDFName;
+
+    /**
+     * 说明书
+     */
+    private String patentInstructionText;
+    /**
+     * 公开号√
+     */
+    private String publicNo;
+    /**
+     * 代理机构√
+     */
+    private String agency;
+    /**
+     * 代理人√
+     */
+    private List<String> agencyPersons;
+
+    /**
+     * 优先权信息
+     */
+    private String priorityInformation;
+    /**
+     * 预估到期日
+     */
+    private String estimatedMaturityDate;
+    /**
+     * 权要数量√
+     */
+    private String rightsNum;
+    /**
+     * 同族号
+     */
+    private String familyId;
+    /**
+     * 优先权信息(优先权号、优先权国家、优先权日)√
+     */
+    private List<Priority> priorities;
+    /**
+     * 专利法律状态√
+     */
+    List<PatentAffair> patentAffairs;
+
+    @Data
+    public static class PatentAffair {
+        /**
+         * 法律状态
+         */
+        private String status;
+        /**
+         * 发生日期
+         */
+        private String dateTime;
+        /**
+         * 简单法律状态
+         */
+        private String simpleStatus;
+
+    }
+}

+ 31 - 0
PAS/src/main/java/cn/cslg/pas/domain/PatentCnipr.java

@@ -0,0 +1,31 @@
+package cn.cslg.pas.domain;
+
+import cn.cslg.pas.common.model.dto.PatentDTO;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+/**
+ * @Author xiexiang
+ * @Date 2023/4/23
+ */
+@Accessors(chain = true)
+@Data
+public class PatentCnipr extends PatentDTO {
+    /**
+     * 主权要
+     */
+    private String mainRight;
+
+    /**
+     * 优先权信息(优先权号、优先权国家、优先权日)√
+     */
+    private List<Priority> priorities;
+
+    /**
+     * 国家/省市√
+     */
+    private String country;
+
+}

+ 29 - 0
PAS/src/main/java/cn/cslg/pas/domain/Priority.java

@@ -0,0 +1,29 @@
+package cn.cslg.pas.domain;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 优先权信息(优先权号、优先权国家、优先权日)
+ *
+ * @Author xiexiang
+ * @Date 2023/4/19
+ */
+@Accessors(chain = true)
+@Data
+public class Priority implements Serializable {
+    /**
+     * 优先权号
+     */
+    private String priorityNo;
+    /**
+     * 优先权国家
+     */
+    private String priorityCountry;
+    /**
+     * 优先权日
+     */
+    private String priorityDate;
+}

文件差异内容过多而无法显示
+ 664 - 0
PAS/src/main/java/cn/cslg/pas/service/CniprService.java