Просмотр исходного кода

Merge branch 'dev' of luocaiyang/Wispro-CodeWarehouse-BackEnd into release

沈永艺 3 лет назад
Родитель
Сommit
19251994c0

+ 7 - 1
PAS/src/main/java/cn/cslg/pas/domain/Patent.java

@@ -94,7 +94,7 @@ public class Patent extends BaseEntity<Patent> {
     private String bureau;
 
     /**
-     * 专利状态【有权、审中、无权、PCT状态】 
+     * 专利状态【有权、审中、无权、PCT状态】
      */
     @TableField("status")
     private Integer simpleStatus;
@@ -145,6 +145,12 @@ public class Patent extends BaseEntity<Patent> {
     private Integer rightNum;
 
     /**
+     * 独立权利要求数量
+     */
+    @TableField("num3")
+    private Integer selfRightNum;
+
+    /**
      * 权利要求
      */
     @TableField("content")

+ 44 - 47
PAS/src/main/java/cn/cslg/pas/service/ReportService.java

@@ -1,13 +1,10 @@
 package cn.cslg.pas.service;
 
 import cn.cslg.pas.common.core.base.Constants;
-import cn.cslg.pas.common.model.dto.report.ReportPatentDTO;
-import cn.cslg.pas.common.model.dto.report.ReportPatentLabelDTO;
 import cn.cslg.pas.common.model.dto.report.*;
-import cn.cslg.pas.domain.*;
 import cn.cslg.pas.common.model.vo.ReportVO;
 import cn.cslg.pas.common.utils.*;
-import cn.cslg.pas.common.utils.WebSocketServer;
+import cn.cslg.pas.domain.*;
 import cn.cslg.pas.mapper.ReportMapper;
 import cn.hutool.core.util.IdUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -15,7 +12,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.deepoove.poi.XWPFTemplate;
 import com.deepoove.poi.config.Configure;
 import com.deepoove.poi.data.PictureRenderData;
-import com.deepoove.poi.data.Pictures;
 import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
 import lombok.RequiredArgsConstructor;
 import org.springframework.context.annotation.Lazy;
@@ -48,15 +44,11 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
     private final PatentInventorService patentInventorService;
     private final PatentInventorLinkService patentInventorLinkService;
     private final PatentLicensorService patentLicensorService;
-    private final PatentPledgeService patentPledgeService;
     private final SystemDictService systemDictService;
     private final PatentAgencyService patentAgencyService;
     private final PatentAgentService patentAgentService;
-    private final PatentApplicantMergeLinkService patentApplicantMergeLinkService;
     private final FileUtils fileUtils;
-    private final ProjectFolderService projectFolderService;
     private final ProjectFolderPatentLinkService projectFolderPatentLinkService;
-    private final ProjectFileService projectFileService;
     private final ProjectFieldPatentLinkService projectFieldPatentLinkService;
     private final PatentLabelService patentLabelService;
     private final PatentClassNumberLinkService patentClassNumberLinkService;
@@ -71,9 +63,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         }
         queryWrapper.orderByDesc(Report::getCreateTime);
         List<Report> dataList = this.list(queryWrapper);
-        dataList.forEach(item -> {
-            item.setCfg(null);
-        });
+        dataList.forEach(item -> item.setCfg(null));
         return dataList;
     }
 
@@ -148,7 +138,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
     //组建数据
     private Map<String, Object> assemData(Report report) {
         //数据整合
-        Map<String, Object> map = new HashMap<String, Object>();
+        Map<String, Object> map = new HashMap<>();
         //1.系统数据
         String date = DateUtils.formateDate(new Date(), DateUtils.YYYY_MM_DD);
         String[] ds = date.split("-");
@@ -181,13 +171,16 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         //获取分类
         List<ReportTemplateLabel> reportTemplateLabelList = reportTemplateLabelService.getTemplateLabelByTemplateIds(Collections.singletonList(report.getTemplateId()));
         List<ReportPatentLabelDTO> reportLabelCfg = JsonUtils.jsonToList(report.getCfg(), ReportPatentLabelDTO.class);
-        ClassifyMO classifyMO = null;
+        ClassifyMO classifyMO;
         for (ReportTemplateLabel label : reportTemplateLabelList) {
             classifyMO = new ClassifyMO();
             classifyMO.setKey(label.getLabel().replace("-", ""));
             classifyMO.setClassify_name(label.getName());
             //此分类的配置的专利
-            ReportPatentLabelDTO lscfg = reportLabelCfg.stream().filter(m -> m.getLabel().equals(label.getId())).findFirst().orElse(null);
+            ReportPatentLabelDTO lscfg = null;
+            if (reportLabelCfg != null) {
+                lscfg = reportLabelCfg.stream().filter(m -> m.getLabel().equals(label.getId())).findFirst().orElse(null);
+            }
             if (lscfg == null || lscfg.getId() == null || lscfg.getId().size() == 0) {
                 continue;
             }
@@ -275,14 +268,12 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         patentMO.setFpublicdate(DateUtils.formatDate(p.getFirstPublicDate(), DateUtils.YYYY_MM_DD));//:首次公开日
         patentMO.setPublictono(FormatUtil.toString(p.getPublicAccreditNo()));//公开授权号
         patentMO.setPublictodate(DateUtils.formatDate(p.getPublicAccreditDate(), DateUtils.YYYY_MM_DD));//:公开授权日
-
         patentMO.setBureau(FormatUtil.toString(p.getBureau()));//受理局
         List<PatentClassNumberLink> patentClassNumberLinkList = patentClassNumberLinkService.getPatentClassNumberLinkByPatentIds(Collections.singletonList(p.getId()));
         patentMO.setIntclassno(FormatUtil.toString(StringUtils.join(patentClassNumberLinkList.stream().filter(item -> item.getType().equals(Constants.PATENT_CLASS_NUMBER_IPC)).map(PatentClassNumberLink::getCode).collect(Collectors.toList()), "\n")));//IPC分类号
         patentMO.setIntclasscpcno(FormatUtil.toString(StringUtils.join(patentClassNumberLinkList.stream().filter(item -> item.getType().equals(Constants.PATENT_CLASS_NUMBER_CPC)).map(PatentClassNumberLink::getCode).collect(Collectors.toList()), "\n")));//CPC分类号
         patentMO.setIntclassupcno(FormatUtil.toString(StringUtils.join(patentClassNumberLinkList.stream().filter(item -> item.getType().equals(Constants.PATENT_CLASS_NUMBER_UPC)).map(PatentClassNumberLink::getCode).collect(Collectors.toList()), "\n")));//UPC分类号
         patentMO.setIntclasslocno(FormatUtil.toString(StringUtils.join(patentClassNumberLinkList.stream().filter(item -> item.getType().equals(Constants.PATENT_CLASS_NUMBER_LOC)).map(PatentClassNumberLink::getCode).collect(Collectors.toList()), "\n")));//LOC分类号
-        // TODO 性能优化
         patentMO.setPstatus(systemDictService.getSystemDictLabelByTypeAndValue(Constants.PATENT_SIMPLE_STATUS, p.getSimpleStatus()));//状态
         patentMO.setPtype(systemDictService.getSystemDictLabelByTypeAndValue(Constants.PATENT_TYPE, p.getType()));//类型
         patentMO.setCode(FormatUtil.toString(p.getCode()));//文献代码
@@ -293,17 +284,11 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         }
         patentMO.setPage(FormatUtil.toString(p.getDocPage()));//文献页数
         patentMO.setInventornum(FormatUtil.toString(p.getInventorNum()));//发明人数量
-        patentMO.setNum2(FormatUtil.toString(p.getRightNum()));//权利要求数量
-        patentMO.setNum3(FormatUtil.toString(p.getSelfRightContent()));//独立权利要求数量
-//      patentMO.setContent(p.getContent());//TODO:权利要求 暂定
-//      patentMO.setContentout(p.getContentout());////TODO:权利要求(译) 暂定
-
-//        List<PatentMO.ContentMO> cs = formatContent(p.getSelfcontent());
-//        patentMO.setSelfcontent(cs);//独立权利要求
+        patentMO.setNum2(FormatUtil.toString(p.getSelfRightContentNum()));//权利要求数量
+        patentMO.setNum3(FormatUtil.toString(p.getSelfRightNum()));//独立权利要求数量 这个字段是没有数据的
         List<PatentRight> patentRightList = patentRightService.getPatentRightByPatentId(p.getId());
         List<PatentMO.ContentMO2> cs = formatContent(patentRightList.stream().filter(item -> item.getType().equals(1)).collect(Collectors.toList()));
         patentMO.setSelfcontent(cs);//独立权利要求
-
         patentMO.setPriorityno(FormatUtil.toString(p.getPriorityNo()));//优先权号
         patentMO.setPrioritycountry(FormatUtil.toString(p.getPriorityCountry()));//优先权国家
         patentMO.setPrioritydate(DateUtils.formatDate(p.getPriorityDate(), DateUtils.YYYY_MM_DD));
@@ -337,16 +322,16 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
             patentMO.setAbstract_path(pic);//摘要附图
         }
         patentMO.setEpcountry(FormatUtil.toString(p.getEpStatus()));//指定国状态
-//        1是权利人  2是申请人
+        //1是权利人  2是申请人
         List<PatentApplicantLink> applyList = allApplicant.stream().filter(m -> m.getPatentId().equals(p.getId()) && m.getType().equals(2)).collect(Collectors.toList());
         if (applyList.size() > 0) {
             //申请人 当前
             List<Integer> currAppIDS = applyList.stream().map(PatentApplicantLink::getApplicantId).collect(Collectors.toList());
             List<PatentApplicant> alist = patentApplicantService.getPatentApplicantByIds(currAppIDS);
             List<String> names = alist.stream().map(PatentApplicant::getName).collect(Collectors.toList());
-            patentMO.setApplicant_names_current(StringUtils.join(names, ","));
+            patentMO.setApplicant_names_current(FormatUtil.toString(StringUtils.join(names, ",")));
             List<PatentApplyMO> aplist = new ArrayList<>();
-            PatentApplyMO mo = null;
+            PatentApplyMO mo;
             for (PatentApplicant a : alist) {
                 mo = new PatentApplyMO();
                 mo.setName(a.getName());
@@ -358,19 +343,19 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
             if (firstApplicantLink != null) {
                 PatentApplicant firstApplicant = alist.stream().filter(item -> item.getId().equals(firstApplicantLink.getApplicantId())).findFirst().orElse(null);
                 if (firstApplicant != null) {
-                    patentMO.setFirstapplicant(firstApplicant.getName());
+                    if (firstApplicant.getName() == null || firstApplicant.getName().equals("")) {
+                        patentMO.setFirstapplicant("无");
+                    } else {
+                        patentMO.setFirstapplicant(FormatUtil.toString(firstApplicant.getName()));
+                    }
                 }
             }
-            if (patentMO.getFirstapplicant() == null) {
-                System.out.println(patentMO.getPatentno());
-                System.out.println("沈永艺");
-            }
             patentMO.setApplicant_list_current(aplist);
             //申请人 标准
             List<String> names2 = alist.stream().map(PatentApplicant::getShortName).collect(Collectors.toList());
-            patentMO.setApplicant_names_standard(StringUtils.join(names2, ","));//赋值
+            patentMO.setApplicant_names_standard(FormatUtil.toString(StringUtils.join(names2, ",")));//赋值
             List<PatentApplyMO> aplist2 = new ArrayList<>();
-            PatentApplyMO mo2 = null;
+            PatentApplyMO mo2;
             for (PatentApplicant a : alist) {
                 mo2 = new PatentApplyMO();
                 mo2.setName(a.getName());
@@ -380,7 +365,6 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
             }
             patentMO.setApplicant_list_standard(aplist2);
         }
-
         //权利人
         List<PatentApplicantLink> obligeeList = allApplicant.stream().filter(m -> m.getPatentId().equals(p.getId()) && m.getType().equals(1)).collect(Collectors.toList());
         if (obligeeList.size() > 0) {
@@ -388,9 +372,9 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
             List<Integer> currAppIDS = obligeeList.stream().map(PatentApplicantLink::getApplicantId).collect(Collectors.toList());
             List<PatentApplicant> alist = patentApplicantService.getPatentApplicantByIds(currAppIDS);
             List<String> names = alist.stream().map(PatentApplicant::getName).collect(Collectors.toList());
-            patentMO.setObligee_names_current(StringUtils.join(names, ","));//赋值
+            patentMO.setObligee_names_current(FormatUtil.toString(StringUtils.join(names, ",")));//赋值
             List<PatentApplyMO> aplist = new ArrayList<>();
-            PatentApplyMO mo = null;
+            PatentApplyMO mo;
             for (PatentApplicant a : alist) {
                 mo = new PatentApplyMO();
                 mo.setName(a.getName());
@@ -401,9 +385,9 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
             patentMO.setObligee_list_current(aplist);
             //权利人 标准
             List<String> names2 = alist.stream().map(PatentApplicant::getName).collect(Collectors.toList());
-            patentMO.setObligee_names_standard(StringUtils.join(names2, ","));//赋值
+            patentMO.setObligee_names_standard(FormatUtil.toString(StringUtils.join(names2, ",")));//赋值
             List<PatentApplyMO> aplist2 = new ArrayList<>();
-            PatentApplyMO mo2 = null;
+            PatentApplyMO mo2;
             for (PatentApplicant a : alist) {
                 mo2 = new PatentApplyMO();
                 mo2.setName(a.getName());
@@ -418,7 +402,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         List<PatentLawMO> affairMoList = new ArrayList<>();
         List<PatentAffair> affairList = allAffair.stream().filter(m -> m.getPatentId().equals(p.getId())).collect(Collectors.toList());
         if (affairList.size() > 0) {
-            PatentLawMO m = null;
+            PatentLawMO m;
             for (PatentAffair a : affairList) {
                 m = new PatentLawMO();
                 m.setLaw_content(a.getContent());
@@ -438,8 +422,8 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
             List<Integer> ids = inventorReloationList.stream().map(PatentInventorLink::getInventorId).collect(Collectors.toList());
             List<PatentInventor> inventorList = allInventor.stream().filter(m -> ids.contains(m.getId())).collect(Collectors.toList());
             List<String> inventorNames = inventorList.stream().map(PatentInventor::getName).collect(Collectors.toList());
-            patentMO.setInventor_names(StringUtils.join(inventorNames, ","));//赋值
-            InventorMO m = null;
+            patentMO.setInventor_names(FormatUtil.toString(StringUtils.join(inventorNames, ",")));//赋值
+            InventorMO m;
             for (PatentInventor a : inventorList) {
                 m = new InventorMO();
                 m.setName(a.getName());
@@ -483,8 +467,8 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
         List<PatentMO.ContentMO2> rlist = new ArrayList<>();
         if (list.size() > 0) {
             for (PatentMO.ContentMO cm : list) {
-                StringBuilder sb = new StringBuilder("");
-                StringBuilder sbb = new StringBuilder("");
+                StringBuilder sb = new StringBuilder();
+                StringBuilder sbb = new StringBuilder();
                 for (String s : cm.getItem()) {
                     sb.append(s);
                 }
@@ -493,7 +477,7 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
                 }
                 String dcode = sb.toString().replace("\n", "").replace(";", ";");
                 String code;
-                if (dcode.contains("。")) {
+                if (sbb.toString().contains("。")) {
                     code = sbb.toString().replace("\n", "").replace("。", ";");
                 } else {
                     code = sbb.toString().replace("\n", "").replace(";", ";");
@@ -502,7 +486,20 @@ public class ReportService extends ServiceImpl<ReportMapper, Report> {
                 List<String> out = Arrays.asList(code.split(";"));
                 for (int i = 0, sarrySize = sarry.size(); i < sarrySize; i++) {
                     String s = sarry.get(i);
-                    rlist.add(new PatentMO.ContentMO2(cm.getTitle(), s, out.get(i)));
+                    if (sarrySize - 1 == i) {
+                        if (out.size() > i) {
+                            rlist.add(new PatentMO.ContentMO2(cm.getTitle(), s + ".", out.get(i)));
+                        } else {
+                            rlist.add(new PatentMO.ContentMO2(cm.getTitle(), s + ".", ""));
+                        }
+                    } else {
+                        if (out.size() > i) {
+                            rlist.add(new PatentMO.ContentMO2(cm.getTitle(), s + ";", out.get(i)));
+                        } else {
+                            rlist.add(new PatentMO.ContentMO2(cm.getTitle(), s + ";", ""));
+                        }
+                    }
+
                 }
             }
         }