Browse Source

PCB推荐产品改为PCB材料、耗材、设备三个类目

wangyc 7 years ago
parent
commit
5c392bb725

+ 4 - 4
src/main/java/com/uas/platform/b2c/prod/commodity/dao/GoodsDao.java

@@ -800,14 +800,14 @@ public interface GoodsDao extends JpaSpecificationExecutor<Goods>, JpaRepository
      * @param kind
      * @param kind
      * @return
      * @return
      */
      */
-    @Query(nativeQuery = true, value = "select * from trade$goods where br_name_uuid is not null and ki_name=:kind and go_status = 601 limit 0,5")
+    @Query(nativeQuery = true, value = "select * from trade$goods where br_name_uuid is not null and ki_name=:kind and go_status = 601 limit 0,8")
     List<Goods> findByKindNameCnAndBrandIsNotNull(@Param("kind")String kind);
     List<Goods> findByKindNameCnAndBrandIsNotNull(@Param("kind")String kind);
 
 
     /**
     /**
-     * 通过类目id获取品牌uuid不为空的前5个批次
-     * @param kindIds 类目id
+     * 通过类目名称获取品牌uuid不为空的前5个批次
+     * @param kinds 类目名称
      * @return
      * @return
      */
      */
-    @Query(nativeQuery = true, value = "select * from trade$goods where br_name_uuid is not null and ki_name in (:kind) and go_status = 601 limit 0,5")
+    @Query(nativeQuery = true, value = "select * from trade$goods where br_name_uuid is not null and ki_name in (:kind) and go_status = 601 limit 0,8")
     List<Goods> findInKindNamesAndBrandIsNotNull(@Param("kind")List<String> kinds);
     List<Goods> findInKindNamesAndBrandIsNotNull(@Param("kind")List<String> kinds);
 }
 }

+ 20 - 15
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/GoodsServiceImpl.java

@@ -66,6 +66,7 @@ import com.uas.platform.b2c.prod.product.brand.dao.BrandDao;
 import com.uas.platform.b2c.prod.product.brand.modal.Brand;
 import com.uas.platform.b2c.prod.product.brand.modal.Brand;
 import com.uas.platform.b2c.prod.product.common.service.CreateNumberService;
 import com.uas.platform.b2c.prod.product.common.service.CreateNumberService;
 import com.uas.platform.b2c.prod.product.component.dao.ComponentDao;
 import com.uas.platform.b2c.prod.product.component.dao.ComponentDao;
+import com.uas.platform.b2c.prod.product.component.dao.ComponentGoodsDao;
 import com.uas.platform.b2c.prod.product.component.modal.Component;
 import com.uas.platform.b2c.prod.product.component.modal.Component;
 import com.uas.platform.b2c.prod.product.kind.dao.KindInfoDao;
 import com.uas.platform.b2c.prod.product.kind.dao.KindInfoDao;
 import com.uas.platform.b2c.prod.product.kind.model.Kind;
 import com.uas.platform.b2c.prod.product.kind.model.Kind;
@@ -4139,22 +4140,26 @@ public class GoodsServiceImpl implements GoodsService {
         List<KindInfo> kindInfos = kindInfoDao.findByParentid(3825L);
         List<KindInfo> kindInfos = kindInfoDao.findByParentid(3825L);
         if (CollectionUtils.isNotEmpty(kindInfos)) {
         if (CollectionUtils.isNotEmpty(kindInfos)) {
             for (KindInfo kindInfo : kindInfos) {
             for (KindInfo kindInfo : kindInfos) {
-                if (kindInfo.getIsLeaf().equals(Constant.YES)) {
-                    List<Goods> goods = goodsDao.findByKindNameCnAndBrandIsNotNull(kindInfo.getNameCn());
-                    if (CollectionUtils.isNotEmpty(goods)) {
-                        map.put(kindInfo.getNameCn(), goods);
-                    }
-                } else {
-                    List<KindInfo> kindInfoChildren = kindInfoDao.findByParentid(kindInfo.getId());
-                    if (!CollectionUtils.isEmpty(kindInfoChildren)) {
-                        List<String> names = new ArrayList<>();
-                        for (KindInfo child : kindInfoChildren) {
-                            names.add(child.getNameCn());
+                // 目前仅展示PCB材料、PCB耗材、PCB设备
+                String secondName = kindInfo.getNameCn();
+                if ("PCB材料".equals(secondName) || "PCB耗材".equals(secondName) || "PCB设备".equals(secondName)) {
+                    if (kindInfo.getIsLeaf().equals(Constant.YES)) {
+                        List<Goods> goods = ComponentGoodsDao goodsDao.findByKindNameCnAndBrandIsNotNull(kindInfo.getNameCn());
+                        if (CollectionUtils.isNotEmpty(goods)) {
+                            map.put(kindInfo.getNameCn(), goods);
                         }
                         }
-                        if (CollectionUtils.isNotEmpty(names)) {
-                            List<Goods> goods = goodsDao.findInKindNamesAndBrandIsNotNull(names);
-                            if (CollectionUtils.isNotEmpty(goods)) {
-                                map.put(kindInfo.getNameCn(), goods);
+                    } else {
+                        List<KindInfo> kindInfoChildren = kindInfoDao.findByParentid(kindInfo.getId());
+                        if (!CollectionUtils.isEmpty(kindInfoChildren)) {
+                            List<String> names = new ArrayList<>();
+                            for (KindInfo child : kindInfoChildren) {
+                                names.add(child.getNameCn());
+                            }
+                            if (CollectionUtils.isNotEmpty(names)) {
+                                List<Goods> goods = goodsDao.findInKindNamesAndBrandIsNotNull(names);
+                                if (CollectionUtils.isNotEmpty(goods)) {
+                                    map.put(kindInfo.getNameCn(), goods);
+                                }
                             }
                             }
                         }
                         }
                     }
                     }