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

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

# Conflicts:
#	src/main/resources/mapper/RegisterMapper.xml
zhijiezhao 1 год назад
Родитель
Сommit
484d5d7662
65 измененных файлов с 4194 добавлено и 819 удалено
  1. 45 0
      src/main/java/com/caimei365/user/components/WeChatService.java
  2. 4 1
      src/main/java/com/caimei365/user/config/ApiConfig.java
  3. 20 1
      src/main/java/com/caimei365/user/controller/BaseApi.java
  4. 3 2
      src/main/java/com/caimei365/user/controller/ClubApi.java
  5. 19 3
      src/main/java/com/caimei365/user/controller/CmBehaviorRecordApi.java
  6. 82 29
      src/main/java/com/caimei365/user/controller/CmBrandLandingApi.java
  7. 153 0
      src/main/java/com/caimei365/user/controller/DistributionApi.java
  8. 67 2
      src/main/java/com/caimei365/user/controller/LoginApi.java
  9. 21 0
      src/main/java/com/caimei365/user/controller/RegisterApi.java
  10. 44 5
      src/main/java/com/caimei365/user/controller/SellerApi.java
  11. 9 0
      src/main/java/com/caimei365/user/controller/ShopApi.java
  12. 17 0
      src/main/java/com/caimei365/user/idempotent/IpSaveAspect.java
  13. 49 1
      src/main/java/com/caimei365/user/mapper/BaseMapper.java
  14. 1 1
      src/main/java/com/caimei365/user/mapper/ClubMapper.java
  15. 0 1
      src/main/java/com/caimei365/user/mapper/CmBrandLandingMapper.java
  16. 122 0
      src/main/java/com/caimei365/user/mapper/CmDistributionMapper.java
  17. 2 0
      src/main/java/com/caimei365/user/mapper/CmQuestionnaireMapper.java
  18. 22 0
      src/main/java/com/caimei365/user/mapper/LoginMapper.java
  19. 23 1
      src/main/java/com/caimei365/user/mapper/SellerMapper.java
  20. 7 0
      src/main/java/com/caimei365/user/mapper/ShopMapper.java
  21. 6 0
      src/main/java/com/caimei365/user/model/dto/ClubRegisterDto.java
  22. 4 0
      src/main/java/com/caimei365/user/model/dto/LoginCodeDto.java
  23. 4 0
      src/main/java/com/caimei365/user/model/dto/LoginPasswordDto.java
  24. 8 0
      src/main/java/com/caimei365/user/model/po/ClubRemarksPo.java
  25. 203 194
      src/main/java/com/caimei365/user/model/po/CmBrandLanding.java
  26. 227 0
      src/main/java/com/caimei365/user/model/po/CmDistribution.java
  27. 488 0
      src/main/java/com/caimei365/user/model/po/CmUser.java
  28. 4 0
      src/main/java/com/caimei365/user/model/vo/BehaviorRecodeVo.java
  29. 8 0
      src/main/java/com/caimei365/user/model/vo/ClubVo.java
  30. 1 1
      src/main/java/com/caimei365/user/model/vo/CmBehaviorRecordVo.java
  31. 34 14
      src/main/java/com/caimei365/user/model/vo/CmBrandLandingVO.java
  32. 87 0
      src/main/java/com/caimei365/user/model/vo/CmDistributionVO.java
  33. 23 0
      src/main/java/com/caimei365/user/model/vo/RetuenDataVo.java
  34. 5 0
      src/main/java/com/caimei365/user/model/vo/UserLoginVo.java
  35. 12 1
      src/main/java/com/caimei365/user/service/BaseService.java
  36. 0 39
      src/main/java/com/caimei365/user/service/CmBrandLandingService.java
  37. 70 0
      src/main/java/com/caimei365/user/service/CmDistributionService.java
  38. 0 15
      src/main/java/com/caimei365/user/service/CmQuestionnaireService.java
  39. 1 0
      src/main/java/com/caimei365/user/service/RegisterService.java
  40. 18 1
      src/main/java/com/caimei365/user/service/SellerService.java
  41. 7 0
      src/main/java/com/caimei365/user/service/ShopService.java
  42. 41 4
      src/main/java/com/caimei365/user/service/impl/BaseServiceImpl.java
  43. 13 3
      src/main/java/com/caimei365/user/service/impl/ClubServiceImpl.java
  44. 0 60
      src/main/java/com/caimei365/user/service/impl/CmBrandLandingServiceImpl.java
  45. 389 0
      src/main/java/com/caimei365/user/service/impl/CmDistributionServiceImpl.java
  46. 14 53
      src/main/java/com/caimei365/user/service/impl/CmQuestionnaireServiceImpl.java
  47. 45 4
      src/main/java/com/caimei365/user/service/impl/LoginServiceImpl.java
  48. 163 6
      src/main/java/com/caimei365/user/service/impl/RegisterServiceImpl.java
  49. 161 15
      src/main/java/com/caimei365/user/service/impl/SellerServiceImpl.java
  50. 60 4
      src/main/java/com/caimei365/user/service/impl/ShopServiceImpl.java
  51. 33 0
      src/main/java/com/caimei365/user/utils/BeanUtil.java
  52. 7 1
      src/main/java/com/caimei365/user/utils/DateUtil.java
  53. 1 1
      src/main/resources/bootstrap.yml
  54. 474 4
      src/main/resources/mapper/BaseMapper.xml
  55. 36 12
      src/main/resources/mapper/ClubMapper.xml
  56. 1 0
      src/main/resources/mapper/CmBrandBannerMapper.xml
  57. 5 1
      src/main/resources/mapper/CmBrandLandingMapper.xml
  58. 391 0
      src/main/resources/mapper/CmDistributionMapper.xml
  59. 2 0
      src/main/resources/mapper/CmQuestionnaireMapper.xml
  60. 20 0
      src/main/resources/mapper/LoginMapper.xml
  61. 1 1
      src/main/resources/mapper/MessageCenter.xml
  62. 194 227
      src/main/resources/mapper/RegisterMapper.xml
  63. 89 0
      src/main/resources/mapper/SellerMapper.xml
  64. 23 0
      src/main/resources/mapper/ShopMapper.xml
  65. 111 111
      src/test/java/com/caimei365/user/UserApplicationTests.java

+ 45 - 0
src/main/java/com/caimei365/user/components/WeChatService.java

@@ -648,4 +648,49 @@ public class WeChatService {
         return ResponseJson.success(result);
     }
 
+    /**
+     * 获取微信urlscheme 联合丽格
+     *
+     * @param path
+     * @param query
+     * @return
+     */
+    public ResponseJson getOpenLinkMcare(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", mcareAppId);
+            link = link.replace("APPSECRET", mcareAppSecret);
+            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);
+    }
+
 }

+ 4 - 1
src/main/java/com/caimei365/user/config/ApiConfig.java

@@ -22,9 +22,12 @@ public class ApiConfig implements WebMvcConfigurer {
         //addPathPatterns 用于添加拦截规则
         //excludePathPatterns 用于排除拦截
         registry.addInterceptor(apiInterceptor)
+                .addPathPatterns("/user/distribution/**")
                 .addPathPatterns("/user/club/info/update")
                 .addPathPatterns("/user/shop/info/update")
-                .addPathPatterns("/user/club/archive/deduction");
+                .addPathPatterns("/user/club/archive/deduction")
+                .excludePathPatterns("/user/distribution/setPassword")
+                .excludePathPatterns("/user/distribution/home");
 //                .excludePathPatterns("/order/detail");
     }
 }

+ 20 - 1
src/main/java/com/caimei365/user/controller/BaseApi.java

@@ -7,6 +7,7 @@ import com.caimei365.user.idempotent.IpSave;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.MobileDto;
 import com.caimei365.user.model.dto.PasswordDto;
+import com.caimei365.user.model.po.CmUser;
 import com.caimei365.user.model.po.SysDict;
 import com.caimei365.user.model.vo.SysDictVO;
 import com.caimei365.user.service.BaseService;
@@ -255,6 +256,12 @@ public class BaseApi {
         return weChatService.getOpenLink(path, query, env);
     }
 
+    @ApiOperation("获取微信跳转url  联合丽格")
+    @GetMapping("/wechat/link/mcare")
+    public ResponseJson getWechatLinkMcare(String path, String query, String env) {
+        return weChatService.getOpenLinkMcare(path, query, env);
+    }
+
     @ApiOperation("获取Dict")
     @GetMapping("/getDict")
     public ResponseJson getDict(String type) {
@@ -267,6 +274,18 @@ public class BaseApi {
     @ApiOperation("获取userId")
     @GetMapping("/getFindUserId")
     public ResponseJson getFindUserId(Integer userType, Integer id) {
-        return ResponseJson.success(baseService.getByUserId(userType, id));
+        return baseService.getByUserId(userType, id);
+    }
+
+    @ApiOperation("获取Mobile")
+    @GetMapping("/getByDistributionClubMobile")
+    public ResponseJson getByMobile(Integer userId) {
+        return ResponseJson.success(baseService.getByMobile(8, userId));
+    }
+
+    @ApiOperation("获取user数量")
+    @GetMapping("/getByUserCount")
+    public Integer getByUserCount(CmUser user) {
+        return baseService.getByUserCount(user);
     }
 }

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

@@ -611,15 +611,16 @@ public class ClubApi {
      * 机构访问记录详情
      * @param clubId
      * @param accessDate
+     * @param ip
      * @return
      */
     @GetMapping("/record/detail")
     public ResponseJson recordDetail(Integer clubId, String accessDate,String ip, Integer pageNum, Integer pageSize) {
         if (null == clubId) {
-            return ResponseJson.error("机构id不能为空",null);
+            return ResponseJson.error("机构id不能为空", null);
         }
         if (!StringUtils.isNotBlank(accessDate)) {
-            return ResponseJson.error("详情时间不能为空",null);
+            return ResponseJson.error("详情时间不能为空", null);
         }
         return clubService.recordDetail(clubId, accessDate, ip, pageNum, pageSize);
     }

+ 19 - 3
src/main/java/com/caimei365/user/controller/CmBehaviorRecordApi.java

@@ -6,6 +6,10 @@ import com.caimei365.user.model.dto.BehaviorRecordDto;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
 /**
  * Description
  *
@@ -19,6 +23,8 @@ public class CmBehaviorRecordApi {
 
     /**
      * 用户行为记录
+     *
+     * @param request
      * @param userId
      * @param pagePath
      * @param pageType
@@ -27,10 +33,20 @@ public class CmBehaviorRecordApi {
      * @param accessDuration
      * @return
      */
-    @IpSave(saveName="用户行为记录",saveParams = true)
+    @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,Integer shopId){
-        log.info("用户行为记录=======userId==》"+userId+"==pagePath=="+pagePath+"==pageType=="+pageType+"==pageLabel=="+pageLabel+"==behaviorType=="+behaviorType+"==productId=="+productId+"==accessDuration=="+accessDuration+"==accessClient=="+accessClient+"==shopId=="+shopId);
+    public ResponseJson<String> behaviorRecordApp(HttpServletRequest request, Integer userId, String pagePath, String pageType, String pageLabel, String behaviorType, Integer productId, String accessDuration, Integer accessClient, Integer shopId, String openId) {
+        HttpSession session = request.getSession();
+        Cookie[] cookies = request.getCookies();
+        if (null != cookies) {
+            for (Cookie cookie : cookies) {
+                if ("tid".equals(cookie.getName())) {
+                    log.info("tid------------>" + cookie.getValue());
+                }
+            }
+        }
+        String touristId = (String) session.getAttribute("touristId");
+        log.info("用户行为记录=======userId==》" + userId + "==pagePath==" + pagePath + "==pageType==" + pageType + "==pageLabel==" + pageLabel + "==behaviorType==" + behaviorType + "==productId==" + productId + "==accessDuration==" + accessDuration + "==accessClient==" + accessClient + "==shopId==" + shopId + "==openId=="+openId);
         return ResponseJson.success("用户行为记录完成");
     }
 

+ 82 - 29
src/main/java/com/caimei365/user/controller/CmBrandLandingApi.java

@@ -1,21 +1,23 @@
 package com.caimei365.user.controller;
 
-import com.caimei365.user.idempotent.IpSave;
-import com.caimei365.user.mapper.CmBrandBannerMapper;
+import com.caimei365.user.mapper.BaseMapper;
 import com.caimei365.user.model.ResponseJson;
-import com.caimei365.user.model.dto.BaikeProductDto;
-import com.caimei365.user.model.dto.ShopArticleDto;
-import com.caimei365.user.model.dto.ShopBannerDto;
-import com.caimei365.user.model.dto.ShopUpdateDto;
-import com.caimei365.user.model.po.*;
-import com.caimei365.user.model.vo.*;
+import com.caimei365.user.model.po.CmBrandBanner;
+import com.caimei365.user.model.po.CmBrandFiles;
+import com.caimei365.user.model.po.CmBrandLanding;
+import com.caimei365.user.model.po.CmQuestionnaire;
+import com.caimei365.user.model.vo.CmBrandLandingVO;
 import com.caimei365.user.service.*;
+import com.caimei365.user.utils.BeanUtil;
+import com.caimei365.user.utils.DateUtil;
+import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.web.bind.annotation.*;
 
@@ -42,6 +44,7 @@ public class CmBrandLandingApi {
     private final CmBrandFilesService cmBrandFilesService;
 
     private final CmQuestionnaireService cmQuestionnaireService;
+    private final BaseMapper baseMapper;
     @Resource
     private RemoteCallService remoteCallService;
 
@@ -60,30 +63,75 @@ public class CmBrandLandingApi {
             return ResponseJson.error("source异常!", null);
         }
         CmBrandBanner cmBrandBanner = new CmBrandBanner().setType("2");
-        CmBrandLanding landing = new CmBrandLanding().setType("1,2,3");
+        CmBrandLanding landing = new CmBrandLanding().type("1").num(0).size(5);
         if (source == 1) {
             cmBrandBanner.setPcStatus("1");
             landing.setPcStatus("1");
-        }
-        if (source == 2) {
+        } else  {
             cmBrandBanner.setAppStatus("1");
             landing.setAppStatus("1");
         }
         HashMap<String, Object> map = new HashMap(2);
         List<CmBrandBanner> cmBrandBanners = cmBrandBannerService.selectCmBrandBannerList(cmBrandBanner);
         List<CmBrandLanding> cmBrandLandings = cmBrandLandingService.selectCmBrandLandingList(landing);
-        cmBrandLandings.forEach(cmBrandLanding -> {
-            CmBrandFiles cmBrandFiles = new CmBrandFiles();
-            cmBrandFiles.setId(cmBrandLanding.getVideo());
-            cmBrandFiles.setType("1");
-            cmBrandLanding.setCmBrandFiles(cmBrandLanding.getVideo() == null ? null :
-                    cmBrandFilesService.selectCmBrandFilesList(cmBrandFiles));
-        });
+        landing.type("2");
+        cmBrandLandings.addAll(cmBrandLandingService.selectCmBrandLandingList(landing));
+        landing.type("3");
+        cmBrandLandings.addAll(cmBrandLandingService.selectCmBrandLandingList(landing));
+        if (CollectionUtils.isNotEmpty(cmBrandLandings)) {
+            cmBrandLandings.forEach(cmBrandLanding -> {
+                CmBrandFiles cmBrandFiles = new CmBrandFiles();
+                cmBrandFiles.setId(cmBrandLanding.getVideo());
+                cmBrandFiles.setType("1");
+                cmBrandLanding.setCmBrandFiles(cmBrandLanding.getVideo() == null ? null :
+                        cmBrandFilesService.selectCmBrandFilesList(cmBrandFiles));
+            });
+        }
         map.put("banner", cmBrandBanners);
         map.put("landing", cmBrandLandings);
         return ResponseJson.success(map);
     }
 
+    /**
+     * 查询供应商落地页资料
+     *
+     * @return source 1PC端,2小程序
+     * @return Map(userPo, clubPo)
+     * @return banner > banner管理
+     * @return landing.type 1成功案例,2视频列表,3文章列表
+     */
+    @ApiOperation("查询供应商落地页资料")
+    @GetMapping("/shopTypeInfo")
+    public ResponseJson shopTypeInfo(Integer source, CmBrandLanding landing,
+                                     @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                     @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
+        if (source == null) {
+            return ResponseJson.error("source异常!", null);
+        }
+        if (landing.type() == null || (!landing.type().equals("2") && !landing.type().equals("3"))) {
+            return ResponseJson.error("type异常!", null);
+        }
+        if (source == 1) {
+            landing.setPcStatus("1");
+        } else  {
+            landing.setAppStatus("1");
+        }
+        List<CmBrandLanding> cmBrandLandings = cmBrandLandingService.selectCmBrandLandingList(landing);
+        if (landing.type().equals("2") && CollectionUtils.isNotEmpty(cmBrandLandings)) {
+            cmBrandLandings.forEach(s -> {
+                CmBrandFiles cmBrandFiles = new CmBrandFiles();
+                cmBrandFiles.setId(s.getVideo());
+                cmBrandFiles.setType("1");
+                s.setCmBrandFiles(s.getVideo() == null ? null :
+                        cmBrandFilesService.selectCmBrandFilesList(cmBrandFiles));
+            });
+        }
+        PageHelper.startPage(pageNum, pageSize);
+        List<CmBrandLandingVO> cmBrandLandingVOS = BeanUtil.setValues(cmBrandLandings, CmBrandLandingVO.class);
+        PageInfo<CmBrandLandingVO> pageInfo = new PageInfo<>(cmBrandLandingVOS);
+        return ResponseJson.success(pageInfo);
+    }
+
     @ApiOperation("供应商落地页解决方案用户需求")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "userId", required = true, value = "userId"),
@@ -97,18 +145,23 @@ public class CmBrandLandingApi {
     public ResponseJson cmQuestionnaireSave(CmQuestionnaire cmQuestionnaire) {
         cmQuestionnaire.setType("1");
         if (StringUtils.isBlank(cmQuestionnaire.getId())) {
-            if (cmQuestionnaire.getType().equals("1")) {
-                //发短信
-                String message = "【采美365】尊敬的客户,已收到您的方案咨询信息,1-3个工作日内采美工作人员将通过此手机号15338851365联系您,期间请留意来电。";
-                if (StringUtils.isNotBlank(cmQuestionnaire.getMobile())) {
-                    CmQuestionnaire byCmQuestionnaire = cmQuestionnaireService.getByCmQuestionnaire(new CmQuestionnaire()
-                            .setLevel(cmQuestionnaire.getLevel())
-                            .setMobile(cmQuestionnaire.getMobile()));
-                    if (byCmQuestionnaire==null||byCmQuestionnaire.getCreateTime().getTime() < (new Date().getTime()-3600000)) {
-                        remoteCallService.remoteSendSms(24, 1, cmQuestionnaire.getMobile(), message);
-                    }
-                    cmQuestionnaireService.addCmQuestionnaire(cmQuestionnaire);
+            //发短信
+            String message = "【采美365】尊敬的客户,已收到您的方案咨询信息,1-3个工作日内采美工作人员将通过此手机号15338851365联系您,期间请留意来电。";
+            if (StringUtils.isNotBlank(cmQuestionnaire.getMobile())) {
+                CmQuestionnaire byCmQuestionnaire = cmQuestionnaireService.getByCmQuestionnaire(new CmQuestionnaire()
+                        .setLevel(cmQuestionnaire.getLevel())
+                        .setMobile(cmQuestionnaire.getMobile()));
+                //管理员手机号短信通知
+                List<String> adminMobileList = baseMapper.findAdminMobileList(1);
+                if (CollectionUtils.isNotEmpty(adminMobileList)) {
+                    adminMobileList.forEach(s -> {
+                        remoteCallService.remoteSendSms(0, 1, s, "【采美365】采美后台-供应商落地页-用户需求:" + DateUtil.formatDateTime(new Date(), "yyyy-MM-dd HH:mm") + "新增一条供应商需求,请及时查看。");
+                    });
+                }
+                if (byCmQuestionnaire == null || byCmQuestionnaire.getCreateTime().getTime() < (new Date().getTime() - 3600000)) {
+                    remoteCallService.remoteSendSms(24, 1, cmQuestionnaire.getMobile(), message);
                 }
+                cmQuestionnaireService.addCmQuestionnaire(cmQuestionnaire);
                 return ResponseJson.success("提交成功");
             }
         } else {

+ 153 - 0
src/main/java/com/caimei365/user/controller/DistributionApi.java

@@ -0,0 +1,153 @@
+package com.caimei365.user.controller;
+
+import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.model.dto.ClubTemporaryDto;
+import com.caimei365.user.model.dto.OnlineDto;
+import com.caimei365.user.model.po.CmDistribution;
+import com.caimei365.user.model.po.CmUser;
+import com.caimei365.user.model.po.ServiceProviderPo;
+import com.caimei365.user.model.vo.*;
+import com.caimei365.user.service.BaseService;
+import com.caimei365.user.service.CmDistributionService;
+import com.caimei365.user.service.SellerService;
+import com.caimei365.user.utils.BeanUtil;
+import com.caimei365.user.utils.RequestUtil;
+import com.caimei365.user.utils.ValidateUtil;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2021/3/24
+ */
+@Api(tags = "分销人员API")
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/user/distribution")
+public class DistributionApi {
+
+    private final CmDistributionService cmDistributionService;
+    private final BaseService baseService;
+
+
+    /**
+     * 团队成员列表
+     */
+    @GetMapping("/getDistributionList")
+    public ResponseJson<List<CmDistributionVO>> getDistributionList(CmDistribution cmDistribution) {
+        if (null == cmDistribution.parentId()) {
+            return ResponseJson.error("参数异常!", null);
+        }
+        List<CmDistribution> cmDistributionList = cmDistributionService.getCmDistributionList(new CmDistribution()
+                .parentId(cmDistribution.parentId())
+        );
+        return ResponseJson.success(BeanUtil.setValues(cmDistributionList,CmDistributionVO.class));
+    }
+
+
+    /**
+     * 协销个人中心
+     */
+    @GetMapping("/home")
+    public ResponseJson<CmDistributionVO> getHome(CmDistribution cmDistribution) {
+        if (null == cmDistribution.userId()&&null == cmDistribution.id()) {
+            return ResponseJson.error("参数异常:用户Id不能为空!", null);
+        }
+        CmDistributionVO cmDistributionVO = BeanUtil.setValue(cmDistributionService.getByCmDistribution(new CmDistribution()
+                .id(cmDistribution.id())
+                .userId(cmDistribution.userId())
+        ), CmDistributionVO.class);
+        return ResponseJson.success(cmDistributionVO);
+    }
+
+    /**
+     * 更新协销信息
+     */
+    @PostMapping("/setHome")
+    public ResponseJson setHome(CmDistribution cmDistribution) {
+        if (null == cmDistribution.userId()) {
+            return ResponseJson.error("参数异常:用户Id不能为空!", null);
+        }
+        cmDistributionService.updateCmDistribution(new CmDistribution()
+                .userId(cmDistribution.userId())
+                .image(cmDistribution.image())
+                .qrCode(cmDistribution.qrCode())
+        );
+        return ResponseJson.success();
+    }
+
+    /**
+     * 更新协销信息
+     */
+    @PostMapping("/setPassword")
+    public ResponseJson setPassword(CmDistribution cmDistribution, String oldPassword,  String code) {
+        if (!oldPassword.equals(cmDistribution.password())) {
+            return ResponseJson.error("两次输入的密码不一致!", null);
+        }
+        return cmDistributionService.setPassword(new CmDistribution()
+                        .userId(cmDistribution.userId())
+                        .mobile(cmDistribution.mobile())
+                        .password(cmDistribution.password())
+                , code);
+    }
+
+    /**
+     * 更新协销信息
+     */
+    @PostMapping("/updateStatus")
+    public ResponseJson updateStatus(CmDistribution cmDistribution) {
+        if (null == cmDistribution.userId()) {
+            return ResponseJson.error("参数异常:用户Id不能为空!!", null);
+        }
+        if (90 != cmDistribution.status()) {
+            cmDistribution.status(91);
+        }
+        cmDistributionService.updateCmDistribution(new CmDistribution()
+                .userId(cmDistribution.userId())
+                .status(cmDistribution.status())
+        );
+        return ResponseJson.success();
+    }
+
+    /**
+     * 新增协销信息
+     */
+    @PostMapping("/save")
+    public ResponseJson save(CmDistribution cmDistribution) {
+        if (null == cmDistribution.parentId() || cmDistribution.parentId() == 0) {
+            return ResponseJson.error("管理员ID不能为空!", null);
+        }
+        if (null == cmDistribution.name() || null == cmDistribution.mobile() || null == cmDistribution.status()) {
+            return ResponseJson.error("参数异常!", null);
+        }
+        // 验证手机号
+        String result = ValidateUtil.validateMobile(cmDistribution.mobile());
+        if (result != null) {
+            return ResponseJson.error(result);
+        }
+        if (90 != cmDistribution.status()) {
+            cmDistribution.status(91);
+        }
+        CmDistribution cmDistributionById = cmDistribution.id()==null?null:cmDistributionService.getCmDistributionById(cmDistribution.id());
+        CmUser cmUser = baseService.findUserByMobile(cmDistribution.mobile(),cmDistributionById==null?null:cmDistributionById.userId(),null);
+        if (cmUser!=null) {
+            return ResponseJson.error("手机号码已经被使用!", null);
+        }
+        cmDistributionService.addCmDistribution(cmDistribution);
+        return ResponseJson.success();
+    }
+
+}

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

@@ -5,6 +5,7 @@ import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.*;
 import com.caimei365.user.model.vo.MessageCenter;
 import com.caimei365.user.model.vo.UserLoginVo;
+import com.caimei365.user.service.CmDistributionService;
 import com.caimei365.user.service.LoginService;
 import com.caimei365.user.service.SellerService;
 import com.github.pagehelper.PageInfo;
@@ -13,6 +14,8 @@ import lombok.RequiredArgsConstructor;
 import org.springframework.http.HttpHeaders;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
 import java.text.ParseException;
 import java.util.Map;
 
@@ -30,6 +33,7 @@ public class LoginApi {
 
     private final LoginService loginService;
     private final SellerService sellerService;
+    private final CmDistributionService cmDistributionService;
 
     /**
      * 登录(用户名,密码)
@@ -46,7 +50,17 @@ public class LoginApi {
     @ApiOperation("登录(用户名,密码)")
     @IpSave(saveName = "用户登录", saveParams = true)
     @PostMapping("/password")
-    public ResponseJson<UserLoginVo> passwordLogin(LoginPasswordDto loginPasswordDto) throws ParseException {
+    public ResponseJson<UserLoginVo> passwordLogin(HttpServletRequest request, LoginPasswordDto loginPasswordDto) throws ParseException {
+        String touristId = "";
+        Cookie[] cookies = request.getCookies();
+        if (null != cookies) {
+            for (Cookie cookie : cookies) {
+                if ("tid".equals(cookie.getName())) {
+                    touristId = cookie.getValue();
+                }
+            }
+        }
+        loginPasswordDto.setTouristId(touristId);
         return loginService.passwordLogin(loginPasswordDto);
     }
 
@@ -81,7 +95,17 @@ public class LoginApi {
      */
     @ApiOperation("登录(手机号,验证码)")
     @PostMapping("/codeLogin")
-    public ResponseJson<UserLoginVo> codeLogin(LoginCodeDto loginCodeDto) throws ParseException {
+    public ResponseJson<UserLoginVo> codeLogin(HttpServletRequest request, LoginCodeDto loginCodeDto) throws ParseException {
+        String touristId = "";
+        Cookie[] cookies = request.getCookies();
+        if (null != cookies) {
+            for (Cookie cookie : cookies) {
+                if ("tid".equals(cookie.getName())) {
+                    touristId = cookie.getValue();
+                }
+            }
+        }
+        loginCodeDto.setTouristId(touristId);
         return loginService.codeLogin(loginCodeDto);
     }
     /**
@@ -119,6 +143,8 @@ public class LoginApi {
         String unionId = loginPasswordDto.getUnionId();
         return sellerService.passwordLogin(mobile, password, unionId);
     }
+
+
     /**
      * 采购员登录(手机号,验证码) --组织
      *
@@ -129,6 +155,45 @@ public class LoginApi {
     public ResponseJson<UserLoginVo> organizesellerLogin(LoginCodeDto loginCodeDto) {
         return sellerService.organizeCodeLogin(loginCodeDto);
     }
+
+    /**
+     * 分销人员登录(手机号,密码)
+     * @param loginPasswordDto {
+     *                         mobileOrEmail 手机号
+     *                         password 密码
+     *                         }
+     * @return UserLoginVo
+     */
+    @ApiOperation("分销人员登录(手机号,密码)")
+    @PostMapping("/distribution")
+    public ResponseJson<UserLoginVo> distributionLogin(LoginPasswordDto loginPasswordDto) {
+        String mobile = loginPasswordDto.getMobileOrEmail();
+        String password = loginPasswordDto.getPassword();
+        return cmDistributionService.passwordLogin(mobile, password);
+    }
+
+    /**
+     * 分销人员登录(手机号,验证码)
+     *
+     * @return UserLoginVo
+     */
+    @ApiOperation("分销人员登录(手机号,验证码)")
+    @PostMapping("/organizeDistribution")
+    public ResponseJson<UserLoginVo> organizeDistributionLogin(LoginCodeDto loginCodeDto) {
+        return cmDistributionService.organizeCodeLogin(loginCodeDto);
+    }
+
+    /**
+     * 分销机构获取验证码(手机号,验证码)
+     *
+     * @return UserLoginVo
+     */
+    @ApiOperation("分销机构获取验证码(手机号,验证码)")
+    @PostMapping("/organizeDistributionClub")
+    public ResponseJson organizeClubCodeLogin(LoginCodeDto loginCodeDto,String userId) {
+        return cmDistributionService.organizeClubCodeLogin(loginCodeDto,userId);
+    }
+
     /**
      * 微信授权登录(小程序),用户数据存入Redis,key前缀:wxInfo:applets:
      * <p>

+ 21 - 0
src/main/java/com/caimei365/user/controller/RegisterApi.java

@@ -87,6 +87,27 @@ public class RegisterApi {
         return registerService.clubRegister(clubRegisterDto, headers);
     }
 
+    /**
+     * 分销人员生成特殊机构(注册)
+     * <p>
+     * spi旧接口:/club/common
+     *
+     * @param clubRegisterDto ClubRegisterDto{
+     *                        name          机构名称
+     *                        userName          联系人
+     *                        bindMobile        企业绑定手机号
+     *                        }
+     * @param headers         HttpHeaders
+     */
+    @ApiOperation("分销人员生成特殊机构")
+    @Idempotent(prefix = "idempotent_distributionClub", keys = {"#distributionClubRegisterDto"}, expire = 5)
+//    @IpSave(saveName = "分销人员生成特殊机构",saveParams = true)
+    @PostMapping("/distributionClub")
+    public ResponseJson distributionClubRegister(ClubRegisterDto clubRegisterDto, @RequestHeader HttpHeaders headers) {
+
+        return registerService.distributionClubRegister(clubRegisterDto, headers);
+    }
+
     /**
      * 组织普通机构 注册校验
      * @param bindMobile

+ 44 - 5
src/main/java/com/caimei365/user/controller/SellerApi.java

@@ -4,10 +4,7 @@ import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.ClubTemporaryDto;
 import com.caimei365.user.model.dto.OnlineDto;
 import com.caimei365.user.model.po.ServiceProviderPo;
-import com.caimei365.user.model.vo.ClubTemporaryVo;
-import com.caimei365.user.model.vo.ClubVo;
-import com.caimei365.user.model.vo.CmBehaviorRecordVo;
-import com.caimei365.user.model.vo.ServiceProviderVo;
+import com.caimei365.user.model.vo.*;
 import com.caimei365.user.service.SellerService;
 import com.caimei365.user.utils.MathUtil;
 import com.github.pagehelper.PageInfo;
@@ -103,12 +100,14 @@ public class SellerApi {
                                                       String name,
                                                       Integer userIdentity,
                                                       Integer groupServiceId,
+                                                      String startTime,
+                                                      String endTime,
                                                       @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, type, name, userIdentity, groupServiceId, pageNum, pageSize);
+        return sellerService.getClubList(spId, status, type, name, userIdentity, groupServiceId, startTime, endTime, pageNum, pageSize);
     }
 
     /**
@@ -192,6 +191,9 @@ public class SellerApi {
      */
     @GetMapping("/setHome")
     public ResponseJson<ServiceProviderPo> setSellerHome(ServiceProviderPo serviceProviderPo) {
+        if (null == serviceProviderPo.getUserId()) {
+            return ResponseJson.error("参数异常:用户Id不能为空!", null);
+        }
         return sellerService.setSellerHome(new ServiceProviderPo()
                 .setUserId(serviceProviderPo.getUserId())
                 .setImage(serviceProviderPo.getImage())
@@ -214,4 +216,41 @@ public class SellerApi {
         return sellerService.getBehaviorRecordClubFrom(spId,clubId, accessTime);
     }
 
+    /**
+     * 机构重点访问页面
+     * @param clubId
+     * @return
+     */
+    @ApiOperation("机构重点访问页面")
+    @ApiImplicitParam(required = true, name = "clubId", value = "机构Id")
+    @GetMapping("/getClubKeynoteRecord")
+    public ResponseJson<PageInfo<RetuenDataVo>> getClubKeynoteRecord(Integer clubId,
+                                                              @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                              @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+
+        if (null == clubId) {
+            return ResponseJson.error(-1, "机构id不能为空", null);
+        }
+        return sellerService.getClubRecord(clubId, pageNum, pageSize);
+    }
+
+    /**
+     * 协销不活跃机构
+     * @param serviceProviderId
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @ApiOperation("协销不活跃机构")
+    @ApiImplicitParam(required = true, name = "serviceProviderId", value = "协销Id")
+    @GetMapping("/getUnActiveClubList")
+    public ResponseJson<PageInfo<ClubVo>> getUnActiveClubList(Integer serviceProviderId,
+                                                              @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                              @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+        if (null == serviceProviderId) {
+            return ResponseJson.error(-1, "协销Id不能为空", null);
+        }
+        return sellerService.getUnActiveClubList(serviceProviderId, pageNum, pageSize);
+    }
+
 }

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

@@ -34,6 +34,15 @@ public class ShopApi {
 
     private final ShopService shopService;
 
+    @ApiOperation("供应商快捷登录")
+    @ApiImplicitParam(required = true, name = "userId", value = "用户Id")
+    @GetMapping("/shortcutLogin")
+    public ResponseJson<UserLoginVo> shortcutLogin(Integer userId) {
+        if (null == userId) {
+            return ResponseJson.error(-1, "用户Id不能为空", null);
+        }
+        return shopService.shortcutLogin(userId);
+    }
     /**
      * 根据用户Id查询供应商资料
      * <p>

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

@@ -18,9 +18,12 @@ import org.springframework.web.context.request.ServletRequestAttributes;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
+import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
 import java.lang.reflect.Method;
+import java.util.Enumeration;
 
 
 /**
@@ -68,6 +71,17 @@ public class IpSaveAspect {
         if (ip == null || ip.length() == 0 || unknown.equalsIgnoreCase(ip)) {
             ip = request.getRemoteAddr();
         }
+        // 获取cookie缓存
+        String touristId = "";
+        Cookie[] cookies = request.getCookies();
+        if (null != cookies) {
+            for (Cookie cookie : cookies) {
+                if ("tid".equals(cookie.getName())) {
+                    touristId = cookie.getValue();
+                }
+            }
+        }
+        log.info("touristId====cookie:=="+touristId);
         // 接口路径
         String requestURI = request.getRequestURI();
         //获取自定义注解
@@ -115,10 +129,13 @@ public class IpSaveAspect {
         } else {
             mes += "¥";
         }
+
         // 访问接口类型为post时接口参数调整
         if ("POST".equals(request.getMethod())){
             queryString = params;
         }
+        // 拼接参数
+        queryString += "&touristId=" + touristId;
         if (StringUtils.isNotBlank(queryString)) {
             queryString += "&referer=" + referer + "&userAgent=" + userAgent;
             mes += queryString + "¥";

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

@@ -1,5 +1,6 @@
 package com.caimei365.user.mapper;
 
+import com.caimei365.user.model.po.CmUser;
 import com.caimei365.user.model.vo.*;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -154,6 +155,12 @@ public interface BaseMapper {
      * @param userId   用户Id
      */
     void updateMobileByUserId(String mobile, Integer userId);
+    /**
+     * 根据用户Id修改头像
+     * @param image   头像
+     * @param userId   用户Id
+     */
+    void updateImageByUserId(String image, Integer userId);
     /**
      * 根据供应商Id修改手机号
      * @param mobile   手机号
@@ -175,5 +182,46 @@ public interface BaseMapper {
     List<String> findLabelsByLableIds(String labelIds);
 
     Integer findBankByUserId(Integer userId);
-    Integer getByUserId(@Param("userType")Integer userType,@Param("id")Integer id);
+
+    Integer getByUserId(@Param("userType") Integer userType, @Param("id") Integer id);
+
+    String getByMobile(@Param("userIdentity") Integer userIdentity, @Param("userId") Integer userId);
+
+    Integer getByUserCount(CmUser user);
+
+    /**
+     * 新增用户信息
+     *
+     * @param user 用户信息
+     * @return 结果
+     */
+    public int addUser(CmUser user);
+
+    /**
+     * 修改用户信息
+     *
+     * @param user 用户信息
+     * @return 结果
+     */
+    public int updateUser(CmUser user);
+
+
+    /**
+     * 修改机构状态信息
+     *
+     */
+    public int updateClubStatus(Integer userId,Integer status);
+
+    /**
+     * 用户信息
+     *
+     * @param user 用户信息
+     * @return 结果
+     */
+    public CmUser getByUser(CmUser user);
+
+    public List<String> findAdminMobileList(Integer type);
+
+    CmUser findUserByMobile(@Param("mobile") String mobile, @Param("oldUserId") Integer oldUserId, @Param("userIdentity") Integer userIdentity);
+
 }

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

@@ -394,7 +394,7 @@ public interface ClubMapper {
 
     List<BehaviorRecodeVo> selBehaviorList(CmPortraitDto cmPortrait);
 
-    List<BehaviorRecodeVo> selRegion(@Param("ip") String ip, @Param("accessDate") String accessDate);
+    List<BehaviorRecodeVo> selRegion(@Param("ip") String ip, @Param("accessDate") String accessDate, @Param("type") Integer type, @Param("accessDateList") List<String> accessDateList);
 
     List<CmClubRemarksVo> selRemarksList(CmPortraitDto cmPortrait);
 

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

@@ -2,7 +2,6 @@ package com.caimei365.user.mapper;
 
 import java.util.List;
 import com.caimei365.user.model.po.CmBrandLanding;
-import com.caimei365.user.model.vo.CmBrandLandingVO;
 import org.apache.ibatis.annotations.Mapper;
 
 /**

+ 122 - 0
src/main/java/com/caimei365/user/mapper/CmDistributionMapper.java

@@ -0,0 +1,122 @@
+package com.caimei365.user.mapper;
+
+import java.util.List;
+
+import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.model.po.CmDistribution;
+import com.caimei365.user.model.vo.UserLoginVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * distributionMapper接口
+ *
+ * @author Kaick
+ * @date 2023-09-25
+ */
+@Mapper
+public interface CmDistributionMapper
+{
+    /**
+     * 通过对象查询distribution列表
+     *
+     * @param cmDistribution distribution
+     * @return distribution集合
+     */
+    public List<CmDistribution> getCmDistributionList(CmDistribution cmDistribution);
+
+    /**
+     * 通过Id查询distribution对象
+     *
+     * @param id distribution主键
+     * @return distribution
+     */
+    public CmDistribution getCmDistributionById(String id);
+
+    /**
+     * 通过对象查询distribution对象
+     *
+     * @param cmDistribution distribution
+     * @return distribution
+     */
+    public CmDistribution getByCmDistribution(CmDistribution cmDistribution);
+
+    /**
+     * 通过对象查询distributionId
+     *
+     * @param cmDistribution distribution
+     * @return String
+     */
+    public String getById(CmDistribution cmDistribution);
+
+    /**
+     * 通过对象查询distributionIds
+     *
+     * @param cmDistribution distribution
+     * @return List<String>
+     */
+    public List<String> getByIds(CmDistribution cmDistribution);
+
+    /**
+     * 通过对象查询distribution记录总数
+     *
+     * @param cmDistribution distribution
+     * @return distributionInteger
+     */
+    public int getCmDistributionCount(CmDistribution cmDistribution);
+
+    /**
+     * 根据手机号获取协销
+     *
+     * @param mobile 手机号
+     * @return UserLoginVo
+     */
+    UserLoginVo getLoginDistributionByMobile(String mobile);
+    /**
+     * 新增distribution
+     *
+     * @param cmDistribution distribution
+     * @return 结果
+     */
+    public int addCmDistribution(CmDistribution cmDistribution);
+
+    /**
+     * 修改distribution
+     *
+     * @param cmDistribution distribution
+     * @return 结果
+     */
+    public int updateCmDistribution(CmDistribution cmDistribution);
+
+    /**
+     * 删除distribution
+     *
+     * @param id distribution主键
+     * @return 结果
+     */
+    public int delCmDistributionById(String id);
+
+    /**
+     * 批量删除distribution
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int delCmDistribution(CmDistribution cmDistribution);
+
+    /**
+     * 批量删除distribution
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int delCmDistributionByIds(@Param("ids") String[] ids);
+
+    /**
+     * 修改批量删除distribution
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int updateDelCmDistributionByIds(@Param("ids") String[] ids,@Param("delFlag") Integer delFlag);
+}

+ 2 - 0
src/main/java/com/caimei365/user/mapper/CmQuestionnaireMapper.java

@@ -39,6 +39,8 @@ public interface CmQuestionnaireMapper
      */
     public List<String> getByIds(CmQuestionnaire cmQuestionnaire);
 
+
+
     /**
      * 查询用户需求调查
      *

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

@@ -74,6 +74,20 @@ public interface LoginMapper {
      */
     void updateServiceProviderUnionId(@Param("userId") Integer userId, @Param("unionId") String unionId);
 
+    /**
+     * 供应商商品上架平台属性
+     * @param shopId
+     * @return
+     */
+    List<String> getShopProductGroudMall(@Param("shopId") Integer shopId);
+
+    /**
+     * 修改用户微信授权信息
+     * @param openId
+     * @param unionId
+     * @param userId
+     */
+    void updateUserInfo(@Param("openId") String openId, @Param("unionId") String unionId, @Param("userId") Integer userId);
     /**
      * 根据userId获取协销
      * @param userId
@@ -171,6 +185,7 @@ public interface LoginMapper {
      */
     void updateLogin(Integer userId);
 
+
     /**
      * 会员机构类型:1医美,2生
      */
@@ -181,4 +196,11 @@ public interface LoginMapper {
      */
     Integer getClubSpUserId(Integer clubId);
 
+    /**
+     * 关联用户和游客
+     * @param userId
+     * @param touristId
+     */
+    void updateTourist(@Param("userId") Integer userId,@Param("touristId") String touristId);
+
 }

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

@@ -66,7 +66,7 @@ public interface SellerMapper {
      */
     void deleteTemporaryClub(Integer id);
 
-    List<ClubVo> findClubs(@Param("serviceProviderId") Integer serviceProviderId, @Param("status") Integer status, @Param("name") String name, @Param("userIdentity") Integer userIdentity, @Param("type") Integer type, @Param("serviceIds") List<Integer> serviceIds);
+    List<ClubVo> findClubs(@Param("serviceProviderId") Integer serviceProviderId, @Param("status") Integer status, @Param("name") String name, @Param("userIdentity") Integer userIdentity, @Param("type") Integer type, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("serviceIds") List<Integer> serviceIds);
 
     /***
      * 功能描述: 机构活跃分析用户登录数量
@@ -112,4 +112,26 @@ public interface SellerMapper {
     List<CmBehaviorRecordVo> getBehaviorRecordYesterdayClubFrom(@Param("spId") Integer spId, @Param("clubId") Integer clubId, @Param("accessTime")String accessTime);
 
     List<CmBehaviorRecordVo> getBehaviorRecordYesterdayClub(@Param("spId") Integer spId,@Param("accessTime")String accessTime);
+
+    /**
+     * 获取机构有访问记录的日期
+     * @param clubId
+     * @return
+     */
+    List<RetuenDataVo> getClubAccessDate(@Param("clubId") Integer clubId);
+
+    /**
+     * 访问详情
+     * @param clubId
+     * @param accessDateList
+     * @return
+     */
+    List<BehaviorRecodeVo> getClubKeynoteRecord(@Param("clubId") Integer clubId, @Param("accessDateList") List<String> accessDateList);
+    /**
+     * 协销不活跃机构列表
+     * @param serviceProviderId
+     * @return
+     */
+    List<ClubVo> getUnActiveClub(@Param("serviceProviderId") Integer serviceProviderId);
+
 }

+ 7 - 0
src/main/java/com/caimei365/user/mapper/ShopMapper.java

@@ -20,6 +20,13 @@ import java.util.Map;
  */
 @Mapper
 public interface ShopMapper {
+
+    /**
+     * 供应商快捷登录
+     * @param userId
+     * @return
+     */
+    UserLoginVo getShopByUserId(Integer userId);
     /**
      * 根据Id查询供应商
      * @param shopId    供应商Id

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

@@ -31,6 +31,12 @@ public class ClubRegisterDto implements Serializable {
      */
     @ApiModelProperty("用户名")
     private String userName;
+
+    /**
+     * 名称
+     */
+    @ApiModelProperty("名称")
+    private String name;
     /**
      * 企业绑定手机号
      */

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

@@ -48,4 +48,8 @@ public class LoginCodeDto implements Serializable {
      */
     @ApiModelProperty("验证类型")
     private String codeType;
+    /**
+     * 游客id
+     */
+    private String touristId;
 }

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

@@ -35,4 +35,8 @@ public class LoginPasswordDto implements Serializable {
      */
     @ApiModelProperty("微信unionId")
     private String unionId;
+    /**
+     * 游客id
+     */
+    private String touristId;
 }

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

@@ -103,4 +103,12 @@ public class ClubRemarksPo implements Serializable {
      * 静态标签
      */
     private String stateKeyword;
+    /**
+     * 首次访问时间
+     */
+    private String firstTime;
+    /**
+     * 最近访问时间
+     */
+    private String recentlyTime;
 }

+ 203 - 194
src/main/java/com/caimei365/user/model/po/CmBrandLanding.java

@@ -19,7 +19,7 @@ import java.util.List;
  * @author Kaick
  * @date 2023-05-31
  */
-@Accessors(chain  = true )
+@Accessors(fluent   = true )
 @Data
 @Alias("CmBrandLanding")
 public class CmBrandLanding
@@ -53,6 +53,9 @@ public class CmBrandLanding
     /** picture跳转链接 */
     private String jumpLink;
 
+    /** picture跳转链接 */
+    private String jumpAppLink;
+
     /** 标题
  */
     private String title;
@@ -76,7 +79,14 @@ public class CmBrandLanding
     /** 删除状态 0正常,1删除 */
     private String delFlag;
 
-
+    /** 归属者Id(type字段表Id) */
+    private String authorId;
+    /** 子级分类: (type=4){1 大图,2小图}(已弃用),(type=5){1 大图,2小图,2小图}  */
+    private String levelType;
+    /** 分页参数 */
+    private Integer num;
+    /**  分页参数 */
+    private Integer size;
     /** 修改时间 */
     @JsonFormat(pattern = "yyyy-MM-dd")
     private Date updateTime;
@@ -86,196 +96,195 @@ public class CmBrandLanding
     /** 文件资料 */
     private List<CmBrandFilesVO> cmBrandFiles;
 
-//    public List<CmBrandFiles> getCmBrandFiles() {
-//        return cmBrandFiles;
-//    }
-//
-//    public void setCmBrandFiles(List<CmBrandFiles> cmBrandFiles) {
-//        this.cmBrandFiles = cmBrandFiles;
-//    }
-//
-//    public void setId(String id)
-//    {
-//        this.id = id;
-//    }
-//
-//    public String getId()
-//    {
-//        return id;
-//    }
-//    public void setAuthUserId(String authUserId)
-//    {
-//        this.authUserId = authUserId;
-//    }
-//
-//    public String getAuthUserId()
-//    {
-//        return authUserId;
-//    }
-//    public void setType(String type)
-//    {
-//        this.type = type;
-//    }
-//
-//    public String getType()
-//    {
-//        return type;
-//    }
-//    public void setHeadPcBanner(String headPcBanner)
-//    {
-//        this.headPcBanner = headPcBanner;
-//    }
-//
-//    public String getHeadPcBanner()
-//    {
-//        return headPcBanner;
-//    }
-//    public void setHeadAppBanner(String headAppBanner)
-//    {
-//        this.headAppBanner = headAppBanner;
-//    }
-//
-//    public String getHeadAppBanner()
-//    {
-//        return headAppBanner;
-//    }
-//    public void setJumpStatus(String jumpStatus)
-//    {
-//        this.jumpStatus = jumpStatus;
-//    }
-//
-//    public String getJumpStatus()
-//    {
-//        return jumpStatus;
-//    }
-//    public void setJumpPcPicture(String jumpPcPicture)
-//    {
-//        this.jumpPcPicture = jumpPcPicture;
-//    }
-//
-//    public String getJumpPcPicture()
-//    {
-//        return jumpPcPicture;
-//    }
-//    public void setJumpAppPicture(String jumpAppPicture)
-//    {
-//        this.jumpAppPicture = jumpAppPicture;
-//    }
-//
-//    public String getJumpAppPicture()
-//    {
-//        return jumpAppPicture;
-//    }
-//    public void setJumpLink(String jumpLink)
-//    {
-//        this.jumpLink = jumpLink;
-//    }
-//
-//    public String getJumpLink()
-//    {
-//        return jumpLink;
-//    }
-//    public void setTitle(String title)
-//    {
-//        this.title = title;
-//    }
-//
-//    public String getTitle()
-//    {
-//        return title;
-//    }
-//    public void setContent(String content)
-//    {
-//        this.content = content;
-//    }
-//
-//    public String getContent()
-//    {
-//        return content;
-//    }
-//    public void setVideo(String video)
-//    {
-//        this.video = video;
-//    }
-//
-//    public String getVideo()
-//    {
-//        return video;
-//    }
-//    public void setSort(String sort)
-//    {
-//        this.sort = sort;
-//    }
-//
-//    public String getSort()
-//    {
-//        return sort;
-//    }
-//    public void setPcStatus(String pcStatus)
-//    {
-//        this.pcStatus = pcStatus;
-//    }
-//
-//    public String getPcStatus()
-//    {
-//        return pcStatus;
-//    }
-//    public void setAppStatus(String appStatus)
-//    {
-//        this.appStatus = appStatus;
-//    }
-//
-//    public String getAppStatus()
-//    {
-//        return appStatus;
-//    }
-//    public void setDelFlag(String delFlag)
-//    {
-//        this.delFlag = delFlag;
-//    }
-//
-//    public String getDelFlag()
-//    {
-//        return delFlag;
-//    }
-//    public void setAddTime(Date addTime)
-//    {
-//        this.addTime = addTime;
-//    }
-//
-//    public Date getAddTime()
-//    {
-//        return addTime;
-//    }
-//    public Date getUpdateTime() {
-//        return updateTime;
-//    }
-//
-//    public void setUpdateTime(Date updateTime) {
-//        this.updateTime = updateTime;
-//    }
-//
-//    @Override
-//    public String toString() {
-//        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-//            .append("id", getId())
-//            .append("authUserId", getAuthUserId())
-//            .append("type", getType())
-//            .append("headPcBanner", getHeadPcBanner())
-//            .append("headAppBanner", getHeadAppBanner())
-//            .append("jumpStatus", getJumpStatus())
-//            .append("jumpPcPicture", getJumpPcPicture())
-//            .append("jumpAppPicture", getJumpAppPicture())
-//            .append("jumpLink", getJumpLink())
-//            .append("title", getTitle())
-//            .append("content", getContent())
-//            .append("video", getVideo())
-//            .append("sort", getSort())
-//            .append("pcStatus", getPcStatus())
-//            .append("appStatus", getAppStatus())
-//            .append("delFlag", getDelFlag())
-//            .append("updateTime", getUpdateTime())
-//            .append("addTime", getAddTime())
-//            .toString();
-//    }
+    public Integer getNum() {
+        return num;
+    }
+
+    public void setNum(Integer num) {
+        this.num = num;
+    }
+
+    public Integer getSize() {
+        return size;
+    }
+
+    public void setSize(Integer size) {
+        this.size = size;
+    }
+
+    public String getAuthorId() {
+        return authorId;
+    }
+
+    public void setAuthorId(String authorId) {
+        this.authorId = authorId;
+    }
+
+    public String getLevelType() {
+        return levelType;
+    }
+
+    public void setLevelType(String levelType) {
+        this.levelType = levelType;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getAuthUserId() {
+        return authUserId;
+    }
+
+    public void setAuthUserId(String authUserId) {
+        this.authUserId = authUserId;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getHeadPcBanner() {
+        return headPcBanner;
+    }
+
+    public void setHeadPcBanner(String headPcBanner) {
+        this.headPcBanner = headPcBanner;
+    }
+
+    public String getHeadAppBanner() {
+        return headAppBanner;
+    }
+
+    public void setHeadAppBanner(String headAppBanner) {
+        this.headAppBanner = headAppBanner;
+    }
+
+    public String getJumpStatus() {
+        return jumpStatus;
+    }
+
+    public void setJumpStatus(String jumpStatus) {
+        this.jumpStatus = jumpStatus;
+    }
+
+    public String getJumpPcPicture() {
+        return jumpPcPicture;
+    }
+
+    public void setJumpPcPicture(String jumpPcPicture) {
+        this.jumpPcPicture = jumpPcPicture;
+    }
+
+    public String getJumpAppPicture() {
+        return jumpAppPicture;
+    }
+
+    public void setJumpAppPicture(String jumpAppPicture) {
+        this.jumpAppPicture = jumpAppPicture;
+    }
+
+    public String getJumpLink() {
+        return jumpLink;
+    }
+
+    public void setJumpLink(String jumpLink) {
+        this.jumpLink = jumpLink;
+    }
+
+    public String getJumpAppLink() {
+        return jumpAppLink;
+    }
+
+    public void setJumpAppLink(String jumpAppLink) {
+        this.jumpAppLink = jumpAppLink;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getVideo() {
+        return video;
+    }
+
+    public void setVideo(String video) {
+        this.video = video;
+    }
+
+    public String getSort() {
+        return sort;
+    }
+
+    public void setSort(String sort) {
+        this.sort = sort;
+    }
+
+    public String getPcStatus() {
+        return pcStatus;
+    }
+
+    public void setPcStatus(String pcStatus) {
+        this.pcStatus = pcStatus;
+    }
+
+    public String getAppStatus() {
+        return appStatus;
+    }
+
+    public void setAppStatus(String appStatus) {
+        this.appStatus = appStatus;
+    }
+
+    public String getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(String delFlag) {
+        this.delFlag = delFlag;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Date getAddTime() {
+        return addTime;
+    }
+
+    public void setAddTime(Date addTime) {
+        this.addTime = addTime;
+    }
+
+    public List<CmBrandFilesVO> getCmBrandFiles() {
+        return cmBrandFiles;
+    }
+
+    public void setCmBrandFiles(List<CmBrandFilesVO> cmBrandFiles) {
+        this.cmBrandFiles = cmBrandFiles;
+    }
 }

+ 227 - 0
src/main/java/com/caimei365/user/model/po/CmDistribution.java

@@ -0,0 +1,227 @@
+package com.caimei365.user.model.po;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.util.Date;
+
+/**
+ * distribution对象 cm_distribution
+ *
+ * @author Kaick
+ * @date 2023-09-25
+ */
+@Accessors(fluent  = true )
+@Data
+@Alias("CmDistribution")
+public class CmDistribution implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private String id;
+
+    /** 用户id */
+    private Integer userId;
+
+    /** 名称 */
+    private String name;
+
+    /** 联系人 */
+    private String linkMan;
+
+    /** 手机号 */
+    private String mobile;
+
+    /** 密码 */
+    private String password;
+
+    /** 公司名称 */
+    private String corporateName;
+
+    /** 分账号 */
+    private String splitCode;
+
+    /** 所属银行 */
+    private String bankName;
+
+    /** 银行卡号 */
+    private String bankAccount;
+
+    /** 状态:90上线,91下线 */
+    private Integer status;
+
+    /** 分销二维码 */
+    private String qrCode;
+
+    /** 头像 */
+    private String image;
+
+    /** 父级团队Id:0表示团队 */
+    private Integer parentId;
+
+    /** 父级团队Id集合 */
+    private String parentIds;
+
+    /** 修改时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    /** 添加时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date addTime;
+
+    /** 删除状态 0正常,其他删除 */
+    private Integer delFlag;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getLinkMan() {
+        return linkMan;
+    }
+
+    public void setLinkMan(String linkMan) {
+        this.linkMan = linkMan;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getCorporateName() {
+        return corporateName;
+    }
+
+    public void setCorporateName(String corporateName) {
+        this.corporateName = corporateName;
+    }
+
+    public String getSplitCode() {
+        return splitCode;
+    }
+
+    public void setSplitCode(String splitCode) {
+        this.splitCode = splitCode;
+    }
+
+    public String getBankName() {
+        return bankName;
+    }
+
+    public void setBankName(String bankName) {
+        this.bankName = bankName;
+    }
+
+    public String getBankAccount() {
+        return bankAccount;
+    }
+
+    public void setBankAccount(String bankAccount) {
+        this.bankAccount = bankAccount;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getQrCode() {
+        return qrCode;
+    }
+
+    public void setQrCode(String qrCode) {
+        this.qrCode = qrCode;
+    }
+
+    public String getImage() {
+        return image;
+    }
+
+    public void setImage(String image) {
+        this.image = image;
+    }
+
+    public Integer getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Integer parentId) {
+        this.parentId = parentId;
+    }
+
+    public String getParentIds() {
+        return parentIds;
+    }
+
+    public void setParentIds(String parentIds) {
+        this.parentIds = parentIds;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public Date getAddTime() {
+        return addTime;
+    }
+
+    public void setAddTime(Date addTime) {
+        this.addTime = addTime;
+    }
+
+    public Integer getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(Integer delFlag) {
+        this.delFlag = delFlag;
+    }
+}
+

+ 488 - 0
src/main/java/com/caimei365/user/model/po/CmUser.java

@@ -0,0 +1,488 @@
+package com.caimei365.user.model.po;
+
+import java.math.BigDecimal;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.util.Date;
+
+/**
+ * 用户信息对象 user
+ *
+ * @author Kaick
+ * @date 2023-09-25
+ */
+@Accessors(fluent  = true )
+@Data
+@Alias("CmUser")
+public class CmUser implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private String userID;
+
+    /** 采美组织默认为0,具体对应cm_mall_organize表ID */
+    private String userOrganizeID;
+
+    /** 企业账号名【供应商,目前只存数据不能用于登录】 */
+    private String account;
+
+    /** 个人手机号码(协销) */
+    private String mobile;
+
+    /** 企业绑定手机号(机构,供应商) */
+    private String bindMobile;
+
+    /** 用户权限 0游客 1 普通用户 2 会员机构 3 供应商 4 协销 5 普通机构 6 呵呵商城用户【V6.2.0版本后0和1不存在】 */
+    private Integer userPermission;
+
+    /** 用户身份 0、个人 1、协销 2、会员机构 3、供应商 4.普通机构 6、呵呵商城用户【V6.2.0版本后0不存在】 */
+    private String userIdentity;
+
+    /** 邮箱 */
+    private String email;
+
+    /** 用户名(机构联系人,供应商简称) */
+    private String userName;
+
+    /** 真实姓名(供应商的联系人,机构不使用) */
+    private String realName;
+
+    /** 注册来源: 0网站 1小程序 */
+    private String source;
+
+    /** 头像 */
+    private String image;
+
+    /** 密码 */
+    private String password;
+
+    /** 名称(机构名称,供应商的公司名称) */
+    private String name;
+
+    /** 见枚举UserType(1供应商,2协销经理,32协销,3会员机构,4普通机构,6呵呵商城) */
+    private String registerUserTypeID;
+
+    /** 供应商状态, 3待审核, 90已上线,91已下线,92审核不通过 */
+    private Integer manufacturerStatus;
+
+    /** 供应商Id */
+    private Integer shopID;
+
+    /** 审核状态 */
+    private String auditStatus;
+
+    /** 审核时间 */
+    private String auditTime;
+
+    /** 审核备注 */
+    private String auditNote;
+
+    /** 注册时间 */
+    private String registerTime;
+
+    /** 注册ip */
+    private String registerIP;
+
+    /** 注册IP所属地 */
+    private String ipAddress;
+
+    /** 登录时间 */
+    private String loginTime;
+
+    /** 登录ip */
+    private String loginIP;
+
+    /** 用户状态,1正常,0冻结 */
+    private String validFlag;
+
+    /** 会所状态,见表c_clubstatus或枚举ClubStatus */
+    private Integer clubStatus;
+
+    /** 会所Id */
+    private Integer clubID;
+
+    /** 同意协议标志 */
+    private String agreeFlag;
+
+    /** 创客状态 */
+    private Integer serviceProviderStatus;
+
+    /** 创客Id */
+    private Integer serviceProviderID;
+
+    /** 账户线下余额 */
+    private BigDecimal userMoney;
+
+    /** 账户实际可用余额(提交订单未支付的被抵扣后的余额) */
+    private BigDecimal ableUserMoney;
+
+    /** 退出时间 */
+    private String logoffTime;
+
+    /** $column.columnComment */
+    private String appKey;
+
+    /** $column.columnComment */
+    private String appSecret;
+
+    /** 扫描标志(4 CRM拉上来的会所) 0待扫描 1 已扫描 2已上线 */
+    private Integer scanFlag;
+
+    /** 采美豆数量 */
+    private Integer userBeans;
+
+    /** 是否已经引导过(供应商首次登陆操作引导/普通机构升级引导) */
+    private Integer guideFlag;
+
+    /** $column.columnComment */
+    private Integer loginFailTime;
+
+    /** $column.columnComment */
+    private String tipStatus;
+
+    /** 账户线上余额 */
+    private BigDecimal onlineMoney;
+
+    public String getUserID() {
+        return userID;
+    }
+
+    public void setUserID(String userID) {
+        this.userID = userID;
+    }
+
+    public String getUserOrganizeID() {
+        return userOrganizeID;
+    }
+
+    public void setUserOrganizeID(String userOrganizeID) {
+        this.userOrganizeID = userOrganizeID;
+    }
+
+    public String getAccount() {
+        return account;
+    }
+
+    public void setAccount(String account) {
+        this.account = account;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getBindMobile() {
+        return bindMobile;
+    }
+
+    public void setBindMobile(String bindMobile) {
+        this.bindMobile = bindMobile;
+    }
+
+    public Integer getUserPermission() {
+        return userPermission;
+    }
+
+    public void setUserPermission(Integer userPermission) {
+        this.userPermission = userPermission;
+    }
+
+    public String getUserIdentity() {
+        return userIdentity;
+    }
+
+    public void setUserIdentity(String userIdentity) {
+        this.userIdentity = userIdentity;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getRealName() {
+        return realName;
+    }
+
+    public void setRealName(String realName) {
+        this.realName = realName;
+    }
+
+    public String getSource() {
+        return source;
+    }
+
+    public void setSource(String source) {
+        this.source = source;
+    }
+
+    public String getImage() {
+        return image;
+    }
+
+    public void setImage(String image) {
+        this.image = image;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getRegisterUserTypeID() {
+        return registerUserTypeID;
+    }
+
+    public void setRegisterUserTypeID(String registerUserTypeID) {
+        this.registerUserTypeID = registerUserTypeID;
+    }
+
+    public Integer getManufacturerStatus() {
+        return manufacturerStatus;
+    }
+
+    public void setManufacturerStatus(Integer manufacturerStatus) {
+        this.manufacturerStatus = manufacturerStatus;
+    }
+
+    public Integer getShopID() {
+        return shopID;
+    }
+
+    public void setShopID(Integer shopID) {
+        this.shopID = shopID;
+    }
+
+    public String getAuditStatus() {
+        return auditStatus;
+    }
+
+    public void setAuditStatus(String auditStatus) {
+        this.auditStatus = auditStatus;
+    }
+
+    public String getAuditTime() {
+        return auditTime;
+    }
+
+    public void setAuditTime(String auditTime) {
+        this.auditTime = auditTime;
+    }
+
+    public String getAuditNote() {
+        return auditNote;
+    }
+
+    public void setAuditNote(String auditNote) {
+        this.auditNote = auditNote;
+    }
+
+    public String getRegisterTime() {
+        return registerTime;
+    }
+
+    public void setRegisterTime(String registerTime) {
+        this.registerTime = registerTime;
+    }
+
+    public String getRegisterIP() {
+        return registerIP;
+    }
+
+    public void setRegisterIP(String registerIP) {
+        this.registerIP = registerIP;
+    }
+
+    public String getIpAddress() {
+        return ipAddress;
+    }
+
+    public void setIpAddress(String ipAddress) {
+        this.ipAddress = ipAddress;
+    }
+
+    public String getLoginTime() {
+        return loginTime;
+    }
+
+    public void setLoginTime(String loginTime) {
+        this.loginTime = loginTime;
+    }
+
+    public String getLoginIP() {
+        return loginIP;
+    }
+
+    public void setLoginIP(String loginIP) {
+        this.loginIP = loginIP;
+    }
+
+    public String getValidFlag() {
+        return validFlag;
+    }
+
+    public void setValidFlag(String validFlag) {
+        this.validFlag = validFlag;
+    }
+
+    public Integer getClubStatus() {
+        return clubStatus;
+    }
+
+    public void setClubStatus(Integer clubStatus) {
+        this.clubStatus = clubStatus;
+    }
+
+    public Integer getClubID() {
+        return clubID;
+    }
+
+    public void setClubID(Integer clubID) {
+        this.clubID = clubID;
+    }
+
+    public String getAgreeFlag() {
+        return agreeFlag;
+    }
+
+    public void setAgreeFlag(String agreeFlag) {
+        this.agreeFlag = agreeFlag;
+    }
+
+    public Integer getServiceProviderStatus() {
+        return serviceProviderStatus;
+    }
+
+    public void setServiceProviderStatus(Integer serviceProviderStatus) {
+        this.serviceProviderStatus = serviceProviderStatus;
+    }
+
+    public Integer getServiceProviderID() {
+        return serviceProviderID;
+    }
+
+    public void setServiceProviderID(Integer serviceProviderID) {
+        this.serviceProviderID = serviceProviderID;
+    }
+
+    public BigDecimal getUserMoney() {
+        return userMoney;
+    }
+
+    public void setUserMoney(BigDecimal userMoney) {
+        this.userMoney = userMoney;
+    }
+
+    public BigDecimal getAbleUserMoney() {
+        return ableUserMoney;
+    }
+
+    public void setAbleUserMoney(BigDecimal ableUserMoney) {
+        this.ableUserMoney = ableUserMoney;
+    }
+
+    public String getLogoffTime() {
+        return logoffTime;
+    }
+
+    public void setLogoffTime(String logoffTime) {
+        this.logoffTime = logoffTime;
+    }
+
+    public String getAppKey() {
+        return appKey;
+    }
+
+    public void setAppKey(String appKey) {
+        this.appKey = appKey;
+    }
+
+    public String getAppSecret() {
+        return appSecret;
+    }
+
+    public void setAppSecret(String appSecret) {
+        this.appSecret = appSecret;
+    }
+
+    public Integer getScanFlag() {
+        return scanFlag;
+    }
+
+    public void setScanFlag(Integer scanFlag) {
+        this.scanFlag = scanFlag;
+    }
+
+    public Integer getUserBeans() {
+        return userBeans;
+    }
+
+    public void setUserBeans(Integer userBeans) {
+        this.userBeans = userBeans;
+    }
+
+    public Integer getGuideFlag() {
+        return guideFlag;
+    }
+
+    public void setGuideFlag(Integer guideFlag) {
+        this.guideFlag = guideFlag;
+    }
+
+    public Integer getLoginFailTime() {
+        return loginFailTime;
+    }
+
+    public void setLoginFailTime(Integer loginFailTime) {
+        this.loginFailTime = loginFailTime;
+    }
+
+    public String getTipStatus() {
+        return tipStatus;
+    }
+
+    public void setTipStatus(String tipStatus) {
+        this.tipStatus = tipStatus;
+    }
+
+    public BigDecimal getOnlineMoney() {
+        return onlineMoney;
+    }
+
+    public void setOnlineMoney(BigDecimal onlineMoney) {
+        this.onlineMoney = onlineMoney;
+    }
+}
+

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

@@ -49,6 +49,10 @@ public class BehaviorRecodeVo {
      * 访问客户端
      */
     private String accessClient;
+    /**
+     * 访问日期
+     */
+    private String accessDate;
     /**
      * 访问时间
      */

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

@@ -241,5 +241,13 @@ public class ClubVo implements Serializable {
      * 电话是否触达
      */
     private String mob;
+    /**
+     * 首次访问时间
+     */
+    private String firstTime;
+    /**
+     * 最近访问时间
+     */
+    private String recentlyTime;
 
 }

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

@@ -46,7 +46,7 @@ public class CmBehaviorRecordVo implements Serializable
     private Integer productID;
 
     /** 访问时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date accessTime;
 
     /** 访问时长 */

+ 34 - 14
src/main/java/com/caimei365/user/model/vo/CmBrandLandingVO.java

@@ -1,16 +1,12 @@
 package com.caimei365.user.model.vo;
 
-import java.util.Date;
-
-import com.caimei365.user.model.vo.CmBrandFilesVO;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.experimental.Accessors;
 import org.apache.ibatis.type.Alias;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 
 import java.io.Serializable;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -19,21 +15,24 @@ import java.util.List;
  * @author Kaick
  * @date 2023-05-31
  */
-@Accessors(chain  = true )
+@Accessors(chain = true )
 @Data
 @Alias("CmBrandLandingVO")
 public class CmBrandLandingVO implements Serializable
 {
-    private static final Long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
 
     /** id */
     private String id;
 
+    /** 分类:1成功案例,2增长社区-视频列表,3增长社区-文章列表, 4信息中心导航栏(info_type)(已弃用) , 5信息中心首页轮播图 */
+    private String type;
+
     /** 供应商id */
     private String authUserId;
 
-    /** 分类:1成功案例,2增长社区-视频列表,3增长社区-文章列表 */
-    private String type;
+    /** 归属者Id(type字段表Id) */
+    private String authorId;
 
     /** pc端picture */
     private String headPcBanner;
@@ -54,21 +53,42 @@ public class CmBrandLandingVO implements Serializable
     private String jumpLink;
 
     /** 标题
- */
+     */
     private String title;
 
     /** 内容
- */
+     */
     private String content;
 
-    /** 视频文件 */
+    /** 视频文件 cm_brand_files表id */
     private String video;
 
     /** 排序 */
     private String sort;
 
-    /** 文件资料 */
-    List<CmBrandFilesVO> cmBrandFiles;
+    /** pc端status 1启用,0停用 */
+    private String pcStatus;
+
+    /**
+     * 移动端status 1启用,0停用
+     */
+    private String appStatus;
+
+    /**
+     * 子级分类: (type=4){1 大图,2小图}(已弃用),(type=5){1 大图,2小图,2小图}
+     */
+    private String levelType;
+
+    /**
+     * 添加时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date addTime;
+
+    /**
+     * 文件资料
+     */
+    private List<CmBrandFilesVO> cmBrandFiles;
 
 
 }

+ 87 - 0
src/main/java/com/caimei365/user/model/vo/CmDistributionVO.java

@@ -0,0 +1,87 @@
+package com.caimei365.user.model.vo;
+
+import java.util.ArrayList;
+import java.util.Date;
+
+import com.caimei365.user.model.po.CmDistribution;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.io.Serializable;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * distribution对象 cm_distribution
+ *
+ * @author Kaick
+ * @date 2023-09-25
+ */
+@Data
+@Alias("CmDistributionVO")
+public class CmDistributionVO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * id
+     */
+    private String id;
+
+    /**
+     * 用户id
+     */
+    private Integer userId;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 联系人
+     */
+    private String linkMan;
+
+    /**
+     * 手机号
+     */
+    private String mobile;
+
+    /**
+     * 分账号
+     */
+    private String splitCode;
+
+    /**
+     * 状态:90上线,91下线
+     */
+    private Integer status;
+
+    /**
+     * 分销二维码
+     */
+    private String qrCode;
+
+    /**
+     * 头像
+     */
+    private String image;
+
+    /**
+     * 父级团队Id:0表示团队
+     */
+    private Integer parentId;
+
+    /**
+     * 父级团队Id集合
+     */
+    private String parentIds;
+
+}

+ 23 - 0
src/main/java/com/caimei365/user/model/vo/RetuenDataVo.java

@@ -0,0 +1,23 @@
+package com.caimei365.user.model.vo;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : hzg
+ * @date : 2023/11/16
+ */
+@Data
+public class RetuenDataVo {
+    /**
+     * 时间
+     */
+    private String accessDate;
+    /**
+     * 机构访问数据
+     */
+    private List<BehaviorRecodeVo> record;
+}

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

@@ -116,6 +116,11 @@ public class UserLoginVo implements Serializable {
      */
     @ApiModelProperty("协销状态: 90:已上线")
     private Integer serviceStatus;
+    /**
+     * 供应商是否可以帮机构下单
+     */
+    @ApiModelProperty("供应商能否帮机构下单")
+    private Boolean shopIsOrder;
     /**
      * 运营人员状态:1未绑定,2已绑定
      */

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

@@ -4,6 +4,7 @@ import com.aliyuncs.exceptions.ClientException;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.MobileDto;
 import com.caimei365.user.model.dto.PasswordDto;
+import com.caimei365.user.model.po.CmUser;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.HashMap;
@@ -126,12 +127,22 @@ public interface BaseService {
 
     /**
      * 查超级会员套餐详情
+     *
      * @return
      */
     ResponseJson findPackage();
 
     ResponseJson<HashMap<String, String>> ossTokenGet() throws ClientException;
 
-    ResponseJson<Integer>  getByUserId(Integer userType, Integer userId);
+    ResponseJson<Integer> getByUserId(Integer userType, Integer userId);
+
+    String getByMobile( Integer userIdentity,  Integer userId);
+
+    Integer getUserIdByMobile(String mobile);
+
+    Integer getByUserCount(CmUser user);
+
+    CmUser getByUser(CmUser user);
 
+    CmUser findUserByMobile(String mobile, Integer oldUserId, Integer userIdentity);
 }

+ 0 - 39
src/main/java/com/caimei365/user/service/CmBrandLandingService.java

@@ -1,7 +1,6 @@
 package com.caimei365.user.service;
 
 import com.caimei365.user.model.po.CmBrandLanding;
-import com.caimei365.user.model.vo.CmBrandLandingVO;
 
 import java.util.List;
 
@@ -13,13 +12,6 @@ import java.util.List;
  */
 public interface CmBrandLandingService
 {
-    /**
-     * 查询供应商落地页资源
-     *
-     * @param id 供应商落地页资源主键
-     * @return 供应商落地页资源
-     */
-    public CmBrandLanding selectCmBrandLandingById(String id);
 
     /**
      * 查询供应商落地页资源列表
@@ -29,35 +21,4 @@ public interface CmBrandLandingService
      */
     public List<CmBrandLanding> selectCmBrandLandingList(CmBrandLanding cmBrandLanding);
 
-    /**
-     * 新增供应商落地页资源
-     *
-     * @param cmBrandLanding 供应商落地页资源
-     * @return 结果
-     */
-    public int insertCmBrandLanding(CmBrandLanding cmBrandLanding);
-
-    /**
-     * 修改供应商落地页资源
-     *
-     * @param cmBrandLanding 供应商落地页资源
-     * @return 结果
-     */
-    public int updateCmBrandLanding(CmBrandLanding cmBrandLanding);
-
-    /**
-     * 批量删除供应商落地页资源
-     *
-     * @param ids 需要删除的供应商落地页资源主键集合
-     * @return 结果
-     */
-    public int deleteCmBrandLandingByIds(String[] ids);
-
-    /**
-     * 删除供应商落地页资源信息
-     *
-     * @param id 供应商落地页资源主键
-     * @return 结果
-     */
-    public int deleteCmBrandLandingById(String id);
 }

+ 70 - 0
src/main/java/com/caimei365/user/service/CmDistributionService.java

@@ -0,0 +1,70 @@
+package com.caimei365.user.service;
+
+import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.model.dto.LoginCodeDto;
+import com.caimei365.user.model.po.CmDistribution;
+import com.caimei365.user.model.vo.UserLoginVo;
+
+import java.util.List;
+
+/**
+ * distributionService接口
+ *
+ * @author Kaick
+ * @date 2023-09-25
+ */
+public interface CmDistributionService
+{
+    /**
+     * 通过对象查询distribution列表
+     *
+     * @param cmDistribution distribution
+     * @return distribution集合
+     */
+    public List<CmDistribution> getCmDistributionList(CmDistribution cmDistribution);
+
+
+    /**
+     * 通过对象查询distribution
+     *
+     * @param cmDistribution distribution
+     * @return distribution
+     */
+    public CmDistribution getByCmDistribution(CmDistribution cmDistribution);
+
+    public CmDistribution getCmDistributionById(String id);
+
+    /**
+     * 新增distribution
+     *
+     * @param cmDistribution distribution
+     * @return 结果
+     */
+    public int addCmDistribution(CmDistribution cmDistribution);
+
+    /**
+     * 修改distribution
+     *
+     * @param cmDistribution distribution
+     * @return 结果
+     */
+    public int updateCmDistribution(CmDistribution cmDistribution);
+
+
+    public ResponseJson<UserLoginVo> passwordLogin(String mobile, String password);
+
+    /**
+     * 分销人员登录验证码登录
+     * @param loginCodeDto
+     * @return
+     */
+    ResponseJson<UserLoginVo> organizeCodeLogin(LoginCodeDto loginCodeDto);
+
+    ResponseJson organizeClubCodeLogin(LoginCodeDto loginCodeDto ,String userId);
+    /**
+     * 修改分销人员登录密码
+     * @param cmDistribution
+     * @return
+     */
+     ResponseJson setPassword(CmDistribution cmDistribution, String code);
+}

+ 0 - 15
src/main/java/com/caimei365/user/service/CmQuestionnaireService.java

@@ -91,19 +91,4 @@ public interface CmQuestionnaireService
      */
     public int delCmQuestionnaireById(String id);
 
-    /**
-     * 批量新增用户需求调查
-     *
-     * @param cmQuestionnaireList 用户需求调查列表
-     * @return 结果
-     */
-    public void batchAddCmQuestionnaire(List<CmQuestionnaire> cmQuestionnaireList);
-
-    /**
-     * 批量修改用户需求调查
-     *
-     * @param cmQuestionnaireList 用户需求调查列表
-     * @return 结果
-     */
-    public void batchUpdateCmQuestionnaire(List<CmQuestionnaire> cmQuestionnaireList);
 }

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

@@ -53,6 +53,7 @@ public interface RegisterService {
      */
     ResponseJson clubRegister(ClubRegisterDto clubRegisterDto, HttpHeaders headers);
 
+    public ResponseJson distributionClubRegister(ClubRegisterDto clubRegisterDto, HttpHeaders headers);
     /**
      * 组织注册信息校验
      * @param bindMobile

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

@@ -26,7 +26,7 @@ public interface SellerService {
      * @param name              机构名字关键字(搜索用)
      * @return
      */
-    ResponseJson<PageInfo<ClubVo>> getClubList(Integer serviceProviderId, Integer status, Integer type, String name, Integer userIdentity, Integer groupServiceId, Integer pageNum, Integer pageSize);
+    ResponseJson<PageInfo<ClubVo>> getClubList(Integer serviceProviderId, Integer status, Integer type, String name, Integer userIdentity, Integer groupServiceId, String startTime, String endTime, Integer pageNum, Integer pageSize);
 /**
  * 功能描述: 机构活跃分析
  * @auther: Kaick
@@ -121,4 +121,21 @@ public interface SellerService {
     ResponseJson<List<CmBehaviorRecordVo>> getBehaviorRecordClubFrom(Integer spId, Integer clubId, String accessTime);
 
     ResponseJson<List<ServiceProviderVo>> getServiceTeam(Integer spId,Integer status);
+
+    /**
+     * 机构重点访问页面
+     * @param clubId
+     * @return
+     */
+    ResponseJson<PageInfo<RetuenDataVo>> getClubRecord(Integer clubId, int pageNum, int pageSize);
+
+    /**
+     * 协销不活跃机构列表
+     * @param serviceProviderId
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    ResponseJson<PageInfo<ClubVo>> getUnActiveClubList(Integer serviceProviderId, int pageNum, int pageSize);
+
 }

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

@@ -19,6 +19,13 @@ import java.util.Map;
  * @date : 2021/3/9
  */
 public interface ShopService {
+
+    /**
+     * 供应商快捷登录
+     * @param userId
+     * @return
+     */
+    ResponseJson<UserLoginVo> shortcutLogin(Integer userId);
     /**
      * 根据用户Id查询供应商资料
      *

+ 41 - 4
src/main/java/com/caimei365/user/service/impl/BaseServiceImpl.java

@@ -12,6 +12,7 @@ import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.MobileDto;
 import com.caimei365.user.model.dto.PasswordDto;
 import com.caimei365.user.model.dto.SuperVipDto;
+import com.caimei365.user.model.po.CmUser;
 import com.caimei365.user.model.po.SuperVipPo;
 import com.caimei365.user.model.po.VipPackage;
 import com.caimei365.user.model.po.VipPayHistoryPo;
@@ -24,6 +25,7 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
@@ -120,7 +122,8 @@ public class BaseServiceImpl implements BaseService {
      * 获取短信验证码
      *
      * @param mobile           手机号
-     * @param activateCodeType 1:找回密码,2:手机号注册机构,3:供应商注册,4:修改手机号-旧手机验证码,5:修改手机号-新手机验证码,7:手机验证码登录,8:联合丽格注册,9:联合丽格登录验证,10:联合丽格找回密码,11:联合丽格更换手机号--旧手机验证码,12:联合丽格更换手机号--新手机验证码,13联合丽格采购员登录
+     * @param activateCodeType 1:找回密码,2:手机号注册机构,3:供应商注册,4:修改手机号-旧手机验证码,5:修改手机号-新手机验证码,7:手机验证码登录,8:联合丽格注册,9:联合丽格登录验证,10:联合丽格找回密码,11:联合丽格更换手机号--旧手机验证码,12:联合丽格更换手机号--新手机验证码,13联合丽格采购员登录,
+     *                         14登录分销商城,15分销商城找回密码
      * @param platformType     0:www,1:crm/h5,2:小程序
      * @param isCheckCaptcha   是否检查图片验证码,0:检查,1:不检查
      * @param imgCode          图片验证码
@@ -305,12 +308,20 @@ public class BaseServiceImpl implements BaseService {
             }
             // 【丽格集采联盟】您的验证码为:{s6},5分钟内有效,请勿泄漏他人。
             String content = "【丽格集采联盟】您的验证码为:" + randomCode + ",5分钟内有效,请勿泄漏他人。";
-            sendFlag = isBeta || remoteCallService.remoteSendSms(0,1,mobile,content);
+            sendFlag = isBeta || remoteCallService.remoteSendSms(0, 1, mobile, content);
             if (!sendFlag) {
                 // 短信发送失败重试一次
-                sendFlag = remoteCallService.remoteSendSms(0,1,mobile,content);
+                sendFlag = remoteCallService.remoteSendSms(0, 1, mobile, content);
             }
             codeTypeTxt = "联合丽格采购员登录";
+        } else if (14 == activateCodeType) {
+            String content = "【分销系统】欢迎登录分销商城,您的验证码为:" + randomCode + ",5分钟内有效,请勿泄漏他人。";
+            sendFlag = isBeta || remoteCallService.remoteSendSms(0, 1, mobile, content);
+            codeTypeTxt = "分销商城人员登录";
+        } else if (15 == activateCodeType) {
+            String content = "【分销系统】您的验证码为:" + randomCode + ",5分钟内有效,请勿泄漏他人。";
+            sendFlag = isBeta || remoteCallService.remoteSendSms(0, 1, mobile, content);
+            codeTypeTxt = "分销商城找回密码";
         } else {
             return ResponseJson.error("参数错误:activateCodeType");
         }
@@ -318,7 +329,7 @@ public class BaseServiceImpl implements BaseService {
             if (6 == activateCodeType) {
                 //二手验证码10分钟有效期
                 redisService.set("code:" + mobile, randomCode, 600L);
-            } else if (8 == activateCodeType || 10 == activateCodeType || 11 == activateCodeType) {
+            } else if (8 == activateCodeType || 10 == activateCodeType || 11 == activateCodeType||14 == activateCodeType||15 == activateCodeType) {
                 // 联合丽格验证码5分钟有效期
                 redisService.set("code:" + mobile, randomCode, 300L);
             }else {
@@ -332,6 +343,7 @@ public class BaseServiceImpl implements BaseService {
         return ResponseJson.success("发送验证码成功");
     }
 
+
     /**
      * 绑定账号,发送短信验证
      *
@@ -805,4 +817,29 @@ public class BaseServiceImpl implements BaseService {
     public ResponseJson<Integer> getByUserId(Integer userType, Integer id) {
         return ResponseJson.success(baseMapper.getByUserId(userType, id));
     }
+
+    @Override
+    public String getByMobile(Integer userIdentity, Integer userId) {
+        return baseMapper.getByMobile(userIdentity,userId);
+    }
+
+    @Override
+    public Integer getUserIdByMobile(String mobile) {
+        return baseMapper.getUserIdByMobile(mobile);
+    }
+
+    @Override
+    public Integer getByUserCount(CmUser user) {
+        return baseMapper.getByUserCount(user);
+    }
+
+    @Override
+    public CmUser getByUser(CmUser user) {
+        return baseMapper.getByUser(user);
+    }
+
+    @Override
+    public CmUser findUserByMobile(String mobile, Integer oldUserId, Integer userIdentity) {
+        return baseMapper.findUserByMobile(mobile, oldUserId, userIdentity);
+    }
 }

+ 13 - 3
src/main/java/com/caimei365/user/service/impl/ClubServiceImpl.java

@@ -30,6 +30,7 @@ import java.text.NumberFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.stream.Collectors;
 
 import static com.alibaba.fastjson.JSON.parseArray;
 import static com.alibaba.fastjson.JSON.parseObject;
@@ -78,6 +79,7 @@ public class ClubServiceImpl implements ClubService {
         if (user == null) {
             return ResponseJson.error("用户信息不存在", null);
         }
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
         if (!StringUtils.isBlank(user.getAuditNote()) && 2 == user.getAuditStatus()) {
             if (user.getAuditNote().contains(",")) {
                 List<String> list = Arrays.asList(user.getAuditNote().split(","));
@@ -120,6 +122,12 @@ public class ClubServiceImpl implements ClubService {
                     club.setMob("未触达");
                 }
             }
+            try {
+                club.setFirstTime(remarksInfo.getFirstTime() != null ? dateFormat.format(dateFormat.parse(remarksInfo.getFirstTime())) : null);
+                club.setRecentlyTime(remarksInfo.getRecentlyTime() != null ? dateFormat.format(dateFormat.parse(remarksInfo.getRecentlyTime())) : null);
+            }catch (ParseException e) {
+                e.printStackTrace();
+            }
         }
         // 资料完整度
         Integer number = 0;
@@ -1294,6 +1302,7 @@ public class ClubServiceImpl implements ClubService {
             clubMapper.updateRemarksSp(clubId, oldSpId, spId, 1);
         }
         if (!spId.equals(choseServiceId)) {
+            log.info("更新协销微信模板提醒"+choseServiceId);
             asyncService.sendChoseServiceMessage(1, clubId, spId, choseServiceId);
         }
         // 添加协销更换记录
@@ -2550,8 +2559,8 @@ public class ClubServiceImpl implements ClubService {
         List<BehaviorRecodeVo> recordDetail = clubMapper.recordDetail(clubId, accessDate);
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-
-        List<BehaviorRecodeVo> region = clubMapper.selRegion(ip,accessDate);
+        // 访问来源数据
+        List<BehaviorRecodeVo> region = clubMapper.selRegion(ip, accessDate, 0, null);
         String format = "";
         for(BehaviorRecodeVo record: recordDetail) {
             // 图片处理
@@ -2568,7 +2577,7 @@ public class ClubServiceImpl implements ClubService {
                 for (BehaviorRecodeVo behaviorRecord : region) {
                     format = simpleDateFormat.format(behaviorRecord.getAccessTime());
                     if (StringUtils.isNotBlank(record.getPageType()) && StringUtils.isNotBlank(behaviorRecord.getPageType())) {
-                        if (record.getPageType().equals(behaviorRecord.getPageType()) && s.equals(format)) {
+                        if (s.equals(format)) {
                             record.setAccessSource(behaviorRecord.getAccessSource());
                         }
                     }
@@ -3025,6 +3034,7 @@ public class ClubServiceImpl implements ClubService {
         }
         return ResponseJson.success(map);
     }
+
     /**
      * 时间计算
      * @param recordTime

+ 0 - 60
src/main/java/com/caimei365/user/service/impl/CmBrandLandingServiceImpl.java

@@ -5,7 +5,6 @@ import java.util.List;
 
 import com.caimei365.user.mapper.CmBrandLandingMapper;
 import com.caimei365.user.model.po.CmBrandLanding;
-import com.caimei365.user.model.vo.CmBrandLandingVO;
 import com.caimei365.user.service.CmBrandLandingService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -22,17 +21,6 @@ public class CmBrandLandingServiceImpl implements CmBrandLandingService
     @Autowired
     private CmBrandLandingMapper cmBrandLandingMapper;
 
-    /**
-     * 查询供应商落地页资源
-     *
-     * @param id 供应商落地页资源主键
-     * @return 供应商落地页资源
-     */
-    @Override
-    public CmBrandLanding selectCmBrandLandingById(String id)
-    {
-        return cmBrandLandingMapper.selectCmBrandLandingById(id);
-    }
 
     /**
      * 查询供应商落地页资源列表
@@ -46,52 +34,4 @@ public class CmBrandLandingServiceImpl implements CmBrandLandingService
         return cmBrandLandingMapper.selectCmBrandLandingList(cmBrandLanding);
     }
 
-    /**
-     * 新增供应商落地页资源
-     *
-     * @param cmBrandLanding 供应商落地页资源
-     * @return 结果
-     */
-    @Override
-    public int insertCmBrandLanding(CmBrandLanding cmBrandLanding)
-    {
-        return cmBrandLandingMapper.insertCmBrandLanding(cmBrandLanding);
-    }
-
-    /**
-     * 修改供应商落地页资源
-     *
-     * @param cmBrandLanding 供应商落地页资源
-     * @return 结果
-     */
-    @Override
-    public int updateCmBrandLanding(CmBrandLanding cmBrandLanding)
-    {
-        cmBrandLanding.setUpdateTime(new Date());
-        return cmBrandLandingMapper.updateCmBrandLanding(cmBrandLanding);
-    }
-
-    /**
-     * 批量删除供应商落地页资源
-     *
-     * @param ids 需要删除的供应商落地页资源主键
-     * @return 结果
-     */
-    @Override
-    public int deleteCmBrandLandingByIds(String[] ids)
-    {
-        return cmBrandLandingMapper.deleteCmBrandLandingByIds(ids);
-    }
-
-    /**
-     * 删除供应商落地页资源信息
-     *
-     * @param id 供应商落地页资源主键
-     * @return 结果
-     */
-    @Override
-    public int deleteCmBrandLandingById(String id)
-    {
-        return cmBrandLandingMapper.deleteCmBrandLandingById(id);
-    }
 }

+ 389 - 0
src/main/java/com/caimei365/user/service/impl/CmDistributionServiceImpl.java

@@ -0,0 +1,389 @@
+package com.caimei365.user.service.impl;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import com.caimei365.user.components.CommonService;
+import com.caimei365.user.components.RedisService;
+import com.caimei365.user.components.WeChatService;
+import com.caimei365.user.mapper.BaseMapper;
+import com.caimei365.user.mapper.CmDistributionMapper;
+import com.caimei365.user.model.ResponseJson;
+import com.caimei365.user.model.dto.LoginCodeDto;
+import com.caimei365.user.model.po.CmDistribution;
+import com.caimei365.user.model.po.CmUser;
+import com.caimei365.user.model.vo.UserLoginVo;
+import com.caimei365.user.service.CmDistributionService;
+import com.caimei365.user.service.RemoteCallService;
+import com.caimei365.user.utils.CodeUtil;
+import com.caimei365.user.utils.DateUtil;
+import com.caimei365.user.utils.JwtUtil;
+import com.caimei365.user.utils.Md5Util;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.http.client.utils.DateUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+
+/**
+ * distributionService业务层处理
+ *
+ * @author Kaick
+ * @date 2023-09-25
+ */
+@Slf4j
+@Service
+public class CmDistributionServiceImpl implements CmDistributionService {
+    @Resource
+    private RedisService redisService;
+    @Resource
+    private BaseMapper baseMapper;
+    @Resource
+    private CmDistributionMapper cmDistributionMapper;
+    @Resource
+    private CommonService commonService;
+    @Resource
+    private RemoteCallService remoteCallService;
+    /**
+     * 通过对象查询distribution列表
+     *
+     * @param cmDistribution distribution
+     * @return distribution
+     */
+    @Override
+    public List<CmDistribution> getCmDistributionList(CmDistribution cmDistribution) {
+        return cmDistributionMapper.getCmDistributionList(cmDistribution);
+    }
+
+
+    /**
+     * 通过对象查询distribution
+     *
+     * @param cmDistribution distribution
+     * @return distribution
+     */
+    @Override
+    public CmDistribution getByCmDistribution(CmDistribution cmDistribution) {
+        return cmDistributionMapper.getByCmDistribution(cmDistribution);
+    }
+
+    /**
+     * 通过对象查询distribution
+     *
+     * @return distribution
+     */
+    @Override
+    public CmDistribution getCmDistributionById(String id) {
+        return cmDistributionMapper.getCmDistributionById(id);
+    }
+
+
+    /**
+     * 新增distribution
+     *
+     * @param cmDistribution distribution
+     * @return 结果
+     */
+    @Override
+    public int addCmDistribution(CmDistribution cmDistribution) {
+        cmDistribution.linkMan(cmDistribution.name());
+        CmUser cmUser = new CmUser();
+        cmUser.setMobile(cmDistribution.mobile());
+        cmUser.setBindMobile(cmDistribution.mobile());
+        cmUser.setServiceProviderStatus(cmDistribution.status());
+        cmUser.setRealName(cmDistribution.name());
+        cmUser.setUserName(cmDistribution.name());
+        cmUser.setName(cmDistribution.name());
+        cmUser.setAuditStatus("1");
+        cmUser.setAuditTime(DateUtil.formatDateTime(new Date()));
+        if (StringUtils.isBlank(cmDistribution.id())) {
+            String password=(char)(Math.random()*26+'A')+ CodeUtil.generateCodeInt(7);
+            cmUser.setUserOrganizeID("0");
+            cmUser.setMobile(cmDistribution.mobile());
+            cmUser.setBindMobile(cmDistribution.mobile());
+            cmUser.setUserIdentity("7");//外部协销
+            cmUser.setRegisterUserTypeID("32");//协销
+            cmUser.setRegisterTime(DateUtil.formatDateTime(new Date()));
+            cmUser.setValidFlag("1");
+            CmDistribution cmDistributionByParentId = cmDistributionMapper.getCmDistributionById(String.valueOf(cmDistribution.parentId()));
+            cmDistribution.parentIds(cmDistributionByParentId.parentIds() + "," + cmDistribution.parentId());
+            cmDistribution.corporateName(cmDistributionByParentId.corporateName());
+            cmDistribution.password(Md5Util.md5(password));
+            cmUser.setPassword(cmDistribution.password());
+            baseMapper.addUser(cmUser);
+//            cmUser.setServiceProviderID(Integer.valueOf(cmDistribution.id()));
+            cmDistribution.userId(Integer.valueOf(cmUser.getUserID()));
+            cmDistribution.addTime(new Date());
+            String content = "【分销系统】您的分销系统登录账号 :"+cmDistribution.mobile()+",密码:"+password;
+            if (cmDistribution.mobile()!= null && cmDistribution.mobile() != "") {
+                remoteCallService.remoteSendSms(0, 1, cmDistribution.mobile(), content);
+            }
+            return cmDistributionMapper.addCmDistribution(cmDistribution);
+        } else {
+            cmDistributionMapper.updateCmDistribution(cmDistribution);
+            cmUser.setUserID(String.valueOf(cmDistribution.userId()));
+            return baseMapper.updateUser(cmUser);
+        }
+    }
+
+    /**
+     * 修改distribution
+     *
+     * @param cmDistribution distribution
+     * @return 结果
+     */
+    @Override
+    public int updateCmDistribution(CmDistribution cmDistribution) {
+        cmDistribution.updateTime(new Date());
+        if (StringUtils.isNotBlank(cmDistribution.image())) {
+            baseMapper.updateImageByUserId(cmDistribution.image(), cmDistribution.userId());
+        }
+        if (StringUtils.isNotBlank(cmDistribution.password())) {
+            baseMapper.updatePasswordByUserId(cmDistribution.password(), cmDistribution.userId());
+        }
+        if (null!=cmDistribution.status()) {
+            baseMapper.updateUser(new CmUser()
+                    .userID(String.valueOf(cmDistribution.userId()))
+                    .validFlag(cmDistribution.status()==90?"1":"0"));
+        }
+        return cmDistributionMapper.updateCmDistribution(cmDistribution);
+    }
+
+    /**
+     * 协销登录(手机号,密码)
+     *
+     * @param mobile   手机号
+     * @param password 密码
+     * @return UserLoginVo
+     */
+    @Override
+    public ResponseJson<UserLoginVo> passwordLogin(String mobile, String password) {
+        if (StringUtils.isBlank(mobile) || StringUtils.isBlank(password)) {
+            return ResponseJson.error("请输入账号密码", null);
+        }
+        UserLoginVo distribution = cmDistributionMapper.getLoginDistributionByMobile(mobile);
+        if (null != distribution) {
+            String key = "login-" + distribution.getUserId();
+            boolean exists = redisService.exists(key);
+            //如果30分钟内输入错误记录>=5,return该账号暂时被冻结,请(30-最前一次时间)分钟后重试或直接修改密码
+            if (exists) {
+                String val = (String) redisService.get(key);
+                String[] split = val.split(",");
+                int count = Integer.parseInt(split[0]);
+                if (count >= 5) {
+                    long s = Long.parseLong(split[1]);
+                    int l = (int) Math.floor((System.currentTimeMillis() - s) / 1000 / 60);
+                    return ResponseJson.error("该账号暂时被冻结,请" + (30 - l) + "分钟后重试或直接修改密码", null);
+                }
+            }
+            // 比对密码
+            if (Md5Util.md5(password).equals(distribution.getPassword())) {
+                if (distribution.getServiceStatus().equals(90)) {
+                    // 生成token
+                    String token = JwtUtil.createToken(distribution.getUserId());
+                    // 为了过期续签,将token存入redis,并设置超时时间
+                    redisService.set(token, token, JwtUtil.getExpireTime());
+                    distribution.setToken(token);
+                    log.info("分销人员账号密码登录");
+                    return ResponseJson.success(distribution);
+                } else {
+                    return ResponseJson.error("登录账号已下线,请联系客服", null);
+                }
+            } else {
+                // 增加一次错误输入密码记录,30分钟内连续五次冻结
+                if (exists) {
+                    String val = (String) redisService.get(key);
+                    String[] split = val.split(",");
+                    int count = Integer.parseInt(split[0]);
+                    if (count < 5) {
+                        count++;
+                        String va = count + "," + System.currentTimeMillis();
+                        redisService.set(key, va);
+                    }
+                    if (count >= 5) {
+                        redisService.set(key, 5 + "," + System.currentTimeMillis(), 1800L);
+                    }
+                } else {
+                    String val = 1 + "," + System.currentTimeMillis();
+                    redisService.set(key, val);
+                }
+            }
+        }
+        return ResponseJson.error("账户名与密码不匹配,请重新输入", null);
+    }
+
+
+    /**
+     * 分销人员登录验证码登录
+     *
+     * @param loginCodeDto
+     * @return
+     */
+    @Override
+    public ResponseJson<UserLoginVo> organizeCodeLogin(LoginCodeDto loginCodeDto) {
+        String mobile = loginCodeDto.getMobile();
+        String code = loginCodeDto.getCode();
+        if (StringUtils.isBlank(mobile)) {
+            return ResponseJson.error("请输入手机号", null);
+        }
+        if (StringUtils.isBlank(code)) {
+            return ResponseJson.error("请输入验证码", null);
+        }
+        // 判断redis中是否存在
+        boolean exists = redisService.exists("code:" + mobile);
+        if (exists) {
+            // 查看验证码是否过期
+            long expireTime = redisService.getExpireTime("code:" + mobile);
+            if (expireTime < 0) {
+                return ResponseJson.error(-1, "验证码已失效,请重新获取", null);
+            }
+            // 获取redis手机短信验证码
+            Object randomCode = redisService.get("code:" + mobile);
+
+            if (!ObjectUtils.isEmpty(randomCode)) {
+                if (code.equals(randomCode.toString())) {
+                    redisService.remove("code:" + mobile);
+                    // 根据手机号获取分销人员
+                    UserLoginVo distribution = cmDistributionMapper.getLoginDistributionByMobile(mobile);
+                    if (null!=distribution&&distribution.getServiceStatus().equals(90)) {
+                        // 生成token
+                        String token = JwtUtil.createToken(distribution.getUserId());
+                        // 为了过期续签,将token存入redis,并设置超时时间
+                        redisService.set(token, token, JwtUtil.getExpireTime());
+                        distribution.setToken(token);
+                        log.info("分销人员账号密码登录");
+                        return ResponseJson.success(distribution);
+                    } else {
+                        return ResponseJson.error("登录账号已下线,请联系客服", null);
+                    }
+                } else {
+                    return ResponseJson.error(-1, "验证码错误,请确认验证码输入", null);
+                }
+            } else {
+                return ResponseJson.error(-1, "验证码错误, 请重新获取", null);
+            }
+        }
+        return ResponseJson.error(-1, "请获短信取验证码", null);
+    }
+
+    /**
+     * 分销人员登录验证码登录
+     *
+     * @param loginCodeDto
+     * @return
+     */
+    @Override
+    public ResponseJson organizeClubCodeLogin(LoginCodeDto loginCodeDto ,String userId) {
+        String mobile = loginCodeDto.getMobile();
+        String code = loginCodeDto.getCode();
+        if (StringUtils.isBlank(mobile)) {
+            return ResponseJson.error("请输入手机号", null);
+        }
+        if (StringUtils.isBlank(code)) {
+            return ResponseJson.error("请输入验证码", null);
+        }
+        // 判断redis中是否存在
+        boolean exists = redisService.exists("code:" + mobile);
+        if (exists) {
+            // 查看验证码是否过期
+            long expireTime = redisService.getExpireTime("code:" + mobile);
+            if (expireTime < 0) {
+                return ResponseJson.error(-1, "验证码已失效,请重新获取", null);
+            }
+            // 获取redis手机短信验证码
+            Object randomCode = redisService.get("code:" + mobile);
+
+            if (!ObjectUtils.isEmpty(randomCode)) {
+                if (code.equals(randomCode.toString())) {
+                    redisService.remove("code:" + mobile);
+                    // 根据手机号获取分销人员
+                    CmUser user = baseMapper.getByUser(new CmUser().userIdentity("8").userID(userId).bindMobile(mobile));
+                    if (null!=user) {
+                        String password=(char)(Math.random()*26+'A')+CodeUtil.generateCodeInt(7);
+                        baseMapper.updateUser(new CmUser()
+                                .userID(userId)
+                                .validFlag("1")
+                                .clubStatus(90)
+                                .password(Md5Util.md5(password))
+                        );
+                        baseMapper.updateClubStatus(Integer.valueOf(userId),90);
+                        // 发送短信
+                        String content = "【分销系统】亲爱的买家,您好,系统根据您下单时的手机号默认给您生成了登录账号与密码,账号:"+mobile+",密码:"+password+",您可通过手机号与密码或验证码登录分销系统查看您的订单状态";
+                        boolean smsFlag = remoteCallService.remoteSendSms(0, 1, mobile, content);
+                        if (!smsFlag) {
+                            // 短信发送失败重试一次
+                            remoteCallService.remoteSendSms(0, 1, mobile, content);
+                        }
+                        // 生成token
+                        String token = JwtUtil.createToken(Integer.valueOf(userId));
+                        // 为了过期续签,将token存入redis,并设置超时时间
+                        redisService.set(token, token, JwtUtil.getExpireTime());
+                        return ResponseJson.success(null,token);
+                    } else {
+                        return ResponseJson.error("该手机号暂未注册", null);
+                    }
+                } else {
+                    return ResponseJson.error(-1, "验证码错误,请确认验证码输入", null);
+                }
+            } else {
+                return ResponseJson.error(-1, "验证码错误, 请重新获取", null);
+            }
+        }
+        return ResponseJson.error(-1, "请获短信取验证码", null);
+    }
+
+    /**
+     * 分销人员登录验证码登录
+     *
+     * @param cmDistribution
+     * @return
+     */
+    @Override
+    public ResponseJson setPassword(CmDistribution cmDistribution, String code) {
+        String mobile = cmDistribution.mobile();
+        if (StringUtils.isBlank(mobile)) {
+            return ResponseJson.error("请输入手机号", null);
+        }
+        if (StringUtils.isBlank(code)) {
+            return ResponseJson.error("请输入验证码", null);
+        }
+        UserLoginVo userBy = cmDistributionMapper.getLoginDistributionByMobile(mobile);
+        if (null==userBy) {
+            return ResponseJson.error("该手机号暂未注册", null);
+        }
+        // 判断redis中是否存在
+        boolean exists = redisService.exists("code:" + mobile);
+        if (exists) {
+            // 查看验证码是否过期
+            long expireTime = redisService.getExpireTime("code:" + mobile);
+            if (expireTime < 0) {
+                return ResponseJson.error(-1, "验证码已失效,请重新获取", null);
+            }
+            // 获取redis手机短信验证码
+            Object randomCode = redisService.get("code:" + mobile);
+
+            if (!ObjectUtils.isEmpty(randomCode)) {
+                if (code.equals(randomCode.toString())) {
+                    redisService.remove("code:" + mobile);
+                    updateCmDistribution(new CmDistribution()
+                            .userId(userBy.getUserId())
+                            .password(Md5Util.md5(cmDistribution.password()))
+                    );
+                    return ResponseJson.success();
+                } else {
+                    return ResponseJson.error(-1, "验证码错误,请确认验证码输入", null);
+                }
+            } else {
+                return ResponseJson.error(-1, "验证码错误, 请重新获取", null);
+            }
+        }
+        return ResponseJson.error(-1, "请获短信取验证码", null);
+    }
+}
+
+

+ 14 - 53
src/main/java/com/caimei365/user/service/impl/CmQuestionnaireServiceImpl.java

@@ -16,8 +16,7 @@ import com.caimei365.user.service.CmQuestionnaireService;
  * @date 2023-07-14
  */
 @Service
-public class CmQuestionnaireServiceImpl implements CmQuestionnaireService
-{
+public class CmQuestionnaireServiceImpl implements CmQuestionnaireService {
     @Autowired
     private CmQuestionnaireMapper cmQuestionnaireMapper;
 
@@ -28,8 +27,7 @@ public class CmQuestionnaireServiceImpl implements CmQuestionnaireService
      * @return 用户需求调查
      */
     @Override
-    public CmQuestionnaire getCmQuestionnaireById(String id)
-    {
+    public CmQuestionnaire getCmQuestionnaireById(String id) {
         return cmQuestionnaireMapper.getCmQuestionnaireById(id);
     }
 
@@ -40,8 +38,7 @@ public class CmQuestionnaireServiceImpl implements CmQuestionnaireService
      * @return String
      */
     @Override
-    public String getById(CmQuestionnaire cmQuestionnaire)
-    {
+    public String getById(CmQuestionnaire cmQuestionnaire) {
         return cmQuestionnaireMapper.getById(cmQuestionnaire);
     }
 
@@ -52,8 +49,7 @@ public class CmQuestionnaireServiceImpl implements CmQuestionnaireService
      * @return List<String>
      */
     @Override
-    public List<String> getByIds(CmQuestionnaire cmQuestionnaire)
-    {
+    public List<String> getByIds(CmQuestionnaire cmQuestionnaire) {
         return cmQuestionnaireMapper.getByIds(cmQuestionnaire);
     }
 
@@ -64,8 +60,7 @@ public class CmQuestionnaireServiceImpl implements CmQuestionnaireService
      * @return 用户需求调查
      */
     @Override
-    public CmQuestionnaire getByCmQuestionnaire(CmQuestionnaire cmQuestionnaire)
-    {
+    public CmQuestionnaire getByCmQuestionnaire(CmQuestionnaire cmQuestionnaire) {
         return cmQuestionnaireMapper.getByCmQuestionnaire(cmQuestionnaire);
     }
 
@@ -76,10 +71,10 @@ public class CmQuestionnaireServiceImpl implements CmQuestionnaireService
      * @return 用户需求调查
      */
     @Override
-    public List<CmQuestionnaire> getCmQuestionnaireList(CmQuestionnaire cmQuestionnaire)
-    {
+    public List<CmQuestionnaire> getCmQuestionnaireList(CmQuestionnaire cmQuestionnaire) {
         return cmQuestionnaireMapper.getCmQuestionnaireList(cmQuestionnaire);
     }
+
     /**
      * 查询用户需求调查记录总数
      *
@@ -87,8 +82,7 @@ public class CmQuestionnaireServiceImpl implements CmQuestionnaireService
      * @return 用户需求调查
      */
     @Override
-    public int getCmQuestionnaireCount(CmQuestionnaire cmQuestionnaire)
-    {
+    public int getCmQuestionnaireCount(CmQuestionnaire cmQuestionnaire) {
         return cmQuestionnaireMapper.getCmQuestionnaireCount(cmQuestionnaire);
     }
 
@@ -99,8 +93,7 @@ public class CmQuestionnaireServiceImpl implements CmQuestionnaireService
      * @return 结果
      */
     @Override
-    public int addCmQuestionnaire(CmQuestionnaire cmQuestionnaire)
-    {
+    public int addCmQuestionnaire(CmQuestionnaire cmQuestionnaire) {
         cmQuestionnaire.setCreateTime(new Date());
         return cmQuestionnaireMapper.addCmQuestionnaire(cmQuestionnaire);
     }
@@ -112,8 +105,7 @@ public class CmQuestionnaireServiceImpl implements CmQuestionnaireService
      * @return 结果
      */
     @Override
-    public int updateCmQuestionnaire(CmQuestionnaire cmQuestionnaire)
-    {
+    public int updateCmQuestionnaire(CmQuestionnaire cmQuestionnaire) {
         cmQuestionnaire.setUpdateTime(new Date());
         return cmQuestionnaireMapper.updateCmQuestionnaire(cmQuestionnaire);
     }
@@ -125,9 +117,8 @@ public class CmQuestionnaireServiceImpl implements CmQuestionnaireService
      * @return 结果
      */
     @Override
-    public int delCmQuestionnaireByIds(String[] ids)
-    {
-        return cmQuestionnaireMapper.updateDelCmQuestionnaireByIds(ids,1);
+    public int delCmQuestionnaireByIds(String[] ids) {
+        return cmQuestionnaireMapper.updateDelCmQuestionnaireByIds(ids, 1);
         //return cmQuestionnaireMapper.delCmQuestionnaireByIds(ids);
     }
 
@@ -138,39 +129,9 @@ public class CmQuestionnaireServiceImpl implements CmQuestionnaireService
      * @return 结果
      */
     @Override
-    public int delCmQuestionnaireById(String id)
-    {
+    public int delCmQuestionnaireById(String id) {
         return cmQuestionnaireMapper.updateCmQuestionnaire(new CmQuestionnaire().setId(id).setDelFlag(1));
         //return cmQuestionnaireMapper.delCmQuestionnaireById(id);
     }
+}
 
-    /**
-     * 批量新增用户需求调查
-     *
-     * @param cmQuestionnaireList 用户需求调查列表
-     * @return 结果
-     */
-    @Override
-    public void batchAddCmQuestionnaire(List<CmQuestionnaire> cmQuestionnaireList)
-    {
-            for (CmQuestionnaire cmQuestionnaire : cmQuestionnaireList)
-            {
-                    cmQuestionnaireMapper.addCmQuestionnaire(cmQuestionnaire);
-            }
-    }
-
-    /**
-     * 批量修改用户需求调查
-     *
-     * @param cmQuestionnaireList 用户需求调查列表
-     * @return 结果
-     */
-    @Override
-    public void batchUpdateCmQuestionnaire(List<CmQuestionnaire> cmQuestionnaireList)
-    {
-            for (CmQuestionnaire cmQuestionnaire : cmQuestionnaireList)
-            {
-                   cmQuestionnaireMapper.updateCmQuestionnaire(cmQuestionnaire);
-            }
-        }
-    }

+ 45 - 4
src/main/java/com/caimei365/user/service/impl/LoginServiceImpl.java

@@ -128,6 +128,10 @@ public class LoginServiceImpl implements LoginService {
             String md5Password = Md5Util.md5(password);
             String dbPassword = baseUser.getPassword();
             if (md5Password.equals(dbPassword)) {
+                // 游客id与用户关联
+                if (StringUtils.isNotBlank(loginPasswordDto.getTouristId()) && StringUtils.isNotEmpty(loginPasswordDto.getTouristId())) {
+                    loginMapper.updateTourist(baseUser.getUserId(), loginPasswordDto.getTouristId());
+                }
                 if (baseUser.getUserIdentity() == 1) {
                     // 协销登录
                     return ResponseJson.success(baseUser);
@@ -294,6 +298,10 @@ public class LoginServiceImpl implements LoginService {
                     redisService.remove("code:" + mobile);
                     // 根据手机号获取用户信息
                     UserLoginVo baseUser = loginMapper.getLoginUserByMobileOrEmail(mobile);
+                    // 游客id与用户关联
+                    if (StringUtils.isNotBlank(loginCodeDto.getTouristId()) && StringUtils.isNotEmpty(loginCodeDto.getTouristId())) {
+                        loginMapper.updateTourist(baseUser.getUserId(), loginCodeDto.getTouristId());
+                    }
                     // 如果前端传入unionId,则存入返回前端
                     baseUser.setUnionId(unionId);
                     if (baseUser.getUserIdentity() == 1) {
@@ -455,8 +463,15 @@ public class LoginServiceImpl implements LoginService {
             seller.setToken(sellerToken);
             seller.setManager(sellerMapper.findManagerByUser(seller.getUserId()));
             seller.setLeaderId(sellerMapper.findLeaderId(seller.getUserId()));
+            // 更新用户openId、unionId 用于后续追踪
+            try {
+                loginMapper.updateUserInfo(openId, unionId, seller.getUserId());
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
             return ResponseJson.success(seller);
         }
+
         // 运营人员授权登录
         return operationAuthLogin(openId, unionId, "mini");
     }
@@ -867,6 +882,22 @@ public class LoginServiceImpl implements LoginService {
             if (92 == loginUser.getShopStatus()) {
                 return ResponseJson.error(-3, "您的企业账号审核未通过", loginUser);
             }
+            // 是否可为机构下单
+            boolean flag = false;
+            // 供应商商品上架平台信息
+            List<String> shopProductList = loginMapper.getShopProductGroudMall(loginUser.getShopId());
+            if (null != shopProductList) {
+                for(String product : shopProductList ) {
+                    if (StringUtils.isNotBlank(product)) {
+                        if (product.contains("4")) {
+                            flag = true;
+                        }
+                    }
+                }
+            } else {
+                flag = false;
+            }
+            loginUser.setShopIsOrder(flag);
         }
         // 会员机构类型:1医美,2生
         if (null != loginUser.getUserIdentity() && loginUser.getUserIdentity() == 2) {
@@ -883,17 +914,27 @@ public class LoginServiceImpl implements LoginService {
             }
             Integer shopID = messageCenterMapper.shopID(loginUser.getUserId());
             Integer newReceiptType = messageCenterMapper.newReceiptType(shopID);
+            // 上架费次数
             Integer listingFeeCount= messageCenterMapper.listingFee(shopID);
+            // 上架费有效期内个数
             Integer listingfeeExpireCount= messageCenterMapper.listingfeeExpire(shopID);
+            // 有免除上架费的次数
             Integer receStatctCount=messageCenterMapper.receStatct(shopID);
-            Integer listingFee=0;
-            if(listingFeeCount>0 && listingfeeExpireCount>0){
-                if(receStatctCount<=0){
-                    listingFee=1;
+            Integer listingFee = 0;
+            // 如果上架费次数为 0 ;所有上架费都不在在生效时间; 没有免除过上架费;
+            if(listingFeeCount > 0 && listingfeeExpireCount == 0){
+                if(receStatctCount <= 0){
+                    listingFee = 1;
                 }
             }
             loginUser.setListingFee(listingFee);
         }
+        // 更新用户openId、unionId 用于后续追踪
+        try {
+            loginMapper.updateUserInfo(loginUser.getOpenId(), loginUser.getUnionId(), loginUser.getUserId());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
 
         // 登录异步赠送10采美豆
         asyncService.loginUpdateBeans(loginUser.getUserId(), loginUser.getUserIdentity());

+ 163 - 6
src/main/java/com/caimei365/user/service/impl/RegisterServiceImpl.java

@@ -697,10 +697,11 @@ public class RegisterServiceImpl implements RegisterService {
         if (nameCheck != null) {
             return ResponseJson.error(nameCheck);
         }
-        String socialCodeResult = ValidateUtil.validateSocialCreditCode(upgradeDto.getSocialCreditCode());
+        // 版本去除 营业执照编号验证
+        /*String socialCodeResult = ValidateUtil.validateSocialCreditCode(upgradeDto.getSocialCreditCode());
         if (socialCodeResult != null) {
             return ResponseJson.error(socialCodeResult);
-        }
+        }*/
         // 更新用户数据 user
         UserPo user = new UserPo();
         user.setUserId(upgradeDto.getUserId());
@@ -742,7 +743,9 @@ public class RegisterServiceImpl implements RegisterService {
         // 营业执照
         club.setBusinessLicense(upgradeDto.getBusinessLicense());
         // 统一社会信用代码
-        club.setSocialCreditCode(upgradeDto.getSocialCreditCode());
+        if (StringUtils.isNotBlank(upgradeDto.getSocialCreditCode())) {
+            club.setSocialCreditCode(upgradeDto.getSocialCreditCode());
+        }
         // 分类: 1医美, 2生美
         club.setFirstClubType(upgradeDto.getFirstClubType());
         if (upgradeDto.getFirstClubType() == 1) {
@@ -1099,9 +1102,9 @@ public class RegisterServiceImpl implements RegisterService {
         if (StringUtils.isBlank(shopRegisterDto.getBindMobile())) {
             return ResponseJson.error("参数异常:企业绑定手机号不能为空!");
         }
-        if (StringUtils.isBlank(shopRegisterDto.getPassword())) {
-            return ResponseJson.error("参数异常:密码不能为空!");
-        }
+//        if (StringUtils.isBlank(shopRegisterDto.getPassword())) {
+//            return ResponseJson.error("参数异常:密码不能为空!");
+//        }
         if (StringUtils.isBlank(passWordConfirm)) {
             return ResponseJson.error("参数异常:确认密码不能为空!");
         }
@@ -1708,6 +1711,160 @@ public class RegisterServiceImpl implements RegisterService {
         return shortLink;
     }
 
+    /**
+     * 功能描述:分销人员生成机构
+     *
+     * @param clubRegisterDto
+     * @param headers
+     * @return [clubRegisterDto, headers]
+     * @auther: Kaick
+     * @date: 2023/10/10 11:28
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public ResponseJson distributionClubRegister(ClubRegisterDto clubRegisterDto, HttpHeaders headers) {
+        // 打印IP
+        String ip = headers.getFirst("X-CLIENT-IP");
+        log.info("机构注册 X-CLIENT-IP : " + ip);
+        // 参数校验
+        if (StringUtils.isBlank(clubRegisterDto.getName())) {
+            return ResponseJson.error("参数异常:名称不能为空!");
+        }
+        // 参数校验
+        if (StringUtils.isBlank(clubRegisterDto.getUserName())) {
+            return ResponseJson.error("参数异常:用户名不能为空!");
+        }
+        if (StringUtils.isBlank(clubRegisterDto.getBindMobile())) {
+            return ResponseJson.error("参数异常:企业绑定手机号不能为空!");
+        }
+        //机构重复则不注册
+        CmUser byUser = baseMapper.getByUser(new CmUser()
+                .userIdentity("8")
+                .validFlag("1")
+                .bindMobile(clubRegisterDto.getBindMobile())
+        );
+        if (null!=byUser) {
+            return ResponseJson.success(String.valueOf(byUser.clubID()), null);
+        }
+        clubRegisterDto.setPassword("1111aaaa");
+        // 获取ip所在地
+        String ipAddress = "";
+        Integer provinceId = null;
+        Integer cityId = null;
+        try {
+            ipAddress = IpUtil.recordIp(ip);
+            Map<String, String> map = IpUtil.recordAddress(ip);
+            // 省
+            String regionPro = map.get("regionPro");
+            provinceId = registerMapper.selProvince(regionPro);
+            // 市
+            String regionCity = map.get("regionCity");
+            cityId = registerMapper.selCity(regionCity);
+
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        log.info("ip所在地====》" + ipAddress);
+        /*
+            组装用户数据 user
+         */
+        UserPo user = new UserPo();
+        // 设置日期时间格式
+        Date date = new Date();
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String current = dateFormat.format(date);
+        // 注册时间
+        user.setRegisterTime(current);
+        // 注册IP
+        user.setRegisterIp(ip);
+        // 注册IP所在地
+        user.setIpAddress(ipAddress);
+        // 注册来源: 0网站 1小程序
+        user.setSource(clubRegisterDto.getSource());
+        // 用户类型,供应商1,会员机构3,普通机构4
+        user.setRegisterUserTypeId(4);
+        // 采美默认组织机构0
+        user.setOrganizeId(0);
+        // 用户名
+        user.setName(clubRegisterDto.getName());
+        user.setUserName(clubRegisterDto.getUserName());
+        // 绑定手机号
+        user.setBindMobile(clubRegisterDto.getBindMobile());
+        // 用户身份: 1协销 2会员机构 3供应商 4普通机构,8分销人员生成机构
+        user.setUserIdentity(8);
+        // 用户权限: 2会员机构 3供应商 4协销 5普通机构
+        user.setUserPermission(5);
+        // 是否已经引导过(机构升级:0否,1是)
+        user.setGuideFlag(0);
+        // 设置机构
+        user.setClubStatus(92);
+        // 设置密码
+        user.setPassword(Md5Util.md5(clubRegisterDto.getPassword()));
+        // 同意协议
+        user.setAgreeFlag(1);
+        // 用户状态,1正常,0冻结
+        user.setValidFlag(0);
+        //采美豆
+        user.setUserBeans(0);
+        // 协销Id,默认采美官方
+        user.setServiceProviderId(clubRegisterDto.getSpId());
+        /*
+            保存数据库 user
+         */
+        int insertFlag = registerMapper.insertClubUser(user);
+        log.info("插入数据库User表,获得userId:" + user.getUserId());
+        if (insertFlag < 1) {
+            throw new RuntimeException("插入数据库异常user:" + user.toString());
+        }
+
+        /*
+          保存用户状态
+         */
+        List<UserPo> userPos = registerMapper.selUser(current);
+        for (UserPo userInfo : userPos) {
+            registerMapper.insertOrgan(userInfo.getUserId());
+        }
+        /*
+            组装机构数据
+         */
+        ClubPo club = new ClubPo();
+        // 机构名称
+        club.setName(user.getName());
+        // 联系手机
+        club.setContractMobile(user.getBindMobile());
+        // 联系人
+        club.setLinkMan(user.getUserName());
+        // 用户Id
+        club.setUserId(user.getUserId());
+        // 注册时间
+        club.setAddTime(current);
+        // 状态设置
+        club.setStatus(92);
+        // 协销Id(spId)
+        club.setServiceProviderId(clubRegisterDto.getSpId());
+        if (4 == user.getUserIdentity()) {
+            if (null != provinceId) {
+                club.setProvinceId(provinceId);
+            }
+            if (null != cityId) {
+                club.setCityId(cityId);
+            }
+        }
+        /*
+            保存数据库 club
+         */
+        int insertClubFlag = registerMapper.insertClub(club);
+        log.info("插入数据库club表,获得clubId:" + club.getClubId());
+        if (insertClubFlag < 1) {
+            throw new RuntimeException("插入数据库异常club:" + club.toString());
+        }
+        // user更新clubId
+        user.setClubId(club.getClubId());
+        registerMapper.updateUserClubId(user.getUserId(), club.getClubId());
+
+        return ResponseJson.success(String.valueOf(club.getClubId()), null);
+    }
+
 //    public static void main(String[] args) throws ParseException {
 //        Date d=new Date();
 //        //1.日期格式

+ 161 - 15
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.vo.*;
 import com.caimei365.user.service.SellerService;
+import com.caimei365.user.utils.ImageUtils;
 import com.caimei365.user.utils.JwtUtil;
 import com.caimei365.user.utils.MathUtil;
 import com.caimei365.user.utils.Md5Util;
@@ -19,17 +20,20 @@ import io.swagger.models.auth.In;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import java.util.stream.Collectors;
 
 /**
  * Description
@@ -40,7 +44,8 @@ import java.util.regex.Pattern;
 @Slf4j
 @Service
 public class SellerServiceImpl implements SellerService {
-
+    @Value("${caimei.wwwDomain}")
+    private String wwwDomain;
     @Resource
     private RedisService redisService;
     @Resource
@@ -55,6 +60,8 @@ public class SellerServiceImpl implements SellerService {
     private SuperVipMapper vipMapper;
     @Resource
     private LoginMapper loginMapper;
+    @Resource
+    private ClubMapper clubMapper;
 
     /**
      * 协销机构列表
@@ -70,7 +77,21 @@ public class SellerServiceImpl implements SellerService {
      * @return
      */
     @Override
-    public ResponseJson<PageInfo<ClubVo>> getClubList(Integer serviceProviderId, Integer status, Integer type, String name, Integer userIdentity, Integer groupServiceId, Integer pageNum, Integer pageSize) {
+    public ResponseJson<PageInfo<ClubVo>> getClubList(Integer serviceProviderId, Integer status, Integer type, String name, Integer userIdentity, Integer groupServiceId, String startTime, String endTime, Integer pageNum, Integer pageSize) {
+        // 处理时间格式
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        try {
+            if (StringUtils.isNotBlank(startTime)) {
+                String start = dateFormat.format(dateFormat.parse(startTime));
+                startTime = start + " 00:00:00";
+            }
+            if (StringUtils.isNotBlank(endTime)){
+                String end = dateFormat.format(dateFormat.parse(endTime));
+                endTime = end + " 23:59:59";
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
         // 获取协销用户下的机构列表
         List<ClubVo> clubList = new ArrayList<ClubVo>();
         List<Integer> serviceIds = new ArrayList<Integer>();
@@ -79,12 +100,12 @@ public class SellerServiceImpl implements SellerService {
                 return ResponseJson.success();
             }else{
                 PageHelper.startPage(pageNum, pageSize);
-                clubList = sellerMapper.findClubs(serviceProviderId, status, name, userIdentity, type, null);
+                clubList = sellerMapper.findClubs(serviceProviderId, status, name, userIdentity, type, startTime, endTime, null);
             }
         } else if (2 == type) {
             if (null != groupServiceId && groupServiceId > 0) {
                 PageHelper.startPage(pageNum, pageSize);
-                clubList = sellerMapper.findClubs(groupServiceId, status, name, userIdentity, 1, null);
+                clubList = sellerMapper.findClubs(groupServiceId, status, name, userIdentity, 1,  startTime, endTime, null);
             } else {
                 Integer leaderId = sellerMapper.findLeaderIdByServiceId(serviceProviderId);
                 Integer managerId = sellerMapper.findmanagerIdByServiceId(serviceProviderId);
@@ -95,7 +116,7 @@ public class SellerServiceImpl implements SellerService {
                     serviceIds = sellerMapper.findAllServiceIds(serviceProviderId);
                 }
                 PageHelper.startPage(pageNum, pageSize);
-                clubList = sellerMapper.findClubs(serviceProviderId, status, name, userIdentity, type, serviceIds);
+                clubList = sellerMapper.findClubs(serviceProviderId, status, name, userIdentity, type, startTime, endTime, serviceIds);
             }
         }
         for (ClubVo club : clubList) {
@@ -109,15 +130,7 @@ public class SellerServiceImpl implements SellerService {
             } else {
                 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);
+            setClubNumber(club);
         }
         PageInfo<ClubVo> pageData = new PageInfo<>(clubList);
         return ResponseJson.success(pageData);
@@ -140,7 +153,7 @@ public class SellerServiceImpl implements SellerService {
     public ResponseJson<Map<String, Object>> getLivelyClubList(Integer serviceProviderId, Integer status, Integer type, String name, Integer userIdentity, Integer pageNum, Integer pageSize) {
         PageHelper.startPage(pageNum, pageSize);
         Map<String, Object> map = new HashMap<>();
-        map.put("clubList", new PageInfo<>(sellerMapper.findClubs(serviceProviderId, status, name, userIdentity, type, null)));
+        map.put("clubList", new PageInfo<>(sellerMapper.findClubs(serviceProviderId, status, name, userIdentity, type,null,null, null)));
         return ResponseJson.success(map);
     }
     /**
@@ -386,6 +399,7 @@ public class SellerServiceImpl implements SellerService {
         for (CmBehaviorRecordVo cmBehaviorRecordVo : behaviorRecordYesterdayClubFrom) {
             String pageLabel = sellerMapper.getBehaviorRecordYesterdayPageLabel(spId, cmBehaviorRecordVo.getClubId(), accessTime);
             cmBehaviorRecordVo.setPageLabel(pageLabel);
+            cmBehaviorRecordVo.setAccessDuration(calculationTime(cmBehaviorRecordVo.getAccessDuration()));
             if (cmBehaviorRecordVo.getProductID() != 0 && cmBehaviorRecordVo.getPageType().equals("6") ) {
                 ProductItemVo productShown = shopMapper.getProductShown(cmBehaviorRecordVo.getProductID());
                 cmBehaviorRecordVo.setTitleId(cmBehaviorRecordVo.getProductID());
@@ -423,4 +437,136 @@ public class SellerServiceImpl implements SellerService {
         return ResponseJson.success(serviceProviderVos);
     }
 
+    /**
+     * 机构重点访问页面
+     *
+     * @param clubId
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @Override
+    public ResponseJson<PageInfo<RetuenDataVo>> getClubRecord(Integer clubId, int pageNum, int pageSize) {
+
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        // 获取机构访问日期
+        List<RetuenDataVo> data = sellerMapper.getClubAccessDate(clubId);
+        // 访问时间集合
+        List<String> access = data.stream().map(RetuenDataVo::getAccessDate).collect(Collectors.toList());
+        // 访问来源数据
+        List<BehaviorRecodeVo> region = clubMapper.selRegion(null, null, 1, access);
+
+        // 机构访问记录
+        List<BehaviorRecodeVo> recordDataList = sellerMapper.getClubKeynoteRecord(clubId, access);
+        String format = "";
+        // 组装数据
+        if (null != data && data.size() > 0) {
+            for (RetuenDataVo rd : data) {
+                // 该日期下机构访问记录
+                List<BehaviorRecodeVo> recordList = recordDataList.stream().filter(r -> r.getAccessDate().equals(rd.getAccessDate())).collect(Collectors.toList());
+
+                for (BehaviorRecodeVo record : recordList) {
+                    // 图片处理
+                    if (StringUtils.isNotBlank(record.getProductImage())) {
+                        record.setProductImage(ImageUtils.getImageURL("product", record.getProductImage(), 0, wwwDomain));
+                    }
+                    String time = calculationTime(record.getAccessDuration());
+                    record.setAccessDuration(time);
+                    record.setAccessNewTime(dateFormat.format(record.getAccessTime()));
+                    String s = simpleDateFormat.format(record.getAccessTime());
+
+                    // 访问来源
+                    if (region.size() != 0) {
+                        for (BehaviorRecodeVo behaviorRecord : region) {
+                            format = simpleDateFormat.format(behaviorRecord.getAccessTime());
+                            if (StringUtils.isNotBlank(record.getPageType()) && StringUtils.isNotBlank(behaviorRecord.getPageType())) {
+                                if (s.equals(format)) {
+                                    record.setAccessSource(behaviorRecord.getAccessSource());
+                                }
+                            }
+                        }
+                    }
+                }
+                rd.setRecord(recordList);
+            }
+            // 没有重点访问页面数据删除不回显
+            data.removeIf(d -> d.getRecord().size() <= 0 );
+        }
+        PageHelper.startPage(pageNum, pageSize);
+        PageInfo<RetuenDataVo> page = new PageInfo<>(data);
+        return ResponseJson.success(page);
+    }
+
+    /**
+     * 协销不活跃机构列表
+     *
+     * @param serviceProviderId
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @Override
+    public ResponseJson<PageInfo<ClubVo>> getUnActiveClubList(Integer serviceProviderId, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<ClubVo> unActiveClub = sellerMapper.getUnActiveClub(serviceProviderId);
+        for (ClubVo club : unActiveClub) {
+            setClubNumber(club);
+        }
+        PageInfo<ClubVo> page = new PageInfo<>(unActiveClub);
+        return ResponseJson.success(page);
+    }
+
+    /**
+     * 机构编号
+     * @param club
+     */
+    public void setClubNumber(ClubVo club) {
+        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);
+    }
+
+    /**
+     * 时间计算
+     * @param recordTime
+     * @return
+     */
+    public String calculationTime(String recordTime){
+        double doc = Double.parseDouble(recordTime);
+        int num = (int)doc;
+        //小时
+        int HH = 0;
+        // 分钟
+        int mm = 0;
+        //秒
+        int ss = 0;
+        int item = num / 1000;
+        if ((item / 60) >0) {
+            mm = item / 60;
+            ss = item % 60;
+        } else {
+            ss = item;
+        }
+        if ((mm / 60) >0) {
+            HH = mm / 60;
+            mm = mm % 60;
+        }
+        String  str= HH+":"+mm+":"+ss;
+        SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
+        Date parse = null;
+        try {
+            parse = dateFormat.parse(str);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        String format = dateFormat.format(parse);
+        return format;
+    }
 }

+ 60 - 4
src/main/java/com/caimei365/user/service/impl/ShopServiceImpl.java

@@ -2,6 +2,7 @@ package com.caimei365.user.service.impl;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.caimei365.user.components.RedisService;
 import com.caimei365.user.feign.CommodityFeign;
 import com.caimei365.user.mapper.*;
 import com.caimei365.user.model.ResponseJson;
@@ -12,10 +13,7 @@ import com.caimei365.user.model.dto.ShopUpdateDto;
 import com.caimei365.user.model.po.*;
 import com.caimei365.user.model.vo.*;
 import com.caimei365.user.service.ShopService;
-import com.caimei365.user.utils.DateUtil;
-import com.caimei365.user.utils.GenerateUtils;
-import com.caimei365.user.utils.ImageUtils;
-import com.caimei365.user.utils.OssUtil;
+import com.caimei365.user.utils.*;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
@@ -42,12 +40,16 @@ public class ShopServiceImpl implements ShopService {
     @Value("${caimei.wwwDomain}")
     private String wwwDomain;
     @Resource
+    private RedisService redisService;
+    @Resource
     private CommodityFeign commodityFeign;
     @Resource
     private BaseMapper baseMapper;
     @Resource
     private ShopMapper shopMapper;
     @Resource
+    private LoginMapper loginMapper;
+    @Resource
     private ArticleMapper articleMapper;
     @Resource
     private BaikeProductMapper baikeProductMapper;
@@ -57,6 +59,60 @@ public class ShopServiceImpl implements ShopService {
     private String active;
 
 
+    /**
+     * 供应商快捷登录
+     *
+     * @param userId
+     * @return
+     */
+    @Override
+    public ResponseJson<UserLoginVo> shortcutLogin(Integer userId) {
+        UserLoginVo userLoginVo = shopMapper.getShopByUserId(userId);
+        // 生成token给用户
+        String token = JwtUtil.createToken(userId);
+        // 为了过期续签,将token存入redis,并设置超时时间
+        redisService.set(token, token, JwtUtil.getExpireTime());
+        userLoginVo.setToken(token);
+        if (null != userLoginVo) {
+            if (null != userLoginVo.getShopId()) {
+                if (null != userLoginVo.getShopStatus() && null != userLoginVo.getUserIdentity() && 3 == userLoginVo.getUserIdentity()) {
+
+                    if (3 == userLoginVo.getShopStatus()) {
+                        return ResponseJson.error(-1, "您的企业账号正在加速审核中,审核通过后即可登录", userLoginVo);
+                    }
+                    if (91 == userLoginVo.getShopStatus()) {
+                        return ResponseJson.error(-1, "您的企业账号已被冻结,请联系客服处理", userLoginVo);
+                    }
+                    if (92 == userLoginVo.getShopStatus()) {
+                        return ResponseJson.error(-3, "您的企业账号审核未通过", userLoginVo);
+                    }
+                }
+                // 是否可为机构下单
+                boolean flag = false;
+                // 供应商商品上架平台信息
+                List<String> shopProductList = loginMapper.getShopProductGroudMall(userLoginVo.getShopId());
+                if (null != shopProductList) {
+                    for(String product : shopProductList ) {
+                        if (StringUtils.isNotBlank(product)) {
+                            // 商品上架平台是否在联合丽格上架
+                            if (product.contains("4")) {
+                                flag = true;
+                            }
+                        }
+                    }
+                } else {
+                    flag = false;
+                }
+                userLoginVo.setShopIsOrder(flag);
+            } else {
+                return ResponseJson.error(-1, "该账号未成为供应商", null);
+            }
+        } else {
+            return ResponseJson.error(-1, "用户数据异常", null);
+        }
+        return ResponseJson.success("登录成功", userLoginVo);
+    }
+
     /**
      * 根据用户Id查询供应商资料
      *

+ 33 - 0
src/main/java/com/caimei365/user/utils/BeanUtil.java

@@ -0,0 +1,33 @@
+package com.caimei365.user.utils;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.beans.BeanUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author :Kaick
+ * @date :Created in 2023/10/27
+ * @description:BeanUtil
+ */
+public class BeanUtil {
+
+    public static <T, S> T setValue(S source, Class<T> clazz) {
+        if (null == source) {
+            return null;
+        }
+        T target = BeanUtils.instantiate(clazz);
+        BeanUtils.copyProperties(source, target);
+        return target;
+    }
+
+    public static <T, S> List<T> setValues(List<S> sourceList, Class<T> target) {
+        if (CollectionUtils.isEmpty(sourceList)) {
+            return null;
+        }
+        List<T> targetList = new ArrayList<>(sourceList.size());
+        sourceList.forEach(s -> targetList.add(setValue(s, target)));
+        return targetList;
+    }
+}

+ 7 - 1
src/main/java/com/caimei365/user/utils/DateUtil.java

@@ -123,6 +123,12 @@ public class DateUtil {
     public static String formatDateTime(Date date) {
         return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
     }
+    /**
+     * 得到日期时间字符串,转换格式(yyyy-MM-dd HH:mm:ss)
+     */
+    public static String formatDateTime(Date date,String format) {
+        return new SimpleDateFormat(format!=null?format:"yyyy-MM-dd HH:mm:ss").format(date);
+    }
 
     /**
      * date2比date1多的天数
@@ -159,4 +165,4 @@ public class DateUtil {
             return day2 - day1;
         }
     }
-}
+}

+ 1 - 1
src/main/resources/bootstrap.yml

@@ -17,4 +17,4 @@ mybatis:
   # 扫描classpath中mapper目录下的映射配置文件,针对于映射文件放到了resources目录下
   mapper-locations: classpath:/mapper/*.xml
   # 定义包别名,使用pojo时可以直接使用pojo的类型名称不用加包名
-  type-aliases-package: com.caimei365.user.model
+  type-aliases-package: com.caimei365.user.model

+ 474 - 4
src/main/resources/mapper/BaseMapper.xml

@@ -11,6 +11,14 @@
         set bindMobile = #{mobile}
         where userID = #{userId}
     </update>
+    <update id="updateImageByUserId">
+        update user
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="image != null and image != ''">image = #{image},</if>
+        </trim>
+        where userId = #{userId}
+    </update>
+
     <update id="updateShopMobileByShopId">
         update shop
         set contractMobile = #{mobile}
@@ -40,7 +48,7 @@
         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)
+          and u.userIdentity in (1, 2, 3, 4,7)
         UNION
         SELECT u.userID
         FROM USER u
@@ -205,14 +213,476 @@
     <select id="getByUserId" resultType="java.lang.Integer">
         <if test="userType != null">
             <if test="userType == 1">
-            SELECT userID from  club   WHERE  clubId = #{id}
+                SELECT userID from club WHERE clubId = #{id}
             </if>
             <if test="userType == 2">
-            SELECT userID from  shop   WHERE  shopId = #{id}
+                SELECT userID from shop WHERE shopId = #{id}
             </if>
             <if test="userType == 3">
-            SELECT userID from  serviceprovider  WHERE  serviceProviderID = #{id}
+                SELECT userID from serviceprovider WHERE serviceProviderID = #{id}
+            </if>
+        </if>
+    </select>
+    <select id="getByMobile" resultType="String">
+       select bindMobile from user where  userIdentity=#{userIdentity} and  userId=#{userId}
+    </select>
+    <select id="getByUserCount" resultType="java.lang.Integer">
+        SELECT count(1) from user
+        <where>
+            <if test="userID != null  and userID != ''">
+                and user.userID
+                <if test="userID.toUpperCase().indexOf('=')==-1">
+                    = #{userID}
+                </if>
+                <if test="userID.toUpperCase().indexOf('=')!=-1">
+                    <if test="userID.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="userID.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="userIDIn" collection="userID.substring(userID.toUpperCase().indexOf('=')+1,userID.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{userIDIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="userOrganizeID != null  and userOrganizeID != ''">
+                and user.userOrganizeID
+                <if test="userOrganizeID.toUpperCase().indexOf('=')==-1">
+                    = #{userOrganizeID}
+                </if>
+                <if test="userOrganizeID.toUpperCase().indexOf('=')!=-1">
+                    <if test="userOrganizeID.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="userOrganizeID.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="typeIn" collection="userOrganizeID.substring(userOrganizeID.toUpperCase().indexOf('=')+1,userOrganizeID.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{typeIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="account != null  and account != ''"> and user.account = #{account}</if>
+            <if test="mobile != null  and mobile != ''"> and user.mobile = #{mobile}</if>
+            <if test="bindMobile != null  and bindMobile != ''"> and user.bindMobile = #{bindMobile}</if>
+            <if test="userPermission != null "> and user.userPermission = #{userPermission}</if>
+            <if test="userIdentity != null  and userIdentity != ''">
+                and user.userIdentity
+                <if test="userIdentity.toUpperCase().indexOf('=')==-1">
+                    = #{userIdentity}
+                </if>
+                <if test="userIdentity.toUpperCase().indexOf('=')!=-1">
+                    <if test="userIdentity.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="userIdentity.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="typeIn" collection="userIdentity.substring(userIdentity.toUpperCase().indexOf('=')+1,userIdentity.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{typeIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="email != null  and email != ''"> and user.email = #{email}</if>
+            <if test="userName != null  and userName != ''"> and user.userName like concat('%', #{userName}, '%')</if>
+            <if test="realName != null  and realName != ''"> and user.realName like concat('%', #{realName}, '%')</if>
+            <if test="source != null  and source != ''"> and user.source = #{source}</if>
+            <if test="image != null  and image != ''"> and user.image = #{image}</if>
+            <if test="password != null  and password != ''"> and user.password = #{password}</if>
+            <if test="name != null  and name != ''"> and user.name like concat('%', #{name}, '%')</if>
+            <if test="registerUserTypeID != null  and registerUserTypeID != ''">
+                and user.registerUserTypeID
+                <if test="registerUserTypeID.toUpperCase().indexOf('=')==-1">
+                    = #{registerUserTypeID}
+                </if>
+                <if test="registerUserTypeID.toUpperCase().indexOf('=')!=-1">
+                    <if test="registerUserTypeID.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="registerUserTypeID.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="typeIn" collection="registerUserTypeID.substring(registerUserTypeID.toUpperCase().indexOf('=')+1,registerUserTypeID.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{typeIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="manufacturerStatus != null "> and user.manufacturerStatus = #{manufacturerStatus}</if>
+            <if test="shopID != null "> and user.shopID = #{shopID}</if>
+            <if test="auditStatus != null  and auditStatus != ''"> and user.auditStatus = #{auditStatus}</if>
+            <if test="auditTime != null  and auditTime != ''"> and user.auditTime = #{auditTime}</if>
+            <if test="auditNote != null  and auditNote != ''"> and user.auditNote = #{auditNote}</if>
+            <if test="registerTime != null  and registerTime != ''"> and user.registerTime = #{registerTime}</if>
+            <if test="registerIP != null  and registerIP != ''"> and user.registerIP = #{registerIP}</if>
+            <if test="ipAddress != null  and ipAddress != ''"> and user.ipAddress = #{ipAddress}</if>
+            <if test="loginTime != null  and loginTime != ''"> and user.loginTime = #{loginTime}</if>
+            <if test="loginIP != null  and loginIP != ''"> and user.loginIP = #{loginIP}</if>
+            <if test="validFlag != null  and validFlag != ''"> and user.validFlag = #{validFlag}</if>
+            <if test="clubStatus != null "> and user.clubStatus = #{clubStatus}</if>
+            <if test="clubID != null "> and user.clubID = #{clubID}</if>
+            <if test="agreeFlag != null  and agreeFlag != ''"> and user.agreeFlag = #{agreeFlag}</if>
+            <if test="serviceProviderStatus != null "> and user.serviceProviderStatus = #{serviceProviderStatus}</if>
+            <if test="serviceProviderID != null "> and user.serviceProviderID = #{serviceProviderID}</if>
+            <if test="userMoney != null "> and user.userMoney = #{userMoney}</if>
+            <if test="ableUserMoney != null "> and user.ableUserMoney = #{ableUserMoney}</if>
+            <if test="logoffTime != null  and logoffTime != ''"> and user.logoffTime = #{logoffTime}</if>
+            <if test="appKey != null  and appKey != ''"> and user.appKey = #{appKey}</if>
+            <if test="appSecret != null  and appSecret != ''"> and user.appSecret = #{appSecret}</if>
+            <if test="scanFlag != null "> and user.scanFlag = #{scanFlag}</if>
+            <if test="userBeans != null "> and user.userBeans = #{userBeans}</if>
+            <if test="guideFlag != null "> and user.guideFlag = #{guideFlag}</if>
+            <if test="loginFailTime != null "> and user.loginFailTime = #{loginFailTime}</if>
+            <if test="tipStatus != null  and tipStatus != ''"> and user.tipStatus = #{tipStatus}</if>
+            <if test="onlineMoney != null "> and user.onlineMoney = #{onlineMoney}</if>
+        </where>
+        group by user.userID
+        order by user.loginTime desc
+    </select>
+
+    <insert id="addUser" parameterType="CmUser" useGeneratedKeys="true" keyProperty="userID">
+        insert into user
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="userID != null and userID != ''">userID,</if>
+            <if test="userOrganizeID != null">userOrganizeID,</if>
+            <if test="account != null and account != ''">account,</if>
+            <if test="mobile != null and mobile != ''">mobile,</if>
+            <if test="bindMobile != null and bindMobile != ''">bindMobile,</if>
+            <if test="userPermission != null">userPermission,</if>
+            <if test="userIdentity != null">userIdentity,</if>
+            <if test="email != null and email != ''">email,</if>
+            <if test="userName != null and userName != ''">userName,</if>
+            <if test="realName != null and realName != ''">realName,</if>
+            <if test="source != null and source != ''">source,</if>
+            <if test="image != null and image != ''">image,</if>
+            <if test="password != null and password != ''">password,</if>
+            <if test="name != null and name != ''">name,</if>
+            <if test="registerUserTypeID != null and registerUserTypeID != ''">registerUserTypeID,</if>
+            <if test="manufacturerStatus != null">manufacturerStatus,</if>
+            <if test="shopID != null">shopID,</if>
+            <if test="auditStatus != null and auditStatus != ''">auditStatus,</if>
+            <if test="auditTime != null and auditTime != ''">auditTime,</if>
+            <if test="auditNote != null and auditNote != ''">auditNote,</if>
+            <if test="registerTime != null and registerTime != ''">registerTime,</if>
+            <if test="registerIP != null and registerIP != ''">registerIP,</if>
+            <if test="ipAddress != null and ipAddress != ''">ipAddress,</if>
+            <if test="loginTime != null and loginTime != ''">loginTime,</if>
+            <if test="loginIP != null and loginIP != ''">loginIP,</if>
+            <if test="validFlag != null and validFlag != ''">validFlag,</if>
+            <if test="clubStatus != null">clubStatus,</if>
+            <if test="clubID != null">clubID,</if>
+            <if test="agreeFlag != null and agreeFlag != ''">agreeFlag,</if>
+            <if test="serviceProviderStatus != null">serviceProviderStatus,</if>
+            <if test="serviceProviderID != null">serviceProviderID,</if>
+            <if test="userMoney != null">userMoney,</if>
+            <if test="ableUserMoney != null">ableUserMoney,</if>
+            <if test="logoffTime != null and logoffTime != ''">logoffTime,</if>
+            <if test="appKey != null and appKey != ''">appKey,</if>
+            <if test="appSecret != null and appSecret != ''">appSecret,</if>
+            <if test="scanFlag != null">scanFlag,</if>
+            <if test="userBeans != null">userBeans,</if>
+            <if test="guideFlag != null">guideFlag,</if>
+            <if test="loginFailTime != null">loginFailTime,</if>
+            <if test="tipStatus != null and tipStatus != ''">tipStatus,</if>
+            <if test="onlineMoney != null">onlineMoney,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="userID != null and userID != ''">#{userID},</if>
+            <if test="userOrganizeID != null">#{userOrganizeID},</if>
+            <if test="account != null and account != ''">#{account},</if>
+            <if test="mobile != null and mobile != ''">#{mobile},</if>
+            <if test="bindMobile != null and bindMobile != ''">#{bindMobile},</if>
+            <if test="userPermission != null">#{userPermission},</if>
+            <if test="userIdentity != null">#{userIdentity},</if>
+            <if test="email != null and email != ''">#{email},</if>
+            <if test="userName != null and userName != ''">#{userName},</if>
+            <if test="realName != null and realName != ''">#{realName},</if>
+            <if test="source != null and source != ''">#{source},</if>
+            <if test="image != null and image != ''">#{image},</if>
+            <if test="password != null and password != ''">#{password},</if>
+            <if test="name != null and name != ''">#{name},</if>
+            <if test="registerUserTypeID != null and registerUserTypeID != ''">#{registerUserTypeID},</if>
+            <if test="manufacturerStatus != null">#{manufacturerStatus},</if>
+            <if test="shopID != null">#{shopID},</if>
+            <if test="auditStatus != null and auditStatus != ''">#{auditStatus},</if>
+            <if test="auditTime != null and auditTime != ''">#{auditTime},</if>
+            <if test="auditNote != null and auditNote != ''">#{auditNote},</if>
+            <if test="registerTime != null and registerTime != ''">#{registerTime},</if>
+            <if test="registerIP != null and registerIP != ''">#{registerIP},</if>
+            <if test="ipAddress != null and ipAddress != ''">#{ipAddress},</if>
+            <if test="loginTime != null and loginTime != ''">#{loginTime},</if>
+            <if test="loginIP != null and loginIP != ''">#{loginIP},</if>
+            <if test="validFlag != null and validFlag != ''">#{validFlag},</if>
+            <if test="clubStatus != null">#{clubStatus},</if>
+            <if test="clubID != null">#{clubID},</if>
+            <if test="agreeFlag != null and agreeFlag != ''">#{agreeFlag},</if>
+            <if test="serviceProviderStatus != null">#{serviceProviderStatus},</if>
+            <if test="serviceProviderID != null">#{serviceProviderID},</if>
+            <if test="userMoney != null">#{userMoney},</if>
+            <if test="ableUserMoney != null">#{ableUserMoney},</if>
+            <if test="logoffTime != null and logoffTime != ''">#{logoffTime},</if>
+            <if test="appKey != null and appKey != ''">#{appKey},</if>
+            <if test="appSecret != null and appSecret != ''">#{appSecret},</if>
+            <if test="scanFlag != null">#{scanFlag},</if>
+            <if test="userBeans != null">#{userBeans},</if>
+            <if test="guideFlag != null">#{guideFlag},</if>
+            <if test="loginFailTime != null">#{loginFailTime},</if>
+            <if test="tipStatus != null and tipStatus != ''">#{tipStatus},</if>
+            <if test="onlineMoney != null">#{onlineMoney},</if>
+        </trim>
+    </insert>
+
+    <update id="updateUser" parameterType="CmUser">
+        update user
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="userOrganizeID != null">userOrganizeID = #{userOrganizeID},</if>
+            <if test="account != null and account != ''">account = #{account},</if>
+            <if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
+            <if test="bindMobile != null and bindMobile != ''">bindMobile = #{bindMobile},</if>
+            <if test="userPermission != null">userPermission = #{userPermission},</if>
+            <if test="userIdentity != null">userIdentity = #{userIdentity},</if>
+            <if test="email != null and email != ''">email = #{email},</if>
+            <if test="userName != null and userName != ''">userName = #{userName},</if>
+            <if test="realName != null and realName != ''">realName = #{realName},</if>
+            <if test="source != null and source != ''">source = #{source},</if>
+            <if test="image != null and image != ''">image = #{image},</if>
+            <if test="password != null and password != ''">password = #{password},</if>
+            <if test="name != null and name != ''">name = #{name},</if>
+            <if test="registerUserTypeID != null and registerUserTypeID != ''">registerUserTypeID = #{registerUserTypeID},</if>
+            <if test="manufacturerStatus != null">manufacturerStatus = #{manufacturerStatus},</if>
+            <if test="shopID != null">shopID = #{shopID},</if>
+            <if test="auditStatus != null and auditStatus != ''">auditStatus = #{auditStatus},</if>
+            <if test="auditTime != null and auditTime != ''">auditTime = #{auditTime},</if>
+            <if test="auditNote != null and auditNote != ''">auditNote = #{auditNote},</if>
+            <if test="registerTime != null and registerTime != ''">registerTime = #{registerTime},</if>
+            <if test="registerIP != null and registerIP != ''">registerIP = #{registerIP},</if>
+            <if test="ipAddress != null and ipAddress != ''">ipAddress = #{ipAddress},</if>
+            <if test="loginTime != null and loginTime != ''">loginTime = #{loginTime},</if>
+            <if test="loginIP != null and loginIP != ''">loginIP = #{loginIP},</if>
+            <if test="validFlag != null and validFlag != ''">validFlag = #{validFlag},</if>
+            <if test="clubStatus != null">clubStatus = #{clubStatus},</if>
+            <if test="clubID != null">clubID = #{clubID},</if>
+            <if test="agreeFlag != null and agreeFlag != ''">agreeFlag = #{agreeFlag},</if>
+            <if test="serviceProviderStatus != null">serviceProviderStatus = #{serviceProviderStatus},</if>
+            <if test="serviceProviderID != null">serviceProviderID = #{serviceProviderID},</if>
+            <if test="userMoney != null">userMoney = #{userMoney},</if>
+            <if test="ableUserMoney != null">ableUserMoney = #{ableUserMoney},</if>
+            <if test="logoffTime != null and logoffTime != ''">logoffTime = #{logoffTime},</if>
+            <if test="appKey != null and appKey != ''">appKey = #{appKey},</if>
+            <if test="appSecret != null and appSecret != ''">appSecret = #{appSecret},</if>
+            <if test="scanFlag != null">scanFlag = #{scanFlag},</if>
+            <if test="userBeans != null">userBeans = #{userBeans},</if>
+            <if test="guideFlag != null">guideFlag = #{guideFlag},</if>
+            <if test="loginFailTime != null">loginFailTime = #{loginFailTime},</if>
+            <if test="tipStatus != null and tipStatus != ''">tipStatus = #{tipStatus},</if>
+            <if test="onlineMoney != null">onlineMoney = #{onlineMoney},</if>
+        </trim>
+        where userID = #{userID}
+    </update>
+    <update id="updateClubStatus" parameterType="CmUser">
+        update club
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="status != null">status = #{status},</if>
+        </trim>
+        where userId = #{userId}
+    </update>
+
+
+    <resultMap type="CmUser" id="UserResult">
+        <result property="userID"    column="userID"    />
+        <result property="userOrganizeID"    column="userOrganizeID"    />
+        <result property="account"    column="account"    />
+        <result property="mobile"    column="mobile"    />
+        <result property="bindMobile"    column="bindMobile"    />
+        <result property="userPermission"    column="userPermission"    />
+        <result property="userIdentity"    column="userIdentity"    />
+        <result property="email"    column="email"    />
+        <result property="userName"    column="userName"    />
+        <result property="realName"    column="realName"    />
+        <result property="source"    column="source"    />
+        <result property="image"    column="image"    />
+        <result property="password"    column="password"    />
+        <result property="name"    column="name"    />
+        <result property="registerUserTypeID"    column="registerUserTypeID"    />
+        <result property="manufacturerStatus"    column="manufacturerStatus"    />
+        <result property="shopID"    column="shopID"    />
+        <result property="auditStatus"    column="auditStatus"    />
+        <result property="auditTime"    column="auditTime"    />
+        <result property="auditNote"    column="auditNote"    />
+        <result property="registerTime"    column="registerTime"    />
+        <result property="registerIP"    column="registerIP"    />
+        <result property="ipAddress"    column="ipAddress"    />
+        <result property="loginTime"    column="loginTime"    />
+        <result property="loginIP"    column="loginIP"    />
+        <result property="validFlag"    column="validFlag"    />
+        <result property="clubStatus"    column="clubStatus"    />
+        <result property="clubID"    column="clubID"    />
+        <result property="agreeFlag"    column="agreeFlag"    />
+        <result property="serviceProviderStatus"    column="serviceProviderStatus"    />
+        <result property="serviceProviderID"    column="serviceProviderID"    />
+        <result property="userMoney"    column="userMoney"    />
+        <result property="ableUserMoney"    column="ableUserMoney"    />
+        <result property="logoffTime"    column="logoffTime"    />
+        <result property="appKey"    column="appKey"    />
+        <result property="appSecret"    column="appSecret"    />
+        <result property="scanFlag"    column="scanFlag"    />
+        <result property="userBeans"    column="userBeans"    />
+        <result property="guideFlag"    column="guideFlag"    />
+        <result property="loginFailTime"    column="loginFailTime"    />
+        <result property="tipStatus"    column="tipStatus"    />
+        <result property="onlineMoney"    column="onlineMoney"    />
+    </resultMap>
+
+    <sql id="selectUserVo">
+        select
+            user.userID,
+            user.userOrganizeID,
+            user.account,
+            user.mobile,
+            user.bindMobile,
+            user.userPermission,
+            user.userIdentity,
+            user.email,
+            user.userName,
+            user.realName,
+            user.source,
+            user.image,
+            user.password,
+            user.name,
+            user.registerUserTypeID,
+            user.manufacturerStatus,
+            user.shopID,
+            user.auditStatus,
+            user.auditTime,
+            user.auditNote,
+            user.registerTime,
+            user.registerIP,
+            user.ipAddress,
+            user.loginTime,
+            user.loginIP,
+            user.validFlag,
+            user.clubStatus,
+            user.clubID,
+            user.agreeFlag,
+            user.serviceProviderStatus,
+            user.serviceProviderID,
+            ifnull(user.userMoney,0) AS userMoney,
+            ifnull(user.ableUserMoney,0) AS ableUserMoney,
+            user.logoffTime,
+            user.appKey,
+            user.appSecret,
+            user.scanFlag,
+            user.userBeans,
+            user.guideFlag,
+            user.loginFailTime,
+            user.tipStatus,
+            ifnull(user.onlineMoney,0) AS onlineMoney
+    </sql>
+
+    <select id="getByUser" parameterType="CmUser" resultMap="UserResult">
+        <include refid="selectUserVo"/>
+        from user AS user
+        <where>
+            <if test="userID != null  and userID != ''">
+                and user.userID
+                <if test="userID.toUpperCase().indexOf('=')==-1">
+                    = #{userID}
+                </if>
+                <if test="userID.toUpperCase().indexOf('=')!=-1">
+                    <if test="userID.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="userID.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="userIDIn" collection="userID.substring(userID.toUpperCase().indexOf('=')+1,userID.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{userIDIn}
+                    </foreach>
+                </if>
             </if>
+            <if test="userOrganizeID != null  and userOrganizeID != ''">
+                and user.userOrganizeID
+                <if test="userOrganizeID.toUpperCase().indexOf('=')==-1">
+                    = #{userOrganizeID}
+                </if>
+                <if test="userOrganizeID.toUpperCase().indexOf('=')!=-1">
+                    <if test="userOrganizeID.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="userOrganizeID.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="typeIn" collection="userOrganizeID.substring(userOrganizeID.toUpperCase().indexOf('=')+1,userOrganizeID.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{typeIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="account != null  and account != ''"> and user.account = #{account}</if>
+            <if test="mobile != null  and mobile != ''"> and user.mobile = #{mobile}</if>
+            <if test="bindMobile != null  and bindMobile != ''"> and user.bindMobile = #{bindMobile}</if>
+            <if test="userPermission != null "> and user.userPermission = #{userPermission}</if>
+            <if test="userIdentity != null  and userIdentity != ''">
+                and user.userIdentity
+                <if test="userIdentity.toUpperCase().indexOf('=')==-1">
+                    = #{userIdentity}
+                </if>
+                <if test="userIdentity.toUpperCase().indexOf('=')!=-1">
+                    <if test="userIdentity.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="userIdentity.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="typeIn" collection="userIdentity.substring(userIdentity.toUpperCase().indexOf('=')+1,userIdentity.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{typeIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="email != null  and email != ''"> and user.email = #{email}</if>
+            <if test="userName != null  and userName != ''"> and user.userName like concat('%', #{userName}, '%')</if>
+            <if test="realName != null  and realName != ''"> and user.realName like concat('%', #{realName}, '%')</if>
+            <if test="source != null  and source != ''"> and user.source = #{source}</if>
+            <if test="image != null  and image != ''"> and user.image = #{image}</if>
+            <if test="password != null  and password != ''"> and user.password = #{password}</if>
+            <if test="name != null  and name != ''"> and user.name like concat('%', #{name}, '%')</if>
+            <if test="registerUserTypeID != null  and registerUserTypeID != ''">
+                and user.registerUserTypeID
+                <if test="registerUserTypeID.toUpperCase().indexOf('=')==-1">
+                    = #{registerUserTypeID}
+                </if>
+                <if test="registerUserTypeID.toUpperCase().indexOf('=')!=-1">
+                    <if test="registerUserTypeID.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="registerUserTypeID.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="typeIn" collection="registerUserTypeID.substring(registerUserTypeID.toUpperCase().indexOf('=')+1,registerUserTypeID.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{typeIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="manufacturerStatus != null "> and user.manufacturerStatus = #{manufacturerStatus}</if>
+            <if test="shopID != null "> and user.shopID = #{shopID}</if>
+            <if test="auditStatus != null  and auditStatus != ''"> and user.auditStatus = #{auditStatus}</if>
+            <if test="auditTime != null  and auditTime != ''"> and user.auditTime = #{auditTime}</if>
+            <if test="auditNote != null  and auditNote != ''"> and user.auditNote = #{auditNote}</if>
+            <if test="registerTime != null  and registerTime != ''"> and user.registerTime = #{registerTime}</if>
+            <if test="registerIP != null  and registerIP != ''"> and user.registerIP = #{registerIP}</if>
+            <if test="ipAddress != null  and ipAddress != ''"> and user.ipAddress = #{ipAddress}</if>
+            <if test="loginTime != null  and loginTime != ''"> and user.loginTime = #{loginTime}</if>
+            <if test="loginIP != null  and loginIP != ''"> and user.loginIP = #{loginIP}</if>
+            <if test="validFlag != null  and validFlag != ''"> and user.validFlag = #{validFlag}</if>
+            <if test="clubStatus != null "> and user.clubStatus = #{clubStatus}</if>
+            <if test="clubID != null "> and user.clubID = #{clubID}</if>
+            <if test="agreeFlag != null  and agreeFlag != ''"> and user.agreeFlag = #{agreeFlag}</if>
+            <if test="serviceProviderStatus != null "> and user.serviceProviderStatus = #{serviceProviderStatus}</if>
+            <if test="serviceProviderID != null "> and user.serviceProviderID = #{serviceProviderID}</if>
+            <if test="userMoney != null "> and user.userMoney = #{userMoney}</if>
+            <if test="ableUserMoney != null "> and user.ableUserMoney = #{ableUserMoney}</if>
+            <if test="logoffTime != null  and logoffTime != ''"> and user.logoffTime = #{logoffTime}</if>
+            <if test="appKey != null  and appKey != ''"> and user.appKey = #{appKey}</if>
+            <if test="appSecret != null  and appSecret != ''"> and user.appSecret = #{appSecret}</if>
+            <if test="scanFlag != null "> and user.scanFlag = #{scanFlag}</if>
+            <if test="userBeans != null "> and user.userBeans = #{userBeans}</if>
+            <if test="guideFlag != null "> and user.guideFlag = #{guideFlag}</if>
+            <if test="loginFailTime != null "> and user.loginFailTime = #{loginFailTime}</if>
+            <if test="tipStatus != null  and tipStatus != ''"> and user.tipStatus = #{tipStatus}</if>
+            <if test="onlineMoney != null "> and user.onlineMoney = #{onlineMoney}</if>
+        </where>
+        group by user.userID
+        order by user.loginTime desc
+        limit 0,1
+    </select>
+    <select id="findUserByMobile"  resultMap="UserResult">
+        <include refid="selectUserVo"/>
+        FROM user user
+        WHERE user.bindMobile=#{mobile}
+        <if test="oldUserId !=null and oldUserId !=''">
+            and user.userId!=#{oldUserId}
         </if>
+        <if test="userIdentity !=null">
+            and user.userIdentity=#{userIdentity}
+        </if>
+        limit 0,1
+    </select>
+
+    <select id="findAdminMobileList" parameterType="String" resultType="String">
+        select
+        cm_admin_mobile.mobile
+        from cm_admin_mobile AS cm_admin_mobile
+        <where>  cm_admin_mobile.delFlag = 0 and cm_admin_mobile.enabledStatus = 1
+            <if test="type != null  and type != ''"> and cm_admin_mobile.type = #{type}</if>
+        </where>
+        group by cm_admin_mobile.id
+        order by cm_admin_mobile.createTime desc
     </select>
 </mapper>

+ 36 - 12
src/main/resources/mapper/ClubMapper.xml

@@ -502,7 +502,10 @@
     </select>
 
     <select id="getRemarksInfo" resultType="com.caimei365.user.model.po.ClubRemarksPo">
-        select ccr.communicationSituation, ccr.communicationMethods, ccr.customerSource, ccr.customerGender, ccr.groupAddition, ccr.customerAge
+        select ccr.communicationSituation, ccr.communicationMethods, ccr.customerSource,
+               ccr.customerGender, ccr.groupAddition, ccr.customerAge,
+               (SELECT ADDTIME FROM cm_club_remarks WHERE clubId = c.clubId ORDER BY ADDTIME ASC LIMIT 1) AS firstTime,
+               (SELECT ADDTIME FROM cm_club_remarks WHERE clubId = c.clubId ORDER BY ADDTIME DESC LIMIT 1) AS recentlyTime
         from cm_club_remarks ccr
         left join club c on ccr.clubId = c.clubId
         where c.userId = #{userId} order by ccr.addTime desc limit 1
@@ -513,7 +516,7 @@
         from cm_prior_keyword cpk
         left join cm_user_search_frequency cusf on cpk.searchId = cusf.id
         WHERE cpk.delFlag = 0 AND cusf.delStatus = 1
-        order by cpk.addTime desc
+        order by cusf.dynamicStatus DESC, cpk.addTime desc
     </select>
 
     <select id="findKeywordExist" resultType="java.lang.Integer">
@@ -521,6 +524,7 @@
         from cm_user_search_frequency
         where keyword = #{keyword}
           and delstatus = 1
+        limit 1
     </select>
 
     <insert id="insertLabel">
@@ -1097,14 +1101,22 @@
         ORDER BY cbr.accessDate DESC
     </select>
     <select id="recordDetail" resultType="com.caimei365.user.model.vo.BehaviorRecodeVo">
-        SELECT pt.pageType,
-               b.pageLabel,
-               p.name      AS productName,
-               p.mainImage AS productImage,
-               b.accessDuration,
-               b.accessSource,
-               b.accessClient,
-               b.accessTime
+        SELECT
+            b.recordID,
+            b.userID,
+            b.pagePath,
+            pt.pageType,
+            b.pageLabel,
+            b.productID,
+            b.accessTime,
+            b.accessDuration,
+            b.accessDate,
+            b.referer,
+            b.accessClient,
+            b.isReckon,
+            b.region,
+            p.name      AS productName,
+            p.mainImage AS productImage
         FROM cm_behavior_record b
                  LEFT JOIN club c ON b.userID = c.userID
                  LEFT JOIN product p ON b.productID = p.productID
@@ -1180,8 +1192,20 @@
                accessTime,
                pageType
         FROM cm_behavior_record_ref
-        WHERE IP = #{ip}
-          AND accessTime like concat('%', #{accessDate}, '%')
+        <where>
+            <if test="type == 0">
+               IP = #{ip}
+               AND accessTime like concat('%', #{accessDate}, '%')
+            </if>
+            <if test="type == 1">
+                <if test="accessDateList.size()>0">
+                    and
+                    <foreach collection="accessDateList" item="accessDate" open="(" separator="or" close=")">
+                        accessTime like concat('%', #{accessDate}, '%')
+                    </foreach>
+                </if>
+            </if>
+        </where>
     </select>
     <select id="selRemarksList" resultType="com.caimei365.user.model.vo.CmClubRemarksVo">
         SELECT

+ 1 - 0
src/main/resources/mapper/CmBrandBannerMapper.xml

@@ -55,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateTime != null "> and updateTime = #{updateTime}</if>
             <if test="addTime != null "> and addTime = #{addTime}</if>
         </where>
+        order by sort desc,addTime desc
     </select>
 
     <select id="selectCmBrandBannerById" parameterType="String" resultMap="CmBrandBannerResult">

+ 5 - 1
src/main/resources/mapper/CmBrandLandingMapper.xml

@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="jumpPcPicture"    column="jumpPcPicture"    />
         <result property="jumpAppPicture"    column="jumpAppPicture"    />
         <result property="jumpLink"    column="jumpLink"    />
+        <result property="jumpAppLink"    column="jumpAppLink"    />
         <result property="title"    column="title"    />
         <result property="content"    column="content"    />
         <result property="video"    column="video"    />
@@ -27,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 
     <sql id="selectCmBrandLandingVo">
-        select id, authUserId, type, headPcBanner, headAppBanner, jumpStatus, jumpPcPicture, jumpAppPicture, jumpLink, title, content, video, sort, pcStatus, appStatus, delFlag, updateTime, addTime from cm_brand_landing
+        select id, authUserId, type, headPcBanner, headAppBanner, jumpStatus, jumpPcPicture, jumpAppPicture, jumpLink,jumpAppLink, title, content, video, sort, pcStatus, appStatus, delFlag, updateTime, addTime from cm_brand_landing
     </sql>
 
     <select id="selectCmBrandLandingList" parameterType="com.caimei365.user.model.po.CmBrandLanding" resultMap="CmBrandLandingResult">
@@ -56,6 +57,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateTime != null "> and updateTime = #{updateTime}</if>
             <if test="addTime != null "> and addTime = #{addTime}</if>
         </where>
+        order by sort desc,addTime desc
+        <if test="num != null ">limit #{num},#{size} </if>
     </select>
 
     <select id="selectCmBrandLandingById" parameterType="String" resultMap="CmBrandLandingResult">
@@ -116,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="jumpPcPicture != null">jumpPcPicture = #{jumpPcPicture},</if>
             <if test="jumpAppPicture != null">jumpAppPicture = #{jumpAppPicture},</if>
             <if test="jumpLink != null">jumpLink = #{jumpLink},</if>
+            <if test="jumpAppLink != null">jumpAppLink = #{jumpAppLink},</if>
             <if test="title != null">title = #{title},</if>
             <if test="content != null">content = #{content},</if>
             <if test="video != null">video = #{video},</if>

+ 391 - 0
src/main/resources/mapper/CmDistributionMapper.xml

@@ -0,0 +1,391 @@
+<?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.CmDistributionMapper">
+
+    <resultMap type="CmDistribution" id="CmDistributionResult">
+        <result property="id"    column="id"    />
+        <result property="userId"    column="userId"    />
+        <result property="name"    column="name"    />
+        <result property="linkMan"    column="linkMan"    />
+        <result property="mobile"    column="mobile"    />
+        <result property="password"    column="password"    />
+        <result property="corporateName"    column="corporateName"    />
+        <result property="splitCode"    column="splitCode"    />
+        <result property="bankName"    column="bankName"    />
+        <result property="bankAccount"    column="bankAccount"    />
+        <result property="status"    column="status"    />
+        <result property="qrCode"    column="qrCode"    />
+        <result property="parentId"    column="parentId"    />
+        <result property="parentIds"    column="parentIds"    />
+        <result property="updateTime"    column="updateTime"    />
+        <result property="addTime"    column="addTime"    />
+        <result property="delFlag"    column="delFlag"    />
+        <result property="image"    column="image"    />
+    </resultMap>
+
+    <sql id="selectCmDistributionVo">
+         select
+         cm_distribution.id,
+         cm_distribution.userId,
+         cm_distribution.name,
+         cm_distribution.linkMan,
+         cm_distribution.mobile,
+         cm_distribution.password,
+         cm_distribution.corporateName,
+         cm_distribution.splitCode,
+         cm_distribution.bankName,
+         cm_distribution.bankAccount,
+         cm_distribution.status,
+         cm_distribution.qrCode,
+         cm_distribution.parentId,
+         cm_distribution.parentIds,
+         cm_distribution.updateTime,
+         cm_distribution.addTime,
+         cm_distribution.delFlag,
+         u.image
+    </sql>
+
+    <select id="getByCmDistribution" parameterType="CmDistribution" resultMap="CmDistributionResult">
+        <include refid="selectCmDistributionVo"/>
+        from cm_distribution AS cm_distribution
+        left join user u on u.userId=cm_distribution.userId
+        <where>  cm_distribution.delFlag = 0
+            <if test="id != null  and id != ''">
+                and cm_distribution.id
+                <if test="id.toUpperCase().indexOf('=')==-1">
+                    = #{id}
+                </if>
+                <if test="id.toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{idIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="userId != null "> and cm_distribution.userId = #{userId}</if>
+            <if test="name != null  and name != ''"> and cm_distribution.name like concat('%', #{name}, '%')</if>
+            <if test="linkMan != null  and linkMan != ''"> and cm_distribution.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_distribution.mobile = #{mobile}</if>
+            <if test="password != null  and password != ''"> and cm_distribution.password = #{password}</if>
+            <if test="corporateName != null  and corporateName != ''"> and cm_distribution.corporateName like concat('%', #{corporateName}, '%')</if>
+            <if test="splitCode != null  and splitCode != ''"> and cm_distribution.splitCode = #{splitCode}</if>
+            <if test="bankName != null  and bankName != ''"> and cm_distribution.bankName like concat('%', #{bankName}, '%')</if>
+            <if test="bankAccount != null  and bankAccount != ''"> and cm_distribution.bankAccount = #{bankAccount}</if>
+            <if test="status != null "> and cm_distribution.status = #{status}</if>
+            <if test="qrCode != null  and qrCode != ''"> and cm_distribution.qrCode = #{qrCode}</if>
+            <if test="parentId != null "> and cm_distribution.parentId = #{parentId}</if>
+            <if test="parentIds != null  and parentIds != ''"> and cm_distribution.parentIds = #{parentIds}</if>
+            <if test="updateTime != null "> and cm_distribution.updateTime = #{updateTime}</if>
+            <if test="addTime != null "> and cm_distribution.addTime = #{addTime}</if>
+        </where>
+        group by cm_distribution.id
+        order by cm_distribution.addTime desc
+        limit 0,1
+    </select>
+
+    <select id="getCmDistributionList" parameterType="CmDistribution" resultMap="CmDistributionResult">
+        <include refid="selectCmDistributionVo"/>
+        from cm_distribution AS cm_distribution
+        left join user u on u.userId=cm_distribution.userId
+        <where>  cm_distribution.delFlag = 0
+            <if test="id != null  and id != ''">
+                and cm_distribution.id
+                <if test="id.toUpperCase().indexOf('=')==-1">
+                    = #{id}
+                </if>
+                <if test="id.toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{idIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="userId != null "> and cm_distribution.userId = #{userId}</if>
+            <if test="name != null  and name != ''"> and cm_distribution.name like concat('%', #{name}, '%')</if>
+            <if test="linkMan != null  and linkMan != ''"> and cm_distribution.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_distribution.mobile = #{mobile}</if>
+            <if test="password != null  and password != ''"> and cm_distribution.password = #{password}</if>
+            <if test="corporateName != null  and corporateName != ''"> and cm_distribution.corporateName like concat('%', #{corporateName}, '%')</if>
+            <if test="splitCode != null  and splitCode != ''"> and cm_distribution.splitCode = #{splitCode}</if>
+            <if test="bankName != null  and bankName != ''"> and cm_distribution.bankName like concat('%', #{bankName}, '%')</if>
+            <if test="bankAccount != null  and bankAccount != ''"> and cm_distribution.bankAccount = #{bankAccount}</if>
+            <if test="status != null "> and cm_distribution.status = #{status}</if>
+            <if test="qrCode != null  and qrCode != ''"> and cm_distribution.qrCode = #{qrCode}</if>
+            <if test="parentId != null "> and cm_distribution.parentId = #{parentId}</if>
+            <if test="parentIds != null  and parentIds != ''"> and cm_distribution.parentIds = #{parentIds}</if>
+            <if test="updateTime != null "> and cm_distribution.updateTime = #{updateTime}</if>
+            <if test="addTime != null "> and cm_distribution.addTime = #{addTime}</if>
+        </where>
+        group by cm_distribution.id
+        order by cm_distribution.addTime desc
+    </select>
+
+    <select id="getCmDistributionCount" parameterType="CmDistribution" resultType="int">
+       select count(1)
+        from cm_distribution AS cm_distribution
+        left join user u on u.userId=cm_distribution.userId
+        <where>  cm_distribution.delFlag = 0
+            <if test="id != null  and  id != ''">
+                    and cm_distribution.id
+                <if test="id.toUpperCase().indexOf('=')==-1">
+                        = #{id}
+                </if>
+                <if test="id.toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+                            #{idIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="userId != null "> and cm_distribution.userId = #{userId}</if>
+            <if test="name != null  and name != ''"> and cm_distribution.name like concat('%', #{name}, '%')</if>
+            <if test="linkMan != null  and linkMan != ''"> and cm_distribution.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_distribution.mobile = #{mobile}</if>
+            <if test="password != null  and password != ''"> and cm_distribution.password = #{password}</if>
+            <if test="corporateName != null  and corporateName != ''"> and cm_distribution.corporateName like concat('%', #{corporateName}, '%')</if>
+            <if test="splitCode != null  and splitCode != ''"> and cm_distribution.splitCode = #{splitCode}</if>
+            <if test="bankName != null  and bankName != ''"> and cm_distribution.bankName like concat('%', #{bankName}, '%')</if>
+            <if test="bankAccount != null  and bankAccount != ''"> and cm_distribution.bankAccount = #{bankAccount}</if>
+            <if test="status != null "> and cm_distribution.status = #{status}</if>
+            <if test="qrCode != null  and qrCode != ''"> and cm_distribution.qrCode = #{qrCode}</if>
+            <if test="parentId != null "> and cm_distribution.parentId = #{parentId}</if>
+            <if test="parentIds != null  and parentIds != ''"> and cm_distribution.parentIds = #{parentIds}</if>
+            <if test="updateTime != null "> and cm_distribution.updateTime = #{updateTime}</if>
+            <if test="addTime != null "> and cm_distribution.addTime = #{addTime}</if>
+        </where>
+        group by cm_distribution.id
+    </select>
+
+    <select id="getCmDistributionById" parameterType="String" resultMap="CmDistributionResult">
+        <include refid="selectCmDistributionVo"/>
+        from cm_distribution AS cm_distribution
+        left join user u on u.userId=cm_distribution.userId
+        where  cm_distribution.delFlag = 0 and cm_distribution.id = #{id}
+    </select>
+
+    <select id="getByIds" parameterType="CmDistribution" resultType="String">
+        select id
+        from cm_distribution AS cm_distribution
+        left join user u on u.userId=cm_distribution.userId
+        <where>  cm_distribution.delFlag = 0
+            <if test="id != null  and id != ''">
+                and cm_distribution.id
+                <if test="id.toUpperCase().indexOf('=')==-1">
+                    = #{id}
+                </if>
+                <if test="id.toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{idIn}
+                    </foreach>
+                </if>
+            </if>
+                <if test="userId != null "> and cm_distribution.userId = #{userId}</if>
+            <if test="name != null  and name != ''"> and cm_distribution.name like concat('%', #{name}, '%')</if>
+            <if test="linkMan != null  and linkMan != ''"> and cm_distribution.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_distribution.mobile = #{mobile}</if>
+            <if test="password != null  and password != ''"> and cm_distribution.password = #{password}</if>
+            <if test="corporateName != null  and corporateName != ''"> and cm_distribution.corporateName like concat('%', #{corporateName}, '%')</if>
+            <if test="splitCode != null  and splitCode != ''"> and cm_distribution.splitCode = #{splitCode}</if>
+            <if test="bankName != null  and bankName != ''"> and cm_distribution.bankName like concat('%', #{bankName}, '%')</if>
+            <if test="bankAccount != null  and bankAccount != ''"> and cm_distribution.bankAccount = #{bankAccount}</if>
+            <if test="status != null "> and cm_distribution.status = #{status}</if>
+            <if test="qrCode != null  and qrCode != ''"> and cm_distribution.qrCode = #{qrCode}</if>
+            <if test="parentId != null "> and cm_distribution.parentId = #{parentId}</if>
+            <if test="parentIds != null  and parentIds != ''"> and cm_distribution.parentIds = #{parentIds}</if>
+            <if test="updateTime != null "> and cm_distribution.updateTime = #{updateTime}</if>
+            <if test="addTime != null "> and cm_distribution.addTime = #{addTime}</if>
+        </where>
+        group by cm_distribution.id
+    </select>
+
+    <select id="getById" parameterType="CmDistribution" resultType="String">
+        select id
+        from cm_distribution AS cm_distribution
+        left join user u on u.userId=cm_distribution.userId
+        <where>  cm_distribution.delFlag = 0
+            <if test="id != null  and id != ''">
+                and cm_distribution.id
+                <if test="id.toString().toUpperCase().indexOf('=')==-1">
+                    = #{id}
+                </if>
+                <if test="id.toString().toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toString().toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toString().toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.toString().substring(id.toString().toUpperCase().indexOf('=')+1,id.toString().length()).trim().split(',')" open="(" separator="," close=")">
+                        #{idIn}
+                    </foreach>
+                </if>
+            </if>
+                <if test="userId != null "> and cm_distribution.userId = #{userId}</if>
+            <if test="name != null  and name != ''"> and cm_distribution.name like concat('%', #{name}, '%')</if>
+            <if test="linkMan != null  and linkMan != ''"> and cm_distribution.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_distribution.mobile = #{mobile}</if>
+            <if test="password != null  and password != ''"> and cm_distribution.password = #{password}</if>
+            <if test="corporateName != null  and corporateName != ''"> and cm_distribution.corporateName like concat('%', #{corporateName}, '%')</if>
+            <if test="splitCode != null  and splitCode != ''"> and cm_distribution.splitCode = #{splitCode}</if>
+            <if test="bankName != null  and bankName != ''"> and cm_distribution.bankName like concat('%', #{bankName}, '%')</if>
+            <if test="bankAccount != null  and bankAccount != ''"> and cm_distribution.bankAccount = #{bankAccount}</if>
+            <if test="status != null "> and cm_distribution.status = #{status}</if>
+            <if test="qrCode != null  and qrCode != ''"> and cm_distribution.qrCode = #{qrCode}</if>
+            <if test="parentId != null "> and cm_distribution.parentId = #{parentId}</if>
+            <if test="parentIds != null  and parentIds != ''"> and cm_distribution.parentIds = #{parentIds}</if>
+            <if test="updateTime != null "> and cm_distribution.updateTime = #{updateTime}</if>
+            <if test="addTime != null "> and cm_distribution.addTime = #{addTime}</if>
+        </where>
+        group by cm_distribution.id
+        limit 0,1
+    </select>
+
+    <select id="getLoginDistributionByMobile" 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.image          as image,
+               u.guideFlag      as guideFlag,
+               u.userPermission as userPermission,
+               u.userIdentity   as userIdentity,
+               u.serviceProviderID as serviceProviderId,
+               u.serviceProviderStatus as serviceStatus,
+               u.password       as password
+        from user u
+        where u.bindMobile = #{mobile}
+          and u.userIdentity = 7
+          and u.validFlag = 1
+    </select>
+
+    <insert id="addCmDistribution" parameterType="CmDistribution" useGeneratedKeys="true" keyProperty="id">
+        insert into cm_distribution
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">id,</if>
+            <if test="userId != null">userId,</if>
+            <if test="name != null and name != ''">name,</if>
+            <if test="linkMan != null and linkMan != ''">linkMan,</if>
+            <if test="mobile != null and mobile != ''">mobile,</if>
+            <if test="password != null and password != ''">password,</if>
+            <if test="corporateName != null and corporateName != ''">corporateName,</if>
+            <if test="splitCode != null and splitCode != ''">splitCode,</if>
+            <if test="bankName != null and bankName != ''">bankName,</if>
+            <if test="bankAccount != null and bankAccount != ''">bankAccount,</if>
+            <if test="status != null">status,</if>
+            <if test="qrCode != null and qrCode != ''">qrCode,</if>
+            <if test="parentId != null">parentId,</if>
+            <if test="parentIds != null and parentIds != ''">parentIds,</if>
+            <if test="updateTime != null">updateTime,</if>
+            <if test="addTime != null">addTime,</if>
+            <if test="delFlag != null">delFlag,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">#{id},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="name != null and name != ''">#{name},</if>
+            <if test="linkMan != null and linkMan != ''">#{linkMan},</if>
+            <if test="mobile != null and mobile != ''">#{mobile},</if>
+            <if test="password != null and password != ''">#{password},</if>
+            <if test="corporateName != null and corporateName != ''">#{corporateName},</if>
+            <if test="splitCode != null and splitCode != ''">#{splitCode},</if>
+            <if test="bankName != null and bankName != ''">#{bankName},</if>
+            <if test="bankAccount != null and bankAccount != ''">#{bankAccount},</if>
+            <if test="status != null">#{status},</if>
+            <if test="qrCode != null and qrCode != ''">#{qrCode},</if>
+            <if test="parentId != null">#{parentId},</if>
+            <if test="parentIds != null and parentIds != ''">#{parentIds},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="addTime != null">#{addTime},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+         </trim>
+    </insert>
+
+    <update id="updateCmDistribution" parameterType="CmDistribution">
+        update cm_distribution
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="userId != null">userId = #{userId},</if>
+            <if test="name != null and name != ''">name = #{name},</if>
+            <if test="linkMan != null and linkMan != ''">linkMan = #{linkMan},</if>
+            <if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
+            <if test="password != null and password != ''">password = #{password},</if>
+            <if test="corporateName != null and corporateName != ''">corporateName = #{corporateName},</if>
+            <if test="splitCode != null and splitCode != ''">splitCode = #{splitCode},</if>
+            <if test="bankName != null and bankName != ''">bankName = #{bankName},</if>
+            <if test="bankAccount != null and bankAccount != ''">bankAccount = #{bankAccount},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="qrCode != null and qrCode != ''">qrCode = #{qrCode},</if>
+            <if test="parentId != null">parentId = #{parentId},</if>
+            <if test="parentIds != null and parentIds != ''">parentIds = #{parentIds},</if>
+            <if test="updateTime != null">updateTime = #{updateTime},</if>
+            <if test="addTime != null">addTime = #{addTime},</if>
+            <if test="delFlag != null">delFlag = #{delFlag},</if>
+        </trim>
+        where 1=1
+        <if test="id != null">and id = #{id}</if>
+        <if test="userId != null">and userId = #{userId}</if>
+    </update>
+
+    <update id="updateDelCmDistributionByIds" parameterType="String">
+        update cm_distribution set delFlag=#{delFlag} where id in
+        <foreach item="id" collection="ids" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
+    <delete id="delCmDistributionById" parameterType="String">
+        delete
+        from cm_distribution where id = #{id}
+    </delete>
+
+    <delete id="delCmDistribution" parameterType="CmDistribution">
+        delete
+        from cm_distribution AS cm_distribution
+        left join user u on u.userId=cm_distribution.userId
+        <where>
+            <if test="id != null  and id != ''">
+                and cm_distribution.id
+                <if test="id.toUpperCase().indexOf('=')==-1">
+                    = #{id}
+                </if>
+                <if test="id.toUpperCase().indexOf('=')!=-1">
+                    <if test="id.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="id.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="idIn" collection="id.substring(id.toUpperCase().indexOf('=')+1,id.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{idIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="userId != null "> and cm_distribution.userId = #{userId}</if>
+            <if test="name != null  and name != ''"> and cm_distribution.name like concat('%', #{name}, '%')</if>
+            <if test="linkMan != null  and linkMan != ''"> and cm_distribution.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''"> and cm_distribution.mobile = #{mobile}</if>
+            <if test="password != null  and password != ''"> and cm_distribution.password = #{password}</if>
+            <if test="corporateName != null  and corporateName != ''"> and cm_distribution.corporateName like concat('%', #{corporateName}, '%')</if>
+            <if test="splitCode != null  and splitCode != ''"> and cm_distribution.splitCode = #{splitCode}</if>
+            <if test="bankName != null  and bankName != ''"> and cm_distribution.bankName like concat('%', #{bankName}, '%')</if>
+            <if test="bankAccount != null  and bankAccount != ''"> and cm_distribution.bankAccount = #{bankAccount}</if>
+            <if test="status != null "> and cm_distribution.status = #{status}</if>
+            <if test="qrCode != null  and qrCode != ''"> and cm_distribution.qrCode = #{qrCode}</if>
+            <if test="parentId != null "> and cm_distribution.parentId = #{parentId}</if>
+            <if test="parentIds != null  and parentIds != ''"> and cm_distribution.parentIds = #{parentIds}</if>
+            <if test="updateTime != null "> and cm_distribution.updateTime = #{updateTime}</if>
+            <if test="addTime != null "> and cm_distribution.addTime = #{addTime}</if>
+            <if test="delFlag != null "> and cm_distribution.delFlag = #{delFlag}</if>
+        </where>
+    </delete>
+
+    <delete id="delCmDistributionByIds" parameterType="String">
+        delete from cm_distribution where id in
+        <foreach item="id" collection="ids" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+</mapper>

+ 2 - 0
src/main/resources/mapper/CmQuestionnaireMapper.xml

@@ -165,6 +165,8 @@
         where  cm_questionnaire.delFlag = 0 and cm_questionnaire.id = #{id}
     </select>
 
+
+
     <select id="getByIds" parameterType="CmQuestionnaire" resultMap="CmQuestionnaireResult">
         select id
         from cm_questionnaire AS cm_questionnaire

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

@@ -179,6 +179,12 @@
           and u.validFlag = 1
         limit 1
     </select>
+    <update id="updateUserInfo">
+        update user
+        set openId = #{openId},
+            unionId = #{unionId}
+        where userId = #{userId}
+    </update>
     <select id="getServiceProviderByUserId" resultType="com.caimei365.user.model.vo.ServiceProviderVo">
         select s.serviceProviderId as serviceProviderId,
                s.status            as status,
@@ -340,6 +346,14 @@
         set loginTime = now()
         where userID = #{userId}
     </update>
+
+    <select id="getShopProductGroudMall" resultType="java.lang.String">
+        select p.groundMall AS groundMall
+        from product p
+                 left join cm_organize_product_info copi on copi.productId = p.productID
+        where p.shopId = #{shopId} and copi.validFlag = 2
+    </select>
+
     <select id="getUserIdByOpenId" resultType="java.lang.Integer">
         select o.userID as userId
         from
@@ -467,4 +481,10 @@
         WHERE  c.clubId = #{clubId}
         limit 1
     </select>
+
+    <update id="updateTourist">
+        update cm_behavior_tourist_info
+        set userId = #{userId}
+        where touristId = #{touristId}
+    </update>
 </mapper>

+ 1 - 1
src/main/resources/mapper/MessageCenter.xml

@@ -101,7 +101,7 @@
     </select>
 
     <select id="listingfeeExpire" resultType="java.lang.Integer">
-        SELECT COUNT(*) FROM `cm_discern_receipt` WHERE newReceiptType=1 AND shopID=#{shopID} AND NOW()> DATE_ADD(receiptDate, INTERVAL 1 YEAR)
+        SELECT COUNT(*) FROM `cm_discern_receipt` WHERE newReceiptType=1 AND shopID = #{shopID} AND NOW() <![CDATA[  <=  ]]> DATE_ADD(receiptDate, INTERVAL 1 YEAR) AND NOW() > receiptDate
     </select>
 
     <select id="MessageList" resultType="com.caimei365.user.model.vo.MessageCenter">

+ 194 - 227
src/main/resources/mapper/RegisterMapper.xml

@@ -1,284 +1,251 @@
 <?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.RegisterMapper">
-    <insert id="insertClubUser" parameterType="com.caimei365.user.model.po.UserPo" keyProperty="userId"
-            useGeneratedKeys="true">
-        insert into user(`userOrganizeID`, `registerTime`, `registerIP`, `ipAddress`, `source`, `registerUserTypeID`,
-                         `name`, `userName`, `bindMobile`, `email`, `userIdentity`, `guideFlag`,
-                         `password`, `agreeFlag`, `validFlag`, `serviceProviderID`, `serviceProviderStatus`, userBeans)
-        values (#{organizeId}, #{registerTime}, #{registerIp}, #{ipAddress}, #{source}, #{registerUserTypeId}, #{name},
-                #{userName}, #{bindMobile}, #{email}, #{userIdentity}, #{guideFlag}, #{password},
-                #{agreeFlag}, #{validFlag}, #{serviceProviderId}, #{serviceProviderStatus}, #{userBeans})
+    <insert id="insertClubUser" parameterType="com.caimei365.user.model.po.UserPo" keyProperty="userId" useGeneratedKeys="true">
+        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 * from user where registerTime = #{registerTime}
     </select>
     <insert id="insertOrgan">
         insert into cm_organ_value_system
-            (userID, activeState, customerValue, stage, delType)
-        values (#{userID}, "新增用户", "一般挽留客户", 0, 1)
+            (userID, activeState, customerValue, activeStatus, customerStatus, stage, delType)
+            values(#{userID}, '活跃用户', '低价值客户', 0, 3, 0, 1)
     </insert>
-    <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`, provinceID, cityID, townID, address, headpic, businessLicenseImage,
-                         medicalPracticeLicenseImg, socialCreditCode)
-        values (#{name}, #{shortName}, #{contractMobile}, #{linkMan}, #{userId}, #{addTime}, #{status},
-                #{serviceProviderId}, #{scanFlag}, #{provinceId}, #{cityId}, #{townId}, #{address}, #{shopPhoto},
-                #{businessLicense}, #{medicalPracticeLicense}, #{socialCreditCode})
+    <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`, provinceID, cityID, townID, address, headpic, businessLicenseImage, medicalPracticeLicenseImg, socialCreditCode,newDeal)
+                  values(#{name},#{shortName},#{contractMobile},#{linkMan},#{userId},#{addTime},#{status}, #{serviceProviderId}, #{scanFlag}, #{provinceId}, #{cityId}, #{townId}, #{address}, #{shopPhoto}, #{businessLicense},#{medicalPracticeLicense}, #{socialCreditCode},1)
     </insert>
-    <insert id="insertUpgradeClub" parameterType="com.caimei365.user.model.po.ClubPo" keyProperty="clubId"
-            useGeneratedKeys="true">
-        insert into club(`name`, `sname`, `contractMobile`, `userID`, `addTime`, `status`, `spID`, `scanFlag`,
-                         `contractEmail`, `linkMan`, `provinceID`, `cityID`, `townID`, `address`, `headpic`,
-                         `businessLicenseImage`, `socialCreditCode`, `firstClubType`, `secondClubType`, `department`,
-                         `medicalPracticeLicenseImg`, `mainpro`)
-        values (#{name}, #{shortName}, #{contractMobile}, #{userId}, #{addTime}, #{status}, #{serviceProviderId},
-                #{scanFlag}, #{contractEmail}, #{linkMan}, #{provinceId}, #{cityId}, #{townId}, #{address},
-                #{shopPhoto}, #{businessLicense}, #{socialCreditCode}, #{firstClubType}, #{secondClubType},
-                #{department}, #{medicalPracticeLicense}, #{mainProduct})
+    <insert id="insertUpgradeClub" parameterType="com.caimei365.user.model.po.ClubPo" keyProperty="clubId" useGeneratedKeys="true">
+        insert into club(`name`, `sname`,     `contractMobile`, `userID`, `addTime`, `status`, `spID`,              `scanFlag`,`contractEmail`,`linkMan`, `provinceID`, `cityID`,`townID`, `address`, `headpic`, `businessLicenseImage`,`socialCreditCode`,`firstClubType`,`secondClubType`,`department`,`medicalPracticeLicenseImg`,`mainpro`,newDeal)
+                  values(#{name},#{shortName},#{contractMobile},#{userId},#{addTime},#{status},#{serviceProviderId},#{scanFlag},#{contractEmail},#{linkMan},#{provinceId},#{cityId},#{townId},#{address},#{shopPhoto},#{businessLicense},#{socialCreditCode},#{firstClubType},#{secondClubType},#{department},#{medicalPracticeLicense},#{mainProduct},1)
     </insert>
-    <insert id="insertOperation" parameterType="com.caimei365.user.model.po.OperationPo" keyProperty="id"
-            useGeneratedKeys="true">
-        insert into cm_mall_operation_user(`userID`, `clubID`, `shopID`, `userOrganizeID`, `linkName`, `nickName`,
-                                           `headimgurl`, `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 id="insertOperation" parameterType="com.caimei365.user.model.po.OperationPo" keyProperty="id" useGeneratedKeys="true">
+        insert into cm_mall_operation_user(`userID`, `clubID`, `shopID`, `userOrganizeID`,`linkName`,`nickName`,`headimgurl`,`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 id="insertShopUser" parameterType="com.caimei365.user.model.po.UserPo" keyProperty="userId"
-            useGeneratedKeys="true">
-        insert into user(`userOrganizeID`, `registerTime`, `registerIP`, `ipAddress`, `source`, `registerUserTypeID`,
-                         `name`, `userName`, `bindMobile`, `email`, `userIdentity`,
-                         `manufacturerStatus`, `password`, `agreeFlag`, `validFlag`)
-        values (#{organizeId}, #{registerTime}, #{registerIp}, #{ipAddress}, #{source}, #{registerUserTypeId}, #{name},
-                #{userName}, #{bindMobile}, #{email}, #{userIdentity}, #{manufacturerStatus},
-                #{password}, #{agreeFlag}, #{validFlag})
+    <insert id="insertShopUser" parameterType="com.caimei365.user.model.po.UserPo" keyProperty="userId" useGeneratedKeys="true">
+        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 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)
-        values (#{userId}, #{name}, #{shortName}, #{linkMan}, #{contractMobile}, #{contractEmail}, #{provinceId},
-                #{cityId}, #{townId}, #{address}, #{socialCreditCode}, #{businessLicense}, #{firstShopType},
-                #{secondShopType}, #{mainProduct}, #{mainProductDesc}, #{shopDesc}, #{website}, #{wxOfficialAccount},
-                #{wxApplets}, #{addTime}, #{validFlag}, #{status}, #{medicalPracticeLicenseImg1})
+    <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)
+        values(#{userId},#{name},#{shortName},#{linkMan},#{contractMobile},#{contractEmail},#{provinceId},#{cityId},#{townId},#{address},#{socialCreditCode},#{businessLicense},#{firstShopType},#{secondShopType},#{mainProduct},#{mainProductDesc},#{shopDesc},#{website},#{wxOfficialAccount},#{wxApplets},#{addTime},#{validFlag},#{status},#{medicalPracticeLicenseImg1})
     </insert>
     <update id="updateUserClubId">
-        update user
-        set clubID = #{clubId}
-        where userID = #{userId}
+        update user set clubID = #{clubId} where userID = #{userId}
     </update>
     <update id="updateUserShopId">
-        update user
-        set shopID = #{shopId}
-        where userID = #{userId}
+        update user set shopID = #{shopId} where userID = #{userId}
     </update>
     <update id="updateClubUserByUpgrade">
-        update user
-        set registerIP = #{registerIp},
-            email      = #{email},
-            name       = #{name}
+        update user set registerIP = #{registerIp},
+                        email = #{email},
+                        name = #{name},
+                        clubStatus = #{clubStatus}
         where userID = #{userId}
     </update>
     <update id="updateShopUserByApply">
         update user set userName = #{userName}, name = #{name}, manufacturerStatus = #{manufacturerStatus}
-        <if test="email != null and email != ''">
-            , email = #{email}
-        </if>
+            <if test="email != null and email != ''">
+                , email = #{email}
+            </if>
         where userID = #{userId}
     </update>
     <update id="updateClubByUpgrade">
         update club set userID = #{userId}, name = #{name}, sname = #{shortName}, contractEmail = #{contractEmail},
-        <if test="contractPhone != null and contractPhone != ''">
-            contractPhone = #{contractPhone},
-        </if>
-        <if test="linkMan != null and linkMan != ''">
-            linkMan = #{linkMan},
-        </if>
-        <if test="linkManIdentity != null and linkManIdentity != ''">
-            linkManIdentity = #{linkManIdentity},
-        </if>
-        provinceID = #{provinceId}, cityID = #{cityId}, townID = #{townId}, address = #{address},
-        <if test="shopPhoto != null  and shopPhoto != 'null'  and shopPhoto != ''">
-            headpic = #{shopPhoto},
-        </if>
-        businessLicenseImage = #{businessLicense}, socialCreditCode = #{socialCreditCode}, firstClubType =
-        #{firstClubType},
-        <if test="firstClubType == 1">
-            secondClubType = #{secondClubType}, department = #{department}, medicalPracticeLicenseImg =
-            #{medicalPracticeLicense},
-        </if>
-        <if test="mainProduct != null and mainProduct != ''">
-            mainpro = #{mainProduct},
-        </if>
-        <if test="fax != null and fax != ''">
-            fax = #{fax},
-        </if>
-        <if test="profile != null and profile != ''">
-            info = #{profile},
-        </if>
-        status = #{status}
+            <if test="contractPhone != null and contractPhone != ''">
+                contractPhone = #{contractPhone},
+            </if>
+            <if test="linkMan != null and linkMan != ''">
+                linkMan = #{linkMan},
+            </if>
+            <if test="linkManIdentity != null and linkManIdentity != ''">
+                linkManIdentity = #{linkManIdentity},
+            </if>
+            provinceID = #{provinceId}, cityID = #{cityId}, townID = #{townId}, address = #{address},
+            <if test="shopPhoto != null  and shopPhoto != 'null'  and shopPhoto != ''">
+                headpic = #{shopPhoto},
+            </if>
+            businessLicenseImage = #{businessLicense}, socialCreditCode = #{socialCreditCode}, firstClubType = #{firstClubType},
+            <if test="firstClubType == 1">
+                secondClubType = #{secondClubType}, department = #{department}, medicalPracticeLicenseImg = #{medicalPracticeLicense},
+            </if>
+            <if test="mainProduct != null and mainProduct != ''">
+                mainpro = #{mainProduct},
+            </if>
+            <if test="fax != null and fax != ''">
+                fax = #{fax},
+            </if>
+            <if test="profile != null and profile != ''">
+                info = #{profile},
+            </if>
+            status = #{status}
         where clubID = #{clubId}
     </update>
     <update id="updateShopInfoByApply">
         update shop set userID = #{userId}, name = #{name},
-        <if test="shortName != null and shortName != ''">
-            sname = #{shortName},
-        </if>
-        <if test="email != null and email != ''">
-            contractEmail = #{email},
-        </if>
-        <if test="linkMan != null and linkMan != ''">
-            linkMan = #{linkMan},
-        </if>
-        <if test="townId != null and townId != ''">
-            provinceID = #{provinceId},cityID = #{cityId},townID = #{townId},address = #{address},
-        </if>
-        <if test="socialCreditCode != null and socialCreditCode != ''">
-            socialCreditCode = #{socialCreditCode},
-        </if>
-        <if test="businessLicense != null and businessLicense != ''">
-            businessLicenseImage = #{businessLicense},
-        </if>
-        <if test="firstShopType != null and firstShopType != ''">
-            firstShopType = #{firstShopType},
-        </if>
-        <if test="secondShopType != null and secondShopType != ''">
-            secondShopType = #{secondShopType},
-        </if>
-        <if test="mainProduct != null and mainProduct != ''">
-            mainpro = #{mainProduct},
-        </if>
-        productDesc = #{mainProductDesc},
-        info = #{shopDesc},
-        website = #{website},
-        wxOfficialAccount = #{wxOfficialAccount},
-        wxApplets = #{wxApplets},
-        status = #{status}
+            <if test="shortName != null and shortName != ''">
+                sname = #{shortName},
+            </if>
+            <if test="email != null and email != ''">
+                contractEmail = #{email},
+            </if>
+            <if test="linkMan != null and linkMan != ''">
+                linkMan = #{linkMan},
+            </if>
+            <if test="townId != null and townId != ''">
+                provinceID = #{provinceId},cityID = #{cityId},townID = #{townId},address = #{address},
+            </if>
+            <if test="socialCreditCode != null and socialCreditCode != ''">
+                socialCreditCode = #{socialCreditCode},
+            </if>
+            <if test="businessLicense != null and businessLicense != ''">
+                businessLicenseImage = #{businessLicense},
+            </if>
+            <if test="firstShopType != null and firstShopType != ''">
+                firstShopType = #{firstShopType},
+            </if>
+            <if test="secondShopType != null and secondShopType != ''">
+                secondShopType = #{secondShopType},
+            </if>
+            <if test="mainProduct != null and mainProduct != ''">
+                mainpro = #{mainProduct},
+            </if>
+            productDesc = #{mainProductDesc},
+            info = #{shopDesc},
+            website = #{website},
+            wxOfficialAccount = #{wxOfficialAccount},
+            wxApplets = #{wxApplets},
+            status = #{status}
         where shopID = #{shopId}
     </update>
 
     <update id="updateGuideFlagByUserId">
-        update user
-        set guideFlag=1
-        where userID = #{userId}
+        update user set guideFlag=1 where userID=#{userId}
     </update>
 
-    <insert id="insertClubTemporary" useGeneratedKeys="true" keyProperty="userId" keyColumn="id"
-            parameterType="com.caimei365.user.model.dto.ClubOnlineDto">
-        INSERT INTO `club_temporary` (`userId`, `name`, `shortName`, `bindMobile`,
-                                      `contractEmail`, `linkMan`, `linkManIdentity`, `provinceId`,
-                                      `cityId`, `townId`, `address`, `shopPhoto`,
-                                      `businessLicense`, `socialCreditCode`,
-                                      `firstClubType`, `secondClubType`,
-                                      `department`, `medicalPracticeLicense`,
-                                      `mainProduct`, `isAgreed`, addTime)
-        VALUES (#{userId}, #{name}, #{shortName}, #{bindMobile},
-                #{contractEmail}, #{linkMan}, #{linkManIdentity}, #{provinceId},
-                #{cityId}, #{townId}, #{address}, #{shopPhoto},
-                #{businessLicense}, #{socialCreditCode},
-                #{firstClubType}, #{secondClubType},
-                #{department}, #{medicalPracticeLicense},
-                #{mainProduct}, #{isAgreed}, now())
+    <insert id="insertClubTemporary" useGeneratedKeys="true" keyProperty="userId" keyColumn="id" parameterType="com.caimei365.user.model.dto.ClubOnlineDto">
+        INSERT INTO `club_temporary` (
+          `userId`, `name`, `shortName`, `bindMobile`,
+          `contractEmail`, `linkMan`, `linkManIdentity`, `provinceId`,
+          `cityId`, `townId`, `address`, `shopPhoto`,
+          `businessLicense`, `socialCreditCode`,
+          `firstClubType`, `secondClubType`,
+          `department`, `medicalPracticeLicense`,
+          `mainProduct`, `isAgreed`,addTime
+        )
+        VALUES
+          (
+            #{userId}, #{name}, #{shortName}, #{bindMobile},
+            #{contractEmail}, #{linkMan}, #{linkManIdentity}, #{provinceId},
+            #{cityId}, #{townId}, #{address}, #{shopPhoto},
+            #{businessLicense}, #{socialCreditCode},
+            #{firstClubType}, #{secondClubType},
+            #{department}, #{medicalPracticeLicense},
+            #{mainProduct}, #{isAgreed},now()
+          )
     </insert>
 
     <select id="getTemporary" resultType="com.caimei365.user.model.vo.ClubTemporaryVo">
-        SELECT `userId`,
-               confirmUserId,
-               `name`,
-               `shortName`,
-               `bindMobile`,
-               `contractEmail`,
-               `linkMan`,
-               `provinceId`,
-               `cityId`,
-               `townId`,
-               `address`,
-               `shopPhoto`,
-               `businessLicense`,
-               `socialCreditCode`,
-               `firstClubType`,
-               `secondClubType`,
-               `department`,
-               `medicalPracticeLicense`,
-               `mainProduct`,
-               `isAgreed`
-        FROM `club_temporary`
-        WHERE id = #{id}
+        SELECT
+          `userId`,
+          confirmUserId,
+          `name`,
+          `shortName`,
+          `bindMobile`,
+          `contractEmail`,
+          `linkMan`,
+          `provinceId`,
+          `cityId`,
+          `townId`,
+          `address`,
+          `shopPhoto`,
+          `businessLicense`,
+          `socialCreditCode`,
+          `firstClubType`,
+          `secondClubType`,
+          `department`,
+          `medicalPracticeLicense`,
+          `mainProduct`,
+          `isAgreed`
+        FROM
+          `club_temporary`
+        WHERE
+          id = #{id}
     </select>
 
     <insert id="insertBeansHistory">
-        INSERT INTO `user_beans_history` (`userId`, `type`, `beansType`, `orderId`, `archiveId`,
-                                          `num`, `pushStatus`, `addTime`, delFlag)
-        VALUES (#{userId}, #{type}, #{beansType}, #{orderId}, #{archiveId},
-                #{num}, #{pushStatus}, #{addTime}, 0)
+        INSERT INTO `user_beans_history` (
+          `userId`, `type`, `beansType`, `orderId`, `archiveId`,
+          `num`, `pushStatus`, `addTime`, delFlag
+        )
+        VALUES
+          (
+            #{userId}, #{type}, #{beansType}, #{orderId}, #{archiveId},
+            #{num}, #{pushStatus}, #{addTime}, 0
+          )
     </insert>
 
     <update id="updateClubUser">
         UPDATE
-            user
-        SET bindMobile            = #{bindMobile},
-            userIdentity          = #{userIdentity},
-            email                 = #{email},
-            userName              = #{userName},
-            source                = #{source},
-            password              = #{password},
-            registerUserTypeID    = #{registerUserTypeId},
-            name                  = #{name},
-            registerTime          = #{registerTime},
-            registerIP            = #{registerIp},
-            ipAddress             = #{ipAddress},
-            serviceProviderStatus = #{serviceProviderStatus},
-            serviceProviderID     = #{serviceProviderId},
-            guideFlag             = #{guideFlag}
-        WHERE userID = #{userId}
+          user
+        SET
+          bindMobile = #{bindMobile},
+          userPermission = #{userPermission},
+          userIdentity = #{userIdentity},
+          email = #{email},
+          userName = #{userName},
+          source = #{source},
+          password = #{password},
+          registerUserTypeID = #{registerUserTypeId},
+          name = #{name},
+          registerTime = #{registerTime},
+          registerIP = #{registerIp},
+          ipAddress = #{ipAddress},
+          clubStatus = #{clubStatus},
+          serviceProviderStatus = #{serviceProviderStatus},
+          serviceProviderID = #{serviceProviderId},
+          guideFlag = #{guideFlag}
+        WHERE
+          userID = #{userId}
     </update>
 
     <update id="updateClub">
         UPDATE
-            club
-        SET name                      = #{name},
-            sname                     = #{shortName},
-            provinceID                = #{provinceId},
-            cityID                    = #{cityId},
-            townID                    = #{townId},
-            spID                      = #{serviceProviderId},
-            address                   = #{address},
-            linkMan                   = #{linkMan},
-            contractPhone             = #{contractPhone},
-            contractMobile            = #{contractMobile},
-            fax                       = #{fax},
-            contractEmail             = #{contractEmail},
-            info                      = #{profile},
-            addTime                   = #{addTime},
-            status                    = #{status},
-            businessLicenseImage      = #{businessLicense},
-            defaultServiceProviderID  = #{serviceProviderId},
-            mainpro                   = #{mainProduct},
-            headpic                   = #{shopPhoto},
-            lastModify                = NOW(),
-            socialCreditCode          = #{socialCreditCode},
-            department                = #{department},
-            medicalPracticeLicenseImg = #{medicalPracticeLicense}
-        WHERE userID = #{userId}
+          club
+        SET
+          name = #{name},
+          sname = #{shortName},
+          provinceID = #{provinceId},
+          cityID = #{cityId},
+          townID = #{townId},
+          spID = #{serviceProviderId},
+          address = #{address},
+          linkMan = #{linkMan},
+          contractPhone = #{contractPhone},
+          contractMobile = #{contractMobile},
+          fax = #{fax},
+          contractEmail = #{contractEmail},
+          info = #{profile},
+          addTime = #{addTime},
+          status = #{status},
+          businessLicenseImage = #{businessLicense},
+          defaultServiceProviderID = #{serviceProviderId},
+          mainpro = #{mainProduct},
+          headpic = #{shopPhoto},
+          lastModify = NOW(),
+          socialCreditCode = #{socialCreditCode},
+          department = #{department},
+          medicalPracticeLicenseImg = #{medicalPracticeLicense}
+        WHERE
+          userID = #{userId}
     </update>
     <select id="selProvince" resultType="java.lang.Integer">
-        SELECT provinceID as provinceId
-        FROM province
-        WHERE NAME LIKE concat('%', #{regionPro}, '%')
-        limit 1
+        SELECT provinceID as provinceId FROM province WHERE NAME LIKE concat('%', #{regionPro} ,'%') limit 1
     </select>
     <select id="selCity" resultType="java.lang.Integer">
-        SELECT cityID as cityId
-        FROM city
-        WHERE NAME LIKE concat('%', #{regionCity}, '%')
-          AND validFlag = 1
-        limit 1
+        SELECT cityID as cityId FROM city WHERE NAME LIKE concat('%', #{regionCity} ,'%') AND validFlag = 1 limit 1
     </select>
 </mapper>

+ 89 - 0
src/main/resources/mapper/SellerMapper.xml

@@ -136,6 +136,7 @@
         LEFT JOIN cm_organ_value_system covs ON covs.userID = u.userID
         LEFT JOIN serviceprovider sp ON c.spID = sp.serviceProviderID
         LEFT JOIN cm_provider_record cpr ON cpr.spID = sp.serviceProviderID and cpr.clubId = c.clubId
+        LEFT JOIN (SELECT DISTINCT clubID, checkTime FROM clubchangesprecord WHERE checkStatus = 1 GROUP BY clubID ORDER BY clubChangeSpRecordID DESC )ccs ON ccs.clubId = c.clubId
         where
         <if test="1 == type">
             c.spID = #{serviceProviderId}
@@ -220,6 +221,14 @@
         <if test="userIdentity != null">
             AND u.userIdentity = #{userIdentity}
         </if>
+        <if test="startTime != null and startTime != ''">
+            AND (ccs.checkTime <![CDATA[ >= ]]> #{startTime}
+                OR cpr.createTime <![CDATA[ >= ]]> #{startTime})
+        </if>
+        <if test="endTime != null and endTime != ''">
+            AND (ccs.checkTime <![CDATA[ <= ]]> #{endTime}
+                OR cpr.createTime <![CDATA[ <= ]]> #{endTime})
+        </if>
         AND covs.stage = 0 AND covs.delType = 1
         group by c.clubID
         order by cpr.createTime desc
@@ -439,4 +448,84 @@
           and  DATE(b.accessTime) = DATE(#{accessTime})
         GROUP BY c.clubId
     </select>
+
+    <select id="getClubAccessDate" resultType="com.caimei365.user.model.vo.RetuenDataVo">
+        select cbr.accessDate
+        from cm_behavior_record cbr
+        LEFT JOIN club c ON cbr.userID = c.userID
+        where c.clubID = #{clubId} group by cbr.accessDate order by cbr.accessDate desc
+    </select>
+    <select id="getClubKeynoteRecord" resultType="com.caimei365.user.model.vo.BehaviorRecodeVo">
+        SELECT
+        b.recordID,
+        b.userID,
+        b.pagePath,
+        pt.pageType,
+        b.pageLabel,
+        b.productID,
+        b.accessTime,
+        b.accessDuration,
+        b.accessDate,
+        b.referer,
+        b.accessClient,
+        b.isReckon,
+        b.region,
+        p.name      AS productName,
+        p.mainImage AS productImage
+        FROM cm_behavior_record b
+        LEFT JOIN club c ON b.userID = c.userID
+        LEFT JOIN product p ON b.productID = p.productID
+        LEFT JOIN cm_page_type pt ON b.pageType = pt.id
+        WHERE c.clubID = #{clubId}
+            and b.pageType IN (6,11)
+            <if test="accessDateList.size()>0">
+                and
+                <foreach collection="accessDateList" item="accessDate" open="(" separator="or" close=")">
+                    b.accessTime like concat('%', #{accessDate}, '%')
+                </foreach>
+            </if>
+        order by b.accessTime desc
+    </select>
+
+    <select id="getUnActiveClub" 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,
+               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,
+               c.addTime, c.status,
+               c.lastCheckOrderDate,
+               u.userIdentity,
+               c.newDeal as newDeal,IF(r.id IS NOT NULL,1,0) AS recordCount,
+               sp.name AS serviceName,
+               covs.activeState AS activeState,
+               covs.customerValue AS customerValue
+            from club c
+            left join user u on c.userID = u.userID
+            LEFT JOIN record_link r ON r.`clubId`=c.`clubID`
+            LEFT JOIN cm_organ_value_system covs ON covs.userID = u.userID
+            LEFT JOIN serviceprovider sp ON c.spID = sp.serviceProviderID
+        WHERE covs.delType = 1 AND covs.stage = 0 AND covs.activeStatus = 1
+          AND sp.serviceProviderID = #{serviceProviderId}
+        GROUP BY covs.userID
+    </select>
+
 </mapper>

+ 23 - 0
src/main/resources/mapper/ShopMapper.xml

@@ -96,6 +96,29 @@
     <select id="getShopCert" resultType="java.lang.String">
         SELECT image FROM shopcert WHERE shopID = #{shopId} AND shopCertTypeID = #{shopCertTypeId}
     </select>
+
+    <select id="getShopByUserId" resultType="com.caimei365.user.model.vo.UserLoginVo">
+        select
+            u.userID             as userId,
+            u.userOrganizeID     as organizeId,
+            u.clubID             as clubId,
+            u.shopID             as shopId,
+            u.serviceProviderId  as serviceProviderId,
+            u.userName           as userName,
+            u.name               as name,
+            u.mobile             as mobile,
+            u.bindMobile         as bindMobile,
+            u.email              as email,
+            u.userPermission     as userPermission,
+            u.userIdentity       as userIdentity,
+            u.password           as password,
+            u.guideFlag          as guideFlag,
+            u.clubStatus         as clubStatus,
+            u.manufacturerStatus as shopStatus
+        from user u
+        where u.userId = #{userId}
+    </select>
+
     <select id="getShopById" resultType="com.caimei365.user.model.vo.ShopVo">
         select userID as userId, shopID as shopId, name, sname as shortName, linkMan, contractMobile,
                contractEmail, contractEmail as email, provinceID as proviceId, cityID as cityId, townID as townId,

+ 111 - 111
src/test/java/com/caimei365/user/UserApplicationTests.java

@@ -1,115 +1,115 @@
-package com.caimei365.user;
-
-import com.caimei365.user.feign.ToolsFeign;
-import com.caimei365.user.mapper.SuperVipMapper;
-import com.caimei365.user.model.po.SuperVipPo;
-import com.caimei365.user.model.po.VipPayHistoryPo;
-import com.caimei365.user.service.LoginService;
-import com.caimei365.user.utils.AliyunSmsUtil;
-import com.caimei365.user.utils.CodeUtil;
-import com.caimei365.user.utils.ValidateUtil;
-import com.caimei365.user.utils.message.InsideMessage;
-import com.caimei365.user.utils.message.MessageModel;
-import com.caimei365.user.utils.message.MessageType;
-import com.caimei365.user.utils.message.MqInfo;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import javax.annotation.Resource;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-
-@SpringBootTest
-class UserApplicationTests {
-    @Resource
-    private ToolsFeign smsFeign;
-    @Resource
-    LoginService loginService;
-    @Test
-    void contextLoads() {
-
-//        //站内信
-//        MessageModel<InsideMessage> insideMessageMessageModel = new MessageModel<>();
-//        insideMessageMessageModel.code(MessageType.WEB_INSIDE_MESSAGE)
-//                .mqInfo(new MqInfo().topic("MessageLine").delay(1).async(0))
-//                .info(new InsideMessage()
-//                        .userType(3)
-//                        .messageType(3)
-//                        .shopTieredType(4)
-//                        .name("user.getUserName()")
-//                        .userName("user.getUserName()")
-//                        .mobile("164848989")
-//                        .thisId(4648)
-//                        .clubId(448)
-//                );
-//        smsFeign.sendCommonMessage(insideMessageMessageModel);
-        /*List<Integer> listShopId = loginService.getMessageCenterListDay(1);
-        System.out.println("-------->listShopId == "+listShopId.toString()+" <--------------");*/
-//        boolean b = ValidateUtil.validateEmail("182126@qq.com");
-//        System.out.println(b);
-    }
-//    @Resource
-//    private ToolsFeign feign;
+// package com.caimei365.user;
 //
+// import com.caimei365.user.feign.ToolsFeign;
+// import com.caimei365.user.mapper.SuperVipMapper;
+// import com.caimei365.user.model.po.SuperVipPo;
+// import com.caimei365.user.model.po.VipPayHistoryPo;
+// import com.caimei365.user.service.LoginService;
+// import com.caimei365.user.utils.AliyunSmsUtil;
+// import com.caimei365.user.utils.CodeUtil;
+// import com.caimei365.user.utils.ValidateUtil;
+// import com.caimei365.user.utils.message.InsideMessage;
+// import com.caimei365.user.utils.message.MessageModel;
+// import com.caimei365.user.utils.message.MessageType;
+// import com.caimei365.user.utils.message.MqInfo;
+// import org.junit.jupiter.api.Test;
+// import org.springframework.beans.factory.annotation.Autowired;
+// import org.springframework.boot.test.context.SpringBootTest;
 //
-//    @Test
-//    void sms(){
-//        String mobile = "15827317748";
-////        String randomCode = CodeUtil.generateCodeInt(6);
-////        String name ="dsfsd";
-//        //AliyunSmsUtil.sendSms(mobile, 6, "{name:"+ mobile +",content:"+ randomCode +"}");
-////        AliyunSmsUtil.sendSms(mobile, 11, "{name:\""+ name +"\",code:" + randomCode + "}");
-//        feign.getSendSms(mobile,"恭喜您成功开通采美平台超级会员,为期1个月,快戳采美网站链接www.caimei365.com或微信搜索“采美采购商城”小程序登录采美平台畅享会员特权吧。关注公众号“采美365网”可获取更多优惠和精彩资讯!");
-//    }
-//    @Test
-//    public static void main(String[] args) {
-//        Calendar cal = Calendar.getInstance();
-//        System.out.println(cal.get(Calendar.MONTH));
+// import javax.annotation.Resource;
+// import java.text.ParseException;
+// import java.text.SimpleDateFormat;
+// import java.util.ArrayList;
+// import java.util.Calendar;
+// import java.util.Date;
+// import java.util.List;
 //
-//    }
-//    @Resource
-//    SuperVipMapper mapper;
+// @SpringBootTest
+// class UserApplicationTests {
+//     @Resource
+//     private ToolsFeign smsFeign;
+//     @Resource
+//     LoginService loginService;
+//     @Test
+//     void contextLoads() {
 //
-//    @Test
-//    void testmap(){
-//        Calendar cal = Calendar.getInstance();
-//        SuperVipPo vip = new SuperVipPo();
-//        Date date = new Date();
-//        vip.setUpdateTime(date);
-//        cal.setTime(date);
-//        cal.add(Calendar.MONTH,36);
-//        vip.setUserId(13990);
-//        vip.setEndTime(cal.getTime());
-//        mapper.updateVip(vip);
-//    }
-    /*@Autowired
-    private SuperVipMapper vipMapper;
-
-    @Test
-    void time() throws ParseException {
-        List<VipPayHistoryPo> vipHistory = vipMapper.findVipHistory(13990);
-        for (VipPayHistoryPo vipPayHistoryPo : vipHistory) {
-            System.out.println(vipPayHistoryPo);
-        }
-    }*/
-
-//    @Test
-//    void contextLoads() {
-//        Calendar cal = Calendar.getInstance();
-//        cal.setTime(new Date());
-//        cal.set(Calendar.HOUR_OF_DAY, 0);
-//        cal.set(Calendar.MINUTE, 0);
-//        cal.set(Calendar.SECOND,0);
-//        cal.set(Calendar.MILLISECOND, 0);
-//        Date now = cal.getTime();
-//        System.out.println(now);
-//        System.out.println("=======================");
-//        cal.add(Calendar.DAY_OF_MONTH,1);
-//        System.out.println(cal.getTime());
-//    }
-}
+// //        //站内信
+// //        MessageModel<InsideMessage> insideMessageMessageModel = new MessageModel<>();
+// //        insideMessageMessageModel.code(MessageType.WEB_INSIDE_MESSAGE)
+// //                .mqInfo(new MqInfo().topic("MessageLine").delay(1).async(0))
+// //                .info(new InsideMessage()
+// //                        .userType(3)
+// //                        .messageType(3)
+// //                        .shopTieredType(4)
+// //                        .name("user.getUserName()")
+// //                        .userName("user.getUserName()")
+// //                        .mobile("164848989")
+// //                        .thisId(4648)
+// //                        .clubId(448)
+// //                );
+// //        smsFeign.sendCommonMessage(insideMessageMessageModel);
+//         /*List<Integer> listShopId = loginService.getMessageCenterListDay(1);
+//         System.out.println("-------->listShopId == "+listShopId.toString()+" <--------------");*/
+// //        boolean b = ValidateUtil.validateEmail("182126@qq.com");
+// //        System.out.println(b);
+//     }
+// //    @Resource
+// //    private ToolsFeign feign;
+// //
+// //
+// //    @Test
+// //    void sms(){
+// //        String mobile = "15827317748";
+// ////        String randomCode = CodeUtil.generateCodeInt(6);
+// ////        String name ="dsfsd";
+// //        //AliyunSmsUtil.sendSms(mobile, 6, "{name:"+ mobile +",content:"+ randomCode +"}");
+// ////        AliyunSmsUtil.sendSms(mobile, 11, "{name:\""+ name +"\",code:" + randomCode + "}");
+// //        feign.getSendSms(mobile,"恭喜您成功开通采美平台超级会员,为期1个月,快戳采美网站链接www.caimei365.com或微信搜索“采美采购商城”小程序登录采美平台畅享会员特权吧。关注公众号“采美365网”可获取更多优惠和精彩资讯!");
+// //    }
+// //    @Test
+// //    public static void main(String[] args) {
+// //        Calendar cal = Calendar.getInstance();
+// //        System.out.println(cal.get(Calendar.MONTH));
+// //
+// //    }
+// //    @Resource
+// //    SuperVipMapper mapper;
+// //
+// //    @Test
+// //    void testmap(){
+// //        Calendar cal = Calendar.getInstance();
+// //        SuperVipPo vip = new SuperVipPo();
+// //        Date date = new Date();
+// //        vip.setUpdateTime(date);
+// //        cal.setTime(date);
+// //        cal.add(Calendar.MONTH,36);
+// //        vip.setUserId(13990);
+// //        vip.setEndTime(cal.getTime());
+// //        mapper.updateVip(vip);
+// //    }
+//     /*@Autowired
+//     private SuperVipMapper vipMapper;
+//
+//     @Test
+//     void time() throws ParseException {
+//         List<VipPayHistoryPo> vipHistory = vipMapper.findVipHistory(13990);
+//         for (VipPayHistoryPo vipPayHistoryPo : vipHistory) {
+//             System.out.println(vipPayHistoryPo);
+//         }
+//     }*/
+//
+// //    @Test
+// //    void contextLoads() {
+// //        Calendar cal = Calendar.getInstance();
+// //        cal.setTime(new Date());
+// //        cal.set(Calendar.HOUR_OF_DAY, 0);
+// //        cal.set(Calendar.MINUTE, 0);
+// //        cal.set(Calendar.SECOND,0);
+// //        cal.set(Calendar.MILLISECOND, 0);
+// //        Date now = cal.getTime();
+// //        System.out.println(now);
+// //        System.out.println("=======================");
+// //        cal.add(Calendar.DAY_OF_MONTH,1);
+// //        System.out.println(cal.getTime());
+// //    }
+// }