浏览代码

增加需求,可以分别查询产品的商品化专利清单和产品架构的相关专利清单

chendayu 2 年之前
父节点
当前提交
77b071782b

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

@@ -14,6 +14,10 @@ import java.util.List;
  */
 @Data
 public class QueryPatentVO extends BaseVO {
+    /**
+     * 查询商品化专利还是相关专利(1.商品化专利  2相关专利)
+     */
+    private Integer queryType;
     //报告id
     private Integer reportId;
     //架构id

+ 5 - 1
PAS/src/main/java/cn/cslg/pas/common/model/vo/ProductVO.java

@@ -62,7 +62,11 @@ public class ProductVO implements Serializable {
      */
     //private List<String> relativePatents;
     /**
-     * 产品相关专利数量
+     * 商品化专利数量(产品和专利关联表)
+     */
+    private Integer productPatentNum;
+    /**
+     * 相关专利数量(架构和专利关联表)
      */
     private Integer patentNum;
     /**

+ 3 - 1
PAS/src/main/java/cn/cslg/pas/mapper/asso/AssoProductPatentMapper.java

@@ -26,7 +26,9 @@ import java.util.List;
 public interface AssoProductPatentMapper extends BaseMapper<AssoProductPatent> {
     int insertBatch(List<String> patentNos, Integer productId);
 
-    IPage<Patent> getPageList(Page<Patent> page, @Param("params") QueryPatentVO params);
+    IPage<Patent> getPageListProductPatent(Page<Patent> page, @Param("params") QueryPatentVO params);
+
+    IPage<Patent> getPageListStructurePatent(Page<Patent> page, @Param("params") QueryPatentVO params);
 
     List<String> getPatentNos(@Param("params") ProductPatentDTO params);
 

+ 12 - 12
PAS/src/main/java/cn/cslg/pas/service/asso/AssoProductPatentService.java

@@ -127,18 +127,18 @@ public class AssoProductPatentService extends ServiceImpl<AssoProductPatentMappe
 
     public IPage<PatentDTO> getPageList(QueryPatentVO params) {
         IPage<PatentDTO> pageList = new Page<>();
-        //当产品Id为null
-//        if (params.getProductId() == null) {
-//            //当架构id不为null时
-//            if (params.getStructureId() != null) {
-//                Structure structure = structureService.getById(params.getStructureId());
-//                params.setProductId(structure.getProductId());
-//            } else {
-//                return pageList;
-//            }
-//
-//        }
-        IPage<Patent> dataPage = baseMapper.getPageList(new Page<>(params.getCurrent(), params.getSize()), params);
+
+        //判断本次请求是查询产品的商品化专利还是相关专利
+        IPage<Patent> dataPage = null;
+        if (params.getQueryType() != null) {
+            if (params.getQueryType() == 1) {  //查商品化专利(与原先相同)
+                dataPage = baseMapper.getPageListProductPatent(new Page<>(params.getCurrent(), params.getSize()), params);
+            } else if (params.getQueryType() == 2) {  //查相关专利
+                dataPage = baseMapper.getPageListStructurePatent(new Page<>(params.getCurrent(), params.getSize()), params);
+            }
+        } else {  //与原先相同
+            dataPage = baseMapper.getPageListProductPatent(new Page<>(params.getCurrent(), params.getSize()), params);
+        }
 
         List<PatentDTO> records = new ArrayList<>();
         List<Integer> patentIds = dataPage.getRecords().stream().map(Patent::getId).collect(Collectors.toList());

+ 86 - 2
PAS/src/main/resources/mapper/AssoProductPatentMapper.xml

@@ -13,7 +13,7 @@
     </insert>
 
 
-    <select id="getPageList" parameterType="cn.cslg.pas.common.model.vo.PatentVO"
+    <select id="getPageListProductPatent" parameterType="cn.cslg.pas.common.model.vo.PatentVO"
             resultType="cn.cslg.pas.domain.Patent">
         select DISTINCT a.id, a.`name` as name, a.nameout as name_out, a.patentno as patent_no, a.abstract_path,
         a.abstract as
@@ -50,7 +50,6 @@
             left join os_patent_typeno h on h.pid =a.id and h.type =3
         </if>
         <where>
-
             <if test="params.productId !=null">
                 and i.product_id =#{params.productId}
             </if>
@@ -103,6 +102,91 @@
         </where>
     </select>
 
+    <select id="getPageListStructurePatent" parameterType="cn.cslg.pas.common.model.vo.PatentVO"
+            resultType="cn.cslg.pas.domain.Patent">
+        select DISTINCT a.id, a.`name` as name, a.nameout as name_out, a.patentno as patent_no, a.abstract_path,
+        a.abstract as
+        abstract_str, a.abstractout as abstract_out,
+        a.publicno as public_no, a.publicdate as public_date, a.simple_family, a.inpadoc_family, a.applicationno as
+        application_no, a.appdate as application_date,
+        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.patsnap_family as patSnapFamily, a.patsnapfamilynum as patSnapFamilyNum
+        from os_patent a
+        <if test="params.productId !=null and params.productId !=''">
+            left join asso_structure_patent t on t.patent_no =a.patentno
+        </if>
+        <if test="params.applicationName !=null ">
+            left join os_applicant_attr b on a.id=b.pid and b.type =1
+            left join os_patent_applicant c on c.id=b.applicantid
+        </if>
+        <if test=" params.obligeeName !=null">
+            left join os_applicant_attr d on a.id=d.pid and d.type =2
+            left join os_patent_applicant e on e.id=d.applicantid
+        </if>
+        <if test="params.numberIpc!=null ">
+            left join os_patent_typeno f on f.pid =a.id and f.type =1
+        </if>
+        <if test=" params.numberCpc!=null ">
+            left join os_patent_typeno g on g.pid =a.id and g.type =2
+        </if>
+        <if test=" params.numberUpc!=null">
+            left join os_patent_typeno h on h.pid =a.id and h.type =3
+        </if>
+        <where>
+            <if test="params.productId !=null">
+                and t.product_id =#{params.productId}
+            </if>
+            <if test="params.applicationName !=null and params.applicationName !=''  ">
+                and c.name REGEXP #{params.applicationName}
+            </if>
+            <if test="params.obligeeName !=null and params.obligeeName!=''">
+                and e.name REGEXP #{params.obligeeName}
+            </if>
+            <if test="params.numberIpc !=null and params.numberIpc!=''">
+                and f.code like concat("%", #{params.numberIpc}, "%")
+            </if>
+            <if test="params.numberCpc !=null and params.numberCpc!=''">
+                and g.code like concat("%", #{params.numberCpc}, "%")
+            </if>
+            <if test="params.numberUpc !=null and params.numberUpc!=''">
+                and h.code like concat("%", #{params.numberUpc}, "%")
+            </if>
+            <if test="params.patentNo !=null and params.patentNo !=''">
+                and a.patentNo REGEXP #{params.patentNo}
+            </if>
+            <if test="params.applicationNo !=null and params.applicationNo !=''">
+                and a.applicationNo like concat("%", #{params.applicationNo}, "%")
+            </if>
+            <if test="params.abstractStr !=null and params.abstractStr !=''">
+                and a.abstract like concat("%", #{params.abstractStr}, "%")
+            </if>
+            <if test="params.patentName !=null and params.patentName !=''">
+                and a.`name` like concat("%", #{params.patentName}, "%")
+            </if>
+            <if test="params.structureId !=null and params.structureId !=''">
+                and find_in_set(#{params.structureId}, t.path)
+            </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=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+    </select>
+
     <select id="getPatentNos" resultType="java.lang.String">
         select  a.patentno as patent_no
         from os_patent a

+ 10 - 1
PAS/src/main/resources/mapper/ProductMapper.xml

@@ -153,9 +153,12 @@
         <collection property="pictures" ofType="cn.cslg.pas.common.model.vo.ProductPictureVO"
                     select="query2" column="{p_id=p_id}">
         </collection>
-        <collection property="patentNum" ofType="Integer"
+        <collection property="productPatentNum" ofType="Integer"
                     select="query3" column="{p_id=p_id}">
         </collection>
+        <collection property="patentNum" ofType="Integer"
+                    select="query33" column="{p_id=p_id}">
+        </collection>
         <collection property="productCategory" ofType="cn.cslg.pas.common.model.vo.ProductCategoryVO"
                     select="query4" column="{pc_id=product_category_id}">
         </collection>
@@ -181,6 +184,12 @@
         where product_id = #{p_id}
     </select>
 
+    <select id="query33" resultType="Integer">
+        select count(distinct patent_no)
+        from asso_structure_patent
+        where product_id = #{p_id}
+    </select>
+
     <select id="query4" resultMap="query4Map">
         select id pc_id,
                product_category_name,