浏览代码

20250317修改查询对比文献

lrj 6 月之前
父节点
当前提交
58585cf74f

+ 15 - 6
src/main/java/cn/cslg/pas/controller/CommonController.java

@@ -10,6 +10,7 @@ import cn.cslg.pas.common.dto.AddSelfFieldDTO;
 import cn.cslg.pas.common.vo.QueryFieldsVO;
 import cn.cslg.pas.common.vo.PersonSelfFieldVO;
 import cn.cslg.pas.domain.business.SystemDict;
+import cn.cslg.pas.service.AiUseRecordService;
 import cn.cslg.pas.service.business.AssoScenarioMatterService;
 import cn.cslg.pas.service.business.CommonService;
 import cn.cslg.pas.service.business.ScenarioService;
@@ -44,10 +45,11 @@ public class CommonController {
     @Autowired
     private PersonFieldService personFieldService;
     @Autowired
-    private EsCustomFieldService esCustomFieldService;
+    private AiUseRecordService aiUseRecordService;
+
+    @Autowired
+    private JobService jobService;
 
-   @Autowired
-   private JobService jobService;
     @PostMapping("getOsSystemDict")
     @Operation(summary = "根据类型获取所有字典项")
     public Response getOSSystemDict(@RequestBody List<String> types) {
@@ -148,9 +150,9 @@ public class CommonController {
 
     @GetMapping("addSysCycleJob")
     @Operation(summary = "获得检索栏位")
-    public Response addSysCycleJob() throws Exception{
-        QrtzTaskDTO qrtzTaskDTO =new QrtzTaskDTO();
-        QuartzVO quartzVO =new QuartzVO();
+    public Response addSysCycleJob() throws Exception {
+        QrtzTaskDTO qrtzTaskDTO = new QrtzTaskDTO();
+        QuartzVO quartzVO = new QuartzVO();
         quartzVO.setJobName("sys_cycle_job");
         quartzVO.setJobGroupName("sys_cycle_job_group");
         quartzVO.setTriggerGroupName("sys_cycle_trigger_group");
@@ -163,4 +165,11 @@ public class CommonController {
         return Response.success("");
     }
 
+    @GetMapping("addAiUseRecord")
+    @Operation(summary = "添加ai使用记录")
+    public Response addAiUseRecord() {
+        aiUseRecordService.addAiUseRecord();
+        return Response.success("");
+    }
+
 }

+ 2 - 2
src/main/java/cn/cslg/pas/controller/outApi/PatentStarController.java

@@ -178,7 +178,7 @@ public class PatentStarController {
     @GetMapping("/queryPatentDetailByPatentNo")
     @Operation(summary = "用于窍笔根据号码获取专利检索详情数据")
     public Response queryPatentDetailByPatentNo(String patentNo) throws IOException {
-        PatentInfoDTO infoDTO = patentStarApiService.queryPatentDetailByPatentNo(patentNo);
-        return Response.success(infoDTO);
+//        PatentInfoDTO infoDTO = patentStarApiService.queryPatentDetailByPatentNo(patentNo);
+        return Response.success("infoDTO");
     }
 }

+ 25 - 0
src/main/java/cn/cslg/pas/domain/AiUseRecord.java

@@ -0,0 +1,25 @@
+package cn.cslg.pas.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 行政诉讼书
+ * @Author xiexiang
+ * @Date 2023/12/28
+ */
+@Data
+@TableName("ai_use_record")
+public class AiUseRecord extends BaseEntity<AiUseRecord> {
+    @TableField(value = "create_id")
+    private String createId;
+
+    /**
+     * 创建时间
+     */
+    @TableField(value = "create_time")
+    private Date createTime;
+}

+ 14 - 0
src/main/java/cn/cslg/pas/mapper/AiUseRecordMapper.java

@@ -0,0 +1,14 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.domain.AiUseRecord;
+import cn.cslg.pas.domain.business.AdminProceed;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @Author lrj
+ * @Date 2025/03/24
+ */
+@Repository
+public interface AiUseRecordMapper extends BaseMapper<AiUseRecord> {
+}

+ 31 - 0
src/main/java/cn/cslg/pas/service/AiUseRecordService.java

@@ -0,0 +1,31 @@
+package cn.cslg.pas.service;
+
+
+import cn.cslg.pas.common.utils.LoginUtils;
+import cn.cslg.pas.domain.AiUseRecord;
+
+import cn.cslg.pas.mapper.AiUseRecordMapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * @Author lrj
+ * @Date 2024/3/25
+ */
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class AiUseRecordService extends ServiceImpl<AiUseRecordMapper, AiUseRecord> {
+    private final LoginUtils loginUtils;
+
+    public void addAiUseRecord() {
+        String id = loginUtils.getId() + "";
+        AiUseRecord aiUseRecord = new AiUseRecord();
+        aiUseRecord.setCreateId(id);
+        aiUseRecord.insert();
+    }
+
+}

+ 17 - 108
src/main/java/cn/cslg/pas/service/common/PatentStarApiService.java

@@ -23,7 +23,6 @@ import cn.cslg.pas.service.WebLoginConfigService;
 import cn.cslg.pas.service.importPatent.WebVOTransformService;
 import cn.cslg.pas.service.novelty.AssoRetrieveRecordProjectService;
 import cn.cslg.pas.service.query.FormatQueryService;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.sun.istack.NotNull;
@@ -32,7 +31,6 @@ import lombok.experimental.Accessors;
 import lombok.extern.slf4j.Slf4j;
 import okhttp3.*;
 import okhttp3.Response;
-import org.apache.commons.lang3.ObjectUtils;
 import org.dom4j.Document;
 import org.dom4j.DocumentException;
 import org.dom4j.Element;
@@ -47,7 +45,6 @@ import org.springframework.context.ApplicationContext;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
-import org.springframework.web.multipart.MultipartFile;
 
 import java.io.File;
 import java.io.IOException;
@@ -89,8 +86,6 @@ public class PatentStarApiService {
     private AssoRetrieveRecordProjectService assoRetrieveRecordProjectService;
     @Autowired
     private NOSCacheService cacheService;
-    @Autowired
-    private FileManagerService fileManagerService;
 
     public Records patentStarSearchLocal(PatentStarListDTO patentStarListDTO) throws IOException {
         RetrieveRecord retrieveRecord = retrieveRecordService.setRetrieveRecord(patentStarListDTO);
@@ -128,7 +123,7 @@ public class PatentStarApiService {
                 assoRetrieveRecordProjectService.add(retrieveRecord.getId(), projectId);
             }
         } else {
-            retrieveRecord =retrieveRecordService.getById(patentStarListDTO.getRetrieveRecordId());
+            retrieveRecord = retrieveRecordService.getById(patentStarListDTO.getRetrieveRecordId());
             retrieveRecord.setRetrieveTime(new Date());
             retrieveRecord.updateById();
         }
@@ -156,6 +151,7 @@ public class PatentStarApiService {
 
     /**
      * 格式化条件后并请求外部接口
+     *
      * @param PatentStarListDTO
      * @return
      * @throws IOException
@@ -194,9 +190,9 @@ public class PatentStarApiService {
         String signMd5 = FormatUtil.MD5(Sign);
         // 创建一个OkHttpClient对象
         OkHttpClient okHttpClient = new OkHttpClient.Builder()
-                .connectTimeout(300, TimeUnit.SECONDS)
-                .writeTimeout(300, TimeUnit.SECONDS)
-                .readTimeout(300, TimeUnit.SECONDS)
+                .connectTimeout(5, TimeUnit.SECONDS)
+                .writeTimeout(5, TimeUnit.SECONDS)
+                .readTimeout(5, TimeUnit.SECONDS)
                 .addInterceptor(new PatentStarApiService.OkhttpInterceptor(3))
                 .build();
 
@@ -252,7 +248,7 @@ public class PatentStarApiService {
             for (PatentColumnDTO columnDTO : columnDTOS) {
                 if (containsNumber(columnDTO, formattedNo)) {
                     PatentColumnDTO dto = new PatentColumnDTO();
-                    BeanUtils.copyProperties(columnDTO,dto);
+                    BeanUtils.copyProperties(columnDTO, dto);
                     dto.setSearchNo(patentNo);
                     result.add(dto);
                     searchedNumbers.add(patentNo); // 标记为已搜索
@@ -375,6 +371,7 @@ public class PatentStarApiService {
      * 从专利之星获取中国专利著录
      */
     public String getCnBibApi(String appNo) {
+        Long start = System.currentTimeMillis();
         String url = "https://api.patentstar.com.cn/api/Patent/CnBibo/" + appNo;
         JSONObject configObject = this.getConfigObject(4, 2);
         String appId = configObject.getString("appId");
@@ -399,6 +396,8 @@ public class PatentStarApiService {
         // 发送请求获取响应
         try {
             Response response = okHttpClient.newCall(request).execute();
+            Long end = System.currentTimeMillis();
+            System.out.println("get zhulu cost" + (end - start));
             // 判断请求是否成功
             if (response.isSuccessful()) {
                 // 打印服务端返回结果
@@ -453,7 +452,7 @@ public class PatentStarApiService {
             e.printStackTrace();
             return null;
         }
-        return "{}";
+        return null;
     }
 
     /**
@@ -463,7 +462,7 @@ public class PatentStarApiService {
      * @author 李仁杰
      * 从专利之星获取中国专利外观图
      */
-    public String getWGPictureApi(String appNo) throws IOException {
+    public String getWGPictureApi(String appNo) {
         String url = "https://api.patentstar.com.cn/api/Patent/CnWGImage/" + appNo;
         JSONObject configObject = this.getConfigObject(4, 2);
         String appId = configObject.getString("appId");
@@ -497,7 +496,7 @@ public class PatentStarApiService {
         } catch (IOException e) {
             e.printStackTrace();
         }
-        return "{}";
+        return null;
     }
 
     /**
@@ -539,7 +538,7 @@ public class PatentStarApiService {
         } catch (IOException e) {
             e.printStackTrace();
         }
-        return "{}";
+        return null;
     }
 
     /**
@@ -789,7 +788,7 @@ public class PatentStarApiService {
      * 从专利之星获取同族专利
      */
     public String getFamilyByPubNoApi(String patentNo) {
-        patentNo = "CN217038881U";
+        Long start = System.currentTimeMillis();
         String url = "https://api.patentstar.com.cn/api/Patent/FamilyByPubNo/" + patentNo;
         JSONObject configObject = this.getConfigObject(4, 2);
         String appId = configObject.getString("appId");
@@ -813,6 +812,8 @@ public class PatentStarApiService {
         // 发送请求获取响应
         try {
             Response response = okHttpClient.newCall(request).execute();
+            Long end = System.currentTimeMillis();
+            System.out.println("get family cost" + (end - start));
             // 判断请求是否成功
             if (response.isSuccessful()) {
                 // 打印服务端返回结果
@@ -1146,98 +1147,6 @@ public class PatentStarApiService {
     }
 
     /**
-     * 根据专利号查询外部权利要求
-     *
-     * @param patentNo
-     * @return
-     * @throws IOException
-     */
-    public PatentInfoDTO queryPatentDetailByPatentNo(String patentNo) throws IOException {
-        PatentStarListDTO patentStarListDTO = new PatentStarListDTO();
-        String condition = "AN=" + patentNo + " OR " + "PN=" + patentNo + " OR " + "GN=" + patentNo;
-        patentStarListDTO.setCurrentQuery(condition);
-        String index = patentNo.substring(0, 2);
-        if (index.equals("CN") || index.equals("ZL")) {
-            patentStarListDTO.setDBType("CN");
-        } else {
-            patentStarListDTO.setDBType("WD");
-        }
-        patentStarListDTO.setOrderBy("AD");
-        patentStarListDTO.setOrderByType("DESC");
-        patentStarListDTO.setPageNum(1);
-        patentStarListDTO.setRowCount(10);
-        Records records = this.patentStarSearchLocal(patentStarListDTO);
-        Object data = records.getData();
-        String s = JSON.toJSONString(data);
-        List<PatentColumnDTO> list = JSON.parseArray(s, PatentColumnDTO.class);
-        PatentInfoDTO dto = new PatentInfoDTO();
-        if (!CollectionUtils.isEmpty(list)) {
-            for (PatentColumnDTO columnDTO : list) {
-                BeanUtils.copyProperties(columnDTO, dto);
-            }
-        }
-        if (StringUtils.isNotEmpty(dto.getRowApplicationNo())) {
-            String txtGuid = this.getTxtGuid(dto.getRowApplicationNo(), patentNo);
-            dto.setTxtGuid(txtGuid);
-        }
-        List<InnerPatentPdfDTO> pdfList = this.getExternalTextPdf(dto.getAppNo(), dto.getRowApplicationNo(), dto.getPublicNo(), dto.getGrantNo());
-        if (!CollectionUtils.isEmpty(pdfList)) {
-            List<InnerPatentPdfDTO> pdfDTOS = new ArrayList<>();
-            for (InnerPatentPdfDTO innerPatentPdfDTO : pdfList) {
-                File file = FileUtils.getFileByUrl(innerPatentPdfDTO.getPdfGuid());
-                List<String> guidList = fileManagerService.uploadFileGetGuid2(Collections.singletonList(file));
-                if (!CollectionUtils.isEmpty(guidList)) {
-                    InnerPatentPdfDTO pdfDTO = new InnerPatentPdfDTO();
-                    pdfDTO.setPdfGuid(guidList.get(0));
-                    pdfDTO.setType(innerPatentPdfDTO.getType());
-                    pdfDTOS.add(pdfDTO);
-                }
-            }
-            dto.setPdfDTOS(pdfDTOS);
-        }
-        return dto;
-    }
-
-    public String getTxtGuid(String rowApplicationNo,String patentNo) throws IOException {
-        StringBuilder builder = new StringBuilder();
-        SelectClaimDTO externalClaim = this.queryExternalClaim(rowApplicationNo);
-        if (ObjectUtils.isNotEmpty(externalClaim)) {
-            List<Text> claimContent = externalClaim.getClaimContent();
-            if (!CollectionUtils.isEmpty(claimContent)) {
-                Text text = claimContent.stream().filter(i -> i.getIfOrigin().equals(true)).findFirst().orElse(null);
-                if (ObjectUtils.isNotEmpty(text)) {
-                    String claim = text.getTextContent();
-                    String claimStr = claim.replaceAll("\t", "\n");
-                    builder.append("                                   权利要求");
-                    builder.append("\n");
-                    builder.append(claimStr);
-                }
-            }
-        }
-        List<Text> fullText = this.getCnFullText(rowApplicationNo);
-        if (!CollectionUtils.isEmpty(fullText)) {
-            Text text = fullText.stream().filter(i -> i.getIfOrigin().equals(true)).findFirst().orElse(null);
-            if (ObjectUtils.isNotEmpty(text)) {
-                String specification = text.getTextContent();
-                builder.append("\n");
-                builder.append("\n");
-                builder.append("\n");
-                builder.append("                                         说明书");
-                builder.append("\n");
-                builder.append(specification);
-            }
-        }
-        String result = builder.toString();
-        byte[] bytes = result.getBytes();
-        MultipartFile multipartFile = FileUtils.convertBytesToMultipartFile(bytes, patentNo + "-" + "文本文档.txt");
-        List<String> list = fileManagerService.uploadFileGetGuid(Collections.singletonList(multipartFile));
-        if (!CollectionUtils.isEmpty(list)) {
-            return list.get(0);
-        }
-        return "";
-    }
-
-    /**
      * 查询外部专利同族专利
      *
      * @param vo
@@ -1508,7 +1417,7 @@ public class PatentStarApiService {
             Request request = chain.request();
             Response response = null;
             try {
-               System.out.println("第" + (retryCent + 1) + "次执行发http请求.");
+                System.out.println("第" + (retryCent + 1) + "次执行发http请求.");
                 response = chain.proceed(request);
             } catch (Exception e) {
                 if (maxRentry > retryCent) {