|
@@ -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();
|
|
|
}
|