Просмотр исходного кода

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

zhijiezhao 2 лет назад
Родитель
Сommit
2cfa11d0f4
59 измененных файлов с 3536 добавлено и 498 удалено
  1. 6 0
      pom.xml
  2. 4 0
      src/main/java/com/caimei365/user/components/CommonService.java
  3. 145 39
      src/main/java/com/caimei365/user/components/WeChatService.java
  4. 35 9
      src/main/java/com/caimei365/user/controller/BaseApi.java
  5. 141 6
      src/main/java/com/caimei365/user/controller/ClubApi.java
  6. 37 0
      src/main/java/com/caimei365/user/controller/CmBehaviorRecordApi.java
  7. 30 2
      src/main/java/com/caimei365/user/controller/LoginApi.java
  8. 62 0
      src/main/java/com/caimei365/user/controller/RoosInformationApi.java
  9. 29 13
      src/main/java/com/caimei365/user/controller/SellerApi.java
  10. 2 0
      src/main/java/com/caimei365/user/controller/ShopApi.java
  11. 34 0
      src/main/java/com/caimei365/user/idempotent/IpSaveAspect.java
  12. 39 4
      src/main/java/com/caimei365/user/mapper/ClubMapper.java
  13. 65 0
      src/main/java/com/caimei365/user/mapper/ClubReportMapper.java
  14. 14 0
      src/main/java/com/caimei365/user/mapper/RegisterMapper.java
  15. 40 0
      src/main/java/com/caimei365/user/mapper/RoosInformationMapper.java
  16. 16 1
      src/main/java/com/caimei365/user/mapper/SellerMapper.java
  17. 46 0
      src/main/java/com/caimei365/user/model/dto/BehaviorRecordDto.java
  18. 5 0
      src/main/java/com/caimei365/user/model/dto/ClubOnlineDto.java
  19. 4 0
      src/main/java/com/caimei365/user/model/dto/ClubUpdateDto.java
  20. 5 0
      src/main/java/com/caimei365/user/model/dto/ClubUpgradeDto.java
  21. 51 0
      src/main/java/com/caimei365/user/model/dto/LoginCodeDto.java
  22. 34 0
      src/main/java/com/caimei365/user/model/dto/RoosInformationDto.java
  23. 13 0
      src/main/java/com/caimei365/user/model/dto/ScanBindDto.java
  24. 18 0
      src/main/java/com/caimei365/user/model/dto/ShopUpdateDto.java
  25. 4 0
      src/main/java/com/caimei365/user/model/po/ClubPo.java
  26. 9 0
      src/main/java/com/caimei365/user/model/po/ClubRemarksPo.java
  27. 4 0
      src/main/java/com/caimei365/user/model/po/UserPo.java
  28. 35 0
      src/main/java/com/caimei365/user/model/vo/ClubChangeSpVo.java
  29. 49 0
      src/main/java/com/caimei365/user/model/vo/ClubVo.java
  30. 4 0
      src/main/java/com/caimei365/user/model/vo/ProductItemVo.java
  31. 36 0
      src/main/java/com/caimei365/user/model/vo/RemarkVo.java
  32. 37 0
      src/main/java/com/caimei365/user/model/vo/RemarksVo.java
  33. 56 0
      src/main/java/com/caimei365/user/model/vo/ReportVo.java
  34. 37 0
      src/main/java/com/caimei365/user/model/vo/VisitRemarkVo.java
  35. 38 0
      src/main/java/com/caimei365/user/model/vo/VisitorRemarkVo.java
  36. 15 1
      src/main/java/com/caimei365/user/service/BaseService.java
  37. 57 2
      src/main/java/com/caimei365/user/service/ClubService.java
  38. 21 0
      src/main/java/com/caimei365/user/service/LoginService.java
  39. 40 0
      src/main/java/com/caimei365/user/service/RoosInformationService.java
  40. 9 1
      src/main/java/com/caimei365/user/service/SellerService.java
  41. 49 1
      src/main/java/com/caimei365/user/service/impl/AsyncService.java
  42. 109 5
      src/main/java/com/caimei365/user/service/impl/BaseServiceImpl.java
  43. 558 91
      src/main/java/com/caimei365/user/service/impl/ClubServiceImpl.java
  44. 183 91
      src/main/java/com/caimei365/user/service/impl/LoginServiceImpl.java
  45. 10 11
      src/main/java/com/caimei365/user/service/impl/OperationServiceImpl.java
  46. 55 43
      src/main/java/com/caimei365/user/service/impl/RegisterServiceImpl.java
  47. 2 0
      src/main/java/com/caimei365/user/service/impl/RemoteCallServiceImpl.java
  48. 118 0
      src/main/java/com/caimei365/user/service/impl/RoosInformationServiceImpl.java
  49. 55 4
      src/main/java/com/caimei365/user/service/impl/SellerServiceImpl.java
  50. 1 0
      src/main/java/com/caimei365/user/service/impl/ShopServiceImpl.java
  51. 59 0
      src/main/java/com/caimei365/user/utils/IpUtil.java
  52. 9 6
      src/main/resources/mapper/BaseMapper.xml
  53. 345 72
      src/main/resources/mapper/ClubMapper.xml
  54. 409 0
      src/main/resources/mapper/ClubReport.xml
  55. 18 6
      src/main/resources/mapper/RegisterMapper.xml
  56. 48 0
      src/main/resources/mapper/RoosInformationMapper.xml
  57. 163 81
      src/main/resources/mapper/SellerMapper.xml
  58. 12 3
      src/main/resources/mapper/ShopMapper.xml
  59. 7 6
      src/main/resources/mapper/SuperVipMapper.xml

+ 6 - 0
pom.xml

@@ -35,6 +35,12 @@
             <artifactId>spring-cloud-starter-openfeign</artifactId>
             <artifactId>spring-cloud-starter-openfeign</artifactId>
         </dependency>
         </dependency>
 
 
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>4.1.14</version>
+        </dependency>
+
         <dependency>
         <dependency>
 			<groupId>org.springframework.boot</groupId>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-web</artifactId>
 			<artifactId>spring-boot-starter-web</artifactId>

+ 4 - 0
src/main/java/com/caimei365/user/components/CommonService.java

@@ -63,6 +63,7 @@ public class CommonService {
             if ("dev".equals(profile) || "beta".equals(profile)){
             if ("dev".equals(profile) || "beta".equals(profile)){
                 redisSmsCode = (null != redisSmsCode && !"null".equals(redisSmsCode) ? redisSmsCode : "666666");
                 redisSmsCode = (null != redisSmsCode && !"null".equals(redisSmsCode) ? redisSmsCode : "666666");
             }
             }
+            log.info("手机验证码校验" + smsCode.equals(redisSmsCode));
             if (!smsCode.equals(redisSmsCode)) {
             if (!smsCode.equals(redisSmsCode)) {
                 return "手机验证码错误";
                 return "手机验证码错误";
             }
             }
@@ -104,6 +105,9 @@ public class CommonService {
     public String operationBindCheck(String mobile, String smsCode) {
     public String operationBindCheck(String mobile, String smsCode) {
         // 手机号验证
         // 手机号验证
         String result = mobileAndCodeValidate(mobile, smsCode);
         String result = mobileAndCodeValidate(mobile, smsCode);
+        if ("手机验证码错误".equals(result)) {
+            return result;
+        }
         if (result != null) {
         if (result != null) {
             // 查询使用该手机号的运营人员或用户
             // 查询使用该手机号的运营人员或用户
             UserLoginVo dbUser = loginMapper.getLoginUserByMobile(mobile);
             UserLoginVo dbUser = loginMapper.getLoginUserByMobile(mobile);

+ 145 - 39
src/main/java/com/caimei365/user/components/WeChatService.java

@@ -1,5 +1,7 @@
 package com.caimei365.user.components;
 package com.caimei365.user.components;
 
 
+import cn.hutool.http.HttpRequest;
+import cn.hutool.http.HttpUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.ResponseJson;
@@ -15,6 +17,8 @@ import org.springframework.stereotype.Component;
 import javax.crypto.Cipher;
 import javax.crypto.Cipher;
 import javax.crypto.spec.IvParameterSpec;
 import javax.crypto.spec.IvParameterSpec;
 import javax.crypto.spec.SecretKeySpec;
 import javax.crypto.spec.SecretKeySpec;
+import java.io.IOException;
+import java.net.URLDecoder;
 import java.security.AlgorithmParameters;
 import java.security.AlgorithmParameters;
 import java.security.Security;
 import java.security.Security;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
@@ -300,15 +304,16 @@ public class WeChatService {
 
 
     /**
     /**
      * 购买会员消息推送
      * 购买会员消息推送
+     *
      * @param accessToken 微信公众号
      * @param accessToken 微信公众号
-     * @param openid 公众号的openid
-     * @param title 标题
-     * @param name 商品名称
-     * @param money 金额
-     * @param remarkText 备注
-     * @param pagePath 跳转链接
+     * @param openid      公众号的openid
+     * @param title       标题
+     * @param name        商品名称
+     * @param money       金额
+     * @param remarkText  备注
+     * @param pagePath    跳转链接
      */
      */
-    public void sendTemplateMsgs(String accessToken, String openid, String title, String name, Double money, String date,String remarkText, String pagePath) {
+    public void sendTemplateMsgs(String accessToken, String openid, String title, String name, Double money, String date, String remarkText, String pagePath) {
         JSONObject first = new JSONObject();
         JSONObject first = new JSONObject();
         first.put("value", title);
         first.put("value", title);
         JSONObject keyword1 = new JSONObject();
         JSONObject keyword1 = new JSONObject();
@@ -332,9 +337,9 @@ public class WeChatService {
         miniProgram.put("pagepath", pagePath);
         miniProgram.put("pagepath", pagePath);
 
 
         JSONObject json = new JSONObject(new LinkedHashMap());
         JSONObject json = new JSONObject(new LinkedHashMap());
-        json.put("touser",openid);
-        json.put("template_id","Sj5QEHxYrXMOvkY0t7ptj_6LJvBE6H4O-N0TRS3l3tc");
-        json.put("url","https://www.caimei365.com/");
+        json.put("touser", openid);
+        json.put("template_id", "Sj5QEHxYrXMOvkY0t7ptj_6LJvBE6H4O-N0TRS3l3tc");
+        json.put("url", "https://www.caimei365.com/");
         json.put("miniprogram", miniProgram);
         json.put("miniprogram", miniProgram);
         json.put("data", data);
         json.put("data", data);
         // json 字符串
         // json 字符串
@@ -343,7 +348,7 @@ public class WeChatService {
         try {
         try {
             // https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN
             // https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN
 //            String requestUrl =  "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token="+accessToken;
 //            String requestUrl =  "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token="+accessToken;
-            String requestUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+accessToken;
+            String requestUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken;
             // 发送请求
             // 发送请求
             String result = RequestUtil.httpRequest(requestUrl, "POST", jsonString);
             String result = RequestUtil.httpRequest(requestUrl, "POST", jsonString);
             log.info(">>>>>>>>推送结果:" + result);
             log.info(">>>>>>>>推送结果:" + result);
@@ -354,16 +359,17 @@ public class WeChatService {
 
 
     /**
     /**
      * 续费会员消息推送
      * 续费会员消息推送
+     *
      * @param accessToken 微信公众号
      * @param accessToken 微信公众号
-     * @param openid 公众号的openid
-     * @param title 标题
-     * @param name 商品名称
-     * @param remarkText 备注
-     * @param pagePath 跳转链接
+     * @param openid      公众号的openid
+     * @param title       标题
+     * @param name        商品名称
+     * @param remarkText  备注
+     * @param pagePath    跳转链接
      */
      */
-    public void sendTemplateMsg(String accessToken, String openid,String date,String remarkText, String pagePath) {
+    public void sendTemplateMsg(String accessToken, String openid, String date, String remarkText, String pagePath) {
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-        Date dat=new Date();
+        Date dat = new Date();
         JSONObject first = new JSONObject();
         JSONObject first = new JSONObject();
         first.put("value", "恭喜您成功续费采美超级会员");
         first.put("value", "恭喜您成功续费采美超级会员");
         JSONObject keyword1 = new JSONObject();
         JSONObject keyword1 = new JSONObject();
@@ -384,9 +390,9 @@ public class WeChatService {
         miniProgram.put("pagepath", pagePath);
         miniProgram.put("pagepath", pagePath);
 
 
         JSONObject json = new JSONObject(new LinkedHashMap());
         JSONObject json = new JSONObject(new LinkedHashMap());
-        json.put("touser",openid);
-        json.put("template_id","QHsM0AhlgGaX6kJ6vFm1wAKIkNjnZdWPjFGOKopLbsM");
-        json.put("url","https://www.caimei365.com/");
+        json.put("touser", openid);
+        json.put("template_id", "QHsM0AhlgGaX6kJ6vFm1wAKIkNjnZdWPjFGOKopLbsM");
+        json.put("url", "https://www.caimei365.com/");
         json.put("miniprogram", miniProgram);
         json.put("miniprogram", miniProgram);
         json.put("data", data);
         json.put("data", data);
         // json 字符串
         // json 字符串
@@ -395,7 +401,7 @@ public class WeChatService {
         try {
         try {
             // https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN
             // https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN
 //            String requestUrl =  "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token="+accessToken;
 //            String requestUrl =  "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token="+accessToken;
-            String requestUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+accessToken;
+            String requestUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken;
             // 发送请求
             // 发送请求
             String result = RequestUtil.httpRequest(requestUrl, "POST", jsonString);
             String result = RequestUtil.httpRequest(requestUrl, "POST", jsonString);
             log.info(">>>>>>>>推送结果:" + result);
             log.info(">>>>>>>>推送结果:" + result);
@@ -406,12 +412,13 @@ public class WeChatService {
 
 
     /**
     /**
      * 续费会员消息推送
      * 续费会员消息推送
+     *
      * @param accessToken 微信公众号
      * @param accessToken 微信公众号
-     * @param openid 公众号的openid
-     * @param remarkText 备注
-     * @param pagePath 跳转链接
+     * @param openid      公众号的openid
+     * @param remarkText  备注
+     * @param pagePath    跳转链接
      */
      */
-    public void sendTemplateMessg(String accessToken, String openid, String nickName,String time,String remarkText, String pagePath) {
+    public void sendTemplateMessg(String accessToken, String openid, String nickName, String time, String remarkText, String pagePath) {
         JSONObject first = new JSONObject();
         JSONObject first = new JSONObject();
         first.put("value", "绑定成功提醒");
         first.put("value", "绑定成功提醒");
         JSONObject keyword1 = new JSONObject();
         JSONObject keyword1 = new JSONObject();
@@ -435,9 +442,9 @@ public class WeChatService {
         miniProgram.put("pagepath", pagePath);
         miniProgram.put("pagepath", pagePath);
 
 
         JSONObject json = new JSONObject(new LinkedHashMap());
         JSONObject json = new JSONObject(new LinkedHashMap());
-        json.put("touser",openid);
-        json.put("template_id","ph3XjF5o2QPuANQW2XlO7PRYU7Y9t-3fAX5TSqwTftk");
-        json.put("url","https://www.caimei365.com/");
+        json.put("touser", openid);
+        json.put("template_id", "ph3XjF5o2QPuANQW2XlO7PRYU7Y9t-3fAX5TSqwTftk");
+        json.put("url", "https://www.caimei365.com/");
         json.put("miniprogram", miniProgram);
         json.put("miniprogram", miniProgram);
         json.put("data", data);
         json.put("data", data);
         // json 字符串
         // json 字符串
@@ -446,7 +453,7 @@ public class WeChatService {
         try {
         try {
             // https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN
             // https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN
 //            String requestUrl =  "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token="+accessToken;
 //            String requestUrl =  "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token="+accessToken;
-            String requestUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+accessToken;
+            String requestUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken;
             // 发送请求
             // 发送请求
             String result = RequestUtil.httpRequest(requestUrl, "POST", jsonString);
             String result = RequestUtil.httpRequest(requestUrl, "POST", jsonString);
             log.info(">>>>>>>>推送结果:" + result);
             log.info(">>>>>>>>推送结果:" + result);
@@ -458,16 +465,17 @@ public class WeChatService {
 
 
     /**
     /**
      * 上架费消息推送
      * 上架费消息推送
+     *
      * @param accessToken 微信公众号
      * @param accessToken 微信公众号
-     * @param openid 公众号的openid
-     * @param remarkText 备注
-     * @param pagePath 跳转链接
+     * @param openid      公众号的openid
+     * @param remarkText  备注
+     * @param pagePath    跳转链接
      */
      */
-    public void sendTemplate(String accessToken, String openid, String date, String newTime,String endTime,Double money,String remarkText, String pagePath) {
+    public void sendTemplate(String accessToken, String openid, String date, String newTime, String endTime, Double money, String remarkText, String pagePath) {
         JSONObject first = new JSONObject();
         JSONObject first = new JSONObject();
         first.put("value", "维护费到期提醒");
         first.put("value", "维护费到期提醒");
         JSONObject keyword1 = new JSONObject();
         JSONObject keyword1 = new JSONObject();
-        keyword1.put("value", "尊敬的采美供应商用户,您的账号维护费用"+date+"天后即将到期!");
+        keyword1.put("value", "尊敬的采美供应商用户,您的账号维护费用" + date + "天后即将到期!");
         JSONObject keyword2 = new JSONObject();
         JSONObject keyword2 = new JSONObject();
         keyword2.put("value", "维护费");
         keyword2.put("value", "维护费");
         JSONObject keyword3 = new JSONObject();
         JSONObject keyword3 = new JSONObject();
@@ -496,9 +504,9 @@ public class WeChatService {
         miniProgram.put("pagepath", pagePath);
         miniProgram.put("pagepath", pagePath);
 
 
         JSONObject json = new JSONObject(new LinkedHashMap());
         JSONObject json = new JSONObject(new LinkedHashMap());
-        json.put("touser",openid);
-        json.put("template_id","jYUIq63wP6mGFvkgNHgTOXAgF7j6h_VZKgST_-2fqCo");
-        json.put("url","https://www.caimei365.com/");
+        json.put("touser", openid);
+        json.put("template_id", "jYUIq63wP6mGFvkgNHgTOXAgF7j6h_VZKgST_-2fqCo");
+        json.put("url", "https://www.caimei365.com/");
         json.put("miniprogram", miniProgram);
         json.put("miniprogram", miniProgram);
         json.put("data", data);
         json.put("data", data);
         // json 字符串
         // json 字符串
@@ -507,7 +515,7 @@ public class WeChatService {
         try {
         try {
             // https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN
             // https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN
 //            String requestUrl =  "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token="+accessToken;
 //            String requestUrl =  "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token="+accessToken;
-            String requestUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token="+accessToken;
+            String requestUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken;
             // 发送请求
             // 发送请求
             String result = RequestUtil.httpRequest(requestUrl, "POST", jsonString);
             String result = RequestUtil.httpRequest(requestUrl, "POST", jsonString);
             log.info(">>>>>>>>推送结果:" + result);
             log.info(">>>>>>>>推送结果:" + result);
@@ -516,9 +524,107 @@ public class WeChatService {
         }
         }
     }
     }
 
 
+    /**
+     * 分配协销消息
+     *
+     * @param title      消息抬头
+     * @param keyWord1
+     * @param keyWord2
+     * @param keyWord3
+     * @param keyWord4
+     * @param Remark     消息下备注
+     * @param path       跳转链接
+     * @param openId     公众号openId
+     * @param templateId 模板Id
+     */
+    public void sendChoseServiceMessage(String title, String keyWord1, String keyWord2, String keyWord3, String keyWord4, String Remark, String path, String openId, String templateId) {
+        JSONObject first = new JSONObject();
+        first.put("value", title);
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", keyWord1);
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", keyWord2);
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", keyWord3);
+        JSONObject keyword4 = new JSONObject();
+        keyword4.put("value", keyWord4);
+        JSONObject remark = new JSONObject();
+        remark.put("value", Remark);
 
 
+        JSONObject data = new JSONObject();
+        data.put("first", first);
+        data.put("keyword1", keyword1);
+        data.put("keyword2", keyword2);
+        data.put("keyword3", keyword3);
+        data.put("keyword4", keyword4);
+        data.put("remark", remark);
 
 
+        JSONObject miniProgram = new JSONObject();
+        miniProgram.put("appid", miniAppId);
+        miniProgram.put("pagepath", path);
 
 
+        JSONObject json = new JSONObject(new LinkedHashMap());
+        json.put("touser", openId);
+        json.put("template_id", templateId);
+        json.put("url", "https://www.caimei365.com/");
+        json.put("miniprogram", miniProgram);
+        json.put("data", data);
+        // json 字符串
+        String jsonString = json.toJSONString();
+        log.info(">>>>>>>>推送微信模板消息:" + jsonString);
+        try {
+            String requestUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + getAccessToken();
+            // 发送请求
+            String result = RequestUtil.httpRequest(requestUrl, "POST", jsonString);
+            log.info(">>>>>>>>推送结果:" + result);
+        } catch (Exception e) {
+            log.info("推送微信模板消息失败:" + e);
+        }
+    }
+
+    /**
+     * 获取微信urlscheme
+     *
+     * @param path
+     * @param query
+     * @return
+     */
+    public ResponseJson getOpenLink(String path, String query, String env) {
+        String token = null;
+        try {
+            String link = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
+            link = link.replace("APPID", miniAppId);
+            link = link.replace("APPSECRET", miniAppSecret);
+            String result = RequestUtil.sendGet(link);
+            log.info("微信公众号获取access_token>>>" + result);
+            Map<String, Object> map = JSONObject.parseObject(result, Map.class);
+            token = (String) map.get("access_token");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        String url = "https://api.weixin.qq.com/wxa/generatescheme?access_token=" + token;
+        JSONObject jumpWxa = new JSONObject();
+        jumpWxa.put("path", path);
+        jumpWxa.put("query", query);
+        //正式版为"release",体验版为"trial",开发版为"develop"
+        jumpWxa.put("env_version", env);
+
+        JSONObject reqMap = new JSONObject();
+        reqMap.put("jump_wxa", jumpWxa);
+        String result = "";
+        try {
+            HttpRequest request = HttpUtil.createPost(url);
+            request.contentType("application/json");
+            request.body(reqMap.toJSONString());
+            result = request.execute().body();
+            result = URLDecoder.decode(result, "UTF-8");
+            log.info("微信获取getOpenLink回调报文" + result);
+            result = JSONObject.parseObject(result).getString("openlink");
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return ResponseJson.success(result);
+    }
 
 
 
 
 }
 }

+ 35 - 9
src/main/java/com/caimei365/user/controller/BaseApi.java

@@ -1,6 +1,7 @@
 package com.caimei365.user.controller;
 package com.caimei365.user.controller;
 
 
 import com.aliyuncs.exceptions.ClientException;
 import com.aliyuncs.exceptions.ClientException;
+import com.caimei365.user.components.WeChatService;
 import com.caimei365.user.idempotent.IpSave;
 import com.caimei365.user.idempotent.IpSave;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.MobileDto;
 import com.caimei365.user.model.dto.MobileDto;
@@ -28,6 +29,7 @@ import java.util.Map;
 public class BaseApi {
 public class BaseApi {
 
 
     private final BaseService baseService;
     private final BaseService baseService;
+    private final WeChatService weChatService;
     @Value(value = "${swagger.enabled}")
     @Value(value = "${swagger.enabled}")
     private Boolean swaggerEnabled;
     private Boolean swaggerEnabled;
 
 
@@ -56,7 +58,7 @@ public class BaseApi {
      */
      */
     @ApiOperation("获取图片验证码")
     @ApiOperation("获取图片验证码")
     @ApiImplicitParam(required = true, name = "platformType", value = "0:www,1:crm/h5,2:小程序")
     @ApiImplicitParam(required = true, name = "platformType", value = "0:www,1:crm/h5,2:小程序")
-    @IpSave(saveName = "获取图片验证码",saveParams = false)
+    @IpSave(saveName = "获取图片验证码", saveParams = false)
     @GetMapping("/captcha")
     @GetMapping("/captcha")
     public ResponseJson<Map<String, Object>> getCaptchaImage(Integer platformType) {
     public ResponseJson<Map<String, Object>> getCaptchaImage(Integer platformType) {
         return baseService.getCaptchaImage(platformType);
         return baseService.getCaptchaImage(platformType);
@@ -84,7 +86,7 @@ public class BaseApi {
             @ApiImplicitParam(required = false, name = "token", value = "图片token")
             @ApiImplicitParam(required = false, name = "token", value = "图片token")
 
 
     })
     })
-    @IpSave(saveName = "获取短信验证码",saveParams = true)
+    @IpSave(saveName = "获取短信验证码", saveParams = true)
     @GetMapping("/sms/code")
     @GetMapping("/sms/code")
     public ResponseJson getSmsCode(String mobile, Integer activateCodeType, Integer platformType, Integer isCheckCaptcha, String imgCode, String token) {
     public ResponseJson getSmsCode(String mobile, Integer activateCodeType, Integer platformType, Integer isCheckCaptcha, String imgCode, String token) {
         return baseService.getSmsCode(mobile, activateCodeType, platformType, isCheckCaptcha, imgCode, token);
         return baseService.getSmsCode(mobile, activateCodeType, platformType, isCheckCaptcha, imgCode, token);
@@ -113,7 +115,7 @@ public class BaseApi {
             @ApiImplicitParam(required = false, name = "imgCode", value = "图片验证码"),
             @ApiImplicitParam(required = false, name = "imgCode", value = "图片验证码"),
             @ApiImplicitParam(required = false, name = "token", value = "图片token")
             @ApiImplicitParam(required = false, name = "token", value = "图片token")
     })
     })
-    @IpSave(saveName = "绑定账号,发送短信验证",saveParams = true)
+    @IpSave(saveName = "绑定账号,发送短信验证", saveParams = true)
     @GetMapping("/sms/bind")
     @GetMapping("/sms/bind")
     public ResponseJson getBindSmsCode(String mobile, String bindMobile, Integer userId, Integer platformType, Integer isCheckCaptcha, String imgCode, String token) {
     public ResponseJson getBindSmsCode(String mobile, String bindMobile, Integer userId, Integer platformType, Integer isCheckCaptcha, String imgCode, String token) {
         return baseService.getBindSmsCode(mobile, bindMobile, userId, platformType, isCheckCaptcha, imgCode, token);
         return baseService.getBindSmsCode(mobile, bindMobile, userId, platformType, isCheckCaptcha, imgCode, token);
@@ -136,6 +138,24 @@ public class BaseApi {
         return baseService.getEmailCode(email, status);
         return baseService.getEmailCode(email, status);
     }
     }
 
 
+    /**
+     * 获取登录验证码
+     * @param mobile 输入手机号
+     * @return
+     */
+    @ApiOperation("获取登录验证码")
+    @GetMapping("/login/code")
+    public ResponseJson loginSmsCode(String mobile) { return baseService.getLoginCode(mobile);}
+
+    /**
+     * 获取绑定运营人员验证码
+     * @param mobile 输入手机号
+     * @return
+     */
+    @ApiOperation("获取绑定运营人员验证码")
+    @GetMapping("/operate/code")
+    public ResponseJson operateSmsCode(String mobile) { return baseService.operateSmsCode(mobile);}
+
     /**
     /**
      * 修改密码(找回密码)
      * 修改密码(找回密码)
      *
      *
@@ -148,7 +168,7 @@ public class BaseApi {
      *                    }
      *                    }
      */
      */
     @ApiOperation("修改密码(旧:/user/findCompanyPwd)")
     @ApiOperation("修改密码(旧:/user/findCompanyPwd)")
-    @IpSave(saveName = "修改密码",saveParams = true)
+    @IpSave(saveName = "修改密码", saveParams = true)
     @PostMapping("/update/password")
     @PostMapping("/update/password")
     public ResponseJson updatePassword(PasswordDto passwordDto) {
     public ResponseJson updatePassword(PasswordDto passwordDto) {
         return baseService.updatePassword(passwordDto);
         return baseService.updatePassword(passwordDto);
@@ -183,19 +203,19 @@ public class BaseApi {
     }
     }
 
 
     @ApiOperation("超级会员会员中心")
     @ApiOperation("超级会员会员中心")
-    @IpSave(saveName = "超级会员中心",saveParams = true)
+    @IpSave(saveName = "超级会员中心", saveParams = true)
     @GetMapping("/super/center")
     @GetMapping("/super/center")
-    public ResponseJson<Map<String, Object>> superCenter(Integer userId,Integer source) {
+    public ResponseJson<Map<String, Object>> superCenter(Integer userId, Integer source) {
         if (null == userId) {
         if (null == userId) {
             return ResponseJson.error("参数异常:用户Id不能为空!", null);
             return ResponseJson.error("参数异常:用户Id不能为空!", null);
         }
         }
-        return baseService.superCenter(userId,source);
+        return baseService.superCenter(userId, source);
     }
     }
 
 
     @ApiOperation("超级会员套餐详情")
     @ApiOperation("超级会员套餐详情")
-    @IpSave(saveName = "超级会员套餐详情",saveParams = false)
+    @IpSave(saveName = "超级会员套餐详情", saveParams = false)
     @GetMapping("/super/package")
     @GetMapping("/super/package")
-    public ResponseJson findPackage(){
+    public ResponseJson findPackage() {
         return baseService.findPackage();
         return baseService.findPackage();
     }
     }
 
 
@@ -204,4 +224,10 @@ public class BaseApi {
     public ResponseJson<HashMap<String, String>> ossTokenGet() throws ClientException {
     public ResponseJson<HashMap<String, String>> ossTokenGet() throws ClientException {
         return baseService.ossTokenGet();
         return baseService.ossTokenGet();
     }
     }
+
+    @ApiOperation("获取微信跳转url")
+    @GetMapping("/wechat/link")
+    public ResponseJson getWechatLink(String path, String query, String env) {
+        return weChatService.getOpenLink(path, query, env);
+    }
 }
 }

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

@@ -14,6 +14,7 @@ import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
+import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
 
 
@@ -174,17 +175,17 @@ public class ClubApi {
                                                                Integer satisfied,
                                                                Integer satisfied,
                                                                Integer followup,
                                                                Integer followup,
                                                                String extra,
                                                                String extra,
-                                                               Integer groupId,
+                                                               Integer groupId, Integer status, Integer newDeal,
                                                                @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                                @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                                @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
                                                                @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
-        return clubService.getRemarksList(serviceProviderId, keyWord, startAddTime, endAddTime, consult, leaderId, manager, clubType, pinceSensitve, satisfied, followup, extra, groupId, pageNum, pageSize);
+        return clubService.getRemarksList(serviceProviderId, keyWord, startAddTime, endAddTime, consult, leaderId, manager, clubType, pinceSensitve, satisfied, followup, extra, groupId, status, newDeal, pageNum, pageSize);
     }
     }
 
 
     @ApiOperation("关键词库联想查询")
     @ApiOperation("关键词库联想查询")
     @ApiImplicitParam(required = true, name = "remarks", value = "联想词")
     @ApiImplicitParam(required = true, name = "remarks", value = "联想词")
     @GetMapping("/remarks/cmremarkslist")
     @GetMapping("/remarks/cmremarkslist")
     public ResponseJson getCmRemarksList(String remarks) {
     public ResponseJson getCmRemarksList(String remarks) {
-        if (null == remarks || remarks=="") {
+        if (null == remarks || remarks == "") {
             return ResponseJson.error("参数异常,关键词不能为空!", null);
             return ResponseJson.error("参数异常,关键词不能为空!", null);
         }
         }
         return clubService.getCmRemarksList(remarks);
         return clubService.getCmRemarksList(remarks);
@@ -214,6 +215,115 @@ public class ClubApi {
         return clubService.saveClubRemarks(jsonParamsDto);
         return clubService.saveClubRemarks(jsonParamsDto);
     }
     }
 
 
+    @ApiOperation("注册机构报备列表")
+    @GetMapping("/report/List")
+    public ResponseJson<PaginationVo<ReportVo>> ClubReportList(Integer serviceProviderId, Integer clubId, String keyWord, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+        return clubService.ClubReportList(serviceProviderId, clubId, keyWord, pageNum, pageSize);
+    }
+
+    @ApiOperation("未注册机构报备列表")
+    @GetMapping("/report/visitor/List")
+    public ResponseJson<PaginationVo<ReportVo>> visitorReportList(String questionManId, String keyWord, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+        return clubService.visitorReportList(questionManId, keyWord, pageNum, pageSize);
+    }
+
+
+    @ApiOperation("报备详情")
+    @GetMapping("/report/details")
+    public ResponseJson<ReportVo> ClubReportList(Integer reportId) {
+        return clubService.reportDetailsList(reportId);
+    }
+
+    @ApiOperation("未确认机构报备详情")
+    @GetMapping("/report/visitor/details")
+    public ResponseJson<ReportVo> visitorReportList(Integer reportId) {
+        return clubService.visitorReportsList(reportId);
+    }
+
+
+    @ApiOperation("新建机构报备")
+    @PostMapping("/report/save")
+    public ResponseJson saveClubReport(ReportVo reportVo) {
+        return clubService.saveClubReport(reportVo);
+    }
+
+    @ApiOperation("未机构新建报备")
+    @PostMapping("/report/visitor/save")
+    public ResponseJson addVisitorReport(ReportVo reportVo) {
+        return clubService.addVisitorReport(reportVo);
+    }
+
+
+    @ApiOperation("咨询/报备关联商品")
+    @GetMapping("/report/productList")
+    public ResponseJson<PaginationVo<ProductItemVo>> getproductList(String keyWord, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+        return clubService.getproductList(keyWord, pageNum, pageSize);
+    }
+
+    @ApiOperation("机构报备列表")
+    @GetMapping("/report/reportRemarks")
+    public ResponseJson<PaginationVo<ReportVo>> reportRemarks(Integer manager, Integer serviceProviderId, String keyWord, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+
+        return clubService.reportRemarks(manager, serviceProviderId, keyWord, pageNum, pageSize);
+    }
+
+    @ApiOperation("未注册机构报备列表")
+    @GetMapping("/report/visitor/reportRemarks")
+    public ResponseJson<PaginationVo<ReportVo>> visitorReportRemarks(Integer manager, Integer serviceProviderId, String keyWord, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+
+        return clubService.visitorReportRemarks(manager, serviceProviderId, keyWord, pageNum, pageSize);
+    }
+
+    @ApiOperation("关联咨询记录列表")
+    @GetMapping("/report/associatedList")
+    public ResponseJson<PaginationVo<RemarkVo>> associated(Integer manager, Integer serviceProviderId, Integer reportId, String keyWord, String startAddTime,
+                                                           String endAddTime,
+                                                           String consult,
+                                                           Integer leaderId,
+                                                           String clubType,
+                                                           Integer pinceSensitve,
+                                                           Integer satisfied,
+                                                           Integer followup,
+                                                           String extra,
+                                                           Integer groupId, Integer newDeal, Integer status, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+        return clubService.associated(manager, serviceProviderId, reportId, keyWord, startAddTime, endAddTime, consult, leaderId, clubType, pinceSensitve, satisfied, followup, extra, groupId, newDeal, status, pageNum, pageSize);
+    }
+
+    @ApiOperation("未注册关联咨询记录列表")
+    @GetMapping("/report/visitor/associatedList")
+    public ResponseJson<PaginationVo<RemarkVo>> visitorAssociated(Integer manager, Integer serviceProviderId, Integer reportId, String keyWord, String startAddTime,
+                                                                  String endAddTime,
+                                                                  String consult,
+                                                                  Integer leaderId,
+                                                                  String clubType,
+                                                                  Integer pinceSensitve,
+                                                                  Integer satisfied,
+                                                                  Integer followup,
+                                                                  String extra,
+                                                                  Integer groupId, Integer status, @RequestParam(value = "pageNum", defaultValue = "1") int pageNum, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+        return clubService.visitorAssociated(manager, serviceProviderId, reportId, keyWord, startAddTime, endAddTime, consult, leaderId, clubType, pinceSensitve, satisfied, followup, extra, groupId, status, pageNum, pageSize);
+    }
+
+
+    @ApiOperation("取消咨询记录和报备的关联")
+    @GetMapping("/report/disassociation")
+    public ResponseJson<PaginationVo<RemarksVo>> disassociation(Integer remarksId) {
+        return clubService.disassociation(remarksId);
+    }
+
+    @ApiOperation("未注册机构取消咨询记录和报备的关联")
+    @GetMapping("/report/visitor/disassociation")
+    public ResponseJson<PaginationVo<RemarksVo>> visitorDisassociation(Integer remarksId) {
+        return clubService.visitorDisassociation(remarksId);
+    }
+
+    @ApiOperation("删除机构报备")
+    @PostMapping("/report/delete")
+    public ResponseJson deleteReport(Integer reportId) {
+        return clubService.deleteReport(reportId);
+    }
+
+
     @ApiOperation("删除机构资料备注")
     @ApiOperation("删除机构资料备注")
     @ApiImplicitParam(required = true, name = "remarksId", value = "机构id")
     @ApiImplicitParam(required = true, name = "remarksId", value = "机构id")
     @PostMapping("/remarks/delete")
     @PostMapping("/remarks/delete")
@@ -221,6 +331,7 @@ public class ClubApi {
         return clubService.deleteClubRemarks(clubRemarksDto.getRemarksId());
         return clubService.deleteClubRemarks(clubRemarksDto.getRemarksId());
     }
     }
 
 
+
     /**
     /**
      * 机构个人中心数据
      * 机构个人中心数据
      */
      */
@@ -276,7 +387,7 @@ public class ClubApi {
             return ResponseJson.error("参数异常:协销id不能为空!", null);
             return ResponseJson.error("参数异常:协销id不能为空!", null);
         }
         }
 //        keyWord, startAddTime, endAddTime, consult, leaderId, groupId,manager,
 //        keyWord, startAddTime, endAddTime, consult, leaderId, groupId,manager,
-        return clubService.getVisitorList(serviceProviderId,pageNum, pageSize);
+        return clubService.getVisitorList(serviceProviderId, pageNum, pageSize);
     }
     }
 
 
     /**
     /**
@@ -358,13 +469,13 @@ public class ClubApi {
                                                                           Integer pinceSensitve,
                                                                           Integer pinceSensitve,
                                                                           Integer satisfied,
                                                                           Integer satisfied,
                                                                           Integer followup,
                                                                           Integer followup,
-                                                                          String extra,
+                                                                          String extra, Integer status,
                                                                           @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                                           @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                                           @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
                                                                           @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
         if (null == serviceProviderId) {
         if (null == serviceProviderId) {
             return ResponseJson.error("参数异常:协销id不能为空!", null);
             return ResponseJson.error("参数异常:协销id不能为空!", null);
         }
         }
-        return clubService.getVisitorRecordList(questionManId, keyWord, serviceProviderId, startAddTime, endAddTime, consult, leaderId, groupId, manager,clubType,pinceSensitve, satisfied,followup,extra, pageNum, pageSize);
+        return clubService.getVisitorRecordList(questionManId, keyWord, serviceProviderId, startAddTime, endAddTime, consult, leaderId, groupId, manager, clubType, pinceSensitve, satisfied, followup, extra, status, pageNum, pageSize);
     }
     }
 
 
     @ApiOperation("删除潜在用户资料备注")
     @ApiOperation("删除潜在用户资料备注")
@@ -408,4 +519,28 @@ public class ClubApi {
         return clubService.findGroups(leaderId);
         return clubService.findGroups(leaderId);
     }
     }
 
 
+
+    @ApiOperation("查询行为记录链接信息")
+    @GetMapping("/recordLinkage")
+    public ResponseJson<Map<String, Object>> recordLinkage(Integer clubId) {
+        return clubService.recordLinkage(clubId);
+    }
+
+    @ApiOperation("可分配协销列表")
+    @GetMapping("/chose/list")
+    @ApiImplicitParam(required = true, name = "spId", value = "协销id")
+    public ResponseJson<List<ServiceProviderVo>> choseSales(Integer spId) {
+        return clubService.choseSales(spId);
+    }
+
+    @ApiOperation("分配协销")
+    @ApiImplicitParams({
+            @ApiImplicitParam(required = true, name = "clubId", value = "机构Id"),
+            @ApiImplicitParam(required = true, name = "spId", value = "协销Id"),
+            @ApiImplicitParam(required = true, name = "choseServiceId", value = "分配人协销Id")
+    })
+    @PostMapping("/chose/sales")
+    public ResponseJson choseSales(Integer clubId, Integer spId, Integer choseServiceId) {
+        return clubService.changeSales(clubId, spId, choseServiceId);
+    }
 }
 }

+ 37 - 0
src/main/java/com/caimei365/user/controller/CmBehaviorRecordApi.java

@@ -0,0 +1,37 @@
+package com.caimei365.user.controller;
+
+import com.caimei365.user.idempotent.IpSave;
+import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.model.dto.BehaviorRecordDto;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/11/1
+ */
+@Slf4j
+@RestController
+@RequestMapping("/user/record")
+public class CmBehaviorRecordApi {
+
+    /**
+     * 用户行为记录
+     * @param userId
+     * @param pagePath
+     * @param pageType
+     * @param pageLabel
+     * @param productId
+     * @param accessDuration
+     * @return
+     */
+    @IpSave(saveName="用户行为记录",saveParams = true)
+    @GetMapping("/Statistics")
+    public ResponseJson<String> behaviorRecordApp(Integer userId,String pagePath,String pageType,String pageLabel,String behaviorType,Integer productId,String accessDuration,Integer accessClient){
+        log.info("用户行为记录=========》"+userId+"===="+pagePath+"===="+pageType+"===="+pageLabel+"===="+behaviorType+"===="+productId+"===="+accessDuration+"===="+accessClient);
+        return ResponseJson.success("用户行为记录完成");
+    }
+
+}

+ 30 - 2
src/main/java/com/caimei365/user/controller/LoginApi.java

@@ -50,6 +50,22 @@ public class LoginApi {
         return loginService.passwordLogin(loginPasswordDto);
         return loginService.passwordLogin(loginPasswordDto);
     }
     }
 
 
+    /**
+     * 登录(手机号,验证码)
+     * @param loginCodeDto {
+     *                      mobile   手机号
+     *                      code     短信验证码
+     *                      unionId  微信unionId
+     *                     }
+     * @return UserLoginVo
+     * @throws ParseException
+     */
+    @ApiOperation("登录(手机号,验证码)")
+    @PostMapping("/codeLogin")
+    public ResponseJson<UserLoginVo> codeLogin(LoginCodeDto loginCodeDto) throws ParseException {
+        return loginService.codeLogin(loginCodeDto);
+    }
+
     /**
     /**
      * 协销登录(手机号,密码)
      * 协销登录(手机号,密码)
      * <p>
      * <p>
@@ -82,7 +98,6 @@ public class LoginApi {
      *                       }
      *                       }
      */
      */
     @ApiOperation("微信授权登录(小程序)")
     @ApiOperation("微信授权登录(小程序)")
-    @IpSave(saveName = "微信授权登录(小程序)", saveParams = false)
     @PostMapping("/auth/applets")
     @PostMapping("/auth/applets")
     public ResponseJson<UserLoginVo> appletsAuthorization(AuthAppletsDto authAppletsDto, @RequestHeader HttpHeaders headers) throws ParseException {
     public ResponseJson<UserLoginVo> appletsAuthorization(AuthAppletsDto authAppletsDto, @RequestHeader HttpHeaders headers) throws ParseException {
         String code = authAppletsDto.getCode();
         String code = authAppletsDto.getCode();
@@ -94,7 +109,6 @@ public class LoginApi {
     @ApiOperation("机构站内消息未读消息记录数")
     @ApiOperation("机构站内消息未读消息记录数")
     @GetMapping("/auth/ClubMessageCount")
     @GetMapping("/auth/ClubMessageCount")
     public ResponseJson<Map<String, Object>> ClubMessageCount(Integer messageType, Integer commonId) {
     public ResponseJson<Map<String, Object>> ClubMessageCount(Integer messageType, Integer commonId) {
-
         return loginService.ClubMessageCount(messageType, commonId);
         return loginService.ClubMessageCount(messageType, commonId);
     }
     }
 
 
@@ -345,4 +359,18 @@ public class LoginApi {
     }
     }
 
 
 
 
+    /**
+     * @param loginCodeDto {
+     *                      mobile   手机号
+     *                      code     短信验证码
+     *                     }
+     * @param loginCodeDto
+     * @return
+     */
+    @ApiOperation("绑定运营人员")
+    @PostMapping("/verification")
+    public ResponseJson<String> operateVerification(LoginCodeDto loginCodeDto) {
+        return loginService.operateVerification(loginCodeDto);
+    }
+
 }
 }

+ 62 - 0
src/main/java/com/caimei365/user/controller/RoosInformationApi.java

@@ -0,0 +1,62 @@
+package com.caimei365.user.controller;
+
+import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.model.dto.RoosInformationDto;
+import com.caimei365.user.service.RoosInformationService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/12/9
+ */
+@Slf4j
+@RestController
+@RequestMapping( "/user/information")
+public class RoosInformationApi {
+
+    @Autowired private RoosInformationService roosInformationService;
+
+    /**
+     * 查看用户是否有过弹框,游客当天是否有过弹框
+     * @return
+     */
+    @GetMapping("/isClick")
+    public ResponseJson<Boolean> boolIsClick() {
+
+        // 获取访问ip
+        String ip = roosInformationService.obtainIp();
+        // 查看用户是否有过弹框,游客当天是否有过弹框
+        Boolean isClick = roosInformationService.boolIsClick(ip);
+        return ResponseJson.success(!isClick);
+    }
+
+    /**
+     * 插入填写咨询人基本信息
+     * @param roosInformationDto
+     * @return
+     */
+    @PostMapping("/insertRoos")
+    public ResponseJson<String> insertRoosInformation(RoosInformationDto roosInformationDto) {
+        // 获取访问ip
+        String ip = roosInformationService.obtainIp();
+        roosInformationDto.setIp(ip);
+        roosInformationService.insRoosInformation(roosInformationDto);
+        return ResponseJson.success("咨询信息插入成功");
+    }
+
+    /**
+     * 查看访问者是否浏览过roos相关页面
+     * @return
+     */
+    @GetMapping("/visitRoos")
+    public ResponseJson<Boolean> selVisitRoos (String userId) {
+        // 获取访问ip
+        String ip = roosInformationService.obtainIp();
+        Boolean visitRoos = roosInformationService.selectVisitRoos(userId,ip);
+        return ResponseJson.success(visitRoos);
+    }
+}

+ 29 - 13
src/main/java/com/caimei365/user/controller/SellerApi.java

@@ -6,6 +6,7 @@ import com.caimei365.user.model.dto.OnlineDto;
 import com.caimei365.user.model.po.ServiceProviderPo;
 import com.caimei365.user.model.po.ServiceProviderPo;
 import com.caimei365.user.model.vo.ClubTemporaryVo;
 import com.caimei365.user.model.vo.ClubTemporaryVo;
 import com.caimei365.user.model.vo.ClubVo;
 import com.caimei365.user.model.vo.ClubVo;
+import com.caimei365.user.model.vo.ServiceProviderVo;
 import com.caimei365.user.service.SellerService;
 import com.caimei365.user.service.SellerService;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
@@ -16,6 +17,7 @@ import lombok.RequiredArgsConstructor;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
+import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
 /**
 /**
@@ -82,28 +84,42 @@ public class SellerApi {
      * 协销机构列表
      * 协销机构列表
      * 原spi的 /seller/club/list
      * 原spi的 /seller/club/list
      *
      *
-     * @param spId 协销Id
-     * @param status            机构状态
-     * @param name              机构名字关键字(搜索用)
+     * @param spId           协销Id
+     * @param status         机构状态
+     * @param type           1.我的机构2.组员机构3.待分配机构
+     * @param name           机构名字关键字(搜索用)
+     * @param groupServiceId 组员协销id(搜索用)
      */
      */
     @ApiOperation("协销机构列表")
     @ApiOperation("协销机构列表")
     @GetMapping("/club/list")
     @GetMapping("/club/list")
     public ResponseJson<PageInfo<ClubVo>> getClubList(Integer spId,
     public ResponseJson<PageInfo<ClubVo>> getClubList(Integer spId,
-                                    Integer status,
-                                    String name,
-                                    Integer userIdentity,
-                                    @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
-                                    @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
-        if (null == spId || null == status) {
-            return ResponseJson.error("spId 或 status 参数不全!", null);
+                                                      Integer status,
+                                                      Integer type,
+                                                      String name,
+                                                      Integer userIdentity,
+                                                      Integer groupServiceId,
+                                                      @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);
         }
         }
-        return sellerService.getClubList(spId, status, name, userIdentity, pageNum, pageSize);
+        return sellerService.getClubList(spId, status, type, name, userIdentity, groupServiceId, pageNum, pageSize);
+    }
+
+    @ApiOperation("组员筛选侧边栏")
+    @GetMapping("/service/team")
+    public ResponseJson<List<ServiceProviderVo>> getClubList(Integer spId) {
+        if (null == spId) {
+            return ResponseJson.error("spId 不能为空!", null);
+        }
+        return sellerService.getServiceTeam(spId, 1);
     }
     }
 
 
     /**
     /**
      * 所有的机构列表
      * 所有的机构列表
      * 原spi的 /seller/findAllClub
      * 原spi的 /seller/findAllClub
-     * @param searchWord     关键字(搜索用)
+     *
+     * @param searchWord 关键字(搜索用)
      */
      */
     @ApiOperation("所有的机构列表(搜索)")
     @ApiOperation("所有的机构列表(搜索)")
     @GetMapping("/club/all")
     @GetMapping("/club/all")
@@ -119,7 +135,7 @@ public class SellerApi {
      * @param userId 协销userId
      * @param userId 协销userId
      */
      */
     @GetMapping("/home")
     @GetMapping("/home")
-    public  ResponseJson<ServiceProviderPo> getSellerHome(Integer userId) {
+    public ResponseJson<ServiceProviderPo> getSellerHome(Integer userId) {
         if (null == userId) {
         if (null == userId) {
             return ResponseJson.error("参数异常:用户Id不能为空!", null);
             return ResponseJson.error("参数异常:用户Id不能为空!", null);
         }
         }

+ 2 - 0
src/main/java/com/caimei365/user/controller/ShopApi.java

@@ -1,5 +1,6 @@
 package com.caimei365.user.controller;
 package com.caimei365.user.controller;
 
 
+import com.caimei365.user.idempotent.IpSave;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.BaikeProductDto;
 import com.caimei365.user.model.dto.BaikeProductDto;
 import com.caimei365.user.model.dto.ShopArticleDto;
 import com.caimei365.user.model.dto.ShopArticleDto;
@@ -106,6 +107,7 @@ public class ShopApi {
     @ApiOperation("供应商首页数据(旧:/supplier/home/detail(supplierId))")
     @ApiOperation("供应商首页数据(旧:/supplier/home/detail(supplierId))")
     @ApiImplicitParam(required = true, name = "shopId", value = "供应商Id")
     @ApiImplicitParam(required = true, name = "shopId", value = "供应商Id")
     @GetMapping("/home/data")
     @GetMapping("/home/data")
+    @IpSave(saveName = "供应商首页数据",saveParams = true)
     public ResponseJson<ShopHomeVo> getShopHomeData(Integer shopId) {
     public ResponseJson<ShopHomeVo> getShopHomeData(Integer shopId) {
         if (null == shopId) {
         if (null == shopId) {
             return ResponseJson.error("参数异常:供应商Id不能为空!", null);
             return ResponseJson.error("参数异常:供应商Id不能为空!", null);

+ 34 - 0
src/main/java/com/caimei365/user/idempotent/IpSaveAspect.java

@@ -1,6 +1,7 @@
 package com.caimei365.user.idempotent;
 package com.caimei365.user.idempotent;
 
 
 
 
+import com.alibaba.fastjson.JSON;
 import com.caimei365.user.feign.ToolsFeign;
 import com.caimei365.user.feign.ToolsFeign;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
@@ -9,13 +10,16 @@ import org.aspectj.lang.annotation.Around;
 import org.aspectj.lang.annotation.Aspect;
 import org.aspectj.lang.annotation.Aspect;
 import org.aspectj.lang.annotation.Pointcut;
 import org.aspectj.lang.annotation.Pointcut;
 import org.aspectj.lang.reflect.MethodSignature;
 import org.aspectj.lang.reflect.MethodSignature;
+import org.springframework.core.LocalVariableTableParameterNameDiscoverer;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 import org.springframework.web.context.request.RequestAttributes;
 import org.springframework.web.context.request.RequestAttributes;
 import org.springframework.web.context.request.RequestContextHolder;
 import org.springframework.web.context.request.RequestContextHolder;
 import org.springframework.web.context.request.ServletRequestAttributes;
 import org.springframework.web.context.request.ServletRequestAttributes;
+import org.springframework.web.multipart.MultipartFile;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import java.lang.reflect.Method;
 import java.lang.reflect.Method;
 
 
 
 
@@ -44,6 +48,8 @@ public class IpSaveAspect {
         RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
         RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
         ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) requestAttributes;
         ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) requestAttributes;
         HttpServletRequest request = servletRequestAttributes.getRequest();
         HttpServletRequest request = servletRequestAttributes.getRequest();
+        String referer = request.getHeader("Referer");
+        String userAgent = request.getHeader("User-Agent");
         // ip
         // ip
         String unknown = "unknown";
         String unknown = "unknown";
         String ip = "";
         String ip = "";
@@ -75,6 +81,29 @@ public class IpSaveAspect {
         if (sp) {
         if (sp) {
             queryString = request.getQueryString();
             queryString = request.getQueryString();
         }
         }
+        // 接口是post时数据处理
+        String params = "";
+        if ("POST".equals(request.getMethod())) {
+            LocalVariableTableParameterNameDiscoverer discoverer = new LocalVariableTableParameterNameDiscoverer();
+            String[] parameterNames = discoverer.getParameterNames(method);
+            // 请求的方法参数值 JSON 格式 null 不显示
+            if (joinPoint.getArgs().length > 0) {
+                Object[] args = joinPoint.getArgs();
+                for (int i = 0; i < args.length; i++) {
+                    // 请求参数类型判断过滤,防止JSON转换报错
+                    if(args[i] instanceof HttpServletRequest || args[i] instanceof HttpServletResponse || args[i] instanceof MultipartFile) {
+                        continue;
+                    }
+                    // 参数格式调整为par1=……&par2=……&......
+                    String[] split = args[i].toString().substring(args[i].toString().indexOf("(")+1, args[i].toString().lastIndexOf(")")).split(",");
+                    for (int k = 0; k < split.length ; k++) {
+                        params += split[k]+"&";
+                    }
+
+                }
+                log.info("POST请求参数打印===================》"+params);
+            }
+        }
         String mes = "";
         String mes = "";
         if (StringUtils.isNotBlank(ip)) {
         if (StringUtils.isNotBlank(ip)) {
             mes += ip + "¥";
             mes += ip + "¥";
@@ -86,7 +115,12 @@ public class IpSaveAspect {
         } else {
         } else {
             mes += "¥";
             mes += "¥";
         }
         }
+        // 访问接口类型为post时接口参数调整
+        if ("POST".equals(request.getMethod())){
+            queryString = params;
+        }
         if (StringUtils.isNotBlank(queryString)) {
         if (StringUtils.isNotBlank(queryString)) {
+            queryString += "&referer=" + referer + "&userAgent=" + userAgent;
             mes += queryString + "¥";
             mes += queryString + "¥";
         } else {
         } else {
             mes += "¥";
             mes += "¥";

+ 39 - 4
src/main/java/com/caimei365/user/mapper/ClubMapper.java

@@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -26,6 +27,7 @@ public interface ClubMapper {
      */
      */
     ClubVo getClubById(Integer clubId);
     ClubVo getClubById(Integer clubId);
 
 
+
     /**
     /**
      * 修改机构信息保存用户
      * 修改机构信息保存用户
      *
      *
@@ -267,15 +269,18 @@ public interface ClubMapper {
 
 
     void updateVisit(@Param("questionManId") String questionManId, @Param("clubId") String clubId);
     void updateVisit(@Param("questionManId") String questionManId, @Param("clubId") String clubId);
 
 
+    void updateReport(@Param("questionManId") String questionManId, @Param("clubId") String clubId);
+
     List<VisitorRemarkVo> findConcactVisit(String questionManId);
     List<VisitorRemarkVo> findConcactVisit(String questionManId);
 
 
     void concactVisit(RemarksVo remarksVo);
     void concactVisit(RemarksVo remarksVo);
 
 
     String findQuestionMan(String questionManId);
     String findQuestionMan(String questionManId);
 
 
-    List<RemarksVo> getRemarksListByKey(@Param("keyWord") String keyWord, @Param("serviceProviderId") Integer serviceProviderId,@Param("startAddTime")String startAddTime,@Param("endAddTime")String endAddTime,@Param("pinceSensitve") Integer pinceSensitve,@Param("leaderId") Integer leaderId, @Param("groupId") Integer groupId,@Param("followup") Integer followup,@Param("satisfied") Integer satisfied, @Param("con")List<String> con);
+    List<RemarksVo> getRemarksListByKey(@Param("keyWord") String keyWord, @Param("serviceProviderId") Integer serviceProviderId, @Param("startAddTime") String startAddTime, @Param("endAddTime") String endAddTime, @Param("pinceSensitve") Integer pinceSensitve, @Param("leaderId") Integer leaderId, @Param("groupId") Integer groupId, @Param("followup") Integer followup, @Param("satisfied") Integer satisfied, @Param("con") List<String> con, Integer status, Integer newDeal);
+
+    List<VisitorRemarkVo> getVisitorListByKey(@Param("serviceProviderId") Integer serviceProviderId, @Param("keyWord") String keyWord, @Param("startAddTime") String startAddTime, @Param("endAddTime") String endAddTime, Integer pinceSensitve, @Param("followup") Integer followup, @Param("satisfied") Integer satisfied, @Param("con") List<String> con, Integer status);
 
 
-    List<VisitorRemarkVo> getVisitorListByKey(@Param("serviceProviderId") Integer serviceProviderId, @Param("keyWord") String keyWord,@Param("startAddTime")String startAddTime,@Param("endAddTime")String endAddTime,Integer pinceSensitve,@Param("followup") Integer followup,@Param("satisfied") Integer satisfied,@Param("con")List<String> con);
     //, @Param("questionManId") String questionManId
     //, @Param("questionManId") String questionManId
     List<VisitorRemarkVo> getVisitRecordListByKey(@Param("keyWord") String keyWord);
     List<VisitorRemarkVo> getVisitRecordListByKey(@Param("keyWord") String keyWord);
 
 
@@ -287,11 +292,41 @@ public interface ClubMapper {
 
 
     ConsultVo findConsultById(String string);
     ConsultVo findConsultById(String string);
 
 
-    List<RemarksVo> findAllRemarks(@Param("keyWord") String keyWord, @Param("startAddTime") String startAddTime, @Param("endAddTime") String endAddTime, @Param("leaderId") Integer leaderId, @Param("groupId") Integer groupId,@Param("followup") Integer followup,@Param("satisfied") Integer satisfied,@Param("pinceSensitve") Integer pinceSensitve, @Param("con")List<String> con);
+    List<RemarksVo> findAllRemarks(@Param("keyWord") String keyWord, @Param("startAddTime") String startAddTime, @Param("endAddTime") String endAddTime, @Param("leaderId") Integer leaderId, @Param("groupId") Integer groupId, @Param("followup") Integer followup, @Param("satisfied") Integer satisfied, @Param("pinceSensitve") Integer pinceSensitve, @Param("con") List<String> con, Integer status, Integer newDeal);
 
 
-    List<VisitorRemarkVo> getAllVisitRemark(@Param("keyWord") String keyWord, @Param("startAddTime") String startAddTime, @Param("endAddTime") String endAddTime, @Param("leaderId") Integer leaderId, @Param("groupId") Integer groupId,@Param("followup") Integer followup,@Param("satisfied") Integer satisfied,@Param("pinceSensitve") Integer pinceSensitve,@Param("con")List<String> con);
+    List<VisitorRemarkVo> getAllVisitRemark(@Param("keyWord") String keyWord, @Param("startAddTime") String startAddTime, @Param("endAddTime") String endAddTime, @Param("leaderId") Integer leaderId, @Param("groupId") Integer groupId, @Param("followup") Integer followup, @Param("satisfied") Integer satisfied, @Param("pinceSensitve") Integer pinceSensitve, @Param("con") List<String> con, Integer status);
 
 
     Integer findLeaderId(Integer serviceProviderId);
     Integer findLeaderId(Integer serviceProviderId);
 
 
     List<CmRemarksVo> getCmRemarksList(String remarks);
     List<CmRemarksVo> getCmRemarksList(String remarks);
+
+    ClubVo recordClubage(Integer clubId);
+
+    String serviceProviderNameage(Integer serviceProviderId);
+
+    List<ServiceProviderVo> findSales();
+
+    Integer findOldSpId(Integer clubId);
+
+    void insertChangeRecord(ClubChangeSpVo clubChangeSpVo);
+
+    void updateClubSpId(@Param("clubId") Integer clubId, @Param("spId") Integer spId);
+
+    List<Integer> findOldSpIds(Integer clubId);
+
+    void updateRemarksSp(@Param("clubId") Integer clubId, @Param("oldSpId") Integer oldSpId, @Param("spId") Integer spId, @Param("status") Integer status);
+
+    void updateReportSp(@Param("clubId") Integer clubId, @Param("oldSpId") Integer oldSpId, @Param("spId") Integer spId);
+
+    String findOpenIdBySpId(Integer spId);
+
+    List<ClubRemarksPo> findNewRemark(@Param("clubId")Integer clubId,@Param("serviceProviderId") Integer serviceProviderId);
+
+    String findServiceName(Integer spId);
+
+    Date findAllotTime(Integer spId, Integer clubId);
+
+    Date findSubmitTime(Integer remarkId);
+
+    Integer findLeaderIdBySp(Integer spId);
 }
 }

+ 65 - 0
src/main/java/com/caimei365/user/mapper/ClubReportMapper.java

@@ -0,0 +1,65 @@
+package com.caimei365.user.mapper;
+
+import com.caimei365.user.model.vo.ProductItemVo;
+import com.caimei365.user.model.vo.RemarksVo;
+import com.caimei365.user.model.vo.ReportVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/8/11
+ */
+@Mapper
+public interface ClubReportMapper {
+
+void addClubReport(ReportVo reportVo);
+
+List<ProductItemVo> productList(String keyWord);
+
+List<ReportVo> reportList(Integer serviceProviderId,Integer clubId,String keyWord);
+
+ReportVo reportDetailsList(Integer reportId);
+
+ReportVo visitorReportsList(Integer reportId);
+
+List<ReportVo>reportRemarks(Integer teamId,Integer serviceProviderId,String keyWord,Integer manager);
+
+List<ReportVo>repotRemark(Integer teamId,Integer serviceProviderId,String keyWord,Integer manager);
+
+List<ReportVo>visitorReportRemarks(Integer teamId,Integer serviceProviderId,String keyWord);
+
+    List<ReportVo>visitoReportRemark(Integer teamId,Integer serviceProviderId,String keyWord);
+
+Integer reportLeaderId(Integer serviceProviderId);
+
+String roeprtNa(Integer serviceProviderId);
+
+List<RemarksVo> associated(@Param("teamId")Integer teamId,@Param("serviceProviderId")Integer serviceProviderId,@Param("reportId")Integer reportId,@Param("keyWord")String keyWord, @Param("startAddTime") String startAddTime, @Param("endAddTime") String endAddTime, Integer leaderId, @Param("groupId") Integer groupId,@Param("followup") Integer followup,@Param("satisfied") Integer satisfied,@Param("pinceSensitve") Integer pinceSensitve,@Param("con")List<String> con,@Param("newDeal")Integer newDeal,@Param("status")Integer status);
+
+List<RemarksVo> visitorAssociated(@Param("teamId")Integer teamId,@Param("serviceProviderId")Integer serviceProviderId,@Param("reportId")Integer reportId,@Param("keyWord")String keyWord, @Param("startAddTime") String startAddTime, @Param("endAddTime") String endAddTime, Integer leaderId, @Param("groupId") Integer groupId,@Param("followup") Integer followup,@Param("satisfied") Integer satisfied,@Param("pinceSensitve") Integer pinceSensitve,@Param("con")List<String> con,@Param("status")Integer status);
+
+void disassociation(Integer remarksId);
+
+void visitorDisassociation(Integer remarksId);
+
+List<ReportVo>visitorReportList(String questionManId,String keyWord);
+
+void addVisitorReport(ReportVo reportVo);
+
+Integer visitorMan(String questionManId);
+
+void deleteReport(Integer reportId);
+
+String questionManNameage(@Param("reportId")Integer reportId,@Param("questionManId")String questionManId,@Param("serviceProviderId")Integer serviceProviderId);
+
+
+
+
+
+
+}

+ 14 - 0
src/main/java/com/caimei365/user/mapper/RegisterMapper.java

@@ -7,6 +7,8 @@ import com.caimei365.user.model.vo.ClubTemporaryVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 
 
+import java.util.List;
+
 /**
 /**
  * Description
  * Description
  *
  *
@@ -23,6 +25,18 @@ public interface RegisterMapper {
      */
      */
     int insertClubUser(UserPo user);
     int insertClubUser(UserPo user);
 
 
+    /**
+     * 查询新注册的用户
+     * @return
+     */
+    List<UserPo> selUser(@Param("registerTime") String registerTime);
+
+    /**
+     * 用户状态添加
+     * @param userID
+     * @return
+     */
+    int insertOrgan(@Param("userID") Integer userID);
     /**
     /**
      * 保存普通机构(club)
      * 保存普通机构(club)
      *
      *

+ 40 - 0
src/main/java/com/caimei365/user/mapper/RoosInformationMapper.java

@@ -0,0 +1,40 @@
+package com.caimei365.user.mapper;
+
+import com.caimei365.user.model.dto.BehaviorRecordDto;
+import com.caimei365.user.model.dto.RoosInformationDto;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/12/9
+ */
+@Mapper
+public interface RoosInformationMapper {
+    /**
+     * 查看用户是否有过弹框
+     * @param IP
+     * @param createTime
+     * @return
+     */
+   List<Integer> selIsClick(@Param("IP") String IP,@Param("createTime") String createTime);
+
+    /**
+     * 插入填写咨询人基本信息
+     * @param roosInformationDto
+     */
+   void insRoosInformation(RoosInformationDto roosInformationDto);
+
+    /**
+     * 查看访问者是否浏览过roos相关页面
+     * @param userID
+     * @param IP
+     * @param accessDate
+     * @return
+     */
+   List<String> visitRoos(@Param("userID") String userID,@Param("IP") String IP,@Param("accessDate") String accessDate);
+}

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

@@ -4,6 +4,7 @@ import com.caimei365.user.model.dto.ClubTemporaryDto;
 import com.caimei365.user.model.po.ServiceProviderPo;
 import com.caimei365.user.model.po.ServiceProviderPo;
 import com.caimei365.user.model.vo.ClubTemporaryVo;
 import com.caimei365.user.model.vo.ClubTemporaryVo;
 import com.caimei365.user.model.vo.ClubVo;
 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.UserLoginVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
@@ -58,13 +59,15 @@ public interface SellerMapper {
      */
      */
     void deleteTemporaryClub(Integer id);
     void deleteTemporaryClub(Integer id);
 
 
-    List<ClubVo> findClubs(@Param("serviceProviderId") Integer serviceProviderId, @Param("status") Integer status, @Param("name") String name, Integer userIdentity);
+    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);
 
 
     Integer findOrderNum(ClubVo club);
     Integer findOrderNum(ClubVo club);
+
     /**
     /**
      * 所有的机构列表
      * 所有的机构列表
      */
      */
     List<ClubVo> getAllClubList(String searchWord);
     List<ClubVo> getAllClubList(String searchWord);
+
     /**
     /**
      * 协销信息
      * 协销信息
      */
      */
@@ -75,4 +78,16 @@ public interface SellerMapper {
     Integer findManagerByUser(Integer userId);
     Integer findManagerByUser(Integer userId);
 
 
     Integer findLeaderId(Integer userId);
     Integer findLeaderId(Integer userId);
+
+    Integer findLeaderIdByServiceId(Integer serviceProviderId);
+
+    Integer findmanagerIdByServiceId(Integer serviceProviderId);
+
+    List<Integer> findServiceIds(Integer serviceProviderId);
+
+    List<Integer> findAllServiceIds(Integer serviceProviderId);
+
+    List<ServiceProviderVo> findServices(@Param("spId")Integer spId,@Param("status")Integer status);
+
+    List<ServiceProviderVo> findAllServices(@Param("spId")Integer spId,@Param("status")Integer status);
 }
 }

+ 46 - 0
src/main/java/com/caimei365/user/model/dto/BehaviorRecordDto.java

@@ -0,0 +1,46 @@
+package com.caimei365.user.model.dto;
+
+import lombok.Data;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/11/7
+ */
+@Data
+public class BehaviorRecordDto {
+    /**
+     * 用户id
+     */
+    private Integer userId;
+    /**
+     * 页面路径
+     */
+    private String pagePath;
+    /**
+     * 页面类型
+     */
+    private String pageType;
+    /**
+     * 页面标签
+     */
+    private String pageLabel;
+    /**
+     * 用户行为类型1:用户行为记录、2:ROOS页面统计
+     */
+    private String behaviorType;
+    /**
+     * 商品id
+     */
+    private Integer productId;
+    /**
+     * 访问时长
+     */
+    private String accessDuration;
+    /**
+     *访问客户端  0:网站 1:小程序
+     */
+    private Integer accessClient;
+}
+

+ 5 - 0
src/main/java/com/caimei365/user/model/dto/ClubOnlineDto.java

@@ -45,6 +45,11 @@ public class ClubOnlineDto implements Serializable {
      */
      */
     @ApiModelProperty("联系人")
     @ApiModelProperty("联系人")
     private String linkMan;
     private String linkMan;
+    /**
+     * 联系人身份:1老板,2采购,3运营,4其他
+     */
+    @ApiModelProperty("联系人身份")
+    private String linkManIdentity;
     /**
     /**
      * 省
      * 省
      */
      */

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

@@ -50,6 +50,10 @@ public class ClubUpdateDto implements Serializable {
      */
      */
     @ApiModelProperty("联系人")
     @ApiModelProperty("联系人")
     private String linkMan;
     private String linkMan;
+    /**
+     * 联系人身份:1老板,2采购,3运营,4其他
+     */
+    private Integer linkManIdentity;
     /**
     /**
      * 省
      * 省
      */
      */

+ 5 - 0
src/main/java/com/caimei365/user/model/dto/ClubUpgradeDto.java

@@ -50,6 +50,11 @@ public class ClubUpgradeDto implements Serializable {
      */
      */
     @ApiModelProperty("联系人")
     @ApiModelProperty("联系人")
     private String linkMan;
     private String linkMan;
+    /**
+     * 联系人身份
+     */
+    @ApiModelProperty("联系人身份:1老板,2采购,3运营,4其他")
+    private Integer linkManIdentity;
     /**
     /**
      * 省
      * 省
      */
      */

+ 51 - 0
src/main/java/com/caimei365/user/model/dto/LoginCodeDto.java

@@ -0,0 +1,51 @@
+package com.caimei365.user.model.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/12/16
+ */
+@Data
+public class LoginCodeDto implements Serializable {
+
+    /**
+     * 手机号或邮箱
+     */
+    @ApiModelProperty("手机号或邮箱")
+    private String mobileOrEmail;
+    /**
+     * 密码
+     */
+    @ApiModelProperty("密码")
+    private String password;
+    /**
+     * 手机号
+     */
+    @ApiModelProperty("手机号")
+    private String mobile;
+
+    /**
+     * 短信验证码
+     */
+    @ApiModelProperty("验证码")
+    private String code;
+
+    /**
+     * 微信unionId
+     */
+    @ApiModelProperty("微信unionId")
+    private String unionId;
+
+    /**
+     * 短信、密码
+     * 0 密码 1短信
+     */
+    @ApiModelProperty("验证类型")
+    private String codeType;
+}

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

@@ -0,0 +1,34 @@
+package com.caimei365.user.model.dto;
+
+import lombok.Data;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/12/9
+ */
+@Data
+public class RoosInformationDto {
+
+    /**
+     * 访问人ip
+     */
+    private String ip;
+    /**
+     * 咨询姓名
+     */
+    private String consultName;
+    /**
+     * 咨询手机号码
+     */
+    private String consultMobile;
+    /**
+     * 是否点击关闭弹框 1:有 0:没有
+     */
+    private Integer isClick;
+    /**
+     * 创建时间
+     */
+    private String createTime;
+}

+ 13 - 0
src/main/java/com/caimei365/user/model/dto/ScanBindDto.java

@@ -52,4 +52,17 @@ public class ScanBindDto implements Serializable {
     @NotNull
     @NotNull
     @ApiModelProperty("联系人")
     @ApiModelProperty("联系人")
     private String linkName;
     private String linkName;
+    /**
+     * 公司账号手机号
+     */
+    @ApiModelProperty("公司账号手机号")
+    private String companyMobile;
+
+    /**
+     * 密码或者短信验证
+     * 0 密码验证 1 短信
+     */
+    @NotNull
+    @ApiModelProperty("密码或者短信验证")
+    private String passOrNote;
 }
 }

+ 18 - 0
src/main/java/com/caimei365/user/model/dto/ShopUpdateDto.java

@@ -174,4 +174,22 @@ public class ShopUpdateDto implements Serializable {
      */
      */
     @ApiModelProperty("税务登记证")
     @ApiModelProperty("税务登记证")
     private String taxLicense;
     private String taxLicense;
+
+    /**
+     * 公司网址
+     */
+    @ApiModelProperty("公司网址")
+    private String website;
+
+    /**
+     * 微信小程序
+     */
+    @ApiModelProperty("微信小程序")
+    private String wxApplets;
+
+    /**
+     * 微信公众号
+     */
+    @ApiModelProperty("微信公众号")
+    private String wxOfficialAccount;
 }
 }

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

@@ -45,6 +45,10 @@ public class ClubPo implements Serializable {
      * 联系人
      * 联系人
      */
      */
     private String linkMan;
     private String linkMan;
+    /**
+     * 联系人身份:1老板,2采购,3运营,4其他
+     */
+    private Integer linkManIdentity;
     /**
     /**
      * 省
      * 省
      */
      */

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

@@ -39,6 +39,7 @@ public class ClubRemarksPo implements Serializable {
     @ApiModelProperty("同步时间")
     @ApiModelProperty("同步时间")
     private Date concactTime;
     private Date concactTime;
 
 
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @ApiModelProperty("添加时间")
     @ApiModelProperty("添加时间")
     private Date addTime;
     private Date addTime;
 
 
@@ -62,4 +63,12 @@ public class ClubRemarksPo implements Serializable {
      * 额外说明
      * 额外说明
      */
      */
     private String extra;
     private String extra;
+    /**
+     *咨询商品ID
+     */
+    private Integer productID;
+    /**
+     *报备关联ID
+     */
+    private Integer reportID;
 }
 }

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

@@ -100,6 +100,10 @@ public class UserPo implements Serializable {
      * 注册ip
      * 注册ip
      */
      */
     private String registerIp;
     private String registerIp;
+    /**
+     * 注册ip所在地
+     */
+    private String ipAddress;
     /**
     /**
      * 用户状态,1正常,0冻结
      * 用户状态,1正常,0冻结
      */
      */

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

@@ -0,0 +1,35 @@
+package com.caimei365.user.model.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class ClubChangeSpVo implements Serializable {
+    private Integer clubChangeSpRecordID;// 会所更换创客Id
+    private Integer clubID;   // 会所ID
+    private Integer oldSpID;  // 旧的创客ID
+    private Integer newSpID;  // 新的创客ID
+    private String checkStatus;// 审核状态(-1:已拒绝,0:待审核,1:已通过)
+    private Date checkTime; // 审核时间
+    private Date applyTime; // 申请时间
+    private String checkMark;//审核备注
+    private Integer checkUserID;//审核人
+    private Integer choseServiceId;//分配人协销Id
+
+    // 会所表中
+    private String address;   // 会所地址
+    private String clubName;  // 会所名称
+    private String clubStatus; // 会所状态(1:待审查资料,90:已上线,91:已冻结,92:待审核,2:电话预约,20:待确认,21:待拜访,3:已预约,30:待员工推荐,)
+    private String contractMobile;//会所联系手机
+    private Date addTime;// 添加时间
+    private Date auditTime;//审核时间
+    // 创客表中
+    private String linkMan;  // 申请创客姓名(创客联系名字)
+    private String spName;    // 定点创客姓名(创客名字)
+
+    // 用户表
+    private String userName;// 用户名
+    private String userLevelID;//用户级别ID(1:普通会员,2:	银卡会员,3:金卡会员,4:白金卡会员,5:钻石卡会员)
+}

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

@@ -3,6 +3,7 @@ package com.caimei365.user.model.vo;
 import lombok.Data;
 import lombok.Data;
 import java.io.Serializable;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.Date;
+import java.util.List;
 
 
 /**
 /**
  * Description
  * Description
@@ -71,6 +72,10 @@ public class ClubVo implements Serializable {
      * 联系人
      * 联系人
      */
      */
     private String linkMan;
     private String linkMan;
+    /**
+     * 联系人身份:1老板,2采购,3运营,4其他
+     */
+    private Integer linkManIdentity;
     /**
     /**
      * 省
      * 省
      */
      */
@@ -119,6 +124,11 @@ public class ClubVo implements Serializable {
      * 主打项目(mainpro)
      * 主打项目(mainpro)
      */
      */
     private String mainProduct;
     private String mainProduct;
+
+    /**
+     * 主营业务列表,号隔开
+     */
+    private List<String> mainProducts;
     /**
     /**
      * 传真
      * 传真
      */
      */
@@ -131,6 +141,16 @@ public class ClubVo implements Serializable {
      * 协销ID
      * 协销ID
      */
      */
     private Integer serviceProviderId;
     private Integer serviceProviderId;
+    /**
+     * 协销名称
+     */
+    private String serviceName;
+
+    /**
+     * 是否分配协销 0.待分配 1.已分配
+     */
+    private Integer spType;
+
     /**
     /**
      * 扫描状态 0待扫描 1 已扫描 2已上线
      * 扫描状态 0待扫描 1 已扫描 2已上线
      */
      */
@@ -151,4 +171,33 @@ public class ClubVo implements Serializable {
      * 最后查看订单时间
      * 最后查看订单时间
      */
      */
     private Date lastCheckOrderDate;
     private Date lastCheckOrderDate;
+    /**
+     *新分配机构状态 1.是 2.否
+     */
+    private Integer newDeal;
+    /**
+     * 行为记录链接描述
+     */
+    private String describe;
+    /**
+     * 是否有行为记录链接 1.是 0.否
+     */
+    private Integer recordCount;
+    /**
+     *  活跃状态
+     */
+    private String activeState;
+    /**
+     *  客户价值
+     */
+    private String customerValue;
+    /**
+     * 新拼接机构Id
+     */
+    private String newClubId;
+    /**
+     * 注册ip所在地
+     */
+    private String ipAddress;
+
 }
 }

+ 4 - 0
src/main/java/com/caimei365/user/model/vo/ProductItemVo.java

@@ -234,4 +234,8 @@ public class ProductItemVo implements Serializable {
      * 超级会员优惠价标签
      * 超级会员优惠价标签
      */
      */
     private String svipPriceTag;
     private String svipPriceTag;
+    /**
+     * 供应商名称回显
+     */
+    private String shopName;
 }
 }

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

@@ -93,4 +93,40 @@ public class RemarkVo implements Serializable {
      * 非持久化字段旧协销名
      * 非持久化字段旧协销名
      */
      */
 //    private String oldName;以后可能会用到
 //    private String oldName;以后可能会用到
+    /**
+     * 商品主图
+     */
+    private String mainImage;
+    /**
+     * 商品名称
+     */
+    private String productName;
+    /**
+     * 供应商名称
+     */
+    private String shopName;
+    /**
+     * 报备事由
+     */
+    private String reportText;
+    /**
+     * 报备审核状态
+     */
+    private Integer status;
+    /**
+     * 审核备注
+     */
+    private String auditText;
+    /**
+     * 新分配机构状态 0.否,1.是
+     */
+    private Integer newDeal;
+    /**
+     * 报备ID
+     */
+    private Integer reportId;
+    /**
+     * 报备商品ID
+     */
+    private Integer productId;
 }
 }

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

@@ -96,4 +96,41 @@ public class RemarksVo implements Serializable {
      * 非持久化字段旧协销名
      * 非持久化字段旧协销名
      */
      */
 //    private String oldName;以后可能会用上
 //    private String oldName;以后可能会用上
+
+    /**
+     * 商品主图
+     */
+    private String mainImage;
+    /**
+     * 商品名称
+     */
+    private String productName;
+    /**
+     * 供应商名称
+     */
+    private String shopName;
+    /**
+     * 报备事由
+     */
+    private String reportText;
+    /**
+     * 报备审核状态
+     */
+   private Integer status;
+    /**
+     * 审核备注
+     */
+    private String auditText;
+    /**
+     * 新分配机构状态 0.否,1.是
+     */
+    private Integer newDeal;
+    /**
+     * 报备ID
+     */
+    private Integer reportId;
+    /**
+     * 报备商品ID
+     */
+    private Integer productId;
 }
 }

+ 56 - 0
src/main/java/com/caimei365/user/model/vo/ReportVo.java

@@ -0,0 +1,56 @@
+package com.caimei365.user.model.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/8/11
+ */
+@Data
+public class ReportVo implements Serializable {
+
+    private Integer reportId;
+
+    private Integer productId;//商品id
+
+    private Integer clubId;//机构ID
+
+    private String reportName;//咨询人
+
+    private String reportText;//报备事由
+
+    private String addTime;//添加时间
+
+    private Integer status;//状态
+
+    private String auditName;//审核人
+
+    private String auditTime;//审核时间
+
+    private String auditText;//审核备注
+
+    private String clubName;//机构名称
+
+    private String shopName;//供应商名称
+
+    private String productName;//商品名称
+
+    private String mainImage;//商品主图
+
+    private String linkMan;//联系人
+
+    private Integer serviceProviderId;//协销ID
+
+    private String questionManId;//咨询人ID
+
+    private String questionMan;//咨询人名称
+
+    private Integer newDeal;// 新分配机构1.是, 2.否,
+
+
+
+}

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

@@ -86,4 +86,41 @@ public class VisitRemarkVo  implements Serializable {
      * 额外说明
      * 额外说明
      */
      */
     private String extra;
     private String extra;
+    /**
+     *报备审核状态 0.全部 1.待审核 2.已审核 3.审核未通过
+     */
+    private Integer status;
+    /**
+     * 报备ID
+     */
+    private Integer reportId;
+    /**
+     * 报备商品ID
+     */
+    private Integer productId;
+    /**
+     * 商品主图
+     */
+    private String mainImage;
+    /**
+     * 商品名称
+     */
+    private String productName;
+    /**
+     * 供应商名称
+     */
+    private String shopName;
+    /**
+     * 报备事由
+     */
+    private String reportText;
+    /**
+     * 审核备注
+     */
+    private String auditText;
+    /**
+     * 新分配机构状态 0.否,1.是
+     */
+    private Integer newDeal;
+
 }
 }

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

@@ -93,4 +93,42 @@ public class VisitorRemarkVo implements Serializable {
      * 额外说明
      * 额外说明
      */
      */
     private String extra;
     private String extra;
+    /**
+     *报备审核状态 0.全部 1.待审核 2.已审核 3.审核未通过
+     */
+    private Integer status;
+    /**
+     * 报备ID
+     */
+    private Integer reportId;
+    /**
+     * 报备商品ID
+     */
+    private Integer productId;
+    /**
+     * 商品主图
+     */
+    private String mainImage;
+    /**
+     * 商品名称
+     */
+    private String productName;
+    /**
+     * 供应商名称
+     */
+    private String shopName;
+    /**
+     * 报备事由
+     */
+    private String reportText;
+    /**
+     * 审核备注
+     */
+    private String auditText;
+    /**
+     * 新分配机构状态 0.否,1.是
+     */
+    private Integer newDeal;
+
+
 }
 }

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

@@ -37,7 +37,7 @@ public interface BaseService {
      * 获取短信验证码
      * 获取短信验证码
      *
      *
      * @param mobile           手机号
      * @param mobile           手机号
-     * @param activateCodeType 1:找回密码,2:手机号注册机构,3:供应商注册,4:修改手机号-旧手机验证码,5:修改手机号-新手机验证码
+     * @param activateCodeType 1:找回密码,2:手机号注册机构,3:供应商注册,4:修改手机号-旧手机验证码,5:修改手机号-新手机验证码,7:手机验证码登录
      * @param platformType     0:www,1:crm/h5,2:小程序
      * @param platformType     0:www,1:crm/h5,2:小程序
      * @param isCheckCaptcha   是否检查图片验证码,0:检查,1:不检查
      * @param isCheckCaptcha   是否检查图片验证码,0:检查,1:不检查
      * @param imgCode          图片验证码
      * @param imgCode          图片验证码
@@ -67,6 +67,20 @@ public interface BaseService {
      */
      */
     ResponseJson getEmailCode(String email, Integer status);
     ResponseJson getEmailCode(String email, Integer status);
 
 
+    /**
+     * 获取登录验证码
+     * @param mobile 输入手机号
+     * @return
+     */
+    ResponseJson getLoginCode(String mobile);
+
+    /**
+     * 获取绑定运营人员验证码
+     * @param mobile
+     * @return
+     */
+    ResponseJson operateSmsCode(String mobile);
+
     /**
     /**
      * 修改密码(找回密码)
      * 修改密码(找回密码)
      *
      *

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

@@ -5,7 +5,9 @@ import com.caimei365.user.model.dto.ClubRemarksDto;
 import com.caimei365.user.model.dto.ClubUpdateDto;
 import com.caimei365.user.model.dto.ClubUpdateDto;
 import com.caimei365.user.model.dto.JsonParamsDto;
 import com.caimei365.user.model.dto.JsonParamsDto;
 import com.caimei365.user.model.vo.*;
 import com.caimei365.user.model.vo.*;
+import org.springframework.web.bind.annotation.RequestParam;
 
 
+import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
 /**
 /**
@@ -23,6 +25,8 @@ public interface ClubService {
      */
      */
     ResponseJson<Map<String, Object>> getClubUserInfo(Integer userId);
     ResponseJson<Map<String, Object>> getClubUserInfo(Integer userId);
 
 
+    ResponseJson<Map<String, Object>> recordLinkage(Integer clubId);
+
     /**
     /**
      * 修改机构资料
      * 修改机构资料
      *
      *
@@ -108,6 +112,47 @@ public interface ClubService {
      */
      */
     ResponseJson saveClubRemarks(JsonParamsDto jsonParamsDto);
     ResponseJson saveClubRemarks(JsonParamsDto jsonParamsDto);
 
 
+    ResponseJson saveClubReport(ReportVo reportVo);
+
+    ResponseJson<PaginationVo<ProductItemVo>> getproductList(String keyWord, int pageNum, int pageSize);
+
+    ResponseJson<PaginationVo<ReportVo>> ClubReportList(Integer serviceProviderId, Integer clubId, String keyWord, int pageNum, int pageSize);
+
+    ResponseJson<PaginationVo<ReportVo>> visitorReportList(String questionManId, String keyWord, int pageNum, int pageSize);
+
+    ResponseJson addVisitorReport(ReportVo reportVo);
+
+    ResponseJson<ReportVo> reportDetailsList(Integer reportId);
+
+    ResponseJson<ReportVo> visitorReportsList(Integer reportId);
+
+    ResponseJson<PaginationVo<RemarkVo>> associated(Integer manager, Integer serviceProviderId, Integer reportId, String keyWord, String startAddTime,
+                                                    String endAddTime,
+                                                    String consult,
+                                                    Integer leaderId,
+                                                    String clubType,
+                                                    Integer pinceSensitve,
+                                                    Integer satisfied,
+                                                    Integer followup,
+                                                    String extra,
+                                                    Integer groupId, Integer newDeal, Integer status, int pageNum, int pageSize);
+
+    ResponseJson<PaginationVo<RemarkVo>> visitorAssociated(Integer manager, Integer serviceProviderId, Integer reportId, String keyWord, String startAddTime,
+                                                           String endAddTime,
+                                                           String consult,
+                                                           Integer leaderId,
+                                                           String clubType,
+                                                           Integer pinceSensitve,
+                                                           Integer satisfied,
+                                                           Integer followup,
+                                                           String extra,
+                                                           Integer groupId, Integer status, int pageNum, int pageSize);
+
+    ResponseJson disassociation(Integer remarksId);
+
+    ResponseJson visitorDisassociation(Integer remarksId);
+
+
     /**
     /**
      * 获取机构资料备注列表
      * 获取机构资料备注列表
      *
      *
@@ -128,7 +173,7 @@ public interface ClubService {
                                                         Integer satisfied,
                                                         Integer satisfied,
                                                         Integer followup,
                                                         Integer followup,
                                                         String extra,
                                                         String extra,
-                                                        Integer groupId, int pageNum, int pageSize);
+                                                        Integer groupId, Integer status, Integer newDeal, int pageNum, int pageSize);
 
 
     /**
     /**
      * 获取机构资料备注详情
      * 获取机构资料备注详情
@@ -202,7 +247,7 @@ public interface ClubService {
      */
      */
     ResponseJson<VisitRemarkVo> getVisitRemark(Integer remarksId);
     ResponseJson<VisitRemarkVo> getVisitRemark(Integer remarksId);
 
 
-    ResponseJson<PaginationVo<VisitRemarkVo>> getVisitorRecordList(String questionManId, String keyWord, Integer serviceProviderId, String startAddTime, String endAddTime, String consult, Integer leaderId, Integer groupId, Integer manager, String clubType, Integer pinceSensitve,Integer satisfied,Integer followup, String extra, int pageNum, int pageSize);
+    ResponseJson<PaginationVo<VisitRemarkVo>> getVisitorRecordList(String questionManId, String keyWord, Integer serviceProviderId, String startAddTime, String endAddTime, String consult, Integer leaderId, Integer groupId, Integer manager, String clubType, Integer pinceSensitve, Integer satisfied, Integer followup, String extra, Integer status, int pageNum, int pageSize);
 
 
     ResponseJson deleteVisitRemarks(String remarksId);
     ResponseJson deleteVisitRemarks(String remarksId);
 
 
@@ -222,4 +267,14 @@ public interface ClubService {
     ResponseJson findGroups(Integer leaderId);
     ResponseJson findGroups(Integer leaderId);
 
 
     ResponseJson getCmRemarksList(String remarks);
     ResponseJson getCmRemarksList(String remarks);
+
+    ResponseJson<PaginationVo<ReportVo>> reportRemarks(Integer manager, Integer serviceProviderId, String keyWord, int pageNum, int pageSize);
+
+    ResponseJson<PaginationVo<ReportVo>> visitorReportRemarks(Integer manager, Integer serviceProviderId, String keyWord, int pageNum, int pageSize);
+
+    ResponseJson deleteReport(Integer reportId);
+
+    ResponseJson<List<ServiceProviderVo>> choseSales(Integer spId);
+
+    ResponseJson changeSales(Integer clubId, Integer spId, Integer choseServiceId);
 }
 }

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

@@ -2,6 +2,7 @@ package com.caimei365.user.service;
 
 
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.AuthBindDto;
 import com.caimei365.user.model.dto.AuthBindDto;
+import com.caimei365.user.model.dto.LoginCodeDto;
 import com.caimei365.user.model.dto.LoginPasswordDto;
 import com.caimei365.user.model.dto.LoginPasswordDto;
 import com.caimei365.user.model.dto.ScanBindDto;
 import com.caimei365.user.model.dto.ScanBindDto;
 import com.caimei365.user.model.vo.MessageCenter;
 import com.caimei365.user.model.vo.MessageCenter;
@@ -33,6 +34,16 @@ public interface LoginService {
      */
      */
     ResponseJson<UserLoginVo> passwordLogin(LoginPasswordDto loginPasswordDto) throws ParseException;
     ResponseJson<UserLoginVo> passwordLogin(LoginPasswordDto loginPasswordDto) throws ParseException;
 
 
+    /**
+     *
+     * @param loginCodeDto {
+     *                          mobile   手机号
+     *                          code     短信验证码
+     *                     }
+     * @return
+     * @throws ParseException
+     */
+    ResponseJson<UserLoginVo> codeLogin(LoginCodeDto loginCodeDto) throws ParseException;
     /**
     /**
      * 微信授权登录(小程序)
      * 微信授权登录(小程序)
      *
      *
@@ -144,4 +155,14 @@ public interface LoginService {
      * @return OperationPo
      * @return OperationPo
      */
      */
     ResponseJson<UserLoginVo> operationBindWeChat(AuthBindDto authBindDto);
     ResponseJson<UserLoginVo> operationBindWeChat(AuthBindDto authBindDto);
+
+    /**
+     * 绑定运营人员短信验证
+     * @param loginCodeDto{
+     *                      mobile   手机号
+     *                      code     短信验证码
+     *                     }
+     * @return
+     */
+    ResponseJson<String> operateVerification(LoginCodeDto loginCodeDto);
 }
 }

+ 40 - 0
src/main/java/com/caimei365/user/service/RoosInformationService.java

@@ -0,0 +1,40 @@
+package com.caimei365.user.service;
+
+import com.caimei365.user.model.dto.BehaviorRecordDto;
+import com.caimei365.user.model.dto.RoosInformationDto;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/12/9
+ */
+public interface RoosInformationService {
+    /**
+     * 查看用户是否有过弹框,游客当天是否有过弹框
+     * @param IP
+     * @return
+     */
+    Boolean boolIsClick(String IP);
+
+    /**
+     * 插入填写咨询人基本信息
+     * @param roosInformationDto
+     */
+    void insRoosInformation(RoosInformationDto roosInformationDto);
+
+    /**
+     * 查看访问者是否浏览过roos相关页面
+     * @param IP
+     * @return
+     */
+    Boolean selectVisitRoos(String userID ,String IP);
+
+    /**
+     * 获取用户访问IP
+     * @return
+     */
+    String obtainIp();
+}

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

@@ -5,9 +5,12 @@ import com.caimei365.user.model.dto.ClubTemporaryDto;
 import com.caimei365.user.model.po.ServiceProviderPo;
 import com.caimei365.user.model.po.ServiceProviderPo;
 import com.caimei365.user.model.vo.ClubTemporaryVo;
 import com.caimei365.user.model.vo.ClubTemporaryVo;
 import com.caimei365.user.model.vo.ClubVo;
 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.UserLoginVo;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
 
 
+import java.util.List;
+
 /**
 /**
  * Description
  * Description
  *
  *
@@ -24,7 +27,8 @@ public interface SellerService {
      * @param name              机构名字关键字(搜索用)
      * @param name              机构名字关键字(搜索用)
      * @return
      * @return
      */
      */
-    ResponseJson<PageInfo<ClubVo>> getClubList(Integer serviceProviderId, Integer status, String name, Integer userIdentity, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<ClubVo>> getClubList(Integer serviceProviderId, Integer status, Integer type, String name, Integer userIdentity, Integer groupServiceId, Integer pageNum, Integer pageSize);
+
     /**
     /**
      * 协销登录(手机号,密码)
      * 协销登录(手机号,密码)
      *
      *
@@ -64,13 +68,17 @@ public interface SellerService {
 
 
     /**
     /**
      * 所有的机构列表
      * 所有的机构列表
+     *
      * @param searchWord 搜索关键字
      * @param searchWord 搜索关键字
      */
      */
     ResponseJson<PageInfo<ClubVo>> getAllClubList(String searchWord, int pageNum, int pageSize);
     ResponseJson<PageInfo<ClubVo>> getAllClubList(String searchWord, int pageNum, int pageSize);
 
 
     /**
     /**
      * 协销个人中心
      * 协销个人中心
+     *
      * @param userId 协销用户id
      * @param userId 协销用户id
      */
      */
     ResponseJson<ServiceProviderPo> getSellerHome(Integer userId);
     ResponseJson<ServiceProviderPo> getSellerHome(Integer userId);
+
+    ResponseJson<List<ServiceProviderVo>> getServiceTeam(Integer spId,Integer status);
 }
 }

+ 49 - 1
src/main/java/com/caimei365/user/service/impl/AsyncService.java

@@ -1,13 +1,16 @@
 package com.caimei365.user.service.impl;
 package com.caimei365.user.service.impl;
 
 
+import com.caimei365.user.components.WeChatService;
 import com.caimei365.user.mapper.*;
 import com.caimei365.user.mapper.*;
 import com.caimei365.user.model.po.UserBeansHistoryPo;
 import com.caimei365.user.model.po.UserBeansHistoryPo;
+import com.caimei365.user.model.vo.ClubVo;
 import com.caimei365.user.model.vo.UserVo;
 import com.caimei365.user.model.vo.UserVo;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Date;
 
 
 /**
 /**
@@ -17,6 +20,7 @@ import java.util.Date;
  * 在Async 方法上标注@Transactional是没用的。 在Async 方法调用的方法上标注@Transactional 有效。
  * 在Async 方法上标注@Transactional是没用的。 在Async 方法调用的方法上标注@Transactional 有效。
  * 调用被@Async标记的方法的调用者不能和被调用的方法在同一类中不然不会起作用!!!!!!!
  * 调用被@Async标记的方法的调用者不能和被调用的方法在同一类中不然不会起作用!!!!!!!
  * 使用@Async时要求是不能有返回值
  * 使用@Async时要求是不能有返回值
+ *
  * @author : Charles
  * @author : Charles
  * @date : 2021/11/12
  * @date : 2021/11/12
  */
  */
@@ -31,11 +35,13 @@ public class AsyncService {
     private ClubMapper clubMapper;
     private ClubMapper clubMapper;
     @Resource
     @Resource
     private BaseMapper baseMapper;
     private BaseMapper baseMapper;
+    @Resource
+    private WeChatService weChatService;
 
 
     @Async("taskExecutor")
     @Async("taskExecutor")
     public void loginUpdateBeans(Integer userId, Integer identity) {
     public void loginUpdateBeans(Integer userId, Integer identity) {
         boolean isClub = null != identity && (2 == identity || 4 == identity);
         boolean isClub = null != identity && (2 == identity || 4 == identity);
-        if (isClub){
+        if (isClub) {
             // 查询今天是否有登录送豆
             // 查询今天是否有登录送豆
             Integer id = clubMapper.findLoginBeans(userId);
             Integer id = clubMapper.findLoginBeans(userId);
             if (id == null) {
             if (id == null) {
@@ -63,4 +69,46 @@ public class AsyncService {
             log.error("【登录】--登录时间记录异常" + e);
             log.error("【登录】--登录时间记录异常" + e);
         }
         }
     }
     }
+
+    /**
+     * @param status         1,分配 / 更换销售成功后对被分配的销售进行如下微信模板
+     *                       o1nMAIsHAFr0VOu0qEbI1rEFDS14hl40UXbt52I5row
+     *                       新客户跟进提醒
+     *                       你有一个新机构客户,请及时跟进。
+     *                       客户电话:15623569845
+     *                       客户姓名:张总
+     *                       客户地址:广东省深圳市福田区
+     *                       提交时间:2022-9-20
+     *                       点击查看详情,了解更多客户信息。
+     *                       <p>
+     *                       2,当组员对分配的机构填写了第一次咨询记录后,立即对组长进行如下微信模板消息提醒
+     *                       DFkeHJWZsJq_pbk2QFXG5FkaLqhlkN_vqvhTEb6o400
+     *                       组员跟进通知
+     *                       组员已跟进客户,填写完成咨询记录
+     *                       机构名称: 广州多美医疗美容诊所有限公司
+     *                       组员姓名:黄豪
+     *                       分配时间:2022-09-10 12:11:15
+     *                       提交时间:2022-09-12 12:11:15
+     *                       点击查看详情,查看咨询记录详情
+     * @param clubId
+     * @param spId
+     * @param choseServiceId stauts=2时,是remarkId
+     */
+    @Async("taskExecutor")
+    public void sendChoseServiceMessage(Integer status, Integer clubId, Integer spId, Integer choseServiceId) {
+        String openId = clubMapper.findOpenIdBySpId(1 == status ? spId : clubMapper.findLeaderIdBySp(spId));
+        if (null != openId) {
+            String title = 1 == status ? "你有一个新机构客户,请及时跟进。" : "组员已跟进客户,填写完成咨询记录";
+            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            ClubVo clubById = clubMapper.getClubById(clubId);
+            String keyWord1 = 1 == status ? clubById.getLinkMan() : clubMapper.findServiceName(spId);
+            String keyWord2 = 1 == status ? clubById.getContractMobile() : clubById.getLinkMan();
+            String keyWord3 = 1 == status ? clubById.getAddress() : format.format(clubMapper.findAllotTime(spId, clubId));
+            String keyWord4 = 1 == status ? new SimpleDateFormat("yyyy-MM-dd").format(new Date()) : format.format(clubMapper.findSubmitTime(choseServiceId));
+            String remark = 1 == status ? "点击查看详情,了解更多客户信息。" : "点击查看详情,查看咨询记录详情";
+            String path = 1 == status ? "pages/seller/club/list?type=wechat" : "pages/seller/remarks/details?remarksId=" + choseServiceId;
+            String templateId = 1 == status ? "o1nMAIsHAFr0VOu0qEbI1rEFDS14hl40UXbt52I5row" : "DFkeHJWZsJq_pbk2QFXG5FkaLqhlkN_vqvhTEb6o400";
+            weChatService.sendChoseServiceMessage(title, keyWord1, keyWord2, keyWord3, keyWord4, remark, path, openId, templateId);
+        }
+    }
 }
 }

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

@@ -25,6 +25,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
@@ -116,7 +117,7 @@ public class BaseServiceImpl implements BaseService {
      * 获取短信验证码
      * 获取短信验证码
      *
      *
      * @param mobile           手机号
      * @param mobile           手机号
-     * @param activateCodeType 1:找回密码,2:手机号注册机构,3:供应商注册,4:修改手机号-旧手机验证码,5:修改手机号-新手机验证码
+     * @param activateCodeType 1:找回密码,2:手机号注册机构,3:供应商注册,4:修改手机号-旧手机验证码,5:修改手机号-新手机验证码,7:手机验证码登录
      * @param platformType     0:www,1:crm/h5,2:小程序
      * @param platformType     0:www,1:crm/h5,2:小程序
      * @param isCheckCaptcha   是否检查图片验证码,0:检查,1:不检查
      * @param isCheckCaptcha   是否检查图片验证码,0:检查,1:不检查
      * @param imgCode          图片验证码
      * @param imgCode          图片验证码
@@ -133,7 +134,7 @@ public class BaseServiceImpl implements BaseService {
         if (null == isCheckCaptcha || 0 == isCheckCaptcha) {
         if (null == isCheckCaptcha || 0 == isCheckCaptcha) {
             Boolean checkFlag = checkCaptchaImage(token, imgCode, platformType);
             Boolean checkFlag = checkCaptchaImage(token, imgCode, platformType);
             if (!checkFlag) {
             if (!checkFlag) {
-                return ResponseJson.error("图验证码错误");
+                return ResponseJson.error("图验证码错误");
             }
             }
         }
         }
         boolean sendFlag = false;
         boolean sendFlag = false;
@@ -189,6 +190,35 @@ public class BaseServiceImpl implements BaseService {
             String content = "您正在采美平台发布二手商品,您的验证码为:" + randomCode + ",10分钟内有效,请勿泄露他人。";
             String content = "您正在采美平台发布二手商品,您的验证码为:" + randomCode + ",10分钟内有效,请勿泄露他人。";
             sendFlag = isBeta || remoteCallService.remoteSendSms(0, 1, mobile, content);
             sendFlag = isBeta || remoteCallService.remoteSendSms(0, 1, mobile, content);
             codeTypeTxt = "更换联系人(旧手机号验证码)";
             codeTypeTxt = "更换联系人(旧手机号验证码)";
+        } else if (7 == activateCodeType) {
+            // 校验是否发送验证码
+            /*Object resCode = redisService.get("code:" + mobile);
+            long expireTime = redisService.getExpireTime("code:" + mobile);
+            if (!ObjectUtils.isEmpty(resCode) || expireTime >= 0) {
+                return ResponseJson.error("验证码已发送,请勿重复操作");
+            }*/
+            // 重复发送,删除前一个验证码
+            redisService.remove("code:"+ mobile);
+            Integer dbUserId = null;
+            // 根据手机号查询用户Id
+            dbUserId = baseMapper.getUserIdByMobile(mobile);
+            if (dbUserId == null) {
+                return ResponseJson.error("该手机号暂未注册");
+            }
+            // 您正在操作登录采美商城,验证码:{s6},请在5分钟内完成验证。如非本人操作,请忽略本短信。
+            String content = "您正在操作登录采美商城,验证码:"+ randomCode +",请在5分钟内完成验证。如非本人操作,请忽略本短信。";
+            boolean smsFlag = isBeta || remoteCallService.remoteSendSms(0,1,mobile,content);
+            if (!smsFlag) {
+                // 短信发送失败重试一次
+                smsFlag = remoteCallService.remoteSendSms(0,1,mobile,content);
+            }
+            if (smsFlag) {
+                redisService.set("code:"+ mobile, randomCode,300L);
+                log.info("登录短信,发送到"+ mobile + "的验证码为:"+ randomCode);
+                return ResponseJson.success("发送验证码成功");
+            } else {
+                return ResponseJson.error("发送验证码失败,请稍后再试");
+            }
         } else {
         } else {
             return ResponseJson.error("参数错误:activateCodeType");
             return ResponseJson.error("参数错误:activateCodeType");
         }
         }
@@ -270,9 +300,8 @@ public class BaseServiceImpl implements BaseService {
             // 开发 和 测试环境 固定短信验证码 666666
             // 开发 和 测试环境 固定短信验证码 666666
             randomCode = "666666";
             randomCode = "666666";
         }
         }
-        String userName = baseMapper.getUserNameByUserId(userId);
-        // 欢迎成为${name}的运营人员,您的邀请码为${code}。
-        String content = "欢迎成为" + userName + "的运营人员,您的邀请码为" + randomCode + "。您可使用以下两种方式激活您的身份:1. 您可在微信搜索“采美采购商城”小程序,使用邀请码登录并绑定微信;2. 进入“采美采购商城”小程序后,使用邀请码登录并绑定微信。绑定微信后,您可通过微信授权直接登录“采美采购商城”小程序或微信扫码直接登录采美365网站。";
+        //	欢迎成为机构运营人员,您的验证码为{s6}。运营人员可通过微信授权直接登录采美365网。
+        String content = "欢迎成为机构运营人员运营人员,您的验证码为" + randomCode + "。运营人员可通过微信授权直接登录采美365网。";
         boolean smsFlag = isBeta || remoteCallService.remoteSendSms(0, 1, mobile, content);
         boolean smsFlag = isBeta || remoteCallService.remoteSendSms(0, 1, mobile, content);
         if (!smsFlag) {
         if (!smsFlag) {
             // 短信发送失败重试一次
             // 短信发送失败重试一次
@@ -336,6 +365,81 @@ public class BaseServiceImpl implements BaseService {
         return ResponseJson.success("发送验证码成功", "");
         return ResponseJson.success("发送验证码成功", "");
     }
     }
 
 
+    /**
+     * 获取登录验证码
+     *
+     * @param mobile 输入手机号
+     * @return
+     */
+    @Override
+    public ResponseJson getLoginCode(String mobile) {
+
+        // 验证手机号
+        String result = ValidateUtil.validateMobile(mobile);
+        if (result != null) {
+            return ResponseJson.error(result);
+        }
+
+        Integer dbUserId = null;
+        // 根据手机号查询用户Id
+        dbUserId = baseMapper.getUserIdByMobile(mobile);
+        if (dbUserId == null) {
+            return ResponseJson.error("该手机号暂未注册");
+        }
+
+        return ResponseJson.success();
+    }
+
+    /**
+     * 获取绑定运营人员验证码
+     *
+     * @param mobile
+     * @return
+     */
+    @Override
+    public ResponseJson operateSmsCode(String mobile) {
+        // 验证手机号
+        String result = ValidateUtil.validateMobile(mobile);
+        if (result != null) {
+            return ResponseJson.error(result);
+        }
+        // 校验是否发送验证码
+        Object resCode = redisService.get("code:" + mobile);
+        long expireTime = redisService.getExpireTime("code:" + mobile);
+        if (!ObjectUtils.isEmpty(resCode) || expireTime >= 0) {
+            return ResponseJson.error("验证码已发送,请勿重复操作");
+        }
+
+        // 重复发送,删除前一个验证码
+        /*redisService.remove("code:"+ mobile);*/
+        Integer dbUserId = null;
+        // 根据手机号查询用户Id
+        dbUserId = baseMapper.getUserIdByMobile(mobile);
+        if (dbUserId == null) {
+            return ResponseJson.error("该手机号暂未注册");
+        }
+        // 生成6位数验证码
+        String randomCode = CodeUtil.generateCodeInt(6);
+        // 开发、测试环境下短信验证码固定为666666
+        boolean isCode = "dev".equals(profile)||"beta".equals(profile);
+        if (isCode) {
+            randomCode = "666666";
+        }
+        // 您正在操作绑定运营人员,验证码:{s6},请在5分钟内完成验证。如非本人操作,请忽略本短信。
+        String content = "您正在操作绑定运营人员,验证码:"+ randomCode+",请在5分钟内完成验证。如非本人操作,请忽略本短信。";
+        boolean smsFlag = isCode || remoteCallService.remoteSendSms(0,1,mobile,content);
+        if (!smsFlag) {
+            smsFlag = remoteCallService.remoteSendSms(0,1,mobile,content);
+        }
+        if (smsFlag) {
+            redisService.set("code:"+mobile,randomCode,300L);
+            log.info("绑定运营人员,发送到:"+mobile+"验证码为:"+randomCode);
+            return ResponseJson.success("发送验证码成功");
+        } else {
+            return ResponseJson.error("发送验证码失败,请稍后再试");
+        }
+    }
+
     /**
     /**
      * 修改密码(找回密码)
      * 修改密码(找回密码)
      *
      *

+ 558 - 91
src/main/java/com/caimei365/user/service/impl/ClubServiceImpl.java

@@ -3,10 +3,7 @@ package com.caimei365.user.service.impl;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.caimei365.user.components.RedisService;
 import com.caimei365.user.components.RedisService;
-import com.caimei365.user.mapper.BaseMapper;
-import com.caimei365.user.mapper.ClubMapper;
-import com.caimei365.user.mapper.RegisterMapper;
-import com.caimei365.user.mapper.SuperVipMapper;
+import com.caimei365.user.mapper.*;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.ClubUpdateDto;
 import com.caimei365.user.model.dto.ClubUpdateDto;
 import com.caimei365.user.model.dto.SuperVipDto;
 import com.caimei365.user.model.dto.SuperVipDto;
@@ -17,6 +14,7 @@ import com.caimei365.user.model.po.UserBeansHistoryPo;
 import com.caimei365.user.model.po.UserPo;
 import com.caimei365.user.model.po.UserPo;
 import com.caimei365.user.model.vo.*;
 import com.caimei365.user.model.vo.*;
 import com.caimei365.user.service.ClubService;
 import com.caimei365.user.service.ClubService;
+import com.caimei365.user.service.SellerService;
 import com.caimei365.user.utils.ImageUtils;
 import com.caimei365.user.utils.ImageUtils;
 import com.caimei365.user.utils.MathUtil;
 import com.caimei365.user.utils.MathUtil;
 import com.caimei365.user.utils.OssUtil;
 import com.caimei365.user.utils.OssUtil;
@@ -24,8 +22,10 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.RequestParam;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
@@ -48,6 +48,8 @@ public class ClubServiceImpl implements ClubService {
     @Resource
     @Resource
     private ClubMapper clubMapper;
     private ClubMapper clubMapper;
     @Resource
     @Resource
+    private ClubReportMapper clubReportMapper;
+    @Resource
     private BaseMapper baseMapper;
     private BaseMapper baseMapper;
     @Resource
     @Resource
     private RegisterMapper registerMapper;
     private RegisterMapper registerMapper;
@@ -55,6 +57,10 @@ public class ClubServiceImpl implements ClubService {
     private SuperVipMapper vipMapper;
     private SuperVipMapper vipMapper;
     @Resource
     @Resource
     private RedisService redisService;
     private RedisService redisService;
+    @Resource
+    private SellerService sellerService;
+    @Resource
+    private AsyncService asyncService;
 
 
     /**
     /**
      * 根据用户Id查询机构资料
      * 根据用户Id查询机构资料
@@ -99,6 +105,45 @@ public class ClubServiceImpl implements ClubService {
         return ResponseJson.success(map);
         return ResponseJson.success(map);
     }
     }
 
 
+
+    @Override
+    public ResponseJson<Map<String, Object>> recordLinkage(Integer clubId) {
+        // 机构信息
+        ClubVo club = clubMapper.recordClubage(clubId);
+        String saleName = "";
+        if (!"".equals(club.getMainProduct()) && club.getMainProduct() != null) {
+            if (club.getMainProduct().contains("/")) {
+                List<String> list = Arrays.asList(club.getMainProduct().split("/"));
+                club.setMainProducts(list);
+            } else {
+                club.setMainProducts(Collections.singletonList(club.getMainProduct()));
+            }
+
+        }
+        if (club.getSpType() == 1) {
+            saleName = clubMapper.serviceProviderNameage(club.getServiceProviderId());
+        }
+
+        if (club == null) {
+            return ResponseJson.error("机构信息不存在", null);
+        }
+        if (null != club.getTownId()) {
+            TownVo town = baseMapper.getTown(club.getTownId());
+            CityVo city = baseMapper.getCity(town.getCityId());
+            ProvinceVo province = baseMapper.getProvince(city.getProvinceId());
+            club.setCityId(city.getCityId());
+            club.setProvinceId(province.getProvinceId());
+            club.setProvincialAddress(province.getName() + "" + city.getName() + "" + town.getName());
+        }
+        log.info("销售人名称" + saleName);
+        log.info("销售人id" + club.getServiceProviderId());
+        Map<String, Object> map = new HashMap(2);
+        map.put("club", club);
+        map.put("saleName", saleName);
+        return ResponseJson.success(map);
+    }
+
+
     /**
     /**
      * 修改机构资料
      * 修改机构资料
      *
      *
@@ -390,14 +435,17 @@ public class ClubServiceImpl implements ClubService {
             Integer satisfied = jsonObject.getInteger("satisfied");
             Integer satisfied = jsonObject.getInteger("satisfied");
             Integer followup = jsonObject.getInteger("followup");
             Integer followup = jsonObject.getInteger("followup");
             String extra = jsonObject.getString("extra");
             String extra = jsonObject.getString("extra");
+            Integer productID = jsonObject.getInteger("productId");
+            Integer reportID = jsonObject.getInteger("reportId");
             if (null == clubId) {
             if (null == clubId) {
                 return ResponseJson.error("参数异常,机构id不能为空");
                 return ResponseJson.error("参数异常,机构id不能为空");
             }
             }
             if (null == serviceProviderId) {
             if (null == serviceProviderId) {
                 return ResponseJson.error("参数异常,协销id不能为空");
                 return ResponseJson.error("参数异常,协销id不能为空");
             }
             }
-
-
+            List<ClubRemarksPo> remarksPos = clubMapper.findNewRemark(clubId, serviceProviderId);
+            //没有记录本次插入给组长推送消息,否则不推
+            boolean pushMessage = null == remarksPos || remarksPos.size() <= 0;
             log.info("【保存机构资料备注解析关键词1】:", remarks);
             log.info("【保存机构资料备注解析关键词1】:", remarks);
 
 
             boolean newRemarks = null == remarksId;
             boolean newRemarks = null == remarksId;
@@ -428,6 +476,8 @@ public class ClubServiceImpl implements ClubService {
             clubRemarksPo.setSatisfied(satisfied);
             clubRemarksPo.setSatisfied(satisfied);
             clubRemarksPo.setFollowup(followup);
             clubRemarksPo.setFollowup(followup);
             clubRemarksPo.setExtra(extra);
             clubRemarksPo.setExtra(extra);
+            clubRemarksPo.setProductID(productID);
+            clubRemarksPo.setReportID(reportID);
             if (newRemarks) {
             if (newRemarks) {
                 // 新增备注
                 // 新增备注
                 clubMapper.insertRemarks(clubRemarksPo);
                 clubMapper.insertRemarks(clubRemarksPo);
@@ -458,6 +508,10 @@ public class ClubServiceImpl implements ClubService {
                     clubMapper.insertRemarksFile(remarksId, fileName, ossName);
                     clubMapper.insertRemarksFile(remarksId, fileName, ossName);
                 }
                 }
             }
             }
+            //新分配的机构并且是第一条记录
+            if (newRemarks && pushMessage) {
+                asyncService.sendChoseServiceMessage(2, clubId, serviceProviderId, clubRemarksPo.getRemarksId());
+            }
             return ResponseJson.success("保存资料备注成功");
             return ResponseJson.success("保存资料备注成功");
         } catch (Exception e) {
         } catch (Exception e) {
             log.info("保存机构资料备注参数:" + jsonParamsDto.toString());
             log.info("保存机构资料备注参数:" + jsonParamsDto.toString());
@@ -466,6 +520,312 @@ public class ClubServiceImpl implements ClubService {
         }
         }
     }
     }
 
 
+    @Override
+    public ResponseJson<PaginationVo<ProductItemVo>> getproductList(String keyWord, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<ProductItemVo> productList = clubReportMapper.productList(keyWord);
+        return ResponseJson.success(new PaginationVo<>(productList));
+    }
+
+    @Override
+    public ResponseJson<PaginationVo<ReportVo>> ClubReportList(Integer serviceProviderId, Integer clubId, String keyWord, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<ReportVo> reportList = clubReportMapper.reportList(serviceProviderId, clubId, keyWord);
+        reportList.forEach(r -> {
+            r.setQuestionMan(clubReportMapper.questionManNameage(null, "", serviceProviderId));
+        });
+        return ResponseJson.success(new PaginationVo<>(reportList));
+    }
+
+    @Override
+    public ResponseJson<PaginationVo<ReportVo>> visitorReportList(String questionManId, String keyWord, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<ReportVo> reportList = clubReportMapper.visitorReportList(questionManId, keyWord);
+        reportList.forEach(r -> {
+            r.setQuestionMan(clubReportMapper.questionManNameage(null, questionManId, null));
+        });
+        return ResponseJson.success(new PaginationVo<>(reportList));
+    }
+
+
+    @Override
+    public ResponseJson<ReportVo> reportDetailsList(Integer reportId) {
+        ReportVo reportVo = clubReportMapper.reportDetailsList(reportId);
+        reportVo.setQuestionMan(clubReportMapper.questionManNameage(reportId, "", null));
+        return ResponseJson.success(reportVo);
+    }
+
+    @Override
+    public ResponseJson<ReportVo> visitorReportsList(Integer reportId) {
+        ReportVo reportVo = clubReportMapper.visitorReportsList(reportId);
+        reportVo.setQuestionMan(clubReportMapper.questionManNameage(reportId, "", null));
+        return ResponseJson.success(reportVo);
+    }
+
+    @Override
+    public ResponseJson saveClubReport(ReportVo reportVo) {
+        reportVo.setReportName(clubReportMapper.roeprtNa(reportVo.getServiceProviderId()));
+        reportVo.setServiceProviderId(reportVo.getServiceProviderId());
+        clubReportMapper.addClubReport(reportVo);
+        return ResponseJson.success("保存成功");
+    }
+
+    @Override
+    public ResponseJson addVisitorReport(ReportVo reportVo) {
+        Integer serviceProviderId = clubReportMapper.visitorMan(reportVo.getQuestionManId());
+        reportVo.setReportName(clubReportMapper.roeprtNa(serviceProviderId));
+        reportVo.setServiceProviderId(serviceProviderId);
+        clubReportMapper.addVisitorReport(reportVo);
+        return ResponseJson.success("保存成功");
+    }
+
+    @Override
+    public ResponseJson disassociation(Integer remarksId) {
+        clubReportMapper.disassociation(remarksId);
+        return ResponseJson.success("取消成功");
+    }
+
+    @Override
+    public ResponseJson visitorDisassociation(Integer remarksId) {
+        clubReportMapper.visitorDisassociation(remarksId);
+        return ResponseJson.success("取消成功");
+    }
+
+    @Override
+    public ResponseJson deleteReport(Integer reportId) {
+        clubReportMapper.deleteReport(reportId);
+        return ResponseJson.success("删除成功");
+    }
+
+    @Override
+    public ResponseJson<List<ServiceProviderVo>> choseSales(Integer spId) {
+        return sellerService.getServiceTeam(spId, 2);
+    }
+
+    @Override
+    public ResponseJson changeSales(Integer clubId, Integer spId, Integer choseServiceId) {
+        //创建审核记录
+        Integer oldSpId = clubMapper.findOldSpId(clubId);
+        ClubChangeSpVo clubChangeSpVo = new ClubChangeSpVo();
+        clubChangeSpVo.setClubID(clubId);
+        clubChangeSpVo.setApplyTime(new Date());
+        clubChangeSpVo.setCheckTime(new Date());
+        clubChangeSpVo.setCheckStatus("1");
+        clubChangeSpVo.setNewSpID(spId);
+        clubChangeSpVo.setOldSpID(oldSpId);
+        clubChangeSpVo.setChoseServiceId(choseServiceId);
+        clubMapper.insertChangeRecord(clubChangeSpVo);
+        //更换club表协销Id
+        clubMapper.updateClubSpId(clubId, spId);
+        //后台更换协销逻辑移植
+        List<Integer> oldSpIds = clubMapper.findOldSpIds(clubId);
+        if (null != oldSpIds && oldSpIds.size() > 0) {
+            clubMapper.updateRemarksSp(clubId, oldSpId, spId, 0);
+            clubMapper.updateReportSp(clubId, oldSpId, spId);
+        } else {
+            clubMapper.updateRemarksSp(clubId, oldSpId, spId, 1);
+        }
+        if (!spId.equals(choseServiceId)) {
+            asyncService.sendChoseServiceMessage(1, clubId, spId, choseServiceId);
+        }
+        return ResponseJson.success();
+    }
+
+    @Override
+    public ResponseJson<PaginationVo<RemarkVo>> associated(Integer manager, Integer serviceProviderId, Integer reportId, String keyWord, String startAddTime,
+                                                           String endAddTime,
+                                                           String consult,
+                                                           Integer leaderId,
+                                                           String clubType,
+                                                           Integer pinceSensitve,
+                                                           Integer satisfied,
+                                                           Integer followup,
+                                                           String extra,
+                                                           Integer groupId, Integer newDeal, Integer status, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<RemarksVo> reportList = null;
+        Integer teamId = clubReportMapper.reportLeaderId(serviceProviderId);
+        List<String> conss = new ArrayList<>();
+        if (StringUtils.isNotBlank(consult)) {
+            if (consult.contains(",")) {
+                conss = Arrays.asList(consult.split(","));
+            } else {
+                conss.add(consult);
+            }
+        }
+        if (null != manager && 1 == manager) {
+            //主管查所有注册客户咨询记录
+            log.info("方法1 管理员");
+            List<String> finalConss = conss;
+            reportList = clubReportMapper.associated(teamId, serviceProviderId, reportId, keyWord, startAddTime, endAddTime, leaderId, groupId, followup, satisfied, pinceSensitve, finalConss, newDeal, status);
+        } else if (null != teamId && teamId > 0) {
+            log.info("方法2 协销组长");
+            List<String> finalConss1 = conss;
+            reportList = clubReportMapper.associated(teamId, serviceProviderId, reportId, keyWord, startAddTime, endAddTime, leaderId, groupId, followup, satisfied, pinceSensitve, finalConss1, newDeal, status);
+        } else {
+            log.info("方法3 协销");
+            List<String> finalConss2 = conss;
+            reportList = clubReportMapper.associated(teamId, serviceProviderId, reportId, keyWord, startAddTime, endAddTime, leaderId, groupId, followup, satisfied, pinceSensitve, finalConss2, newDeal, status);
+        }
+        ArrayList<RemarkVo> remarkVos = new ArrayList<>();
+        RemarkVo remarkVo = new RemarkVo();
+        reportList.forEach(remarksVo -> {
+            List<Map<String, String>> strings = new ArrayList<>();
+            String rk = null == remarksVo.getRemarks() ? "" : remarksVo.getRemarks();
+            if (rk.contains(",")) {
+                String[] split = rk.split(",");
+                for (String remark : split) {
+                    HashMap<String, String> map = new HashMap<>();
+                    map.put("label", remark);
+                    strings.add(map);
+                }
+            } else {
+                HashMap<String, String> map = new HashMap<>();
+                map.put("label", rk);
+                strings.add(map);
+            }
+
+            remarkVo.setLeaderName(remarksVo.getLeaderName());
+            remarkVo.setRecordName(remarksVo.getRecordName());
+            remarkVo.setServiceProviderId(remarksVo.getServiceProviderId());
+            remarkVo.setRemarks(strings);
+            remarkVo.setQuestionMan(remarksVo.getQuestionMan());
+            remarkVo.setRemarksId(remarksVo.getRemarksId());
+            remarkVo.setAddTime(remarksVo.getAddTime());
+            remarkVo.setClubName(clubMapper.findClubName(remarksVo.getClubId()));
+            remarkVo.setClubName(remarksVo.getClubName());
+            remarkVo.setConsult(remarksVo.getConsult());
+            remarkVo.setClubType(remarksVo.getClubType());
+            remarkVo.setExtra(remarksVo.getExtra());
+            remarkVo.setSatisfied(remarksVo.getSatisfied());
+            remarkVo.setPinceSensitve(remarksVo.getPinceSensitve());
+            remarkVo.setFollowup(remarksVo.getFollowup());
+            remarkVo.setStatus(remarksVo.getStatus());
+            remarkVo.setNewDeal(remarksVo.getNewDeal());
+            remarkVos.add(remarkVo);
+        });
+        PaginationVo<RemarkVo> pageVo = new PaginationVo<>(remarkVos);
+        if (null != remarkVos && remarkVos.size() > 0) {
+            pageVo.setTotalRecord(remarkVos.size());
+            if (remarkVos.size() > pageSize) {
+                pageVo.setTotalPage((int) Math.ceil(MathUtil.div(remarkVos.size(), pageSize).doubleValue()));
+                pageVo.setHasNextPage(true);
+            } else {
+                pageVo.setTotalPage(1);
+                pageVo.setHasNextPage(false);
+            }
+        } else {
+            pageVo.setTotalPage(0);
+            pageVo.setHasNextPage(false);
+            pageVo.setTotalRecord(0);
+        }
+        return ResponseJson.success(pageVo);
+    }
+
+    @Override
+    public ResponseJson<PaginationVo<RemarkVo>> visitorAssociated(Integer manager, Integer serviceProviderId, Integer reportId, String keyWord, String startAddTime,
+                                                                  String endAddTime,
+                                                                  String consult,
+                                                                  Integer leaderId,
+                                                                  String clubType,
+                                                                  Integer pinceSensitve,
+                                                                  Integer satisfied,
+                                                                  Integer followup,
+                                                                  String extra,
+                                                                  Integer groupId, Integer status, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<RemarksVo> reportList = null;
+        Integer teamId = clubReportMapper.reportLeaderId(serviceProviderId);
+        List<String> conss = new ArrayList<>();
+        if (StringUtils.isNotBlank(consult)) {
+            if (consult.contains(",")) {
+                conss = Arrays.asList(consult.split(","));
+            } else {
+                conss.add(consult);
+            }
+        }
+        if (null != manager && 1 == manager) {
+            //主管查所有注册客户咨询记录
+            log.info("方法1 管理员");
+            List<String> finalConss = conss;
+            reportList = clubReportMapper.visitorAssociated(teamId, serviceProviderId, reportId, keyWord, startAddTime, endAddTime, leaderId, groupId, followup, satisfied, pinceSensitve, finalConss, status);
+        } else if (null != teamId && teamId > 0) {
+            log.info("方法2 协销组长");
+            List<String> finalConss1 = conss;
+            reportList = clubReportMapper.visitorAssociated(teamId, serviceProviderId, reportId, keyWord, startAddTime, endAddTime, leaderId, groupId, followup, satisfied, pinceSensitve, finalConss1, status);
+        } else {
+            log.info("方法3 协销");
+            List<String> finalConss2 = conss;
+            reportList = clubReportMapper.visitorAssociated(teamId, serviceProviderId, reportId, keyWord, startAddTime, endAddTime, leaderId, groupId, followup, satisfied, pinceSensitve, finalConss2, status);
+        }
+        ArrayList<RemarkVo> remarkVos = new ArrayList<>();
+        RemarkVo remarkVo = new RemarkVo();
+        reportList.forEach(remarksVo -> {
+            List<Map<String, String>> strings = new ArrayList<>();
+            String rk = null == remarksVo.getRemarks() ? "" : remarksVo.getRemarks();
+            if (rk.contains(",")) {
+                String[] split = rk.split(",");
+                for (String remark : split) {
+                    HashMap<String, String> map = new HashMap<>();
+                    map.put("label", remark);
+                    strings.add(map);
+                }
+            } else {
+                HashMap<String, String> map = new HashMap<>();
+                map.put("label", rk);
+                strings.add(map);
+            }
+            if (StringUtils.isNotBlank(remarksVo.getConsult())) {
+                if (remarksVo.getConsult().contains(",")) {
+                    String[] split = remarksVo.getConsult().split(",");
+                    String Cons = "";
+                    for (String con : split) {
+                        Cons += clubMapper.findConsultById(con).getClassName() + ",";
+                    }
+                    Cons = Cons.substring(0, Cons.length() - 1);
+                    remarkVo.setConsultBack(Cons);
+                } else {
+                    remarkVo.setConsultBack(clubMapper.findConsultById(remarksVo.getConsult()).getClassName());
+                }
+            }
+            remarkVo.setLeaderName(remarksVo.getLeaderName());
+            remarkVo.setRecordName(remarksVo.getRecordName());
+            remarkVo.setServiceProviderId(remarksVo.getServiceProviderId());
+            remarkVo.setRemarks(strings);
+            remarkVo.setQuestionMan(remarksVo.getQuestionMan());
+            remarkVo.setRemarksId(remarksVo.getRemarksId());
+            remarkVo.setAddTime(remarksVo.getAddTime());
+            remarkVo.setClubName(clubMapper.findClubName(remarksVo.getClubId()));
+            remarkVo.setClubName(remarksVo.getClubName());
+            remarkVo.setConsult(remarksVo.getConsult());
+            remarkVo.setClubType(remarksVo.getClubType());
+            remarkVo.setExtra(remarksVo.getExtra());
+            remarkVo.setSatisfied(remarksVo.getSatisfied());
+            remarkVo.setPinceSensitve(remarksVo.getPinceSensitve());
+            remarkVo.setFollowup(remarksVo.getFollowup());
+            remarkVo.setStatus(remarksVo.getStatus());
+            remarkVo.setNewDeal(remarksVo.getNewDeal());
+            remarkVos.add(remarkVo);
+        });
+        PaginationVo<RemarkVo> pageVo = new PaginationVo<>(remarkVos);
+        if (null != remarkVos && remarkVos.size() > 0) {
+            pageVo.setTotalRecord(remarkVos.size());
+            if (remarkVos.size() > pageSize) {
+                pageVo.setTotalPage((int) Math.ceil(MathUtil.div(remarkVos.size(), pageSize).doubleValue()));
+                pageVo.setHasNextPage(true);
+            } else {
+                pageVo.setTotalPage(1);
+                pageVo.setHasNextPage(false);
+            }
+        } else {
+            pageVo.setTotalPage(0);
+            pageVo.setHasNextPage(false);
+            pageVo.setTotalRecord(0);
+        }
+        return ResponseJson.success(pageVo);
+//        return ResponseJson.success(new PaginationVo<>(reportList));
+    }
+
     @Override
     @Override
     public ResponseJson<PaginationVo<RemarkVo>> getRemarksList(Integer serviceProviderId,
     public ResponseJson<PaginationVo<RemarkVo>> getRemarksList(Integer serviceProviderId,
                                                                String keyWord,
                                                                String keyWord,
@@ -479,11 +839,12 @@ public class ClubServiceImpl implements ClubService {
                                                                Integer satisfied,
                                                                Integer satisfied,
                                                                Integer followup,
                                                                Integer followup,
                                                                String extra,
                                                                String extra,
-                                                               Integer groupId,
+                                                               Integer groupId, Integer status, Integer newDeal,
                                                                int pageNum, int pageSize) {
                                                                int pageNum, int pageSize) {
         if (null == serviceProviderId) {
         if (null == serviceProviderId) {
             return ResponseJson.error("参数异常,协销id不能为空", null);
             return ResponseJson.error("参数异常,协销id不能为空", null);
         }
         }
+//        List<RemarksVo> pageInfo = null;
         PageInfo<RemarksVo> pageInfo = null;
         PageInfo<RemarksVo> pageInfo = null;
         Integer findLeader = clubMapper.findLeaderId(serviceProviderId);
         Integer findLeader = clubMapper.findLeaderId(serviceProviderId);
         List<String> conss = new ArrayList<>();
         List<String> conss = new ArrayList<>();
@@ -494,20 +855,40 @@ public class ClubServiceImpl implements ClubService {
                 conss.add(consult);
                 conss.add(consult);
             }
             }
         }
         }
+
         if (null != manager && 1 == manager) {
         if (null != manager && 1 == manager) {
             //主管查所有注册客户咨询记录
             //主管查所有注册客户咨询记录
-            log.info("方法1 所有");
+            log.info("方法1 管理员");
             List<String> finalConss = conss;
             List<String> finalConss = conss;
-            pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> clubMapper.findAllRemarks(keyWord, startAddTime, endAddTime, leaderId, groupId, followup, satisfied, pinceSensitve, finalConss));
+            pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> clubMapper.findAllRemarks(keyWord, startAddTime, endAddTime, leaderId, groupId, followup, satisfied, pinceSensitve, finalConss, status, newDeal));
         } else if (null != findLeader && findLeader > 0) {
         } else if (null != findLeader && findLeader > 0) {
-            log.info("方法2 小组");
+            log.info("方法2 协销组长");
             List<String> finalConss1 = conss;
             List<String> finalConss1 = conss;
-            pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> clubMapper.findAllRemarks(keyWord, startAddTime, endAddTime, serviceProviderId, groupId, followup, satisfied, pinceSensitve, finalConss1));
+            pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> clubMapper.findAllRemarks(keyWord, startAddTime, endAddTime, serviceProviderId, groupId, followup, satisfied, pinceSensitve, finalConss1, status, newDeal));
         } else {
         } else {
             log.info("方法3 协销");
             log.info("方法3 协销");
             List<String> finalConss2 = conss;
             List<String> finalConss2 = conss;
-            pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> clubMapper.getRemarksListByKey(keyWord, serviceProviderId, startAddTime, endAddTime, pinceSensitve, leaderId, groupId, followup, satisfied, finalConss2));
+            pageInfo = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> clubMapper.getRemarksListByKey(keyWord, serviceProviderId, startAddTime, endAddTime, pinceSensitve, leaderId, groupId, followup, satisfied, finalConss2, status, newDeal));
         }
         }
+
+//        if (null != manager && 1 == manager) {
+//            //主管查所有注册客户咨询记录
+//            log.info("方法1 管理员");
+//            List<String> finalConss = conss;
+//            PageHelper.startPage(pageNum, pageSize);
+//            pageInfo =  clubMapper.findAllRemarks(keyWord, startAddTime, endAddTime, leaderId, groupId, followup, satisfied, pinceSensitve, finalConss,status,newDeal);
+//        } else if (null != findLeader && findLeader > 0) {
+//            log.info("方法2 协销组长");
+//            PageHelper.startPage(pageNum, pageSize);
+//            List<String> finalConss1 = conss;
+//            pageInfo =  clubMapper.findAllRemarks(keyWord, startAddTime, endAddTime, serviceProviderId, groupId, followup, satisfied, pinceSensitve, finalConss1,status,newDeal);
+//        } else {
+//            log.info("方法3 协销");
+//            PageHelper.startPage(pageNum, pageSize);
+//            List<String> finalConss2 = conss;
+//            pageInfo =  clubMapper.getRemarksListByKey(keyWord, serviceProviderId, startAddTime, endAddTime, pinceSensitve, leaderId, groupId, followup, satisfied, finalConss2,status,newDeal);
+//        }
+
         ArrayList<RemarkVo> remarkVos = new ArrayList<>();
         ArrayList<RemarkVo> remarkVos = new ArrayList<>();
         pageInfo.getList().forEach(r -> {
         pageInfo.getList().forEach(r -> {
             RemarkVo remarkVo = new RemarkVo();
             RemarkVo remarkVo = new RemarkVo();
@@ -562,13 +943,17 @@ public class ClubServiceImpl implements ClubService {
             remarkVo.setPinceSensitve(r.getPinceSensitve());
             remarkVo.setPinceSensitve(r.getPinceSensitve());
             remarkVo.setFollowup(r.getFollowup());
             remarkVo.setFollowup(r.getFollowup());
 //            remarkVo.setOldName(r.getOldName());
 //            remarkVo.setOldName(r.getOldName());
+            remarkVo.setStatus(r.getStatus());
+            remarkVo.setNewDeal(r.getNewDeal());
             remarkVos.add(remarkVo);
             remarkVos.add(remarkVo);
         });
         });
+
         PaginationVo<RemarkVo> pageVo = new PaginationVo<>(remarkVos);
         PaginationVo<RemarkVo> pageVo = new PaginationVo<>(remarkVos);
         if (null != remarkVos && remarkVos.size() > 0) {
         if (null != remarkVos && remarkVos.size() > 0) {
-            pageVo.setTotalRecord(remarkVos.size());
-            if (remarkVos.size() > pageSize) {
-                pageVo.setTotalPage((int) Math.ceil(MathUtil.div(remarkVos.size(), pageSize).doubleValue()));
+            pageVo.setTotalRecord((int) pageInfo.getTotal());
+            if (pageInfo.getSize() >= pageSize) {
+                pageVo.setTotalPage((int) Math.ceil(MathUtil.div(pageInfo.getTotal(), pageSize).doubleValue()));
+                log.info(">>>>>>>>>>>>>>>>>>>>" + MathUtil.div(pageInfo.getTotal(), pageSize).doubleValue());
                 pageVo.setHasNextPage(true);
                 pageVo.setHasNextPage(true);
             } else {
             } else {
                 pageVo.setTotalPage(1);
                 pageVo.setTotalPage(1);
@@ -592,50 +977,108 @@ public class ClubServiceImpl implements ClubService {
         List<RemarksFileVo> fileList = clubMapper.getRemarksFileList(remarksId);
         List<RemarksFileVo> fileList = clubMapper.getRemarksFileList(remarksId);
         fileList.forEach(file -> file.setFileUrl(OssUtil.getOssUrl(file.getOssName())));
         fileList.forEach(file -> file.setFileUrl(OssUtil.getOssUrl(file.getOssName())));
         List<Map<String, String>> strings = new ArrayList<>();
         List<Map<String, String>> strings = new ArrayList<>();
-        String rk = null == remarksVo.getRemarks() ? "" : remarksVo.getRemarks();
-        if (rk.contains(",")) {
-            String[] split = rk.split(",");
-            for (String remark : split) {
+        if (remarksVo != null) {
+            String rk = null == remarksVo.getRemarks() ? "" : remarksVo.getRemarks();
+            if (rk.contains(",")) {
+                String[] split = rk.split(",");
+                for (String remark : split) {
+                    HashMap<String, String> map = new HashMap<>();
+                    map.put("label", remark);
+                    strings.add(map);
+                }
+            } else {
                 HashMap<String, String> map = new HashMap<>();
                 HashMap<String, String> map = new HashMap<>();
-                map.put("label", remark);
+                map.put("label", rk);
                 strings.add(map);
                 strings.add(map);
             }
             }
-        } else {
-            HashMap<String, String> map = new HashMap<>();
-            map.put("label", rk);
-            strings.add(map);
-        }
-        RemarkVo remarkVo = new RemarkVo();
-        remarkVo.setClubId(remarksVo.getClubId());
-        remarkVo.setUserId(remarksVo.getUserId());
-        remarkVo.setRemarksId(remarksVo.getRemarksId());
-        remarkVo.setQuestionMan(remarksVo.getQuestionMan());
-        remarkVo.setRemarks(strings);
-        remarkVo.setFileList(fileList);
-        remarkVo.setImageList(imageList);
-        remarkVo.setAddTime(remarksVo.getAddTime());
-        remarkVo.setConsult(remarksVo.getConsult());
-        remarkVo.setClubType(remarksVo.getClubType());
-        remarkVo.setPinceSensitve(remarksVo.getPinceSensitve());
-        remarkVo.setSatisfied(remarksVo.getSatisfied());
-        remarkVo.setFollowup(remarksVo.getFollowup());
-        remarkVo.setExtra(remarksVo.getExtra());
-        if (StringUtils.isNotBlank(remarksVo.getConsult())) {
-            if (remarkVo.getConsult().contains(",")) {
-                List<String> cons = Arrays.asList(remarkVo.getConsult().split(","));
-                String Cons = "";
-                for (String con : cons) {
-                    Cons += clubMapper.findConsultById(con).getClassName() + ",";
+
+            RemarkVo remarkVo = new RemarkVo();
+            remarkVo.setClubId(remarksVo.getClubId());
+            remarkVo.setUserId(remarksVo.getUserId());
+            remarkVo.setRemarksId(remarksVo.getRemarksId());
+            remarkVo.setQuestionMan(remarksVo.getQuestionMan());
+            remarkVo.setRemarks(strings);
+            remarkVo.setFileList(fileList);
+            remarkVo.setImageList(imageList);
+            remarkVo.setAddTime(remarksVo.getAddTime());
+            remarkVo.setConsult(remarksVo.getConsult());
+            remarkVo.setClubType(remarksVo.getClubType());
+            remarkVo.setPinceSensitve(remarksVo.getPinceSensitve());
+            remarkVo.setSatisfied(remarksVo.getSatisfied());
+            remarkVo.setFollowup(remarksVo.getFollowup());
+            remarkVo.setExtra(remarksVo.getExtra());
+            remarkVo.setMainImage(remarksVo.getMainImage());
+            remarkVo.setReportText(remarksVo.getReportText());
+            remarkVo.setProductName(remarksVo.getProductName());
+            remarkVo.setShopName(remarksVo.getShopName());
+            remarkVo.setStatus(remarksVo.getStatus());
+            remarkVo.setAuditText(remarksVo.getAuditText());
+            remarkVo.setNewDeal(remarksVo.getNewDeal());
+            remarkVo.setProductId(remarksVo.getProductId());
+            remarkVo.setReportId(remarksVo.getReportId());
+            if (StringUtils.isNotBlank(remarksVo.getConsult())) {
+                if (remarkVo.getConsult().contains(",")) {
+                    List<String> cons = Arrays.asList(remarkVo.getConsult().split(","));
+                    String Cons = "";
+                    for (String con : cons) {
+                        Cons += clubMapper.findConsultById(con).getClassName() + ",";
+                    }
+                    Cons = Cons.substring(0, Cons.length() - 1);
+                    remarkVo.setConsultBack(Cons);
+                } else {
+                    remarkVo.setConsultBack(clubMapper.findConsultById(remarkVo.getConsult()).getClassName());
                 }
                 }
-                Cons = Cons.substring(0, Cons.length() - 1);
-                remarkVo.setConsultBack(Cons);
-            } else {
-                remarkVo.setConsultBack(clubMapper.findConsultById(remarkVo.getConsult()).getClassName());
             }
             }
+            return ResponseJson.success(remarkVo);
         }
         }
-        return ResponseJson.success(remarkVo);
+        return ResponseJson.error("remarksVo为空remarksId:" + remarksId);
     }
     }
 
 
+    @Override
+    public ResponseJson<PaginationVo<ReportVo>> visitorReportRemarks(Integer manager, Integer serviceProviderId, String keyWord, int pageNum, int pageSize) {
+        Integer teamId = clubReportMapper.reportLeaderId(serviceProviderId);
+        List<ReportVo> pageInfo = null;
+        PageHelper.startPage(pageNum, pageSize);
+        if (null != manager && 1 == manager) {
+            //主管查所有注册客户咨询记录
+            log.info("方法1 管理员");
+            pageInfo = clubReportMapper.visitoReportRemark(teamId, serviceProviderId, keyWord);
+        } else if (null != teamId && teamId > 0) {
+            log.info("方法2 协销组长");
+
+            pageInfo = clubReportMapper.visitorReportRemarks(teamId, serviceProviderId, keyWord);
+        } else {
+            log.info("方法3 协销");
+            pageInfo = clubReportMapper.visitorReportRemarks(teamId, serviceProviderId, keyWord);
+        }
+        pageInfo.forEach(r -> {
+            r.setQuestionMan(clubReportMapper.questionManNameage(r.getReportId(), "", null));
+        });
+        return ResponseJson.success(new PaginationVo<>(pageInfo));
+    }
+
+
+    @Override
+    public ResponseJson<PaginationVo<ReportVo>> reportRemarks(Integer manager, Integer serviceProviderId, String keyWord, int pageNum, int pageSize) {
+        Integer teamId = clubReportMapper.reportLeaderId(serviceProviderId);
+        List<ReportVo> pageInfo = null;
+        PageHelper.startPage(pageNum, pageSize);
+        if (null != manager && 1 == manager) {
+            //主管查所有注册客户咨询记录
+            log.info("方法1 管理员");
+            pageInfo = clubReportMapper.repotRemark(teamId, null, keyWord, manager);
+        } else if (null != teamId && teamId > 0) {
+            log.info("方法2 协销组长");
+
+            pageInfo = clubReportMapper.reportRemarks(teamId, serviceProviderId, keyWord, manager);
+        } else {
+            log.info("方法3 协销");
+            pageInfo = clubReportMapper.reportRemarks(teamId, serviceProviderId, keyWord, manager);
+        }
+        return ResponseJson.success(new PaginationVo<>(pageInfo));
+    }
+
+
     @Override
     @Override
     public ResponseJson deleteClubRemarks(Integer remarksId) {
     public ResponseJson deleteClubRemarks(Integer remarksId) {
         if (null == remarksId) {
         if (null == remarksId) {
@@ -846,6 +1289,8 @@ public class ClubServiceImpl implements ClubService {
             Integer satisfied = jsonObject.getInteger("satisfied");
             Integer satisfied = jsonObject.getInteger("satisfied");
             Integer followup = jsonObject.getInteger("followup");
             Integer followup = jsonObject.getInteger("followup");
             String extra = jsonObject.getString("extra");
             String extra = jsonObject.getString("extra");
+            Integer productID = jsonObject.getInteger("productId");
+            Integer reportID = jsonObject.getInteger("reportId");
 
 
             if (null == questionManId) {
             if (null == questionManId) {
                 return ResponseJson.error("参数异常,咨询人id不能为空");
                 return ResponseJson.error("参数异常,咨询人id不能为空");
@@ -888,6 +1333,8 @@ public class ClubServiceImpl implements ClubService {
             visitorRemarkVo.setSatisfied(satisfied);
             visitorRemarkVo.setSatisfied(satisfied);
             visitorRemarkVo.setFollowup(followup);
             visitorRemarkVo.setFollowup(followup);
             visitorRemarkVo.setExtra(extra);
             visitorRemarkVo.setExtra(extra);
+            visitorRemarkVo.setReportId(reportID);
+            visitorRemarkVo.setProductId(productID);
             if (newRemarks) {
             if (newRemarks) {
                 // 新增备注
                 // 新增备注
                 clubMapper.insertVisitorRemark(visitorRemarkVo);
                 clubMapper.insertVisitorRemark(visitorRemarkVo);
@@ -936,52 +1383,65 @@ public class ClubServiceImpl implements ClubService {
         List<RemarksFileVo> fileList = clubMapper.getVisitRemarksFileList(remarksId);
         List<RemarksFileVo> fileList = clubMapper.getVisitRemarksFileList(remarksId);
         fileList.forEach(file -> file.setFileUrl(OssUtil.getOssUrl(file.getOssName())));
         fileList.forEach(file -> file.setFileUrl(OssUtil.getOssUrl(file.getOssName())));
         List<Map<String, String>> strings = new ArrayList<>();
         List<Map<String, String>> strings = new ArrayList<>();
-        String rk = null == visitRemarksVo.getRemarks() ? "" : visitRemarksVo.getRemarks();
-        if (rk.contains(",")) {
-            String[] split = rk.split(",");
-            for (String remark : split) {
+        if (visitRemarksVo != null) {
+            String rk = null == visitRemarksVo.getRemarks() ? "" : visitRemarksVo.getRemarks();
+            if (rk.contains(",")) {
+                String[] split = rk.split(",");
+                for (String remark : split) {
+                    HashMap<String, String> map = new HashMap<>();
+                    map.put("label", remark);
+                    strings.add(map);
+                }
+            } else {
                 HashMap<String, String> map = new HashMap<>();
                 HashMap<String, String> map = new HashMap<>();
-                map.put("label", remark);
+                map.put("label", rk);
                 strings.add(map);
                 strings.add(map);
             }
             }
-        } else {
-            HashMap<String, String> map = new HashMap<>();
-            map.put("label", rk);
-            strings.add(map);
-        }
-        VisitRemarkVo visit = new VisitRemarkVo();
-        visit.setConsult(visitRemarksVo.getConsult());
-        visit.setQuestionMan(visitRemarksVo.getQuestionMan());
-        visit.setQuestionManId(visitRemarksVo.getQuestionManId());
-        visit.setRemarksId(visitRemarksVo.getRemarksId());
-        visit.setRemarks(strings);
-        visit.setAddDate(visitRemarksVo.getAddDate());
-        visit.setImageList(imageList);
-        visit.setFileList(fileList);
-        visit.setClubType(visitRemarksVo.getClubType());
-        visit.setFollowup(visitRemarksVo.getFollowup());
-        visit.setSatisfied(visitRemarksVo.getSatisfied());
-        visit.setPinceSensitve(visitRemarksVo.getPinceSensitve());
-        visit.setExtra(visitRemarksVo.getExtra());
-
-        if (StringUtils.isNotBlank(visitRemarksVo.getConsult())) {
-            if (visitRemarksVo.getConsult().contains(",")) {
-                List<String> cons = Arrays.asList(visitRemarksVo.getConsult().split(","));
-                String Cons = "";
-                for (String con : cons) {
-                    Cons += clubMapper.findConsultById(con).getClassName() + ",";
+
+            VisitRemarkVo visit = new VisitRemarkVo();
+            visit.setConsult(visitRemarksVo.getConsult());
+            visit.setQuestionMan(visitRemarksVo.getQuestionMan());
+            visit.setQuestionManId(visitRemarksVo.getQuestionManId());
+            visit.setRemarksId(visitRemarksVo.getRemarksId());
+            visit.setRemarks(strings);
+            visit.setAddDate(visitRemarksVo.getAddDate());
+            visit.setImageList(imageList);
+            visit.setFileList(fileList);
+            visit.setClubType(visitRemarksVo.getClubType());
+            visit.setFollowup(visitRemarksVo.getFollowup());
+            visit.setSatisfied(visitRemarksVo.getSatisfied());
+            visit.setPinceSensitve(visitRemarksVo.getPinceSensitve());
+            visit.setExtra(visitRemarksVo.getExtra());
+
+            visit.setMainImage(visitRemarksVo.getMainImage());
+            visit.setReportText(visitRemarksVo.getReportText());
+            visit.setProductName(visitRemarksVo.getProductName());
+            visit.setShopName(visitRemarksVo.getShopName());
+            visit.setStatus(visitRemarksVo.getStatus());
+            visit.setAuditText(visitRemarksVo.getAuditText());
+            visit.setProductId(visitRemarksVo.getProductId());
+            visit.setReportId(visitRemarksVo.getReportId());
+
+            if (StringUtils.isNotBlank(visitRemarksVo.getConsult())) {
+                if (visitRemarksVo.getConsult().contains(",")) {
+                    List<String> cons = Arrays.asList(visitRemarksVo.getConsult().split(","));
+                    String Cons = "";
+                    for (String con : cons) {
+                        Cons += clubMapper.findConsultById(con).getClassName() + ",";
+                    }
+                    Cons = Cons.substring(0, Cons.length() - 1);
+                    visit.setConsultBack(Cons);
+                } else {
+                    visit.setConsultBack(clubMapper.findConsultById(visitRemarksVo.getConsult()).getClassName());
                 }
                 }
-                Cons = Cons.substring(0, Cons.length() - 1);
-                visit.setConsultBack(Cons);
-            } else {
-                visit.setConsultBack(clubMapper.findConsultById(visitRemarksVo.getConsult()).getClassName());
             }
             }
+            return ResponseJson.success(visit);
         }
         }
-        return ResponseJson.success(visit);
+        return ResponseJson.error("visitRemarksVo为空remarksId:" + remarksId);
     }
     }
 
 
     @Override
     @Override
-    public ResponseJson<PaginationVo<VisitRemarkVo>> getVisitorRecordList(String questionManId, String keyWord, Integer serviceProviderId, String startAddTime, String endAddTime, String consult, Integer leaderId, Integer groupId, Integer manager, String clubType, Integer pinceSensitve, Integer satisfied, Integer followup, String extra, int pageNum, int pageSize) {
+    public ResponseJson<PaginationVo<VisitRemarkVo>> getVisitorRecordList(String questionManId, String keyWord, Integer serviceProviderId, String startAddTime, String endAddTime, String consult, Integer leaderId, Integer groupId, Integer manager, String clubType, Integer pinceSensitve, Integer satisfied, Integer followup, String extra, Integer status, int pageNum, int pageSize) {
         PageInfo<VisitorRemarkVo> remarksList = null;
         PageInfo<VisitorRemarkVo> remarksList = null;
         List<String> conss = new ArrayList<>();
         List<String> conss = new ArrayList<>();
         if (StringUtils.isNotBlank(consult)) {
         if (StringUtils.isNotBlank(consult)) {
@@ -995,13 +1455,13 @@ public class ClubServiceImpl implements ClubService {
         if (null != manager && 1 == manager) {
         if (null != manager && 1 == manager) {
             //主管查所有注册客户咨询记录
             //主管查所有注册客户咨询记录
             List<String> finalConss = conss;
             List<String> finalConss = conss;
-            remarksList = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> clubMapper.getAllVisitRemark(keyWord, startAddTime, endAddTime, leaderId, groupId, pinceSensitve, satisfied, followup, finalConss));
+            remarksList = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> clubMapper.getAllVisitRemark(keyWord, startAddTime, endAddTime, leaderId, groupId, pinceSensitve, satisfied, followup, finalConss, status));
         } else if (null != findLeader && findLeader > 0) {
         } else if (null != findLeader && findLeader > 0) {
             List<String> finalConss1 = conss;
             List<String> finalConss1 = conss;
-            remarksList = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> clubMapper.getAllVisitRemark(keyWord, startAddTime, endAddTime, leaderId, groupId, pinceSensitve, satisfied, followup, finalConss1));
+            remarksList = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> clubMapper.getAllVisitRemark(keyWord, startAddTime, endAddTime, leaderId, groupId, pinceSensitve, satisfied, followup, finalConss1, status));
         } else {
         } else {
             List<String> finalConss2 = conss;
             List<String> finalConss2 = conss;
-            remarksList = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> clubMapper.getVisitorListByKey(serviceProviderId, keyWord, startAddTime, endAddTime, pinceSensitve, satisfied, followup, finalConss2));
+            remarksList = PageHelper.startPage(pageNum, pageSize).doSelectPageInfo(() -> clubMapper.getVisitorListByKey(serviceProviderId, keyWord, startAddTime, endAddTime, pinceSensitve, satisfied, followup, finalConss2, status));
         }
         }
         ArrayList<VisitRemarkVo> remarkVos = new ArrayList<>();
         ArrayList<VisitRemarkVo> remarkVos = new ArrayList<>();
         remarksList.getList().forEach(r -> {
         remarksList.getList().forEach(r -> {
@@ -1059,6 +1519,7 @@ public class ClubServiceImpl implements ClubService {
             visit.setSatisfied(r.getSatisfied());
             visit.setSatisfied(r.getSatisfied());
             visit.setFollowup(r.getFollowup());
             visit.setFollowup(r.getFollowup());
             visit.setExtra(r.getExtra());
             visit.setExtra(r.getExtra());
+            visit.setStatus(r.getStatus());
             remarkVos.add(visit);
             remarkVos.add(visit);
         });
         });
         PaginationVo<VisitRemarkVo> pageVo = new PaginationVo<>(remarkVos);
         PaginationVo<VisitRemarkVo> pageVo = new PaginationVo<>(remarkVos);
@@ -1105,6 +1566,7 @@ public class ClubServiceImpl implements ClubService {
         }
         }
         //根据咨询人查cm_visitor_remarks赋值clubid,concactTime
         //根据咨询人查cm_visitor_remarks赋值clubid,concactTime
         clubMapper.updateVisit(questionManId, clubId);
         clubMapper.updateVisit(questionManId, clubId);
+        clubMapper.updateReport(questionManId, clubId);
         //cm_visitor_remarks搬运到cm_club_remarks,cm_visitor_remarks_file搬运到cm_club_remarks_file
         //cm_visitor_remarks搬运到cm_club_remarks,cm_visitor_remarks_file搬运到cm_club_remarks_file
         List<VisitorRemarkVo> visits = clubMapper.findConcactVisit(questionManId);
         List<VisitorRemarkVo> visits = clubMapper.findConcactVisit(questionManId);
         visits.forEach(v -> {
         visits.forEach(v -> {
@@ -1123,6 +1585,9 @@ public class ClubServiceImpl implements ClubService {
             remarksVo.setFollowup(v.getFollowup());
             remarksVo.setFollowup(v.getFollowup());
             remarksVo.setExtra(v.getExtra());
             remarksVo.setExtra(v.getExtra());
             remarksVo.setClubType(v.getClubType());
             remarksVo.setClubType(v.getClubType());
+            remarksVo.setStatus(v.getStatus());
+            remarksVo.setProductId(v.getProductId());
+            remarksVo.setReportId(v.getReportId());
             clubMapper.concactVisit(remarksVo);
             clubMapper.concactVisit(remarksVo);
             if (null != imageList && imageList.size() > 0) {
             if (null != imageList && imageList.size() > 0) {
                 imageList.forEach(i -> clubMapper.insertRemarksImage(remarksVo.getRemarksId(), i));
                 imageList.forEach(i -> clubMapper.insertRemarksImage(remarksVo.getRemarksId(), i));
@@ -1172,4 +1637,6 @@ public class ClubServiceImpl implements ClubService {
         List<CmRemarksVo> remarklist = clubMapper.getCmRemarksList(remarks);
         List<CmRemarksVo> remarklist = clubMapper.getCmRemarksList(remarks);
         return ResponseJson.success(remarklist);
         return ResponseJson.success(remarklist);
     }
     }
+
+
 }
 }

+ 183 - 91
src/main/java/com/caimei365/user/service/impl/LoginServiceImpl.java

@@ -7,10 +7,7 @@ import com.caimei365.user.components.RedisService;
 import com.caimei365.user.components.WeChatService;
 import com.caimei365.user.components.WeChatService;
 import com.caimei365.user.mapper.*;
 import com.caimei365.user.mapper.*;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.ResponseJson;
-import com.caimei365.user.model.dto.AuthBindDto;
-import com.caimei365.user.model.dto.LoginPasswordDto;
-import com.caimei365.user.model.dto.ScanBindDto;
-import com.caimei365.user.model.dto.SuperVipDto;
+import com.caimei365.user.model.dto.*;
 import com.caimei365.user.model.po.OperationPo;
 import com.caimei365.user.model.po.OperationPo;
 import com.caimei365.user.model.po.SuperVipPo;
 import com.caimei365.user.model.po.SuperVipPo;
 import com.caimei365.user.model.vo.*;
 import com.caimei365.user.model.vo.*;
@@ -19,6 +16,7 @@ import com.caimei365.user.service.RemoteCallService;
 import com.caimei365.user.utils.JwtUtil;
 import com.caimei365.user.utils.JwtUtil;
 import com.caimei365.user.utils.MathUtil;
 import com.caimei365.user.utils.MathUtil;
 import com.caimei365.user.utils.Md5Util;
 import com.caimei365.user.utils.Md5Util;
+import com.caimei365.user.utils.ValidateUtil;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
 import lombok.SneakyThrows;
 import lombok.SneakyThrows;
@@ -28,6 +26,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpHeaders;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.text.ParseException;
 import java.text.ParseException;
@@ -116,10 +115,6 @@ public class LoginServiceImpl implements LoginService {
             }
             }
             // 如果前端传入unionId,则存入返回前端
             // 如果前端传入unionId,则存入返回前端
             baseUser.setUnionId(unionId);
             baseUser.setUnionId(unionId);
-
-            Integer clubId = messageCenterMapper.clubIdCule(baseUser.getUserId());
-            Integer savedCount = null;
-
             // 比对密码
             // 比对密码
             String md5Password = Md5Util.md5(password);
             String md5Password = Md5Util.md5(password);
             String dbPassword = baseUser.getPassword();
             String dbPassword = baseUser.getPassword();
@@ -154,6 +149,65 @@ public class LoginServiceImpl implements LoginService {
         return ResponseJson.error("账户名与密码不匹配,请重新输入", null);
         return ResponseJson.error("账户名与密码不匹配,请重新输入", null);
     }
     }
 
 
+    /**
+     * @param loginCodeDto {
+     *                      mobile   手机号
+     *                      code     短信验证码
+     *                     }
+     * @return
+     * @throws ParseException
+     */
+    @Override
+    public ResponseJson<UserLoginVo> codeLogin(LoginCodeDto loginCodeDto) throws ParseException {
+        if (ObjectUtils.isEmpty(loginCodeDto.getMobile())) {
+            return ResponseJson.error("请填写手机号",null);
+        }
+        if (ObjectUtils.isEmpty(loginCodeDto.getCode())) {
+            return ResponseJson.error("请输入短信验证码",null);
+        }
+        String mobile = loginCodeDto.getMobile();
+        String code = loginCodeDto.getCode();
+        String unionId = loginCodeDto.getUnionId();
+        String result = ValidateUtil.validateMobile(mobile);
+        if (result != null) {
+            return ResponseJson.error(result);
+        }
+        // 判断redis中是否存在
+        boolean exists = redisService.exists("code:" + mobile);
+        if (exists) {
+            // 查看验证码是否过期
+            long expireTime = redisService.getExpireTime("code:" + mobile);
+            if (expireTime < 0) {
+                return ResponseJson.error("验证码已失效,请重新获取");
+            }
+            // 获取redis手机短信验证码
+            Object randomCode = redisService.get("code:"+mobile);
+
+            if (!ObjectUtils.isEmpty(randomCode)) {
+                if (code.equals(randomCode.toString())) {
+                    redisService.remove("code:" + mobile);
+                    // 根据手机号获取用户信息
+                    UserLoginVo baseUser = loginMapper.getLoginUserByMobileOrEmail(mobile);
+                    // 如果前端传入unionId,则存入返回前端
+                    baseUser.setUnionId(unionId);
+                    if (baseUser.getUserIdentity() == 1) {
+                        // 协销登录
+                        return ResponseJson.success(baseUser);
+                    } else {
+                        // 返回登录校验结果
+                        return logonVerify(baseUser);
+                    }
+                } else {
+                    return ResponseJson.error("验证码不匹配,请重新输入");
+                }
+            } else {
+                return ResponseJson.error("验证码错误,请重新获取");
+            }
+        } else {
+            return ResponseJson.error("验证码错误,请重新获取");
+        }
+    }
+
     /**
     /**
      * 微信授权登录(小程序)
      * 微信授权登录(小程序)
      *
      *
@@ -163,7 +217,7 @@ public class LoginServiceImpl implements LoginService {
      * @param headers       HttpHeaders
      * @param headers       HttpHeaders
      */
      */
     @Override
     @Override
-    public ResponseJson<UserLoginVo> appletsAuthorization(String code, String encryptedData, String iv, HttpHeaders headers) throws ParseException {
+    public ResponseJson<UserLoginVo> appletsAuthorization(String code, String encryptedData, String iv, HttpHeaders headers){
         if (StringUtils.isBlank(code)) {
         if (StringUtils.isBlank(code)) {
             return ResponseJson.error("没有获取到微信授权code", null);
             return ResponseJson.error("没有获取到微信授权code", null);
         }
         }
@@ -195,15 +249,6 @@ public class LoginServiceImpl implements LoginService {
         log.info("小程序授权登录,返回unionId给前端,用户数据存入Redis,key:wxInfo:applets:" + unionId);
         log.info("小程序授权登录,返回unionId给前端,用户数据存入Redis,key:wxInfo:applets:" + unionId);
         // 协销授权登录
         // 协销授权登录
         UserLoginVo seller = loginMapper.getServiceProviderUserByOpenId(openId);
         UserLoginVo seller = loginMapper.getServiceProviderUserByOpenId(openId);
-        Integer userID = messageCenterMapper.userId(openId);
-        Integer clubId = messageCenterMapper.clubIdCule(userID);
-        Integer savedCount = null;
-        if (userID != null) {
-            Integer shopID = messageCenterMapper.shopID(userID);
-            log.info(">>>>>" + shopID);
-            Integer newReceiptType = messageCenterMapper.newReceiptType(shopID);
-            log.info(">>>>>" + newReceiptType);
-        }
         if (null != seller) {
         if (null != seller) {
             loginMapper.updateServiceProviderUnionId(seller.getUserId(), unionId);
             loginMapper.updateServiceProviderUnionId(seller.getUserId(), unionId);
             String token = JwtUtil.createToken(seller.getUserId());
             String token = JwtUtil.createToken(seller.getUserId());
@@ -225,7 +270,6 @@ public class LoginServiceImpl implements LoginService {
 
 
     @Override
     @Override
     public ResponseJson<Map<String, Object>> ClubMessageCount(Integer messageType, Integer commonId) {
     public ResponseJson<Map<String, Object>> ClubMessageCount(Integer messageType, Integer commonId) {
-
         Integer count = messageCenterMapper.Count(1, commonId);
         Integer count = messageCenterMapper.Count(1, commonId);
         Integer tradeCount = messageCenterMapper.MessageCount(1, 1, commonId);
         Integer tradeCount = messageCenterMapper.MessageCount(1, 1, commonId);
         Integer accountCount = messageCenterMapper.MessageCount(1, 2, commonId);
         Integer accountCount = messageCenterMapper.MessageCount(1, 2, commonId);
@@ -360,69 +404,6 @@ public class LoginServiceImpl implements LoginService {
         return ResponseJson.success(pageData);
         return ResponseJson.success(pageData);
     }
     }
 
 
-
-
-//    /**
-//     * 当天天下午3点推送超级会员过期条件
-//     */
-////    @Scheduled(cron = "0 0 15 * * ?")
-//    @Scheduled(cron = "0 0/2 * * * ?")
-//    private Void Timerw() throws ParseException {
-//
-//        List<SuperVipPo> superV = vipMapper.findVip();
-//        superV.forEach(superVip -> {
-//            Integer clubId = messageCenterMapper.clubIdCule(superVip.getUserId());
-//            if (clubId != null) {
-//                if (superVip != null) {
-//                    Date d = new Date();
-//                    //1.日期格式
-//                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
-//                    String endTime = sdf.format(superVip.getEndTime());
-//                    //2.某天的日期
-//                    Date da1 = null;
-//                    try {
-//                        da1 = sdf.parse(endTime);
-//                    } catch (ParseException e) {
-//                        e.printStackTrace();
-//                    }
-//                    Long s = (d.getTime() - da1.getTime()) / 24 / 60 / 60 / 1000;
-//                    //3.输出间隔天数         getTime获取的是毫秒
-//                    log.info("输出间隔天数----------->", s);
-//                    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-//                    String current = dateFormat.format(new Date());
-//                    MessageCenter messageCenter = new MessageCenter();
-//                    //推送信息中心-账户通知
-//                    if (s == 7) {
-//                        messageCenter.setShopId(null);
-//                        messageCenter.setClubId(clubId);
-//                        messageCenter.setUserType(1);
-//                        messageCenter.setMessageType(2);
-//                        messageCenter.setAccountType(3);
-//                        messageCenter.setContent(s + "日后");
-//                        messageCenter.setTime(current);
-//                        messageCenterMapper.addMessageCenter(messageCenter);
-//
-//
-//                    }
-//                    if (s == 1) {
-//                        messageCenter.setShopId(null);
-//                        messageCenter.setClubId(clubId);
-//                        messageCenter.setUserType(1);
-//                        messageCenter.setMessageType(2);
-//                        messageCenter.setAccountType(3);
-//                        messageCenter.setContent("今日后");
-//                        messageCenter.setTime(current);
-//                        messageCenterMapper.addMessageCenter(messageCenter);
-//
-//                    }
-//                }
-//            }
-//        });
-//        return null;
-//    }
-
-
-
     /**
     /**
      * 微信公众号授权链接(www)
      * 微信公众号授权链接(www)
      *
      *
@@ -707,22 +688,41 @@ public class LoginServiceImpl implements LoginService {
      *                    mobile        手机号
      *                    mobile        手机号
      *                    smsCode       手机验证码
      *                    smsCode       手机验证码
      *                    linkName      联系人
      *                    linkName      联系人
+     *                    passOrNote    0 密码验证 1 短信
      *                    }
      *                    }
      */
      */
     @Override
     @Override
     public ResponseJson<UserLoginVo> qrCodeAuthScanBind(ScanBindDto scanBindDto) {
     public ResponseJson<UserLoginVo> qrCodeAuthScanBind(ScanBindDto scanBindDto) {
-        String mobileOrEmail = scanBindDto.getMobileOrEmail();
-        String password = scanBindDto.getPassword();
+        String mobileOrEmail = null;
+
+        if (!ObjectUtils.isEmpty(scanBindDto.getMobileOrEmail())) {
+            mobileOrEmail = scanBindDto.getMobileOrEmail();
+        }
+        String password = null;
+        if (!ObjectUtils.isEmpty(scanBindDto.getPassword())) {
+            password = scanBindDto.getPassword();
+        }
         String mobile = scanBindDto.getMobile();
         String mobile = scanBindDto.getMobile();
         String smsCode = scanBindDto.getSmsCode();
         String smsCode = scanBindDto.getSmsCode();
         String linkName = scanBindDto.getLinkName();
         String linkName = scanBindDto.getLinkName();
         String unionId = scanBindDto.getUnionId();
         String unionId = scanBindDto.getUnionId();
-        // 参数校验
-        if (StringUtils.isBlank(mobileOrEmail)) {
-            return ResponseJson.error("参数异常:手机号或邮箱不能为空!", null);
+        // 0 密码验证 1 短信
+        String passOrNote = "0";
+        if (!ObjectUtils.isEmpty(scanBindDto.getPassOrNote())) {
+            passOrNote = scanBindDto.getPassOrNote();
         }
         }
-        if (StringUtils.isBlank(password)) {
-            return ResponseJson.error("参数异常:密码不能为空!", null);
+        String companyMobile = null;
+        if (!ObjectUtils.isEmpty(scanBindDto.getPassOrNote())) {
+            companyMobile = scanBindDto.getCompanyMobile();
+        }
+        // 参数校验
+        if ("0".equals(passOrNote)) {
+            if (StringUtils.isBlank(mobileOrEmail)) {
+                return ResponseJson.error("参数异常:手机号或邮箱不能为空!", null);
+            }
+            if (StringUtils.isBlank(password)) {
+                return ResponseJson.error("参数异常:密码不能为空!", null);
+            }
         }
         }
         if (StringUtils.isBlank(mobile)) {
         if (StringUtils.isBlank(mobile)) {
             return ResponseJson.error("参数异常:手机号不能为空!", null);
             return ResponseJson.error("参数异常:手机号不能为空!", null);
@@ -734,9 +734,26 @@ public class LoginServiceImpl implements LoginService {
             return ResponseJson.error("参数异常:unionId不能为空!", null);
             return ResponseJson.error("参数异常:unionId不能为空!", null);
         }
         }
         //处理比对密码
         //处理比对密码
+        if ("0".equals(passOrNote)) {
+            mobileOrEmail = mobileOrEmail;
+        }
+        if ("1".equals(passOrNote)) {
+            mobileOrEmail = companyMobile;
+        }
+        // 根据手机号或者邮箱获取账户信息
         UserLoginVo user = loginMapper.getLoginUserByMobileOrEmail(mobileOrEmail);
         UserLoginVo user = loginMapper.getLoginUserByMobileOrEmail(mobileOrEmail);
-        String md5Password = Md5Util.md5(password);
-        if (null != user && md5Password.equals(user.getPassword())) {
+        String md5Password = null;
+        boolean item = false;
+        // 账号密码验证、短信验证校验方式
+        if ("0".equals(passOrNote)) {
+            md5Password = Md5Util.md5(password);
+            item= md5Password.equals(user.getPassword());
+        }
+        if ("1".equals(passOrNote)) {
+            item = true;
+        }
+
+        if (null != user && item) {
             // 查询使用该手机号的运营人员或用户
             // 查询使用该手机号的运营人员或用户
             String checkRust = commonService.operationBindCheck(mobile, smsCode);
             String checkRust = commonService.operationBindCheck(mobile, smsCode);
             if (checkRust != null) {
             if (checkRust != null) {
@@ -1059,6 +1076,81 @@ public class LoginServiceImpl implements LoginService {
         return ResponseJson.success("绑定微信成功", user);
         return ResponseJson.success("绑定微信成功", user);
     }
     }
 
 
+    /**
+     * 绑定运营人员短信验证
+     *
+     * @param loginCodeDto
+     * @return
+     */
+    @Override
+    public ResponseJson<String> operateVerification(LoginCodeDto loginCodeDto) {
+
+        // 验证码或者账号密码
+        String codeType = null;
+        if (!ObjectUtils.isEmpty(loginCodeDto.getCodeType())) {
+            codeType = loginCodeDto.getCodeType();
+        }
+        // 账号密码验证
+        if ("0".equals(codeType)) {
+            if (ObjectUtils.isEmpty(loginCodeDto.getMobileOrEmail())) {
+                return ResponseJson.error("请输入账号",null);
+            }
+            if (ObjectUtils.isEmpty(loginCodeDto.getPassword())) {
+                return ResponseJson.error("请输入密码",null);
+            }
+            // 账号
+            String mobileOrEmail = loginCodeDto.getMobileOrEmail();
+            // 密码
+            String password = loginCodeDto.getPassword();
+
+            // 根据手机号或者邮箱获取账户信息
+            UserLoginVo user = loginMapper.getLoginUserByMobileOrEmail(mobileOrEmail);
+            // 账号密码验证
+            String md5Password = Md5Util.md5(password);
+            if (md5Password.equals(user.getPassword())) {
+                return ResponseJson.success("账号与密码匹配成功");
+            }
+            return ResponseJson.error("账号与密码不匹配,请检查后重新输入");
+        } else {
+            // 手机短信验证
+            if (ObjectUtils.isEmpty(loginCodeDto.getMobile())) {
+                return ResponseJson.error("请输入手机号",null);
+            }
+            if (ObjectUtils.isEmpty(loginCodeDto.getCode())) {
+                return ResponseJson.error("请输入验证码",null);
+            }
+            String mobile = loginCodeDto.getMobile();
+            String code = loginCodeDto.getCode();
+            String result = ValidateUtil.validateMobile(mobile);
+            if (result != null) {
+                return ResponseJson.error(result);
+            }
+            // 判断redis中是否存在
+            boolean exists = redisService.exists("code:" + mobile);
+            if (exists) {
+                // 校验验证码是否过期
+                long expireTime = redisService.getExpireTime("code:" + mobile);
+                if (expireTime < 0) {
+                    return ResponseJson.error("验证码已失效,请重新获取");
+                }
+                // 获取redis缓存验证码
+                Object randomCode = redisService.get("code:" + mobile);
+                if (!ObjectUtils.isEmpty(randomCode)) {
+                    if (code.equals(randomCode.toString())) {
+                        redisService.remove("code:" + mobile);
+                        return ResponseJson.success("验证码匹配成功");
+                    } else {
+                        return ResponseJson.error("验证码不匹配,请重新输入");
+                    }
+                } else {
+                    return ResponseJson.error("验证码错误,请重新获取");
+                }
+            } else {
+                return ResponseJson.error("验证码错误,请重新获取");
+            }
+        }
+    }
+
     /**
     /**
      * 根据userId查是否过期,返回dto对象,flag=0未买过,-1过期,1有效,endTime过期时间
      * 根据userId查是否过期,返回dto对象,flag=0未买过,-1过期,1有效,endTime过期时间
      */
      */

+ 10 - 11
src/main/java/com/caimei365/user/service/impl/OperationServiceImpl.java

@@ -85,7 +85,6 @@ public class OperationServiceImpl implements OperationService {
 //        }
 //        }
 
 
 
 
-
         Date date = new Date();
         Date date = new Date();
         // 保存生成邀请码
         // 保存生成邀请码
         if (operationDto.getConfigFlag() == 2) {
         if (operationDto.getConfigFlag() == 2) {
@@ -102,12 +101,12 @@ public class OperationServiceImpl implements OperationService {
                 name = operationMapper.findShopNameById(operationDto.getShopId());
                 name = operationMapper.findShopNameById(operationDto.getShopId());
             }
             }
             String mobile = operationDto.getMobile();
             String mobile = operationDto.getMobile();
-//            if (StringUtils.isNotEmpty(mobile)) {
-//                // 欢迎成为${name}的运营人员,您的邀请码为${code}。
-//                String content = "欢迎成为"+name+"的运营人员,您的邀请码为"+invitationCode+"。您可使用以下两种方式激活您的身份:1. 您可在微信搜索“采美采购商城”小程序,使用邀请码登录并绑定微信;2. 进入“采美采购商城”小程序后,使用邀请码登录并绑定微信。绑定微信后,您可通过微信授权直接登录“采美采购商城”小程序或微信扫码直接登录采美365网站。";
-//                remoteCallService.remoteSendSms(0, 1, mobile, content);
-//                log.info("欢迎成为"+ name +"的运营人员,您的邀请码为:" + invitationCode);
-//            }
+            if (StringUtils.isNotEmpty(mobile)) {
+                // 欢迎成为${name}的运营人员,您的邀请码为${code}。
+                String content = "欢迎成为" + name + "的运营人员,您的邀请码为" + invitationCode + "。您可使用以下两种方式激活您的身份:1. 您可在微信搜索“采美采购商城”小程序,使用邀请码登录并绑定微信;2. 进入“采美采购商城”小程序后,使用邀请码登录并绑定微信。绑定微信后,您可通过微信授权直接登录“采美采购商城”小程序或微信扫码直接登录采美365网站。";
+                remoteCallService.remoteSendSms(0, 1, mobile, content);
+                log.info("欢迎成为" + name + "的运营人员,您的邀请码为:" + invitationCode);
+            }
         }
         }
         if (operationDto.getShopId() == null) {
         if (operationDto.getShopId() == null) {
             operation.setUserType(1);
             operation.setUserType(1);
@@ -139,7 +138,7 @@ public class OperationServiceImpl implements OperationService {
     @Override
     @Override
     public ResponseJson updateInvitationCode(OperationDto operationDto) {
     public ResponseJson updateInvitationCode(OperationDto operationDto) {
         OperationPo operation = operationMapper.getOperationCodeInfoById(operationDto.getId());
         OperationPo operation = operationMapper.getOperationCodeInfoById(operationDto.getId());
-        if (null == operation){
+        if (null == operation) {
             return ResponseJson.error("运营人员数据异常!");
             return ResponseJson.error("运营人员数据异常!");
         }
         }
         int flag = 0;
         int flag = 0;
@@ -165,9 +164,9 @@ public class OperationServiceImpl implements OperationService {
             String mobile = operation.getMobile();
             String mobile = operation.getMobile();
             if (StringUtils.isNotEmpty(mobile)) {
             if (StringUtils.isNotEmpty(mobile)) {
                 // 欢迎成为${name}的运营人员,您更新的邀请码为${code}。
                 // 欢迎成为${name}的运营人员,您更新的邀请码为${code}。
-                String content = "欢迎成为"+name+"的运营人员,您的邀请码为"+invitationCode+"。您可使用以下两种方式激活您的身份:1. 您可在微信搜索“采美采购商城”小程序,使用邀请码登录并绑定微信;2. 进入“采美采购商城”小程序后,使用邀请码登录并绑定微信。绑定微信后,您可通过微信授权直接登录“采美采购商城”小程序或微信扫码直接登录采美365网站。";
+                String content = "欢迎成为" + name + "的运营人员,您的邀请码为" + invitationCode + "。您可使用以下两种方式激活您的身份:1. 您可在微信搜索“采美采购商城”小程序,使用邀请码登录并绑定微信;2. 进入“采美采购商城”小程序后,使用邀请码登录并绑定微信。绑定微信后,您可通过微信授权直接登录“采美采购商城”小程序或微信扫码直接登录采美365网站。";
                 remoteCallService.remoteSendSms(0, 1, mobile, content);
                 remoteCallService.remoteSendSms(0, 1, mobile, content);
-                log.info("欢迎成为"+ name +"的运营人员,您更新的邀请码为:" + invitationCode);
+                log.info("欢迎成为" + name + "的运营人员,您更新的邀请码为:" + invitationCode);
             }
             }
             flag = operationMapper.updateOperation(operation);
             flag = operationMapper.updateOperation(operation);
         }
         }
@@ -247,7 +246,7 @@ public class OperationServiceImpl implements OperationService {
     /**
     /**
      * 生成六位随机码
      * 生成六位随机码
      */
      */
-    private String generateInvitationCode(){
+    private String generateInvitationCode() {
         // 生成六位随机码
         // 生成六位随机码
         String invitationCode = CodeUtil.generateCodeInt(6);
         String invitationCode = CodeUtil.generateCodeInt(6);
         // 判断生成随机码是否和数据库有重复
         // 判断生成随机码是否和数据库有重复

+ 55 - 43
src/main/java/com/caimei365/user/service/impl/RegisterServiceImpl.java

@@ -11,10 +11,7 @@ import com.caimei365.user.model.po.*;
 import com.caimei365.user.model.vo.*;
 import com.caimei365.user.model.vo.*;
 import com.caimei365.user.service.RegisterService;
 import com.caimei365.user.service.RegisterService;
 import com.caimei365.user.service.RemoteCallService;
 import com.caimei365.user.service.RemoteCallService;
-import com.caimei365.user.utils.CodeUtil;
-import com.caimei365.user.utils.Md5Util;
-import com.caimei365.user.utils.RandomCodeGenerator;
-import com.caimei365.user.utils.ValidateUtil;
+import com.caimei365.user.utils.*;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
@@ -24,6 +21,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
@@ -138,6 +136,14 @@ public class RegisterServiceImpl implements RegisterService {
         if (passResult != null) {
         if (passResult != null) {
             return ResponseJson.error(passResult);
             return ResponseJson.error(passResult);
         }
         }
+        // 获取ip所在地
+        String ipAddress = "";
+        try {
+            ipAddress = IpUtil.recordIp(ip);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        log.info("ip所在地====》"+ipAddress);
         /*
         /*
             组装用户数据 user
             组装用户数据 user
          */
          */
@@ -150,6 +156,8 @@ public class RegisterServiceImpl implements RegisterService {
         user.setRegisterTime(current);
         user.setRegisterTime(current);
         // 注册IP
         // 注册IP
         user.setRegisterIp(ip);
         user.setRegisterIp(ip);
+        // 注册IP所在地
+        user.setIpAddress(ipAddress);
         // 注册来源: 0网站 1小程序
         // 注册来源: 0网站 1小程序
         user.setSource(clubRegisterDto.getSource());
         user.setSource(clubRegisterDto.getSource());
         // 用户类型,供应商1,会员机构3,普通机构4
         // 用户类型,供应商1,会员机构3,普通机构4
@@ -189,6 +197,14 @@ public class RegisterServiceImpl implements RegisterService {
         if (insertFlag < 1) {
         if (insertFlag < 1) {
             throw new RuntimeException("插入数据库异常user:" + user.toString());
             throw new RuntimeException("插入数据库异常user:" + user.toString());
         }
         }
+
+        /*
+          保存用户状态
+         */
+        List<UserPo> userPos = registerMapper.selUser(current);
+        for (UserPo userInfo : userPos) {
+            registerMapper.insertOrgan(userInfo.getUserId());
+        }
         /*
         /*
             组装机构数据
             组装机构数据
          */
          */
@@ -219,7 +235,7 @@ public class RegisterServiceImpl implements RegisterService {
         user.setClubId(club.getClubId());
         user.setClubId(club.getClubId());
         registerMapper.updateUserClubId(user.getUserId(), club.getClubId());
         registerMapper.updateUserClubId(user.getUserId(), club.getClubId());
         //推送信息中心-账户通知
         //推送信息中心-账户通知
-        MessageCenter messageCenter=new MessageCenter();
+        MessageCenter messageCenter = new MessageCenter();
         messageCenter.setShopId(null);
         messageCenter.setShopId(null);
         messageCenter.setClubId(club.getClubId());
         messageCenter.setClubId(club.getClubId());
         messageCenter.setUserType(1);
         messageCenter.setUserType(1);
@@ -231,7 +247,7 @@ public class RegisterServiceImpl implements RegisterService {
 
 
         //    绑定微信,成为机构运营人员
         //    绑定微信,成为机构运营人员
         if (StringUtils.isNotEmpty(clubRegisterDto.getNickName())) {
         if (StringUtils.isNotEmpty(clubRegisterDto.getNickName())) {
-            MessageCenter messageCente=new MessageCenter();
+            MessageCenter messageCente = new MessageCenter();
             messageCente.setShopId(null);
             messageCente.setShopId(null);
             messageCente.setClubId(club.getClubId());
             messageCente.setClubId(club.getClubId());
             messageCente.setUserType(1);
             messageCente.setUserType(1);
@@ -406,6 +422,8 @@ public class RegisterServiceImpl implements RegisterService {
         club.setContractPhone(upgradeDto.getContractPhone());
         club.setContractPhone(upgradeDto.getContractPhone());
         // 联系人
         // 联系人
         club.setLinkMan(upgradeDto.getLinkMan());
         club.setLinkMan(upgradeDto.getLinkMan());
+        // 联系人身份
+        club.setLinkManIdentity(upgradeDto.getLinkManIdentity());
         // 地址
         // 地址
         club.setProvinceId(upgradeDto.getProvinceId());
         club.setProvinceId(upgradeDto.getProvinceId());
         club.setCityId(upgradeDto.getCityId());
         club.setCityId(upgradeDto.getCityId());
@@ -514,6 +532,14 @@ public class RegisterServiceImpl implements RegisterService {
         // 设置日期时间格式
         // 设置日期时间格式
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String current = dateFormat.format(new Date());
         String current = dateFormat.format(new Date());
+        // 获取ip所在地
+        String ipAddress = "";
+        try {
+            ipAddress = IpUtil.recordIp(ip);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        log.info("ip所在地====》"+ipAddress);
         /*
         /*
             组装用户数据 user
             组装用户数据 user
          */
          */
@@ -522,6 +548,8 @@ public class RegisterServiceImpl implements RegisterService {
         user.setRegisterTime(current);
         user.setRegisterTime(current);
         // 机构拉上线统称为此IP方便后面直接标记为协销代注册
         // 机构拉上线统称为此IP方便后面直接标记为协销代注册
         user.setRegisterIp("192.168.1.10");
         user.setRegisterIp("192.168.1.10");
+        // 注册IP所在地
+        user.setIpAddress(ipAddress);
         // 注册来源: 0网站 1小程序(拉机构上线小程序注册)
         // 注册来源: 0网站 1小程序(拉机构上线小程序注册)
         user.setSource(1);
         user.setSource(1);
         // 采美默认组织机构0
         // 采美默认组织机构0
@@ -579,6 +607,12 @@ public class RegisterServiceImpl implements RegisterService {
             registerMapper.updateClubUser(user);
             registerMapper.updateClubUser(user);
             log.info("客服注册机构注册,更新user表userId>>>>>" + confirmUserId);
             log.info("客服注册机构注册,更新user表userId>>>>>" + confirmUserId);
         }
         }
+        /* 机构列表用户状态默认插入 */
+
+        if(user.getUserId() != null) {
+            registerMapper.insertOrgan(user.getUserId());
+            log.info("插入数据库用户价值表,cm_organ_value_system表userid=====》" + user.getUserId());
+        }
         /*
         /*
             组装机构数据
             组装机构数据
          */
          */
@@ -789,6 +823,14 @@ public class RegisterServiceImpl implements RegisterService {
         if (null == isAgreed || 1 != isAgreed) {
         if (null == isAgreed || 1 != isAgreed) {
             return ResponseJson.error("请勾选同意协议");
             return ResponseJson.error("请勾选同意协议");
         }
         }
+        // 获取ip所在地
+        String ipAddress = "";
+        try {
+            ipAddress = IpUtil.recordIp(ip);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        log.info("ip所在地====》"+ipAddress);
         /*
         /*
             组装用户数据 user
             组装用户数据 user
          */
          */
@@ -800,6 +842,8 @@ public class RegisterServiceImpl implements RegisterService {
         user.setRegisterTime(current);
         user.setRegisterTime(current);
         // 注册IP
         // 注册IP
         user.setRegisterIp(ip);
         user.setRegisterIp(ip);
+        // 注册IP所在地
+        user.setIpAddress(ipAddress);
         // 注册来源: 0网站 1小程序
         // 注册来源: 0网站 1小程序
         user.setSource(shopRegisterDto.getSource());
         user.setSource(shopRegisterDto.getSource());
         // 采美默认组织机构0
         // 采美默认组织机构0
@@ -997,13 +1041,11 @@ public class RegisterServiceImpl implements RegisterService {
      */
      */
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
     @Override
     @Override
-    public ResponseJson superVipUpByBeans(Integer userId, Integer packageId, HttpHeaders headers){
+    public ResponseJson superVipUpByBeans(Integer userId, Integer packageId, HttpHeaders headers) {
         Integer clubId = messageCenterMapper.clubIdCule(userId);
         Integer clubId = messageCenterMapper.clubIdCule(userId);
         SuperVipDto endFlag = findEnd(userId);
         SuperVipDto endFlag = findEnd(userId);
         Integer userBeans = vipMapper.findUserBeans(userId);
         Integer userBeans = vipMapper.findUserBeans(userId);
         VipPackage pac = vipMapper.findUserPackage(packageId);
         VipPackage pac = vipMapper.findUserPackage(packageId);
-
-
         //过期和没买过都是生效时间重置,到期时间=现在+套餐时间
         //过期和没买过都是生效时间重置,到期时间=现在+套餐时间
         if (endFlag.getVipFlag() == 0 || endFlag.getVipFlag() == -1) {
         if (endFlag.getVipFlag() == 0 || endFlag.getVipFlag() == -1) {
             //1.查用户采美豆,够就用采美豆下单,不够就返回信息
             //1.查用户采美豆,够就用采美豆下单,不够就返回信息
@@ -1072,27 +1114,22 @@ public class RegisterServiceImpl implements RegisterService {
                     messageCenter.setContent(pac.getDuration() + "个月");
                     messageCenter.setContent(pac.getDuration() + "个月");
                     messageCenter.setTime(current);
                     messageCenter.setTime(current);
                     messageCenterMapper.addMessageCenter(messageCenter);
                     messageCenterMapper.addMessageCenter(messageCenter);
-
                     try {
                     try {
                         log.info("***********会员续费微信公众号推送************");
                         log.info("***********会员续费微信公众号推送************");
                         String accessToken = weChatService.getAccessToken();
                         String accessToken = weChatService.getAccessToken();
-                        String unionId=messageCenterMapper.UnionIdList(userId);
+                        String unionId = messageCenterMapper.UnionIdList(userId);
                         String openid = messageCenterMapper.getOpenidListByPermission(unionId);
                         String openid = messageCenterMapper.getOpenidListByPermission(unionId);
-                        String date=current;
+                        String date = current;
                         String remarkText = "如在使用中有任何疑问,请在小程序内联系在线客服";
                         String remarkText = "如在使用中有任何疑问,请在小程序内联系在线客服";
                         // 跳转到【小程序付款-选择支付方式页面】
                         // 跳转到【小程序付款-选择支付方式页面】
                         String pagePath = "/pages/user/member/member";
                         String pagePath = "/pages/user/member/member";
                         // sendTemplateMsg(openid, 标题, 金额, 收款日期, 备注, 跳转链接
                         // sendTemplateMsg(openid, 标题, 金额, 收款日期, 备注, 跳转链接
                         log.error("获取openid>>>>>" + openid);
                         log.error("获取openid>>>>>" + openid);
-                        weChatService.sendTemplateMsg(accessToken, openid,date,remarkText, pagePath);
+                        weChatService.sendTemplateMsg(accessToken, openid, date, remarkText, pagePath);
                     } catch (Exception e) {
                     } catch (Exception e) {
                         log.error("【会员充值微信通知】获取微信公众号access_token异常!", e);
                         log.error("【会员充值微信通知】获取微信公众号access_token异常!", e);
                     }
                     }
-
-
-
                 }
                 }
-
                 return ResponseJson.success("支付采美豆购买成功");
                 return ResponseJson.success("支付采美豆购买成功");
             }
             }
             return ResponseJson.error("用户采美豆不足", null);
             return ResponseJson.error("用户采美豆不足", null);
@@ -1121,14 +1158,10 @@ public class RegisterServiceImpl implements RegisterService {
         }
         }
         cal.setTime(beginTime);
         cal.setTime(beginTime);
         cal.add(Calendar.MONTH, pac.getDuration());
         cal.add(Calendar.MONTH, pac.getDuration());
-
-
         // 查询未支付的当前超级会员套餐购买记录
         // 查询未支付的当前超级会员套餐购买记录
         Integer dbHistoryId = vipMapper.getVipHistoryId(userId, packageId);
         Integer dbHistoryId = vipMapper.getVipHistoryId(userId, packageId);
         //userId, packageId, beginTime, endTime, payStatus, payWay, payType, price, userBeans, payTime
         //userId, packageId, beginTime, endTime, payStatus, payWay, payType, price, userBeans, payTime
         VipPayHistoryPo payHistory = new VipPayHistoryPo();
         VipPayHistoryPo payHistory = new VipPayHistoryPo();
-
-
         payHistory.setUserBeans(0d);
         payHistory.setUserBeans(0d);
         payHistory.setUserId(userId);
         payHistory.setUserId(userId);
         payHistory.setPackageId(packageId);
         payHistory.setPackageId(packageId);
@@ -1139,19 +1172,6 @@ public class RegisterServiceImpl implements RegisterService {
         // 线上支付
         // 线上支付
         payHistory.setPayWay(1);
         payHistory.setPayWay(1);
         payHistory.setPrice(pac.getPrice());
         payHistory.setPrice(pac.getPrice());
-
-        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        String current = dateFormat.format(new Date());
-        //1.日期格式
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
-        String endTime = sdf.format(payHistory.getEndTime());
-        //2.会员有效期(月)
-        Long s = (payHistory.getEndTime().getTime() - payHistory.getBeginTime().getTime()) / 24 / 60 / 60 / 30 / 1000;
-        //2.会员有效期(日)
-        Long t = (payHistory.getEndTime().getTime() - payHistory.getBeginTime().getTime()) / 24 / 60 / 60 / 1000;
-        Integer count =messageCenterMapper.getVipHistoryCount(userId);
-
-
         if (null != dbHistoryId && dbHistoryId > 0) {
         if (null != dbHistoryId && dbHistoryId > 0) {
             payHistory.setId(dbHistoryId);
             payHistory.setId(dbHistoryId);
             // 更新未支付的当前超级会员购买记录
             // 更新未支付的当前超级会员购买记录
@@ -1160,21 +1180,17 @@ public class RegisterServiceImpl implements RegisterService {
             // 新增超级会员购买记录
             // 新增超级会员购买记录
             vipMapper.addPayHistory(payHistory);
             vipMapper.addPayHistory(payHistory);
         }
         }
-
         if (payHistory.getId() > 0) {
         if (payHistory.getId() > 0) {
-
             return ResponseJson.success(payHistory.getId());
             return ResponseJson.success(payHistory.getId());
         }
         }
         return ResponseJson.error("支付开通超级会员异常!", null);
         return ResponseJson.error("支付开通超级会员异常!", null);
     }
     }
 
 
 
 
-
-
     /**
     /**
      * 根据userId查是否过期,返回dto对象,flag=0未买过,-1过期,1有效,endTime过期时间
      * 根据userId查是否过期,返回dto对象,flag=0未买过,-1过期,1有效,endTime过期时间
      */
      */
-    private SuperVipDto findEnd(Integer userId){
+    private SuperVipDto findEnd(Integer userId) {
         SuperVipPo superVip = vipMapper.findSuperVip(userId);
         SuperVipPo superVip = vipMapper.findSuperVip(userId);
         SuperVipDto superVipDto = new SuperVipDto();
         SuperVipDto superVipDto = new SuperVipDto();
         Integer clubId = messageCenterMapper.clubIdCule(userId);
         Integer clubId = messageCenterMapper.clubIdCule(userId);
@@ -1188,12 +1204,8 @@ public class RegisterServiceImpl implements RegisterService {
             } else {
             } else {
                 superVipDto.setVipFlag(1);
                 superVipDto.setVipFlag(1);
                 superVipDto.setEndTime(endTime.getEndTime());
                 superVipDto.setEndTime(endTime.getEndTime());
-
             }
             }
-
-
         }
         }
-
         return superVipDto;
         return superVipDto;
     }
     }
 
 

+ 2 - 0
src/main/java/com/caimei365/user/service/impl/RemoteCallServiceImpl.java

@@ -52,6 +52,8 @@ public class RemoteCallServiceImpl implements RemoteCallService {
             list.add("15113936829");
             list.add("15113936829");
             list.add("18476937515");
             list.add("18476937515");
             list.add("18175515644");
             list.add("18175515644");
+            list.add("18670511721");
+            list.add("15017915300");
             if ("prod".equals(profile) || list.contains(mobile)) {
             if ("prod".equals(profile) || list.contains(mobile)) {
                 if (StringUtils.isNotBlank(mobile) && mobile.length() == 11) {
                 if (StringUtils.isNotBlank(mobile) && mobile.length() == 11) {
                     String regex = "^(1[3-9]\\d{9}$)";
                     String regex = "^(1[3-9]\\d{9}$)";

+ 118 - 0
src/main/java/com/caimei365/user/service/impl/RoosInformationServiceImpl.java

@@ -0,0 +1,118 @@
+package com.caimei365.user.service.impl;
+
+import com.caimei365.user.mapper.RoosInformationMapper;
+import com.caimei365.user.model.dto.RoosInformationDto;
+import com.caimei365.user.service.RoosInformationService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
+import org.springframework.web.context.request.RequestAttributes;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2022/12/9
+ */
+@Slf4j
+@Service
+public class RoosInformationServiceImpl implements RoosInformationService {
+
+    @Autowired private RoosInformationMapper roosInformationMapper;
+
+    /**
+     * 查看用户是否有过弹框,游客当天是否有过弹框
+     *
+     * @param IP
+     * @return
+     */
+    @Override
+    public Boolean boolIsClick(String IP) {
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        String format = simpleDateFormat.format(new Date());
+        List<Integer> list = roosInformationMapper.selIsClick(IP, format);
+        boolean isClick = false;
+        // 判断是否点击过取消、或者填写过信息
+        for (Integer i: list) {
+            if (i == 1) {
+                isClick = true;
+            }
+        }
+        return isClick;
+    }
+
+    /**
+     * 插入填写咨询人基本信息
+     *
+     * @param roosInformationDto
+     */
+    @Override
+    public void 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);
+    }
+
+    /**
+     * 查看访问者是否浏览过roos相关页面
+     *
+     * @param userID
+     * @param IP
+     * @return
+     */
+    @Override
+    public Boolean selectVisitRoos(String 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;
+            }
+        }
+        return isVisit;
+    }
+
+
+    /**
+     * 获取用户访问IP
+     * @return
+     */
+    @Override
+    public String obtainIp() {
+        RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
+        ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) requestAttributes;
+        HttpServletRequest request = servletRequestAttributes.getRequest();
+        // ip
+        String unknown = "unknown";
+        String ip = "";
+        ip = request.getHeader("x-forwarded-for");
+        if (org.apache.commons.lang.StringUtils.isBlank(ip)) {
+            ip = request.getHeader("X-Real-IP");
+        }
+        if (ip == null || ip.length() == 0 || unknown.equalsIgnoreCase(ip)) {
+            ip = request.getHeader("Proxy-Client-IP");
+        }
+
+        if (ip == null || ip.length() == 0 || unknown.equalsIgnoreCase(ip)) {
+            ip = request.getHeader("WL-Proxy-Client-IP");
+        }
+
+        if (ip == null || ip.length() == 0 || unknown.equalsIgnoreCase(ip)) {
+            ip = request.getRemoteAddr();
+        }
+        log.info("获取访问人ip==========="+ip);
+        return ip;
+    }
+}

+ 55 - 4
src/main/java/com/caimei365/user/service/impl/SellerServiceImpl.java

@@ -10,6 +10,7 @@ import com.caimei365.user.model.po.ServiceProviderPo;
 import com.caimei365.user.model.po.SuperVipPo;
 import com.caimei365.user.model.po.SuperVipPo;
 import com.caimei365.user.model.vo.ClubTemporaryVo;
 import com.caimei365.user.model.vo.ClubTemporaryVo;
 import com.caimei365.user.model.vo.ClubVo;
 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.UserLoginVo;
 import com.caimei365.user.service.SellerService;
 import com.caimei365.user.service.SellerService;
 import com.caimei365.user.utils.JwtUtil;
 import com.caimei365.user.utils.JwtUtil;
@@ -21,6 +22,7 @@ import org.apache.commons.lang.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
@@ -54,13 +56,38 @@ public class SellerServiceImpl implements SellerService {
      *                          90:已上线, 91:已冻结, 92:审查资料未通过,待补充资料, 40:已完成第一次采购
      *                          90:已上线, 91:已冻结, 92:审查资料未通过,待补充资料, 40:已完成第一次采购
      *                          66:协销下所有上线的机构----虚拟状态
      *                          66:协销下所有上线的机构----虚拟状态
      * @param name              机构名字关键字(搜索用)
      * @param name              机构名字关键字(搜索用)
+     * @param type              1.我的机构2.组员机构(组长展示全组,总管理员展示所有人)3.待分配机构
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public ResponseJson<PageInfo<ClubVo>> getClubList(Integer serviceProviderId, Integer status, String name, Integer userIdentity, Integer pageNum, Integer pageSize) {
-        PageHelper.startPage(pageNum, pageSize);
+    public ResponseJson<PageInfo<ClubVo>> getClubList(Integer serviceProviderId, Integer status, Integer type, String name, Integer userIdentity, Integer groupServiceId, Integer pageNum, Integer pageSize) {
         // 获取协销用户下的机构列表
         // 获取协销用户下的机构列表
-        List<ClubVo> clubList = sellerMapper.findClubs(serviceProviderId, status, name, userIdentity);
+        List<ClubVo> clubList = new ArrayList<ClubVo>();
+        List<Integer> serviceIds = new ArrayList<Integer>();
+        if (1 == type || 3 == type) {
+            if(null != groupServiceId && groupServiceId > 0){
+                return ResponseJson.success();
+            }else{
+                PageHelper.startPage(pageNum, pageSize);
+                clubList = sellerMapper.findClubs(serviceProviderId, status, name, userIdentity, type, null);
+            }
+        } else if (2 == type) {
+            if (null != groupServiceId && groupServiceId > 0) {
+                PageHelper.startPage(pageNum, pageSize);
+                clubList = sellerMapper.findClubs(groupServiceId, status, name, userIdentity, 1, null);
+            } else {
+                Integer leaderId = sellerMapper.findLeaderIdByServiceId(serviceProviderId);
+                Integer managerId = sellerMapper.findmanagerIdByServiceId(serviceProviderId);
+                if (null != leaderId) {
+                    serviceIds = sellerMapper.findServiceIds(serviceProviderId);
+                }
+                if (null != managerId) {
+                    serviceIds = sellerMapper.findAllServiceIds(serviceProviderId);
+                }
+                PageHelper.startPage(pageNum, pageSize);
+                clubList = sellerMapper.findClubs(serviceProviderId, status, name, userIdentity, type, serviceIds);
+            }
+        }
         for (ClubVo club : clubList) {
         for (ClubVo club : clubList) {
             //未查看订单数量
             //未查看订单数量
             Integer orderNum = sellerMapper.findOrderNum(club);
             Integer orderNum = sellerMapper.findOrderNum(club);
@@ -69,9 +96,18 @@ public class SellerServiceImpl implements SellerService {
             SuperVipPo vip = vipMapper.findEndTime(club.getUserId());
             SuperVipPo vip = vipMapper.findEndTime(club.getUserId());
             if (vip != null) {
             if (vip != null) {
                 club.setVipFlag(1);
                 club.setVipFlag(1);
-            }else {
+            } else {
                 club.setVipFlag(0);
                 club.setVipFlag(0);
             }
             }
+            String newClubId = club.getClubId().toString();
+            int maxLen = 6;
+            int len = newClubId.length();
+            if (len < maxLen) {
+                for (int i = 0;i < (maxLen - len); i++) {
+                    newClubId = "0" + newClubId;
+                }
+            }
+            club.setNewClubId(newClubId);
         }
         }
         PageInfo<ClubVo> pageData = new PageInfo<>(clubList);
         PageInfo<ClubVo> pageData = new PageInfo<>(clubList);
         return ResponseJson.success(pageData);
         return ResponseJson.success(pageData);
@@ -166,4 +202,19 @@ public class SellerServiceImpl implements SellerService {
         return ResponseJson.success(seller);
         return ResponseJson.success(seller);
     }
     }
 
 
+    @Override
+    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);
+        }
+        if (null != managerId) {
+            serviceProviderVos = sellerMapper.findAllServices(spId,status);
+        }
+        //个人返回空,组长返回小组所有人
+        return ResponseJson.success(serviceProviderVos);
+    }
+
 }
 }

+ 1 - 0
src/main/java/com/caimei365/user/service/impl/ShopServiceImpl.java

@@ -748,6 +748,7 @@ public class ShopServiceImpl implements ShopService {
         String productIds = baikeProductMapper.getRecommendProductIds(productId);
         String productIds = baikeProductMapper.getRecommendProductIds(productId);
         productIds += "".equals(productIds) ? productId : "," + productId;
         productIds += "".equals(productIds) ? productId : "," + productId;
         baikeProductDto.setProductIds(productIds);
         baikeProductDto.setProductIds(productIds);
+        baikeProductDto.setAuditStatus(2);
         PageHelper.startPage(pageNum, pageSize);
         PageHelper.startPage(pageNum, pageSize);
         List<BaikeProductListVo> addRecommendList = baikeProductMapper.getBaikeProductList(baikeProductDto);
         List<BaikeProductListVo> addRecommendList = baikeProductMapper.getBaikeProductList(baikeProductDto);
         PageInfo<BaikeProductListVo> pageInfo = new PageInfo<>(addRecommendList);
         PageInfo<BaikeProductListVo> pageInfo = new PageInfo<>(addRecommendList);

+ 59 - 0
src/main/java/com/caimei365/user/utils/IpUtil.java

@@ -0,0 +1,59 @@
+package com.caimei365.user.utils;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2023/2/22
+ */
+public class IpUtil {
+
+    // 获取IP对应地址 ---- 太平洋
+    public static String recordIp(String ip) throws IOException {
+        URL url = null;
+        HttpURLConnection connection = null;
+        String encoding = "gbk";
+        String text = "";
+        String line = "";
+        String region = "";
+        String urlStr = "http://whois.pconline.com.cn/ipJson.jsp?ip="+ip+"&json=true";
+        try {
+            url = new URL(urlStr);
+            connection = (HttpURLConnection) url.openConnection();	//新建链接实例
+            connection.setConnectTimeout(20000);	//设置链接超时时间,单位毫秒
+            connection.setReadTimeout(20000);		//设置读取数据超时时间,单位毫秒
+            connection.setDoOutput(true);		//是否打开输出流true|false
+            connection.setDoInput(true);		//是否打开输入流true|false
+            connection.setRequestMethod("GET");		// 提交方式get|post
+            connection.setUseCaches(false);		// 是否加入缓存true|false
+            connection.connect();	//打开链接端口
+
+            BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), encoding));	// 往对端写完数据对端服务器返回数据。以BufferedReader流来读取
+
+            while ((line = reader.readLine()) != null) {
+                text += line+"\n";
+            }
+            reader.close();
+
+            JSONObject jsonObject = JSONObject.parseObject(text);
+            region = jsonObject.get("addr").toString();
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        } finally {
+            if (connection != null) {
+                connection.disconnect();	//关闭连接
+            }
+        }
+        return region;
+    }
+
+}

+ 9 - 6
src/main/resources/mapper/BaseMapper.xml

@@ -28,12 +28,15 @@
         limit 1
         limit 1
     </select>
     </select>
     <select id="getUserIdByMobile" resultType="java.lang.Integer">
     <select id="getUserIdByMobile" resultType="java.lang.Integer">
-        select u.userID from user u
-        left join cm_mall_operation_user cu on cu.userID = u.userID
-        where (u.bindMobile = #{mobile}
-                or (cu.mobile = #{mobile} and cu.delFlag != 1)
-        ) and u.userIdentity in (1,2,3,4)
-        limit 1
+        SELECT u.userID FROM USER u
+            LEFT JOIN cm_mall_operation_user cu ON cu.userID = u.userID
+        WHERE u.bindMobile = #{mobile} and u.userIdentity in (1,2,3,4)
+        UNION
+        SELECT u.userID FROM USER u
+            LEFT JOIN cm_mall_operation_user cu ON cu.userID = u.userID
+        WHERE cu.mobile = #{mobile} AND cu.delFlag != 1
+          AND u.userIdentity IN (1,2,3,4)
+        LIMIT 1
     </select>
     </select>
     <select id="getOperationUserIdByMobile" resultType="java.lang.Integer">
     <select id="getOperationUserIdByMobile" resultType="java.lang.Integer">
         select userID from cm_mall_operation_user
         select userID from cm_mall_operation_user

+ 345 - 72
src/main/resources/mapper/ClubMapper.xml

@@ -3,8 +3,10 @@
 <mapper namespace="com.caimei365.user.mapper.ClubMapper">
 <mapper namespace="com.caimei365.user.mapper.ClubMapper">
     <insert id="insertRemarks" parameterType="com.caimei365.user.model.po.ClubRemarksPo" keyProperty="remarksId"
     <insert id="insertRemarks" parameterType="com.caimei365.user.model.po.ClubRemarksPo" keyProperty="remarksId"
             useGeneratedKeys="true">
             useGeneratedKeys="true">
-        insert into cm_club_remarks(clubId, serviceProviderId, remarks, addTime, questionMan,consultType,clubType,pinceSensitve,satisfied,followup,extra)
-        values (#{clubId}, #{serviceProviderId}, #{remarks}, now(), #{questionMan},#{consult}, #{clubType}, #{pinceSensitve}, #{satisfied}, #{followup}, #{extra})
+        insert into cm_club_remarks(clubId, serviceProviderId, remarks, addTime, questionMan, consultType, clubType,
+                                    pinceSensitve, satisfied, followup, extra, productID, reportID)
+        values (#{clubId}, #{serviceProviderId}, #{remarks}, now(), #{questionMan}, #{consult}, #{clubType},
+                #{pinceSensitve}, #{satisfied}, #{followup}, #{extra}, #{productID}, #{reportID})
     </insert>
     </insert>
     <insert id="insertRemarksImage">
     <insert id="insertRemarksImage">
         insert into cm_club_remarks_file(remarksId, fileType, imageUrl)
         insert into cm_club_remarks_file(remarksId, fileType, imageUrl)
@@ -19,8 +21,10 @@
         values (#{questionManId}, #{serviceProviderId}, #{remarks}, now(), #{questionMan}, #{concactTime})
         values (#{questionManId}, #{serviceProviderId}, #{remarks}, now(), #{questionMan}, #{concactTime})
     </insert>
     </insert>
     <insert id="insertVisitorRemark" keyProperty="remarksId" useGeneratedKeys="true">
     <insert id="insertVisitorRemark" keyProperty="remarksId" useGeneratedKeys="true">
-        insert into cm_visitor_remarks(questionMan, questionManId, serviceProviderId, remarks, addTime,consultType,clubType,pinceSensitve,satisfied,followup,extra)
-        values (#{questionMan}, #{questionManId}, #{serviceProviderId}, #{remarks}, now(),#{consult}, #{clubType}, #{pinceSensitve}, #{satisfied}, #{followup}, #{extra})
+        insert into cm_visitor_remarks(questionMan, questionManId, serviceProviderId, remarks, addTime, consultType,
+                                       clubType, pinceSensitve, satisfied, followup, extra, reportID, productID)
+        values (#{questionMan}, #{questionManId}, #{serviceProviderId}, #{remarks}, now(), #{consult}, #{clubType},
+                #{pinceSensitve}, #{satisfied}, #{followup}, #{extra}, #{reportId}, #{productId})
     </insert>
     </insert>
     <insert id="insertVisitorRemarksImage">
     <insert id="insertVisitorRemarksImage">
         insert into cm_visitor_remarks_file(remarksId, fileType, imageUrl)
         insert into cm_visitor_remarks_file(remarksId, fileType, imageUrl)
@@ -32,8 +36,32 @@
     </insert>
     </insert>
     <insert id="concactVisit" parameterType="com.caimei365.user.model.vo.RemarksVo" keyProperty="remarksId"
     <insert id="concactVisit" parameterType="com.caimei365.user.model.vo.RemarksVo" keyProperty="remarksId"
             useGeneratedKeys="true">
             useGeneratedKeys="true">
-        insert into cm_club_remarks(clubId, serviceProviderId, remarks, addTime, questionMan, concactTime,consultType,clubType,pinceSensitve,satisfied,followup,extra)
-        values (#{clubId}, #{serviceProviderId}, #{remarks}, #{addTime}, #{questionMan}, now(),#{consult}, #{clubType}, #{pinceSensitve}, #{satisfied}, #{followup}, #{extra})
+        insert into cm_club_remarks(clubId, serviceProviderId, remarks, addTime, questionMan, concactTime, consultType,
+                                    clubType, pinceSensitve, satisfied, followup, extra, productID, reportID)
+        values (#{clubId}, #{serviceProviderId}, #{remarks}, #{addTime}, #{questionMan}, now(), #{consult}, #{clubType},
+                #{pinceSensitve}, #{satisfied}, #{followup}, #{extra}, #{productId}, #{reportId})
+    </insert>
+    <insert id="insertChangeRecord" parameterType="com.caimei365.user.model.vo.ClubChangeSpVo"
+            keyProperty="clubChangeSpRecordID"
+            useGeneratedKeys="true">
+        INSERT INTO clubchangesprecord(clubID,
+                                       oldSpID,
+                                       newSpID,
+                                       applyTime,
+                                       checkTime,
+                                       checkStatus,
+                                       checkMark,
+                                       checkUserID,
+                                       choseServiceId)
+        VALUES (#{clubID},
+                #{oldSpID},
+                #{newSpID},
+                #{applyTime},
+                #{checkTime},
+                #{checkStatus},
+                #{checkMark},
+                #{checkUserID},
+                #{choseServiceId})
     </insert>
     </insert>
     <update id="updateClubUserByUpdateInfo">
     <update id="updateClubUserByUpdateInfo">
         update user set
         update user set
@@ -61,6 +89,9 @@
         <if test="linkMan != null and linkMan != ''">
         <if test="linkMan != null and linkMan != ''">
             linkMan = #{linkMan},
             linkMan = #{linkMan},
         </if>
         </if>
+        <if test="linkManIdentity != null and linkManIdentity != ''">
+            linkManIdentity = #{linkManIdentity},
+        </if>
         <if test="townId != null and townId != ''">
         <if test="townId != null and townId != ''">
             provinceID = #{provinceId}, cityID = #{cityId}, townID = #{townId}, address = #{address},
             provinceID = #{provinceId}, cityID = #{cityId}, townID = #{townId}, address = #{address},
         </if>
         </if>
@@ -122,10 +153,11 @@
                contractEmail,
                contractEmail,
                contractPhone,
                contractPhone,
                linkMan,
                linkMan,
+               linkManIdentity,
                provinceID                as proviceId,
                provinceID                as proviceId,
                cityID                    as cityId,
                cityID                    as cityId,
                townID                    as townId,
                townID                    as townId,
-               address,
+               ifnull(address,'暂无')     as address,
                headpic                   as shopPhoto,
                headpic                   as shopPhoto,
                businessLicenseImage      as businessLicense,
                businessLicenseImage      as businessLicense,
                socialCreditCode,
                socialCreditCode,
@@ -139,7 +171,9 @@
                spID                      as serviceProviderId,
                spID                      as serviceProviderId,
                addTime,
                addTime,
                status,
                status,
-               lastCheckOrderDate
+               lastCheckOrderDate,
+               newDeal                   as newDeal
+
         from club
         from club
         where clubID = #{clubId}
         where clubID = #{clubId}
     </select>
     </select>
@@ -198,15 +232,17 @@
     </update>
     </update>
     <update id="updateRemarks">
     <update id="updateRemarks">
         update cm_club_remarks
         update cm_club_remarks
-        set remarks     = #{remarks},
-            questionMan = #{questionMan},
-            consultType = #{consult},
+        set remarks      = #{remarks},
+            questionMan  = #{questionMan},
+            consultType  = #{consult},
             clubType=#{clubType},
             clubType=#{clubType},
             pinceSensitve=#{pinceSensitve},
             pinceSensitve=#{pinceSensitve},
             satisfied=#{satisfied},
             satisfied=#{satisfied},
             followup=#{followup},
             followup=#{followup},
-            extra=#{extra}
-         where id = #{remarksId}
+            extra=#{extra},
+            productID=#{productID},
+            reportID=#{reportID}
+        where id = #{remarksId}
     </update>
     </update>
     <update id="updateQuestionMan">
     <update id="updateQuestionMan">
         update cm_visitor_remarks
         update cm_visitor_remarks
@@ -216,13 +252,15 @@
     </update>
     </update>
     <update id="updateVisitorRemark">
     <update id="updateVisitorRemark">
         update cm_visitor_remarks
         update cm_visitor_remarks
-        set remarks = #{remarks},
-            consultType = #{consult},
+        set remarks      = #{remarks},
+            consultType  = #{consult},
             clubType=#{clubType},
             clubType=#{clubType},
             pinceSensitve=#{pinceSensitve},
             pinceSensitve=#{pinceSensitve},
             satisfied=#{satisfied},
             satisfied=#{satisfied},
             followup=#{followup},
             followup=#{followup},
-            extra=#{extra}
+            extra=#{extra},
+            reportID=#{reportId},
+            productID=#{productId}
         where id = #{remarksId}
         where id = #{remarksId}
     </update>
     </update>
     <update id="updateVisit">
     <update id="updateVisit">
@@ -231,6 +269,35 @@
             concactTime = now()
             concactTime = now()
         where questionManId = #{questionManId}
         where questionManId = #{questionManId}
     </update>
     </update>
+
+    <update id="updateReport">
+        update cm_club_report
+        set clubId       = #{clubId},
+            questionManId=null
+        where questionManId = #{questionManId}
+    </update>
+    <update id="updateClubSpId">
+        update club
+        set spID=#{spId},
+            scanFlag=2
+        where clubID = #{clubId}
+    </update>
+    <update id="updateRemarksSp">
+        UPDATE `cm_club_remarks`
+        SET
+        <if test="status == 1">
+            oldserviceProviderId = #{oldSpId},
+        </if>
+        serviceProviderId=#{spId}
+        WHERE clubId = #{clubId}
+        AND serviceProviderId = #{oldSpId}
+    </update>
+    <update id="updateReportSp">
+        UPDATE cm_club_report
+        SET serviceProviderId=#{spId}
+        WHERE clubId = #{clubId}
+          AND serviceProviderId = #{oldSpId}
+    </update>
     <select id="findAllBeansHistory" resultType="com.caimei365.user.model.vo.BeansHistoryVo">
     <select id="findAllBeansHistory" resultType="com.caimei365.user.model.vo.BeansHistoryVo">
         SELECT
         SELECT
         type,
         type,
@@ -261,17 +328,20 @@
     <select id="findCountCoupon" resultType="integer">
     <select id="findCountCoupon" resultType="integer">
         SELECT COUNT(a.id)
         SELECT COUNT(a.id)
         FROM cm_coupon_club a
         FROM cm_coupon_club a
-        LEFT JOIN cm_coupon cc ON a.couponId = cc.id
+                 LEFT JOIN cm_coupon cc ON a.couponId = cc.id
         WHERE cc.delFlag = 0
         WHERE cc.delFlag = 0
           AND a.delFlag = 0
           AND a.delFlag = 0
           AND a.userId = #{userId}
           AND a.userId = #{userId}
           AND a.status = 1
           AND a.status = 1
-          AND (cc.couponType IN (0,1,3)
+          AND (cc.couponType IN (0, 1, 3)
             OR (cc.couponType = 2 AND a.userId = #{userId})
             OR (cc.couponType = 2 AND a.userId = #{userId})
             OR ((SELECT registerTime FROM user WHERE userID = #{userId}) <![CDATA[ >= ]]> startDate AND couponType = 4))
             OR ((SELECT registerTime FROM user WHERE userID = #{userId}) <![CDATA[ >= ]]> startDate AND couponType = 4))
           and NOW() <![CDATA[ > ]]> startDate
           and NOW() <![CDATA[ > ]]> startDate
-          and NOW() <![CDATA[ < ]]> if(receiveFlag = 1,endDate,
-                                       date_add(if((SELECT registerTime FROM user WHERE userID = #{userId}) <![CDATA[ > ]]> startDate and (SELECT registerTime FROM user WHERE userID = #{userId}) <![CDATA[ < ]]> endDate,(SELECT registerTime FROM user WHERE userID = #{userId}),startDate),interval receivePeriod day)
+          and NOW() <![CDATA[ < ]]> if(receiveFlag = 1 OR vipFlag = 1, endDate,
+                         date_add(if((SELECT registerTime FROM user WHERE userID = #{userId}) <![CDATA[ > ]]> startDate and
+                                     (SELECT registerTime FROM user WHERE userID = #{userId}) <![CDATA[ < ]]> endDate,
+                                     (SELECT registerTime FROM user WHERE userID = #{userId}), startDate),
+                                  interval receivePeriod day)
             )
             )
           AND cc.status != 2
           AND cc.status != 2
     </select>
     </select>
@@ -293,10 +363,34 @@
         order by addTime desc
         order by addTime desc
     </select>
     </select>
     <select id="getRemarks" resultType="com.caimei365.user.model.vo.RemarksVo">
     <select id="getRemarks" resultType="com.caimei365.user.model.vo.RemarksVo">
-        select ccr.id as remarksId, ccr.remarks, ccr.questionMan, ccr.addTime, ccr.clubId, c.userID,IFNULL(ccr.consultType,'')as consult,ccr.clubType,ccr.pinceSensitve,ccr.satisfied,ccr.followup,ccr.extra
-        from cm_club_remarks ccr
-                 left join club c on ccr.clubId = c.clubId
-        where id = #{remarksId}
+        SELECT DISTINCT ccr.id                      AS remarksId,
+                        ccr.remarks,
+                        ccr.questionMan,
+                        ccr.addTime,
+                        ccr.clubId,
+                        c.userID,
+                        IFNULL(ccr.consultType, '') AS consult,
+                        ccr.clubType,
+                        ccr.pinceSensitve,
+                        ccr.satisfied,
+                        ccr.followup,
+                        ccr.extra,
+                        p.`mainImage`               AS mainImage,
+                        p.name                      AS productName,
+                        s.name                      AS shopName,
+                        cmc.`reportText`            as reportText,
+                        cmc.`status`                as status,
+                        cmc.`auditText`             as auditText,
+                        c.newDeal                   as newDeal,
+                        p.productId                 as productId,
+                        cmc.ID                      as reportId
+        FROM cm_club_remarks ccr
+                 LEFT JOIN club c ON ccr.clubId = c.clubId
+                 LEFT JOIN product p ON p.productID = ccr.productID
+                 LEFT JOIN cm_club_report cmc ON cmc.ID = ccr.reportID
+                 LEFT JOIN shop s ON s.shopID = p.shopID
+        where ccr.id = #{remarksId}
+          AND ccr.remarks IS NOT NULL
     </select>
     </select>
     <select id="getRemarksImageList" resultType="java.lang.String">
     <select id="getRemarksImageList" resultType="java.lang.String">
         select imageUrl
         select imageUrl
@@ -337,13 +431,19 @@
     <select id="getUserCouponCount" resultType="java.lang.Integer">
     <select id="getUserCouponCount" resultType="java.lang.Integer">
         SELECT COUNT(a.id)
         SELECT COUNT(a.id)
         FROM cm_coupon_club a
         FROM cm_coupon_club a
-        LEFT JOIN cm_coupon cc ON a.couponId = cc.id
+                 LEFT JOIN cm_coupon cc ON a.couponId = cc.id
         WHERE cc.delFlag = 0
         WHERE cc.delFlag = 0
           AND a.delFlag = 0
           AND a.delFlag = 0
           AND a.status = 1
           AND a.status = 1
           AND cc.status != 2
           AND cc.status != 2
           AND a.userId = #{userId}
           AND a.userId = #{userId}
-          AND NOW() BETWEEN cc.startDate AND cc.endDate
+          AND if(cc.vipFlag = 1
+            , NOW() BETWEEN cc.startDate
+                     AND cc.endDate
+            , NOW() <![CDATA[ < ]]> IF(cc.usePeriod IS NULL
+                    , cc.endDate
+                    , DATE_ADD(a.createDate
+                             , INTERVAL cc.usePeriod DAY)))
     </select>
     </select>
     <select id="getUserAdvertiseList" resultType="com.caimei365.user.model.vo.AdvertiseVo">
     <select id="getUserAdvertiseList" resultType="com.caimei365.user.model.vo.AdvertiseVo">
         SELECT image, link, title
         SELECT image, link, title
@@ -375,7 +475,7 @@
         ORDER BY informationID DESC
         ORDER BY informationID DESC
     </select>
     </select>
     <select id="getVisitorList" resultType="com.caimei365.user.model.vo.VisitorRemarkVo">
     <select id="getVisitorList" resultType="com.caimei365.user.model.vo.VisitorRemarkVo">
-        SELECT questionManId, serviceProviderId, addTime as addDate, questionMan,consultType as consult
+        SELECT questionManId, serviceProviderId, addTime as addDate, questionMan, consultType as consult
         FROM cm_visitor_remarks
         FROM cm_visitor_remarks
         WHERE serviceProviderId = #{serviceProviderId}
         WHERE serviceProviderId = #{serviceProviderId}
           and clubId is null
           and clubId is null
@@ -383,11 +483,33 @@
         ORDER BY addTime DESC
         ORDER BY addTime DESC
     </select>
     </select>
     <select id="getVisitRemark" resultType="com.caimei365.user.model.vo.VisitorRemarkVo">
     <select id="getVisitRemark" resultType="com.caimei365.user.model.vo.VisitorRemarkVo">
-        select id as remarksId, questionManId, remarks, questionMan, addTime as addDate,IFNULL(consultType,'') as consult,clubType,pinceSensitve,satisfied,followup,extra
-        from cm_visitor_remarks
-        where id = #{remarksId}
-          AND remarks IS NOT NULL
-          and clubId is null
+        select DISTINCT ccr.id                      as remarksId,
+                        ccr.questionManId,
+                        ccr.remarks,
+                        ccr.questionMan,
+                        ccr.addTime                 as addDate,
+                        IFNULL(ccr.consultType, '') as consult,
+                        ccr.clubType,
+                        ccr.pinceSensitve,
+                        ccr.satisfied,
+                        ccr.followup,
+                        ccr.extra,
+                        p.`mainImage`               AS mainImage,
+                        p.name                      AS productName,
+                        s.name                      AS shopName,
+                        cmc.`reportText`            as reportText,
+                        cmc.`status`                as status,
+                        cmc.`auditText`             as auditText,
+                        p.productId                 as productId,
+                        cmc.ID                      as reportId
+        from cm_visitor_remarks ccr
+                 LEFT JOIN club c ON ccr.clubId = c.clubId
+                 LEFT JOIN product p ON p.productID = ccr.productID
+                 LEFT JOIN cm_club_report cmc ON cmc.ID = ccr.reportID
+                 LEFT JOIN shop s ON s.shopID = p.shopID
+        where ccr.id = #{remarksId}
+          AND ccr.remarks IS NOT NULL #           and cmc.clubId is null
+
     </select>
     </select>
     <select id="getVisitRemarksImageList" resultType="java.lang.String">
     <select id="getVisitRemarksImageList" resultType="java.lang.String">
         select imageUrl
         select imageUrl
@@ -415,11 +537,11 @@
         ORDER BY ADDTIME DESC
         ORDER BY ADDTIME DESC
     </select>
     </select>
     <select id="findConcactVisit" resultType="com.caimei365.user.model.vo.VisitorRemarkVo">
     <select id="findConcactVisit" resultType="com.caimei365.user.model.vo.VisitorRemarkVo">
-        select id      as remarksId,
+        select id          as remarksId,
                questionManId,
                questionManId,
                serviceProviderId,
                serviceProviderId,
                remarks,
                remarks,
-               addTime as addDate,
+               addTime     as addDate,
                questionMan,
                questionMan,
                clubId,
                clubId,
                consultType as consult,
                consultType as consult,
@@ -428,7 +550,9 @@
                pinceSensitve,
                pinceSensitve,
                satisfied,
                satisfied,
                followup,
                followup,
-               extra
+               extra,
+               productID,
+               reportID
         from cm_visitor_remarks
         from cm_visitor_remarks
         where questionManId = #{questionManId}
         where questionManId = #{questionManId}
           and remarks is not null
           and remarks is not null
@@ -444,21 +568,24 @@
         SELECT DISTINCT
         SELECT DISTINCT
         ccr.id AS remarksId, ccr.remarks,ccr.addTime,ccr.questionMan,ccr.serviceProviderId as serviceProviderId,
         ccr.id AS remarksId, ccr.remarks,ccr.addTime,ccr.questionMan,ccr.serviceProviderId as serviceProviderId,
         csr.leaderId AS leaderId,IFNULL(ccr.consultType,'') as consult, c.Name as clubName,
         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.clubType AS clubType,ccr.pinceSensitve AS pinceSensitve,ccr.satisfied AS satisfied,ccr.followup AS
+        followup,ccr.extra AS extra,
         (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID= csr.leaderId) AS leaderName,
         (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID= csr.leaderId) AS leaderName,
-        (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderID) AS recordName
-#         (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.oldserviceProviderId) AS oldName
+        (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderID) AS
+        recordName,c.newDeal as newDeal,cmc.status as status
+        # (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.oldserviceProviderId) AS oldName
         FROM cm_club_remarks ccr
         FROM cm_club_remarks ccr
         LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
         LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
         LEFT JOIN club c ON c.clubId=ccr.clubId
         LEFT JOIN club c ON c.clubId=ccr.clubId
         LEFT JOIN cm_serviceTeam_group csg ON ccr.serviceProviderId = csg.serviceId
         LEFT JOIN cm_serviceTeam_group csg ON ccr.serviceProviderId = csg.serviceId
         LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
         LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
+        LEFT JOIN cm_club_report cmc ON cmc.ID = ccr.reportID
         where ccr.serviceProviderId=#{serviceProviderId}
         where ccr.serviceProviderId=#{serviceProviderId}
 
 
         <if test="keyWord != null and keyWord != ''">
         <if test="keyWord != null and keyWord != ''">
-           AND (ccr.remarks LIKE CONCAT('%', #{keyWord}, '%')
-           OR c.Name LIKE CONCAT('%', #{keyWord}, '%')
-           OR ccr.questionMan LIKE CONCAT('%', #{keyWord}, '%'))
+            AND (ccr.remarks LIKE CONCAT('%', #{keyWord}, '%')
+            OR c.Name LIKE CONCAT('%', #{keyWord}, '%')
+            OR ccr.questionMan LIKE CONCAT('%', #{keyWord}, '%'))
         </if>
         </if>
         <if test="leaderId != null and leaderId>0">
         <if test="leaderId != null and leaderId>0">
             and csr.leaderId = #{leaderId}
             and csr.leaderId = #{leaderId}
@@ -479,34 +606,41 @@
         <if test="satisfied != '' and satisfied != null">
         <if test="satisfied != '' and satisfied != null">
             and ccr.satisfied LIKE concat('%',#{satisfied},'%')
             and ccr.satisfied LIKE concat('%',#{satisfied},'%')
         </if>
         </if>
-
+        <if test="status!=null and status!=0">
+            and cmc.status=#{status}
+        </if>
+        <if test="newDeal !=null and newDeal!=0">
+            and c.newDeal =#{newDeal}
+        </if>
         <if test="followup != '' and followup != null">
         <if test="followup != '' and followup != null">
             and ccr.followup LIKE concat('%',#{followup},'%')
             and ccr.followup LIKE concat('%',#{followup},'%')
         </if>
         </if>
         <if test="con != null and con.size > 0">
         <if test="con != null and con.size > 0">
-           and
-              <foreach collection="con" item="item" index="index"  open="(" close=")" separator="OR">
-                  ccr.consultType LIKE CONCAT('%',#{item},'%')
-             </foreach>
+            and
+            <foreach collection="con" item="item" index="index" open="(" close=")" separator="OR">
+                ccr.consultType LIKE CONCAT('%',#{item},'%')
+            </foreach>
         </if>
         </if>
         order by addTime desc
         order by addTime desc
     </select>
     </select>
     <select id="getVisitorListByKey" resultType="com.caimei365.user.model.vo.VisitorRemarkVo">
     <select id="getVisitorListByKey" resultType="com.caimei365.user.model.vo.VisitorRemarkVo">
         SELECT DISTINCT
         SELECT DISTINCT
-        ccr.id as remarksId, ccr.questionManId, ccr.remarks, ccr.addTime as addDate, ccr.questionMan,IFNULL(ccr.consultType,'') as consult,
+        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.serviceProviderId,ccr.clubType,ccr.pinceSensitve,ccr.satisfied,ccr.followup,ccr.extra,
         (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS recordName,
         (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS recordName,
-        (select name from serviceprovider s where s.serviceProviderID = csr.leaderId) as leaderName
+        (select name from serviceprovider s where s.serviceProviderID = csr.leaderId) as leaderName,cmc.status as status
         FROM cm_visitor_remarks ccr
         FROM cm_visitor_remarks ccr
         left join cm_serviceteam_group csg on csg.serviceId = ccr.serviceProviderID
         left join cm_serviceteam_group csg on csg.serviceId = ccr.serviceProviderID
         left join cm_serviceteam_role csr on csr.id = csg.teamId
         left join cm_serviceteam_role csr on csr.id = csg.teamId
         left join serviceprovider s on ccr.serviceProviderID = s.serviceProviderID
         left join serviceprovider s on ccr.serviceProviderID = s.serviceProviderID
+        LEFT JOIN cm_club_report cmc ON cmc.Id = ccr.reportID
         WHERE ccr.serviceProviderId = #{serviceProviderId}
         WHERE ccr.serviceProviderId = #{serviceProviderId}
         and ccr.remarks IS NOT NULL
         and ccr.remarks IS NOT NULL
         and ccr.clubId is null
         and ccr.clubId is null
         <if test="keyWord != null and keyWord != ''">
         <if test="keyWord != null and keyWord != ''">
-          and (ccr.questionMan LIKE CONCAT('%', #{keyWord}, '%')
-          or ccr.remarks LIKE CONCAT('%', #{keyWord}, '%'))
+            and (ccr.questionMan LIKE CONCAT('%', #{keyWord}, '%')
+            or ccr.remarks LIKE CONCAT('%', #{keyWord}, '%'))
         </if>
         </if>
         <if test="startAddTime !='' and startAddTime != null">
         <if test="startAddTime !='' and startAddTime != null">
             and ccr.addTime <![CDATA[  >=  ]]> #{startAddTime}
             and ccr.addTime <![CDATA[  >=  ]]> #{startAddTime}
@@ -520,13 +654,15 @@
         <if test="satisfied != '' and satisfied!=null">
         <if test="satisfied != '' and satisfied!=null">
             and ccr.satisfied LIKE concat('%',#{satisfied},'%')
             and ccr.satisfied LIKE concat('%',#{satisfied},'%')
         </if>
         </if>
-
+        <if test="status!=null and status!=0">
+            and cmc.status=#{status}
+        </if>
         <if test="followup != '' and followup!=null">
         <if test="followup != '' and followup!=null">
             and ccr.followup LIKE concat('%',#{followup},'%')
             and ccr.followup LIKE concat('%',#{followup},'%')
         </if>
         </if>
         <if test="con != null and con.size > 0">
         <if test="con != null and con.size > 0">
             and
             and
-            <foreach collection="con" item="item" index="index"  open="(" close=")" separator="OR">
+            <foreach collection="con" item="item" index="index" open="(" close=")" separator="OR">
                 ccr.consultType LIKE CONCAT('%',#{item},'%')
                 ccr.consultType LIKE CONCAT('%',#{item},'%')
             </foreach>
             </foreach>
         </if>
         </if>
@@ -534,7 +670,8 @@
     </select>
     </select>
     <select id="getVisitRecordListByKey" resultType="com.caimei365.user.model.vo.VisitorRemarkVo">
     <select id="getVisitRecordListByKey" resultType="com.caimei365.user.model.vo.VisitorRemarkVo">
         select DISTINCT
         select DISTINCT
-        ccr.id as remarksId, ccr.questionManId, ccr.remarks, ccr.addTime as addDate, ccr.questionMan,IFNULL(ccr.consultType,'') as consult,
+        ccr.id as remarksId, ccr.questionManId, ccr.remarks, ccr.addTime as addDate,
+        ccr.questionMan,IFNULL(ccr.consultType,'') as consult,
         ccr.serviceProviderId,
         ccr.serviceProviderId,
         (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS recordName,
         (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS recordName,
         (select name from serviceprovider s where s.serviceProviderID = csr.leaderId) as leaderName
         (select name from serviceprovider s where s.serviceProviderID = csr.leaderId) as leaderName
@@ -545,8 +682,8 @@
         where ccr.remarks IS NOT NULL
         where ccr.remarks IS NOT NULL
         and ccr.clubId is null
         and ccr.clubId is null
         <if test="keyWord != null and keyWord != ''">
         <if test="keyWord != null and keyWord != ''">
-           and ccr.questionMan LIKE CONCAT('%', #{keyWord}, '%')
-           OR ccr.remarks LIKE CONCAT('%', #{keyWord}, '%')
+            and ccr.questionMan LIKE CONCAT('%', #{keyWord}, '%')
+            OR ccr.remarks LIKE CONCAT('%', #{keyWord}, '%')
         </if>
         </if>
         ORDER BY ccr.ADDTIME DESC
         ORDER BY ccr.ADDTIME DESC
     </select>
     </select>
@@ -558,17 +695,21 @@
         ORDER BY sortNumber ASC
         ORDER BY sortNumber ASC
     </select>
     </select>
     <select id="findAllTeams" resultType="com.caimei365.user.model.vo.TeamLederVo">
     <select id="findAllTeams" resultType="com.caimei365.user.model.vo.TeamLederVo">
-        select csr.id as teamId, csr.leaderId,IF(csm.serviceproviderId IS NULL,2,1) as manager, csr.createdTime, s.name as leaderName
+        select csr.id                                  as teamId,
+               csr.leaderId,
+               IF(csm.serviceproviderId IS NULL, 2, 1) as manager,
+               csr.createdTime,
+               s.name                                  as leaderName
         from cm_serviceteam_role csr
         from cm_serviceteam_role csr
-        left join serviceprovider s on csr.leaderId = s.serviceProviderID
-        LEFT JOIN cm_serviceteam_manager csm ON csr.leaderId = csm.serviceproviderId
+                 left join serviceprovider s on csr.leaderId = s.serviceProviderID
+                 LEFT JOIN cm_serviceteam_manager csm ON csr.leaderId = csm.serviceproviderId
         where csr.delflag = 0
         where csr.delflag = 0
     </select>
     </select>
     <select id="findGroups" resultType="com.caimei365.user.model.vo.TeamGroupVo">
     <select id="findGroups" resultType="com.caimei365.user.model.vo.TeamGroupVo">
         select serviceProviderId as groupId, name as groupName
         select serviceProviderId as groupId, name as groupName
         from serviceprovider s
         from serviceprovider s
-        left join cm_serviceteam_group csg on s.serviceProviderID = csg.serviceId
-        left join cm_serviceteam_role csr on csr.id = csg.teamId
+                 left join cm_serviceteam_group csg on s.serviceProviderID = csg.serviceId
+                 left join cm_serviceteam_role csr on csr.id = csg.teamId
         where csr.leaderId = #{leaderId}
         where csr.leaderId = #{leaderId}
     </select>
     </select>
     <select id="findConsultById" resultType="com.caimei365.user.model.vo.ConsultVo">
     <select id="findConsultById" resultType="com.caimei365.user.model.vo.ConsultVo">
@@ -581,17 +722,20 @@
     </select>
     </select>
     <select id="findAllRemarks" resultType="com.caimei365.user.model.vo.RemarksVo">
     <select id="findAllRemarks" resultType="com.caimei365.user.model.vo.RemarksVo">
         SELECT DISTINCT
         SELECT DISTINCT
-               ccr.id AS remarksId, ccr.remarks,ccr.addTime,ccr.questionMan,ccr.serviceProviderId as serviceProviderId,
+        ccr.id AS remarksId, ccr.remarks,ccr.addTime,ccr.questionMan,ccr.serviceProviderId as serviceProviderId,
         csr.leaderId AS leaderId,IFNULL(ccr.consultType,'') as consult, c.Name as clubName,
         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.clubType AS clubType,ccr.pinceSensitve AS pinceSensitve,ccr.satisfied AS satisfied,ccr.followup AS
+        followup,ccr.extra AS extra,
         (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID= csr.leaderId) AS leaderName,
         (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID= csr.leaderId) AS leaderName,
-        (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderID) AS recordName
-#         (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.oldserviceProviderId) AS oldName
+        (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderID) AS
+        recordName,c.newDeal as newDeal,cmc.status as status
+        # (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.oldserviceProviderId) AS oldName
         FROM cm_club_remarks ccr
         FROM cm_club_remarks ccr
         LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
         LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
         LEFT JOIN club c ON c.clubId=ccr.clubId
         LEFT JOIN club c ON c.clubId=ccr.clubId
         LEFT JOIN cm_serviceTeam_group csg ON ccr.serviceProviderId = csg.serviceId
         LEFT JOIN cm_serviceTeam_group csg ON ccr.serviceProviderId = csg.serviceId
         LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
         LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
+        LEFT JOIN cm_club_report cmc ON cmc.clubId = ccr.clubId
         <where>
         <where>
             <if test="keyWord != null and keyWord !=''">
             <if test="keyWord != null and keyWord !=''">
                 AND (ccr.remarks LIKE concat('%',#{keyWord},'%')
                 AND (ccr.remarks LIKE concat('%',#{keyWord},'%')
@@ -601,6 +745,9 @@
             <if test="leaderId != null and leaderId>0">
             <if test="leaderId != null and leaderId>0">
                 and csr.leaderId = #{leaderId}
                 and csr.leaderId = #{leaderId}
             </if>
             </if>
+            <if test="status!=null and status!=0">
+                and cmc.status=#{status}
+            </if>
             <if test="groupId != null and groupId>0">
             <if test="groupId != null and groupId>0">
                 and ccr.serviceProviderId = #{groupId}
                 and ccr.serviceProviderId = #{groupId}
             </if>
             </if>
@@ -621,11 +768,14 @@
             <if test="followup != '' and followup !=null">
             <if test="followup != '' and followup !=null">
                 and ccr.followup LIKE concat('%',#{followup},'%')
                 and ccr.followup LIKE concat('%',#{followup},'%')
             </if>
             </if>
+            <if test="newDeal !=null and newDeal!=0">
+                and c.newDeal =#{newDeal}
+            </if>
 
 
             <if test="con != null and con.size > 0">
             <if test="con != null and con.size > 0">
                 and
                 and
                 <foreach collection="con" item="item" index="index" open="(" close=")" separator="OR">
                 <foreach collection="con" item="item" index="index" open="(" close=")" separator="OR">
-                    ccr.consultType LIKE CONCAT('%',#{consultType},'%')
+                    ccr.consultType LIKE CONCAT('%',#{item},'%')
                 </foreach>
                 </foreach>
             </if>
             </if>
         </where>
         </where>
@@ -633,14 +783,18 @@
     </select>
     </select>
     <select id="getAllVisitRemark" resultType="com.caimei365.user.model.vo.VisitorRemarkVo">
     <select id="getAllVisitRemark" resultType="com.caimei365.user.model.vo.VisitorRemarkVo">
         SELECT DISTINCT
         SELECT DISTINCT
-        ccr.id AS remarksId, ccr.remarks,ccr.addTime as addDate,ccr.questionMan,IFNULL(ccr.consultType,'') as consult,ccr.serviceProviderId,ccr.questionManId,
-        ccr.clubType AS clubType,ccr.pinceSensitve AS pinceSensitve,ccr.satisfied AS satisfied,ccr.followup AS followup,ccr.extra AS extra,
+        ccr.id AS remarksId, ccr.remarks,ccr.addTime as addDate,ccr.questionMan,IFNULL(ccr.consultType,'') as
+        consult,ccr.serviceProviderId,ccr.questionManId,
+        ccr.clubType AS clubType,ccr.pinceSensitve AS pinceSensitve,ccr.satisfied AS satisfied,ccr.followup AS
+        followup,ccr.extra AS extra,
         (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID = csr.leaderId) AS leaderName,
         (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID = csr.leaderId) AS leaderName,
-        (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS recordName
+        (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS
+        recordName,cmc.status as status
         FROM cm_visitor_remarks ccr
         FROM cm_visitor_remarks ccr
         LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
         LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
         LEFT JOIN cm_serviceTeam_group csg ON ccr.serviceProviderId = csg.serviceId
         LEFT JOIN cm_serviceTeam_group csg ON ccr.serviceProviderId = csg.serviceId
         LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
         LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
+        LEFT JOIN cm_club_report cmc ON cmc.Id = ccr.reportID
         <where>
         <where>
             and ccr.remarks IS NOT NULL
             and ccr.remarks IS NOT NULL
             and ccr.clubId is null
             and ccr.clubId is null
@@ -670,6 +824,9 @@
             <if test="followup != '' and followup !=null">
             <if test="followup != '' and followup !=null">
                 and ccr.followup LIKE concat('%',#{followup},'%')
                 and ccr.followup LIKE concat('%',#{followup},'%')
             </if>
             </if>
+            <if test="status!=null and status!=0">
+                and cmc.status=#{status}
+            </if>
             <if test="con != null and con.size > 0">
             <if test="con != null and con.size > 0">
                 and
                 and
                 <foreach collection="con" item="item" index="index" open="(" close=")" separator="OR">
                 <foreach collection="con" item="item" index="index" open="(" close=")" separator="OR">
@@ -680,13 +837,129 @@
         ORDER BY ccr.addtime DESC
         ORDER BY ccr.addtime DESC
     </select>
     </select>
     <select id="findLeaderId" resultType="java.lang.Integer">
     <select id="findLeaderId" resultType="java.lang.Integer">
-        SELECT leaderId FROM cm_serviceteam_role csr
-        LEFT JOIN serviceprovider s ON s.serviceProviderId=csr.leaderId
+        SELECT leaderId
+        FROM cm_serviceteam_role csr
+                 LEFT JOIN serviceprovider s ON s.serviceProviderId = csr.leaderId
         WHERE s.serviceProviderID = #{serviceProviderId}
         WHERE s.serviceProviderID = #{serviceProviderId}
     </select>
     </select>
     <select id="getCmRemarksList" resultType="com.caimei365.user.model.vo.CmRemarksVo">
     <select id="getCmRemarksList" resultType="com.caimei365.user.model.vo.CmRemarksVo">
-        SELECT remarks FROM cm_remarks csr
-        WHERE remarks like concat('%',#{remarks},'%')
+        SELECT remarks
+        FROM cm_remarks csr
+        WHERE remarks like concat('%', #{remarks}, '%')
         order by addtime DESC
         order by addtime DESC
     </select>
     </select>
+
+    <select id="recordClubage" resultType="com.caimei365.user.model.vo.ClubVo">
+        select c.clubID                                  as clubId,
+               c.userID                                  as userId,
+               c.name,
+               c.sname                                   as shortName,
+               c.contractMobile,
+               c.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,
+               c.firstClubType,
+               c.secondClubType,
+               c.department,
+               c.medicalPracticeLicenseImg               as medicalPracticeLicense,
+               c.mainpro                                 as mainProduct,
+               c.fax,
+               c.info                                    as profile,
+               c.spID                                    as serviceProviderId,
+               u.ipAddress                               as ipAddress,
+               c.addTime,
+               c.status,
+               c.lastCheckOrderDate,
+               c.newDeal                                 as newDeal,
+               IF(c.spid IS NULL or c.spId = 1342, 0, 1) AS spType,
+               r.describe,
+               u.userIdentity                            as userIdentity
+
+        from club c
+                 LEFT JOIN record_link r ON r.`clubId` = c.`clubID`
+                 left join user u on u.clubId = c.clubId
+        where c.clubID = #{clubId}
+        ORDER BY r.id DESC
+        LIMIT 1
+
+    </select>
+
+    <select id="serviceProviderNameage" resultType="java.lang.String">
+        select linkMan
+        from `serviceprovider`
+        where serviceProviderID = #{serviceproviderId}
+    </select>
+    <select id="findSales" resultType="com.caimei365.user.model.vo.ServiceProviderVo">
+        select serviceProviderId, linkman as name
+        from serviceprovider
+        where status = 90
+        order by serviceProviderID DESC
+    </select>
+    <select id="findOldSpId" resultType="java.lang.Integer">
+        select spID
+        from club
+        where clubID = #{clubId}
+    </select>
+    <select id="findOldSpIds" resultType="java.lang.Integer">
+        select oldserviceProviderId
+        FROM cm_club_remarks
+        WHERE clubId = #{clubID}
+          AND oldserviceProviderId IS NOT NULL
+    </select>
+    <select id="findOpenIdBySpId" resultType="java.lang.String">
+        SELECT wu.openId
+        FROM wechat_user wu
+                 LEFT JOIN serviceprovider s ON s.unionId = wu.unionId
+        WHERE serviceProviderID = #{spId}
+    </select>
+    <select id="findNewRemark" resultType="com.caimei365.user.model.po.ClubRemarksPo">
+        SELECT id          as remarksId,
+               clubId,
+               serviceProviderId,
+               consultType as consult,
+               remarks,
+               addTime,
+               questionMan
+        FROM cm_club_remarks
+        WHERE clubId = #{clubId}
+          AND serviceproviderId = #{serviceProviderId}
+          AND ADDTIME >
+              (SELECT checkTime
+               FROM clubchangesprecord c
+               WHERE c.clubId = #{clubId}
+                 AND c.newspId = #{serviceProviderId}
+               ORDER BY checkTime DESC
+               LIMIT 1)
+    </select>
+    <select id="findServiceName" resultType="java.lang.String">
+        select linkMan
+        from serviceprovider
+        where serviceProviderID = #{spId}
+    </select>
+    <select id="findAllotTime" resultType="java.util.Date">
+        select checkTime
+        from clubchangesprecord
+        where clubID = #{clubId}
+          and newSpID = #{spId}
+        ORDER BY checkTime DESC
+        LIMIT 1
+    </select>
+    <select id="findSubmitTime" resultType="java.util.Date">
+        select addTime
+        from cm_club_remarks
+        where id = #{remarkId}
+    </select>
+    <select id="findLeaderIdBySp" resultType="java.lang.Integer">
+        SELECT leaderId
+        FROM cm_serviceteam_role csr
+        LEFT JOIN cm_serviceteam_group csg ON csr.id=csg.teamId
+        WHERE csg.serviceId = #{spId}
+    </select>
 </mapper>
 </mapper>

+ 409 - 0
src/main/resources/mapper/ClubReport.xml

@@ -0,0 +1,409 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei365.user.mapper.ClubReportMapper">
+
+    <insert id="addClubReport">
+        INSERT INTO cm_club_report (serviceProviderID, clubID, productID, reportName, reportText, addTime)
+        VALUES (#{serviceProviderId}, #{clubId}, #{productId}, #{reportName}, #{reportText}, now())
+    </insert>
+
+    <insert id="addVisitorReport">
+        INSERT INTO cm_club_report (serviceProviderID, questionManId, productID, reportName, reportText, addTime)
+        VALUES (#{serviceProviderId}, #{questionManId}, #{productId}, #{reportName}, #{reportText}, now())
+    </insert>
+
+
+    <select id="productList" resultType="com.caimei365.user.model.vo.ProductItemVo">
+        SELECT DISTINCT p.productID as productId,p.mainImage as image,p.name,
+        (select price from cm_sku where productId=p.productId order by price asc limit 1)as price,s.name as shopName
+        FROM product p
+        LEFT JOIN shop s ON s.shopID = p.shopID
+        LEFT JOIN cm_club_report cmc ON cmc.productID = p.productID
+        <where>
+            (p.validFlag=9 or p.validFlag=2)
+            <if test="keyWord != null and keyWord !=''">
+                and p.name LIKE concat('%',#{keyWord},'%')
+            </if>
+        </where>
+        ORDER BY p.productId DESC
+    </select>
+
+    <select id="reportList" resultType="com.caimei365.user.model.vo.ReportVo">
+        SELECT DISTINCT
+        cmc.Id as reportId,cmc.clubID as clubId,cmc.status as status,cmc.productID as productId,c.`name` as
+        clubName,cmc.`addTime`,p.`name` as productName,p.`mainImage` as mainImage,cmc.`reportText` as
+        reportText,cmc.`auditText` as auditText
+        FROM cm_club_report cmc
+        LEFT JOIN cm_club_remarks ccr ON ccr.clubID = cmc.clubID
+        LEFT JOIN club c ON c.clubID = cmc.clubID
+        LEFT JOIN product p ON cmc.productID = p.productID
+        <where>
+            and (cmc.`serviceProviderId`=#{serviceProviderId} and cmc.`clubID`=#{clubId} and cmc.clubID is not null)
+            <if test="keyWord != null and keyWord !=''">
+                AND (p.name LIKE concat('%',#{keyWord},'%')
+                or cmc.reportText LIKE CONCAT('%', #{keyWord}, '%'))
+            </if>
+
+        </where>
+        ORDER BY cmc.`addTime` DESC
+    </select>
+
+    <select id="reportDetailsList" resultType="com.caimei365.user.model.vo.ReportVo">
+        SELECT DISTINCT
+                cmc.Id          as reportId,
+               cmc.clubID      as clubId,
+               cmc.status      as status,
+               p.productID     as productId,
+               c.name          AS clubName,
+                ccr.questionMan as questionMan,
+               c.linkMan,
+               cmc.`reportName`,
+               cmc.`addTime`,
+               p.`name`        as productName,
+               p.`mainImage`,
+               cmc.`reportText`,
+               s.name          as shopName,
+               cmc.`auditText` as auditText
+        FROM cm_club_report cmc
+                 LEFT JOIN club c ON c.clubID = cmc.clubID
+                 LEFT JOIN cm_club_remarks ccr ON cmc.Id = ccr.reportId
+                 LEFT JOIN product p ON p.productID = cmc.productID
+                 LEFT JOIN shop s ON s.shopID = p.shopID
+        WHERE cmc.id = #{reportId}
+          and cmc.clubID is not null
+        ORDER BY cmc.`addTime` DESC
+    </select>
+
+    <select id="visitorReportsList" resultType="com.caimei365.user.model.vo.ReportVo">
+        SELECT DISTINCT
+            cmc.Id          as reportId,
+            cmc.clubID      as clubId,
+            cmc.status      as status,
+            p.productID     as productId,
+           ccr.questionMan as questionMan,
+            cmc.`reportName`,
+            cmc.`addTime`,
+            p.`name`        as productName,
+            p.`mainImage`,
+            cmc.`reportText`,
+            s.name          as shopName,
+            cmc.`auditText` as auditText
+        FROM cm_club_report cmc
+                 LEFT JOIN cm_visitor_remarks ccr ON cmc.Id = ccr.reportId
+                 LEFT JOIN product p ON p.productID = cmc.productID
+                 LEFT JOIN shop s ON s.shopID = p.shopID
+        WHERE cmc.id = #{reportId}
+          and cmc.clubID is  null
+        ORDER BY cmc.`addTime` DESC
+    </select>
+
+
+
+    <select id="reportRemarks" resultType="com.caimei365.user.model.vo.ReportVo">
+        SELECT DISTINCT
+        cmc.id AS reportId ,cmc.productID AS productId,ccr.serviceProviderID AS serviceProviderId,  c.name AS clubName,c.`newDeal` AS newDeal,cmc.reportName AS
+        reportName,cmc.`addTime` AS ADDTIME,p.`mainImage` AS mainImage,p.name AS productName,cmc.`reportText` AS
+        reportText,cmc.status AS STATUS,cmc.`auditText` AS auditText,ccr.questionMan AS questionMan
+        FROM cm_club_report cmc
+        LEFT JOIN club c ON c.clubId=cmc.clubId
+        LEFT JOIN cm_club_remarks ccr ON cmc.Id = ccr.reportId
+        LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
+        LEFT JOIN cm_serviceTeam_group csg ON ccr.serviceProviderId = csg.serviceId
+        LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
+        LEFT JOIN product p ON p.productID = cmc.productID
+        <where>
+            and cmc.clubID is not null
+            <if test="keyWord != null and keyWord !=''">
+                AND (p.name LIKE concat('%',#{keyWord},'%')
+                or cmc.reportText LIKE CONCAT('%', #{keyWord}, '%'))
+            </if>
+            <if test="teamId!=null">
+                and csg.teamId = #{teamId}
+            </if>
+            <if test="serviceProviderId!=null">
+                and cmc.serviceProviderId=#{serviceProviderId}
+            </if>
+        </where>
+        ORDER BY cmc.`addTime` DESC
+    </select>
+
+    <select id="repotRemark" resultType="com.caimei365.user.model.vo.ReportVo">
+        SELECT DISTINCT
+        cmc.id AS reportId ,cmc.productID AS productId,ccr.serviceProviderID AS serviceProviderId,  c.name AS clubName,c.`newDeal` AS newDeal,cmc.reportName AS
+        reportName,cmc.`addTime` AS ADDTIME,p.`mainImage` AS mainImage,p.name AS productName,cmc.`reportText` AS
+        reportText,cmc.status AS STATUS,cmc.`auditText` AS auditText,ccr.questionMan AS questionMan
+        FROM cm_club_report cmc
+        LEFT JOIN club c ON c.clubId=cmc.clubId
+        LEFT JOIN cm_club_remarks ccr ON cmc.Id = ccr.reportId
+        LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
+        LEFT JOIN cm_serviceTeam_group csg ON ccr.serviceProviderId = csg.serviceId
+        LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
+        LEFT JOIN product p ON p.productID = cmc.productID
+        where
+             cmc.clubID is not null
+
+        ORDER BY cmc.`addTime` DESC
+    </select>
+
+
+    <select id="visitorReportRemarks" resultType="com.caimei365.user.model.vo.ReportVo">
+        SELECT DISTINCT
+        cmc.id AS reportId , cmc.productID as productId,cmc.serviceProviderID as serviceProviderId,cmc.questionManId AS questionManId, c.name AS clubName,c.`newDeal` AS
+        newDeal,cmc.reportName AS reportName,cmc.`addTime` AS ADDTIME,p.`mainImage` AS mainImage,p.name AS
+        productName,cmc.`reportText` as reportText,cmc.status AS status,cmc.`auditText` as auditText
+        FROM cm_club_report cmc
+        LEFT JOIN club c ON c.clubId=cmc.clubId
+        LEFT JOIN cm_visitor_remarks ccr ON cmc.Id = ccr.reportId
+        LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
+        LEFT JOIN cm_serviceTeam_group csg ON ccr.serviceProviderId = csg.serviceId
+        LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
+        LEFT JOIN product p ON p.productID = cmc.productID
+        <where>
+            and cmc.clubID is null
+#             and reportID is not null
+            <if test="keyWord != null and keyWord != ''">
+                AND p.name LIKE concat('%',#{keyWord},'%')
+                or cmc.reportText LIKE CONCAT('%', #{keyWord}, '%')
+            </if>
+            <if test="teamId!=null">
+                and csg.teamId = #{teamId}
+            </if>
+            <if test="teamId==null and serviceProviderId!=null">
+                and cmc.serviceProviderId=#{serviceProviderId}
+            </if>
+        </where>
+        ORDER BY cmc.`addTime` DESC
+    </select>
+
+    <select id="visitoReportRemark" resultType="com.caimei365.user.model.vo.ReportVo">
+        SELECT DISTINCT
+        cmc.id AS reportId , cmc.productID as productId,cmc.serviceProviderID as serviceProviderId,cmc.questionManId AS questionManId, c.name AS clubName,c.`newDeal` AS
+        newDeal,cmc.reportName AS reportName,cmc.`addTime` AS ADDTIME,p.`mainImage` AS mainImage,p.name AS
+        productName,cmc.`reportText` as reportText,cmc.status AS status,cmc.`auditText` as auditText
+        FROM cm_club_report cmc
+        LEFT JOIN club c ON c.clubId=cmc.clubId
+        LEFT JOIN cm_visitor_remarks ccr ON cmc.Id = ccr.reportId
+        LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
+        LEFT JOIN cm_serviceTeam_group csg ON ccr.serviceProviderId = csg.serviceId
+        LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
+        LEFT JOIN product p ON p.productID = cmc.productID
+        where
+             cmc.clubID is null
+
+        ORDER BY cmc.`addTime` DESC
+    </select>
+
+    <select id="reportLeaderId" resultType="java.lang.Integer">
+        SELECT DISTINCT id
+        FROM cm_serviceteam_role csr
+        LEFT JOIN serviceprovider s ON s.serviceProviderId = csr.leaderId
+        WHERE s.serviceProviderID = #{serviceProviderId}
+    </select>
+
+
+    <select id="roeprtNa" resultType="java.lang.String">
+        SELECT DISTINCT linkMan
+        FROM serviceprovider
+        WHERE serviceProviderID = #{serviceProviderId}
+        LIMIT 1
+    </select>
+
+    <select id="visitorMan" resultType="java.lang.Integer">
+        SELECT DISTINCT serviceProviderId
+        FROM cm_visitor_remarks
+        WHERE questionManId = #{questionManId}
+        LIMIT 1
+    </select>
+
+
+
+    <select id="associated" resultType="com.caimei365.user.model.vo.RemarksVo">
+        SELECT DISTINCT
+        ccr.id AS remarksId, ccr.remarks,ccr.addTime,ccr.serviceProviderId AS serviceProviderId,
+        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,
+        (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID= csr.leaderId) AS leaderName,
+        (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderID) AS
+        recordName,c.newDeal AS newDeal,cmc.status AS status,cmc.`auditText` as auditText
+        # (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.oldserviceProviderId) AS oldName
+        FROM cm_club_remarks ccr
+        LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
+        LEFT JOIN club c ON c.clubId=ccr.clubId
+        LEFT JOIN cm_serviceTeam_group csg ON ccr.serviceProviderId = csg.serviceId
+        LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
+        LEFT JOIN cm_club_report cmc ON cmc.Id = ccr.reportID
+        <where>
+            and cmc.id=#{reportId}
+            and cmc.clubID is not null
+            <if test="teamId!=null">
+                and csg.teamId = #{teamId}
+            </if>
+            <if test="teamId==null and serviceProviderId!=null">
+                and cmc.serviceProviderId=#{serviceProviderId}
+            </if>
+            and reportID is not null
+            <if test="keyWord != null and keyWord !=''">
+                and cmc.reportText LIKE CONCAT('%', #{keyWord}, '%')
+            </if>
+            <if test="leaderId != null and leaderId>0">
+                and csr.leaderId = #{leaderId}
+            </if>
+            <if test="groupId != null and groupId>0">
+                and ccr.serviceProviderId = #{groupId}
+            </if>
+            <if test="startAddTime !='' and startAddTime !=null">
+                and ccr.addTime <![CDATA[  >  ]]> #{startAddTime}
+            </if>
+            <if test="endAddTime != '' and endAddTime!=null">
+                and ccr.addTime <![CDATA[  <  ]]> #{endAddTime}
+            </if>
+
+            <if test="pinceSensitve != '' and pinceSensitve!=null">
+                and ccr.pinceSensitve LIKE concat('%',#{pinceSensitve},'%')
+            </if>
+            <if test="satisfied != '' and satisfied!=null">
+                and ccr.satisfied LIKE concat('%',#{satisfied},'%')
+            </if>
+
+            <if test="followup != '' and followup !=null">
+                and ccr.followup LIKE concat('%',#{followup},'%')
+            </if>
+            <if test="newDeal !=null and newDeal != 0">
+                and c.newDeal =#{newDeal}
+            </if>
+            <if test="status!=null and status!=0">
+                and cmc.status=#{status}
+            </if>
+            <if test="con != null and con.size > 0">
+                and
+                <foreach collection="con" item="item" index="index" open="(" close=")" separator="OR">
+                    ccr.consultType LIKE CONCAT('%',#{consultType},'%')
+                </foreach>
+            </if>
+
+        </where>
+        ORDER BY cmc.`addTime` DESC
+    </select>
+
+
+    <select id="visitorAssociated" resultType="com.caimei365.user.model.vo.RemarksVo">
+        SELECT DISTINCT
+        ccr.id AS remarksId, ccr.remarks,ccr.addTime,ccr.questionMan,ccr.serviceProviderId AS serviceProviderId,
+        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,
+        (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID= csr.leaderId) AS leaderName,
+        (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderID) AS
+        recordName,c.newDeal AS newDeal,cmc.status AS status,cmc.`auditText` as auditText
+        # (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.oldserviceProviderId) AS oldName
+        FROM cm_visitor_remarks ccr
+        LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
+        LEFT JOIN club c ON c.clubId=ccr.clubId
+        LEFT JOIN cm_serviceTeam_group csg ON ccr.serviceProviderId = csg.serviceId
+        LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
+        LEFT JOIN cm_club_report cmc ON cmc.Id = ccr.reportID
+        <where>
+            and cmc.id=#{reportId}
+            and cmc.clubID is null
+            and reportID is not null
+            <if test="teamId!=null">
+                and csg.teamId = #{teamId}
+            </if>
+            <if test="teamId==null and serviceProviderId!=null">
+                and cmc.serviceProviderId=#{serviceProviderId}
+            </if>
+            <if test="keyWord != null and keyWord !=''">
+                and cmc.reportText LIKE CONCAT('%', #{keyWord}, '%')
+            </if>
+            <if test="leaderId != null and leaderId>0">
+                and csr.leaderId = #{leaderId}
+            </if>
+            <if test="groupId != null and groupId>0">
+                and ccr.serviceProviderId = #{groupId}
+            </if>
+            <if test="startAddTime !='' and startAddTime !=null">
+                and ccr.addTime <![CDATA[  >  ]]> #{startAddTime}
+            </if>
+            <if test="endAddTime != '' and endAddTime!=null">
+                and ccr.addTime <![CDATA[  <  ]]> #{endAddTime}
+            </if>
+
+            <if test="pinceSensitve != '' and pinceSensitve!=null">
+                and ccr.pinceSensitve LIKE concat('%',#{pinceSensitve},'%')
+            </if>
+            <if test="satisfied != '' and satisfied!=null">
+                and ccr.satisfied LIKE concat('%',#{satisfied},'%')
+            </if>
+            <if test="status!=null and status!=0">
+                and cmc.status=#{status}
+            </if>
+            <if test="followup != '' and followup !=null">
+                and ccr.followup LIKE concat('%',#{followup},'%')
+            </if>
+        </where>
+        ORDER BY cmc.`addTime` DESC
+    </select>
+
+
+    <update id="disassociation">
+        UPDATE cm_club_remarks
+        SET reportId=NULL
+#             clubId=NULL
+        WHERE Id = #{remarksId}
+    </update>
+
+    <update id="visitorDisassociation">
+        UPDATE cm_visitor_remarks
+        SET reportId=NULL
+#             questionManId=NULL
+        WHERE Id = #{remarksId}
+    </update>
+
+
+    <select id="visitorReportList" resultType="com.caimei365.user.model.vo.ReportVo">
+        SELECT DISTINCT
+        cmc.id as reportId,cmc.productID as productId,cmc.reportName as reportName,ccr.questionMan AS questionMan,cmc.`addTime`,p.`name` as
+        productName,p.`mainImage` as mainImage,cmc.`reportText`,cmc.status AS status,cmc.`auditText` as auditText
+        FROM cm_club_report cmc
+        LEFT JOIN cm_visitor_remarks ccr ON cmc.Id = ccr.reportID
+        LEFT JOIN serviceprovider s ON cmc.serviceProviderId = s.serviceProviderID
+        LEFT JOIN product p ON p.productID = cmc.productID
+        <where>
+            and cmc.`questionManId`=#{questionManId} and cmc.clubID is  null
+            <if test="keyWord != null and keyWord !=''">
+                AND (p.name LIKE concat('%',#{keyWord},'%')
+                or cmc.reportText LIKE CONCAT('%', #{keyWord}, '%'))
+            </if>
+
+        </where>
+         ORDER BY cmc.`addTime` DESC
+    </select>
+
+    <delete id="deleteReport">
+        DELETE FROM cm_club_report WHERE id=#{reportId}
+    </delete>
+
+    <select id="questionManNameage" resultType="java.lang.String">
+        SELECT ccr.questionMan FROM cm_club_report cmc
+        LEFT JOIN cm_visitor_remarks ccr ON cmc.questionManId = ccr.questionManId
+        <where>
+        <if test="reportId!=null">
+            cmc.id=#{reportId}
+        </if>
+            <if test="questionManId!='' and questionManId!=null">
+                cmc.questionManId=#{questionManId}
+            </if>
+            <if test="serviceProviderId!=null">
+                cmc.serviceProviderId=#{serviceProviderId}
+            </if>
+        </where>
+        LIMIT 1
+    </select>
+
+
+
+
+
+
+</mapper>

+ 18 - 6
src/main/resources/mapper/RegisterMapper.xml

@@ -2,8 +2,16 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei365.user.mapper.RegisterMapper">
 <mapper namespace="com.caimei365.user.mapper.RegisterMapper">
     <insert id="insertClubUser" parameterType="com.caimei365.user.model.po.UserPo" keyProperty="userId" useGeneratedKeys="true">
     <insert id="insertClubUser" parameterType="com.caimei365.user.model.po.UserPo" keyProperty="userId" useGeneratedKeys="true">
-        insert into user(`userOrganizeID`,`registerTime`,`registerIP`, `source`, `registerUserTypeID`, `name`, `userName`, `bindMobile`, `email`, `userIdentity`, `userPermission`,`guideFlag`,`clubStatus`, `password`, `agreeFlag`, `validFlag`, `serviceProviderID`, `serviceProviderStatus`, userBeans)
-                  values(#{organizeId},#{registerTime},#{registerIp},#{source},#{registerUserTypeId},#{name},#{userName},#{bindMobile},#{email},#{userIdentity},#{userPermission},#{guideFlag},#{clubStatus},#{password},#{agreeFlag},#{validFlag},#{serviceProviderId},#{serviceProviderStatus}, #{userBeans})
+        insert into user(`userOrganizeID`,`registerTime`,`registerIP`, `ipAddress`, `source`, `registerUserTypeID`, `name`, `userName`, `bindMobile`, `email`, `userIdentity`, `userPermission`,`guideFlag`,`clubStatus`, `password`, `agreeFlag`, `validFlag`, `serviceProviderID`, `serviceProviderStatus`, userBeans)
+                  values(#{organizeId},#{registerTime},#{registerIp},#{ipAddress},#{source},#{registerUserTypeId},#{name},#{userName},#{bindMobile},#{email},#{userIdentity},#{userPermission},#{guideFlag},#{clubStatus},#{password},#{agreeFlag},#{validFlag},#{serviceProviderId},#{serviceProviderStatus}, #{userBeans})
+    </insert>
+    <select id="selUser" resultType="com.caimei365.user.model.po.UserPo">
+        select * from user where registerTime = #{registerTime}
+    </select>
+    <insert id="insertOrgan">
+        insert into cm_organ_value_system
+            (userID, activeState, customerValue, stage, delType)
+            values(#{userID},"新增用户","一般挽留客户",0,1)
     </insert>
     </insert>
     <insert id="insertClub" parameterType="com.caimei365.user.model.po.ClubPo" keyProperty="clubId" useGeneratedKeys="true">
     <insert id="insertClub" parameterType="com.caimei365.user.model.po.ClubPo" keyProperty="clubId" useGeneratedKeys="true">
         insert into club(`name`, `sname`, `contractMobile`, `linkMan`, `userID`, `addTime`, `status`, `spID`, `scanFlag`)
         insert into club(`name`, `sname`, `contractMobile`, `linkMan`, `userID`, `addTime`, `status`, `spID`, `scanFlag`)
@@ -18,8 +26,8 @@
                                     values(#{userId},#{clubId},#{shopId},#{organizeId},#{linkName},#{nickName},#{avatarUrl},#{userType},#{mobile} ,#{status},#{unionId},#{openId},#{pcOpenId},#{addTime},#{updateTime},#{bindTime},#{delFlag})
                                     values(#{userId},#{clubId},#{shopId},#{organizeId},#{linkName},#{nickName},#{avatarUrl},#{userType},#{mobile} ,#{status},#{unionId},#{openId},#{pcOpenId},#{addTime},#{updateTime},#{bindTime},#{delFlag})
     </insert>
     </insert>
     <insert id="insertShopUser" parameterType="com.caimei365.user.model.po.UserPo" keyProperty="userId" useGeneratedKeys="true">
     <insert id="insertShopUser" parameterType="com.caimei365.user.model.po.UserPo" keyProperty="userId" useGeneratedKeys="true">
-        insert into user(`userOrganizeID`,`registerTime`, `registerIP`, `source`, `registerUserTypeID`, `name`, `userName`, `bindMobile`, `email`, `userIdentity`, `userPermission`, `manufacturerStatus` , `password`, `agreeFlag`, `validFlag`)
-        values(#{organizeId},#{registerTime},#{registerIp},#{source},#{registerUserTypeId},#{name},#{userName},#{bindMobile},#{email},#{userIdentity},#{userPermission},#{manufacturerStatus},#{password},#{agreeFlag},#{validFlag})
+        insert into user(`userOrganizeID`,`registerTime`, `registerIP`, `ipAddress`, `source`, `registerUserTypeID`, `name`, `userName`, `bindMobile`, `email`, `userIdentity`, `userPermission`, `manufacturerStatus` , `password`, `agreeFlag`, `validFlag`)
+        values(#{organizeId},#{registerTime},#{registerIp},#{ipAddress},#{source},#{registerUserTypeId},#{name},#{userName},#{bindMobile},#{email},#{userIdentity},#{userPermission},#{manufacturerStatus},#{password},#{agreeFlag},#{validFlag})
     </insert>
     </insert>
     <insert id="insertShop" parameterType="com.caimei365.user.model.po.ShopPo" keyProperty="shopId" useGeneratedKeys="true">
     <insert id="insertShop" parameterType="com.caimei365.user.model.po.ShopPo" keyProperty="shopId" useGeneratedKeys="true">
         insert into shop(`userID`, `name`, `sname`, `linkMan`, `contractMobile`, `contractEmail`, `provinceID`, `cityID`, `townID`, `address`, `socialCreditCode`, `businessLicenseImage`, `firstShopType`, `secondShopType`, `mainpro`, `productDesc`, `info`, `website`, `wxOfficialAccount`, `wxApplets`, `addTime`, `validFlag`, `status`,medicalPracticeLicenseImg1)
         insert into shop(`userID`, `name`, `sname`, `linkMan`, `contractMobile`, `contractEmail`, `provinceID`, `cityID`, `townID`, `address`, `socialCreditCode`, `businessLicenseImage`, `firstShopType`, `secondShopType`, `mainpro`, `productDesc`, `info`, `website`, `wxOfficialAccount`, `wxApplets`, `addTime`, `validFlag`, `status`,medicalPracticeLicenseImg1)
@@ -53,6 +61,9 @@
             <if test="linkMan != null and linkMan != ''">
             <if test="linkMan != null and linkMan != ''">
                 linkMan = #{linkMan},
                 linkMan = #{linkMan},
             </if>
             </if>
+            <if test="linkManIdentity != null and linkManIdentity != ''">
+                linkManIdentity = #{linkManIdentity},
+            </if>
             provinceID = #{provinceId}, cityID = #{cityId}, townID = #{townId}, address = #{address},
             provinceID = #{provinceId}, cityID = #{cityId}, townID = #{townId}, address = #{address},
             <if test="shopPhoto != null  and shopPhoto != 'null'  and shopPhoto != ''">
             <if test="shopPhoto != null  and shopPhoto != 'null'  and shopPhoto != ''">
                 headpic = #{shopPhoto},
                 headpic = #{shopPhoto},
@@ -118,7 +129,7 @@
     <insert id="insertClubTemporary" useGeneratedKeys="true" keyProperty="userId" keyColumn="id" parameterType="com.caimei365.user.model.dto.ClubOnlineDto">
     <insert id="insertClubTemporary" useGeneratedKeys="true" keyProperty="userId" keyColumn="id" parameterType="com.caimei365.user.model.dto.ClubOnlineDto">
         INSERT INTO `club_temporary` (
         INSERT INTO `club_temporary` (
           `userId`, `name`, `shortName`, `bindMobile`,
           `userId`, `name`, `shortName`, `bindMobile`,
-          `contractEmail`, `linkMan`, `provinceId`,
+          `contractEmail`, `linkMan`, `linkManIdentity`, `provinceId`,
           `cityId`, `townId`, `address`, `shopPhoto`,
           `cityId`, `townId`, `address`, `shopPhoto`,
           `businessLicense`, `socialCreditCode`,
           `businessLicense`, `socialCreditCode`,
           `firstClubType`, `secondClubType`,
           `firstClubType`, `secondClubType`,
@@ -128,7 +139,7 @@
         VALUES
         VALUES
           (
           (
             #{userId}, #{name}, #{shortName}, #{bindMobile},
             #{userId}, #{name}, #{shortName}, #{bindMobile},
-            #{contractEmail}, #{linkMan}, #{provinceId},
+            #{contractEmail}, #{linkMan}, #{linkManIdentity}, #{provinceId},
             #{cityId}, #{townId}, #{address}, #{shopPhoto},
             #{cityId}, #{townId}, #{address}, #{shopPhoto},
             #{businessLicense}, #{socialCreditCode},
             #{businessLicense}, #{socialCreditCode},
             #{firstClubType}, #{secondClubType},
             #{firstClubType}, #{secondClubType},
@@ -192,6 +203,7 @@
           name = #{name},
           name = #{name},
           registerTime = #{registerTime},
           registerTime = #{registerTime},
           registerIP = #{registerIp},
           registerIP = #{registerIp},
+          ipAddress = #{ipAddress},
           clubStatus = #{clubStatus},
           clubStatus = #{clubStatus},
           serviceProviderStatus = #{serviceProviderStatus},
           serviceProviderStatus = #{serviceProviderStatus},
           serviceProviderID = #{serviceProviderId},
           serviceProviderID = #{serviceProviderId},

+ 48 - 0
src/main/resources/mapper/RoosInformationMapper.xml

@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!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>
+
+    <insert id="insRoosInformation">
+        INSERT INTO cm_roos_information
+            (
+             IP,
+             <if test="consultName != null and consultName != ''">
+                 consultName,
+             </if>
+             <if test="consultMobile != null and consultMobile != ''">
+                consultMobile,
+             </if>
+             isClick,
+             createTime
+             )
+        VALUES(
+               #{ip},
+               <if test="consultName != null and consultName != ''">
+                #{consultName},
+               </if>
+               <if test="consultMobile != null and consultMobile != ''">
+                #{consultMobile},
+               </if>
+               #{isClick},
+               #{createTime}
+               )
+    </insert>
+
+    <select id="visitRoos" resultType="String">
+        SELECT behaviorType FROM cm_behavior_record
+        <where>
+            <if test="userID != 0">
+                AND userID = #{userID}
+            </if>
+            <if test="userID == 0">
+                AND IP = #{IP}
+            </if>
+        </where>
+    </select>
+</mapper>

+ 163 - 81
src/main/resources/mapper/SellerMapper.xml

@@ -2,90 +2,92 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei365.user.mapper.SellerMapper">
 <mapper namespace="com.caimei365.user.mapper.SellerMapper">
     <select id="getLoginSellerByMobile" resultType="com.caimei365.user.model.vo.UserLoginVo">
     <select id="getLoginSellerByMobile" resultType="com.caimei365.user.model.vo.UserLoginVo">
-        select u.userID as userId,
-            u.clubID as clubId,
-            u.shopID as shopId,
-            u.userName as userName,u.name as name,
-            u.mobile as mobile,
-            u.bindMobile as bindMobile,
-            u.email as email,
-            u.guideFlag as guideFlag,
-            u.userPermission as userPermission,
-            u.userIdentity as userIdentity,
-            u.password as password
+        select u.userID         as userId,
+               u.clubID         as clubId,
+               u.shopID         as shopId,
+               u.userName       as userName,
+               u.name           as name,
+               u.mobile         as mobile,
+               u.bindMobile     as bindMobile,
+               u.email          as email,
+               u.guideFlag      as guideFlag,
+               u.userPermission as userPermission,
+               u.userIdentity   as userIdentity,
+               u.password       as password
         from user u
         from user u
-        where
-          u.mobile = #{mobile}
+        where u.mobile = #{mobile}
           and u.userIdentity = 1
           and u.userIdentity = 1
           and u.userPermission = 4
           and u.userPermission = 4
           and u.validFlag = 1
           and u.validFlag = 1
     </select>
     </select>
     <update id="updateServiceProviderByUserId">
     <update id="updateServiceProviderByUserId">
         update serviceprovider
         update serviceprovider
-        set openid = #{openId}, unionId = #{unionId}
+        set openid  = #{openId},
+            unionId = #{unionId}
         where userID = #{userId}
         where userID = #{userId}
     </update>
     </update>
 
 
     <select id="findClubTemporary" resultType="com.caimei365.user.model.vo.ClubTemporaryVo">
     <select id="findClubTemporary" resultType="com.caimei365.user.model.vo.ClubTemporaryVo">
         SELECT
         SELECT
-          `id`,
-          `userId`,
-          `name`,
-          `shortName`,
-          `bindMobile`,
-          `contractEmail`,
-          `linkMan`,
-          `provinceId`,
-          `cityId`,
-          `townId`,
-          `address`,
-          `shopPhoto`,
-          `businessLicense`,
-          `socialCreditCode`,
-          `firstClubType`,
-          `secondClubType`,
-          `department`,
-          `medicalPracticeLicense`,
-          `mainProduct`,
-          `isAgreed`
+        `id`,
+        `userId`,
+        `name`,
+        `shortName`,
+        `bindMobile`,
+        `contractEmail`,
+        `linkMan`,
+        `provinceId`,
+        `cityId`,
+        `townId`,
+        `address`,
+        `shopPhoto`,
+        `businessLicense`,
+        `socialCreditCode`,
+        `firstClubType`,
+        `secondClubType`,
+        `department`,
+        `medicalPracticeLicense`,
+        `mainProduct`,
+        `isAgreed`
         FROM
         FROM
-          club_temporary
+        club_temporary
         WHERE
         WHERE
-          userId = #{userId}
-          <if test="searchName != null and searchName != ''">
-              AND (name LIKE CONCAT('%',#{searchName},'%') OR linkMan LIKE CONCAT('%',#{searchName},'%'))
-          </if>
+        userId = #{userId}
+        <if test="searchName != null and searchName != ''">
+            AND (name LIKE CONCAT('%',#{searchName},'%') OR linkMan LIKE CONCAT('%',#{searchName},'%'))
+        </if>
         ORDER BY
         ORDER BY
-          id DESC
+        id DESC
     </select>
     </select>
 
 
     <update id="updateClubTemporary">
     <update id="updateClubTemporary">
         UPDATE
         UPDATE
-          `club_temporary`
-        SET
-          `name` = #{name},
-          `shortName` = #{shortName},
-          `bindMobile` = #{bindMobile},
-          `contractEmail` = #{contractEmail},
-          `linkMan` = #{linkMan},
-          `provinceId` = #{provinceId},
-          `cityId` = #{cityId},
-          `townId` = #{townId},
-          `address` = #{address},
-          `shopPhoto` = #{shopPhoto},
-          `businessLicense` = #{businessLicense},
-          `socialCreditCode` = #{socialCreditCode},
-          `firstClubType` = #{firstClubType},
-          `secondClubType` = #{secondClubType},
-          `department` = #{department},
-          `medicalPracticeLicense` = #{medicalPracticeLicense},
-          `mainProduct` = #{mainProduct},
-          `isAgreed` = #{isAgreed}
+            `club_temporary`
+        SET `name`                   = #{name},
+            `shortName`              = #{shortName},
+            `bindMobile`             = #{bindMobile},
+            `contractEmail`          = #{contractEmail},
+            `linkMan`                = #{linkMan},
+            `provinceId`             = #{provinceId},
+            `cityId`                 = #{cityId},
+            `townId`                 = #{townId},
+            `address`                = #{address},
+            `shopPhoto`              = #{shopPhoto},
+            `businessLicense`        = #{businessLicense},
+            `socialCreditCode`       = #{socialCreditCode},
+            `firstClubType`          = #{firstClubType},
+            `secondClubType`         = #{secondClubType},
+            `department`             = #{department},
+            `medicalPracticeLicense` = #{medicalPracticeLicense},
+            `mainProduct`            = #{mainProduct},
+            `isAgreed`               = #{isAgreed}
         WHERE `id` = #{id}
         WHERE `id` = #{id}
     </update>
     </update>
 
 
     <delete id="deleteTemporaryClub">
     <delete id="deleteTemporaryClub">
-        DELETE FROM `club_temporary` WHERE `id` = #{id}
+        DELETE
+        FROM `club_temporary`
+        WHERE `id` = #{id}
     </delete>
     </delete>
 
 
     <select id="findOrderNum" resultType="integer">
     <select id="findOrderNum" resultType="integer">
@@ -102,15 +104,34 @@
     </select>
     </select>
 
 
     <select id="findClubs" resultType="com.caimei365.user.model.vo.ClubVo">
     <select id="findClubs" resultType="com.caimei365.user.model.vo.ClubVo">
-        select c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile, c.contractEmail as contractEmail,
+        select DISTINCT 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.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,
         c.address, c.headpic as shopPhoto, c.businessLicenseImage as businessLicense, c.socialCreditCode,
         c.firstClubType, c.secondClubType, c.department, c.medicalPracticeLicenseImg as medicalPracticeLicense,
         c.firstClubType, c.secondClubType, c.department, c.medicalPracticeLicenseImg as medicalPracticeLicense,
-        c.mainpro as mainProduct, c.fax, c.info as profile, c.spID as serviceProviderId, c.addTime, c.status, c.lastCheckOrderDate,
-        u.userIdentity
+        c.mainpro as mainProduct, c.fax, c.info as profile, c.spID as serviceProviderId, c.addTime, c.status,
+        c.lastCheckOrderDate,
+        u.userIdentity,c.newDeal as newDeal,IF(r.id IS NOT NULL,1,0) AS recordCount,
+        covs.activeState AS activeState,
+        covs.customerValue AS customerValue
         from club c
         from club c
         left join user u on c.userID = u.userID
         left join user u on c.userID = u.userID
-        where c.spID = #{serviceProviderId}
+        LEFT JOIN record_link r ON r.`clubId`=c.`clubID`
+        LEFT JOIN cm_organ_value_system covs ON covs.userID = u.userID
+        where
+        <if test="1 == type">
+            c.spID = #{serviceProviderId}
+        </if>
+        <if test="2 == type">
+            c.spID in
+            <foreach collection="serviceIds" item="id" index="index" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </if>
+        <if test="3 == type">
+            r.clubId IS NOT NULL
+            AND c.spId=1342
+        </if>
         <if test="status != null and status != 66">
         <if test="status != null and status != 66">
             AND c.status = #{status}
             AND c.status = #{status}
         </if>
         </if>
@@ -118,19 +139,22 @@
             AND c.status IN (1,90,92,93)
             AND c.status IN (1,90,92,93)
         </if>
         </if>
         <if test="name != null and name != ''">
         <if test="name != null and name != ''">
-            AND (c.name LIKE CONCAT('%',#{name},'%') OR c.linkMan LIKE CONCAT('%',#{name},'%'))
+            AND (c.name LIKE CONCAT('%',#{name},'%') OR c.linkMan LIKE CONCAT('%',#{name},'%') OR c.contractMobile LIKE CONCAT('%',#{name},'%'))
         </if>
         </if>
         <if test="userIdentity != null">
         <if test="userIdentity != null">
             AND u.userIdentity = #{userIdentity}
             AND u.userIdentity = #{userIdentity}
         </if>
         </if>
+        AND covs.stage = 0 AND covs.delType = 1
         order by c.clubID desc
         order by c.clubID desc
     </select>
     </select>
     <select id="getAllClubList" resultType="com.caimei365.user.model.vo.ClubVo">
     <select id="getAllClubList" resultType="com.caimei365.user.model.vo.ClubVo">
-        SELECT c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile, c.contractEmail as contractEmail,
+        SELECT DISTINCT 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.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,
         c.address, c.headpic as shopPhoto, c.businessLicenseImage as businessLicense, c.socialCreditCode,
         c.firstClubType, c.secondClubType, c.department, c.medicalPracticeLicenseImg as medicalPracticeLicense,
         c.firstClubType, c.secondClubType, c.department, c.medicalPracticeLicenseImg as medicalPracticeLicense,
-        c.mainpro as mainProduct, c.fax, c.info as profile, c.spID as serviceProviderId, c.addTime, c.status, c.lastCheckOrderDate,
+        c.mainpro as mainProduct, c.fax, c.info as profile, c.spID as serviceProviderId, c.addTime, c.status,
+        c.lastCheckOrderDate,
         u.userIdentity
         u.userIdentity
         FROM club c
         FROM club c
         LEFT JOIN user u ON c.userID=u.userID
         LEFT JOIN user u ON c.userID=u.userID
@@ -144,26 +168,84 @@
         </if>
         </if>
     </select>
     </select>
     <select id="getSellerByUserId" resultType="com.caimei365.user.model.po.ServiceProviderPo">
     <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,
+        select serviceProviderID     AS serviceProviderId,
+               status,
+               userID                AS userId,
+               openid,
+               unionId,
+               name,
+               contractMobile,
+               linkMan,
+               duty,
+               contractEmail,
+               auditStatus,
+               auditTime,
+               auditNote,
+               validFlag,
+               addTime,
                mainServiceProviderID AS mainServiceProviderId
                mainServiceProviderID AS mainServiceProviderId
-        from serviceprovider where userID = #{userId}
+        from serviceprovider
+        where userID = #{userId}
     </select>
     </select>
     <select id="findManager" resultType="java.lang.Integer">
     <select id="findManager" resultType="java.lang.Integer">
-        SELECT IF(csm.serviceProviderId IS NULL,2,1) AS manager FROM  cm_serviceteam_manager csm
-        LEFT JOIN serviceprovider s ON csm.serviceProviderId = s.serviceProviderId
-        LEFT JOIN USER u ON s.userId = u.userId
-        WHERE u.bindmobile = #{mobile} OR u.mobile = #{mobile}
+        SELECT IF(csm.serviceProviderId IS NULL, 2, 1) AS manager
+        FROM cm_serviceteam_manager csm
+                 LEFT JOIN serviceprovider s ON csm.serviceProviderId = s.serviceProviderId
+                 LEFT JOIN USER u ON s.userId = u.userId
+        WHERE u.bindmobile = #{mobile}
+           OR u.mobile = #{mobile}
     </select>
     </select>
     <select id="findManagerByUser" resultType="java.lang.Integer">
     <select id="findManagerByUser" resultType="java.lang.Integer">
-        SELECT IF(csm.serviceProviderId IS NULL,2,1) AS manager
-        FROM  cm_serviceteam_manager csm
-        LEFT JOIN serviceprovider s ON csm.serviceProviderId = s.serviceProviderId
-        WHERE s.userID  = #{userId}
+        SELECT IF(csm.serviceProviderId IS NULL, 2, 1) AS manager
+        FROM cm_serviceteam_manager csm
+                 LEFT JOIN serviceprovider s ON csm.serviceProviderId = s.serviceProviderId
+        WHERE s.userID = #{userId}
     </select>
     </select>
     <select id="findLeaderId" resultType="java.lang.Integer">
     <select id="findLeaderId" resultType="java.lang.Integer">
-        SELECT leaderId FROM cm_serviceteam_role csr
-        LEFT JOIN serviceprovider s ON s.serviceProviderId=csr.leaderId
+        SELECT leaderId
+        FROM cm_serviceteam_role csr
+                 LEFT JOIN serviceprovider s ON s.serviceProviderId = csr.leaderId
         WHERE s.userId = #{userId}
         WHERE s.userId = #{userId}
     </select>
     </select>
+    <select id="findLeaderIdByServiceId" resultType="java.lang.Integer">
+        select leaderId
+        FROM cm_serviceteam_role
+        WHERE leaderId = #{serviceProviderId}
+    </select>
+    <select id="findmanagerIdByServiceId" resultType="java.lang.Integer">
+        SELECT serviceProviderId
+        FROM cm_serviceteam_manager
+        where serviceProviderId = #{serviceProviderId}
+    </select>
+    <select id="findServiceIds" resultType="java.lang.Integer">
+        SELECT csg.serviceId
+        FROM cm_serviceteam_group csg
+                 LEFT JOIN cm_serviceteam_role csr ON csr.id = csg.teamId
+        WHERE csr.leaderId = #{serviceProviderId}
+          AND csg.serviceId != #{serviceProviderId}
+    </select>
+    <select id="findAllServiceIds" resultType="java.lang.Integer">
+        SELECT csg.serviceId
+        FROM cm_serviceteam_group csg
+        WHERE csg.serviceId != #{serviceProviderId}
+    </select>
+    <select id="findServices" resultType="com.caimei365.user.model.vo.ServiceProviderVo">
+        SELECT csg.serviceId as serviceProviderId,s.linkMan as name
+        FROM cm_serviceteam_group csg
+        LEFT JOIN cm_serviceteam_role csr ON csr.id=csg.teamId
+        left join serviceprovider s on csg.serviceId=s.serviceProviderID
+        WHERE csr.leaderId = #{spId}
+        <if test="status == 1">
+            AND csg.serviceId != #{spId}
+        </if>
+    </select>
+    <select id="findAllServices" resultType="com.caimei365.user.model.vo.ServiceProviderVo">
+        SELECT csg.serviceId AS serviceProviderId,s.linkMan AS NAME
+        FROM cm_serviceteam_group csg
+        LEFT JOIN serviceprovider s ON csg.serviceId=s.serviceProviderID
+        <if test="status == 1">
+            WHERE csg.serviceId != #{spId}
+        </if>
+    </select>
+
 </mapper>
 </mapper>

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

@@ -77,6 +77,15 @@
             <if test="logo != null and logo != ''">
             <if test="logo != null and logo != ''">
                 logo = #{logo},
                 logo = #{logo},
             </if>
             </if>
+            <if test="website != null and website != ''">
+                website = #{website},
+            </if>
+            <if test="wxApplets != null and wxApplets != ''">
+                wxApplets = #{wxApplets},
+            </if>
+            <if test="wxOfficialAccount != null and wxOfficialAccount != ''">
+                wxOfficialAccount = #{wxOfficialAccount},
+            </if>
             name = #{name}
             name = #{name}
         </set>
         </set>
         where shopID = #{shopId}
         where shopID = #{shopId}
@@ -157,10 +166,10 @@
             cpg.number as number,
             cpg.number as number,
             0 as price,
             0 as price,
             2 as productType,
             2 as productType,
-            p.price as originalPrice,
-            p.unit as unit,
+            (select price from cm_sku where productId=p.productId order by price asc limit 1)as originalPrice,
+            (select unit from cm_sku where productId=p.productId order by price asc limit 1)as unit,
             p.validFlag as validFlag,
             p.validFlag as validFlag,
-            p.stock as stock
+            (select stock from cm_sku where productId=p.productId order by price asc limit 1)as stock
         from product p
         from product p
         left join cm_promotions_gift cpg on cpg.productId = p.productID
         left join cm_promotions_gift cpg on cpg.productId = p.productID
         where cpg.promotionsId = #{promotionsId}
         where cpg.promotionsId = #{promotionsId}

+ 7 - 6
src/main/resources/mapper/SuperVipMapper.xml

@@ -140,9 +140,7 @@
         AND cc.status != 2
         AND cc.status != 2
         AND cs.delFlag = 0
         AND cs.delFlag = 0
         AND cmn.status != 2
         AND cmn.status != 2
-        <if test="useTime != null and useTime != ''">
-            AND cmn.useTime=#{useTime}
-        </if>
+        AND NOW() BETWEEN cc.startdate AND cc.enddate
         ORDER BY cc.startDate DESC
         ORDER BY cc.startDate DESC
     </select>
     </select>
 
 
@@ -151,18 +149,21 @@
         FROM cm_coupon_club a
         FROM cm_coupon_club a
         INNER JOIN cm_svip_coupon cs ON a.couponId = cs.couponId
         INNER JOIN cm_svip_coupon cs ON a.couponId = cs.couponId
         left join cm_svip_coupon_month cmn on cmn.id = cs.montId
         left join cm_svip_coupon_month cmn on cmn.id = cs.montId
+        LEFT JOIN cm_coupon cc ON cs.couponId = cc.id
         WHERE a.userId = #{userId}
         WHERE a.userId = #{userId}
-          AND cmn.useTime = #{useTime}
+          AND  NOW() BETWEEN cc.startDate AND cc.endDate
     </select>
     </select>
 
 
     <select id="findCouponUse" resultType="java.lang.Integer">
     <select id="findCouponUse" resultType="java.lang.Integer">
         select ccb.couponId from cm_coupon_club ccb
         select ccb.couponId from cm_coupon_club ccb
         inner join cm_svip_coupon cs ON cs.couponId = ccb.couponId
         inner join cm_svip_coupon cs ON cs.couponId = ccb.couponId
         left join cm_svip_coupon_month cmn on cmn.id=cs.montId
         left join cm_svip_coupon_month cmn on cmn.id=cs.montId
+        LEFT JOIN cm_coupon cc ON cs.couponId = cc.id
         where ccb.userId=#{userId} and ccb.status=2 AND ccb.delFlag=0
         where ccb.userId=#{userId} and ccb.status=2 AND ccb.delFlag=0
-        <if test="useTime != null and useTime !=''">
+        AND NOW() BETWEEN cc.startDate AND cc.endDate
+        <!--<if test="useTime != null and useTime !=''">
             and cmn.useTime=#{useTime}
             and cmn.useTime=#{useTime}
-        </if>
+        </if>-->
     </select>
     </select>
 
 
     <select id="findMobile" resultType="java.lang.String">
     <select id="findMobile" resultType="java.lang.String">