Browse Source

用户行为优化1.0.4

huangzhiguo 1 year ago
parent
commit
23a3ef049f

+ 15 - 2
src/main/java/com/caimei365/user/mapper/RoosInformationMapper.java

@@ -35,6 +35,14 @@ public interface RoosInformationMapper {
      * @return
      * @return
      */
      */
    Integer getShopStatus(@Param("shopId") Integer shopId, @Param("productId") Integer productId, @Param("infoId") Integer infoId, @Param("keyword") String keyword);
    Integer getShopStatus(@Param("shopId") Integer shopId, @Param("productId") Integer productId, @Param("infoId") Integer infoId, @Param("keyword") String keyword);
+
+    /**
+     * 潜客供应商下商品id
+     * @param shopId
+     * @return
+     */
+   List<Integer> getShopProductIds(@Param("shopId") Integer shopId);
+
     /**
     /**
      * 供应商广告图
      * 供应商广告图
      * @param shopIds
      * @param shopIds
@@ -44,14 +52,19 @@ public interface RoosInformationMapper {
 
 
     /**
     /**
      * 弹框样式
      * 弹框样式
-     * @param shopId
      * @param productId
      * @param productId
      * @param infoId
      * @param infoId
      * @param keyword
      * @param keyword
      * @return
      * @return
      */
      */
-   CmShopPopUpVo getShopPop(@Param("shopId") Integer shopId,@Param("productId")  Integer productId,@Param("infoId")  Integer infoId,@Param("keyword")  String keyword);
+   CmShopPopUpVo getShopPop(@Param("productId")  Integer productId,@Param("infoId")  Integer infoId,@Param("keyword")  String keyword);
 
 
+    /**
+     * 弹框样式
+     * @param shopId
+     * @return
+     */
+   CmShopPopUpVo getProductPop(@Param("shopId") Integer shopId);
     /**
     /**
      * 插入填写咨询人基本信息
      * 插入填写咨询人基本信息
      * @param roosInformationDto
      * @param roosInformationDto

+ 23 - 2
src/main/java/com/caimei365/user/service/impl/RoosInformationServiceImpl.java

@@ -58,13 +58,23 @@ public class RoosInformationServiceImpl implements RoosInformationService {
         log.info("shopId==="+shopId+"===productId==="+productId+"===infoId==="+infoId+"===keyword==="+keyword);
         log.info("shopId==="+shopId+"===productId==="+productId+"===infoId==="+infoId+"===keyword==="+keyword);
         // 供应商不存在或者处于不统计状态 不显示弹框
         // 供应商不存在或者处于不统计状态 不显示弹框
         Integer shopStatus = roosInformationMapper.getShopStatus(shopId, productId, infoId, keyword);
         Integer shopStatus = roosInformationMapper.getShopStatus(shopId, productId, infoId, keyword);
+        List<Integer> shopProductIds = roosInformationMapper.getShopProductIds(shopId);
         log.info("shopStatus===="+shopStatus);
         log.info("shopStatus===="+shopStatus);
+        // 网站底部的每个商品的弹窗,只在浏览了该商品相关的文章详情,商品详情和搜索列表后才显示,而不是该供应商的任意一个商品都显示
         if (null != shopStatus && 0 != shopStatus) {
         if (null != shopStatus && 0 != shopStatus) {
             isClick = false;
             isClick = false;
         }
         }
         if (null == shopStatus) {
         if (null == shopStatus) {
             isClick = false;
             isClick = false;
         }
         }
+        // 若一个供应商只添加了一个商品,则游客在浏览该供应商主页时,就显示该商品的底部弹窗
+        if (null != shopId) {
+            if (0 == shopStatus && null != shopProductIds && shopProductIds.size() == 1) {
+                isClick = true;
+            } else {
+                isClick = false;
+            }
+        }
         return isClick;
         return isClick;
     }
     }
 
 
@@ -80,7 +90,18 @@ public class RoosInformationServiceImpl implements RoosInformationService {
     @Override
     @Override
     public ResponseJson<CmShopPopUpVo> getPopUpInfo(Integer shopId, Integer productId, Integer infoId, String keyword) {
     public ResponseJson<CmShopPopUpVo> getPopUpInfo(Integer shopId, Integer productId, Integer infoId, String keyword) {
         log.info("shopId==="+shopId+"===productId==="+productId+"===infoId==="+infoId+"===keyword==="+keyword);
         log.info("shopId==="+shopId+"===productId==="+productId+"===infoId==="+infoId+"===keyword==="+keyword);
-        CmShopPopUpVo shopPop = roosInformationMapper.getShopPop(shopId, productId, infoId, keyword);
+        CmShopPopUpVo shopPop = new CmShopPopUpVo();
+        if (null != shopId) {
+            List<Integer> shopProductIds = roosInformationMapper.getShopProductIds(shopId);
+            if (null != shopProductIds && shopProductIds.size() == 1) {
+                shopPop = roosInformationMapper.getProductPop(shopId);
+            }
+        } else {
+            shopPop = roosInformationMapper.getShopPop(productId, infoId, keyword);
+        }
+        if (null == shopPop) {
+            return ResponseJson.error(-1, "信息异常", null);
+        }
         log.info("shopPop====="+shopPop);
         log.info("shopPop====="+shopPop);
         return ResponseJson.success(shopPop);
         return ResponseJson.success(shopPop);
     }
     }
@@ -113,7 +134,7 @@ public class RoosInformationServiceImpl implements RoosInformationService {
         String format = simpleDateFormat.format(new Date());
         String format = simpleDateFormat.format(new Date());
         // 供应商集合
         // 供应商集合
         List<Integer> shopIds = new ArrayList<>();
         List<Integer> shopIds = new ArrayList<>();
-        // 该用户是否访问过香干供应商相关页面
+        // 该用户是否访问过相关供应商相关页面
         List<Integer> shopIdList = roosInformationMapper.getShopId();
         List<Integer> shopIdList = roosInformationMapper.getShopId();
         for (Integer shopId : shopIdList) {
         for (Integer shopId : shopIdList) {
             List<Integer> behavior = null;
             List<Integer> behavior = null;

+ 29 - 12
src/main/resources/mapper/RoosInformationMapper.xml

@@ -65,6 +65,14 @@
         limit 1
         limit 1
     </select>
     </select>
 
 
+    <select id="getShopProductIds" resultType="java.lang.Integer">
+        SELECT
+            csp.productId
+        FROM cm_shop_product csp
+                 LEFT JOIN cm_shop_statistics css ON css.id = csp.statisticsId
+        WHERE css.shopId = #{shopId}
+    </select>
+
     <select id="getShopAdvert" resultType="com.caimei365.user.model.vo.cmShopAdvertisingImage">
     <select id="getShopAdvert" resultType="com.caimei365.user.model.vo.cmShopAdvertisingImage">
         select csa.* from cm_shop_advertisingImage csa
         select csa.* from cm_shop_advertisingImage csa
         left join cm_shop_statistics cps on csa.shopId = cps.shopId
         left join cm_shop_statistics cps on csa.shopId = cps.shopId
@@ -87,37 +95,46 @@
           csp.guidingTwo,
           csp.guidingTwo,
           csp.addTime
           csp.addTime
         FROM cm_shop_popUp csp
         FROM cm_shop_popUp csp
-        left join cm_shop_statistics css on css.shopId = csp.shopId
-        <if test="productId != null">
-            LEFT JOIN product p ON p.shopId = csp.shopId
-        </if>
+        left join cm_shop_product cspd on cspd.id = csp.shopProductId
          <if test="infoId != null">
          <if test="infoId != null">
             LEFT JOIN cm_shop_info csi ON csi.shopId = csp.shopId
             LEFT JOIN cm_shop_info csi ON csi.shopId = csp.shopId
          </if>
          </if>
         <if test="keyword != null and keyword != ''">
         <if test="keyword != null and keyword != ''">
-            left join shop s on s.shopId = csp.shopId
-            LEFT JOIN cm_shop_keyword csk ON csk.shopId = csp.shopId
+            LEFT JOIN cm_shop_keyword csk ON csk.shopId = cspd.id
             left join cm_user_search_frequency cusf on cusf.id = csk.searchId
             left join cm_user_search_frequency cusf on cusf.id = csk.searchId
         </if>
         </if>
         <where>
         <where>
-            css.status = 0
-            <if test="shopId != null">
-                and csp.shopId = #{shopId}
-            </if>
+            css.status = 0 and cspd.status = 0
             <if test="productId != null">
             <if test="productId != null">
-                and p.productId = #{productId}
+                and cspd.productId = #{productId}
             </if>
             </if>
             <if test="infoId != null">
             <if test="infoId != null">
                 and csi.status = 0
                 and csi.status = 0
                 and csi.infoId = #{infoId}
                 and csi.infoId = #{infoId}
             </if>
             </if>
             <if test="keyword != null and keyword != ''">
             <if test="keyword != null and keyword != ''">
-                and (csk.status = 0 and cusf.keyword like concat('%',#{keyword},'%') ) or s.name like concat('%',#{keyword},'%')
+                and csk.status = 0
+                and cusf.keyword like concat('%',#{keyword},'%')
             </if>
             </if>
         </where>
         </where>
         limit 1
         limit 1
     </select>
     </select>
 
 
+    <select id="getProductPop" resultType="com.caimei365.user.model.vo.CmShopPopUpVo">
+        SELECT
+            csp.id,
+            csp.shopId,
+            csp.image,
+            csp.guidingOne,
+            csp.guidingTwo,
+            csp.addTime
+        FROM cm_shop_popUp csp
+        left join cm_shop_product cspd on cspd.id = csp.shopProductId
+        left join cm_shop_statistics css on css.id = cspd.statisticsId
+        where css.shopId = #{shopId}
+        limit 1
+    </select>
+
     <insert id="insRoosInformation">
     <insert id="insRoosInformation">
         INSERT INTO cm_roos_information
         INSERT INTO cm_roos_information
             (
             (