Browse Source

Merge remote-tracking branch 'origin/developer' into developerF

Duan_xu 2 years ago
parent
commit
a6d930c70e

+ 13 - 7
src/main/java/com/caimei365/commodity/components/SearchOpenService.java

@@ -223,7 +223,7 @@ public class SearchOpenService {
         config.setStart(num - 1);
         config.setHits(size);
         // 设置搜索结果返回应用中哪些字段
-        config.setFetchFields(Lists.newArrayList("id", "p_id", "p_name", "p_image", "p_brand_name", "p_unit", "p_code", "p_price_flag", "p_price_grade", "p_supplier_id", "p_keyword", "p_act_flag", "p_brand_id","p_product_type","p_newvalidflag"));
+        config.setFetchFields(Lists.newArrayList("id", "p_id", "p_name", "p_image", "p_brand_name", "p_unit", "p_code", "p_price_flag", "p_price_grade", "p_supplier_id", "p_keyword", "p_act_flag", "p_brand_id", "p_product_type", "p_newvalidflag"));
         // 注意:config子句中的rerank_size参数,在Rank类对象中设置
         // 设置返回格式为json格式
         config.setSearchFormat(SearchFormat.JSON);
@@ -251,7 +251,10 @@ public class SearchOpenService {
         } else if (identity == 4) {
             // 普通机构
             thisFilter += "(p_visibility=2 OR p_visibility=3) AND p_valid=2 AND p_type=1";
-        } else {
+        }  else if (6 == identity) {
+            //供应商自己主页看商品,不对商品状态进行限制
+            thisFilter += "p_type=1";
+        }else {
             // 游客|所有人
             thisFilter += "p_visibility=3 AND p_valid=2 AND p_type=1";
         }
@@ -335,7 +338,7 @@ public class SearchOpenService {
         // config.setStart(0) scroll该参数不起作用,默认为0
         config.setHits(size);
         // 设置搜索结果返回应用中哪些字段
-        config.setFetchFields(Lists.newArrayList("id", "p_id", "p_name", "p_image", "p_brand_name", "p_unit", "p_code", "p_price_flag", "p_price_grade", "p_supplier_id", "p_keyword", "p_act_flag", "p_brand_id","p_product_type"));
+        config.setFetchFields(Lists.newArrayList("id", "p_id", "p_name", "p_image", "p_brand_name", "p_unit", "p_code", "p_price_flag", "p_price_grade", "p_supplier_id", "p_keyword", "p_act_flag", "p_brand_id", "p_product_type"));
         // 设置返回格式为json格式
         config.setSearchFormat(SearchFormat.JSON);
         // 创建参数对象
@@ -347,18 +350,21 @@ public class SearchOpenService {
         // identity: 0个人,1协销,2会员机构,3供应商,4普通机构,5医美机构
         // p_valid:0逻辑删除 1待审核 2已上架 3已下架 8审核未通过 9已隐身 10已冻结
         // p_visibility:3:所有人可见,2:普通机构可见,1:会员机构可见,4:仅医美机构可见
-        if (identity == 1) {
+        if (1 == identity) {
             // 协销 | 综合供应商
             thisFilter += "(p_valid=2 OR p_valid=3 OR p_valid=9) AND p_type=1";
-        } else if (identity == 5) {
+        } else if (5 == identity) {
             // 医美机构
             thisFilter += "p_valid=2 AND p_type=1";
-        } else if (identity == 2) {
+        } else if (2 == identity) {
             // 会员机构
             thisFilter += "(p_visibility=1 OR p_visibility=2 OR p_visibility=3) ANDp_valid=2 AND p_type=1";
-        } else if (identity == 4) {
+        } else if (4 == identity) {
             // 普通机构
             thisFilter += "(p_visibility=2 OR p_visibility=3) AND p_valid=2 AND p_type=1";
+        } else if (6 == identity) {
+            //供应商自己主页看商品,不对商品状态进行限制
+            thisFilter += "p_type=1";
         } else {
             // 游客|所有人
             thisFilter += "p_visibility=3 AND p_valid=2 AND p_type=1";

+ 2 - 3
src/main/java/com/caimei365/commodity/service/impl/PageServiceImpl.java

@@ -653,10 +653,10 @@ public class PageServiceImpl implements PageService {
             boolean pass5 = visibility == 2 && (null != identity && (identity == 4 || identity == 2));
             // 没有权限查看该商品
             if (!(pass1 || pass2 || pass3 || pass4 || pass5)) {
-                return ResponseJson.success(1, "没有权限查看该商品", new ProductDetailVo());
+                return ResponseJson.success(0, "没有权限查看该商品", product);
             }
         } else if (2 == visibility || 1 == visibility || 4 == visibility) {
-            return ResponseJson.success(1, "没有权限查看该商品,userId为空", new ProductDetailVo());
+            return ResponseJson.success(0, "没有权限查看该商品,userId为空", product);
         }
         // 商品不处于已删除/待审核/审核未通过的状态
         if (0 != product.getValidFlag()) {
@@ -1371,7 +1371,6 @@ public class PageServiceImpl implements PageService {
         log.info("pagenum,pagesize,brandId-------------------------------->"+pageNum+"-----"+pageSize+"-=---------------"+brandID.toString());
         PageHelper.startPage(pageNum, pageSize);
         List<ProductItemVo> list = pageMapper.getNewFloorList(brandID);
-        log.info("当前分页--------------------》"+list.toString());
         list.forEach(product -> {
             Boolean couponsLogo = setCouponsLogo(userId, product.getProductId(), source);
             product.setCouponsLogo(couponsLogo);

+ 3 - 0
src/main/java/com/caimei365/commodity/service/impl/SearchProductServiceImpl.java

@@ -371,6 +371,8 @@ public class SearchProductServiceImpl implements SearchProductService {
         if (null == id) {
             return ResponseJson.error("请提供供应商id", null);
         }
+        // 供应商看自己主页商品的时候可以看到隐身,冻结。
+        identity = 6;
         ResponseJson<String> result;
         if (StringUtils.isEmpty(keyword)) {
             String queryStr = "p_supplier:'" + id + "'";
@@ -389,6 +391,7 @@ public class SearchProductServiceImpl implements SearchProductService {
         if (0 == result.getCode()) {
             return result;
         } else {
+            identity = 3;
             // 阿里云搜索失败,再次从数据库搜索
             return queryProductFromDatabase(pageNum, pageSize, identity, keyword, id, null, null, null, null, sortField, sortType);
         }

+ 2 - 1
src/main/java/com/caimei365/commodity/utils/AppletsLinkUtil.java

@@ -150,6 +150,7 @@ public class AppletsLinkUtil {
      * 28认证通推广页
      */
     public static final Pattern pattern44 = Pattern.compile("/attestation.html");
+    public static final Pattern pattern44_1 = Pattern.compile("/12/ross");
     /**
      * 29领券中心
      */
@@ -216,7 +217,7 @@ public class AppletsLinkUtil {
                 return 26;
             } else if (pattern43.matcher(link).find()) {
                 return 27;
-            } else if (pattern44.matcher(link).find()) {
+            } else if (pattern44.matcher(link).find() || pattern44_1.matcher(link).find()) {
                 return 28;
             } else if (pattern45.matcher(link).find()) {
                 return 29;