Jelajahi Sumber

查询专利号带筛选 2022/2/8

lwhhszx 2 tahun lalu
induk
melakukan
56c3bd3da9

+ 5 - 0
PAS/pom.xml

@@ -157,6 +157,11 @@
             <artifactId>poi-scratchpad</artifactId>
             <version>${poi.version}</version>
         </dependency>
+        <dependency>
+            <groupId>commons-fileupload</groupId>
+            <artifactId>commons-fileupload</artifactId>
+            <version>1.3.3</version>
+        </dependency>
     </dependencies>
 
     <build>

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

@@ -32,6 +32,10 @@ public class QueryPatentVO extends BaseVO {
 
     private Integer endNumber;
 
+    private String orderType;
+
+    private String orderItem;
+
     @Schema(description = "专题库自定义选项列表")
     private List<SourceVO> PasOptions;
 

+ 13 - 0
PAS/src/main/java/cn/cslg/pas/common/model/dto/RMS/ComPatentDTO.java

@@ -0,0 +1,13 @@
+package cn.cslg.pas.common.model.dto.RMS;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ComPatentDTO {
+    private Integer total;
+    private Long size;
+    private Long current;
+
+}

+ 66 - 0
PAS/src/main/java/cn/cslg/pas/common/utils/FileUtils.java

@@ -3,11 +3,16 @@ package cn.cslg.pas.common.utils;
 import cn.cslg.pas.common.model.dto.UploadFileDTO;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.util.IdUtil;
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
 import org.springframework.boot.system.ApplicationHome;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
 
 import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
 import java.nio.charset.StandardCharsets;
 
 @Service
@@ -145,5 +150,66 @@ public class FileUtils {
         return last.toString();
     }
 
+
+    public static MultipartFile fileToMultipartFile(File file) {
+        DiskFileItemFactory diskFileItemFactory = new DiskFileItemFactory(16, null);
+        FileItem item = diskFileItemFactory.createItem(file.getName(), "text/plain", true, file.getName());
+        int bytesRead = 0;
+        byte[] buffer = new byte[8192];
+        try {
+            FileInputStream fis = new FileInputStream(file);
+            OutputStream os = item.getOutputStream();
+            int len = 8192;
+            while ((bytesRead = fis.read(buffer, 0, len)) != -1){
+                os.write(buffer, 0, bytesRead);
+            }
+            os.close();
+            fis.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return (MultipartFile)new CommonsMultipartFile(item);
+    }
+
+    public static File getFile(String url) throws Exception {
+        //读取图片类型
+        String fileName = url.substring(url.lastIndexOf("."),url.length());
+        File file = null;
+
+        URL urlfile;
+        InputStream inStream = null;
+        OutputStream os = null;
+        try {
+            file = File.createTempFile("new_url", ".jpg");
+            //获取文件
+            urlfile = new URL(url);
+            inStream = urlfile.openStream();
+            os = new FileOutputStream(file);
+
+            int bytesRead = 0;
+            byte[] buffer = new byte[8192];
+            while ((bytesRead = inStream.read(buffer, 0, 8192)) != -1) {
+                os.write(buffer, 0, bytesRead);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                if (null != os) {
+                    os.close();
+                }
+                if (null != inStream) {
+                    inStream.close();
+                }
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+
+        return file;
+    }
+
+
 }
 

+ 19 - 8
PAS/src/main/java/cn/cslg/pas/controller/PatentController.java

@@ -3,26 +3,31 @@ package cn.cslg.pas.controller;
 import cn.cslg.pas.common.core.annotation.Permission;
 import cn.cslg.pas.common.core.base.Constants;
 import cn.cslg.pas.common.model.dto.PatentDTO;
+import cn.cslg.pas.common.model.dto.UploadFileDTO;
+import cn.cslg.pas.common.utils.*;
 import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
 import cn.cslg.pas.common.utils.auth.checkAuth;
 import cn.cslg.pas.domain.Patent;
 import cn.cslg.pas.common.model.vo.*;
-import cn.cslg.pas.common.utils.JsonUtils;
-import cn.cslg.pas.common.utils.Response;
-import cn.cslg.pas.common.utils.ResponseEnum;
-import cn.cslg.pas.common.utils.StringUtils;
 import cn.cslg.pas.domain.PatentRight;
 import cn.cslg.pas.service.*;
-import cn.cslg.pas.common.utils.CacheUtils;
 import cn.dev33.satoken.stp.StpUtil;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.Parameters;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.compress.utils.IOUtils;
+import org.apache.tomcat.util.http.fileupload.disk.DiskFileItem;
 import org.springframework.context.annotation.Lazy;
+import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
 
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
 import java.util.Collections;
 import java.util.List;
 
@@ -47,7 +52,7 @@ public class PatentController {
     private final ProjectFieldPatentLinkService projectFieldPatentLinkService;
     private final LoginUtils loginUtils;
     private  final PatentRightService patentRightService;
-
+    private final FileUtils fileUtils;
     @GetMapping("/read/total")
     @Operation(summary = "专利阅读状态统计")
     public String getPatentReadTotal(PatentReadVO params) {
@@ -187,10 +192,16 @@ public class PatentController {
     @PostMapping("getPagination")
     @Operation(summary = "分页获取专利")
     public String getPagination(@RequestBody PatentVO patentVO){
-
        return patentService.getPagination(patentVO.getPatentNos(),patentVO.getStartNumber());
     }
-
+    @GetMapping("test")
+    @Operation(summary = "141541")
+    public UploadFileDTO test(String url) throws Exception {
+        File pdfFile= FileUtils.getFile(url);
+   MultipartFile file =    FileUtils.fileToMultipartFile(pdfFile);
+        UploadFileDTO fileDTO = fileUtils.uploadFile(file);
+        return fileDTO;
+    }
 
 
 }

+ 4 - 2
PAS/src/main/java/cn/cslg/pas/controller/SystemController.java

@@ -4,6 +4,7 @@ import cn.cslg.pas.common.core.base.Constants;
 import cn.cslg.pas.common.model.QueryPatentVO;
 import cn.cslg.pas.common.model.vo.PatentVO;
 import cn.cslg.pas.common.model.vo.TaskVO;
+import cn.cslg.pas.common.utils.FileUtils;
 import cn.cslg.pas.common.utils.Response;
 import cn.cslg.pas.domain.Patent;
 import cn.cslg.pas.domain.ProjectField;
@@ -18,6 +19,7 @@ import lombok.RequiredArgsConstructor;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -40,7 +42,7 @@ public class SystemController {
     private final PatentService patentService;
     private final PatentFieldService patentFieldService;
     private final ClientService clientService;
-    private final PatentApplicantService patentApplicantService;
+
     @PostMapping("dict")
     @Operation(summary = "根据类型获得字典")
     public String getPageList(@RequestBody  List<String> dicts) {
@@ -88,7 +90,7 @@ public class SystemController {
     @PostMapping("gcease1")
     @Operation(summary = "测试11111")
     public List<Integer> getAllClient1() {
-        return patentApplicantService.test();
+        return new ArrayList<>();
     }
 }
 

+ 0 - 41
PAS/src/main/java/cn/cslg/pas/service/PatentApplicantService.java

@@ -337,45 +337,4 @@ public class PatentApplicantService extends ServiceImpl<PatentApplicantMapper, P
         }
     }
 
-    @Transactional(rollbackFor = Exception.class)
-    public List<Integer>  test(){
-List<String> names =  this.baseMapper.getNames();
-
-List<Integer> ids1 =new ArrayList<>();
-names.forEach(item->{
-    LambdaQueryWrapper<PatentApplicant> wrapper =new LambdaQueryWrapper<>();
-    wrapper.eq(PatentApplicant::getName,item);
-    List<PatentApplicant> lists =this.list(wrapper);
-    List<Integer> ids =lists.stream().map(PatentApplicant::getId).collect(Collectors.toList());
-    if(ids.size()<=1){
-        System.out.println("个数为"+ids.size());
-    }
-    Integer id =0;
-   for(PatentApplicant tem :lists) {
-       if (tem.getName().equals(tem.getShortName()) ) {
-           ids.remove(tem.getId());
-           id = tem.getId();
-           ids1.addAll(ids);
-           break;
-       }
-   }
-    PatentApplicant t=lists.get(0);
-    id =t.getId();
-    ids.remove(t.getId());;
-    ids1.addAll(ids);
-   if(id!=0){
-       LambdaUpdateWrapper<PatentApplicantLink> tem =new LambdaUpdateWrapper<>();
-       tem.set(PatentApplicantLink::getApplicantId,id)
-               .in(PatentApplicantLink::getApplicantId,ids);
-       patentApplicantLinkService.update(null,tem);
-       LambdaUpdateWrapper<PatentApplicantMergeLink> te =new LambdaUpdateWrapper<>();
-       te.set(PatentApplicantMergeLink::getApplicantId,id)
-               .in(PatentApplicantMergeLink::getApplicantId,ids);
-       patentApplicantMergeLinkService.update(null,te);
-   }
-        }
-);
-this.removeByIds(ids1);
-return  ids1;
-    }
 }

+ 5 - 2
PAS/src/main/java/cn/cslg/pas/service/PatentRightService.java

@@ -94,15 +94,18 @@ public class PatentRightService extends ServiceImpl<PatentRightMapper, PatentRig
 
     public List<Authority> splits(PatentRightParams params) {
         //去掉全要开头的""
-
+        List<Authority> list = new ArrayList<>();
         String selfContent = params.getContent();
+        if(selfContent==null){
+            selfContent="";
+        }
         //청구항 2. 삭제(是否删除代办)
       //  selfContent.replaceAll("청구항(\\s)(^\\d*$+)(\\s)삭제","");
         selfContent.replaceAll("''", "");
         selfContent.replaceAll("(^\\d*$+)-(^\\d*$+)(\\.)(\\s)(canceled)","");
 //        selfContent.replaceAll("(^\\d*$+)(.)(\\s)(canceled)","");
         selfContent.replaceAll("\n", " ");
-        List<Authority> list = new ArrayList<>();
+
         //找到1. 2. ...这种格式的正则表达式
         String str1 = "(^\\d*$+)(\\.)";
         //找到[001]或者[002]这种格式的

+ 50 - 1
PAS/src/main/java/cn/cslg/pas/service/PatentService.java

@@ -538,7 +538,6 @@ public class PatentService extends ServiceImpl<PatentMapper, Patent> {
         List<PatentSimpleFamilyLink> patentPatSnapFamilyLinkList = patentSimpleFamilyLinkService.getPatentSimpleFamilyLinkByFamilyIds(dataPage.stream().map(Patent::getPatSnapFamily).collect(Collectors.toList()));
         List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Arrays.asList(Constants.PATENT_TYPE, Constants.PATENT_SIMPLE_STATUS));
         dataPage.forEach(item -> {
-
             PatentDTO patentDTO = new PatentDTO();
             BeanUtils.copyProperties(item, patentDTO);
             patentDTO.setApplicationDate(DateUtils.formatDate(item.getApplicationDate(), DateUtils.YYYY_MM_DD));
@@ -570,6 +569,53 @@ public class PatentService extends ServiceImpl<PatentMapper, Patent> {
         });
         return records;
     }
+    //查询对比文件信息
+    public List<PatentDTO> getRmsComparePatent(PatentVO params) {
+        List<Patent> dataPage = baseMapper.getPatent(params.getPatentNos(),-1,-1);
+        List<PatentDTO> records = new ArrayList<>();
+        List<Integer> patentIds = dataPage.stream().map(Patent::getId).collect(Collectors.toList());
+        List<PatentApplicant> patentApplicantList = patentApplicantService.getPatentApplicantByPatentIds(patentIds);
+        List<PatentInventor> patentInventorList = patentInventorService.getPatentInventorByPatentIds(patentIds);
+        List<PatentClassNumberLink> patentClassNumberLinkList = patentClassNumberLinkService.getPatentClassNumberLinkByPatentIds(patentIds);
+        List<PatentAgent> patentAgentList = patentAgentService.getPatentAgentByPatentIds(patentIds);
+        List<PatentAgency> patentAgencyList = patentAgencyService.getPatentAgencyByIds(dataPage.stream().filter(item -> StringUtils.isNotEmpty(item.getAgencyId())).map(item -> Integer.parseInt(item.getAgencyId())).distinct().collect(Collectors.toList()));
+        List<PatentSimpleFamilyLink> patentSimpleFamilyLinkList = patentSimpleFamilyLinkService.getPatentSimpleFamilyLinkByFamilyIds(dataPage.stream().map(Patent::getSimpleFamily).collect(Collectors.toList()));
+        List<PatentSimpleFamilyLink> patentInpadocFamilyLinkList = patentSimpleFamilyLinkService.getPatentSimpleFamilyLinkByFamilyIds(dataPage.stream().map(Patent::getInpadocFamily).collect(Collectors.toList()));
+        List<PatentSimpleFamilyLink> patentPatSnapFamilyLinkList = patentSimpleFamilyLinkService.getPatentSimpleFamilyLinkByFamilyIds(dataPage.stream().map(Patent::getPatSnapFamily).collect(Collectors.toList()));
+        List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Arrays.asList(Constants.PATENT_TYPE, Constants.PATENT_SIMPLE_STATUS));
+        dataPage.forEach(item -> {
+            PatentDTO patentDTO = new PatentDTO();
+            BeanUtils.copyProperties(item, patentDTO);
+            patentDTO.setApplicationDate(DateUtils.formatDate(item.getApplicationDate(), DateUtils.YYYY_MM_DD));
+            patentDTO.setPriorityDate(DateUtils.formatDate(item.getPriorityDate(), DateUtils.YYYY_MM_DD));
+            patentDTO.setPublicDate(DateUtils.formatDate(item.getPublicDate(), DateUtils.YYYY_MM_DD));
+            patentDTO.setPublicAccreditDate(DateUtils.formatDate(item.getPublicAccreditDate(), DateUtils.YYYY_MM_DD));
+            patentDTO.setFirstPublicDate(DateUtils.formatDate(item.getFirstPublicDate(), DateUtils.YYYY_MM_DD));
+            patentDTO.setSimpleStatus(systemDictList.stream().filter(systemDict -> systemDict.getType().equals(Constants.PATENT_SIMPLE_STATUS) && systemDict.getValue().equals(String.valueOf(item.getSimpleStatus()))).findFirst().orElse(new SystemDict()).getLabel());
+            patentDTO.setSimpleStatusInt(item.getSimpleStatus());
+            patentDTO.setType(systemDictList.stream().filter(systemDict -> systemDict.getType().equals(Constants.PATENT_TYPE) && systemDict.getValue().equals(String.valueOf(item.getType()))).findFirst().orElse(new SystemDict()).getLabel());
+            patentDTO.setApplicant(patentApplicantList.stream().filter(patentApplicant -> patentApplicant.getPatentId().equals(item.getId())).collect(Collectors.toList()));
+            patentDTO.setInventor(patentInventorList.stream().filter(patentInventor -> patentInventor.getPatentId().equals(item.getId())).collect(Collectors.toList()));
+            patentDTO.setIpcList(patentClassNumberLinkList.stream().filter(patentClassNumber -> patentClassNumber.getPatentId().equals(item.getId()) && patentClassNumber.getType().equals(Constants.PATENT_CLASS_NUMBER_IPC)).map(PatentClassNumberLink::getCode).distinct().collect(Collectors.toList()));
+            patentDTO.setCpcList(patentClassNumberLinkList.stream().filter(patentClassNumber -> patentClassNumber.getPatentId().equals(item.getId()) && patentClassNumber.getType().equals(Constants.PATENT_CLASS_NUMBER_CPC)).map(PatentClassNumberLink::getCode).distinct().collect(Collectors.toList()));
+            patentDTO.setUpcList(patentClassNumberLinkList.stream().filter(patentClassNumber -> patentClassNumber.getPatentId().equals(item.getId()) && patentClassNumber.getType().equals(Constants.PATENT_CLASS_NUMBER_UPC)).map(PatentClassNumberLink::getCode).distinct().collect(Collectors.toList()));
+            patentDTO.setLocList(patentClassNumberLinkList.stream().filter(patentClassNumber -> patentClassNumber.getPatentId().equals(item.getId()) && patentClassNumber.getType().equals(Constants.PATENT_CLASS_NUMBER_LOC)).map(PatentClassNumberLink::getCode).distinct().collect(Collectors.toList()));
+            if (StringUtils.isNotEmpty(item.getAgencyId())) {
+                patentDTO.setAgency(patentAgencyList.stream().filter(patentAgency -> patentAgency.getId().equals(Integer.parseInt(item.getAgencyId()))).findFirst().orElse(null));
+            }
+            PatentDTO.PatentFamily patentFamily = new PatentDTO.PatentFamily();
+            patentFamily.setSimple(patentSimpleFamilyLinkList.stream().filter(patentSimpleFamilyLink -> patentSimpleFamilyLink.getFamilyId().equals(item.getSimpleFamily())).map(PatentSimpleFamilyLink::getPatentNo).collect(Collectors.toList()));
+            patentFamily.setInpadoc(patentInpadocFamilyLinkList.stream().filter(patentSimpleFamilyLink -> patentSimpleFamilyLink.getFamilyId().equals(item.getInpadocFamily())).map(PatentSimpleFamilyLink::getPatentNo).collect(Collectors.toList()));
+            patentFamily.setPatSnap(patentPatSnapFamilyLinkList.stream().filter(patentSimpleFamilyLink -> patentSimpleFamilyLink.getFamilyId().equals(item.getPatSnapFamily())).map(PatentSimpleFamilyLink::getPatentNo).collect(Collectors.toList()));
+            patentDTO.setFamily(patentFamily);
+            patentDTO.setAffair(patentAffairService.getPatentAffairByPatentId(item.getId()));
+            patentDTO.setAgent(patentAgentList.stream().filter(patentAgent -> patentAgent.getPatentId().equals(item.getId())).collect(Collectors.toList()));
+            // TODO 性能优化
+            records.add(patentDTO);
+        });
+        return records;
+    }
+
 // 获得对比专利号
 public String getComPantentNos(PatentVO params){
   List<String> patents = baseMapper.getListForRMS(params);
@@ -1472,4 +1518,7 @@ public String getConPantentNos(QueryPatentVO params){
     }
 
 
+
+
+
 }

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

@@ -99,7 +99,6 @@ public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
     private final PatentInventorMergeService patentInventorMergeService;
     private final UserService userService;
     private final LoginUtils loginUtils;
-    private final SecurityUtils securityUtils;
     private final RequestService requestService;
 
     public Project getProjectByName(String name) {

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

@@ -375,6 +375,7 @@ public class UploadPatentBatchService {
             patentRightParams.setSelfContent(uploadParamsVO.getSelfContent());
         }
         patentRightService.updatePatentRight(patentRightParams);
+
         patentRightService.importAuthority(patentRightParams);
     }
 

+ 34 - 19
PAS/src/main/resources/mapper/PatentMapper.xml

@@ -1314,7 +1314,7 @@
             left join os_patent_typeno h on h.pid =a.id and h.type =3
         </if>
         <if test="params.projectId != null and params.PasOptions !=null and params.PasOptions.size()!=0">
-            left join os_thematic_pid i on i.pid=a.id  left join os_patent_field_patent_link j on a.id=j.pid
+            left join os_thematic_pid i on i.pid=a.id left join os_patent_field_patent_link j on a.id=j.pid
 
         </if>
         <where>
@@ -1357,8 +1357,6 @@
                         </foreach>
                         )
                     </if>
-
-
                     <if test="params.notInPatentNos != null and params.notInPatentNos.size!=0">
                         and patentno not in
                         <foreach item="item" collection="params.notInPatentNos" index="index" open="(" separator=","
@@ -1402,12 +1400,30 @@
                         and a.`name` like concat("%", #{params.patentName}, "%")
                     </if>
                     <if test="params.PasOptions !=null and params.PasOptions.size()!=0">
-                      and  <foreach item="item" collection="params.PasOptions" index="index" open="(" separator="and"
+                        and
+                        <foreach item="item" collection="params.PasOptions" index="index" open="(" separator="and"
+                                 close=")">
+                            and #{item.fieldId}
+                        </foreach>
+                    </if>
+                    <if test="params.orderItem!=null and params.orderItem!='SysOrder'">
+                        order by #{params.orderItem}
+                        <if test="params.orderType!=null">
+                            #{params.orderType}
+                        </if>
+                    </if>
+                    <if test="params.orderItem==null">
+                        order by a.patentno
+
+                    </if>
+                    <if test="params.orderItem=='SysOrder' and params.patentNos != null and params.patentNos.size()!=0">
+                        order by field (a.patentno,
+                        <foreach item="item" collection="params.patentNos" index="index" open="" separator=","
                                  close=")">
-                          and  #{item.fieldId}
+                            #{item}
                         </foreach>
                     </if>
-                    order  by a.patentno
+
                 </when>
 
                 <otherwise>
@@ -1419,7 +1435,7 @@
 
     <select id="getConPantentNos" parameterType="cn.cslg.pas.common.model.QueryPatentVO"
             resultType="java.lang.String">
-        select DISTINCT  a.patentno as patent_no
+        select DISTINCT a.patentno as patent_no
         from os_patent a
         <if test="params.applicationName !=null ">
             left join os_applicant_attr b on a.id=b.pid and b.type =1
@@ -1559,20 +1575,19 @@
         a.`status` as simple_status, a.type, a.publictodate as public_accredit_date, a.fpublicdate as first_public_date,
         a.prioritydate as priority_date,
         a.agencyid as agency_id, a.num2 as right_num, a.quoteno as quote_num, a.quotedno as quoted_num,
-               a.quote,
+        a.quote,
         a.patsnap_family as patSnapFamily, a.patsnapfamilynum as patSnapFamilyNum
         from os_patent a
-        <where> patentno="0"
-        <if test="patentNo != null and patentNo.size!=0">
-             or patentno in
-        <foreach item="item" collection="patentNo" index="index" open="(" separator="," close=")">
-            #{item}
-        </foreach>
-
-        </if>
-        <if test="n!=-1 and p!=-1">
-            limit #{n},#{p}
-        </if>
+        <where>patentno="0"
+            <if test="patentNo != null and patentNo.size!=0">
+                or patentno in
+                <foreach item="item" collection="patentNo" index="index" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="n!=-1 and p!=-1">
+                limit #{n},#{p}
+            </if>
         </where>
     </select>
     <!--    int getPatentNumber(@Param("patentNo")List<String> patentNo);-->