Browse Source

商品详情展示区分普通机构/资质机构

zhijiezhao 3 years ago
parent
commit
eb2184b405

+ 5 - 1
src/main/java/com/caimei365/commodity/model/po/ProductDetailInfoPo.java

@@ -20,9 +20,13 @@ public class ProductDetailInfoPo implements Serializable {
      */
     private Integer productId;
     /**
-     * 商品详情信息
+     * 资质机构商品详情信息
      */
     private String detailInfo;
+    /**
+     * 普通机构商品详情信息
+     */
+    private String detailInfo2;
     /**
      * 服务详情
      */

+ 4 - 0
src/main/java/com/caimei365/commodity/model/vo/ProductDetailVo.java

@@ -323,4 +323,8 @@ public class ProductDetailVo implements Serializable {
      * 商品备注
      */
     private String productRemarks;
+    /**
+     * 普通机构商品详情 1同资质机构商品详情,2用普通机构商品详情
+     */
+    private String productDetailChose;
 }

+ 21 - 9
src/main/java/com/caimei365/commodity/service/impl/PageServiceImpl.java

@@ -285,8 +285,8 @@ public class PageServiceImpl implements PageService {
         String liveAdvertisingImage = pageMapper.getLiveAdvertisingImage();
         map.put("liveImage", liveAdvertisingImage);
         // 热门百科导航
-        List <BaikeProductVo> baikeList = pageMapper.getSidebarBaike();
-        baikeList.forEach(baikeProduct->{
+        List<BaikeProductVo> baikeList = pageMapper.getSidebarBaike();
+        baikeList.forEach(baikeProduct -> {
             String commodityType = baikeProduct.getCommodityType() == 1 ? "product-" : "instrument-";
             baikeProduct.setLink(domain + "/encyclopedia/" + commodityType + baikeProduct.getProductId() + ".html");
         });
@@ -494,6 +494,8 @@ public class PageServiceImpl implements PageService {
     @Override
     public ResponseJson<ProductDetailVo> getProductDetails(Integer productId, Integer userId) {
         ProductDetailVo product = pageMapper.getProductDetails(productId);
+        // 用户身份:0个人,1协销,2会员机构,3供应商,4普通机构
+        Integer identity = shopMapper.getUserIdentityById(userId);
         if (product == null) {
             //商品不存在
             product = new ProductDetailVo();
@@ -533,6 +535,14 @@ public class PageServiceImpl implements PageService {
         product.setImageList(imageList);
         // 商品详情
         ProductDetailInfoPo productDetail = shopMapper.getProductDetailInfo(productId);
+        //非资质机构商品详情展示普通机构商品详情
+        if (2 != identity) {
+            String chose = product.getProductDetailChose();
+            if(StringUtils.isNotEmpty(chose)&&"2".equals(chose)){
+                //将商品详情展示为普通机构商品详情
+                productDetail.setDetailInfo(productDetail.getDetailInfo2());
+            }
+        }
         product.setProductDetail(productDetail);
         // 相关参数
         List<ProductParameterPo> parametersList = shopMapper.getProductParameters(productId);
@@ -570,8 +580,6 @@ public class PageServiceImpl implements PageService {
         // 商品可见度:3:所有人可见,2:普通机构可见,1:会员机构可见,4:仅医美机构可见
         Integer visibility = product.getVisibility();
         if (null != userId && userId > 0) {
-            // 用户身份:0个人,1协销,2会员机构,3供应商,4普通机构
-            Integer identity = shopMapper.getUserIdentityById(userId);
             // 会员机构类型:1医美,2生美
             Integer clubType = 0;
             if (null != identity && identity == 2) {
@@ -677,7 +685,7 @@ public class PageServiceImpl implements PageService {
             identity = shopMapper.getUserIdentityById(userId);
             identity = null == identity ? 0 : identity;
         }
-        boolean flag  = (identity == 1 || identity == 2 || identity == 3);
+        boolean flag = (identity == 1 || identity == 2 || identity == 3);
         if (!flag) {
             return ResponseJson.success(1, "没有权限查看该项目仪器", new PageDetailVo());
         }
@@ -929,12 +937,16 @@ public class PageServiceImpl implements PageService {
             boolean isSuperVip = null != svipUserId;
             // 根据用户Id查询用户身份: 0个人,1协销,2会员机构,3供应商,4普通机构
             Integer identity = priceMapper.getIdentityByUserId(userId);
-            if (null == identity) {identity = 0;}
+            if (null == identity) {
+                identity = 0;
+            }
             // 会员机构类型:1医美,2生美
             Integer clubType = 0;
             if (identity == 2) {
                 clubType = priceMapper.getClubTypeById(userId);
-                if (null == clubType) {clubType = 0;}
+                if (null == clubType) {
+                    clubType = 0;
+                }
             }
             if (image.getProductId() != null) {
                 // 获取商品及价格
@@ -1227,10 +1239,10 @@ public class PageServiceImpl implements PageService {
     public ResponseJson<List<BaikeTypeVo>> getBaikePageData(Integer commodityType) {
         // 分类列表
         List<BaikeTypeVo> baikeTypeList = pageMapper.getBaikeTypeList(commodityType);
-        baikeTypeList.forEach(baikeType->{
+        baikeTypeList.forEach(baikeType -> {
             // 产品/仪器列表
             List<BaikeProductVo> productList = pageMapper.getBaikeProducts(baikeType.getTypeId(), null, 6);
-            productList.forEach(product ->{
+            productList.forEach(product -> {
                 // 问题列表
                 List<String> questionList = pageMapper.getBaikeQuestionList(product.getProductId());
                 product.setQuestionList(questionList);

+ 1 - 1
src/main/resources/mapper/PageMapper.xml

@@ -177,7 +177,7 @@
             productCategory, serviceNumber, taxPoint, supplierTaxPoint, priceFlag, actFlag, ladderPriceFlag,
             addTime, hasSkuFlag, sellNumber, sortIndex, featuredFlag, costCheckFlag, recommendType, machineType,
             productCode, updateTime, validFlag, searchKey, allAreaFlag, step, costPrice, provinceIds, qualificationImg,
-            trainingMethod, trainingType ,trainingFee, productRemarks
+            trainingMethod, trainingType ,trainingFee, productRemarks,productDetail as productDetailChose
         from product
         where productID = #{productId}
     </select>

+ 1 - 1
src/main/resources/mapper/ShopMapper.xml

@@ -489,7 +489,7 @@
         where productID = #{productId} order by mainFlag desc
     </select>
     <select id="getProductDetailInfo" resultType="com.caimei365.commodity.model.po.ProductDetailInfoPo">
-        select productDetailInfoId, productId, detailInfo, serviceInfo, orderInfo, propValueAlias,
+        select productDetailInfoId, productId, detailInfo, detailInfo2,serviceInfo, orderInfo, propValueAlias,
                 propValueImages, detailInfoTxt, seoTitle, seoKeyword, seoDes
         from productdetailinfo
         where productId = #{productId}