瀏覽代碼

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

# Conflicts:
#	src/main/resources/mapper/RegisterMapper.xml
zhijiezhao 1 年之前
父節點
當前提交
203493c225
共有 61 個文件被更改,包括 3331 次插入223 次删除
  1. 5 1
      pom.xml
  2. 14 5
      src/main/java/com/caimei365/user/components/WeChatService.java
  3. 10 0
      src/main/java/com/caimei365/user/controller/BaseApi.java
  4. 41 5
      src/main/java/com/caimei365/user/controller/ClubApi.java
  5. 23 1
      src/main/java/com/caimei365/user/controller/LoginApi.java
  6. 29 10
      src/main/java/com/caimei365/user/controller/RoosInformationApi.java
  7. 72 0
      src/main/java/com/caimei365/user/controller/SellerApi.java
  8. 6 3
      src/main/java/com/caimei365/user/controller/ShopApi.java
  9. 13 0
      src/main/java/com/caimei365/user/feign/ToolsFeign.java
  10. 1 1
      src/main/java/com/caimei365/user/mapper/ArticleMapper.java
  11. 1 0
      src/main/java/com/caimei365/user/mapper/BaseMapper.java
  12. 38 1
      src/main/java/com/caimei365/user/mapper/ClubMapper.java
  13. 5 0
      src/main/java/com/caimei365/user/mapper/LoginMapper.java
  14. 59 4
      src/main/java/com/caimei365/user/mapper/RoosInformationMapper.java
  15. 27 5
      src/main/java/com/caimei365/user/mapper/SellerMapper.java
  16. 5 3
      src/main/java/com/caimei365/user/mapper/ShopMapper.java
  17. 8 0
      src/main/java/com/caimei365/user/model/dto/ClubRegisterDto.java
  18. 4 0
      src/main/java/com/caimei365/user/model/dto/RoosInformationDto.java
  19. 4 0
      src/main/java/com/caimei365/user/model/po/ClubPo.java
  20. 32 0
      src/main/java/com/caimei365/user/model/po/ClubRemarksPo.java
  21. 24 0
      src/main/java/com/caimei365/user/model/po/ServiceProviderPo.java
  22. 6 0
      src/main/java/com/caimei365/user/model/vo/ArticleTypeVo.java
  23. 42 0
      src/main/java/com/caimei365/user/model/vo/ClubVo.java
  24. 96 0
      src/main/java/com/caimei365/user/model/vo/CmBehaviorRecordVo.java
  25. 34 0
      src/main/java/com/caimei365/user/model/vo/CmShopPopUpVo.java
  26. 27 1
      src/main/java/com/caimei365/user/model/vo/MessageCenter.java
  27. 33 0
      src/main/java/com/caimei365/user/model/vo/RemarkVo.java
  28. 35 0
      src/main/java/com/caimei365/user/model/vo/RemarksVo.java
  29. 6 1
      src/main/java/com/caimei365/user/model/vo/ShopArticleVo.java
  30. 3 0
      src/main/java/com/caimei365/user/model/vo/UserLoginVo.java
  31. 38 0
      src/main/java/com/caimei365/user/model/vo/VisitRemarkVo.java
  32. 36 1
      src/main/java/com/caimei365/user/model/vo/VisitorRemarkVo.java
  33. 59 0
      src/main/java/com/caimei365/user/model/vo/cmShopAdvertisingImage.java
  34. 4 0
      src/main/java/com/caimei365/user/service/BaseService.java
  35. 15 1
      src/main/java/com/caimei365/user/service/ClubService.java
  36. 3 0
      src/main/java/com/caimei365/user/service/LoginService.java
  37. 18 4
      src/main/java/com/caimei365/user/service/RoosInformationService.java
  38. 37 4
      src/main/java/com/caimei365/user/service/SellerService.java
  39. 1 1
      src/main/java/com/caimei365/user/service/ShopService.java
  40. 5 0
      src/main/java/com/caimei365/user/service/impl/BaseServiceImpl.java
  41. 544 33
      src/main/java/com/caimei365/user/service/impl/ClubServiceImpl.java
  42. 50 0
      src/main/java/com/caimei365/user/service/impl/LoginServiceImpl.java
  43. 52 3
      src/main/java/com/caimei365/user/service/impl/RegisterServiceImpl.java
  44. 87 14
      src/main/java/com/caimei365/user/service/impl/RoosInformationServiceImpl.java
  45. 126 7
      src/main/java/com/caimei365/user/service/impl/SellerServiceImpl.java
  46. 23 12
      src/main/java/com/caimei365/user/service/impl/ShopServiceImpl.java
  47. 305 0
      src/main/java/com/caimei365/user/utils/AppletsLinkUtil.java
  48. 92 2
      src/main/java/com/caimei365/user/utils/RequestUtil.java
  49. 377 0
      src/main/java/com/caimei365/user/utils/message/InsideMessage.java
  50. 43 0
      src/main/java/com/caimei365/user/utils/message/MessageModel.java
  51. 41 0
      src/main/java/com/caimei365/user/utils/message/MessageType.java
  52. 65 0
      src/main/java/com/caimei365/user/utils/message/MqInfo.java
  53. 6 3
      src/main/resources/mapper/ArticleMapper.xml
  54. 13 0
      src/main/resources/mapper/BaseMapper.xml
  55. 159 44
      src/main/resources/mapper/ClubMapper.xml
  56. 6 0
      src/main/resources/mapper/LoginMapper.xml
  57. 33 18
      src/main/resources/mapper/MessageCenter.xml
  58. 154 10
      src/main/resources/mapper/RoosInformationMapper.xml
  59. 208 22
      src/main/resources/mapper/SellerMapper.xml
  60. 5 3
      src/main/resources/mapper/ShopMapper.xml
  61. 23 0
      src/test/java/com/caimei365/user/UserApplicationTests.java

+ 5 - 1
pom.xml

@@ -154,7 +154,11 @@
             <version>3.0.0</version>
         </dependency>
 
-
+        <dependency>
+            <groupId>com.github.tobato</groupId>
+            <artifactId>fastdfs-client</artifactId>
+            <version>1.27.2</version>
+        </dependency>
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-test</artifactId>

+ 14 - 5
src/main/java/com/caimei365/user/components/WeChatService.java

@@ -4,6 +4,7 @@ import cn.hutool.http.HttpRequest;
 import cn.hutool.http.HttpUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.caimei365.user.feign.ToolsFeign;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.utils.RequestUtil;
 import lombok.extern.slf4j.Slf4j;
@@ -13,19 +14,21 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpHeaders;
 import org.springframework.stereotype.Component;
+import org.springframework.web.multipart.MultipartFile;
 
+import javax.annotation.Resource;
 import javax.crypto.Cipher;
 import javax.crypto.spec.IvParameterSpec;
 import javax.crypto.spec.SecretKeySpec;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.net.URLDecoder;
 import java.security.AlgorithmParameters;
 import java.security.Security;
 import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 微信 服务工具类
@@ -59,6 +62,12 @@ public class WeChatService {
     private String mcareAppId;
     @Value("${wx.mcare-app-secret}")
     private String mcareAppSecret;
+    @Value("${spring.cloud.config.profile}")
+    private String active;
+    @Value("${caimei.imageDomain}")
+    private String imageDomain;
+    @Resource
+    private ToolsFeign toolsFeign;
 
     public void setRedirectUri(String redirectUri) {
         redirectUri = redirectUri;
@@ -288,6 +297,7 @@ public class WeChatService {
         link = link.replace("APPID", crmAppId);
         link = link.replace("APPSECRET", crmAppSecret);
         String result = RequestUtil.sendGet(link);
+        log.info("微信公众号获取access_token>>>" + link);
         log.info("微信公众号获取access_token>>>" + result);
         Map<String, Object> map = JSONObject.parseObject(result, Map.class);
         return (String) map.get("access_token");
@@ -638,5 +648,4 @@ public class WeChatService {
         return ResponseJson.success(result);
     }
 
-
 }

+ 10 - 0
src/main/java/com/caimei365/user/controller/BaseApi.java

@@ -1,5 +1,6 @@
 package com.caimei365.user.controller;
 
+import com.alibaba.fastjson.JSONObject;
 import com.aliyuncs.exceptions.ClientException;
 import com.caimei365.user.components.WeChatService;
 import com.caimei365.user.idempotent.IpSave;
@@ -10,8 +11,10 @@ import com.caimei365.user.model.po.SysDict;
 import com.caimei365.user.model.vo.SysDictVO;
 import com.caimei365.user.service.BaseService;
 import com.caimei365.user.service.SysDictService;
+import com.caimei365.user.utils.RequestUtil;
 import io.swagger.annotations.*;
 import lombok.RequiredArgsConstructor;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
@@ -251,6 +254,7 @@ public class BaseApi {
     public ResponseJson getWechatLink(String path, String query, String env) {
         return weChatService.getOpenLink(path, query, env);
     }
+
     @ApiOperation("获取Dict")
     @GetMapping("/getDict")
     public ResponseJson getDict(String type) {
@@ -259,4 +263,10 @@ public class BaseApi {
         }
         return ResponseJson.success(sysDictService.getSysDictList(new SysDict().setType(type)));
     }
+
+    @ApiOperation("获取userId")
+    @GetMapping("/getFindUserId")
+    public ResponseJson getFindUserId(Integer userType, Integer id) {
+        return ResponseJson.success(baseService.getByUserId(userType, id));
+    }
 }

+ 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

+ 23 - 1
src/main/java/com/caimei365/user/controller/LoginApi.java

@@ -182,6 +182,11 @@ public class LoginApi {
         return loginService.shopMessageCount(messageType, commonId);
     }
 
+    @ApiOperation("协销站内消息未读消息记录数")
+    @GetMapping("/auth/SpCount")
+    public ResponseJson<Map<String, Object>> SpCount(Integer messageType, Integer commonId) {
+        return loginService.SpCount(messageType, commonId);
+    }
     @ApiOperation("供应商站内消息未读消息总记录数")
     @GetMapping("/auth/ShopCount")
     public ResponseJson<Map<String, Object>> ShopCount(Integer messageType, Integer commonId) {
@@ -195,7 +200,15 @@ public class LoginApi {
 
         return loginService.ClubCount(messageType, commonId);
     }
-
+    @ApiOperation("协销站内消息列表")
+    @GetMapping("/auth/SpMessageList")
+    public ResponseJson<PageInfo<MessageCenter>> SpMessageList(Integer commonId,
+                                                               Integer messageType,
+                                                               Integer source,
+                                                               @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                               @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+        return loginService.SpMessageList(commonId, messageType, source, pageNum, pageSize);
+    }
 
     @ApiOperation("机构站内消息列表")
     @GetMapping("/auth/ClubMessageList")
@@ -239,6 +252,15 @@ public class LoginApi {
         }
         return ResponseJson.success("标记已读成功", null);
     }
+    @ApiOperation("协销站内消息改为已读")
+    @GetMapping("/auth/updateSpMessageAsRead")
+    public ResponseJson<Void> updateSpMessageAsRead(Integer messageType, Integer commonId) {
+        Integer i = loginService.updateSpMessageAsRead(messageType, commonId);
+        if (i <= 0) {
+            return ResponseJson.error("没有未读消息了!", null);
+        }
+        return ResponseJson.success("标记已读成功", null);
+    }
 
     @ApiOperation("删除站内消息")
     @PostMapping("/auth/deleteMessage")

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

+ 72 - 0
src/main/java/com/caimei365/user/controller/SellerApi.java

@@ -6,8 +6,10 @@ import com.caimei365.user.model.dto.OnlineDto;
 import com.caimei365.user.model.po.ServiceProviderPo;
 import com.caimei365.user.model.vo.ClubTemporaryVo;
 import com.caimei365.user.model.vo.ClubVo;
+import com.caimei365.user.model.vo.CmBehaviorRecordVo;
 import com.caimei365.user.model.vo.ServiceProviderVo;
 import com.caimei365.user.service.SellerService;
+import com.caimei365.user.utils.MathUtil;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -17,6 +19,9 @@ import lombok.RequiredArgsConstructor;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.web.bind.annotation.*;
 
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -106,6 +111,46 @@ public class SellerApi {
         return sellerService.getClubList(spId, status, type, name, userIdentity, groupServiceId, pageNum, pageSize);
     }
 
+    /**
+     * 机构活跃分析
+     */
+    @ApiOperation("机构活跃分析比例")
+    @GetMapping("/club/livelyClub")
+    public ResponseJson<Map<String, Object>> getLivelyClub(Integer spId) {
+        if (null == spId ) {
+            return ResponseJson.error("spId  参数不全!", null);
+        }
+        return sellerService.getLivelyClub(spId);
+    }
+
+    /**
+     * 机构活跃分析
+     * 原spi的 /seller/club/list
+     *
+     * @param spId           协销Id
+     * @param status         机构状态
+     * @param type           1.我的机构2.组员机构3.待分配机构
+     * @param name           机构名字关键字(搜索用)
+     */
+    @ApiOperation("机构活跃分析列表")
+    @GetMapping("/club/livelyClubList")
+    public ResponseJson<Map<String, Object>> getLivelyClubList(Integer spId,
+                                                                         Integer status,
+                                                                         Integer type,
+                                                                         String name,
+                                                                         Integer userIdentity,
+                                                                         @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                                         @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+        if (null == spId || null == status || null == type) {
+            return ResponseJson.error("spId 或 status 或 type 参数不全!", null);
+        }
+        if (4 != type && 5 != type ) {
+            return ResponseJson.error("type 参数错误!", null);
+        }
+
+        return sellerService.getLivelyClubList(spId, status, type, name, userIdentity, pageNum, pageSize);
+    }
+
     @ApiOperation("组员筛选侧边栏")
     @GetMapping("/service/team")
     public ResponseJson<List<ServiceProviderVo>> getClubList(Integer spId) {
@@ -142,4 +187,31 @@ public class SellerApi {
         return sellerService.getSellerHome(userId);
     }
 
+    /**
+     * 更新协销信息
+     */
+    @GetMapping("/setHome")
+    public ResponseJson<ServiceProviderPo> setSellerHome(ServiceProviderPo serviceProviderPo) {
+        return sellerService.setSellerHome(new ServiceProviderPo()
+                .setUserId(serviceProviderPo.getUserId())
+                .setImage(serviceProviderPo.getImage())
+                .setQrCode(serviceProviderPo.getQrCode()));
+
+    }
+    /**
+     * 机构访问列表
+     */
+    @GetMapping("/getBehaviorRecordClub")
+    public ResponseJson<List<CmBehaviorRecordVo>> getBehaviorRecordClub(Integer spId, String accDateTime) {
+        return sellerService.getBehaviorRecordClub( spId, accDateTime);
+
+    }
+    /**
+     * 机构访问详情
+     */
+    @GetMapping("/getBehaviorRecordClubFrom")
+    public ResponseJson<List<CmBehaviorRecordVo>> getBehaviorRecordClubFrom(Integer spId,Integer clubId,String accessTime) {
+        return sellerService.getBehaviorRecordClubFrom(spId,clubId, accessTime);
+    }
+
 }

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

@@ -163,13 +163,16 @@ public class ShopApi {
      * @param userId 用户Id
      */
     @ApiOperation("供应商个人中心数据(旧:/supplier/homePageData)")
-    @ApiImplicitParam(required = true, name = "userId", value = "用户Id")
+    @ApiImplicitParams({
+            @ApiImplicitParam(required = true, name = "userId", value = "用户Id"),
+            @ApiImplicitParam(required = true, name = "productOrganize", value = "商品上架平台")
+    })
     @GetMapping("/personal/data")
-    public ResponseJson<Map<String, Object>> getShopPersonalData(Integer userId) {
+    public ResponseJson<Map<String, Object>> getShopPersonalData(Integer userId, Integer productOrganize) {
         if (null == userId) {
             return ResponseJson.error("参数异常:用户Id不能为空!", null);
         }
-        return shopService.getShopPersonalData(userId);
+        return shopService.getShopPersonalData(userId, productOrganize);
     }
 
     @ApiOperation("供应商文章表单")

+ 13 - 0
src/main/java/com/caimei365/user/feign/ToolsFeign.java

@@ -1,8 +1,14 @@
 package com.caimei365.user.feign;
 
+import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.utils.message.MessageModel;
 import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.http.HttpHeaders;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
 import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.multipart.MultipartFile;
 
 /**
  * Description
@@ -28,4 +34,11 @@ public interface ToolsFeign {
     @PostMapping("/tools/mq/send")
     String sendCommonMessage(@RequestParam String topic, @RequestParam String content, @RequestParam String tag, @RequestParam Integer sort, @RequestParam Integer async, @RequestParam Integer oneway, @RequestParam Integer delay);
 
+    /**
+     * 请求发消息
+     */
+    @PostMapping("/tools/message/send")
+    ResponseJson sendCommonMessage(@RequestBody MessageModel messageModel);
+
+
 }

+ 1 - 1
src/main/java/com/caimei365/user/mapper/ArticleMapper.java

@@ -32,7 +32,7 @@ public interface ArticleMapper {
     /**
      * 查询文章分类列表
      */
-    List<ArticleTypeVo> getArticleTypeList();
+    List<ArticleTypeVo> getArticleTypeList(String parentId);
     /**
      * 根据文章标签查询标签id
      */

+ 1 - 0
src/main/java/com/caimei365/user/mapper/BaseMapper.java

@@ -175,4 +175,5 @@ public interface BaseMapper {
     List<String> findLabelsByLableIds(String labelIds);
 
     Integer findBankByUserId(Integer userId);
+    Integer getByUserId(@Param("userType")Integer userType,@Param("id")Integer id);
 }

+ 38 - 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
@@ -225,6 +226,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);
+
     /**
      * 删除资料备注
      *
@@ -315,7 +344,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);
 
@@ -357,6 +386,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);
@@ -370,4 +403,8 @@ public interface ClubMapper {
     String selSpLinkMan(Integer choseServiceId);
 
     void inProvider(@Param("spId") Integer spId, @Param("clubId") Integer clubId, @Param("operator") String operator, @Param("isOneself") Integer isOneself );
+
+    Integer getSpIdRAND();
+
+    Integer getSpUserId(@Param("spId") Integer spId);
 }

+ 5 - 0
src/main/java/com/caimei365/user/mapper/LoginMapper.java

@@ -176,4 +176,9 @@ public interface LoginMapper {
      */
     Integer getClubTypeById(Integer userId);
 
+    /**
+     * 会员机构类型:1医美,2生
+     */
+    Integer getClubSpUserId(Integer clubId);
+
 }

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

+ 27 - 5
src/main/java/com/caimei365/user/mapper/SellerMapper.java

@@ -2,14 +2,12 @@ package com.caimei365.user.mapper;
 
 import com.caimei365.user.model.dto.ClubTemporaryDto;
 import com.caimei365.user.model.po.ServiceProviderPo;
-import com.caimei365.user.model.vo.ClubTemporaryVo;
-import com.caimei365.user.model.vo.ClubVo;
-import com.caimei365.user.model.vo.ServiceProviderVo;
-import com.caimei365.user.model.vo.UserLoginVo;
+import com.caimei365.user.model.vo.*;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * Description
@@ -36,6 +34,15 @@ public interface SellerMapper {
      */
     void updateServiceProviderByUserId(Integer userId, String openId, String unionId);
 
+    /**
+     * 更新协销信息
+     */
+    Integer setSellerHome(ServiceProviderPo serviceProviderPo);
+    /**
+     * 更新协销头像
+     */
+    Integer setSellerUserHome(@Param("userId")Integer userId, @Param("image")String image);
+
     /**
      * 查询待注册机构数据
      *
@@ -59,7 +66,16 @@ public interface SellerMapper {
      */
     void deleteTemporaryClub(Integer id);
 
-    List<ClubVo> findClubs(@Param("serviceProviderId") Integer serviceProviderId, @Param("status") Integer status, @Param("name") String name, @Param("userIdentity") Integer userIdentity,@Param("type") Integer type,@Param("serviceIds") List<Integer> serviceIds);
+    List<ClubVo> findClubs(@Param("serviceProviderId") Integer serviceProviderId, @Param("status") Integer status, @Param("name") String name, @Param("userIdentity") Integer userIdentity, @Param("type") Integer type, @Param("serviceIds") List<Integer> serviceIds);
+
+    /***
+     * 功能描述: 机构活跃分析用户登录数量
+     * @auther: Kaick
+     * @date: 2023/8/30 15:25
+     * @param spID
+     * @return [spID]
+     */
+    Map<String, Object> findSpUserLoginSum(@Param("spID") String spID);
 
     Integer findOrderNum(ClubVo club);
 
@@ -90,4 +106,10 @@ public interface SellerMapper {
     List<ServiceProviderVo> findServices(@Param("spId")Integer spId,@Param("status")Integer status);
 
     List<ServiceProviderVo> findAllServices(@Param("spId")Integer spId,@Param("status")Integer status);
+
+    String getBehaviorRecordYesterdayPageLabel(@Param("spId") Integer spId,@Param("clubId") Integer clubId,@Param("accessTime")String accessTime);
+
+    List<CmBehaviorRecordVo> getBehaviorRecordYesterdayClubFrom(@Param("spId") Integer spId, @Param("clubId") Integer clubId, @Param("accessTime")String accessTime);
+
+    List<CmBehaviorRecordVo> getBehaviorRecordYesterdayClub(@Param("spId") Integer spId,@Param("accessTime")String accessTime);
 }

+ 5 - 3
src/main/java/com/caimei365/user/mapper/ShopMapper.java

@@ -7,6 +7,7 @@ import com.caimei365.user.model.po.UserPo;
 import com.caimei365.user.model.vo.*;
 import org.apache.ibatis.annotations.MapKey;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
@@ -89,14 +90,15 @@ public interface ShopMapper {
      * 统计商品数量
      *
      * @param shopId    供应商id
+     * @param productOrganize    上架平台
      * @param validFlag 商品状态
      */
-    Integer getShopProductCount(Integer shopId, Integer validFlag);
+    Integer getShopProductCount(@Param("shopId") Integer shopId, @Param("productOrganize") Integer productOrganize, @Param("validFlag") Integer validFlag);
     /**
      * 统计前五的商品销售信息
      */
     @MapKey("productId")
-    List<Map<String, Object>> getSalesRankingList(Integer shopId);
+    List<Map<String, Object>> getSalesRankingList(@Param("shopId") Integer shopId, @Param("organizeId") Integer organizeId);
     /**
      * 获取商品信息
      */
@@ -105,7 +107,7 @@ public interface ShopMapper {
      * 销售统计
      */
     @MapKey("orderQuantity")
-    Map<String, Object> getSalesStatistics(Integer shopId, String startTime, String endTime);
+    Map<String, Object> getSalesStatistics(Integer shopId, Integer organizeId, String startTime, String endTime);
     /**
      * 轮播图片数量
      */

+ 8 - 0
src/main/java/com/caimei365/user/model/dto/ClubRegisterDto.java

@@ -61,6 +61,13 @@ public class ClubRegisterDto implements Serializable {
     @NotNull
     @ApiModelProperty("是否同意勾选同意协议,1是,其他否")
     private Integer isAgreed;
+
+    @NotNull
+    @ApiModelProperty("是否接受匹配客户经理,1是,其他否")
+    private Integer isSp;
+
+    @ApiModelProperty("协销ID")
+    private Integer spId;
     /**
      * 微信unionId
      */
@@ -76,4 +83,5 @@ public class ClubRegisterDto implements Serializable {
      */
     @ApiModelProperty("微信头像(headimgurl)")
     private String avatarUrl;
+
 }

+ 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;
     /**
      * 咨询姓名
      */

+ 4 - 0
src/main/java/com/caimei365/user/model/po/ClubPo.java

@@ -121,5 +121,9 @@ public class ClubPo implements Serializable {
      * 状态:90:已上线,91:已冻结,92:审查资料未通过,待补充资料,1:待审查资料,2:电话预约,3:已预约,20:待确认,21:待拜访,30:待员工推荐,40:已完成第一次采购
      */
     private Integer status;
+    /**
+     * 新分配机构状态 0.否,1.是
+     */
+    private Integer newDeal;
 }
 

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

+ 24 - 0
src/main/java/com/caimei365/user/model/po/ServiceProviderPo.java

@@ -1,8 +1,20 @@
 package com.caimei365.user.model.po;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.aliyuncs.http.HttpRequest;
+import com.caimei365.user.utils.RequestUtil;
+import com.caimei365.user.utils.message.InsideMessage;
+import com.caimei365.user.utils.message.MessageModel;
+import com.caimei365.user.utils.message.MessageType;
+import com.caimei365.user.utils.message.MqInfo;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import lombok.Data;
+import lombok.experimental.Accessors;
 
 import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * 协销
@@ -10,6 +22,7 @@ import java.io.Serializable;
  * @author : Aslee
  * @date : 2021/3/18
  */
+@Accessors(chain  = true )
 @Data
 public class ServiceProviderPo implements Serializable {
     private static final long serialVersionUID = 1L;
@@ -72,6 +85,16 @@ public class ServiceProviderPo implements Serializable {
      */
     private String validFlag;
 
+    /**
+     * 头像
+     */
+    private String image;
+
+    /**
+     * 协销二维码
+     */
+    private String qrCode;
+
     /**
      * 创建时间
      */
@@ -80,4 +103,5 @@ public class ServiceProviderPo implements Serializable {
      * 创客经理Id
      */
     private Integer mainServiceProviderId;
+
 }

+ 6 - 0
src/main/java/com/caimei365/user/model/vo/ArticleTypeVo.java

@@ -3,6 +3,7 @@ package com.caimei365.user.model.vo;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * Description
@@ -22,5 +23,10 @@ public class ArticleTypeVo implements Serializable {
      */
     private String typeName;
 
+    /**
+     * 子级文章分类
+     */
+    private List<ArticleTypeVo> articleTypes;
+
     private static final long serialVersionUID = 1L;
 }

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

@@ -200,4 +200,46 @@ public class ClubVo implements Serializable {
      */
     private String ipAddress;
 
+    /***
+     * 分配时间:
+     */
+    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;
+
 }

+ 96 - 0
src/main/java/com/caimei365/user/model/vo/CmBehaviorRecordVo.java

@@ -0,0 +1,96 @@
+package com.caimei365.user.model.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 用户行为记录对象 cm_behavior_record
+ *
+ * @author Kaick
+ * @date 2023-09-06
+ */
+@Accessors(chain  = true )
+@Data
+@Alias("CmBehaviorRecordVo")
+public class CmBehaviorRecordVo implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private String recordID;
+
+    /** 访问人IP地址 */
+    private String IP;
+
+    /** 用户id、0为游客 */
+    private Integer userID;
+
+    /** 页面路径 */
+    private String pagePath;
+
+    /** 页面类型 */
+    private String pageType;
+
+    /** 页面标签 */
+    private String pageLabel;
+
+    /** 用户行为类型1:用户行为记录、2:ROOS页面统计 */
+    private String behaviorType;
+
+    /** 商品ID */
+    private Integer productID;
+
+    /** 访问时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date accessTime;
+
+    /** 访问时长 */
+    private String accessDuration;
+
+    /** 访问日期 */
+    private String accessDate;
+
+    /** 浏览器链接 */
+    private String referer;
+
+    /** 0直接访问 1百度搜索 2360搜索 3谷歌搜索 4神马搜索 5头条搜索 6搜狗搜索 7小程序 */
+    private String accessSource;
+
+    /** 访问客户端  0:网站 1:小程序 */
+    private String accessClient;
+
+    /** 是否计算访问时长 0未计算 1已计算 */
+    private String isReckon;
+
+    /** ip所属地 */
+    private String region;
+
+    /** 请求头 userAgent */
+    private String userAgent;
+
+    /** 图片 */
+    private String image;
+
+    /** 标题Id */
+    private Integer titleId;
+    /** 标题 */
+    private String title;
+    /** 标题图片 */
+    private String titleImage;
+    /** 内容 */
+    private String content;
+    /** 机构Id */
+    private Integer clubId;
+    /** 名称 */
+    private String name;
+    /** 联系人 */
+    private String linkMan;
+    /** 手机号 */
+    private String contractMobile;
+
+}

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

+ 27 - 1
src/main/java/com/caimei365/user/model/vo/MessageCenter.java

@@ -70,7 +70,7 @@ public class MessageCenter implements Serializable {
      */
     private Integer shopMessType;
     /**
-     * 供应商服务消息类型 1.上架费
+     * 服务消息类型 1.上架费,2.机构重新分配通知,3.机构转移分配通知,4.机构分配通知,5.客户经理分配通知,6.客户经理重新分配通知,7.机构访问通知,8机构回收通知
      */
     private Integer shopTieredType;
     /**
@@ -111,4 +111,30 @@ public class MessageCenter implements Serializable {
      * 失败原因
      */
     private String reasonContent;
+
+
+    /** 手机号 */
+    private String mobile;
+
+    /** 名称 */
+    private String name;
+
+    /**
+     * 用户名称
+     */
+    private String userName;
+
+    /**
+     * 前用户名称
+     */
+    private String superUserName;
+
+    /**
+     * 当前id
+     */
+    private Integer thisId;
+    /**
+     * 数量
+     */
+    private Integer sum;
 }

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

+ 6 - 1
src/main/java/com/caimei365/user/model/vo/ShopArticleVo.java

@@ -71,6 +71,11 @@ public class ShopArticleVo {
 	 */
 	private String typeName;
 
+	/**
+	 * 父级文章分类Id
+	 */
+	private String parentId;
+
 	/**
 	 * 引导图
 	 */
@@ -115,4 +120,4 @@ public class ShopArticleVo {
 	 * 添加时间
 	 */
 	private Date createDate;
-}
+}

+ 3 - 0
src/main/java/com/caimei365/user/model/vo/UserLoginVo.java

@@ -19,6 +19,9 @@ public class UserLoginVo implements Serializable {
      */
     @ApiModelProperty("用户Id")
     private Integer userId;
+
+    @ApiModelProperty("协销用户Id")
+    private Integer spUserId;
     /**
      * 组织Id
      */

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

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

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

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

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

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

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

@@ -4,6 +4,7 @@ import com.aliyuncs.exceptions.ClientException;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.MobileDto;
 import com.caimei365.user.model.dto.PasswordDto;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -130,4 +131,7 @@ public interface BaseService {
     ResponseJson findPackage();
 
     ResponseJson<HashMap<String, String>> ossTokenGet() throws ClientException;
+
+    ResponseJson<Integer>  getByUserId(Integer userType, Integer userId);
+
 }

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

+ 3 - 0
src/main/java/com/caimei365/user/service/LoginService.java

@@ -86,6 +86,7 @@ public interface LoginService {
      */
     ResponseJson<UserLoginVo> appletsOrganizeAuthorization(String code, String encryptedData, String iv, HttpHeaders headers) throws ParseException;
 
+    ResponseJson<PageInfo<MessageCenter>> SpMessageList(Integer commonId,Integer messageType,Integer source, int pageNum, int pageSize);
     ResponseJson<PageInfo<MessageCenter>> ClubMessageList(Integer commonId,Integer messageType,Integer source, int pageNum, int pageSize);
 
     ResponseJson<PageInfo<MessageCenter>> shopMessageList(Integer commonId,Integer messageType,Integer source, int pageNum, int pageSize);
@@ -94,6 +95,7 @@ public interface LoginService {
 
     ResponseJson<Map<String, Object>> shopMessageCount(Integer messageType,Integer commonId);
 
+    ResponseJson<Map<String, Object>> SpCount(Integer messageType,Integer commonId);
     ResponseJson<Map<String, Object>> ShopCount(Integer messageType,Integer commonId);
 
     ResponseJson<Map<String, Object>> ClubCount(Integer messageType,Integer commonId);
@@ -101,6 +103,7 @@ public interface LoginService {
      Integer updateMessageAsRead(Integer messageType,Integer commonId);
 
     Integer updateShopMessageAsRead(Integer messageType,Integer commonId);
+    Integer updateSpMessageAsRead(Integer messageType,Integer commonId);
 
      Integer updateRead(Integer userType,String Id);
 

+ 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

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

@@ -4,13 +4,11 @@ import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.ClubTemporaryDto;
 import com.caimei365.user.model.dto.LoginCodeDto;
 import com.caimei365.user.model.po.ServiceProviderPo;
-import com.caimei365.user.model.vo.ClubTemporaryVo;
-import com.caimei365.user.model.vo.ClubVo;
-import com.caimei365.user.model.vo.ServiceProviderVo;
-import com.caimei365.user.model.vo.UserLoginVo;
+import com.caimei365.user.model.vo.*;
 import com.github.pagehelper.PageInfo;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * Description
@@ -29,7 +27,30 @@ public interface SellerService {
      * @return
      */
     ResponseJson<PageInfo<ClubVo>> getClubList(Integer serviceProviderId, Integer status, Integer type, String name, Integer userIdentity, Integer groupServiceId, Integer pageNum, Integer pageSize);
+/**
+ * 功能描述: 机构活跃分析
+ * @auther: Kaick
+ * @date: 2023/8/30 16:54
+ * @param serviceProviderId
+ * @param status
+ * @param type
+ * @param name
+ * @param userIdentity
+ * @param pageNum
+ * @param pageSize
+ * @return [serviceProviderId, status, type, name, userIdentity, pageNum, pageSize]
+ */
+
+    ResponseJson<Map<String, Object>> getLivelyClubList(Integer serviceProviderId, Integer status, Integer type, String name, Integer userIdentity, Integer pageNum, Integer pageSize);
+    /**
+     * 功能描述: 机构活跃分析比例
+     * @auther: Kaick
+     * @date: 2023/9/4 9:48
+     * @param
+     * @return []
+     */
 
+    ResponseJson<Map<String, Object>> getLivelyClub(Integer serviceProviderId);
     /**
      * 协销登录(手机号,密码)
      *
@@ -86,6 +107,18 @@ public interface SellerService {
      * @param userId 协销用户id
      */
     ResponseJson<ServiceProviderPo> getSellerHome(Integer userId);
+    /**
+     * 功能描述: 更新协销信息
+     * @auther: Kaick
+     * @date: 2023/9/4 10:02
+     * @param serviceProviderPo
+     * @return [serviceProviderPo]
+     */
+
+    ResponseJson setSellerHome(ServiceProviderPo serviceProviderPo);
+
+    ResponseJson<List<CmBehaviorRecordVo>> getBehaviorRecordClub(Integer spId,String accessTime);
+    ResponseJson<List<CmBehaviorRecordVo>> getBehaviorRecordClubFrom(Integer spId, Integer clubId, String accessTime);
 
     ResponseJson<List<ServiceProviderVo>> getServiceTeam(Integer spId,Integer status);
 }

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

@@ -84,7 +84,7 @@ public interface ShopService {
      * 供应商个人中心数据
      * @param userId 用户Id
      */
-    ResponseJson<Map<String, Object>> getShopPersonalData(Integer userId);
+    ResponseJson<Map<String, Object>> getShopPersonalData(Integer userId, Integer productOrganize);
 
     /**
      * 供应商-更新轮播图片

+ 5 - 0
src/main/java/com/caimei365/user/service/impl/BaseServiceImpl.java

@@ -800,4 +800,9 @@ public class BaseServiceImpl implements BaseService {
         }
         return superVipDto;
     }
+
+    @Override
+    public ResponseJson<Integer> getByUserId(Integer userType, Integer id) {
+        return ResponseJson.success(baseMapper.getByUserId(userType, id));
+    }
 }

+ 544 - 33
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");
@@ -2233,24 +2744,24 @@ public class ClubServiceImpl implements ClubService {
                     // 普通订单
                     if (("0".equals(order.getSecondHandOrderFlag()) || StringUtils.isEmpty(order.getSecondHandOrderFlag()))
                             && (!"1".equals(order.getRebateFlag()) || "".equals(order.getRebateFlag()) || StringUtils.isEmpty(order.getRebateFlag()))
-                            && ((!"1".equals(order.getRefundType()) && !"2".equals(order.getRefundType())) || "".equals(order.getRefundType()) || StringUtils.isEmpty(order.getRefundType()))
-                            && !"6".equals(order.getStatus())) {
+                            && (!"2".equals(order.getRefundType()) || "".equals(order.getRefundType()) || StringUtils.isEmpty(order.getRefundType()))
+                            && !"4".equals(order.getStatus())) {
                         ordinary++;
                     }
                     // 二手订单
                     if ("1".equals(order.getSecondHandOrderFlag()) && !"1".equals(order.getRebateFlag())
-                            && (!"1".equals(order.getRefundType()) && !"2".equals(order.getRefundType())) && !"6".equals(order.getStatus())) {
+                            && (!"2".equals(order.getRefundType())) && !"4".equals(order.getStatus())) {
                         secondHand++;
                     }
                     // 返佣订单
-                    if ("1".equals(order.getRebateFlag()) &&
-                            (!"1".equals(order.getRefundType()) && !"2".equals(order.getRefundType()) || StringUtils.isEmpty(order.getRefundType())) && !"6".equals(order.getStatus())) {
+                    /*if ("1".equals(order.getRebateFlag()) &&
+                            (!"2".equals(order.getRefundType()) || StringUtils.isEmpty(order.getRefundType())) && !"4".equals(order.getStatus())) {
                         rebate++;
-                    }
+                    }*/
                     // 部分退款
-                    if ("1".equals(order.getRefundType()) && !"6".equals(order.getStatus())) {
+                    /*if ("1".equals(order.getRefundType()) && !"4".equals(order.getStatus())) {
                         partialRefund++;
-                    }
+                    }*/
                     // 全部退款
                     /*if ("2".equals(order.getRefundType()) && !"6".equals(order.getStatus())) {
                         fullRefund++;
@@ -2287,7 +2798,7 @@ public class ClubServiceImpl implements ClubService {
                     orderPortrait.setPer("0");
                 }
                 orderPortraits.add(orderPortrait);
-                orderPortrait = new PortraitMap();
+                /*orderPortrait = new PortraitMap();
                 orderPortrait.setValue(rebate);
                 if (rebate != 0) {
                     orderPortrait.setName("返佣");
@@ -2296,8 +2807,8 @@ public class ClubServiceImpl implements ClubService {
                     orderPortrait.setName("返佣");
                     orderPortrait.setPer("0");
                 }
-                orderPortraits.add(orderPortrait);
-                orderPortrait = new PortraitMap();
+                orderPortraits.add(orderPortrait);*/
+                /*orderPortrait = new PortraitMap();
                 orderPortrait.setValue(partialRefund);
                 if (partialRefund != 0) {
                     orderPortrait.setName("部分退款");
@@ -2306,7 +2817,7 @@ public class ClubServiceImpl implements ClubService {
                     orderPortrait.setName("部分退款");
                     orderPortrait.setPer("0");
                 }
-                orderPortraits.add(orderPortrait);
+                orderPortraits.add(orderPortrait);*/
                 /*orderPortrait = new PortraitMap();
                 orderPortrait.setValue(fullRefund);
                 if (fullRefund != 0) {

+ 50 - 0
src/main/java/com/caimei365/user/service/impl/LoginServiceImpl.java

@@ -553,6 +553,21 @@ public class LoginServiceImpl implements LoginService {
         return ResponseJson.success(map);
     }
 
+    @Override
+    public ResponseJson<Map<String, Object>> SpCount(Integer messageType, Integer commonId) {
+        Integer count = messageCenterMapper.Count(3, commonId);
+        Integer tradeCount = messageCenterMapper.MessageCount(3, 1, commonId);
+        Integer accountCount = messageCenterMapper.MessageCount(3, 2, commonId);
+        Integer notificationCount = messageCenterMapper.MessageCount(3, 3, commonId);
+        Integer promotionCount = messageCenterMapper.MessageCount(3, 4, commonId);
+        Map<String, Object> map = new HashMap(10);
+        map.put("count", count);
+        map.put("tradeCount", tradeCount);
+        map.put("accountCount", accountCount);
+        map.put("notificationCount", notificationCount);
+        map.put("promotionCount", promotionCount);
+        return ResponseJson.success(map);
+    }
     @Override
     public ResponseJson<Map<String, Object>> ShopCount(Integer messageType, Integer commonId) {
         Integer count = messageCenterMapper.Count(2, commonId);
@@ -579,6 +594,10 @@ public class LoginServiceImpl implements LoginService {
     public Integer updateShopMessageAsRead(Integer messageType, Integer commonId) {
         return messageCenterMapper.updateMessageAsRead(2, messageType, commonId);
     }
+    @Override
+    public Integer updateSpMessageAsRead(Integer messageType, Integer commonId) {
+        return messageCenterMapper.updateMessageAsRead(3, messageType, commonId);
+    }
 
     @Override
     public Integer deleteMessage(String id) {
@@ -601,6 +620,34 @@ public class LoginServiceImpl implements LoginService {
     }
 
 
+    @Override
+    public ResponseJson<PageInfo<MessageCenter>> SpMessageList(Integer commonId, Integer messageType, Integer source, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<MessageCenter> list = messageCenterMapper.MessageList(3, messageType, commonId);
+        list.forEach(mess -> {
+            if (null != mess.getClubId()) {
+                MessageCenter messageCenter = messageCenterMapper.MainImage(3, commonId, mess.getOrderId());
+                Integer productCount=messageCenterMapper.productCount(mess.getOrderId());
+                if (null != messageCenter) {
+                    mess.setMainImage(messageCenter.getMainImage());
+                    mess.setOnlinePayFlag(messageCenter.getOnlinePayFlag());
+                    if (messageCenter.getProductName().length() > 10) {
+                        mess.setProductName(StringUtils.strip(messageCenter.getProductName().substring(0, 11)));
+                    } else {
+                        mess.setProductName(messageCenter.getProductName());
+                    }
+                    mess.setProductCount(productCount);
+                    mess.setRefundType(messageCenter.getRefundType());
+                    mess.setStatus(messageCenter.getStatus());
+                }
+            }
+        });
+        if (source == 2) {
+            messageCenterMapper.updateMessageAsRead(3, messageType, commonId);
+        }
+        PageInfo<MessageCenter> pageData = new PageInfo<>(list);
+        return ResponseJson.success(pageData);
+    }
     @Override
     public ResponseJson<PageInfo<MessageCenter>> ClubMessageList(Integer commonId, Integer messageType, Integer source, int pageNum, int pageSize) {
         PageHelper.startPage(pageNum, pageSize);
@@ -831,6 +878,9 @@ public class LoginServiceImpl implements LoginService {
         loginUser.setVipFlag(end.getVipFlag());
 
         if (loginUser.getUserId() != null) {
+            if(loginUser.getClubId() != null&&loginUser.getClubId()!=1342){
+                loginUser.setSpUserId(loginMapper.getClubSpUserId(loginUser.getClubId()));
+            }
             Integer shopID = messageCenterMapper.shopID(loginUser.getUserId());
             Integer newReceiptType = messageCenterMapper.newReceiptType(shopID);
             Integer listingFeeCount= messageCenterMapper.listingFee(shopID);

+ 52 - 3
src/main/java/com/caimei365/user/service/impl/RegisterServiceImpl.java

@@ -12,6 +12,10 @@ import com.caimei365.user.model.vo.*;
 import com.caimei365.user.service.RegisterService;
 import com.caimei365.user.service.RemoteCallService;
 import com.caimei365.user.utils.*;
+import com.caimei365.user.utils.message.InsideMessage;
+import com.caimei365.user.utils.message.MessageModel;
+import com.caimei365.user.utils.message.MessageType;
+import com.caimei365.user.utils.message.MqInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Value;
@@ -154,6 +158,11 @@ public class RegisterServiceImpl implements RegisterService {
         if (passResult != null) {
             return ResponseJson.error(passResult);
         }
+        // 协销Id,默认采美官方
+        Integer spId =1342;
+        if (null !=clubRegisterDto.getIsSp()&&1 ==clubRegisterDto.getIsSp()) {
+            spId =null!= clubRegisterDto.getSpId()?clubRegisterDto.getSpId():clubMapper.getSpIdRAND();
+        }
         // 获取ip所在地
         String ipAddress = "";
         Integer provinceId = null;
@@ -208,7 +217,7 @@ public class RegisterServiceImpl implements RegisterService {
         // 用户状态,1正常,0冻结
         user.setValidFlag(1);
         // 协销Id,默认采美官方
-        user.setServiceProviderId(1342);
+        user.setServiceProviderId(spId);
         // 协销状态,已上线
         user.setServiceProviderStatus(90);
         //采美豆
@@ -242,7 +251,7 @@ public class RegisterServiceImpl implements RegisterService {
         // 用户Id
         club.setUserId(user.getUserId());
         // 协销Id(spId)
-        club.setServiceProviderId(1342);
+        club.setServiceProviderId(spId);
         // 注册时间
         club.setAddTime(current);
         // 状态设置上线
@@ -268,7 +277,46 @@ public class RegisterServiceImpl implements RegisterService {
         registerMapper.updateUserClubId(user.getUserId(), club.getClubId());
         // 添加机构协销记录
         if (StringUtils.isNotBlank(club.getLinkMan())) {
-            clubMapper.inProvider(1342, club.getClubId(), club.getLinkMan(), 0);
+            clubMapper.inProvider(spId, club.getClubId(), spId!=1342?"系统自动分配":club.getLinkMan(), 0);
+            if(spId!=1342) {
+                log.info("注册普通机构,开始站内信推送");
+                String selSpName = clubMapper.selSpName(spId);
+                String spMessage = "【采美365】系统已为你分配机构客户,请及时跟进。机构名称【" + user.getUserName() + "】,联系人【" + user.getUserName() + "】,手机号【" + user.getBindMobile() + "】。";
+                String mobile = vipMapper.findMobile(clubMapper.getSpUserId(spId));
+                String clubMessage = "【采美365】采美平台已为您提供专属客户经理,为您提供专业服务。客户经理【" + selSpName + "】,手机号【" + mobile + "】。";
+                if (mobile != null && mobile != "") {
+                    log.info("注册普通机构,发送站内信推送");
+                    //站内信
+                    MessageModel<InsideMessage> insideMessageMessageModel = new MessageModel<>();
+                    insideMessageMessageModel.code(MessageType.WEB_INSIDE_MESSAGE)
+                            .mqInfo(new MqInfo().topic("MessageLine").delay(1).async(0))
+                            .info(new InsideMessage()
+                                    .userType(3)
+                                    .messageType(3)
+                                    .shopTieredType(4)
+                                    .name(user.getUserName())
+                                    .userName(user.getUserName())
+                                    .mobile(user.getBindMobile())
+                                    .thisId(spId)
+                                    .clubId(club.getClubId())
+                            );
+                    smsFeign.sendCommonMessage(insideMessageMessageModel);
+
+                    insideMessageMessageModel.code(MessageType.WEB_INSIDE_MESSAGE)
+                            .info(new InsideMessage()
+                                    .userType(1)
+                                    .messageType(3)
+                                    .shopTieredType(5)
+                                    .userName(selSpName)
+                                    .mobile(mobile)
+                                    .clubId(club.getClubId())
+                            );
+                    smsFeign.sendCommonMessage(insideMessageMessageModel);
+                    //短信
+                    remoteCallService.remoteSendSms(25, 1, mobile, spMessage);
+                    remoteCallService.remoteSendSms(25, 1, user.getBindMobile(), clubMessage);
+                }
+            }
         }
         //推送信息中心-账户通知
         MessageCenter messageCenter = new MessageCenter();
@@ -891,6 +939,7 @@ public class RegisterServiceImpl implements RegisterService {
         club.setServiceProviderId(serviceProvider.getServiceProviderId());
         // 待扫描
         club.setScanFlag(0);
+
         // 注册时间
         club.setAddTime(current);
         // 会员机构,填写升级资料

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

+ 126 - 7
src/main/java/com/caimei365/user/service/impl/SellerServiceImpl.java

@@ -2,9 +2,7 @@ package com.caimei365.user.service.impl;
 
 import com.caimei365.user.components.RedisService;
 import com.caimei365.user.components.WeChatService;
-import com.caimei365.user.mapper.LoginMapper;
-import com.caimei365.user.mapper.SellerMapper;
-import com.caimei365.user.mapper.SuperVipMapper;
+import com.caimei365.user.mapper.*;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.ClubTemporaryDto;
 import com.caimei365.user.model.dto.LoginCodeDto;
@@ -13,16 +11,25 @@ import com.caimei365.user.model.po.SuperVipPo;
 import com.caimei365.user.model.vo.*;
 import com.caimei365.user.service.SellerService;
 import com.caimei365.user.utils.JwtUtil;
+import com.caimei365.user.utils.MathUtil;
 import com.caimei365.user.utils.Md5Util;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import io.swagger.models.auth.In;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * Description
@@ -41,6 +48,10 @@ public class SellerServiceImpl implements SellerService {
     @Resource
     private SellerMapper sellerMapper;
     @Resource
+    private ShopMapper shopMapper;
+    @Resource
+    private ArticleMapper articleMapper;
+    @Resource
     private SuperVipMapper vipMapper;
     @Resource
     private LoginMapper loginMapper;
@@ -63,7 +74,7 @@ public class SellerServiceImpl implements SellerService {
         // 获取协销用户下的机构列表
         List<ClubVo> clubList = new ArrayList<ClubVo>();
         List<Integer> serviceIds = new ArrayList<Integer>();
-        if (1 == type || 3 == type) {
+        if (1 == type || 3 == type|| 6 == type) {
             if(null != groupServiceId && groupServiceId > 0){
                 return ResponseJson.success();
             }else{
@@ -112,6 +123,49 @@ public class SellerServiceImpl implements SellerService {
         return ResponseJson.success(pageData);
     }
 
+    /**
+     * 机构活跃分析
+     *
+     * @param serviceProviderId 协销Id
+     * @param status            机构状态:
+     *                          1:待审查资料, 2:电话预约, 3:已预约
+     *                          20:待确认, 21:待拜访, 30:待员工推荐
+     *                          90:已上线, 91:已冻结, 92:审查资料未通过,待补充资料, 40:已完成第一次采购
+     *                          66:协销下所有上线的机构----虚拟状态
+     * @param name              机构名字关键字(搜索用)
+     * @param type              1.我的机构2.组员机构(组长展示全组,总管理员展示所有人)3.待分配机构
+     * @return
+     */
+    @Override
+    public ResponseJson<Map<String, Object>> getLivelyClubList(Integer serviceProviderId, Integer status, Integer type, String name, Integer userIdentity, Integer pageNum, Integer pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        Map<String, Object> map = new HashMap<>();
+        map.put("clubList", new PageInfo<>(sellerMapper.findClubs(serviceProviderId, status, name, userIdentity, type, null)));
+        return ResponseJson.success(map);
+    }
+    /**
+     * 功能描述: 机构活跃分析比例
+     * @auther: Kaick
+     * @date: 2023/9/4 9:48
+     * @param
+     * @return []
+     */
+
+    @Override
+    public ResponseJson<Map<String, Object>> getLivelyClub(Integer serviceProviderId) {
+        Map<String, Object> map = new HashMap<>();
+        Map<String, Object> spUserLoginSum = sellerMapper.findSpUserLoginSum(serviceProviderId.toString());
+        Integer loginSum = Integer.valueOf(spUserLoginSum.get("loginSum").toString());
+        Integer not_loginSum = Integer.valueOf(spUserLoginSum.get("not_loginSum").toString());
+//        机构活跃与不活跃占比计算方法,例如:机构活跃数/机构活跃数+机构不活跃数(60/(60+30)=0.666...),保留小数点后2位,四舍五入,0.67;
+        BigDecimal livelyClubProportion = new BigDecimal((loginSum + not_loginSum) != 0 ?(double) loginSum / (loginSum + not_loginSum) * 100 : 0).setScale(2, RoundingMode.UP);
+        map.put("livelyClub", loginSum);
+        map.put("noLivelyClub", not_loginSum);
+        map.put("livelyClubProportion", livelyClubProportion);
+        map.put("noLivelyClubProportion", MathUtil.sub(100, livelyClubProportion).setScale(2));
+        return ResponseJson.success(map);
+    }
+
     /**
      * 协销登录(手机号,密码)
      *
@@ -289,16 +343,81 @@ public class SellerServiceImpl implements SellerService {
         return ResponseJson.success(seller);
     }
 
+
+    @Override
+    public ResponseJson setSellerHome(ServiceProviderPo serviceProviderPo) {
+        // 协销用户
+        if (StringUtils.isNotBlank(serviceProviderPo.getImage())) {
+            sellerMapper.setSellerUserHome(serviceProviderPo.getUserId(), serviceProviderPo.getImage());
+        }
+        if (StringUtils.isNotBlank(serviceProviderPo.getQrCode())) {
+            sellerMapper.setSellerHome(serviceProviderPo);
+        }
+        return ResponseJson.success("");
+    }
+
+    @Override
+    public ResponseJson<List<CmBehaviorRecordVo>> getBehaviorRecordClub(Integer spId, String accessTime) {
+       // 设置日期格式
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        LocalDate date = LocalDate.parse(accessTime, formatter);
+        // 获取前一天的日期
+        LocalDate dayBeforeYesterday = date.minusDays(1);
+        // 格式化日期
+        accessTime= dayBeforeYesterday.format(formatter);
+        List<CmBehaviorRecordVo> behaviorRecordYesterdayClub = sellerMapper.getBehaviorRecordYesterdayClub(spId, accessTime);
+        for (CmBehaviorRecordVo cmBehaviorRecordVo : behaviorRecordYesterdayClub) {
+            String pageLabel = sellerMapper.getBehaviorRecordYesterdayPageLabel(spId, cmBehaviorRecordVo.getClubId(), accessTime);
+            cmBehaviorRecordVo.setPageLabel(pageLabel);
+        }
+        return ResponseJson.success(behaviorRecordYesterdayClub);
+    }
+
+    @Override
+    public ResponseJson<List<CmBehaviorRecordVo>> getBehaviorRecordClubFrom(Integer spId, Integer clubId, String accessTime) {
+//        // 设置日期格式
+//        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+//        LocalDate date = LocalDate.parse(accessTime, formatter);
+//        // 获取前一天的日期
+//        LocalDate dayBeforeYesterday = date.minusDays(1);
+//        // 格式化日期
+//        accessTime= dayBeforeYesterday.format(formatter);
+        List<CmBehaviorRecordVo> behaviorRecordYesterdayClubFrom = sellerMapper.getBehaviorRecordYesterdayClubFrom(spId, clubId, accessTime);
+        for (CmBehaviorRecordVo cmBehaviorRecordVo : behaviorRecordYesterdayClubFrom) {
+            String pageLabel = sellerMapper.getBehaviorRecordYesterdayPageLabel(spId, cmBehaviorRecordVo.getClubId(), accessTime);
+            cmBehaviorRecordVo.setPageLabel(pageLabel);
+            if (cmBehaviorRecordVo.getProductID() != 0 && cmBehaviorRecordVo.getPageType().equals("6") ) {
+                ProductItemVo productShown = shopMapper.getProductShown(cmBehaviorRecordVo.getProductID());
+                cmBehaviorRecordVo.setTitleId(cmBehaviorRecordVo.getProductID());
+                cmBehaviorRecordVo.setTitle(productShown.getName());
+                cmBehaviorRecordVo.setTitleImage(productShown.getImage());
+            }else if ( cmBehaviorRecordVo.getPageType().equals("11") ) {
+                //获取文章id
+                Integer id = null;
+                Pattern pattern = Pattern.compile("info/detail-(.*?)-");
+                Matcher matcher = pattern.matcher(cmBehaviorRecordVo.getPagePath());
+                if (matcher.find()) {
+                    id= Integer.valueOf(matcher.group(1));
+                }
+                ShopArticleVo info = articleMapper.getShopArticleById(id);
+                cmBehaviorRecordVo.setTitleId(id);
+                cmBehaviorRecordVo.setTitle(info.getTitle());
+                cmBehaviorRecordVo.setTitleImage(info.getGuidanceImage());
+            }
+        }
+        return ResponseJson.success(behaviorRecordYesterdayClubFrom);
+    }
+
     @Override
-    public ResponseJson<List<ServiceProviderVo>> getServiceTeam(Integer spId,Integer status) {
+    public ResponseJson<List<ServiceProviderVo>> getServiceTeam(Integer spId, Integer status) {
         Integer leaderId = sellerMapper.findLeaderIdByServiceId(spId);
         Integer managerId = sellerMapper.findmanagerIdByServiceId(spId);
         List<ServiceProviderVo> serviceProviderVos = new ArrayList<>();
         if (null != leaderId) {
-            serviceProviderVos = sellerMapper.findServices(spId,status);
+            serviceProviderVos = sellerMapper.findServices(spId, status);
         }
         if (null != managerId) {
-            serviceProviderVos = sellerMapper.findAllServices(spId,status);
+            serviceProviderVos = sellerMapper.findAllServices(spId, status);
         }
         //个人返回空,组长返回小组所有人
         return ResponseJson.success(serviceProviderVos);

+ 23 - 12
src/main/java/com/caimei365/user/service/impl/ShopServiceImpl.java

@@ -324,7 +324,7 @@ public class ShopServiceImpl implements ShopService {
      * @param userId 用户Id
      */
     @Override
-    public ResponseJson<Map<String, Object>> getShopPersonalData(Integer userId) {
+    public ResponseJson<Map<String, Object>> getShopPersonalData(Integer userId, Integer productOrganize) {
         Map<String, Object> result = new HashMap<>(11);
         // 1.用户信息
         UserVo user = baseMapper.getUserByUserId(userId);
@@ -366,13 +366,14 @@ public class ShopServiceImpl implements ShopService {
         Integer unReadMessageCount = personalCenterMapper.getUnReadMessageCount(userId);
         result.put("unReadMessageCount", unReadMessageCount);
         // 7.商品数量统计,validFlag 商品状态,见ProductStatus,0逻辑删除 1待审核 2已上架 3已下架 8审核未通过 9已冻结'
-        Integer allNum = shopMapper.getShopProductCount(user.getShopId(), null);
+        productOrganize = null == productOrganize ? 0 : productOrganize;
+        Integer allNum = shopMapper.getShopProductCount(user.getShopId(), productOrganize, null);
         result.put("allNum", allNum);
         // 8.已上架数量
-        Integer upNum = shopMapper.getShopProductCount(user.getShopId(), 2);
+        Integer upNum = shopMapper.getShopProductCount(user.getShopId(), productOrganize, 2);
         result.put("upNum", upNum);
         // 9.已下架数量
-        Integer downNum = shopMapper.getShopProductCount(user.getShopId(), 3);
+        Integer downNum = shopMapper.getShopProductCount(user.getShopId(), productOrganize, 3);
         result.put("downNum", downNum);
         Jedis jedis = new Jedis("172.31.165.27", 6379);
         jedis.auth("6#xsI%b4o@5c3RoE");
@@ -380,7 +381,7 @@ public class ShopServiceImpl implements ShopService {
         result.put("constraint", jedis.rpop("constraint"));
 
         // 10.单品销售排名
-        List<Map<String, Object>> salesRankingList = shopMapper.getSalesRankingList(user.getShopId());
+        List<Map<String, Object>> salesRankingList = shopMapper.getSalesRankingList(user.getShopId(), productOrganize);
         if (salesRankingList != null && salesRankingList.size() > 0) {
             salesRankingList.forEach(map -> {
                 ProductItemVo product = shopMapper.getProductShown((Integer) map.get("productId"));
@@ -396,22 +397,22 @@ public class ShopServiceImpl implements ShopService {
         Date endDayOfDay = DateUtil.getDayEnd();
         // 近一个月销售情况统计
         Date beginDayOfYesterday = DateUtil.addMonth(endDayOfDay, -1);
-        Map<String, Object> m1 = shopMapper.getSalesStatistics(user.getShopId(), DateUtil.formatDateTime(beginDayOfYesterday), DateUtil.formatDateTime(endDayOfDay));
+        Map<String, Object> m1 = shopMapper.getSalesStatistics(user.getShopId(), productOrganize, DateUtil.formatDateTime(beginDayOfYesterday), DateUtil.formatDateTime(endDayOfDay));
         m1.put("time", "近一月");
         salesStatisticsList.add(m1);
         // 近三个月销售情况统计
         Date beginDayOfLastWeek = DateUtil.addMonth(endDayOfDay, -3);
-        Map<String, Object> m2 = shopMapper.getSalesStatistics(user.getShopId(), DateUtil.formatDateTime(beginDayOfLastWeek), DateUtil.formatDateTime(endDayOfDay));
+        Map<String, Object> m2 = shopMapper.getSalesStatistics(user.getShopId(), productOrganize, DateUtil.formatDateTime(beginDayOfLastWeek), DateUtil.formatDateTime(endDayOfDay));
         m2.put("time", "近三月");
         salesStatisticsList.add(m2);
         // 近半年销售情况统计
         Date beginDayOfLastMonth = DateUtil.addMonth(endDayOfDay, -6);
-        Map<String, Object> m3 = shopMapper.getSalesStatistics(user.getShopId(), DateUtil.formatDateTime(beginDayOfLastMonth), DateUtil.formatDateTime(endDayOfDay));
+        Map<String, Object> m3 = shopMapper.getSalesStatistics(user.getShopId(), productOrganize, DateUtil.formatDateTime(beginDayOfLastMonth), DateUtil.formatDateTime(endDayOfDay));
         m3.put("time", "近半年");
         salesStatisticsList.add(m3);
         // 近一年销售情况统计
         Date beginDayOfLastYear = DateUtil.addMonth(endDayOfDay, -12);
-        Map<String, Object> m4 = shopMapper.getSalesStatistics(user.getShopId(), DateUtil.formatDateTime(beginDayOfLastYear), DateUtil.formatDateTime(endDayOfDay));
+        Map<String, Object> m4 = shopMapper.getSalesStatistics(user.getShopId(), productOrganize, DateUtil.formatDateTime(beginDayOfLastYear), DateUtil.formatDateTime(endDayOfDay));
         m4.put("time", "近一年");
         salesStatisticsList.add(m4);
         result.put("salesStatisticsList", salesStatisticsList);
@@ -435,7 +436,8 @@ public class ShopServiceImpl implements ShopService {
         // 供应商文章
         ShopArticleVo shopArticle = articleMapper.getShopArticleById(articleId);
         // 文章分类列表
-        List<ArticleTypeVo> articleTypeList = articleMapper.getArticleTypeList();
+        List<ArticleTypeVo> articleTypeList = articleMapper.getArticleTypeList("0");
+        infoTypes(articleTypeList);
         // 文章标签列表
         String articleLabels = articleMapper.getArticleLabelList();
         // 文章关联的标签库
@@ -550,10 +552,19 @@ public class ShopServiceImpl implements ShopService {
 
     @Override
     public ResponseJson<List<ArticleTypeVo>> getArticleTypeList() {
-        List<ArticleTypeVo> articleTypeList = articleMapper.getArticleTypeList();
+        List<ArticleTypeVo> articleTypeList = articleMapper.getArticleTypeList("0");
+        infoTypes(articleTypeList);
         return ResponseJson.success(articleTypeList);
     }
-
+    public void infoTypes(List<ArticleTypeVo> articleTypes ) {
+        articleTypes.forEach(type->{
+            List<ArticleTypeVo> articleTypes1 = articleMapper.getArticleTypeList(type.getTypeId().toString());
+            if(articleTypes1.size()>0){
+                type.setArticleTypes(articleTypes1);
+                infoTypes(articleTypes1);
+            }
+        });
+    }
     @Override
     public ResponseJson<Void> deleteArticle(Integer articleId) {
         articleMapper.deleteArticle(articleId);

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

+ 92 - 2
src/main/java/com/caimei365/user/utils/RequestUtil.java

@@ -1,5 +1,12 @@
 package com.caimei365.user.utils;
 
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.protocol.HttpContext;
 import org.springframework.util.StringUtils;
 
 import javax.net.ssl.HttpsURLConnection;
@@ -7,8 +14,7 @@ import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLSocketFactory;
 import javax.net.ssl.TrustManager;
 import java.io.*;
-import java.net.URL;
-import java.net.URLConnection;
+import java.net.*;
 import java.nio.charset.StandardCharsets;
 import java.security.cert.X509Certificate;
 import java.util.List;
@@ -117,7 +123,31 @@ public class RequestUtil {
         }
         return result.toString();
     }
+    public static ByteArrayInputStream sendPost(String url, String params) throws URISyntaxException, IOException {
+        CloseableHttpClient client = HttpClients.createDefault();
+        HttpPost httpPost = new HttpPost();
+        httpPost.addHeader("Content-type","application/json;charset=UTF-8");
+        httpPost.setHeader("Accept","application/json");
+        URI uri = new URI(url);
+        httpPost.setURI(uri);
+        StringEntity entity = new StringEntity(params, "UTF-8");
+        httpPost.setEntity(entity);
+        CloseableHttpResponse response = client.execute(httpPost, (HttpContext) null);
+        HttpEntity responseEntity = response.getEntity();
+        InputStream inputStream = responseEntity.getContent();
+        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+        byte[] buffer = new byte[1024];
+        int len = 0;
+        while ((len = inputStream.read(buffer)) != -1) {
+            outputStream.write(buffer, 0, len);
+        }
+        inputStream.close();
+        ByteArrayInputStream byteInputStream = new ByteArrayInputStream(outputStream.toByteArray());
+        outputStream.flush();
+        outputStream.close();
+        return byteInputStream;
 
+    }
     /**
      * 向指定 URL 发送请求
      * @param requestUrl 发送请求的 URL
@@ -184,4 +214,64 @@ public class RequestUtil {
         } catch (Exception ignored) {}
         return null;
     }
+
+    public static String sendPost(String url, String param, String contentType) {
+        OutputStreamWriter out = null;
+        BufferedReader in = null;
+        String result = "";
+        try {
+            URL realUrl = new URL(url);
+            // 打开和URL之间的连接
+            HttpURLConnection conn = (HttpURLConnection) realUrl.openConnection();
+            // 设置通用的请求属性
+            conn.setRequestProperty("accept", "*/*");
+            conn.setRequestProperty("connection", "Keep-Alive");
+            conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+            conn.setRequestProperty("Content-Type", contentType);
+            // 发送POST请求必须设置如下两行
+            conn.setDoOutput(true);
+            conn.setDoInput(true);
+
+            /*************************************************************************/
+            // 获取URLConnection对象对应的输出流
+            // out = new PrintWriter(conn.getOutputStream());
+            out = new OutputStreamWriter(conn.getOutputStream(), "utf-8"); // 8859_1
+            /*************************************************************************/
+
+            out.write(param); // post的关键所在
+            // 发送请求参数
+            // out.print(param);
+            // flush输出流的缓冲
+            out.flush();
+            // 定义BufferedReader输入流来读取URL的响应
+            int code = conn.getResponseCode();
+            if(code == 200) {
+                in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+            }else{
+                in = new BufferedReader(new InputStreamReader(conn.getErrorStream()));
+            }
+            String line;
+            while ((line = in.readLine()) != null) {
+                result += line;
+            }
+        } catch (Exception e) {
+            System.out.println("发送 POST 请求出现异常!" + e);
+            e.printStackTrace();
+        }
+        // 使用finally块来关闭输出流、输入流
+        finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (in != null) {
+                    in.close();
+                }
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+        return result;
+    }
+
 }

+ 377 - 0
src/main/java/com/caimei365/user/utils/message/InsideMessage.java

@@ -0,0 +1,377 @@
+package com.caimei365.user.utils.message;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * @author Administrator
+ * 站内信model
+ */
+@Data
+@Accessors(fluent = true)
+public class InsideMessage implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 消息id
+     */
+    private Integer id;
+    /**
+     * 供应商id
+     */
+    private Integer shopId;
+    /**
+     * 机构id
+     */
+    private Integer clubId;
+    /**
+     * 订单ID
+     */
+    private Integer orderId;
+    /**
+     * 用户类型1.机构2.供应商
+     */
+    private Integer userType;
+    /**
+     * 消息类型1.交易物流2.账户通知3.服务通知4.优惠促销
+     */
+    private Integer messageType;
+    /**
+     * 消息内容
+     */
+    private String content;
+
+    /**
+     * 失败原因
+     */
+    private String reasonContent;
+    /**
+     * 操作完成时间
+     */
+    private String time;
+    /**
+     * 账户通知类型 1.注册成功通知 2.购买超级会员成功 3.超级会员到期提醒 4.超级会员到期提醒 5.升级资质机构成功 6.升级资质机构失败 7.成为机构运营人员通知
+     */
+    private Integer accountType;
+    /**
+     * 优惠券类型 1.优惠券待领取通知 2.优惠券过期通知
+     */
+    private Integer couponType;
+    /**
+     * 优惠券金额
+     */
+    private Double couponFee;
+    /**
+     * 主图
+     */
+    private String mainImage;
+    /**
+     * 是否能走线上支付 0可以 1不可以 只能线下
+     */
+    private Integer onlinePayFlag;
+    /**
+     * 商品名称
+     */
+    private String productName;
+    /**
+     * 供应商消息类型 1,账号审核通知,2.成为公司运营人员通知,3.商品上架审核通知,4.新品展示审核通知,5.上架费到期通知 6.商品资质到期通知
+     */
+    private Integer shopMessType;
+    /**
+     * 供应商服务消息类型 1.上架费
+     */
+    private Integer shopTieredType;
+    /**
+     * 交易物流1.下单成功通知  2.订单支付完成 3.退款/货成功通知 4.订单取消通知 5.订单发货通知 6.自动收货通知
+     */
+    private Integer orderMessageType;
+    /**
+     * 0.未读 , 1.已读
+     */
+    private Integer saved;
+    /**
+     * 优惠券类型 1.优惠券待领取通知 2.优惠券过期通知
+     */
+    private Integer couponMessageType;
+    /**
+     * 商品记录数
+     */
+    private Integer productCount;
+    /**
+     * 退货退款类型:1部分退、2全部退
+     */
+    private Integer refundType;
+
+    /**
+     * 订单状态
+     */
+    private Integer status;
+    /**
+     * 商品ID
+     */
+    private Integer productId;
+
+    /** 手机号 */
+    private String mobile;
+
+    /** 名称 */
+    private String name;
+
+    /** 用户名称 */
+    private String userName;
+
+    /** 前用户名称 */
+    private String superUserName;
+
+    /** 当前id */
+    private Integer thisId;
+
+    /**
+     * 供应商公司名称
+     */
+
+    private String shopName;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getShopId() {
+        return shopId;
+    }
+
+    public void setShopId(Integer shopId) {
+        this.shopId = shopId;
+    }
+
+    public Integer getClubId() {
+        return clubId;
+    }
+
+    public void setClubId(Integer clubId) {
+        this.clubId = clubId;
+    }
+
+    public Integer getOrderId() {
+        return orderId;
+    }
+
+    public void setOrderId(Integer orderId) {
+        this.orderId = orderId;
+    }
+
+    public Integer getUserType() {
+        return userType;
+    }
+
+    public void setUserType(Integer userType) {
+        this.userType = userType;
+    }
+
+    public Integer getMessageType() {
+        return messageType;
+    }
+
+    public void setMessageType(Integer messageType) {
+        this.messageType = messageType;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getReasonContent() {
+        return reasonContent;
+    }
+
+    public void setReasonContent(String reasonContent) {
+        this.reasonContent = reasonContent;
+    }
+
+    public String getTime() {
+        return time;
+    }
+
+    public void setTime(String time) {
+        this.time = time;
+    }
+
+    public Integer getAccountType() {
+        return accountType;
+    }
+
+    public void setAccountType(Integer accountType) {
+        this.accountType = accountType;
+    }
+
+    public Integer getCouponType() {
+        return couponType;
+    }
+
+    public void setCouponType(Integer couponType) {
+        this.couponType = couponType;
+    }
+
+    public Double getCouponFee() {
+        return couponFee;
+    }
+
+    public void setCouponFee(Double couponFee) {
+        this.couponFee = couponFee;
+    }
+
+    public String getMainImage() {
+        return mainImage;
+    }
+
+    public void setMainImage(String mainImage) {
+        this.mainImage = mainImage;
+    }
+
+    public Integer getOnlinePayFlag() {
+        return onlinePayFlag;
+    }
+
+    public void setOnlinePayFlag(Integer onlinePayFlag) {
+        this.onlinePayFlag = onlinePayFlag;
+    }
+
+    public String getProductName() {
+        return productName;
+    }
+
+    public void setProductName(String productName) {
+        this.productName = productName;
+    }
+
+    public Integer getShopMessType() {
+        return shopMessType;
+    }
+
+    public void setShopMessType(Integer shopMessType) {
+        this.shopMessType = shopMessType;
+    }
+
+    public Integer getShopTieredType() {
+        return shopTieredType;
+    }
+
+    public void setShopTieredType(Integer shopTieredType) {
+        this.shopTieredType = shopTieredType;
+    }
+
+    public Integer getOrderMessageType() {
+        return orderMessageType;
+    }
+
+    public void setOrderMessageType(Integer orderMessageType) {
+        this.orderMessageType = orderMessageType;
+    }
+
+    public Integer getSaved() {
+        return saved;
+    }
+
+    public void setSaved(Integer saved) {
+        this.saved = saved;
+    }
+
+    public Integer getCouponMessageType() {
+        return couponMessageType;
+    }
+
+    public void setCouponMessageType(Integer couponMessageType) {
+        this.couponMessageType = couponMessageType;
+    }
+
+    public Integer getProductCount() {
+        return productCount;
+    }
+
+    public void setProductCount(Integer productCount) {
+        this.productCount = productCount;
+    }
+
+    public Integer getRefundType() {
+        return refundType;
+    }
+
+    public void setRefundType(Integer refundType) {
+        this.refundType = refundType;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getSuperUserName() {
+        return superUserName;
+    }
+
+    public void setSuperUserName(String superUserName) {
+        this.superUserName = superUserName;
+    }
+
+    public Integer getThisId() {
+        return thisId;
+    }
+
+    public void setThisId(Integer thisId) {
+        this.thisId = thisId;
+    }
+
+    public String getShopName() {
+        return shopName;
+    }
+
+    public void setShopName(String shopName) {
+        this.shopName = shopName;
+    }
+}

+ 43 - 0
src/main/java/com/caimei365/user/utils/message/MessageModel.java

@@ -0,0 +1,43 @@
+package com.caimei365.user.utils.message;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+/**
+ * @author Administrator
+ */
+@Data
+@Accessors(fluent = true)
+@NoArgsConstructor
+public class MessageModel<T> {
+    private MessageType code;
+
+    private MqInfo mqInfo;
+
+    private T info;
+
+    public MessageType getCode() {
+        return code;
+    }
+
+    public void setCode(MessageType code) {
+        this.code = code;
+    }
+
+    public MqInfo getMqInfo() {
+        return mqInfo;
+    }
+
+    public void setMqInfo(MqInfo mqInfo) {
+        this.mqInfo = mqInfo;
+    }
+
+    public T getInfo() {
+        return info;
+    }
+
+    public void setInfo(T info) {
+        this.info = info;
+    }
+}

+ 41 - 0
src/main/java/com/caimei365/user/utils/message/MessageType.java

@@ -0,0 +1,41 @@
+package com.caimei365.user.utils.message;
+
+import lombok.AllArgsConstructor;
+import lombok.ToString;
+
+/**
+ * @author Administrator
+ */
+
+@ToString
+@AllArgsConstructor
+public enum MessageType {
+    /**
+     * 1.微信模板消息
+     * 2.站内消息
+     * 3.邮件
+     * 4.短信
+     */
+    WECHAT_TEMPLATE_MESSAGE(1, "微信模板消息"),
+    WEB_INSIDE_MESSAGE(2, "站内消息"),
+    EMAILS(3, "邮件"),
+    SYS_MESSAGE(4, "短信");
+    private Integer code;
+    private String description;
+
+    public Integer getCode() {
+        return code;
+    }
+
+    public void setCode(Integer code) {
+        this.code = code;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+}

+ 65 - 0
src/main/java/com/caimei365/user/utils/message/MqInfo.java

@@ -0,0 +1,65 @@
+package com.caimei365.user.utils.message;
+
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.hibernate.validator.constraints.Range;
+
+
+@Data
+@Accessors(fluent = true)
+public class MqInfo {
+    /**
+     * 异步消息(可选):1是,0否
+     */
+    @Range(min = 0, max = 1)
+    private Integer async;
+
+    /**
+     * 1-18,0否,对应时间依次:1s 5s 10s 30s 1m 2m 3m 4m 5m 6m 7m 8m 9m 10m 20m 30m 1h 2h
+     */
+    @Range(min = 0, max = 18)
+    private Integer delay;
+
+    /**
+     * 消息主题
+     */
+    private String topic;
+
+    /**
+     * 消息标签(可选)
+     */
+    private String tag;
+
+    public Integer getAsync() {
+        return async;
+    }
+
+    public void setAsync(Integer async) {
+        this.async = async;
+    }
+
+    public Integer getDelay() {
+        return delay;
+    }
+
+    public void setDelay(Integer delay) {
+        this.delay = delay;
+    }
+
+    public String getTopic() {
+        return topic;
+    }
+
+    public void setTopic(String topic) {
+        this.topic = topic;
+    }
+
+    public String getTag() {
+        return tag;
+    }
+
+    public void setTag(String tag) {
+        this.tag = tag;
+    }
+}

+ 6 - 3
src/main/resources/mapper/ArticleMapper.xml

@@ -19,14 +19,16 @@
                guidanceImage,
                enabledStatus as status,
                labelIds
-        from info
+            from info
         where id = #{articleId}
     </select>
     <select id="getArticleTypeList" resultType="com.caimei365.user.model.vo.ArticleTypeVo">
         select id as typeId, name as typeName
-        from info_type
+        from info_type a
         where enabledStatus = '1'
+          and a.delFlag = 0 and a.type = 1
           and shopUseFlag = 1
+          and a.parentId=#{parentId}
         order by sort desc, createDate desc
     </select>
     <select id="getArticleLabelId" resultType="java.lang.Integer">
@@ -42,6 +44,7 @@
         publisher,
         source,
         it.name as typeName,
+        it.parentId as parentId,
         guidanceImage,
         i.pubdate as publishDate,
         i.createDate,
@@ -63,7 +66,7 @@
             and publisher like concat('%',#{publisher},'%')
         </if>
         <if test="typeId != null">
-            and typeId = #{typeId}
+            and (typeId = #{typeId} or it.parentId=#{typeId})
         </if>
         <if test="status != null">
             and i.enabledStatus = #{status}

+ 13 - 0
src/main/resources/mapper/BaseMapper.xml

@@ -202,4 +202,17 @@
         WHERE userId = #{userId}
           and delflag = 0
     </select>
+    <select id="getByUserId" resultType="java.lang.Integer">
+        <if test="userType != null">
+            <if test="userType == 1">
+            SELECT userID from  club   WHERE  clubId = #{id}
+            </if>
+            <if test="userType == 2">
+            SELECT userID from  shop   WHERE  shopId = #{id}
+            </if>
+            <if test="userType == 3">
+            SELECT userID from  serviceprovider  WHERE  serviceProviderID = #{id}
+            </if>
+        </if>
+    </select>
 </mapper>

+ 159 - 44
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
@@ -238,9 +242,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">-->
@@ -298,17 +304,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
@@ -326,7 +340,15 @@
             followup=#{followup},
             extra=#{extra},
             reportID=#{reportId},
-            productID=#{productId}
+            productID=#{productId},
+            communicationSituation  = #{communicationSituation},
+            communicationMethods    = #{communicationMethods},
+            customerSource          = #{customerSource},
+            customerGender          = #{customerGender},
+            customerAge             = #{customerAge},
+            groupAddition           = #{groupAddition},
+            trendsKeyword   = #{trendsKeyword},
+            stateKeyword    = #{stateKeyword}
         where id = #{remarksId}
     </update>
     <update id="updateVisit">
@@ -441,6 +463,14 @@
                         ccr.satisfied,
                         ccr.followup,
                         ccr.extra,
+                        ccr.communicationSituation,
+                        ccr.communicationMethods,
+                        ccr.customerSource,
+                        ccr.customerGender,
+                        ccr.groupAddition,
+                        ccr.customerAge,
+                        ccr.trendsKeyword,
+                        ccr.stateKeyword,
                         p.`mainImage`               AS mainImage,
                         p.name                      AS productName,
                         s.name                      AS shopName,
@@ -470,6 +500,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,
@@ -531,6 +590,14 @@
                         ccr.satisfied,
                         ccr.followup,
                         ccr.extra,
+                        ccr.communicationSituation,
+                        ccr.communicationMethods,
+                        ccr.customerSource,
+                        ccr.customerGender,
+                        ccr.groupAddition,
+                        ccr.customerAge,
+                        ccr.trendsKeyword,
+                        ccr.stateKeyword,
                         p.`mainImage`               AS mainImage,
                         p.name                      AS productName,
                         s.name                      AS shopName,
@@ -606,6 +673,8 @@
         ccr.id AS remarksId, ccr.remarks,ccr.addTime,ccr.questionMan,ccr.serviceProviderId as serviceProviderId, ccr.createServiceProviderId as createServiceProviderId,
         csr.leaderId AS leaderId,IFNULL(ccr.consultType,'') as consult, c.Name as clubName,
         ccr.clubType AS clubType,ccr.pinceSensitve AS pinceSensitve,ccr.satisfied AS satisfied,ccr.followup AS followup,ccr.extra AS extra,
+        ccr.communicationSituation, ccr.communicationMethods, ccr.customerSource, ccr.customerGender,
+        ccr.groupAddition, ccr.customerAge, ccr.trendsKeyword, ccr.stateKeyword,
         (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID= csr.leaderId) AS leaderName,
         (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.createServiceProviderId) as recordName,c.newDeal as newDeal,cmc.status as status
         # (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.oldserviceProviderId) AS oldName
@@ -663,8 +732,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
@@ -762,6 +831,8 @@
         ccr.id AS remarksId, ccr.remarks,ccr.addTime,ccr.questionMan,ccr.serviceProviderId as serviceProviderId, ccr.createServiceProviderId as createServiceProviderId,
         csr.leaderId AS leaderId,IFNULL(ccr.consultType,'') as consult, c.Name as clubName,
         ccr.clubType AS clubType,ccr.pinceSensitve AS pinceSensitve,ccr.satisfied AS satisfied,ccr.followup AS followup,ccr.extra AS extra,
+        ccr.communicationSituation, ccr.communicationMethods, ccr.customerSource, ccr.customerGender,
+        ccr.groupAddition, ccr.customerAge, ccr.trendsKeyword, ccr.stateKeyword,
         (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID= csr.leaderId) AS leaderName,
         (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.createServiceProviderId) AS recordName,c.newDeal as newDeal,cmc.status as status
         # (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.oldserviceProviderId) AS oldName
@@ -820,9 +891,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
@@ -878,10 +949,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>
 
@@ -1007,8 +1081,8 @@
         WHERE csg.serviceId = #{spId}
     </select>
     <select id="selTotal" resultType="com.caimei365.user.model.dto.CmPortraitDto">
-        SELECT (SELECT COUNT(orderID) FROM cm_order WHERE clubID = #{clubId} AND STATUS != 6 AND STATUS != 7 AND refundType != 2 AND orderTime <![CDATA[ < ]]> now())      AS orderTotal,
-               (SELECT SUM(payTotalFee) FROM cm_order WHERE clubID = #{clubId} AND STATUS != 6 AND STATUS != 7 AND refundType != 2 AND orderTime <![CDATA[ < ]]> now())                                                                 AS orderTotalAmount,
+        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,
+               (SELECT IFNULL(SUM(totalAmount), 0) FROM cm_shop_order WHERE clubID = #{clubId} AND shopStatus != 4 AND shopStatus != 5 AND refundStatus != 2 AND orderTime <![CDATA[ < ]]> NOW()) AS orderTotalAmount,
                (SELECT COUNT(cbr.recordID) FROM cm_behavior_record cbr LEFT JOIN club c ON cbr.userID = c.userID
                 WHERE cbr.pageType IN (8, 9) AND c.clubID = #{clubId} AND cbr.accessDate <![CDATA[ < ]]> now())                                                            AS totalkeywords,
                (SELECT COUNT(remarks) FROM cm_club_remarks WHERE clubID = #{clubId} AND addTime <![CDATA[ < ]]> now()) AS remarksTotal
@@ -1039,22 +1113,48 @@
           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(orderID) FROM cm_order WHERE clubID = #{clubId} AND STATUS != 6 AND STATUS != 7 AND refundType != 2) as numbers,
-        (SELECT SUM(payTotalFee) FROM cm_order WHERE clubID = #{clubId} AND STATUS != 6 AND STATUS != 7 AND refundType != 2) as totalMoney,
-        clubID,
-        secondHandOrderFlag,
-        rebateFlag,
-        refundType,
-        payTotalFee,
-        STATUS,
-        orderTime
-        FROM cm_order
+        (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,
+        (SELECT IFNULL(SUM(totalAmount), 0) FROM cm_shop_order WHERE clubID = #{clubId} AND shopStatus != 4 AND shopStatus != 5 AND refundStatus != 2 AND orderTime <![CDATA[ < ]]> NOW()) AS orderTotalAmount,
+        cso.clubID,
+        co.secondHandOrderFlag,
+        co.rebateFlag,
+        cso.totalAmount AS payTotalFee,
+        ifnull(cso.refundStatus,1) as refundType,
+        cso.shopStatus AS STATUS,
+        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>
-            clubID = #{clubId} AND STATUS != 6 AND STATUS != 7 AND refundType != 2
+            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 orderTime <![CDATA[ >= ]]> #{startTime} AND orderTime <![CDATA[ <= ]]> #{endTime}
+                AND cso.orderTime <![CDATA[ >= ]]> #{startTime} AND cso.orderTime <![CDATA[ <= ]]> #{endTime}
             </if>
         </where>
     </select>
@@ -1134,6 +1234,21 @@
     <select id="selSpLinkMan" resultType="java.lang.String">
         SELECT linkMan FROM serviceprovider WHERE serviceProviderID = #{choseServiceId}
     </select>
+    <select id="getSpIdRAND" resultType="java.lang.Integer">
+        SELECT sp.serviceProviderID FROM serviceprovider sp
+        WHERE sp.organizeID = 0
+          and sp.status=90
+          and sp.serviceProviderID != 1342 and linkMan not LIKE '%测试%'
+        ORDER BY RAND()
+        LIMIT 0,1;
+    </select>
+    <select id="getSpUserId" resultType="java.lang.Integer">
+        SELECT sp.userId FROM serviceprovider sp
+        WHERE sp.organizeID = 0
+          and sp.status=90
+          and sp.serviceProviderID=#{spId}
+        LIMIT 0,1;
+    </select>
     <insert id="inProvider">
         insert into cm_provider_record (spId, clubId, operator, isOneself, createTime)
         values (#{spId}, #{clubId}, #{operator}, #{isOneself}, now())

+ 6 - 0
src/main/resources/mapper/LoginMapper.xml

@@ -461,4 +461,10 @@
         WHERE userID = #{userId}
         limit 1
     </select>
+    <select id="getClubSpUserId" resultType="java.lang.Integer">
+        SELECT s.userID from  serviceprovider s
+        left join club c on c.spId=s.serviceProviderID
+        WHERE  c.clubId = #{clubId}
+        limit 1
+    </select>
 </mapper>

+ 33 - 18
src/main/resources/mapper/MessageCenter.xml

@@ -65,6 +65,9 @@
             <if test="userType == 2">
                 and  shopID=#{commonId}
             </if>
+            <if test="userType == 3">
+                and  thisId=#{commonId}
+            </if>
             AND messageType=#{messageType}
             and userType=#{userType}
             AND saved=0
@@ -80,6 +83,9 @@
             <if test="userType == 2">
                 and  shopID=#{commonId}
             </if>
+            <if test="userType == 3">
+                and  thisId=#{commonId}
+            </if>
             and userType=#{userType}
             AND saved=0
         </where>
@@ -102,15 +108,18 @@
         SELECT * FROM `message_center`
         <where>
             <if test="messageType !=null">
-            AND messageType=#{messageType}
-           </if>
+                AND messageType=#{messageType}
+            </if>
             <if test="userType == 1">
-                and  clubID=#{commonId}
+                and clubID=#{commonId}
             </if>
             <if test="userType == 2">
-                and  shopID=#{commonId}
+                and shopID=#{commonId}
+            </if>
+            <if test="userType == 3">
+                and thisId=#{commonId}
             </if>
-           and userType=#{userType}
+            and userType=#{userType}
         </where>
         ORDER BY id DESC
     </select>
@@ -154,12 +163,15 @@
         <where>
 
             <if test="userType == 1">
-              and  c.clubID=#{commonId}
+                and c.clubID=#{commonId}
             </if>
             <if test="userType == 2">
-              and  p.shopID=#{commonId}
+                and p.shopID=#{commonId}
+            </if>
+            <if test="userType == 3">
+                and sp.serviceProviderID=#{commonId}
             </if>
-        and co.orderID=#{orderID}
+            and co.orderID=#{orderID}
         </where>
         LIMIT 1
     </select>
@@ -216,16 +228,19 @@
     <update id="updateMessageAsRead">
         UPDATE message_center SET saved = 1
         <where>
-      <if test="userType == 1">
-          and  clubID=#{commonId}
-      </if>
-      <if test="userType == 2">
-          and  shopID=#{commonId}
-      </if>
-        <if test="messageType !=null">
-           and messageType = #{messageType}
-        </if>
-          and userType=#{userType}
+            <if test="userType == 1">
+                and clubID=#{commonId}
+            </if>
+            <if test="userType == 2">
+                and shopID=#{commonId}
+            </if>
+            <if test="userType == 3">
+                and thisId=#{commonId}
+            </if>
+            <if test="messageType !=null">
+                and messageType = #{messageType}
+            </if>
+            and userType=#{userType}
         </where>
     </update>
 

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

+ 208 - 22
src/main/resources/mapper/SellerMapper.xml

@@ -26,6 +26,20 @@
             unionId = #{unionId}
         where userID = #{userId}
     </update>
+    <update id="setSellerHome" parameterType="com.caimei365.user.model.po.ServiceProviderPo">
+        update serviceprovider
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="qrCode != null and qrCode != ''">qrCode = #{qrCode},</if>
+        </trim>
+        where userID = #{userId}
+    </update>
+    <update id="setSellerUserHome" >
+        update user
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="image != null and image != ''">image = #{image},</if>
+        </trim>
+        where userId = #{userId}
+    </update>
 
     <select id="findClubTemporary" resultType="com.caimei365.user.model.vo.ClubTemporaryVo">
         SELECT
@@ -104,7 +118,7 @@
     </select>
 
     <select id="findClubs" resultType="com.caimei365.user.model.vo.ClubVo">
-        select DISTINCT c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile,
+        select  c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile,
         c.contractEmail as contractEmail,
         c.contractPhone, c.linkMan, c.provinceID as proviceId, c.cityID as cityId, c.townID as townId,
         c.address, c.headpic as shopPhoto, c.businessLicenseImage as businessLicense, c.socialCreditCode,
@@ -114,12 +128,14 @@
         u.userIdentity,c.newDeal as newDeal,IF(r.id IS NOT NULL,1,0) AS recordCount,
         sp.name AS serviceName,
         covs.activeState AS activeState,
-        covs.customerValue AS customerValue
+        covs.customerValue AS customerValue,
+        cpr.createTime AS providerTime
         from club c
         left join user u on c.userID = u.userID
         LEFT JOIN record_link r ON r.`clubId`=c.`clubID`
         LEFT JOIN cm_organ_value_system covs ON covs.userID = u.userID
         LEFT JOIN serviceprovider sp ON c.spID = sp.serviceProviderID
+        LEFT JOIN cm_provider_record cpr ON cpr.spID = sp.serviceProviderID and cpr.clubId = c.clubId
         where
         <if test="1 == type">
             c.spID = #{serviceProviderId}
@@ -134,6 +150,64 @@
             r.clubId IS NOT NULL
             AND c.spId=1342
         </if>
+        <if test="4 == type">
+            c.spID = #{serviceProviderId}
+            AND sp.status = 90 and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
+            AND (u.loginTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) OR c.clubId in (select a.clubId
+            FROM ((
+            select
+            c.clubId,ccr.addTime AS time,c.spID
+            FROM club c
+            LEFT JOIN user u ON u.userID = c.userID
+            LEFT JOIN cm_club_remarks ccr ON ccr.clubId = c.clubId
+            LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
+            where c.status=90 and sp.status=90
+            and  ccr.addTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+            GROUP BY c.clubId
+            )UNION(
+            select c.clubId,cr.orderTime AS time,c.spID
+            FROM club c
+            LEFT JOIN user u ON u.userID = c.userID
+            LEFT JOIN cm_order cr ON cr.clubId = c.clubId
+            LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
+            where c.status=90 and sp.status=90
+            and  cr.orderTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+            GROUP BY c.clubId
+            )) a where a.time is not null
+            and  a.spID=#{serviceProviderId}
+            GROUP BY a.clubId))
+        </if>
+        <if test="5 == type">
+            c.spID = #{serviceProviderId}
+            AND sp.status = 90 and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
+            AND (u.loginTime <![CDATA[ < ]]> DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) or u.loginTime is null)and c.clubId not in (select a.clubId
+            FROM ((
+            select
+            c.clubId,ccr.addTime AS time,c.spID
+            FROM club c
+            LEFT JOIN user u ON u.userID = c.userID
+            LEFT JOIN cm_club_remarks ccr ON ccr.clubId = c.clubId
+            LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
+            where c.status=90 and sp.status=90
+            and  ccr.addTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+            GROUP BY c.clubId
+            )UNION(
+            select c.clubId,cr.orderTime AS time,c.spID
+            FROM club c
+            LEFT JOIN user u ON u.userID = c.userID
+            LEFT JOIN cm_order cr ON cr.clubId = c.clubId
+            LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
+            where c.status=90 and sp.status=90
+            and  cr.orderTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+            GROUP BY c.clubId
+            )) a where a.time is not null
+            and  a.spID=#{serviceProviderId}
+            GROUP BY a.clubId )
+        </if>
+        <if test="6 == type">
+            c.spID = #{serviceProviderId}
+            AND c.newDeal =1
+        </if>
         <if test="status != null and status != 66">
             AND c.status = #{status}
         </if>
@@ -147,7 +221,54 @@
             AND u.userIdentity = #{userIdentity}
         </if>
         AND covs.stage = 0 AND covs.delType = 1
-        order by c.clubID desc
+        group by c.clubID
+        order by cpr.createTime desc
+    </select>
+
+    <select id="findSpUserLoginSum" resultType="java.util.HashMap" parameterType="string">
+        select
+        COUNT(  CASE WHEN a.time=1 THEN 1 END) AS loginSum,
+        ((SELECT count(1) from club
+        WHERE  status=90
+        <if test="spID != null">
+            and  spID=#{spID}
+        </if>
+        )-COUNT(  CASE WHEN a.time=1 THEN 1 END)) AS not_loginSum
+        FROM (select a.*
+        FROM ((
+        select
+        c.clubId,1 AS time,c.spID
+        FROM club c
+        LEFT JOIN user u ON u.userID = c.userID
+        LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
+        where c.status=90 and sp.status=90 and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
+        and u.loginTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+        GROUP BY c.clubId
+        )UNION(
+        select
+        c.clubId,1 AS time,c.spID
+        FROM club c
+        LEFT JOIN user u ON u.userID = c.userID
+        LEFT JOIN cm_club_remarks ccr ON ccr.clubId = c.clubId
+        LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
+        where c.status=90 and sp.status=90 and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
+        and  ccr.addTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+        GROUP BY c.clubId
+        )UNION(
+        select c.clubId,1 AS time,c.spID
+        FROM club c
+        LEFT JOIN user u ON u.userID = c.userID
+        LEFT JOIN cm_order cr ON cr.clubId = c.clubId
+        LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
+        where c.status=90 and sp.status=90 and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
+        and  cr.orderTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+        GROUP BY c.clubId
+        )
+        ) a where  1=1
+        <if test="spID != null">
+            and  a.spID=#{spID}
+        </if>
+        GROUP BY a.clubId ) a
     </select>
     <select id="getAllClubList" resultType="com.caimei365.user.model.vo.ClubVo">
         SELECT DISTINCT c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile,
@@ -170,24 +291,27 @@
         </if>
     </select>
     <select id="getSellerByUserId" resultType="com.caimei365.user.model.po.ServiceProviderPo">
-        select serviceProviderID     AS serviceProviderId,
-               status,
-               userID                AS userId,
-               openid,
-               unionId,
-               name,
-               contractMobile,
-               linkMan,
-               duty,
-               contractEmail,
-               auditStatus,
-               auditTime,
-               auditNote,
-               validFlag,
-               addTime,
-               mainServiceProviderID AS mainServiceProviderId
-        from serviceprovider
-        where userID = #{userId}
+        select s.serviceProviderID     AS serviceProviderId,
+               s.status,
+               s.userID                AS userId,
+               s.openid,
+               s.unionId,
+               s.name,
+               s.contractMobile,
+               s.linkMan,
+               s.duty,
+               s.contractEmail,
+               s.auditStatus,
+               s.auditTime,
+               s.auditNote,
+               s.validFlag,
+               s.addTime,
+               s.qrCode,
+               u.image,
+               s.mainServiceProviderID AS mainServiceProviderId
+        from serviceprovider s
+        LEFT JOIN USER u ON s.userId = u.userId
+        where s.userID = #{userId}
     </select>
     <select id="findManager" resultType="java.lang.Integer">
         SELECT IF(csm.serviceProviderId IS NULL, 2, 1) AS manager
@@ -252,5 +376,67 @@
             </if>
         </where>
     </select>
-
+    <select id="getBehaviorRecordYesterdayPageLabel" resultType="string">
+        SELECT GROUP_CONCAT(a.pageLabel)
+        FROM (SELECT b.pageLabel
+        FROM cm_behavior_record b
+        LEFT JOIN club c ON b.userID = c.userID
+        WHERE b.userId !=0
+        and c.spId=#{spId}
+        <if test="clubId != null">
+            AND c.clubId =#{clubId}
+        </if>
+        and b.pageType in(6,8,11)
+        and  DATE(b.accessTime) = DATE(#{accessTime})
+        GROUP BY b.pageLabel LIMIT 10) as a
+    </select>
+    <select id="getBehaviorRecordYesterdayClubFrom" resultType="com.caimei365.user.model.vo.CmBehaviorRecordVo">
+        SELECT
+            b.recordID,
+            b.userID,
+            b.pagePath,
+            b.pageType,
+            b.pageLabel,
+            b.productID,
+            b.accessTime,
+            b.accessDuration,
+            b.accessDate,
+            b.referer,
+            b.accessClient,
+            b.isReckon,
+            b.region,
+            c.name,c.linkMan,c.contractMobile,c.clubId,u.image
+        FROM cm_behavior_record b
+        LEFT JOIN club c ON b.userID = c.userID
+        LEFT JOIN user u ON u.userID = c.userID
+        WHERE b.userId !=0
+        and c.spId=#{spId}
+        and c.clubId=#{clubId}
+        and b.pageType in(6,11)
+        and  DATE(b.accessTime) = DATE(#{accessTime})
+    </select>
+    <select id="getBehaviorRecordYesterdayClub" resultType="com.caimei365.user.model.vo.CmBehaviorRecordVo">
+        SELECT b.recordID,
+               b.userID,
+               b.pagePath,
+               b.pageType,
+               b.pageLabel,
+               b.productID,
+               b.accessTime,
+               b.accessDuration,
+               b.accessDate,
+               b.referer,
+               b.accessClient,
+               b.isReckon,
+               b.region,
+               c.name,c.linkMan,c.contractMobile,c.clubId,u.image
+        FROM cm_behavior_record b
+                 LEFT JOIN club c ON b.userID = c.userID
+                 LEFT JOIN user u ON u.userID = c.userID
+        WHERE b.userId !=0
+        and c.spId=#{spId}
+          and b.pageType in(6,8,11)
+          and  DATE(b.accessTime) = DATE(#{accessTime})
+        GROUP BY c.clubId
+    </select>
 </mapper>

+ 5 - 3
src/main/resources/mapper/ShopMapper.xml

@@ -180,15 +180,16 @@
         SELECT COUNT(*)
         FROM product p
         left join cm_organize_product_info copi on p.productID = copi.productId
-        WHERE shopID = #{shopId}
+        WHERE p.shopID = #{shopId} and copi.organizeId = #{productOrganize}
+        and p.groundMall LIKE concat('%',#{productOrganize},'%')
         <if test="validFlag != null">
-            AND validFlag = #{validFlag}
+            AND copi.validFlag = #{validFlag}
         </if>
     </select>
     <select id="getSalesRankingList" resultType="java.util.Map">
         SELECT cop.productID AS productId, SUM(cop.num) AS total
         FROM cm_order_product cop JOIN cm_order co ON co.orderID = cop.orderID
-        WHERE cop.shopID = #{shopId}
+        WHERE cop.shopID = #{shopId} and cop.organizeID = #{organizeId}
           AND co.STATUS NOT IN ('0', '6', '7')
           AND co.delFlag = '0'
           AND co.secondHandOrderFlag != '1'
@@ -210,6 +211,7 @@
         AND o.delFlag = '0'
         AND so.delFlag = '0'
         AND so.shopID = #{shopId}
+        AND so.organizeID = #{organizeId}
         AND o.secondHandOrderFlag != '1'
         <if test="startTime != null and startTime != ''">
             AND o.orderTime <![CDATA[  >=  ]]> #{startTime}

+ 23 - 0
src/test/java/com/caimei365/user/UserApplicationTests.java

@@ -8,6 +8,10 @@ import com.caimei365.user.service.LoginService;
 import com.caimei365.user.utils.AliyunSmsUtil;
 import com.caimei365.user.utils.CodeUtil;
 import com.caimei365.user.utils.ValidateUtil;
+import com.caimei365.user.utils.message.InsideMessage;
+import com.caimei365.user.utils.message.MessageModel;
+import com.caimei365.user.utils.message.MessageType;
+import com.caimei365.user.utils.message.MqInfo;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -15,16 +19,35 @@ import org.springframework.boot.test.context.SpringBootTest;
 import javax.annotation.Resource;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
 @SpringBootTest
 class UserApplicationTests {
+    @Resource
+    private ToolsFeign smsFeign;
     @Resource
     LoginService loginService;
     @Test
     void contextLoads() {
+
+//        //站内信
+//        MessageModel<InsideMessage> insideMessageMessageModel = new MessageModel<>();
+//        insideMessageMessageModel.code(MessageType.WEB_INSIDE_MESSAGE)
+//                .mqInfo(new MqInfo().topic("MessageLine").delay(1).async(0))
+//                .info(new InsideMessage()
+//                        .userType(3)
+//                        .messageType(3)
+//                        .shopTieredType(4)
+//                        .name("user.getUserName()")
+//                        .userName("user.getUserName()")
+//                        .mobile("164848989")
+//                        .thisId(4648)
+//                        .clubId(448)
+//                );
+//        smsFeign.sendCommonMessage(insideMessageMessageModel);
         /*List<Integer> listShopId = loginService.getMessageCenterListDay(1);
         System.out.println("-------->listShopId == "+listShopId.toString()+" <--------------");*/
 //        boolean b = ValidateUtil.validateEmail("182126@qq.com");