Browse Source

数据统计记录

huangzhiguo 1 năm trước cách đây
mục cha
commit
65a9b251ee

+ 6 - 6
src/main/java/com/caimei365/user/controller/ClubApi.java

@@ -232,19 +232,19 @@ public class ClubApi {
 
     @ApiOperation("优先展示标签 -- 咨询记录 -> 标签记录")
     @GetMapping("/remarks/getPriorKeyword")
-    public ResponseJson<List<String>> getPriorKeyword(){
+    public ResponseJson<List<Map<String, String>>> getPriorKeyword(){
 
         return clubService.getPriorKeyword();
     }
 
     @ApiOperation("查询机构历史填写信息")
-    @ApiImplicitParam(required = true, name = "clubId", value = "机构Id")
+    @ApiImplicitParam(required = true, name = "userId", value = "机构用户Id")
     @GetMapping("/remarks/getHistoryInfo")
-    public ResponseJson<Map<String, String>> getHistoryInfo(Integer clubId) {
-        if (null == clubId) {
+    public ResponseJson<Map<String, Object>> getHistoryInfo(Integer userId) {
+        if (null == userId) {
             return ResponseJson.error(-1, "机构Id不能为空", null);
         }
-        return clubService.getHistoryInfo(clubId);
+        return clubService.getHistoryInfo(userId);
     }
 
     /**
@@ -646,7 +646,7 @@ public class ClubApi {
      * @return
      */
     @GetMapping("/getCustomDemand")
-    public ResponseJson getCustomDemand(Integer clubId, Integer dateType, String startTime, String endTime) {
+    public ResponseJson<Map<String, Object>> getCustomDemand(Integer clubId, Integer dateType, String startTime, String endTime) {
         return clubService.getCustomDemand(clubId, dateType, startTime, endTime);
     }
     /**

+ 11 - 8
src/main/java/com/caimei365/user/controller/RoosInformationApi.java

@@ -3,11 +3,15 @@ package com.caimei365.user.controller;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.RoosInformationDto;
 import com.caimei365.user.model.vo.CmShopPopUpVo;
+import com.caimei365.user.model.vo.cmShopAdvertisingImage;
 import com.caimei365.user.service.RoosInformationService;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 /**
  * Description
  *
@@ -26,13 +30,13 @@ public class RoosInformationApi {
      * @return
      */
     @GetMapping("/isClick")
-    public ResponseJson<Boolean> boolIsClick() {
+    public ResponseJson<Boolean> boolIsClick(Integer shopId, Integer productId, Integer infoId, String keyword) {
 
         // 获取访问ip
         String ip = roosInformationService.obtainIp();
         // 查看用户是否有过弹框,游客当天是否有过弹框
-        Boolean isClick = roosInformationService.boolIsClick(ip);
-        return ResponseJson.success(!isClick);
+        Boolean isClick = roosInformationService.boolIsClick(ip, shopId, productId, infoId, keyword);
+        return ResponseJson.success(isClick);
     }
 
     /**
@@ -65,14 +69,13 @@ public class RoosInformationApi {
     }
 
     /**
-     * 查看访问者是否浏览过roos相关页面
+     * 查看访问者是否浏览过供应商相关页面 供应商广告图
      * @return
      */
-    @GetMapping("/visitRoos")
-    public ResponseJson<Boolean> selVisitRoos (String userId) {
+    @GetMapping("/getShopAdvert")
+    public ResponseJson<List<cmShopAdvertisingImage>> selVisitRoos(Integer userId) {
         // 获取访问ip
         String ip = roosInformationService.obtainIp();
-        Boolean visitRoos = roosInformationService.selectVisitRoos(userId,ip);
-        return ResponseJson.success(visitRoos);
+        return roosInformationService.selectVisitRoos(userId,ip);
     }
 }

+ 9 - 5
src/main/java/com/caimei365/user/mapper/ClubMapper.java

@@ -12,6 +12,7 @@ import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Description
@@ -235,16 +236,16 @@ public interface ClubMapper {
 
     /**
      * 机构咨询记录历史信息
-     * @param clubId
+     * @param userId
      * @return
      */
-    ClubRemarksPo getRemarksInfo(@Param("clubId") Integer clubId);
+    ClubRemarksPo getRemarksInfo(@Param("userId") Integer userId);
 
     /**
      * 优先展示标签
      * @return
      */
-    List<String> getPriorKeywordList();
+    List<Map<String, String>> getPriorKeywordList();
 
     /**
      * 标签是否已存在
@@ -255,9 +256,10 @@ public interface ClubMapper {
     /**
      * 保存静态动态标签
      * @param keyword
+     * @param trueStatus
      * @param dynamicStatus
      */
-    void insertLabel(@Param("keyword") String keyword, @Param("dynamicStatus") Integer dynamicStatus);
+    void insertLabel(@Param("keyword") String keyword,@Param("trueStatus") Integer trueStatus, @Param("dynamicStatus") Integer dynamicStatus);
 
     /**
      * 删除资料备注
@@ -391,7 +393,9 @@ public interface ClubMapper {
 
     List<BehaviorRecodeVo> recordDetail(@Param("clubId") Integer clubId, @Param("accessDate") String accessDate);
 
-    List<String> getClubRemarksInfo(Integer clubId, String startTime, String endTime);
+    List<String> getClubRemarksInfo(@Param("clubId") Integer clubId,@Param("startTime") String startTime,@Param("endTime") String endTime);
+
+    List<String> getClubBehavior(@Param("clubId") Integer clubId,@Param("startTime") String startTime,@Param("endTime") String endTime);
 
     List<NewOrderPo> selOrderList(CmPortraitDto cmPortrait);
 

+ 48 - 4
src/main/java/com/caimei365/user/mapper/RoosInformationMapper.java

@@ -3,6 +3,7 @@ package com.caimei365.user.mapper;
 import com.caimei365.user.model.dto.BehaviorRecordDto;
 import com.caimei365.user.model.dto.RoosInformationDto;
 import com.caimei365.user.model.vo.CmShopPopUpVo;
+import com.caimei365.user.model.vo.cmShopAdvertisingImage;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -19,10 +20,27 @@ public interface RoosInformationMapper {
     /**
      * 查看用户是否有过弹框
      * @param IP
+     * @param shopId
      * @param createTime
      * @return
      */
-   List<Integer> selIsClick(@Param("IP") String IP,@Param("createTime") String createTime);
+   List<Integer> selIsClick(@Param("IP") String IP, @Param("createTime") String createTime, @Param("shopId") Integer shopId, @Param("productId") Integer productId, @Param("infoId") Integer infoId, @Param("keyword") String keyword);
+
+    /**
+     * 获取供应商Id 是否为空
+     * @param shopId
+     * @param productId
+     * @param infoId
+     * @param keyword
+     * @return
+     */
+   Integer getShopStatus(@Param("shopId") Integer shopId, @Param("productId") Integer productId, @Param("infoId") Integer infoId, @Param("keyword") String keyword);
+    /**
+     * 供应商广告图
+     * @param shopIds
+     * @return
+     */
+   List<cmShopAdvertisingImage> getShopAdvert(@Param("shopIds") List<Integer> shopIds);
 
     /**
      * 弹框样式
@@ -41,11 +59,37 @@ public interface RoosInformationMapper {
    void insRoosInformation(RoosInformationDto roosInformationDto);
 
     /**
-     * 查看访问者是否浏览过roos相关页面
-     * @param userID
+     * 供应商Id
+     * @return
+     */
+   List<Integer> getShopId();
+
+    /**
+     * 供应商商品信息
+     * @return
+     */
+   List<Integer> getShopProductId(@Param("shopId") Integer shopId);
+
+    /**
+     * 供应商需要统计文章Id
+     * @return
+     */
+   List<Integer> getShopInfoId(@Param("shopId") Integer shopId);
+
+    /**
+     * 供应商搜索词
+     * @return
+     */
+   List<String> getShopKeyword(@Param("shopId") Integer shopId);
+
+    /**
+     * 查看访问者是否浏览过供应商相关页面
+     * @param userId
      * @param IP
      * @param accessDate
+     * @param pageType
+     * @param pagePath
      * @return
      */
-   List<String> visitRoos(@Param("userID") String userID,@Param("IP") String IP,@Param("accessDate") String accessDate);
+   List<Integer> getBehavior(@Param("userId") String userId,@Param("ip") String IP,@Param("accessDate") String accessDate , @Param("pageType") Integer pageType, @Param("pagePath") String pagePath);
 }

+ 2 - 2
src/main/java/com/caimei365/user/model/po/ClubRemarksPo.java

@@ -76,9 +76,9 @@ public class ClubRemarksPo implements Serializable {
      */
     private Integer communicationSituation;
     /**
-     * 沟通方式
+     * 沟通方式 1:电话 2:微信
      */
-    private Integer communicationMethods;
+    private String communicationMethods;
     /**
      * 客户来源
      */

+ 10 - 2
src/main/java/com/caimei365/user/model/vo/ClubVo.java

@@ -210,9 +210,9 @@ public class ClubVo implements Serializable {
      */
     private Integer communicationSituation;
     /**
-     * 沟通方式
+     * 沟通方式 1:电话 2:微信
      */
-    private Integer communicationMethods;
+    private String communicationMethods;
     /**
      * 客户来源
      */
@@ -233,5 +233,13 @@ public class ClubVo implements Serializable {
      * 资料完整度
      */
     private Integer number;
+    /**
+     * 微信是否触达
+     */
+    private String wx;
+    /**
+     * 电话是否触达
+     */
+    private String mob;
 
 }

+ 33 - 0
src/main/java/com/caimei365/user/model/vo/RemarkVo.java

@@ -130,4 +130,37 @@ public class RemarkVo implements Serializable {
      * 报备商品ID
      */
     private Integer productId;
+    /**
+     * 沟通情况 0 已沟通 1联系不上
+     */
+    private Integer communicationSituation;
+    /**
+     * 沟通方式 1:电话 2:微信
+     */
+    private String communicationMethods;
+    /**
+     * 客户来源 0 网址 1 小程序 2 公众号 3 小红书 4 微博 5 搜狐 6 其他
+     */
+    private Integer customerSource;
+    /**
+     * 客户性别 0 男 1 女
+     */
+    private Integer customerGender;
+    /**
+     * 加群情况 0 以加群 1 未加群
+     */
+    private Integer groupAddition;
+    /**
+     * 客户年龄
+     */
+    private String customerAge;
+
+    /**
+     * 动态标签
+     */
+    private List<Map<String, String>> trendsKeyword;
+    /**
+     * 静态标签
+     */
+    private List<Map<String, String>> stateKeyword;
 }

+ 35 - 0
src/main/java/com/caimei365/user/model/vo/RemarksVo.java

@@ -6,6 +6,7 @@ import lombok.Data;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Description
@@ -137,4 +138,38 @@ public class RemarksVo implements Serializable {
      * 创建记录 协销id
      */
     private Integer createServiceProviderId;
+    /**
+     * 沟通情况 0 已沟通 1联系不上
+     */
+    private Integer communicationSituation;
+    /**
+     * 沟通方式  1:电话 2:微信
+     */
+    private String communicationMethods;
+    /**
+     * 客户来源 0 网址 1 小程序 2 公众号 3 小红书 4 微博 5 搜狐 6 其他
+     */
+    private Integer customerSource;
+    /**
+     * 客户性别 0 男 1 女
+     */
+    private Integer customerGender;
+    /**
+     * 加群情况 0 以加群 1 未加群
+     */
+    private Integer groupAddition;
+    /**
+     * 客户年龄
+     */
+    private String customerAge;
+    /**
+     * 动态标签
+     */
+    private String trendsKeyword;
+    /**
+     * 静态标签
+     */
+    private String stateKeyword;
+
+
 }

+ 38 - 0
src/main/java/com/caimei365/user/model/vo/VisitRemarkVo.java

@@ -123,4 +123,42 @@ public class VisitRemarkVo  implements Serializable {
      */
     private Integer newDeal;
 
+    /**
+     * 创建记录 协销id
+     */
+    private Integer createServiceProviderId;
+
+    /**
+     * 沟通情况
+     */
+    private Integer communicationSituation;
+    /**
+     * 沟通方式 1:电话 2:微信
+     */
+    private String communicationMethods;
+    /**
+     * 客户来源
+     */
+    private Integer customerSource;
+    /**
+     * 客户性别
+     */
+    private Integer customerGender;
+    /**
+     * 客户年龄
+     */
+    private String customerAge;
+    /**
+     * 加群情况
+     */
+    private Integer groupAddition;
+    /**
+     * 动态标签
+     */
+    private List<Map<String, String>> trendsKeyword;
+    /**
+     * 静态标签
+     */
+    private List<Map<String, String>> stateKeyword;
+
 }

+ 36 - 1
src/main/java/com/caimei365/user/model/vo/VisitorRemarkVo.java

@@ -129,6 +129,41 @@ public class VisitorRemarkVo implements Serializable {
      * 新分配机构状态 0.否,1.是
      */
     private Integer newDeal;
+    /**
+     * 创建人协销Id
+     */
+    private Integer createServiceProviderId;
 
-
+    /**
+     * 沟通情况
+     */
+    private Integer communicationSituation;
+    /**
+     * 沟通方式 1:电话 2:微信
+     */
+    private String communicationMethods;
+    /**
+     * 客户来源
+     */
+    private Integer customerSource;
+    /**
+     * 客户性别
+     */
+    private Integer customerGender;
+    /**
+     * 客户年龄
+     */
+    private String customerAge;
+    /**
+     * 加群情况
+     */
+    private Integer groupAddition;
+    /**
+     * 动态标签
+     */
+    private String trendsKeyword;
+    /**
+     * 静态标签
+     */
+    private String stateKeyword;
 }

+ 59 - 0
src/main/java/com/caimei365/user/model/vo/cmShopAdvertisingImage.java

@@ -0,0 +1,59 @@
+package com.caimei365.user.model.vo;
+
+import lombok.Data;
+
+import java.util.Map;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2023/9/20
+ */
+@Data
+public class cmShopAdvertisingImage {
+    private String id;
+    /**
+     * 供应商Id
+     */
+    private String shopId;
+    /**
+     * pc图片
+     */
+    private String pcImage;
+    /**
+     * 小程序图片
+     */
+    private String appImage;
+    /**
+     * 跳转链接
+     */
+    private String jumpLink;
+    /**
+     * 链接类型 -1未知类型 1二级页面 2项目仪器 3直播页面 4自由页面 5商品详情 6项目仪器详情
+     * 7供应商主页 8专题活动页 9二手市场介绍 10二手商品列表 11二手商品发布 12商品搜索 13信息详情
+     * 14品牌招商介绍页 15维修保养介绍页 16首页 17注册页 18信息中心 19供应商列表
+     */
+    private Integer linkType;
+
+    /**
+     * 链接包含的参数
+     */
+    private Map<String, Object> linkParam;
+    /**
+     * 排序
+     */
+    private String sort;
+    /**
+     * 添加时间
+     */
+    private String addTime;
+    /**
+     * 上下架状态 0 已上架 1 已下架
+     */
+    private String status;
+    /**
+     * 删除标记:0未删除,1已删除
+     */
+    private String delFlag;
+}

+ 4 - 4
src/main/java/com/caimei365/user/service/ClubService.java

@@ -110,14 +110,14 @@ public interface ClubService {
      * 优先展示标签 -- 咨询记录 -》 标签记录
      * @return
      */
-    ResponseJson<List<String>> getPriorKeyword();
+    ResponseJson<List<Map<String, String>>> getPriorKeyword();
 
     /**
      * 查询机构历史填写信息
-     * @param clubId
+     * @param userId
      * @return
      */
-    ResponseJson<Map<String, String>> getHistoryInfo(Integer clubId);
+    ResponseJson<Map<String, Object>> getHistoryInfo(Integer userId);
     /**
      * 保存机构资料备注
      *
@@ -307,7 +307,7 @@ public interface ClubService {
 
     ResponseJson selTotal(Integer clubId);
 
-    ResponseJson<List<String>> getCustomDemand(Integer clubId, Integer dateType, String startTime, String endTime);
+    ResponseJson<Map<String, Object>> getCustomDemand(Integer clubId, Integer dateType, String startTime, String endTime);
 
     ResponseJson dataList(CmPortraitDto cmPortrait);
 

+ 5 - 3
src/main/java/com/caimei365/user/service/RoosInformationService.java

@@ -4,6 +4,7 @@ import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.BehaviorRecordDto;
 import com.caimei365.user.model.dto.RoosInformationDto;
 import com.caimei365.user.model.vo.CmShopPopUpVo;
+import com.caimei365.user.model.vo.cmShopAdvertisingImage;
 
 import java.util.List;
 
@@ -19,7 +20,8 @@ public interface RoosInformationService {
      * @param IP
      * @return
      */
-    Boolean boolIsClick(String IP);
+    Boolean boolIsClick(String IP, Integer shopId, Integer productId, Integer infoId, String keyword);
+
 
     /**
      * 供应商弹框信息
@@ -38,11 +40,11 @@ public interface RoosInformationService {
     ResponseJson<String> insRoosInformation(RoosInformationDto roosInformationDto);
 
     /**
-     * 查看访问者是否浏览过roos相关页面
+     * 查看访问者是否浏览过roos相关页面 供应商广告图
      * @param IP
      * @return
      */
-    Boolean selectVisitRoos(String userID ,String IP);
+    ResponseJson<List<cmShopAdvertisingImage>> selectVisitRoos(Integer userId ,String IP);
 
     /**
      * 获取用户访问IP

+ 307 - 59
src/main/java/com/caimei365/user/service/impl/ClubServiceImpl.java

@@ -100,7 +100,7 @@ public class ClubServiceImpl implements ClubService {
             club.setProvincialAddress(province.getName() + "" + city.getName() + "" + town.getName());
         }
         // 机构咨询记录信息
-        ClubRemarksPo remarksInfo = clubMapper.getRemarksInfo(club.getClubId());
+        ClubRemarksPo remarksInfo = clubMapper.getRemarksInfo(club.getUserId());
         if (null != remarksInfo) {
             club.setCommunicationSituation(remarksInfo.getCommunicationSituation());
             club.setCommunicationMethods(remarksInfo.getCommunicationMethods());
@@ -108,6 +108,18 @@ public class ClubServiceImpl implements ClubService {
             club.setCustomerGender(remarksInfo.getCustomerGender());
             club.setCustomerAge(remarksInfo.getCustomerAge());
             club.setGroupAddition(remarksInfo.getGroupAddition());
+            if (StringUtils.isNotBlank(remarksInfo.getCommunicationMethods())) {
+                if (remarksInfo.getCommunicationMethods().contains("1")) {
+                    club.setWx("已触达");
+                } else {
+                    club.setWx("未触达");
+                }
+                if (remarksInfo.getCommunicationMethods().contains("2")) {
+                    club.setMob("已触达");
+                } else {
+                    club.setMob("未触达");
+                }
+            }
         }
         // 资料完整度
         Integer number = 0;
@@ -965,32 +977,32 @@ public class ClubServiceImpl implements ClubService {
      * @return
      */
     @Override
-    public ResponseJson<List<String>> getPriorKeyword() {
+    public ResponseJson<List<Map<String, String>>> getPriorKeyword() {
         return ResponseJson.success(clubMapper.getPriorKeywordList());
     }
 
     /**
      * 查询机构历史填写信息
      *
-     * @param clubId
+     * @param userId
      * @return
      */
     @Override
-    public ResponseJson<Map<String, String>> getHistoryInfo(Integer clubId) {
-        ClubRemarksPo remarksInfo = clubMapper.getRemarksInfo(clubId);
-        Map<String, String> map = new HashMap<>();
+    public ResponseJson<Map<String, Object>> getHistoryInfo(Integer userId) {
+        ClubRemarksPo remarksInfo = clubMapper.getRemarksInfo(userId);
+        Map<String, Object> map = new HashMap<>();
         if (null != remarksInfo) {
             if (null != remarksInfo.getCustomerSource()) {
-                map.put("customerSource", remarksInfo.getCustomerSource().toString());
+                map.put("customerSource", remarksInfo.getCustomerSource());
             }
             if (null != remarksInfo.getCustomerGender()) {
-                map.put("customerGender", remarksInfo.getCustomerGender().toString());
+                map.put("customerGender", remarksInfo.getCustomerGender());
             }
             if (null != remarksInfo.getCustomerAge()) {
                 map.put("customerAge", remarksInfo.getCustomerAge());
             }
             if (null != remarksInfo.getGroupAddition()) {
-                map.put("groupAddition", remarksInfo.getGroupAddition().toString());
+                map.put("groupAddition", remarksInfo.getGroupAddition());
             }
         }
         return ResponseJson.success(map);
@@ -1031,7 +1043,7 @@ public class ClubServiceImpl implements ClubService {
             // 沟通情况
             Integer communicationSituation = jsonObject.getInteger("communicationSituation");
             // 沟通方式
-            Integer communicationMethods = jsonObject.getInteger("communicationMethods");
+            String communicationMethods = jsonObject.getString("communicationMethods");
             /// 客户来源
             Integer customerSource = jsonObject.getInteger("customerSource");
             // 客户性别
@@ -1069,6 +1081,48 @@ public class ClubServiceImpl implements ClubService {
             if (strings == null) {
                 return ResponseJson.error("添加关键词为空!", null);
             }
+            List<String> trendsKeywordList = new ArrayList<>();
+            //  保存动态标签
+            if (StringUtils.isNotBlank(trendsKeyword)) {
+                trendsKeyword = StringUtils.strip(trendsKeyword, "[]").replaceAll("\"", "");
+                if (trendsKeyword.contains(",")) {
+                    String[] split = trendsKeyword.split(",");
+                    for (String keyword : split) {
+                        trendsKeywordList.add(keyword);
+                        Integer keywordExist = clubMapper.findKeywordExist(keyword);
+                        if(null == keywordExist) {
+                            clubMapper.insertLabel(keyword, 1, 0);
+                        }
+                    }
+                } else {
+                    trendsKeywordList.add(trendsKeyword);
+                    Integer keywordExist = clubMapper.findKeywordExist(trendsKeyword);
+                    if(null == keywordExist) {
+                        clubMapper.insertLabel(trendsKeyword, 1,0);
+                    }
+                }
+            }
+            List<String> stateKeywordList = new ArrayList<>();
+            // 保存静态标签
+            if (StringUtils.isNotBlank(stateKeyword)) {
+                stateKeyword = StringUtils.strip(stateKeyword, "[]").replaceAll("\"", "");
+                if (stateKeyword.contains(",")) {
+                    String[] split = stateKeyword.split(",");
+                    for (String keyword : split) {
+                        stateKeywordList.add(keyword);
+                        Integer keywordExist = clubMapper.findKeywordExist(keyword);
+                        if(null == keywordExist) {
+                            clubMapper.insertLabel(keyword, 0, 1);
+                        }
+                    }
+                } else {
+                    stateKeywordList.add(stateKeyword);
+                    Integer keywordExist = clubMapper.findKeywordExist(stateKeyword);
+                    if(null == keywordExist) {
+                        clubMapper.insertLabel(stateKeyword, 0, 1);
+                    }
+                }
+            }
 //                clubRemarksPo.setRemarks(StringUtils.strip(strings.toString(), "[]"));
 //            }
             // 是否新增备注
@@ -1091,8 +1145,8 @@ public class ClubServiceImpl implements ClubService {
             clubRemarksPo.setCustomerGender(customerGender);
             clubRemarksPo.setCustomerAge(customerAge);
             clubRemarksPo.setGroupAddition(groupAddition);
-            clubRemarksPo.setTrendsKeyword(trendsKeyword);
-            clubRemarksPo.setStateKeyword(stateKeyword);
+            clubRemarksPo.setTrendsKeyword(StringUtils.strip(trendsKeywordList.toString(), "[]"));
+            clubRemarksPo.setStateKeyword(StringUtils.strip(stateKeywordList.toString(), "[]"));
             if (newRemarks) {
                 // 新增备注
                 clubMapper.insertRemarks(clubRemarksPo);
@@ -1128,40 +1182,7 @@ public class ClubServiceImpl implements ClubService {
             if (newRemarks && pushMessage) {
                 asyncService.sendChoseServiceMessage(2, clubId, serviceProviderId, clubRemarksPo.getRemarksId());
             }
-            //  保存动态标签
-            if (StringUtils.isNotBlank(trendsKeyword)) {
-                if (trendsKeyword.contains(",")) {
-                    String[] split = trendsKeyword.split(",");
-                    for (String keyword : split) {
-                        Integer keywordExist = clubMapper.findKeywordExist(keyword);
-                        if(null == keywordExist) {
-                            clubMapper.insertLabel(keyword, 0);
-                        }
-                    }
-                } else {
-                    Integer keywordExist = clubMapper.findKeywordExist(trendsKeyword);
-                    if(null == keywordExist) {
-                        clubMapper.insertLabel(trendsKeyword, 0);
-                    }
-                }
-            }
-            // 保存静态标签
-            if (StringUtils.isNotBlank(stateKeyword)) {
-                if (stateKeyword.contains(",")) {
-                    String[] split = stateKeyword.split(",");
-                    for (String keyword : split) {
-                        Integer keywordExist = clubMapper.findKeywordExist(keyword);
-                        if(null == keywordExist) {
-                            clubMapper.insertLabel(keyword, 1);
-                        }
-                    }
-                } else {
-                    Integer keywordExist = clubMapper.findKeywordExist(stateKeyword);
-                    if(null == keywordExist) {
-                        clubMapper.insertLabel(stateKeyword, 1);
-                    }
-                }
-            }
+
             return ResponseJson.success("保存资料备注成功");
         } catch (Exception e) {
             log.info("保存机构资料备注参数:" + jsonParamsDto.toString());
@@ -1556,26 +1577,73 @@ public class ClubServiceImpl implements ClubService {
             RemarkVo remarkVo = new RemarkVo();
             List<Map<String, String>> strings = new ArrayList<>();
             String rk = null == r.getRemarks() ? "" : r.getRemarks();
+            String trend = null == r.getTrendsKeyword() ? "" : r.getTrendsKeyword();
+            String state = null == r.getStateKeyword() ? "" : r.getStateKeyword();
             if (rk.contains(",")) {
                 String[] split = rk.split(",");
                 split = rk.split(",");
                 for (String remark : split) {
                     HashMap<String, String> map = new HashMap<>();
                     map.put("label", remark);
-                    strings.add(map);
+                    if (strings.size() < 10 && StringUtils.isNotBlank(remark)) {
+                        strings.add(map);
+                    }
                 }
             } else if (rk.contains(",")) {
                 String[] split = rk.split(",");
                 for (String remark : split) {
                     HashMap<String, String> map = new HashMap<>();
                     map.put("label", remark);
-                    strings.add(map);
+                    if (strings.size() < 10 && StringUtils.isNotBlank(remark)) {
+                        strings.add(map);
+                    }
                 }
             } else {
                 HashMap<String, String> map = new HashMap<>();
                 map.put("label", rk);
-                strings.add(map);
+                if (strings.size() < 10 && StringUtils.isNotBlank(rk)) {
+                    strings.add(map);
+                }
             }
+            // 动态标签
+            if (trend.contains(",")) {
+                String[] split = trend.split(",");
+                for (String remark : split) {
+                    HashMap<String, String> map = new HashMap<>();
+                    map.put("label", remark);
+                    if (strings.size() < 10 && StringUtils.isNotBlank(remark)) {
+                        strings.add(map);
+                    }
+                }
+            } else {
+                HashMap<String, String> map = new HashMap<>();
+                map.put("label", trend);
+                if (strings.size() < 10 && StringUtils.isNotBlank(trend)) {
+                    strings.add(map);
+                }
+            }
+            // 静态标签
+            if (state.contains(",")) {
+                String[] split = state.split(",");
+                for (String remark : split) {
+                    HashMap<String, String> map = new HashMap<>();
+                    map.put("label", remark);
+                    if (strings.size() < 10 && StringUtils.isNotBlank(remark)) {
+                        strings.add(map);
+                    }
+                }
+            } else {
+                HashMap<String, String> map = new HashMap<>();
+                map.put("label", state);
+                if (strings.size() < 10 && StringUtils.isNotBlank(state)) {
+                    strings.add(map);
+                }
+            }
+            // 数据为空时 返回为null
+            if (StringUtils.isNotBlank(rk) && StringUtils.isNotBlank(trend) && StringUtils.isNotBlank(state)) {
+                strings = null;
+            }
+
             if (StringUtils.isNotBlank(r.getConsult())) {
                 if (r.getConsult().contains(",")) {
                     String[] split = r.getConsult().split(",");
@@ -1640,8 +1708,10 @@ public class ClubServiceImpl implements ClubService {
         List<RemarksFileVo> fileList = clubMapper.getRemarksFileList(remarksId);
         fileList.forEach(file -> file.setFileUrl(OssUtil.getOssUrl(file.getOssName())));
         List<Map<String, String>> strings = new ArrayList<>();
+        List<Map<String, String>> trends = new ArrayList<>();
+        List<Map<String, String>> state = new ArrayList<>();
         if (remarksVo != null) {
-            String rk = null == remarksVo.getRemarks() ? "" : remarksVo.getRemarks();
+            String rk = StringUtils.isBlank(remarksVo.getRemarks()) ? "" : remarksVo.getRemarks();
             if (rk.contains(",")) {
                 String[] split = rk.split(",");
                 for (String remark : split) {
@@ -1654,7 +1724,38 @@ public class ClubServiceImpl implements ClubService {
                 map.put("label", rk);
                 strings.add(map);
             }
-
+            // 动态标签
+            String trendsKeywords = StringUtils.isBlank(remarksVo.getTrendsKeyword()) ? "" : remarksVo.getTrendsKeyword();
+            if (trendsKeywords.contains(",")) {
+                String[] split = trendsKeywords.split(",");
+                for (String remark : split) {
+                    HashMap<String, String> map = new HashMap<>();
+                    map.put("label", remark);
+                    trends.add(map);
+                }
+            } else {
+                HashMap<String, String> map = new HashMap<>();
+                map.put("label", trendsKeywords);
+                trends.add(map);
+            }
+            // 静态标签
+            String stateKeywords = StringUtils.isBlank(remarksVo.getStateKeyword()) ? "" : remarksVo.getStateKeyword();
+            if (stateKeywords.contains(",")) {
+                String[] split = stateKeywords.split(",");
+                for (String remark : split) {
+                    HashMap<String, String> map = new HashMap<>();
+                    map.put("label", remark);
+                    state.add(map);
+                }
+            } else {
+                HashMap<String, String> map = new HashMap<>();
+                map.put("label", stateKeywords);
+                state.add(map);
+            }
+            // 数据为空时 返回null
+            if (StringUtils.isBlank(remarksVo.getRemarks()) && StringUtils.isBlank(remarksVo.getTrendsKeyword()) && StringUtils.isBlank(remarksVo.getStateKeyword())) {
+                state = null;
+            }
             RemarkVo remarkVo = new RemarkVo();
             remarkVo.setClubId(remarksVo.getClubId());
             remarkVo.setUserId(remarksVo.getUserId());
@@ -1679,6 +1780,14 @@ public class ClubServiceImpl implements ClubService {
             remarkVo.setNewDeal(remarksVo.getNewDeal());
             remarkVo.setProductId(remarksVo.getProductId());
             remarkVo.setReportId(remarksVo.getReportId());
+            remarkVo.setCommunicationSituation(remarksVo.getCommunicationSituation());
+            remarkVo.setCommunicationMethods(remarksVo.getCommunicationMethods());
+            remarkVo.setCustomerSource(remarksVo.getCustomerSource());
+            remarkVo.setCustomerGender(remarksVo.getCustomerGender());
+            remarkVo.setCustomerAge(remarksVo.getCustomerAge());
+            remarkVo.setGroupAddition(remarksVo.getGroupAddition());
+            remarkVo.setTrendsKeyword(trends);
+            remarkVo.setStateKeyword(state);
             if (StringUtils.isNotBlank(remarksVo.getConsult())) {
                 if (remarkVo.getConsult().contains(",")) {
                     List<String> cons = Arrays.asList(remarkVo.getConsult().split(","));
@@ -1814,7 +1923,8 @@ public class ClubServiceImpl implements ClubService {
         visitor.setQuestionManId(uuid);
         visitor.setServiceProviderId(Integer.valueOf(serviceProviderId));
         clubMapper.insertQuestionMan(visitor);
-        HashMap<String, String> result = new HashMap<>(2);
+        HashMap<String, String> result = new HashMap<>(3);
+        result.put("remarksId", visitor.getRemarksId().toString());
         result.put("questionManId", uuid);
         result.put("questionMan", name);
         return ResponseJson.success("添加成功", result);
@@ -1893,7 +2003,22 @@ public class ClubServiceImpl implements ClubService {
             String extra = jsonObject.getString("extra");
             Integer productID = jsonObject.getInteger("productId");
             Integer reportID = jsonObject.getInteger("reportId");
-
+            // 沟通情况
+            Integer communicationSituation = jsonObject.getInteger("communicationSituation");
+            // 沟通方式
+            String communicationMethods = jsonObject.getString("communicationMethods");
+            /// 客户来源
+            Integer customerSource = jsonObject.getInteger("customerSource");
+            // 客户性别
+            Integer customerGender = jsonObject.getInteger("customerGender");
+            // 客户年龄
+            String customerAge = jsonObject.getString("customerAge");
+            // 加群情况
+            Integer groupAddition = jsonObject.getInteger("groupAddition");
+            // 动态标签
+            String trendsKeyword = jsonObject.getString("trendsKeyword");
+            // 静态标签
+            String stateKeyword = jsonObject.getString("stateKeyword");
             if (null == questionManId) {
                 return ResponseJson.error("参数异常,咨询人id不能为空");
             }
@@ -1920,6 +2045,48 @@ public class ClubServiceImpl implements ClubService {
             if (strings == null) {
                 return ResponseJson.error("strings添加关键词为空!", null);
             }
+            List<String> trendsKeywordList = new ArrayList<>();
+            //  保存动态标签
+            if (StringUtils.isNotBlank(trendsKeyword)) {
+                trendsKeyword = StringUtils.strip(trendsKeyword, "[]").replaceAll("\"", "");
+                if (trendsKeyword.contains(",")) {
+                    String[] split = trendsKeyword.split(",");
+                    for (String keyword : split) {
+                        trendsKeywordList.add(keyword);
+                        Integer keywordExist = clubMapper.findKeywordExist(keyword);
+                        if(null == keywordExist) {
+                            clubMapper.insertLabel(keyword, 1, 0);
+                        }
+                    }
+                } else {
+                    trendsKeywordList.add(trendsKeyword);
+                    Integer keywordExist = clubMapper.findKeywordExist(trendsKeyword);
+                    if(null == keywordExist) {
+                        clubMapper.insertLabel(trendsKeyword, 1,0);
+                    }
+                }
+            }
+            List<String> stateKeywordList = new ArrayList<>();
+            // 保存静态标签
+            if (StringUtils.isNotBlank(stateKeyword)) {
+                stateKeyword = StringUtils.strip(stateKeyword, "[]").replaceAll("\"", "");
+                if (stateKeyword.contains(",")) {
+                    String[] split = stateKeyword.split(",");
+                    for (String keyword : split) {
+                        stateKeywordList.add(keyword);
+                        Integer keywordExist = clubMapper.findKeywordExist(keyword);
+                        if(null == keywordExist) {
+                            clubMapper.insertLabel(keyword, 0, 1);
+                        }
+                    }
+                } else {
+                    stateKeywordList.add(stateKeyword);
+                    Integer keywordExist = clubMapper.findKeywordExist(stateKeyword);
+                    if(null == keywordExist) {
+                        clubMapper.insertLabel(stateKeyword, 0, 1);
+                    }
+                }
+            }
             visitorRemarkVo.setRemarks(StringUtils.strip(strings.toString(), "[]").replace("\"", ""));//去除符号
 //            }
             // 是否新增备注
@@ -1937,6 +2104,14 @@ public class ClubServiceImpl implements ClubService {
             visitorRemarkVo.setExtra(extra);
             visitorRemarkVo.setReportId(reportID);
             visitorRemarkVo.setProductId(productID);
+            visitorRemarkVo.setCommunicationSituation(communicationSituation);
+            visitorRemarkVo.setCommunicationMethods(communicationMethods);
+            visitorRemarkVo.setCustomerSource(customerSource);
+            visitorRemarkVo.setCustomerGender(customerGender);
+            visitorRemarkVo.setCustomerAge(customerAge);
+            visitorRemarkVo.setGroupAddition(groupAddition);
+            visitorRemarkVo.setTrendsKeyword(StringUtils.strip(trendsKeywordList.toString(), "[]"));
+            visitorRemarkVo.setStateKeyword(StringUtils.strip(stateKeywordList.toString(), "[]"));
             if (newRemarks) {
                 // 新增备注
                 clubMapper.insertVisitorRemark(visitorRemarkVo);
@@ -1985,6 +2160,8 @@ public class ClubServiceImpl implements ClubService {
         List<RemarksFileVo> fileList = clubMapper.getVisitRemarksFileList(remarksId);
         fileList.forEach(file -> file.setFileUrl(OssUtil.getOssUrl(file.getOssName())));
         List<Map<String, String>> strings = new ArrayList<>();
+        List<Map<String, String>> trends = new ArrayList<>();
+        List<Map<String, String>> state = new ArrayList<>();
         if (visitRemarksVo != null) {
             String rk = null == visitRemarksVo.getRemarks() ? "" : visitRemarksVo.getRemarks();
             if (rk.contains(",")) {
@@ -1999,6 +2176,39 @@ public class ClubServiceImpl implements ClubService {
                 map.put("label", rk);
                 strings.add(map);
             }
+            // 动态标签
+            String trendsKeywords = StringUtils.isBlank(visitRemarksVo.getTrendsKeyword()) ? "" : visitRemarksVo.getTrendsKeyword();
+            if (trendsKeywords.contains(",")) {
+                String[] split = trendsKeywords.split(",");
+                for (String remark : split) {
+                    HashMap<String, String> map = new HashMap<>();
+                    map.put("label", remark);
+                    trends.add(map);
+                }
+            } else {
+                HashMap<String, String> map = new HashMap<>();
+                map.put("label", trendsKeywords);
+                trends.add(map);
+            }
+            // 静态标签
+            String stateKeywords = StringUtils.isBlank(visitRemarksVo.getStateKeyword()) ? "" : visitRemarksVo.getStateKeyword();
+            if (stateKeywords.contains(",")) {
+                String[] split = stateKeywords.split(",");
+                for (String remark : split) {
+                    HashMap<String, String> map = new HashMap<>();
+                    map.put("label", remark);
+                    state.add(map);
+                }
+            } else {
+                HashMap<String, String> map = new HashMap<>();
+                map.put("label", stateKeywords);
+                state.add(map);
+            }
+            // 数据为空时 返回null
+            if (StringUtils.isBlank(visitRemarksVo.getRemarks()) && StringUtils.isBlank(visitRemarksVo.getTrendsKeyword()) && StringUtils.isBlank(visitRemarksVo.getStateKeyword())) {
+                state = null;
+            }
+
 
             VisitRemarkVo visit = new VisitRemarkVo();
             visit.setConsult(visitRemarksVo.getConsult());
@@ -2023,6 +2233,14 @@ public class ClubServiceImpl implements ClubService {
             visit.setAuditText(visitRemarksVo.getAuditText());
             visit.setProductId(visitRemarksVo.getProductId());
             visit.setReportId(visitRemarksVo.getReportId());
+            visit.setCommunicationSituation(visitRemarksVo.getCommunicationSituation());
+            visit.setCommunicationMethods(visitRemarksVo.getCommunicationMethods());
+            visit.setCustomerSource(visitRemarksVo.getCustomerSource());
+            visit.setCustomerGender(visitRemarksVo.getCustomerGender());
+            visit.setCustomerAge(visitRemarksVo.getCustomerAge());
+            visit.setGroupAddition(visitRemarksVo.getGroupAddition());
+            visit.setTrendsKeyword(trends);
+            visit.setStateKeyword(state);
 
             if (StringUtils.isNotBlank(visitRemarksVo.getConsult())) {
                 if (visitRemarksVo.getConsult().contains(",")) {
@@ -2122,6 +2340,7 @@ public class ClubServiceImpl implements ClubService {
             visit.setFollowup(r.getFollowup());
             visit.setExtra(r.getExtra());
             visit.setStatus(r.getStatus());
+            visit.setCreateServiceProviderId(r.getCreateServiceProviderId());
             remarkVos.add(visit);
         });
         PaginationVo<VisitRemarkVo> pageVo = new PaginationVo<>(remarkVos);
@@ -2323,19 +2542,19 @@ public class ClubServiceImpl implements ClubService {
      * @return
      */
     @Override
-    public ResponseJson<List<String>> getCustomDemand(Integer clubId, Integer dateType, String startTime, String endTime) {
+    public ResponseJson<Map<String, Object>> getCustomDemand(Integer clubId, Integer dateType, String startTime, String endTime) {
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
         Date date = new Date();
         Calendar calendar = Calendar.getInstance();
         calendar.setTime(date);
         calendar.add(Calendar.DAY_OF_MONTH, -1);
         Date time = calendar.getTime();
-        endTime = dateFormat.format(time);
         boolean expty = StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime);
         if (expty) {
+            endTime = dateFormat.format(time);
             Date start = null;
             // 日期参数为    日
-            if (0 ==  dateType || 1 == dateType) {
+            if (0 == dateType) {
                 startTime = endTime;
             }
             if (1 == dateType) {
@@ -2359,16 +2578,45 @@ public class ClubServiceImpl implements ClubService {
         }
         // 用户需求
         List<String> list = new ArrayList<>();
+        // 咨询记录
         List<String> clubRemarksInfo = clubMapper.getClubRemarksInfo(clubId, startTime, endTime);
         for (String remark : clubRemarksInfo) {
             if (remark.contains(",")) {
                 String[] split = remark.split(",");
-                list.addAll(Arrays.asList(split));
+                for (String s : split) {
+                    if (list.size() <= 10 && StringUtils.isNotBlank(s)) {
+                        list.add(s);
+                    }
+                }
             } else {
-                list.add(remark);
+                if (list.size() <= 10 && StringUtils.isNotBlank(remark)) {
+                    list.add(remark);
+                }
             }
         }
-        return ResponseJson.success(list);
+        // 访问记录
+        List<String> clubBehaviors = clubMapper.getClubBehavior(clubId, startTime, endTime);
+        if (clubBehaviors.size() > 0) {
+            for (String clubBehavior : clubBehaviors) {
+                if (clubBehavior.contains(",")) {
+                    String[] split = clubBehavior.split(",");
+                    for (String s : split) {
+                        if (list.size() <= 10 && StringUtils.isNotBlank(s)) {
+                            list.add(s);
+                        }
+                    }
+                } else {
+                    if (list.size() <= 10 && StringUtils.isNotBlank(clubBehavior)) {
+                        list.add(clubBehavior);
+                    }
+                }
+            }
+        }
+        Map<String, Object> map = new HashMap<>();
+        map.put("startTime", startTime);
+        map.put("endTime", endTime);
+        map.put("list", list);
+        return ResponseJson.success(map);
     }
 
     @Override

+ 68 - 13
src/main/java/com/caimei365/user/service/impl/RoosInformationServiceImpl.java

@@ -4,7 +4,9 @@ import com.caimei365.user.mapper.RoosInformationMapper;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.RoosInformationDto;
 import com.caimei365.user.model.vo.CmShopPopUpVo;
+import com.caimei365.user.model.vo.cmShopAdvertisingImage;
 import com.caimei365.user.service.RoosInformationService;
+import com.caimei365.user.utils.AppletsLinkUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -15,6 +17,8 @@ import org.springframework.web.context.request.ServletRequestAttributes;
 
 import javax.servlet.http.HttpServletRequest;
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 
@@ -37,16 +41,29 @@ public class RoosInformationServiceImpl implements RoosInformationService {
      * @return
      */
     @Override
-    public Boolean boolIsClick(String IP) {
+    public Boolean boolIsClick(String IP, Integer shopId, Integer productId, Integer infoId, String keyword) {
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
         String format = simpleDateFormat.format(new Date());
-        List<Integer> list = roosInformationMapper.selIsClick(IP, format);
+        List<Integer> list = roosInformationMapper.selIsClick(IP, format, shopId, productId, infoId, keyword);
+        log.info("list==="+list);
         boolean isClick = false;
         // 判断是否点击过取消、或者填写过信息
-        for (Integer i: list) {
-            if (i == 1) {
+        if (null != list && list.size() > 0) {
+            if (list.stream().allMatch(i -> i == 0)) {
                 isClick = true;
             }
+        } else {
+            isClick = true;
+        }
+        log.info("shopId==="+shopId+"===productId==="+productId+"===infoId==="+infoId+"===keyword==="+keyword);
+        // 供应商不存在或者处于不统计状态 不显示弹框
+        Integer shopStatus = roosInformationMapper.getShopStatus(shopId, productId, infoId, keyword);
+        log.info("shopStatus===="+shopStatus);
+        if (null != shopStatus && 0 != shopStatus) {
+            isClick = false;
+        }
+        if (null == shopStatus) {
+            isClick = false;
         }
         return isClick;
     }
@@ -62,7 +79,9 @@ public class RoosInformationServiceImpl implements RoosInformationService {
      */
     @Override
     public ResponseJson<CmShopPopUpVo> getPopUpInfo(Integer shopId, Integer productId, Integer infoId, String keyword) {
+        log.info("shopId==="+shopId+"===productId==="+productId+"===infoId==="+infoId+"===keyword==="+keyword);
         CmShopPopUpVo shopPop = roosInformationMapper.getShopPop(shopId, productId, infoId, keyword);
+        log.info("shopPop====="+shopPop);
         return ResponseJson.success(shopPop);
     }
 
@@ -82,24 +101,60 @@ public class RoosInformationServiceImpl implements RoosInformationService {
     }
 
     /**
-     * 查看访问者是否浏览过roos相关页面
+     * 查看访问者是否浏览过供应商相关页面 供应商广告图
      *
-     * @param userID
+     * @param userId
      * @param IP
      * @return
      */
     @Override
-    public Boolean selectVisitRoos(String userID , String IP) {
+    public ResponseJson<List<cmShopAdvertisingImage>> selectVisitRoos(Integer userId , String IP) {
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
         String format = simpleDateFormat.format(new Date());
-        boolean isVisit = false;
-        List<String> list = roosInformationMapper.visitRoos(userID, IP, format);
-        for (String str: list) {
-            if (str.equals("2")) {
-                isVisit = true;
+        // 供应商集合
+        List<Integer> shopIds = new ArrayList<>();
+        // 该用户是否访问过香干供应商相关页面
+        List<Integer> shopIdList = roosInformationMapper.getShopId();
+        for (Integer shopId : shopIdList) {
+            List<Integer> behavior = null;
+            // 是否访问过商品
+            List<Integer> shopProductId = roosInformationMapper.getShopProductId(shopId);
+            for (Integer productId : shopProductId) {
+                behavior = roosInformationMapper.getBehavior(userId.toString(), IP, format, 6, productId.toString());
+                if (behavior != null && behavior.size() > 0) {
+                    if (!shopIds.contains(shopId)) {
+                        shopIds.add(shopId);
+                    }
+                }
+            }
+            // 是否访问过供应商相关文章
+            List<Integer> shopInfoId = roosInformationMapper.getShopInfoId(shopId);
+            for (Integer infoId : shopInfoId) {
+                behavior = roosInformationMapper.getBehavior(userId.toString(), IP, format, 11, infoId.toString());
+                if (behavior != null && behavior.size() > 0) {
+                    if (!shopIds.contains(shopId)) {
+                        shopIds.add(shopId);
+                    }
+                }
             }
+            // 是否搜索过供应商相关搜索词
+            List<String> shopKeyword = roosInformationMapper.getShopKeyword(shopId);
+            for (String keyword: shopKeyword) {
+                behavior = roosInformationMapper.getBehavior(userId.toString(), IP, format, 8, keyword);
+                if (behavior != null && behavior.size() > 0) {
+                    if (!shopIds.contains(shopId)) {
+                        shopIds.add(shopId);
+                    }
+                }
+            }
+        }
+        // 返回数供应商广告图据
+        List<cmShopAdvertisingImage> shopAdvert = roosInformationMapper.getShopAdvert(shopIdList);
+        for (cmShopAdvertisingImage advert : shopAdvert) {
+            advert.setLinkType(AppletsLinkUtil.getLinkType(advert.getJumpLink()));
+            advert.setLinkParam(AppletsLinkUtil.getLinkParam(advert.getLinkType(), advert.getJumpLink()));
         }
-        return isVisit;
+        return ResponseJson.success(shopAdvert);
     }
 
 

+ 305 - 0
src/main/java/com/caimei365/user/utils/AppletsLinkUtil.java

@@ -0,0 +1,305 @@
+package com.caimei365.user.utils;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+/**
+ * 小程序链接工具类
+ *
+ * @author : Charles
+ * @date : 2021/4/9
+ */
+@Slf4j
+public class AppletsLinkUtil {
+    /**
+     * 1二级页面
+     */
+    public static final Pattern pattern1 = Pattern.compile("/cmpage/info-1");
+    public static final Pattern pattern34 = Pattern.compile("/topic.html");
+    public static final Pattern pattern34_1 = Pattern.compile("/topic-");
+    /**
+     * 2项目仪器详情
+     */
+    public static final Pattern pattern2 = Pattern.compile("/cmpage/info-2");
+    public static final Pattern pattern6 = Pattern.compile("equipment/detail");
+    public static final Pattern pattern6_1 = Pattern.compile("/equipment-");
+    /**
+     * 3直播页面
+     */
+    public static final Pattern pattern3 = Pattern.compile("/cmpage/info-3");
+    public static final Pattern pattern36 = Pattern.compile("wx.vzan.com");
+    /**
+     * 4自由页面
+     */
+    public static final Pattern pattern4 = Pattern.compile("/cmpage/info-4");
+    public static final Pattern pattern33 = Pattern.compile("/page.html");
+    public static final Pattern pattern33_1 = Pattern.compile("/page-");
+    /**
+     * 5商品详情
+     */
+    public static final Pattern pattern5 = Pattern.compile("/product-");
+
+    /**
+     * 7供应商主页
+     */
+    public static final Pattern pattern7 = Pattern.compile("supplier/prolist");
+    public static final Pattern pattern8 = Pattern.compile("supplier/index.html");
+    public static final Pattern pattern8_1 = Pattern.compile("/supplier-");
+    public static final Pattern pattern9 = Pattern.compile("view/supplierHomePage.jsp");
+    public static final Pattern pattern10 = Pattern.compile("supplier/productlist-");
+    /**
+     * 8专题活动页
+     */
+    public static final Pattern pattern11 = Pattern.compile("promotions.html");
+    public static final Pattern pattern12 = Pattern.compile("cmpage/area.html");
+    /**
+     * 9二手市场介绍
+     */
+    public static final Pattern pattern13 = Pattern.compile("html/secondHand/introduction.jsp");
+    public static final Pattern pattern14 = Pattern.compile("flea-market/intro.html");
+    /**
+     * 10二手商品列表
+     */
+    public static final Pattern pattern15 = Pattern.compile("html/secondHand/secondList.jsp");
+    public static final Pattern pattern16 = Pattern.compile("flea-market/list.html");
+    /**
+     * 11二手商品发布
+     */
+    public static final Pattern pattern17 = Pattern.compile("html/maintenance/view/secondtransactions.jsp");
+    public static final Pattern pattern18 = Pattern.compile("flea-market/form.html");
+    /**
+     * 12商品搜索
+     */
+    public static final Pattern pattern19 = Pattern.compile("product/search.shtml");
+    public static final Pattern pattern20 = Pattern.compile("product/search/list");
+    public static final Pattern pattern21 = Pattern.compile("product/list.html");
+    /**
+     * 13信息详情
+     */
+    public static final Pattern pattern22 = Pattern.compile("info/detail");
+    /**
+     * 14品牌招商介绍页
+     */
+    public static final Pattern pattern23 = Pattern.compile("html/InvestmentCaiMei/investmentpage.jsp");
+    public static final Pattern pattern24 = Pattern.compile("investment.html");
+    /**
+     * 15维修保养介绍页
+     */
+    public static final Pattern pattern25 = Pattern.compile("html/maintenance/view/mt-entry-index.jsp");
+    public static final Pattern pattern26 = Pattern.compile("repair.html");
+    /**
+     * 16首页
+     */
+    public static final Pattern pattern27 = Pattern.compile("index.action");
+    public static final Pattern pattern28 = Pattern.compile("index.html");
+    /**
+     * 17注册页
+     */
+    public static final Pattern pattern29 = Pattern.compile("web/login/view/register_new_vip.jsp");
+    public static final Pattern pattern30 = Pattern.compile("register.html");
+    /**
+     * 18信息中心
+     */
+    public static final Pattern pattern31 = Pattern.compile("info/center");
+    /**
+     * 19供应商列表
+     */
+    public static final Pattern pattern32 = Pattern.compile("supplier/list.html");
+    /**
+     * 20分类详情
+     */
+    public static final Pattern pattern35 = Pattern.compile("/cmpage/info-5");
+    public static final Pattern pattern35_1 = Pattern.compile("/product/type");
+    /**
+     * 21美博会专题页
+     */
+    public static final Pattern pattern37 = Pattern.compile("/beautytopic");
+    /**
+     * 22美体会专题页
+     */
+    public static final Pattern pattern38 = Pattern.compile("/cmpage/info-5-301");
+    /**
+     * 23活动专题(云上美博会)
+     */
+    public static final Pattern pattern39 = Pattern.compile("/cmpage/info-6");
+    public static final Pattern pattern39_1 = Pattern.compile("/activity/activityTopic");
+    public static final Pattern pattern39_2 = Pattern.compile("/cmpage/info-7");
+    public static final Pattern pattern39_3 = Pattern.compile("/product/beauty-");
+    /**
+     * 24美博会优惠券页
+     */
+    public static final Pattern pattern40 = Pattern.compile("/user/beautyfair");
+    /**
+     * 25商品资料库列表
+     */
+    public static final Pattern pattern41 = Pattern.compile("/document/beauty-archive.html");
+    /**
+     * 26采美百科产品详情页
+     */
+    public static final Pattern pattern42 = Pattern.compile("/encyclopedia/product-");
+    /**
+     * 27采美百科仪器详情页
+     */
+    public static final Pattern pattern43 = Pattern.compile("/encyclopedia/instrument-");
+    /**
+     * 28认证通推广页
+     */
+    public static final Pattern pattern44 = Pattern.compile("/attestation.html");
+    public static final Pattern pattern44_1 = Pattern.compile("/12/ross");
+    /**
+     * 29领券中心
+     */
+    public static final Pattern pattern45 = Pattern.compile("/user/coupon-collection.html");
+    /**
+     * 招商入驻
+     */
+    public static final Pattern pattern46 = Pattern.compile("/supplier/attraction.html");
+    /**
+     * 快捷运营
+     */
+    public static final Pattern pattern47 = Pattern.compile("/quickOperation/operation-");
+
+    /**
+     * 根据链接判断链接类型
+     *
+     * @param link
+     * @return
+     */
+    public static Integer getLinkType(String link) {
+        if (StringUtils.isNotEmpty(link)) {
+            if (pattern1.matcher(link).find() || pattern34.matcher(link).find() || pattern34_1.matcher(link).find()) {
+                return 1;
+            } else if (pattern2.matcher(link).find() || pattern6.matcher(link).find() || pattern6_1.matcher(link).find()) {
+                return 2;
+            } else if (pattern3.matcher(link).find() || pattern36.matcher(link).find()) {
+                return 3;
+            } else if (pattern4.matcher(link).find() || pattern33.matcher(link).find() || pattern33_1.matcher(link).find()) {
+                return 4;
+            } else if (pattern5.matcher(link).find()) {
+                return 5;
+            } else if (pattern7.matcher(link).find() || pattern8.matcher(link).find() || pattern8_1.matcher(link).find() || pattern9.matcher(link).find() || pattern10.matcher(link).find()) {
+                return 7;
+            } else if (pattern11.matcher(link).find() || pattern12.matcher(link).find()) {
+                return 8;
+            } else if (pattern13.matcher(link).find() || pattern14.matcher(link).find()) {
+                return 9;
+            } else if (pattern15.matcher(link).find() || pattern16.matcher(link).find()) {
+                return 10;
+            } else if (pattern17.matcher(link).find() || pattern18.matcher(link).find()) {
+                return 11;
+            } else if (pattern19.matcher(link).find() || pattern20.matcher(link).find() || pattern21.matcher(link).find()) {
+                return 12;
+            } else if (pattern22.matcher(link).find()) {
+                return 13;
+            } else if (pattern23.matcher(link).find() || pattern24.matcher(link).find()) {
+                return 14;
+            } else if (pattern25.matcher(link).find() || pattern26.matcher(link).find()) {
+                return 15;
+            } else if (pattern27.matcher(link).find() || pattern28.matcher(link).find()) {
+                return 16;
+            } else if (pattern29.matcher(link).find() || pattern30.matcher(link).find()) {
+                return 17;
+            } else if (pattern46.matcher(link).find() || pattern31.matcher(link).find()) {
+                return 18;
+            } else if (pattern32.matcher(link).find()) {
+                return 19;
+            } else if (pattern35.matcher(link).find() || pattern35_1.matcher(link).find()) {
+                if (pattern38.matcher(link).find()) {
+                    return 22;
+                }
+                return 20;
+            } else if (pattern37.matcher(link).find()) {
+                return 21;
+            } else if (pattern39.matcher(link).find() || pattern39_1.matcher(link).find() || pattern39_2.matcher(link).find()|| pattern39_3.matcher(link).find()) {
+                return 23;
+            } else if (pattern40.matcher(link).find()) {
+                return 24;
+            } else if (pattern41.matcher(link).find()) {
+                return 25;
+            } else if (pattern42.matcher(link).find()) {
+                return 26;
+            } else if (pattern43.matcher(link).find()) {
+                return 27;
+            } else if (pattern44.matcher(link).find() || pattern44_1.matcher(link).find()) {
+                return 28;
+            } else if (pattern45.matcher(link).find()) {
+                return 29;
+            } else if (pattern47.matcher(link).find()) {
+                return 30;
+            } else {
+                return -1;
+            }
+        } else {
+            return -1;
+        }
+    }
+
+    /**
+     * 根据链接获取链接中携带的参数
+     *
+     * @param linkType
+     * @param link
+     * @return
+     */
+    public static Map<String, Object> getLinkParam(Integer linkType, String link) {
+        HashMap<String, Object> map = new HashMap<>();
+        String[] idArr = link.split("/");
+        String[] split1 = null;
+        String[] split2 = null;
+        String[] split3 = null;
+        if (idArr.length > 0) {
+            split1 = idArr[idArr.length - 1].split("-");
+            split2 = idArr[idArr.length - 1].split("=");
+            if (split1.length > 0) {
+                split3 = split1[split1.length - 1].split("\\.");
+            }
+        }
+        if (linkType == 3 || linkType == 5 || linkType == 20 || linkType == 22 || linkType == 23 || linkType == 26 || linkType == 27|| linkType == 30) {
+            //-{id}.html
+            if (split3 != null && split3.length == 2) {
+                map.put("id", split3[0]);
+            }
+        } else if (linkType == 1 || linkType == 2 || linkType == 4 || linkType == 7) {
+            if (pattern1.matcher(link).find() || pattern2.matcher(link).find() || pattern6_1.matcher(link).find() || pattern8_1.matcher(link).find() || pattern4.matcher(link).find() || pattern7.matcher(link).find() || pattern10.matcher(link).find() || pattern33_1.matcher(link).find() || pattern34_1.matcher(link).find()) {
+                //-{id}.html
+                if (split3 != null && split3.length == 2) {
+                    map.put("id", split3[0]);
+                }
+            } else if (pattern6.matcher(link).find() || pattern33.matcher(link).find() || pattern8.matcher(link).find() || pattern9.matcher(link).find() || pattern34.matcher(link).find()) {
+                //id={id}
+                if (split2 != null && split2.length == 2) {
+                    map.put("id", split2[1]);
+                }
+            }
+        } else if (linkType == 13 || linkType == 18) {
+            //a-{id}-b
+            if (split1 != null && split1.length == 3) {
+                map.put("id", split1[1]);
+            }
+        } else if (linkType == 12 || linkType == 19) {
+            //keyword=
+            if (split2 != null && split2.length == 2) {
+                String keyword = split2[1];
+                try {
+                    keyword = URLDecoder.decode(keyword, "UTF-8");
+                } catch (UnsupportedEncodingException e) {
+                    log.error("try-catch:",e);
+                }
+                map.put("keyword", keyword);
+            }
+        }
+        return map;
+    }
+
+    public static void main(String[] args) {
+        System.out.println(getLinkType("https://www.caimei365.com/product/beauty-383.html"));
+        System.out.println(getLinkType("http://120.79.25.27:8009/quickOperation/operation-351.html"));
+        System.out.println(getLinkType("https://www-b.caimei365.com/flea-market/list.html"));
+    }
+}

+ 67 - 20
src/main/resources/mapper/ClubMapper.xml

@@ -5,10 +5,10 @@
             useGeneratedKeys="true">
         insert into cm_club_remarks(clubId, serviceProviderId, remarks, addTime, questionMan, consultType, clubType,
                                     pinceSensitve, satisfied, followup, extra, createServiceProviderId, productID, reportID,
-                                    communicationSituation, communicationMethods, customerSource, customerGender, customerAge, groupAddition)
+                                    communicationSituation, communicationMethods, customerSource, customerGender, customerAge, groupAddition, trendsKeyword, stateKeyword)
         values (#{clubId}, #{serviceProviderId}, #{remarks}, now(), #{questionMan}, #{consult}, #{clubType},
                 #{pinceSensitve}, #{satisfied}, #{followup}, #{extra}, #{serviceProviderId}, #{productID}, #{reportID},
-                #{communicationSituation}, #{communicationMethods},#{customerSource},#{customerGender},#{customerAge},#{groupAddition} )
+                #{communicationSituation}, #{communicationMethods},#{customerSource},#{customerGender},#{customerAge},#{groupAddition},#{trendsKeyword}, #{stateKeyword} )
     </insert>
     <insert id="insertRemarksImage">
         insert into cm_club_remarks_file(remarksId, fileType, imageUrl)
@@ -18,15 +18,17 @@
         insert into cm_club_remarks_file(remarksId, fileType, fileName, ossName)
         values (#{remarksId}, 2, #{fileName}, #{ossName})
     </insert>
-    <insert id="insertQuestionMan">
-        insert into cm_visitor_remarks(questionManId, serviceProviderId, remarks, addTime, questionMan, concactTime)
-        values (#{questionManId}, #{serviceProviderId}, #{remarks}, now(), #{questionMan}, #{concactTime})
+    <insert id="insertQuestionMan" keyProperty="remarksId" keyColumn="id" useGeneratedKeys="true">
+        insert into cm_visitor_remarks(questionManId, serviceProviderId, remarks, addTime, questionMan, concactTime, createServiceProviderId)
+        values (#{questionManId}, #{serviceProviderId}, #{remarks}, now(), #{questionMan}, #{concactTime}, #{serviceProviderId})
     </insert>
     <insert id="insertVisitorRemark" keyProperty="remarksId" useGeneratedKeys="true">
         insert into cm_visitor_remarks(questionMan, questionManId, serviceProviderId, remarks, addTime, consultType,
-                                       clubType, pinceSensitve, satisfied, followup, extra, reportID, productID)
+                                       clubType, pinceSensitve, satisfied, followup, extra, reportID, productID,
+                                       communicationSituation, communicationMethods, customerSource, customerGender, customerAge, groupAddition, trendsKeyword, stateKeyword)
         values (#{questionMan}, #{questionManId}, #{serviceProviderId}, #{remarks}, now(), #{consult}, #{clubType},
-                #{pinceSensitve}, #{satisfied}, #{followup}, #{extra}, #{reportId}, #{productId})
+                #{pinceSensitve}, #{satisfied}, #{followup}, #{extra}, #{reportId}, #{productId},
+                #{communicationSituation}, #{communicationMethods},#{customerSource},#{customerGender},#{customerAge},#{groupAddition},#{trendsKeyword}, #{stateKeyword})
     </insert>
     <update id="updateClubNewDeal">
         update club
@@ -317,8 +319,10 @@
             customerSource          = #{customerSource},
             customerGender          = #{customerGender},
             customerAge             = #{customerAge},
-            groupAddition           = #{groupAddition}
-        where id = #{remarksId}
+            groupAddition           = #{groupAddition},
+            trendsKeyword   = #{trendsKeyword},
+            stateKeyword    = #{stateKeyword}
+            where id = #{remarksId}
     </update>
     <update id="updateQuestionMan">
         update cm_visitor_remarks
@@ -336,7 +340,15 @@
             followup=#{followup},
             extra=#{extra},
             reportID=#{reportId},
-            productID=#{productId}
+            productID=#{productId},
+            communicationSituation  = #{communicationSituation},
+            communicationMethods    = #{communicationMethods},
+            customerSource          = #{customerSource},
+            customerGender          = #{customerGender},
+            customerAge             = #{customerAge},
+            groupAddition           = #{groupAddition},
+            trendsKeyword   = #{trendsKeyword},
+            stateKeyword    = #{stateKeyword}
         where id = #{remarksId}
     </update>
     <update id="updateVisit">
@@ -451,6 +463,14 @@
                         ccr.satisfied,
                         ccr.followup,
                         ccr.extra,
+                        ccr.communicationSituation,
+                        ccr.communicationMethods,
+                        ccr.customerSource,
+                        ccr.customerGender,
+                        ccr.groupAddition,
+                        ccr.customerAge,
+                        ccr.trendsKeyword,
+                        ccr.stateKeyword,
                         p.`mainImage`               AS mainImage,
                         p.name                      AS productName,
                         s.name                      AS shopName,
@@ -482,12 +502,14 @@
     </select>
 
     <select id="getRemarksInfo" resultType="com.caimei365.user.model.po.ClubRemarksPo">
-        select communicationSituation, communicationMethods, customerSource, customerGender, groupAddition, customerAge
-        from cm_club_remarks where clubId = #{clubId} order by addTime desc limit 1
+        select ccr.communicationSituation, ccr.communicationMethods, ccr.customerSource, ccr.customerGender, ccr.groupAddition, ccr.customerAge
+        from cm_club_remarks ccr
+        left join club c on ccr.clubId = c.clubId
+        where c.userId = #{userId} order by ccr.addTime desc limit 1
     </select>
 
-    <select id="getPriorKeywordList" resultType="java.lang.String">
-        select cusf.keyword as keyword
+    <select id="getPriorKeywordList" resultType="java.util.Map">
+        select cusf.keyword as label
         from cm_prior_keyword cpk
         left join cm_user_search_frequency cusf on cpk.searchId = cusf.id
         WHERE cpk.delFlag = 0 AND cusf.delStatus = 1
@@ -503,7 +525,7 @@
 
     <insert id="insertLabel">
         insert into cm_user_search_frequency(fromSearch, keyword, frequency, trueStatus, dynamicStatus, addTime)
-        values (4, #{keyword}, 0, 0, #{dynamicStatus}, now())
+        values (4, #{keyword}, 0, #{trueStatus}, #{dynamicStatus}, now())
     </insert>
 
 
@@ -568,6 +590,14 @@
                         ccr.satisfied,
                         ccr.followup,
                         ccr.extra,
+                        ccr.communicationSituation,
+                        ccr.communicationMethods,
+                        ccr.customerSource,
+                        ccr.customerGender,
+                        ccr.groupAddition,
+                        ccr.customerAge,
+                        ccr.trendsKeyword,
+                        ccr.stateKeyword,
                         p.`mainImage`               AS mainImage,
                         p.name                      AS productName,
                         s.name                      AS shopName,
@@ -643,6 +673,8 @@
         ccr.id AS remarksId, ccr.remarks,ccr.addTime,ccr.questionMan,ccr.serviceProviderId as serviceProviderId, ccr.createServiceProviderId as createServiceProviderId,
         csr.leaderId AS leaderId,IFNULL(ccr.consultType,'') as consult, c.Name as clubName,
         ccr.clubType AS clubType,ccr.pinceSensitve AS pinceSensitve,ccr.satisfied AS satisfied,ccr.followup AS followup,ccr.extra AS extra,
+        ccr.communicationSituation, ccr.communicationMethods, ccr.customerSource, ccr.customerGender,
+        ccr.groupAddition, ccr.customerAge, ccr.trendsKeyword, ccr.stateKeyword,
         (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID= csr.leaderId) AS leaderName,
         (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.createServiceProviderId) as recordName,c.newDeal as newDeal,cmc.status as status
         # (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.oldserviceProviderId) AS oldName
@@ -700,7 +732,7 @@
     <select id="getVisitorListByKey" resultType="com.caimei365.user.model.vo.VisitorRemarkVo">
         SELECT DISTINCT
         ccr.id as remarksId, ccr.questionManId, ccr.remarks, ccr.addTime as addDate,
-        ccr.questionMan,IFNULL(ccr.consultType,'') as consult,
+        ccr.questionMan,IFNULL(ccr.consultType,'') as consult, ccr.createServiceProviderId as createServiceProviderId,
         ccr.serviceProviderId,ccr.clubType,ccr.pinceSensitve,ccr.satisfied,ccr.followup,ccr.extra,
         (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS recordName,
         (select name from serviceprovider s where s.serviceProviderID = csr.leaderId) as leaderName,cmc.status as status
@@ -799,6 +831,8 @@
         ccr.id AS remarksId, ccr.remarks,ccr.addTime,ccr.questionMan,ccr.serviceProviderId as serviceProviderId, ccr.createServiceProviderId as createServiceProviderId,
         csr.leaderId AS leaderId,IFNULL(ccr.consultType,'') as consult, c.Name as clubName,
         ccr.clubType AS clubType,ccr.pinceSensitve AS pinceSensitve,ccr.satisfied AS satisfied,ccr.followup AS followup,ccr.extra AS extra,
+        ccr.communicationSituation, ccr.communicationMethods, ccr.customerSource, ccr.customerGender,
+        ccr.groupAddition, ccr.customerAge, ccr.trendsKeyword, ccr.stateKeyword,
         (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID= csr.leaderId) AS leaderName,
         (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.createServiceProviderId) AS recordName,c.newDeal as newDeal,cmc.status as status
         # (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.oldserviceProviderId) AS oldName
@@ -857,7 +891,7 @@
     <select id="getAllVisitRemark" resultType="com.caimei365.user.model.vo.VisitorRemarkVo">
         SELECT DISTINCT
         ccr.id AS remarksId, ccr.remarks,ccr.addTime as addDate,ccr.questionMan,IFNULL(ccr.consultType,'') as
-        consult,ccr.serviceProviderId,ccr.questionManId,
+        consult,ccr.serviceProviderId,ccr.questionManId,ccr.createServiceProviderId as createServiceProviderId,
         ccr.clubType AS clubType,ccr.pinceSensitve AS pinceSensitve,ccr.satisfied AS satisfied,ccr.followup AS
         followup,ccr.extra AS extra,
         (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID = csr.leaderId) AS leaderName,
@@ -916,8 +950,8 @@
         WHERE s.serviceProviderID = #{serviceProviderId}
     </select>
 
-    <select id="getCmRemarksList" resultType="java.lang.String">
-        SELECT keyword
+    <select id="getCmRemarksList" resultType="java.util.Map">
+        SELECT keyword as label
         FROM cm_user_search_frequency
         WHERE keyword like concat('%', #{keyword}, '%')
         and dynamicStatus = #{type}
@@ -1091,6 +1125,18 @@
         </if>
     </select>
 
+    <select id="getClubBehavior" resultType="java.lang.String">
+        SELECT cbr.pageLabel FROM cm_behavior_record cbr LEFT JOIN club c ON c.userID = cbr.userId
+        WHERE pageType IN (6, 8, 9, 11, 14) AND c.clubId = #{clubId}
+        <if test="startTime != null and startTime != ''">
+            and cbr.accessTime > #{startTime}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and cbr.accessTime <![CDATA[ < ]]> #{endTime}
+        </if>
+        GROUP BY cbr.pageLabel ORDER BY COUNT(cbr.pageLabel) DESC
+    </select>
+
     <select id="selOrderList" resultType="com.caimei365.user.model.po.NewOrderPo">
         SELECT
         (SELECT COUNT(shopOrderId) FROM cm_shop_order WHERE clubID = #{clubId} AND shopStatus != 4 AND shopStatus != 5 AND refundStatus != 2 AND orderTime <![CDATA[ < ]]> NOW()) AS orderTotal,
@@ -1104,8 +1150,9 @@
         cso.orderTime
         FROM cm_shop_order cso
         LEFT JOIN cm_order co ON cso.orderId = co.orderId
+        left join cm_order_product cop on cop.shopOrderId = cso.shopOrderId
         <where>
-            cso.clubID = #{clubID} AND cso.shopStatus != 4 AND cso.shopStatus != 5 AND cso.refundStatus != 2 AND cop.productId != 999
+            cso.clubID = #{clubId} AND cso.shopStatus != 4 AND cso.shopStatus != 5 AND cso.refundStatus != 2 AND cop.productId != 999
             <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
                 AND cso.orderTime <![CDATA[ >= ]]> #{startTime} AND cso.orderTime <![CDATA[ <= ]]> #{endTime}
             </if>

+ 118 - 15
src/main/resources/mapper/RoosInformationMapper.xml

@@ -2,10 +2,80 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei365.user.mapper.RoosInformationMapper">
     <select id="selIsClick" resultType="integer">
-        SELECT isClick FROM cm_roos_information
-            <where>
-                    AND IP = #{IP} AND createTime LIKE concat('%',#{createTime},'%')
-            </where>
+        SELECT isClick FROM cm_roos_information cri
+        <if test="productId != null">
+            LEFT JOIN product p ON p.shopId = cri.shopId
+        </if>
+        <if test="infoId != null">
+            LEFT JOIN cm_shop_info csi ON csi.shopId = cri.shopId
+        </if>
+        <if test="keyword != null and keyword != ''">
+            left join shop s on s.shopId = cri.shopId
+            LEFT JOIN cm_shop_keyword csk ON csk.shopId = cri.shopId
+            left join cm_user_search_frequency cusf on cusf.id = csk.searchId
+        </if>
+        <where>
+            cri.IP = #{IP} and cri.createTime LIKE concat('%',#{createTime},'%')
+            <if test="shopId != null">
+                and cri.shopId = #{shopId}
+            </if>
+            <if test="productId != null">
+                and p.productId = #{productId}
+            </if>
+            <if test="infoId != null">
+                and csi.status = 0
+                and csi.infoId = #{infoId}
+            </if>
+            <if test="keyword != null and keyword != ''">
+                and ((csk.status = 0 and cusf.keyword like concat('%',#{keyword},'%') ) or s.name like concat('%',#{keyword},'%'))
+            </if>
+        </where>
+    </select>
+
+    <select id="getShopStatus" resultType="java.lang.Integer">
+        select css.status
+        from cm_shop_statistics css
+        <if test="productId != null">
+            LEFT JOIN product p ON p.shopId = css.shopId
+        </if>
+        <if test="infoId != null">
+            LEFT JOIN cm_shop_info csi ON csi.shopId = css.shopId
+        </if>
+        <if test="keyword != null and keyword != ''">
+            left join shop s on s.shopId = css.shopId
+            LEFT JOIN cm_shop_keyword csk ON csk.shopId = css.shopId
+            left join cm_user_search_frequency cusf on cusf.id = csk.searchId
+        </if>
+        <where>
+            css.delFlag = 0
+            <if test="shopId != null">
+                and css.shopId = #{shopId}
+            </if>
+            <if test="productId != null">
+                and p.productId = #{productId}
+            </if>
+            <if test="infoId != null">
+                and csi.status = 0
+                and csi.infoId = #{infoId}
+            </if>
+            <if test="keyword != null and keyword != ''">
+                and (csk.status = 0 and cusf.keyword like concat('%',#{keyword},'%') ) or s.name like concat('%',#{keyword},'%')
+            </if>
+        </where>
+        limit 1
+    </select>
+
+    <select id="getShopAdvert" resultType="com.caimei365.user.model.vo.cmShopAdvertisingImage">
+        select csa.* from cm_shop_advertisingImage csa
+        left join cm_shop_statistics cps on csa.shopId = cps.shopId
+        where cps.status = 0 and csa.status = 0 and csa.delFlag = 0
+        <if test="shopIds.size()>0">
+            and csa.shopId in
+            <foreach collection="shopIds" item="shopId" open="(" separator="," close=")">
+                  #{shopId}
+            </foreach>
+        </if>
+        order by csa.sort asc, csa.addTime desc
     </select>
 
     <select id="getShopPop" resultType="com.caimei365.user.model.vo.CmShopPopUpVo">
@@ -17,6 +87,7 @@
           csp.guidingTwo,
           csp.addTime
         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>
@@ -24,24 +95,24 @@
             LEFT JOIN cm_shop_info csi ON csi.shopId = csp.shopId
          </if>
         <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_user_search_frequency cusf on cusf.id = csk.searchId
         </if>
         <where>
-            csp.status = 0
+            css.status = 0
             <if test="shopId != null">
                 and csp.shopId = #{shopId}
             </if>
             <if test="productId != null">
-                and s.productId = #{productId}
+                and p.productId = #{productId}
             </if>
             <if test="infoId != null">
                 and csi.status = 0
-                and csi.id = #{infoId}
+                and csi.infoId = #{infoId}
             </if>
             <if test="keyword != null and keyword != ''">
-                and csk.status = 0
-                and cusf.keyword like concat('%',#{keyword},'%')
+                and (csk.status = 0 and cusf.keyword like concat('%',#{keyword},'%') ) or s.name like concat('%',#{keyword},'%')
             </if>
         </where>
         limit 1
@@ -75,14 +146,46 @@
                )
     </insert>
 
-    <select id="visitRoos" resultType="String">
-        SELECT behaviorType FROM cm_behavior_record
+    <select id="getShopId" resultType="java.lang.Integer">
+        select shopId from cm_shop_statistics where status = 0 and delFlag = 0
+    </select>
+
+    <select id="getShopProductId" resultType="java.lang.Integer">
+        select productId from product where shopId = #{shopId}
+    </select>
+
+    <select id="getShopInfoId" resultType="java.lang.Integer">
+        select infoId from cm_shop_info where shopId = #{shopId} and status = 0 and delFlag = 0
+    </select>
+
+    <select id="getShopKeyword" resultType="java.lang.String">
+        select cusf.keyword
+        from cm_shop_keyword csk
+        left join cm_user_search_frequency cusf on cusf.id = csk.searchId
+        where csk.shopId = #{shopId} and csk.status = 0 and csk.delFlag = 0
+    </select>
+
+    <select id="getBehavior" resultType="java.lang.Integer">
+        SELECT recordID
+        from cm_behavior_record
         <where>
-            <if test="userID != 0">
-                AND userID = #{userID}
+            delFlag = 0 and accessDate = #{accessDate}
+            <if test="pageType != null">
+                and pageType = #{pageType}
+            </if>
+            <if test="pageType != 8">
+                <if test="pagePath != null and pagePath != ''">
+                    and pagePath like concat('%',#{pagePath},'%')
+                </if>
+            </if>
+            <if test="pageType == 8">
+                and pageLabel  = #{pagePath}
+            </if>
+            <if test="userId != 0">
+                AND userID = #{userId}
             </if>
-            <if test="userID == 0">
-                AND IP = #{IP}
+            <if test="userId == 0">
+                AND IP = #{ip}
             </if>
         </where>
     </select>