Jelajahi Sumber

仅医美机构可见bugfix

chao 3 tahun lalu
induk
melakukan
96385fac99

+ 2 - 2
src/main/java/com/caimei365/commodity/components/PriceUtilService.java

@@ -105,11 +105,11 @@ public class PriceUtilService {
         PromotionsVo promotions = promotionsMapper.getPricePromotions(price.getProductId(), identity);
         price.setRepurchaseFlag(0);
         price.setActStatus(0);
+        // 用户身份: 2-会员机构, 4-普通机构
+        price.setUserIdentity(identity);
         // 设置价格标志(协销|价格公开|仅对医美机构公开|仅对会员机构公开)
         boolean setFlag = identity == 1 || priceFlag == 0 || (priceFlag == 3 && clubType == 1) || (priceFlag == 2 && identity == 2);
         if (setFlag) {
-            // 用户身份: 2-会员机构, 4-普通机构
-            price.setUserIdentity(identity);
             // 设置划线价
             price.setOriginalPrice(price.getPrice());
             //税费标志

+ 1 - 1
src/main/java/com/caimei365/commodity/model/vo/ProductItemVo.java

@@ -56,7 +56,7 @@ public class ProductItemVo implements Serializable {
      */
     private Integer priceGrade;
     /**
-     * 商品可见度:3:所有人可见,2:普通机构可见,1:会员机构可见
+     * 商品可见度:3:所有人可见,2:普通机构可见,1:会员机构可见,4:仅医美机构可见
      */
     private String visibility;
     /**

+ 27 - 24
src/main/java/com/caimei365/commodity/service/impl/PageServiceImpl.java

@@ -919,36 +919,39 @@ public class PageServiceImpl implements PageService {
             image.setLinkParam(linkParam);
             // 超级会员标识
             Integer svipUserId = pageMapper.getSvipUserIdByUserId(userId);
-            boolean svipUserFlag = null != svipUserId;
+            boolean isSuperVip = null != svipUserId;
+            // 根据用户Id查询用户身份: 0个人,1协销,2会员机构,3供应商,4普通机构
+            Integer identity = priceMapper.getIdentityByUserId(userId);
+            if (null == identity) {identity = 0;}
+            // 会员机构类型:1医美,2生美
+            Integer clubType = 0;
+            if (identity == 2) {
+                clubType = priceMapper.getClubTypeById(userId);
+                if (null == clubType) {clubType = 0;}
+            }
             if (image.getProductId() != null) {
                 // 获取商品及价格
                 ProductItemVo product = pageMapper.getProductItemById(image.getProductId());
                 if (product != null) {
-                    // 商品价格
-                    priceUtilService.setProductDetails(userId, product);
-                    // 设置商品主图
-                    image.setListType(1);
-                    image.setName(product.getName());
-                    image.setImage(ImageUtils.getImageURL("product", product.getImage(), 0, domain));
-                    image.setProduct(product);
-                    if (userId != null) {
-                        if (product.getUserIdentity() > 0) {
-                            if (!svipUserFlag && 4 == product.getUserIdentity() && "1".equals(product.getVisibility())) {
-                                iterator.remove();
-                            }
-                        } else {
-                            if ("1".equals(product.getVisibility()) || "2".equals(product.getVisibility())) {
-                                iterator.remove();
-                            }
-                        }
+                    // visibility  3:所有人可见,2:普通机构可见,1:会员机构可见,4:仅医美机构可见
+                    String visibility = product.getVisibility();
+                    boolean visibileFlag = "3".equals(visibility) || ("4".equals(visibility) && clubType == 1) || ("1".equals(visibility) && (isSuperVip || identity == 2))
+                            || ("2".equals(visibility) && (isSuperVip || identity == 2 || identity == 4));
+                    if (!visibileFlag) {
+                        iterator.remove();
                     } else {
-                        if ("1".equals(product.getVisibility()) || "2".equals(product.getVisibility())) {
-                            iterator.remove();
-                        }
+                        // 商品价格
+                        priceUtilService.setProductDetails(userId, product);
+                        // 设置商品主图
+                        image.setListType(1);
+                        image.setName(product.getName());
+                        image.setImage(ImageUtils.getImageURL("product", product.getImage(), 0, domain));
+                        //优惠券标识
+                        Boolean couponsLogo = setCouponsLogo(userId, image.getProductId(), source);
+                        product.setCouponsLogo(couponsLogo);
+
+                        image.setProduct(product);
                     }
-                    //优惠券标识
-                    Boolean couponsLogo = setCouponsLogo(userId, image.getProductId(), source);
-                    product.setCouponsLogo(couponsLogo);
                 } else {
                     iterator.remove();
                 }

+ 3 - 0
src/main/resources/mapper/SearchMapper.xml

@@ -310,6 +310,9 @@
             <when test="identity == 4">
                 and p.visibility in (2,3) and p.validFlag = 2
             </when>
+            <when test="identity == 5">
+                and p.visibility in (1,2,3,4) and p.validFlag = 2
+            </when>
             <otherwise>
                 and p.visibility = 3 and p.validFlag = 2
             </otherwise>