瀏覽代碼

Merge remote-tracking branch 'origin/developerD' into developer

huangzhiguo 1 年之前
父節點
當前提交
542e52f91d

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

@@ -208,13 +208,19 @@ public class ClubApi {
     }
 
     @ApiOperation("关键词库联想查询")
-    @ApiImplicitParam(required = true, name = "remarks", value = "联想词")
+    @ApiImplicitParams({
+            @ApiImplicitParam(required = true, name = "remarks", value = "联想词"),
+            @ApiImplicitParam(required = true, name = "type", value = "联想类型 0 动态标签 1 静态标签")
+    })
     @GetMapping("/remarks/cmremarkslist")
-    public ResponseJson getCmRemarksList(String remarks) {
-        if (null == remarks || remarks == "") {
+    public ResponseJson getCmRemarksList(String remarks, Integer type) {
+        if (StringUtils.isBlank(remarks)) {
             return ResponseJson.error("参数异常,关键词不能为空!", null);
         }
-        return clubService.getCmRemarksList(remarks);
+        if (null == type) {
+            return ResponseJson.error("参数异常,联想类型不能为空!", null);
+        }
+        return clubService.getCmRemarksList(remarks, type);
     }
 
     @ApiOperation("机构资料备注详情")
@@ -224,6 +230,23 @@ public class ClubApi {
         return clubService.getRemarksDetail(remarksId);
     }
 
+    @ApiOperation("优先展示标签 -- 咨询记录 -> 标签记录")
+    @GetMapping("/remarks/getPriorKeyword")
+    public ResponseJson<List<Map<String, String>>> getPriorKeyword(){
+
+        return clubService.getPriorKeyword();
+    }
+
+    @ApiOperation("查询机构历史填写信息")
+    @ApiImplicitParam(required = true, name = "userId", value = "机构用户Id")
+    @GetMapping("/remarks/getHistoryInfo")
+    public ResponseJson<Map<String, Object>> getHistoryInfo(Integer userId) {
+        if (null == userId) {
+            return ResponseJson.error(-1, "机构Id不能为空", null);
+        }
+        return clubService.getHistoryInfo(userId);
+    }
+
     /**
      * @param jsonParamsDto:{ remarksId:           备注id,
      *                        机构id:               机构id,
@@ -602,7 +625,7 @@ public class ClubApi {
     }
 
     /**
-     * 机构初始出局
+     * 机构初始数据
      * @param clubId
      * @return
      */
@@ -613,6 +636,19 @@ public class ClubApi {
         }
         return clubService.selTotal(clubId);
     }
+
+    /**
+     * 用户需求
+     * @param clubId
+     * @param dateType
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    @GetMapping("/getCustomDemand")
+    public ResponseJson<Map<String, Object>> getCustomDemand(Integer clubId, Integer dateType, String startTime, String endTime) {
+        return clubService.getCustomDemand(clubId, dateType, startTime, endTime);
+    }
     /**
      * 机构画像
      * @param cmPortrait

+ 29 - 10
src/main/java/com/caimei365/user/controller/RoosInformationApi.java

@@ -2,11 +2,16 @@ 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
  *
@@ -25,13 +30,26 @@ 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);
+    }
+
+    /**
+     * 供应商弹框信息
+     * @param shopId
+     * @param productId
+     * @param infoId
+     * @param keyword
+     * @return
+     */
+    @GetMapping("/getPopUpInfo")
+    public ResponseJson<CmShopPopUpVo> getPopUpInfo(Integer shopId, Integer productId, Integer infoId, String keyword) {
+        return roosInformationService.getPopUpInfo(shopId, productId, infoId, keyword);
     }
 
     /**
@@ -41,22 +59,23 @@ public class RoosInformationApi {
      */
     @PostMapping("/insertRoos")
     public ResponseJson<String> insertRoosInformation(RoosInformationDto roosInformationDto) {
+        if (null == roosInformationDto.getShopId()) {
+            return ResponseJson.error(-1, "供应商Id不能为空", null);
+        }
         // 获取访问ip
         String ip = roosInformationService.obtainIp();
         roosInformationDto.setIp(ip);
-        roosInformationService.insRoosInformation(roosInformationDto);
-        return ResponseJson.success("咨询信息插入成功");
+        return roosInformationService.insRoosInformation(roosInformationDto);
     }
 
     /**
-     * 查看访问者是否浏览过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);
     }
 }

+ 34 - 1
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
@@ -233,6 +234,34 @@ public interface ClubMapper {
      */
     List<RemarksFileVo> getRemarksFileList(Integer remarksId);
 
+    /**
+     * 机构咨询记录历史信息
+     * @param userId
+     * @return
+     */
+    ClubRemarksPo getRemarksInfo(@Param("userId") Integer userId);
+
+    /**
+     * 优先展示标签
+     * @return
+     */
+    List<Map<String, String>> getPriorKeywordList();
+
+    /**
+     * 标签是否已存在
+     * @param keyword
+     * @return
+     */
+    Integer findKeywordExist(@Param("keyword") String keyword);
+    /**
+     * 保存静态动态标签
+     * @param keyword
+     * @param serviceProviderId
+     * @param trueStatus
+     * @param dynamicStatus
+     */
+    void insertLabel(@Param("keyword") String keyword, @Param("serviceProviderId") Integer serviceProviderId, @Param("trueStatus") Integer trueStatus, @Param("dynamicStatus") Integer dynamicStatus);
+
     /**
      * 删除资料备注
      *
@@ -323,7 +352,7 @@ public interface ClubMapper {
 
     Integer findLeaderId(Integer serviceProviderId);
 
-    List<CmRemarksVo> getCmRemarksList(String remarks);
+    List<String> getCmRemarksList(@Param("keyword") String keyword, @Param("type") Integer type);
 
     ClubVo recordClubage(Integer clubId);
 
@@ -365,6 +394,10 @@ public interface ClubMapper {
 
     List<BehaviorRecodeVo> recordDetail(@Param("clubId") Integer clubId, @Param("accessDate") String accessDate);
 
+    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);
 
     List<BehaviorRecodeVo> selBehaviorList(CmPortraitDto cmPortrait);

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

@@ -2,6 +2,8 @@ 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;
 
@@ -18,10 +20,37 @@ 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);
+
+    /**
+     * 弹框样式
+     * @param shopId
+     * @param productId
+     * @param infoId
+     * @param keyword
+     * @return
+     */
+   CmShopPopUpVo getShopPop(@Param("shopId") Integer shopId,@Param("productId")  Integer productId,@Param("infoId")  Integer infoId,@Param("keyword")  String keyword);
 
     /**
      * 插入填写咨询人基本信息
@@ -30,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);
 }

+ 4 - 0
src/main/java/com/caimei365/user/model/dto/RoosInformationDto.java

@@ -15,6 +15,10 @@ public class RoosInformationDto {
      * 访问人ip
      */
     private String ip;
+    /**
+     * 供应商Id
+     */
+    private Integer shopId;
     /**
      * 咨询姓名
      */

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

@@ -71,4 +71,36 @@ public class ClubRemarksPo implements Serializable {
      *报备关联ID
      */
     private Integer reportID;
+    /**
+     * 沟通情况
+     */
+    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;
 }

+ 37 - 0
src/main/java/com/caimei365/user/model/vo/ClubVo.java

@@ -205,4 +205,41 @@ public class ClubVo implements Serializable {
      */
     private Date providerTime;
 
+    /**
+     * 沟通情况
+     */
+    private Integer communicationSituation;
+    /**
+     * 沟通方式 1:电话 2:微信
+     */
+    private String communicationMethods;
+    /**
+     * 客户来源
+     */
+    private Integer customerSource;
+    /**
+     * 客户性别
+     */
+    private Integer customerGender;
+    /**
+     * 客户年龄
+     */
+    private String customerAge;
+    /**
+     * 加群情况
+     */
+    private Integer groupAddition;
+    /**
+     * 资料完整度
+     */
+    private Integer number;
+    /**
+     * 微信是否触达
+     */
+    private String wx;
+    /**
+     * 电话是否触达
+     */
+    private String mob;
+
 }

+ 34 - 0
src/main/java/com/caimei365/user/model/vo/CmShopPopUpVo.java

@@ -0,0 +1,34 @@
+package com.caimei365.user.model.vo;
+
+import lombok.Data;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2023/9/13
+ */
+@Data
+public class CmShopPopUpVo {
+    private Integer id;
+    /**
+     * 供应商Id
+     */
+    private Integer shopId;
+    /**
+     * 图片
+     */
+    private String image;
+    /**
+     * 引导语1
+     */
+    private String guidingOne;
+    /**
+     * 引导语2
+     */
+    private String guidingTwo;
+    /**
+     * 添加时间
+     */
+    private String addTime;
+}

+ 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;
+}

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

@@ -106,6 +106,18 @@ public interface ClubService {
      */
     ResponseJson archiveDeduction(Integer userId, Integer archiveId);
 
+    /**
+     * 优先展示标签 -- 咨询记录 -》 标签记录
+     * @return
+     */
+    ResponseJson<List<Map<String, String>>> getPriorKeyword();
+
+    /**
+     * 查询机构历史填写信息
+     * @param userId
+     * @return
+     */
+    ResponseJson<Map<String, Object>> getHistoryInfo(Integer userId);
     /**
      * 保存机构资料备注
      *
@@ -277,7 +289,7 @@ public interface ClubService {
 
     ResponseJson findGroups(Integer leaderId);
 
-    ResponseJson getCmRemarksList(String remarks);
+    ResponseJson getCmRemarksList(String remarks, Integer type);
 
     ResponseJson<PaginationVo<ReportVo>> reportRemarks(Integer manager, Integer serviceProviderId, String keyWord, int pageNum, int pageSize);
 
@@ -295,6 +307,8 @@ public interface ClubService {
 
     ResponseJson selTotal(Integer clubId);
 
+    ResponseJson<Map<String, Object>> getCustomDemand(Integer clubId, Integer dateType, String startTime, String endTime);
+
     ResponseJson dataList(CmPortraitDto cmPortrait);
 
     ResponseJson<List<BanksVo>> getUserBanks(Integer userId);

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

@@ -1,7 +1,10 @@
 package com.caimei365.user.service;
 
+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;
 
@@ -17,20 +20,31 @@ public interface RoosInformationService {
      * @param IP
      * @return
      */
-    Boolean boolIsClick(String IP);
+    Boolean boolIsClick(String IP, Integer shopId, Integer productId, Integer infoId, String keyword);
+
+
+    /**
+     * 供应商弹框信息
+     * @param shopId
+     * @param productId
+     * @param infoId
+     * @param keyword
+     * @return
+     */
+    ResponseJson<CmShopPopUpVo> getPopUpInfo(Integer shopId, Integer productId, Integer infoId, String keyword);
 
     /**
      * 插入填写咨询人基本信息
      * @param roosInformationDto
      */
-    void insRoosInformation(RoosInformationDto roosInformationDto);
+    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

+ 532 - 21
src/main/java/com/caimei365/user/service/impl/ClubServiceImpl.java

@@ -99,6 +99,76 @@ public class ClubServiceImpl implements ClubService {
             club.setProvinceId(province.getProvinceId());
             club.setProvincialAddress(province.getName() + "" + city.getName() + "" + town.getName());
         }
+        // 机构咨询记录信息
+        ClubRemarksPo remarksInfo = clubMapper.getRemarksInfo(club.getUserId());
+        if (null != remarksInfo) {
+            club.setCommunicationSituation(remarksInfo.getCommunicationSituation());
+            club.setCommunicationMethods(remarksInfo.getCommunicationMethods());
+            club.setCustomerSource(remarksInfo.getCustomerSource());
+            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;
+        if (null != club) {
+            // 计算资料完整度
+            if (StringUtils.isNotBlank(club.getName())) {
+                number += 10;
+            }
+            if (StringUtils.isNotBlank(club.getLinkMan())) {
+                number += 10;
+            }
+            if (StringUtils.isNotBlank(club.getContractMobile())) {
+                number += 10;
+            }
+            if (null != club.getLinkManIdentity()) {
+                number += 10;
+            }
+            if (StringUtils.isNotBlank(club.getAddress())) {
+                number += 10;
+            }
+            if (StringUtils.isNotBlank(club.getBusinessLicense())) {
+                number += 10;
+            }
+            if (null != club.getUserIdentity()) {
+                number += 10;
+            }
+            if (StringUtils.isNotBlank(club.getShortName())) {
+                number += 3;
+            }
+            if (StringUtils.isNotBlank(club.getContractEmail())) {
+                number += 5;
+            }
+            if (StringUtils.isNotBlank(club.getContractPhone())) {
+                number += 4;
+            }
+            if (StringUtils.isNotBlank(club.getFax())) {
+                number += 3;
+            }
+            if (StringUtils.isNotBlank(club.getShopPhoto())) {
+                number += 5;
+            }
+            if (StringUtils.isNotBlank(club.getSocialCreditCode())) {
+                number += 5;
+            }
+            if (StringUtils.isNotBlank(club.getProfile())) {
+                number += 5;
+            }
+        }
+        club.setNumber(number);
         Map<String, Object> map = new HashMap(2);
         map.put("user", user);
         map.put("club", club);
@@ -901,6 +971,43 @@ public class ClubServiceImpl implements ClubService {
         return ResponseJson.success("抵扣成功");
     }
 
+    /**
+     * 优先展示标签 -- 咨询记录 -》 标签记录
+     *
+     * @return
+     */
+    @Override
+    public ResponseJson<List<Map<String, String>>> getPriorKeyword() {
+        return ResponseJson.success(clubMapper.getPriorKeywordList());
+    }
+
+    /**
+     * 查询机构历史填写信息
+     *
+     * @param userId
+     * @return
+     */
+    @Override
+    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());
+            }
+            if (null != remarksInfo.getCustomerGender()) {
+                map.put("customerGender", remarksInfo.getCustomerGender());
+            }
+            if (null != remarksInfo.getCustomerAge()) {
+                map.put("customerAge", remarksInfo.getCustomerAge());
+            }
+            if (null != remarksInfo.getGroupAddition()) {
+                map.put("groupAddition", remarksInfo.getGroupAddition());
+            }
+        }
+        return ResponseJson.success(map);
+    }
+
     /**
      * 保存机构资料备注
      *
@@ -933,6 +1040,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 == clubId) {
                 return ResponseJson.error("参数异常,机构id不能为空");
             }
@@ -955,8 +1078,47 @@ public class ClubServiceImpl implements ClubService {
             } else {
                 strings.add(rk);
             }
-            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, serviceProviderId, 1, 0);
+                        }
+                    }
+                } else {
+                    trendsKeywordList.add(trendsKeyword);
+                    Integer keywordExist = clubMapper.findKeywordExist(trendsKeyword);
+                    if(null == keywordExist) {
+                        clubMapper.insertLabel(trendsKeyword, serviceProviderId, 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, serviceProviderId, 0, 1);
+                        }
+                    }
+                } else {
+                    stateKeywordList.add(stateKeyword);
+                    Integer keywordExist = clubMapper.findKeywordExist(stateKeyword);
+                    if(null == keywordExist) {
+                        clubMapper.insertLabel(stateKeyword, serviceProviderId, 0, 1);
+                    }
+                }
             }
 //                clubRemarksPo.setRemarks(StringUtils.strip(strings.toString(), "[]"));
 //            }
@@ -974,6 +1136,14 @@ public class ClubServiceImpl implements ClubService {
             clubRemarksPo.setExtra(extra);
             clubRemarksPo.setProductID(productID);
             clubRemarksPo.setReportID(reportID);
+            clubRemarksPo.setCommunicationSituation(communicationSituation);
+            clubRemarksPo.setCommunicationMethods(communicationMethods);
+            clubRemarksPo.setCustomerSource(customerSource);
+            clubRemarksPo.setCustomerGender(customerGender);
+            clubRemarksPo.setCustomerAge(customerAge);
+            clubRemarksPo.setGroupAddition(groupAddition);
+            clubRemarksPo.setTrendsKeyword(StringUtils.strip(trendsKeywordList.toString(), "[]"));
+            clubRemarksPo.setStateKeyword(StringUtils.strip(stateKeywordList.toString(), "[]"));
             if (newRemarks) {
                 // 新增备注
                 clubMapper.insertRemarks(clubRemarksPo);
@@ -1009,6 +1179,7 @@ public class ClubServiceImpl implements ClubService {
             if (newRemarks && pushMessage) {
                 asyncService.sendChoseServiceMessage(2, clubId, serviceProviderId, clubRemarksPo.getRemarksId());
             }
+
             return ResponseJson.success("保存资料备注成功");
         } catch (Exception e) {
             log.info("保存机构资料备注参数:" + jsonParamsDto.toString());
@@ -1403,26 +1574,75 @@ 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.isBlank(rk) || StringUtils.isEmpty(rk)) &&
+                    (StringUtils.isBlank(trend) || StringUtils.isEmpty(trend)) &&
+                    (StringUtils.isBlank(state) || StringUtils.isEmpty(state))) {
+                strings = null;
+            }
+
             if (StringUtils.isNotBlank(r.getConsult())) {
                 if (r.getConsult().contains(",")) {
                     String[] split = r.getConsult().split(",");
@@ -1487,8 +1707,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) {
@@ -1501,7 +1723,44 @@ public class ClubServiceImpl implements ClubService {
                 map.put("label", rk);
                 strings.add(map);
             }
-
+            if (StringUtils.isBlank(remarksVo.getRemarks()) || StringUtils.isEmpty(remarksVo.getRemarks())) {
+                strings = null;
+            }
+            // 动态标签
+            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);
+            }
+            if (StringUtils.isBlank(remarksVo.getTrendsKeyword()) || StringUtils.isEmpty(remarksVo.getTrendsKeyword())) {
+                trends = null;
+            }
+            // 静态标签
+            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.getStateKeyword()) || StringUtils.isEmpty(remarksVo.getStateKeyword())) {
+                state = null;
+            }
             RemarkVo remarkVo = new RemarkVo();
             remarkVo.setClubId(remarksVo.getClubId());
             remarkVo.setUserId(remarksVo.getUserId());
@@ -1526,6 +1785,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(","));
@@ -1661,7 +1928,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);
@@ -1740,20 +2008,28 @@ 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不能为空");
             }
             if (null == serviceProviderId) {
                 return ResponseJson.error("参数异常,协销id不能为空");
             }
-//            JSONArray remarks;
-//
-//            remarks = parseArray(visitor.getParams());
-
-            if (remarks.isEmpty()) {
-                return ResponseJson.error("添加关键词异常!", null);
-            }
             boolean newRemarks = null == remarksId;
             VisitorRemarkVo visitorRemarkVo = new VisitorRemarkVo();
             List<String> strings = new ArrayList<>();
@@ -1767,6 +2043,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, serviceProviderId, 1, 0);
+                        }
+                    }
+                } else {
+                    trendsKeywordList.add(trendsKeyword);
+                    Integer keywordExist = clubMapper.findKeywordExist(trendsKeyword);
+                    if(null == keywordExist) {
+                        clubMapper.insertLabel(trendsKeyword, serviceProviderId, 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, serviceProviderId, 0, 1);
+                        }
+                    }
+                } else {
+                    stateKeywordList.add(stateKeyword);
+                    Integer keywordExist = clubMapper.findKeywordExist(stateKeyword);
+                    if(null == keywordExist) {
+                        clubMapper.insertLabel(stateKeyword, serviceProviderId, 0, 1);
+                    }
+                }
+            }
             visitorRemarkVo.setRemarks(StringUtils.strip(strings.toString(), "[]").replace("\"", ""));//去除符号
 //            }
             // 是否新增备注
@@ -1784,6 +2102,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);
@@ -1832,6 +2158,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(",")) {
@@ -1846,6 +2174,45 @@ public class ClubServiceImpl implements ClubService {
                 map.put("label", rk);
                 strings.add(map);
             }
+            if (StringUtils.isBlank(visitRemarksVo.getRemarks()) || StringUtils.isEmpty(visitRemarksVo.getRemarks())) {
+                strings = null;
+            }
+            // 动态标签
+            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);
+            }
+            if (StringUtils.isBlank(visitRemarksVo.getTrendsKeyword()) || StringUtils.isEmpty(visitRemarksVo.getTrendsKeyword())) {
+                trends = null;
+            }
+            // 静态标签
+            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.getStateKeyword()) || StringUtils.isEmpty(visitRemarksVo.getStateKeyword())) {
+                state = null;
+            }
+
 
             VisitRemarkVo visit = new VisitRemarkVo();
             visit.setConsult(visitRemarksVo.getConsult());
@@ -1870,6 +2237,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(",")) {
@@ -1923,20 +2298,69 @@ public class ClubServiceImpl implements ClubService {
                 for (String remark : split) {
                     HashMap<String, String> map = new HashMap<>();
                     map.put("label", remark);
-                    strings.add(map);
+                    if (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 (StringUtils.isNotBlank(remark)) {
+                        strings.add(map);
+                    }
                 }
             } else {
                 HashMap<String, String> map = new HashMap<>();
                 map.put("label", rk);
-                strings.add(map);
+                if (StringUtils.isNotBlank(rk)) {
+                    strings.add(map);
+                }
             }
+            // 动态标签
+            String trendsKeywords = StringUtils.isBlank(r.getTrendsKeyword()) ? "" : r.getTrendsKeyword();
+            if (trendsKeywords.contains(",")) {
+                String[] split = trendsKeywords.split(",");
+                for (String remark : split) {
+                    HashMap<String, String> map = new HashMap<>();
+                    map.put("label", remark);
+                    if (StringUtils.isNotBlank(remark)) {
+                        strings.add(map);
+                    }
+                }
+            } else {
+                HashMap<String, String> map = new HashMap<>();
+                map.put("label", trendsKeywords);
+                if (StringUtils.isNotBlank(trendsKeywords)) {
+                    strings.add(map);
+                }
+            }
+            // 静态标签
+            String stateKeywords = StringUtils.isBlank(r.getStateKeyword()) ? "" : r.getStateKeyword();
+            if (stateKeywords.contains(",")) {
+                String[] split = stateKeywords.split(",");
+                for (String remark : split) {
+                    HashMap<String, String> map = new HashMap<>();
+                    map.put("label", remark);
+                    if (StringUtils.isNotBlank(remark)) {
+                        strings.add(map);
+                    }
+                }
+            } else {
+                HashMap<String, String> map = new HashMap<>();
+                map.put("label", stateKeywords);
+                if (StringUtils.isNotBlank(stateKeywords)) {
+                    strings.add(map);
+                }
+            }
+            // 数据为空时 返回null
+            if ( (StringUtils.isBlank(rk) || StringUtils.isEmpty(rk)) &&
+                    (StringUtils.isBlank(r.getTrendsKeyword()) || StringUtils.isEmpty(r.getTrendsKeyword())) &&
+                    (StringUtils.isBlank(r.getStateKeyword()) || StringUtils.isEmpty(r.getStateKeyword()))) {
+                strings = null;
+            }
+
             if (StringUtils.isNotBlank(r.getConsult())) {
                 if (r.getConsult().contains(",")) {
                     String[] split = r.getConsult().split(",");
@@ -1969,6 +2393,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);
@@ -2082,8 +2507,8 @@ public class ClubServiceImpl implements ClubService {
     }
 
     @Override
-    public ResponseJson getCmRemarksList(String remarks) {
-        List<CmRemarksVo> remarklist = clubMapper.getCmRemarksList(remarks);
+    public ResponseJson getCmRemarksList(String remarks, Integer type) {
+        List<String> remarklist = clubMapper.getCmRemarksList(remarks, type);
         return ResponseJson.success(remarklist);
     }
 
@@ -2161,6 +2586,92 @@ public class ClubServiceImpl implements ClubService {
         return ResponseJson.success(cmPortraitDto);
     }
 
+    /**
+     * 用户需求
+     * @param clubId
+     * @param dateType
+     * @param startTime
+     * @param endTime
+     * @return
+     */
+    @Override
+    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();
+        boolean expty = StringUtils.isEmpty(startTime) && StringUtils.isEmpty(endTime);
+        if (expty) {
+            endTime = dateFormat.format(time);
+            Date start = null;
+            // 日期参数为    日
+            if (0 == dateType) {
+                startTime = endTime;
+            }
+            if (1 == dateType) {
+                calendar.setTime(time);
+                calendar.add(Calendar.MONTH, -1);
+                start = calendar.getTime();
+                startTime = dateFormat.format(start);
+            }
+            if (2 == dateType) {
+                calendar.setTime(time);
+                calendar.add(Calendar.MONTH, -6);
+                start = calendar.getTime();
+                startTime = dateFormat.format(start);
+            }
+            if (3 == dateType) {
+                calendar.setTime(time);
+                calendar.add(Calendar.YEAR, -1);
+                start = calendar.getTime();
+                startTime = dateFormat.format(start);
+            }
+        }
+        // 用户需求
+        List<String> list = new ArrayList<>();
+        // 咨询记录
+        List<String> clubRemarksInfo = clubMapper.getClubRemarksInfo(clubId, startTime, endTime);
+        for (String remark : clubRemarksInfo) {
+            if (remark.contains(",")) {
+                String[] split = remark.split(",");
+                for (String s : split) {
+                    if (list.size() <= 10 && StringUtils.isNotBlank(s)) {
+                        list.add(s);
+                    }
+                }
+            } else {
+                if (list.size() <= 10 && StringUtils.isNotBlank(remark)) {
+                    list.add(remark);
+                }
+            }
+        }
+        // 访问记录
+        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
     public ResponseJson dataList(CmPortraitDto cmPortrait) {
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");

+ 87 - 14
src/main/java/com/caimei365/user/service/impl/RoosInformationServiceImpl.java

@@ -1,8 +1,12 @@
 package com.caimei365.user.service.impl;
 
 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;
@@ -13,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;
 
@@ -35,53 +41,120 @@ 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;
     }
 
+    /**
+     * 供应商弹框信息
+     *
+     * @param shopId
+     * @param productId
+     * @param infoId
+     * @param keyword
+     * @return
+     */
+    @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);
+    }
+
     /**
      * 插入填写咨询人基本信息
      *
      * @param roosInformationDto
      */
     @Override
-    public void insRoosInformation(RoosInformationDto roosInformationDto) {
+    public ResponseJson<String> insRoosInformation(RoosInformationDto roosInformationDto) {
         // 设置创建时间
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String format = simpleDateFormat.format(new Date());
         roosInformationDto.setCreateTime(format);
         roosInformationMapper.insRoosInformation(roosInformationDto);
+        return ResponseJson.success("咨询信息插入成功");
     }
 
     /**
-     * 查看访问者是否浏览过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"));
+    }
+}

+ 130 - 31
src/main/resources/mapper/ClubMapper.xml

@@ -4,9 +4,11 @@
     <insert id="insertRemarks" parameterType="com.caimei365.user.model.po.ClubRemarksPo" keyProperty="remarksId"
             useGeneratedKeys="true">
         insert into cm_club_remarks(clubId, serviceProviderId, remarks, addTime, questionMan, consultType, clubType,
-                                    pinceSensitve, satisfied, followup, extra, createServiceProviderId, productID, reportID)
+                                    pinceSensitve, satisfied, followup, extra, createServiceProviderId, productID, reportID,
+                                    communicationSituation, communicationMethods, customerSource, customerGender, customerAge, groupAddition, trendsKeyword, stateKeyword)
         values (#{clubId}, #{serviceProviderId}, #{remarks}, now(), #{questionMan}, #{consult}, #{clubType},
-                #{pinceSensitve}, #{satisfied}, #{followup}, #{extra}, #{serviceProviderId}, #{productID}, #{reportID})
+                #{pinceSensitve}, #{satisfied}, #{followup}, #{extra}, #{serviceProviderId}, #{productID}, #{reportID},
+                #{communicationSituation}, #{communicationMethods},#{customerSource},#{customerGender},#{customerAge},#{groupAddition},#{trendsKeyword}, #{stateKeyword} )
     </insert>
     <insert id="insertRemarksImage">
         insert into cm_club_remarks_file(remarksId, fileType, imageUrl)
@@ -16,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, createServiceProviderId,
+                                       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}, #{serviceProviderId},
+                #{communicationSituation}, #{communicationMethods},#{customerSource},#{customerGender},#{customerAge},#{groupAddition},#{trendsKeyword}, #{stateKeyword})
     </insert>
     <update id="updateClubNewDeal">
         update club
@@ -239,9 +243,11 @@
                addTime,
                status,
                lastCheckOrderDate,
-               newDeal                   as newDeal
-
-        from club
+               newDeal                   as newDeal,
+               (select userIdentity from user where userId = c.userId) as userIdentity,
+                (select activeState from cm_organ_value_system where stage = 0 and delType = 1 and userId = c.userId) as activeState,
+                (select customerValue from cm_organ_value_system where stage = 0 and delType = 1 and userId = c.userId) as customerValue
+        from club c
         where clubID = #{clubId}
     </select>
     <!--    <select id="getOrderCount" resultType="com.caimei365.user.model.vo.OrderCountVo">-->
@@ -299,17 +305,25 @@
     </update>
     <update id="updateRemarks">
         update cm_club_remarks
-        set remarks      = #{remarks},
-            questionMan  = #{questionMan},
-            consultType  = #{consult},
-            clubType=#{clubType},
-            pinceSensitve=#{pinceSensitve},
-            satisfied=#{satisfied},
-            followup=#{followup},
-            extra=#{extra},
-            productID=#{productID},
-            reportID=#{reportID}
-        where id = #{remarksId}
+        set remarks         = #{remarks},
+            questionMan     = #{questionMan},
+            consultType     = #{consult},
+            clubType        = #{clubType},
+            pinceSensitve   = #{pinceSensitve},
+            satisfied       = #{satisfied},
+            followup        = #{followup},
+            extra           = #{extra},
+            productID       = #{productID},
+            reportID        = #{reportID},
+            communicationSituation  = #{communicationSituation},
+            communicationMethods    = #{communicationMethods},
+            customerSource          = #{customerSource},
+            customerGender          = #{customerGender},
+            customerAge             = #{customerAge},
+            groupAddition           = #{groupAddition},
+            trendsKeyword   = #{trendsKeyword},
+            stateKeyword    = #{stateKeyword}
+            where id = #{remarksId}
     </update>
     <update id="updateQuestionMan">
         update cm_visitor_remarks
@@ -327,7 +341,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">
@@ -442,6 +464,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,
@@ -471,6 +501,35 @@
         where remarksId = #{remarksId}
           and fileType = 2
     </select>
+
+    <select id="getRemarksInfo" resultType="com.caimei365.user.model.po.ClubRemarksPo">
+        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.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
+        order by cpk.addTime desc
+    </select>
+
+    <select id="findKeywordExist" resultType="java.lang.Integer">
+        select id
+        from cm_user_search_frequency
+        where keyword = #{keyword}
+          and delstatus = 1
+    </select>
+
+    <insert id="insertLabel">
+        insert into cm_user_search_frequency(fromSearch, serviceProviderId, keyword, frequency, trueStatus, dynamicStatus, addTime)
+        values (4, #{serviceProviderId}, #{keyword}, 0, #{trueStatus}, #{dynamicStatus}, now())
+    </insert>
+
+
     <select id="getAfterSale" resultType="com.caimei365.user.model.vo.AfterSaleVo">
         SELECT id,
                organizeName,
@@ -532,6 +591,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,
@@ -607,6 +674,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
@@ -664,8 +733,8 @@
     <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.serviceProviderId,ccr.clubType,ccr.pinceSensitve,ccr.satisfied,ccr.followup,ccr.extra,
+        ccr.questionMan,IFNULL(ccr.consultType,'') as consult, ccr.createServiceProviderId as createServiceProviderId,
+        ccr.serviceProviderId,ccr.clubType,ccr.pinceSensitve,ccr.satisfied,ccr.followup,ccr.extra,ccr.trendsKeyword, ccr.stateKeyword,
         (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
         FROM cm_visitor_remarks ccr
@@ -763,6 +832,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
@@ -821,9 +892,9 @@
     <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,
+        followup,ccr.extra AS extra,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.serviceProviderId) AS
         recordName,cmc.status as status
@@ -879,10 +950,13 @@
                  LEFT JOIN serviceprovider s ON s.serviceProviderId = csr.leaderId
         WHERE s.serviceProviderID = #{serviceProviderId}
     </select>
-    <select id="getCmRemarksList" resultType="com.caimei365.user.model.vo.CmRemarksVo">
-        SELECT remarks
-        FROM cm_remarks csr
-        WHERE remarks like concat('%', #{remarks}, '%')
+
+    <select id="getCmRemarksList" resultType="java.util.Map">
+        SELECT keyword as label
+        FROM cm_user_search_frequency
+        WHERE keyword like concat('%', #{keyword}, '%')
+        and dynamicStatus = #{type}
+        and delStatus = 1
         order by addtime DESC
     </select>
 
@@ -1040,6 +1114,30 @@
           AND b.accessDate = #{accessDate}
         order by b.accessTime desc
     </select>
+
+    <select id="getClubRemarksInfo" resultType="java.lang.String">
+        SELECT remarks FROM cm_club_remarks
+        WHERE clubId = #{clubId}
+        <if test="startTime != null and startTime != ''">
+            and addTime <![CDATA[ >= ]]> #{startTime}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and addTime <![CDATA[ <= ]]> #{endTime}
+        </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,
@@ -1053,8 +1151,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>

+ 154 - 10
src/main/resources/mapper/RoosInformationMapper.xml

@@ -2,16 +2,127 @@
 <!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">
+        SELECT
+          csp.id,
+          csp.shopId,
+          csp.image,
+          csp.guidingOne,
+          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>
+         <if test="infoId != null">
+            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>
+            css.status = 0
+            <if test="shopId != null">
+                and csp.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>
 
     <insert id="insRoosInformation">
         INSERT INTO cm_roos_information
             (
              IP,
+             shopId,
              <if test="consultName != null and consultName != ''">
                  consultName,
              </if>
@@ -23,6 +134,7 @@
              )
         VALUES(
                #{ip},
+               #{shopId},
                <if test="consultName != null and consultName != ''">
                 #{consultName},
                </if>
@@ -34,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>