浏览代码

Merge remote-tracking branch 'origin/dev' into dev

lwhhszx 2 年之前
父节点
当前提交
454de1a2bd

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

@@ -24,5 +24,9 @@ public class ProductCategoryQueryPageDTO extends PageDTO2 {
      * 模糊查询-创建人名称
      */
     private String createPersonName;
+    /**
+     * 专利号
+     */
+    private String patentNo;
 
 }

+ 10 - 10
PAS/src/main/java/cn/cslg/pas/service/impl/ProductCategoryServiceImpl.java

@@ -265,8 +265,9 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
         //根据产品类别ID获得产品id和产品名称
         LambdaQueryWrapper<Product> productWrapper = new LambdaQueryWrapper<>();
         productWrapper.eq(Product::getProductCategoryId, dto.getCategoryId());
-        if(dto.getCompanyName()!=null&&dto.getCompanyName()!=""){
-        productWrapper.eq(Product::getCompanyName,dto.getCompanyName());}
+        if (dto.getCompanyName() != null && dto.getCompanyName() != "") {
+            productWrapper.eq(Product::getCompanyName, dto.getCompanyName());
+        }
         List<Product> products = productService.list(productWrapper);
         if (products.size() != 0) {
             List<Integer> productIds = products.stream().map(Product::getId).collect(Collectors.toList());
@@ -302,19 +303,18 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
                                 ca.setTime(dateForm);
                                 int month = ca.get(Calendar.MONTH);//第几个月
                                 int year = ca.get(Calendar.YEAR);//年份数值
-                                int season = (month - 1) / 3+1;
+                                int season = (month - 1) / 3 + 1;
                                 date = year + "-" + season;
                             } catch (ParseException e) {
                                 e.printStackTrace();
                             }
-                        }
-                        else if(dto.getTimeUnit() == 2){
+                        } else if (dto.getTimeUnit() == 2) {
                             try {
                                 Date dateForm = new SimpleDateFormat("yyyy-MM").parse(date);
                                 Calendar ca = Calendar.getInstance();
                                 ca.setTime(dateForm);
                                 int year = ca.get(Calendar.YEAR);//年份数值
-                                date = year+"";
+                                date = year + "";
                             } catch (ParseException e) {
                                 e.printStackTrace();
                             }
@@ -326,10 +326,10 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
                         marketDataMap.put(date, saleCount);
 
                         //产品总体部分
-                if (allMarketDataMap.get(date) != null) {
-                    saleCount += Double.parseDouble(allMarketDataMap.get(date).toString());
-                }
-                allMarketDataMap.put(date, saleCount);
+                        if (allMarketDataMap.get(date) != null) {
+                            saleCount += Double.parseDouble(allMarketDataMap.get(date).toString());
+                        }
+                        allMarketDataMap.put(date, saleCount);
                     }
             );
             Set keyset = marketDataMap.keySet();

+ 1 - 1
PAS/src/main/java/cn/cslg/pas/service/impl/StructureServiceImpl.java

@@ -310,7 +310,7 @@ public class StructureServiceImpl extends ServiceImpl<StructureMapper, Structure
                 }
         );
         //若ids.size == 0,则表示根据名称模糊查询不到数据,则直接返回空structureVO
-        if (ids.size() != 0) {
+        if (structureVO != null && ids.size() != 0) {
             diGui(structureVO, map, structureId, productId, ids);
         }
         return structureVO;

+ 18 - 13
PAS/src/main/resources/mapper/ProductCategoryMapper.xml

@@ -72,6 +72,11 @@
             <if test="productName != null">
                 and id in (select product_category_id from product where product_name like '%${productName}%')
             </if>
+            <if test="patentNo != null">
+                and id in (select product_category_id from product where id in (select product_id from
+                asso_product_patent where patent_no = #{patentNo} union select product_id from
+                asso_structure_patent where patent_no = #{patentNo}))
+            </if>
         </where>
         order by pc_id
     </select>
@@ -108,18 +113,18 @@
         SELECT DISTINCT sale_area
         FROM product_market_data
         WHERE
-          <if test="productId != null and productId != ''">
-              product_id = #{productId}
-          </if>
-          <if test="categoryId !=null and categoryId != ''">
-              product_id
-              IN(
-              SELECT id
-              FROM product
-              WHERE
-              product_category_id = #{categoryId})
-          </if>
-          <if test="patentNoList != null and patentNoList.size() > 0 ">
+        <if test="productId != null and productId != ''">
+            product_id = #{productId}
+        </if>
+        <if test="categoryId !=null and categoryId != ''">
+            product_id
+            IN(
+            SELECT id
+            FROM product
+            WHERE
+            product_category_id = #{categoryId})
+        </if>
+        <if test="patentNoList != null and patentNoList.size() > 0 ">
             product_id IN(
             SELECT product_id
             FROM asso_structure_patent
@@ -135,6 +140,6 @@
                 #{patentNo}
             </foreach>
             )
-          </if>
+        </if>
     </select>
 </mapper>