Преглед изворни кода

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

# Conflicts:
#	src/main/resources/mapper/ClubMapper.xml
zhijiezhao пре 1 година
родитељ
комит
cad98389a4

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

@@ -76,6 +76,7 @@ public class RegisterApi {
      *                        passWordConfirm   用户确认密码
      *                        smsCode           短信验证码(旧:activationCode)
      *                        isAgreed          是否同意勾选同意协议,1是,其他否
+     *                        insideFLag        内外部协销标记 0内部协销,1外部协销
      *                        }
      * @param headers         HttpHeaders
      */

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

@@ -70,14 +70,6 @@ public interface ClubMapper {
      */
     void updateClubByUpdateInfo(ClubUpdateDto club);
 
-//    /**
-//     * 获取订单数量
-//     *
-//     * @param userId
-//     * @return
-//     */
-//    OrderCountVo getOrderCount(Integer userId);
-
     /**
      * 查询采美豆类型记录
      *

+ 0 - 8
src/main/java/com/caimei365/user/mapper/SuperVipMapper.java

@@ -71,14 +71,6 @@ public interface SuperVipMapper {
      */
     void addUserBeansHistory(Integer userId, Integer userBeans);
 
-    /**
-     * 用户权限修改
-     * 用户权限 0游客 1 普通用户 2 会员机构 3 供应商 4 协销 5 普通机构 6 呵呵商城用户【V6.2.0版本后0和1不存在】
-     *
-     * @param userId
-     * @param userPermission
-     */
-    void updateUserPermission(Integer userId, Integer userPermission);
 
     /**
      * 用户身份修改

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

@@ -16,6 +16,10 @@ import java.io.Serializable;
 @ApiModel("机构注册")
 @Data
 public class ClubRegisterDto implements Serializable {
+    /**
+     *  内外部协销标记 0内部协销,1外部协销
+     */
+    private Integer insideFLag;
     /**
      * 注册来源: 0网站 1小程序
      */

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

@@ -1,6 +1,5 @@
 package com.caimei365.user.model.po;
 
-import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -65,10 +64,6 @@ public class UserPo implements Serializable {
      * 用户身份: 1协销 2会员机构 3供应商 4普通机构
      */
     private Integer userIdentity;
-    /**
-     * 用户权限: 2会员机构 3供应商 4协销 5普通机构 6颜选用户
-     */
-    private Integer userPermission;
     /**
      * 是否已经引导过(机构升级:0否,1是)
      */
@@ -77,10 +72,6 @@ public class UserPo implements Serializable {
      * 组织名称
      */
     private String name;
-    /**
-     * 机构状态:90:已上线,91:已冻结,92:审查资料未通过,待补充资料,1:待审查资料,2:电话预约,3:已预约,20:待确认,21:待拜访,30:待员工推荐,40:已完成第一次采购
-     */
-    private Integer clubStatus;
     /**
      * 供应商状态:90:已上线,91:已下线,92:审核不通过,3:待审核
      */

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

@@ -14,6 +14,11 @@ import java.util.Date;
  */
 @Data
 public class UserLoginVo implements Serializable {
+
+    /**
+     * 内外部协销标记 0内部协销,1外部协销
+     */
+    private Integer insideFLag;
     /**
      * 用户Id
      */
@@ -101,11 +106,6 @@ public class UserLoginVo implements Serializable {
      */
     @ApiModelProperty("用户身份: 1协销 2会员机构 3供应商 4普通机构")
     private Integer userIdentity;
-    /**
-     * 用户权限: 2会员机构 3供应商 4协销 5普通机构
-     */
-    @ApiModelProperty("用户权限: 2会员机构 3供应商 4协销 5普通机构")
-    private Integer userPermission;
     /**
      * 机构状态:90:已上线,91:已冻结,92:审查资料未通过,待补充资料,1:待审查资料,2:电话预约,3:已预约,20:待确认,21:待拜访,30:待员工推荐,40:已完成第一次采购
      */

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

@@ -61,18 +61,10 @@ public class UserVo implements Serializable {
      * 用户身份: 1协销 2会员机构 3供应商 4普通机构
      */
     private Integer userIdentity;
-    /**
-     * 用户权限: 2会员机构 3供应商 4协销 5普通机构
-     */
-    private Integer userPermission;
     /**
      * 组织名称
      */
     private String name;
-    /**
-     * 机构状态:90:已上线,91:已冻结,92:审查资料未通过,待补充资料,1:待审查资料,2:电话预约,3:已预约,20:待确认,21:待拜访,30:待员工推荐,40:已完成第一次采购
-     */
-    private Integer clubStatus;
     /**
      * 供应商状态:90:已上线,91:已下线,92:审核不通过,3:待审核
      */

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

@@ -88,7 +88,6 @@ public class HeHeServiceImpl implements HeHeService {
                     user.setName(heHeUserDto.getNickName());
                     user.setPassword("HeHe");
                     //6:呵呵商城用户
-                    user.setUserPermission(6);
                     user.setUserIdentity(6);
                     user.setRegisterUserTypeId(6);
                     user.setRegisterTime(currentTime);

+ 60 - 62
src/main/java/com/caimei365/user/service/impl/LoginServiceImpl.java

@@ -187,12 +187,12 @@ public class LoginServiceImpl implements LoginService {
         UserLoginVo baseUser = loginMapper.getLoginOrganizeUserByMobileOrEmail(mobileOrEmail);
         // 机构下线,登录失败
         if (91 == baseUser.getClubStatus()) {
-            return ResponseJson.error(-1,"您的企业账号已被冻结,请联系客服处理", null);
+            return ResponseJson.error(-1, "您的企业账号已被冻结,请联系客服处理", null);
         }
         if (null != baseUser) {
             // 绑定微信信息
             Integer operationUser = loginMapper.getOperationUser(mobileOrEmail);
-            log.info("operationUser==="+operationUser);
+            log.info("operationUser===" + operationUser);
             if (null == operationUser) {
                 // 绑定微信
                 OperationVo operationVo = new OperationVo();
@@ -208,7 +208,7 @@ public class LoginServiceImpl implements LoginService {
                 operationVo.setAddTime(new Date());
                 operationVo.setDelFlag(0);
                 loginMapper.insertOperation(operationVo);
-                log.info("operationVo***"+operationVo);
+                log.info("operationVo***" + operationVo);
             }
             String key = "login-" + baseUser.getUserId();
             boolean exists = redisService.exists(key);
@@ -256,13 +256,13 @@ public class LoginServiceImpl implements LoginService {
                 }
             }
         }
-        return ResponseJson.error(-1,"账户名与密码不匹配,请重新输入", null);
+        return ResponseJson.error(-1, "账户名与密码不匹配,请重新输入", null);
     }
 
     /**
      * @param loginCodeDto {
-     *                      mobile   手机号
-     *                      code     短信验证码
+     *                     mobile   手机号
+     *                     code     短信验证码
      *                     }
      * @return
      * @throws ParseException
@@ -270,10 +270,10 @@ public class LoginServiceImpl implements LoginService {
     @Override
     public ResponseJson<UserLoginVo> codeLogin(LoginCodeDto loginCodeDto) throws ParseException {
         if (ObjectUtils.isEmpty(loginCodeDto.getMobile())) {
-            return ResponseJson.error("请填写手机号",null);
+            return ResponseJson.error("请填写手机号", null);
         }
         if (ObjectUtils.isEmpty(loginCodeDto.getCode())) {
-            return ResponseJson.error("请输入短信验证码",null);
+            return ResponseJson.error("请输入短信验证码", null);
         }
         String mobile = loginCodeDto.getMobile();
         String code = loginCodeDto.getCode();
@@ -291,7 +291,7 @@ public class LoginServiceImpl implements LoginService {
                 return ResponseJson.error("验证码已失效,请重新获取");
             }
             // 获取redis手机短信验证码
-            Object randomCode = redisService.get("code:"+mobile);
+            Object randomCode = redisService.get("code:" + mobile);
 
             if (!ObjectUtils.isEmpty(randomCode)) {
                 if (code.equals(randomCode.toString())) {
@@ -324,8 +324,8 @@ public class LoginServiceImpl implements LoginService {
 
     /**
      * @param loginCodeDto {
-     *                      mobile   手机号
-     *                      code     短信验证码
+     *                     mobile   手机号
+     *                     code     短信验证码
      *                     }
      * @return
      * @throws ParseException
@@ -333,10 +333,10 @@ public class LoginServiceImpl implements LoginService {
     @Override
     public ResponseJson<UserLoginVo> codeOrganizeLogin(LoginCodeDto loginCodeDto) throws ParseException {
         if (ObjectUtils.isEmpty(loginCodeDto.getMobile())) {
-            return ResponseJson.error("请填写手机号",null);
+            return ResponseJson.error("请填写手机号", null);
         }
         if (ObjectUtils.isEmpty(loginCodeDto.getCode())) {
-            return ResponseJson.error("请输入短信验证码",null);
+            return ResponseJson.error("请输入短信验证码", null);
         }
         String mobile = loginCodeDto.getMobile();
         String code = loginCodeDto.getCode();
@@ -351,10 +351,10 @@ public class LoginServiceImpl implements LoginService {
             // 查看验证码是否过期
             long expireTime = redisService.getExpireTime("code:" + mobile);
             if (expireTime < 0) {
-                return ResponseJson.error(-1,"验证码已失效,请重新获取",null);
+                return ResponseJson.error(-1, "验证码已失效,请重新获取", null);
             }
             // 获取redis手机短信验证码
-            Object randomCode = redisService.get("code:"+mobile);
+            Object randomCode = redisService.get("code:" + mobile);
 
             if (!ObjectUtils.isEmpty(randomCode)) {
                 if (code.equals(randomCode.toString())) {
@@ -363,7 +363,7 @@ public class LoginServiceImpl implements LoginService {
                     UserLoginVo baseUser = loginMapper.getLoginOrganizeUserByMobileOrEmail(mobile);
                     // 绑定微信信息
                     Integer operationUser = loginMapper.getOperationUser(mobile);
-                    log.info("operationUser==="+operationUser);
+                    log.info("operationUser===" + operationUser);
                     if (null == operationUser) {
                         // 绑定微信
                         OperationVo operationVo = new OperationVo();
@@ -399,13 +399,13 @@ public class LoginServiceImpl implements LoginService {
                         return logonVerify(baseUser);
                     }
                 } else {
-                    return ResponseJson.error(-1,"验证码不匹配,请重新输入",null);
+                    return ResponseJson.error(-1, "验证码不匹配,请重新输入", null);
                 }
             } else {
-                return ResponseJson.error(-1,"验证码错误,请重新获取",null);
+                return ResponseJson.error(-1, "验证码错误,请重新获取", null);
             }
         } else {
-            return ResponseJson.error(-1,"验证码错误,请重新获取",null);
+            return ResponseJson.error(-1, "验证码错误,请重新获取", null);
         }
     }
 
@@ -418,7 +418,7 @@ public class LoginServiceImpl implements LoginService {
      * @param headers       HttpHeaders
      */
     @Override
-    public ResponseJson<UserLoginVo> appletsAuthorization(String code, String encryptedData, String iv, HttpHeaders headers){
+    public ResponseJson<UserLoginVo> appletsAuthorization(String code, String encryptedData, String iv, HttpHeaders headers) {
         if (StringUtils.isBlank(code)) {
             return ResponseJson.error("没有获取到微信授权code", null);
         }
@@ -492,7 +492,7 @@ public class LoginServiceImpl implements LoginService {
         }
         // 小程序微信授权获取登录信息
         ResponseJson<Map<String, Object>> appletsInfo = weChatService.getInfoMapByApplets(code, headers, 3);
-        log.info("appletsInfo***"+appletsInfo);
+        log.info("appletsInfo***" + appletsInfo);
         if (appletsInfo.getCode() == -1) {
             return ResponseJson.error(appletsInfo.getMsg(), null);
         }
@@ -583,6 +583,7 @@ public class LoginServiceImpl implements LoginService {
         map.put("promotionCount", promotionCount);
         return ResponseJson.success(map);
     }
+
     @Override
     public ResponseJson<Map<String, Object>> ShopCount(Integer messageType, Integer commonId) {
         Integer count = messageCenterMapper.Count(2, commonId);
@@ -609,6 +610,7 @@ public class LoginServiceImpl implements LoginService {
     public Integer updateShopMessageAsRead(Integer messageType, Integer commonId) {
         return messageCenterMapper.updateMessageAsRead(2, messageType, commonId);
     }
+
     @Override
     public Integer updateSpMessageAsRead(Integer messageType, Integer commonId) {
         return messageCenterMapper.updateMessageAsRead(3, messageType, commonId);
@@ -642,7 +644,7 @@ public class LoginServiceImpl implements LoginService {
         list.forEach(mess -> {
             if (null != mess.getClubId()) {
                 MessageCenter messageCenter = messageCenterMapper.MainImage(3, commonId, mess.getOrderId());
-                Integer productCount=messageCenterMapper.productCount(mess.getOrderId());
+                Integer productCount = messageCenterMapper.productCount(mess.getOrderId());
                 if (null != messageCenter) {
                     mess.setMainImage(messageCenter.getMainImage());
                     mess.setOnlinePayFlag(messageCenter.getOnlinePayFlag());
@@ -663,6 +665,7 @@ public class LoginServiceImpl implements LoginService {
         PageInfo<MessageCenter> pageData = new PageInfo<>(list);
         return ResponseJson.success(pageData);
     }
+
     @Override
     public ResponseJson<PageInfo<MessageCenter>> ClubMessageList(Integer commonId, Integer messageType, Integer source, int pageNum, int pageSize) {
         PageHelper.startPage(pageNum, pageSize);
@@ -670,7 +673,7 @@ public class LoginServiceImpl implements LoginService {
         list.forEach(mess -> {
             if (null != mess.getClubId()) {
                 MessageCenter messageCenter = messageCenterMapper.MainImage(1, commonId, mess.getOrderId());
-                Integer productCount=messageCenterMapper.productCount(mess.getOrderId());
+                Integer productCount = messageCenterMapper.productCount(mess.getOrderId());
                 if (null != messageCenter) {
                     mess.setMainImage(messageCenter.getMainImage());
                     mess.setOnlinePayFlag(messageCenter.getOnlinePayFlag());
@@ -697,18 +700,18 @@ public class LoginServiceImpl implements LoginService {
         PageHelper.startPage(pageNum, pageSize);
         List<MessageCenter> list = messageCenterMapper.MessageList(2, messageType, commonId);
         list.forEach(mess -> {
-                String shopName=messageCenterMapper.shopName(commonId);
-                MessageCenter messageCenter = messageCenterMapper.productImage(mess.getProductId(),commonId);
-                if (messageCenter != null) {
-                    mess.setMainImage(messageCenter.getMainImage());
-                    mess.setOnlinePayFlag(messageCenter.getOnlinePayFlag());
-                    if (messageCenter.getProductName().length() > 10) {
-                        mess.setProductName(StringUtils.strip(messageCenter.getProductName().substring(0, 11)));
-                    } else {
-                        mess.setProductName(messageCenter.getProductName());
-                    }
-                    mess.setProductCount(messageCenter.getProductCount());
-                    mess.setRefundType(messageCenter.getRefundType());
+            String shopName = messageCenterMapper.shopName(commonId);
+            MessageCenter messageCenter = messageCenterMapper.productImage(mess.getProductId(), commonId);
+            if (messageCenter != null) {
+                mess.setMainImage(messageCenter.getMainImage());
+                mess.setOnlinePayFlag(messageCenter.getOnlinePayFlag());
+                if (messageCenter.getProductName().length() > 10) {
+                    mess.setProductName(StringUtils.strip(messageCenter.getProductName().substring(0, 11)));
+                } else {
+                    mess.setProductName(messageCenter.getProductName());
+                }
+                mess.setProductCount(messageCenter.getProductCount());
+                mess.setRefundType(messageCenter.getRefundType());
             }
             mess.setShopName(shopName);
         });
@@ -847,8 +850,8 @@ public class LoginServiceImpl implements LoginService {
         operation.setOpenId(openId);
         operation.setUnionId(unionId);
         // 审核未通过 待审核状态
-        if (1 == operation.getClubStatus() || 92 == operation.getClubStatus()){
-            return ResponseJson.error(-1,"登陆失败",operation);
+        if (1 == operation.getClubStatus() || 92 == operation.getClubStatus()) {
+            return ResponseJson.error(-1, "登陆失败", operation);
         }
         // 返回登录校验结果
         return logonVerify(operation);
@@ -887,7 +890,7 @@ public class LoginServiceImpl implements LoginService {
             // 供应商商品上架平台信息
             List<String> shopProductList = loginMapper.getShopProductGroudMall(loginUser.getShopId());
             if (null != shopProductList) {
-                for(String product : shopProductList ) {
+                for (String product : shopProductList) {
                     if (StringUtils.isNotBlank(product)) {
                         if (product.contains("4")) {
                             flag = true;
@@ -907,28 +910,23 @@ public class LoginServiceImpl implements LoginService {
         // 超级会员
         SuperVipDto end = findEnd(loginUser.getUserId());
         loginUser.setVipFlag(end.getVipFlag());
-//        if (1 == end.getVipFlag() && 4 == loginUser.getUserIdentity()) {
-//            // 个人超级会员权限置为会员机构
-//            loginUser.setUserIdentity(2);
-//            loginUser.setUserPermission(2);
-//        }
 
         if (loginUser.getUserId() != null) {
-            if(loginUser.getClubId() != null&&loginUser.getClubId()!=1342){
+            if (loginUser.getClubId() != null && loginUser.getClubId() != 1342) {
                 loginUser.setSpUserId(loginMapper.getClubSpUserId(loginUser.getClubId()));
             }
             Integer shopID = messageCenterMapper.shopID(loginUser.getUserId());
             Integer newReceiptType = messageCenterMapper.newReceiptType(shopID);
             // 上架费次数
-            Integer listingFeeCount= messageCenterMapper.listingFee(shopID);
+            Integer listingFeeCount = messageCenterMapper.listingFee(shopID);
             // 上架费有效期内个数
-            Integer listingfeeExpireCount= messageCenterMapper.listingfeeExpire(shopID);
+            Integer listingfeeExpireCount = messageCenterMapper.listingfeeExpire(shopID);
             // 有免除上架费的次数
-            Integer receStatctCount=messageCenterMapper.receStatct(shopID);
+            Integer receStatctCount = messageCenterMapper.receStatct(shopID);
             Integer listingFee = 0;
             // 如果上架费次数为 0 ;所有上架费都不在在生效时间; 没有免除过上架费;
-            if(listingFeeCount > 0 && listingfeeExpireCount == 0){
-                if(receStatctCount <= 0){
+            if (listingFeeCount > 0 && listingfeeExpireCount == 0) {
+                if (receStatctCount <= 0) {
                     listingFee = 1;
                 }
             }
@@ -1036,13 +1034,13 @@ public class LoginServiceImpl implements LoginService {
                 System.out.println(savedCount);
             } else {
                 savedCount = messageCenterMapper.Count(2, 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 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;
                     }
                 }
 
@@ -1127,7 +1125,7 @@ public class LoginServiceImpl implements LoginService {
         // 账号密码验证、短信验证校验方式
         if ("0".equals(passOrNote)) {
             md5Password = Md5Util.md5(password);
-            item= md5Password.equals(user.getPassword());
+            item = md5Password.equals(user.getPassword());
         }
         if ("1".equals(passOrNote)) {
             item = true;
@@ -1550,10 +1548,10 @@ public class LoginServiceImpl implements LoginService {
         // 账号密码验证
         if ("0".equals(codeType)) {
             if (ObjectUtils.isEmpty(loginCodeDto.getMobileOrEmail())) {
-                return ResponseJson.error("请输入账号",null);
+                return ResponseJson.error("请输入账号", null);
             }
             if (ObjectUtils.isEmpty(loginCodeDto.getPassword())) {
-                return ResponseJson.error("请输入密码",null);
+                return ResponseJson.error("请输入密码", null);
             }
             // 账号
             String mobileOrEmail = loginCodeDto.getMobileOrEmail();
@@ -1571,10 +1569,10 @@ public class LoginServiceImpl implements LoginService {
         } else {
             // 手机短信验证
             if (ObjectUtils.isEmpty(loginCodeDto.getMobile())) {
-                return ResponseJson.error("请输入手机号",null);
+                return ResponseJson.error("请输入手机号", null);
             }
             if (ObjectUtils.isEmpty(loginCodeDto.getCode())) {
-                return ResponseJson.error("请输入验证码",null);
+                return ResponseJson.error("请输入验证码", null);
             }
             String mobile = loginCodeDto.getMobile();
             String code = loginCodeDto.getCode();
@@ -1620,7 +1618,7 @@ public class LoginServiceImpl implements LoginService {
 
     @Override
     public List<Integer> getMessageCenterListDay(Integer day) {
-        return  messageCenterMapper.getMessageCenterListDay(day);
+        return messageCenterMapper.getMessageCenterListDay(day);
     }
 
     /**

+ 34 - 69
src/main/java/com/caimei365/user/service/impl/RegisterServiceImpl.java

@@ -89,7 +89,7 @@ public class RegisterServiceImpl implements RegisterService {
     /**
      * 检查账号可以注册 -- 组织
      *
-     * @param mobile 手机号
+     * @param mobile     手机号
      * @param organizeId 组织Id
      * @return sucess
      */
@@ -159,10 +159,17 @@ public class RegisterServiceImpl implements RegisterService {
             return ResponseJson.error(passResult);
         }
         // 协销Id,默认采美官方
-        Integer spId =1342;
-        if (null !=clubRegisterDto.getIsSp()&&1 ==clubRegisterDto.getIsSp()) {
-            spId =null!= clubRegisterDto.getSpId()?clubRegisterDto.getSpId():clubMapper.getSpIdRAND();
+        Integer spId = 1342;
+        int ss = null != clubRegisterDto.getInsideFLag() ? clubRegisterDto.getInsideFLag() : 0;
+        // 外部协销
+        if (null != clubRegisterDto.getInsideFLag() && 1 == clubRegisterDto.getInsideFLag()) {
+            spId = clubRegisterDto.getSpId();
+        } else {
+            if (null != clubRegisterDto.getIsSp() && 1 == clubRegisterDto.getIsSp()) {
+                spId = null != clubRegisterDto.getSpId() ? clubRegisterDto.getSpId() : clubMapper.getSpIdRAND();
+            }
         }
+        spId = null == spId ? 1342 : spId;
         // 获取ip所在地
         String ipAddress = "";
         Integer provinceId = null;
@@ -180,7 +187,7 @@ public class RegisterServiceImpl implements RegisterService {
         } catch (IOException e) {
             e.printStackTrace();
         }
-        log.info("ip所在地====》"+ipAddress);
+        log.info("ip所在地====》" + ipAddress);
         /*
             组装用户数据 user
          */
@@ -208,12 +215,8 @@ public class RegisterServiceImpl implements RegisterService {
         user.setBindMobile(clubRegisterDto.getBindMobile());
         // 用户身份: 1协销 2会员机构 3供应商 4普通机构
         user.setUserIdentity(4);
-        // 用户权限: 2会员机构 3供应商 4协销 5普通机构
-        user.setUserPermission(5);
         // 是否已经引导过(机构升级:0否,1是)
         user.setGuideFlag(0);
-        // 设置机构上线
-        user.setClubStatus(90);
         // 设置密码
         user.setPassword(Md5Util.md5(clubRegisterDto.getPassword()));
         // 同意协议
@@ -281,8 +284,8 @@ public class RegisterServiceImpl implements RegisterService {
         registerMapper.updateUserClubId(user.getUserId(), club.getClubId());
         // 添加机构协销记录
         if (StringUtils.isNotBlank(club.getLinkMan())) {
-            clubMapper.inProvider(spId, club.getClubId(), spId!=1342?"系统自动分配":club.getLinkMan(), 0);
-            if(spId!=1342) {
+            clubMapper.inProvider(spId, club.getClubId(), spId != 1342 ? "系统自动分配" : club.getLinkMan(), 0);
+            if (spId != 1342) {
                 log.info("注册普通机构,开始站内信推送");
                 String selSpName = clubMapper.selSpName(spId);
                 String spMessage = "【采美365】系统已为你分配机构客户,请及时跟进。机构名称【" + user.getUserName() + "】,联系人【" + user.getUserName() + "】,手机号【" + user.getBindMobile() + "】。";
@@ -389,9 +392,6 @@ public class RegisterServiceImpl implements RegisterService {
             log.info("注册普通机构,默认绑定为机构运营人员");
         }
         log.info("注册普通机构成功,手机号>>>" + clubRegisterDto.getBindMobile());
-//        if (!smsFlag) {
-//            log.info("短信发送失败,手机号:" + clubRegisterDto.getBindMobile());
-//        }
         //新用户自主注册送1000采美豆
         UserBeansHistoryPo beansHistory = new UserBeansHistoryPo();
         beansHistory.setUserId(user.getUserId());
@@ -416,19 +416,19 @@ public class RegisterServiceImpl implements RegisterService {
     @Override
     public ResponseJson accountInfo(String bindMobile, String smsCode, String password, String passWordConfirm) {
         if (StringUtils.isBlank(bindMobile) || StringUtils.isEmpty(bindMobile)) {
-            return ResponseJson.error(-1, "请输入手机号",null);
+            return ResponseJson.error(-1, "请输入手机号", null);
         }
         if (StringUtils.isBlank(smsCode) || StringUtils.isEmpty(smsCode)) {
-            return ResponseJson.error(-1, "请输入验证码",null);
+            return ResponseJson.error(-1, "请输入验证码", null);
         }
         if (StringUtils.isBlank(password) || StringUtils.isEmpty(password)) {
-            return ResponseJson.error(-1, "请输入登录密码",null);
+            return ResponseJson.error(-1, "请输入登录密码", null);
         }
         if (StringUtils.isBlank(passWordConfirm) || StringUtils.isEmpty(passWordConfirm)) {
-            return ResponseJson.error(-1, "请确认密码",null);
+            return ResponseJson.error(-1, "请确认密码", null);
         }
         if (!password.equals(passWordConfirm)) {
-            return ResponseJson.error(-1, "两次输入的密码不一致",null);
+            return ResponseJson.error(-1, "两次输入的密码不一致", null);
         }
         // 手机号与验证码校验
         String result = commonService.organizeMobileValidate(bindMobile, smsCode, 4);
@@ -507,12 +507,8 @@ public class RegisterServiceImpl implements RegisterService {
         user.setBindMobile(organizeRegisterDto.getBindMobile());
         // 用户身份: 1协销 2会员机构 3供应商 4普通机构
         user.setUserIdentity(4);
-        // 用户权限: 2会员机构 3供应商 4协销 5普通机构
-        user.setUserPermission(5);
         // 是否已经引导过(机构升级:0否,1是)
         user.setGuideFlag(0);
-        // 联合丽格设置待审核
-        user.setClubStatus(1);
         // 设置密码
         user.setPassword(Md5Util.md5(organizeRegisterDto.getPassword()));
         // 同意协议
@@ -722,8 +718,6 @@ public class RegisterServiceImpl implements RegisterService {
         user.setEmail(upgradeDto.getContractEmail());
         // 机构名称
         user.setName(upgradeDto.getName());
-        // 待审核资料
-        user.setClubStatus(1);
         // 更新机构用户
         registerMapper.updateClubUserByUpgrade(user);
         /*
@@ -873,7 +867,7 @@ public class RegisterServiceImpl implements RegisterService {
         } catch (IOException e) {
             e.printStackTrace();
         }
-        log.info("ip所在地====》"+ipAddress);
+        log.info("ip所在地====》" + ipAddress);
         /*
             组装用户数据 user
          */
@@ -898,10 +892,6 @@ public class RegisterServiceImpl implements RegisterService {
         user.setBindMobile(mobile);
         // 用户身份: 1协销 2会员机构 3供应商 4普通机构
         user.setUserIdentity(4);
-        // 用户权限: 2会员机构 3供应商 4协销 5普通机构
-        user.setUserPermission(5);
-        // 设置机构上线
-        user.setClubStatus(90);
         // 默认密码
         String randomCode = CodeUtil.generateCodeInt(6);
         String initPassword = "cm" + randomCode;
@@ -916,8 +906,6 @@ public class RegisterServiceImpl implements RegisterService {
         user.setServiceProviderStatus(serviceProvider.getStatus());
         // 会员机构,填写升级资料
         if (StringUtils.isNotBlank(businessLicense)) {
-            // 状态:待审查资料
-            user.setClubStatus(1);
             // 组织名称
             user.setName(clubTemporary.getName());
             // 邮箱
@@ -937,13 +925,12 @@ public class RegisterServiceImpl implements RegisterService {
             }
         } else {
             user.setUserId(confirmUserId);
-            user.setClubStatus(90);
             registerMapper.updateClubUser(user);
             log.info("客服注册机构注册,更新user表userId>>>>>" + confirmUserId);
         }
         /* 机构列表用户状态默认插入 */
 
-        if(user.getUserId() != null) {
+        if (user.getUserId() != null) {
             registerMapper.insertOrgan(user.getUserId());
             log.info("插入数据库用户价值表,cm_organ_value_system表userid=====》" + user.getUserId());
         }
@@ -1044,7 +1031,7 @@ public class RegisterServiceImpl implements RegisterService {
             clubMapper.inProvider(serviceProvider.getServiceProviderId(), club.getClubId(), club.getLinkMan(), 1);
         }
         //推送信息中心-账户通知
-        MessageCenter messageCenter=new MessageCenter();
+        MessageCenter messageCenter = new MessageCenter();
         messageCenter.setShopId(null);
         messageCenter.setClubId(club.getClubId());
         messageCenter.setUserType(1);
@@ -1054,9 +1041,6 @@ public class RegisterServiceImpl implements RegisterService {
         messageCenter.setTime(current);
         messageCenterMapper.addMessageCenter(messageCenter);
 
-
-
-
         /*
          * 操作成功,推送短信给机构,获取账号密码。
          * 协销去后台审核,机构用账号密码登录绑定微信
@@ -1071,7 +1055,7 @@ public class RegisterServiceImpl implements RegisterService {
             logTxt = String.format(logTxt, "普通机构", mobile, initPassword);
         }
         // 发送短信
-        String content = "欢迎成为采美机构用户,您的登录账号为:"+mobile+",初始密码为:cm"+randomCode+",您可使用该账号密码登录采美365网和“采美采购商城”小程序。";
+        String content = "欢迎成为采美机构用户,您的登录账号为:" + mobile + ",初始密码为:cm" + randomCode + ",您可使用该账号密码登录采美365网和“采美采购商城”小程序。";
         boolean smsFlag = remoteCallService.remoteSendSms(0, 1, mobile, content);
         if (!smsFlag) {
             // 短信发送失败重试一次
@@ -1173,7 +1157,7 @@ public class RegisterServiceImpl implements RegisterService {
         } catch (IOException e) {
             e.printStackTrace();
         }
-        log.info("ip所在地====》"+ipAddress);
+        log.info("ip所在地====》" + ipAddress);
         /*
             组装用户数据 user
          */
@@ -1204,8 +1188,6 @@ public class RegisterServiceImpl implements RegisterService {
         user.setEmail(shopRegisterDto.getEmail());
         // 用户身份: 1协销 2会员机构 3供应商 4普通机构
         user.setUserIdentity(3);
-        // 用户权限: 2会员机构 3供应商 4协销 5普通机构
-        user.setUserPermission(3);
         // 供应商状态:90:已上线,91:已下线,92:审核不通过,3:待审核
         user.setManufacturerStatus(3);
         // 用户状态,1正常,0冻结
@@ -1262,8 +1244,8 @@ public class RegisterServiceImpl implements RegisterService {
         shop.setStatus(3);
         //如选择为医疗>>三类器械  则必须要上传资质
         shop.setMedicalPracticeLicenseImg1(shopRegisterDto.getMedicalPracticeLicense());
-        /*
-            保存数据库 shop
+        /**
+         保存数据库 shop
          */
         int insertShopFlag = registerMapper.insertShop(shop);
         if (insertShopFlag < 1) {
@@ -1416,19 +1398,19 @@ public class RegisterServiceImpl implements RegisterService {
                     try {
                         log.info("***********会员充值微信公众号推送************");
                         String accessToken = weChatService.getAccessToken();
-                        String unionId=messageCenterMapper.UnionIdList(userId);
+                        String unionId = messageCenterMapper.UnionIdList(userId);
                         String openid = messageCenterMapper.getOpenidListByPermission(unionId);
-                        String title="恭喜您成为采美商城超级会员";
-                        String name=pac.getDuration() + "个月";
-                        Double price=pac.getPrice();
-                        String date="30";
+                        String title = "恭喜您成为采美商城超级会员";
+                        String name = pac.getDuration() + "个月";
+                        Double price = pac.getPrice();
+                        String date = "30";
                         String time = current;
                         String remarkText = "如在使用中有任何疑问,请在小程序内联系在线客服";
                         // 跳转到【小程序付款-选择支付方式页面】
                         String pagePath = "/pages/user/member/member";
                         // sendTemplateMsg(openid, 标题, 金额, 收款日期, 备注, 跳转链接
                         log.error("获取openid>>>>>" + openid);
-                        weChatService.sendTemplateMsgs(accessToken, openid,title,name,price,date,remarkText, pagePath);
+                        weChatService.sendTemplateMsgs(accessToken, openid, title, name, price, date, remarkText, pagePath);
                     } catch (Exception e) {
                         log.error("【会员充值微信通知】获取微信公众号access_token异常!", e);
                     }
@@ -1441,7 +1423,7 @@ public class RegisterServiceImpl implements RegisterService {
             if (Double.valueOf(userBeans) >= (pac.getPrice() * pac.getProportion())) {
                 //续费生效时间不变,原到期时间+套餐时间
                 beanPay(userId, packageId, endFlag.getEndTime(), endFlag.getVipFlag());
-                     //推送站内消息
+                //推送站内消息
                 if (clubId != null) {
                     //推送信息中心-账户通知
                     SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -1768,7 +1750,7 @@ public class RegisterServiceImpl implements RegisterService {
                 .validFlag("1")
                 .bindMobile(clubRegisterDto.getBindMobile())
         );
-        if (null!=byUser) {
+        if (null != byUser) {
             return ResponseJson.success(String.valueOf(byUser.clubID()), null);
         }
         clubRegisterDto.setPassword("1111aaaa");
@@ -1817,12 +1799,8 @@ public class RegisterServiceImpl implements RegisterService {
         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()));
         // 同意协议
@@ -1890,18 +1868,5 @@ public class RegisterServiceImpl implements RegisterService {
         return ResponseJson.success(String.valueOf(club.getClubId()), null);
     }
 
-//    public static void main(String[] args) throws ParseException {
-//        Date d=new Date();
-//        //1.日期格式
-//        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
-//
-//        //2.某天的日期
-//        Date da1=sdf.parse("2022-01-01 03:30:16");
-//        Long s=(d.getTime()-da1.getTime())/24/60/60/30/1000;
-//        //3.输出间隔天数         getTime获取的是毫秒
-//        System.out.println(s);
-//    }
-
-
 }
 

+ 30 - 26
src/main/java/com/caimei365/user/service/impl/SellerServiceImpl.java

@@ -85,7 +85,7 @@ public class SellerServiceImpl implements SellerService {
                 String start = dateFormat.format(dateFormat.parse(startTime));
                 startTime = start + " 00:00:00";
             }
-            if (StringUtils.isNotBlank(endTime)){
+            if (StringUtils.isNotBlank(endTime)) {
                 String end = dateFormat.format(dateFormat.parse(endTime));
                 endTime = end + " 23:59:59";
             }
@@ -95,17 +95,17 @@ public class SellerServiceImpl implements SellerService {
         // 获取协销用户下的机构列表
         List<ClubVo> clubList = new ArrayList<ClubVo>();
         List<Integer> serviceIds = new ArrayList<Integer>();
-        if (1 == type || 3 == type|| 6 == type) {
-            if(null != groupServiceId && groupServiceId > 0){
+        if (1 == type || 3 == type || 6 == type) {
+            if (null != groupServiceId && groupServiceId > 0) {
                 return ResponseJson.success();
-            }else{
+            } else {
                 PageHelper.startPage(pageNum, pageSize);
                 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,  startTime, endTime, null);
+                clubList = sellerMapper.findClubs(groupServiceId, status, name, userIdentity, 1, startTime, endTime, null);
             } else {
                 Integer leaderId = sellerMapper.findLeaderIdByServiceId(serviceProviderId);
                 Integer managerId = sellerMapper.findmanagerIdByServiceId(serviceProviderId);
@@ -153,15 +153,17 @@ 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,null, null)));
+        map.put("clubList", new PageInfo<>(sellerMapper.findClubs(serviceProviderId, status, name, userIdentity, type, null, null, null)));
         return ResponseJson.success(map);
     }
+
     /**
      * 功能描述: 机构活跃分析比例
-     * @auther: Kaick
-     * @date: 2023/9/4 9:48
+     *
      * @param
      * @return []
+     * @auther: Kaick
+     * @date: 2023/9/4 9:48
      */
 
     @Override
@@ -171,7 +173,7 @@ public class SellerServiceImpl implements SellerService {
         Integer loginSum = Integer.valueOf(spUserLoginSum.get("loginSum").toString());
         Integer not_loginSum = Integer.valueOf(spUserLoginSum.get("not_loginSum").toString());
 //        机构活跃与不活跃占比计算方法,例如:机构活跃数/机构活跃数+机构不活跃数(60/(60+30)=0.666...),保留小数点后2位,四舍五入,0.67;
-        BigDecimal livelyClubProportion = new BigDecimal((loginSum + not_loginSum) != 0 ?(double) loginSum / (loginSum + not_loginSum) * 100 : 0).setScale(2, RoundingMode.UP);
+        BigDecimal livelyClubProportion = new BigDecimal((loginSum + not_loginSum) != 0 ? (double) loginSum / (loginSum + not_loginSum) * 100 : 0).setScale(2, RoundingMode.UP);
         map.put("livelyClub", loginSum);
         map.put("noLivelyClub", not_loginSum);
         map.put("livelyClubProportion", livelyClubProportion);
@@ -263,16 +265,16 @@ public class SellerServiceImpl implements SellerService {
                     UserLoginVo baseUser = loginMapper.getLoginOrganizeUserByMobileOrEmail(mobile);
                     // 协销下线不在登录协销登录
                     if (null != baseUser.getUserIdentity() && 1 == baseUser.getUserIdentity()) {
-                        if ( null != baseUser.getServiceStatus() && 90 != baseUser.getServiceStatus()) {
+                        if (null != baseUser.getServiceStatus() && 90 != baseUser.getServiceStatus()) {
                             seller = new UserLoginVo();
                             seller.setOpenId(openId);
                             seller.setUnionId(unionId);
-                            return ResponseJson.error(-1,"采购员已下线",seller);
+                            return ResponseJson.error(-1, "采购员已下线", seller);
                         }
                     }
                     // 绑定微信信息
                     Integer operationUser = loginMapper.getOperationUser(mobile);
-                    log.info("operationUser==="+operationUser);
+                    log.info("operationUser===" + operationUser);
                     /*if (null == operationUser) {
                         // 绑定微信
                         OperationVo operationVo = new OperationVo();
@@ -291,10 +293,10 @@ public class SellerServiceImpl implements SellerService {
                     }*/
                     return ResponseJson.success(seller);
                 } else {
-                    return ResponseJson.error(-1, "验证码错误,请确认验证码输入",null);
+                    return ResponseJson.error(-1, "验证码错误,请确认验证码输入", null);
                 }
             } else {
-                return ResponseJson.error(-1, "验证码错误, 请重新获取",null);
+                return ResponseJson.error(-1, "验证码错误, 请重新获取", null);
             }
         }
         return ResponseJson.error();
@@ -371,13 +373,13 @@ public class SellerServiceImpl implements SellerService {
 
     @Override
     public ResponseJson<List<CmBehaviorRecordVo>> getBehaviorRecordClub(Integer spId, String accessTime) {
-       // 设置日期格式
+        // 设置日期格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         LocalDate date = LocalDate.parse(accessTime, formatter);
         // 获取前一天的日期
         LocalDate dayBeforeYesterday = date.minusDays(1);
         // 格式化日期
-        accessTime= dayBeforeYesterday.format(formatter);
+        accessTime = dayBeforeYesterday.format(formatter);
         List<CmBehaviorRecordVo> behaviorRecordYesterdayClub = sellerMapper.getBehaviorRecordYesterdayClub(spId, accessTime);
         for (CmBehaviorRecordVo cmBehaviorRecordVo : behaviorRecordYesterdayClub) {
             String pageLabel = sellerMapper.getBehaviorRecordYesterdayPageLabel(spId, cmBehaviorRecordVo.getClubId(), accessTime);
@@ -400,18 +402,18 @@ public class SellerServiceImpl implements SellerService {
             String pageLabel = sellerMapper.getBehaviorRecordYesterdayPageLabel(spId, cmBehaviorRecordVo.getClubId(), accessTime);
             cmBehaviorRecordVo.setPageLabel(pageLabel);
             cmBehaviorRecordVo.setAccessDuration(calculationTime(cmBehaviorRecordVo.getAccessDuration()));
-            if (cmBehaviorRecordVo.getProductID() != 0 && cmBehaviorRecordVo.getPageType().equals("6") ) {
+            if (cmBehaviorRecordVo.getProductID() != 0 && cmBehaviorRecordVo.getPageType().equals("6")) {
                 ProductItemVo productShown = shopMapper.getProductShown(cmBehaviorRecordVo.getProductID());
                 cmBehaviorRecordVo.setTitleId(cmBehaviorRecordVo.getProductID());
                 cmBehaviorRecordVo.setTitle(productShown.getName());
                 cmBehaviorRecordVo.setTitleImage(productShown.getImage());
-            }else if ( cmBehaviorRecordVo.getPageType().equals("11") ) {
+            } else if (cmBehaviorRecordVo.getPageType().equals("11")) {
                 //获取文章id
                 Integer id = null;
                 Pattern pattern = Pattern.compile("info/detail-(.*?)-");
                 Matcher matcher = pattern.matcher(cmBehaviorRecordVo.getPagePath());
                 if (matcher.find()) {
-                    id= Integer.valueOf(matcher.group(1));
+                    id = Integer.valueOf(matcher.group(1));
                 }
                 ShopArticleVo info = articleMapper.getShopArticleById(id);
                 cmBehaviorRecordVo.setTitleId(id);
@@ -491,7 +493,7 @@ public class SellerServiceImpl implements SellerService {
                 rd.setRecord(recordList);
             }
             // 没有重点访问页面数据删除不回显
-            data.removeIf(d -> d.getRecord().size() <= 0 );
+            data.removeIf(d -> d.getRecord().size() <= 0);
         }
         PageHelper.startPage(pageNum, pageSize);
         PageInfo<RetuenDataVo> page = new PageInfo<>(data);
@@ -519,6 +521,7 @@ public class SellerServiceImpl implements SellerService {
 
     /**
      * 机构编号
+     *
      * @param club
      */
     public void setClubNumber(ClubVo club) {
@@ -526,7 +529,7 @@ public class SellerServiceImpl implements SellerService {
         int maxLen = 6;
         int len = newClubId.length();
         if (len < maxLen) {
-            for (int i = 0;i < (maxLen - len); i++) {
+            for (int i = 0; i < (maxLen - len); i++) {
                 newClubId = "0" + newClubId;
             }
         }
@@ -535,12 +538,13 @@ public class SellerServiceImpl implements SellerService {
 
     /**
      * 时间计算
+     *
      * @param recordTime
      * @return
      */
-    public String calculationTime(String recordTime){
+    public String calculationTime(String recordTime) {
         double doc = Double.parseDouble(recordTime);
-        int num = (int)doc;
+        int num = (int) doc;
         //小时
         int HH = 0;
         // 分钟
@@ -548,17 +552,17 @@ public class SellerServiceImpl implements SellerService {
         //秒
         int ss = 0;
         int item = num / 1000;
-        if ((item / 60) >0) {
+        if ((item / 60) > 0) {
             mm = item / 60;
             ss = item % 60;
         } else {
             ss = item;
         }
-        if ((mm / 60) >0) {
+        if ((mm / 60) > 0) {
             HH = mm / 60;
             mm = mm % 60;
         }
-        String  str= HH+":"+mm+":"+ss;
+        String str = HH + ":" + mm + ":" + ss;
         SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
         Date parse = null;
         try {

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

@@ -483,7 +483,7 @@ public class ShopServiceImpl implements ShopService {
     public void Open() {
         Jedis jedis = new Jedis("172.31.165.27", 6379);
         jedis.auth("6#xsI%b4o@5c3RoE");
-        jedis.lpush("constraint", "0");
+        jedis.lpush("constraint", "");
     }
 
     @Override

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

@@ -94,7 +94,7 @@
         SELECT serviceProviderID as serviceProviderId, status as operationStatus FROM serviceprovider WHERE contractMobile = #{mobile} and organizeId = 4 limit 1
     </select>
     <select id="getUserIdByOrganizeStatus" resultType="com.caimei365.user.model.vo.UserLoginVo">
-        SELECT userId, userIdentity, clubStatus
+        SELECT userId, userIdentity, (select status from club where userId = USER.userId limit 1) as clubStatus
         FROM USER
         WHERE userOrganizeID = #{organizeId}
           AND bindMobile = #{mobile}
@@ -109,8 +109,8 @@
         limit 1
     </select>
     <select id="getClubStatusByUserId" resultType="java.lang.Integer">
-        select clubStatus
-        from user
+        select status
+        from club
         where userID = #{userId}
     </select>
     <select id="getShopStatusByUserId" resultType="java.lang.Integer">
@@ -161,8 +161,7 @@
                bindMobile,
                password,
                userIdentity,
-               userPermission,
-               clubStatus,
+               (select status from club where userId = user.userId limit 1) as clubStatus,
                manufacturerStatus,
                serviceProviderStatus,
                auditNote,

+ 166 - 111
src/main/resources/mapper/ClubMapper.xml

@@ -4,11 +4,14 @@
     <insert id="insertRemarks" parameterType="com.caimei365.user.model.po.ClubRemarksPo" keyProperty="remarksId"
             useGeneratedKeys="true">
         insert into cm_club_remarks(clubId, serviceProviderId, remarks, addTime, questionMan, consultType, clubType,
-                                    pinceSensitve, satisfied, followup, extra, createServiceProviderId, productID, reportID,
-                                    communicationSituation, communicationMethods, customerSource, customerGender, customerAge, groupAddition, trendsKeyword, stateKeyword)
+                                    pinceSensitve, satisfied, followup, extra, createServiceProviderId, productID,
+                                    reportID,
+                                    communicationSituation, communicationMethods, customerSource, customerGender,
+                                    customerAge, groupAddition, trendsKeyword, stateKeyword)
         values (#{clubId}, #{serviceProviderId}, #{remarks}, now(), #{questionMan}, #{consult}, #{clubType},
                 #{pinceSensitve}, #{satisfied}, #{followup}, #{extra}, #{serviceProviderId}, #{productID}, #{reportID},
-                #{communicationSituation}, #{communicationMethods},#{customerSource},#{customerGender},#{customerAge},#{groupAddition},#{trendsKeyword}, #{stateKeyword} )
+                #{communicationSituation}, #{communicationMethods}, #{customerSource}, #{customerGender},
+                #{customerAge}, #{groupAddition}, #{trendsKeyword}, #{stateKeyword})
     </insert>
     <insert id="insertRemarksImage">
         insert into cm_club_remarks_file(remarksId, fileType, imageUrl)
@@ -19,16 +22,21 @@
         values (#{remarksId}, 2, #{fileName}, #{ossName})
     </insert>
     <insert id="insertQuestionMan" keyProperty="remarksId" keyColumn="id" useGeneratedKeys="true">
-        insert into cm_visitor_remarks(questionManId, serviceProviderId, remarks, addTime, questionMan, concactTime, createServiceProviderId)
-        values (#{questionManId}, #{serviceProviderId}, #{remarks}, now(), #{questionMan}, #{concactTime}, #{serviceProviderId})
+        insert into cm_visitor_remarks(questionManId, serviceProviderId, remarks, addTime, questionMan, concactTime,
+                                       createServiceProviderId)
+        values (#{questionManId}, #{serviceProviderId}, #{remarks}, now(), #{questionMan}, #{concactTime},
+                #{serviceProviderId})
     </insert>
     <insert id="insertVisitorRemark" keyProperty="remarksId" useGeneratedKeys="true">
         insert into cm_visitor_remarks(questionMan, questionManId, serviceProviderId, remarks, addTime, consultType,
-                                       clubType, pinceSensitve, satisfied, followup, extra, reportID, productID, createServiceProviderId,
-                                       communicationSituation, communicationMethods, customerSource, customerGender, customerAge, groupAddition, trendsKeyword, stateKeyword)
+                                       clubType, pinceSensitve, satisfied, followup, extra, reportID, productID,
+                                       createServiceProviderId,
+                                       communicationSituation, communicationMethods, customerSource, customerGender,
+                                       customerAge, groupAddition, trendsKeyword, stateKeyword)
         values (#{questionMan}, #{questionManId}, #{serviceProviderId}, #{remarks}, now(), #{consult}, #{clubType},
                 #{pinceSensitve}, #{satisfied}, #{followup}, #{extra}, #{reportId}, #{productId}, #{serviceProviderId},
-                #{communicationSituation}, #{communicationMethods},#{customerSource},#{customerGender},#{customerAge},#{groupAddition},#{trendsKeyword}, #{stateKeyword})
+                #{communicationSituation}, #{communicationMethods}, #{customerSource}, #{customerGender},
+                #{customerAge}, #{groupAddition}, #{trendsKeyword}, #{stateKeyword})
     </insert>
     <update id="updateClubNewDeal">
         update club
@@ -46,9 +54,10 @@
     <insert id="concactVisit" parameterType="com.caimei365.user.model.vo.RemarksVo" keyProperty="remarksId"
             useGeneratedKeys="true">
         insert into cm_club_remarks(clubId, serviceProviderId, remarks, addTime, questionMan, concactTime, consultType,
-                                    clubType, pinceSensitve, satisfied, followup, extra, createServiceProviderId, productID, reportID)
+                                    clubType, pinceSensitve, satisfied, followup, extra, createServiceProviderId,
+                                    productID, reportID)
         values (#{clubId}, #{serviceProviderId}, #{remarks}, #{addTime}, #{questionMan}, now(), #{consult}, #{clubType},
-                #{pinceSensitve}, #{satisfied}, #{followup}, #{extra},#{serviceProviderId}, #{productId}, #{reportId})
+                #{pinceSensitve}, #{satisfied}, #{followup}, #{extra}, #{serviceProviderId}, #{productId}, #{reportId})
     </insert>
     <insert id="insertChangeRecord" parameterType="com.caimei365.user.model.vo.ClubChangeSpVo"
             keyProperty="clubChangeSpRecordID"
@@ -91,8 +100,7 @@
         <if test="email != null and email != ''">
             email = #{email},
         </if>
-        userName = #{userName},
-        clubStatus = 1
+        userName = #{userName}
         where userID = #{userId}
     </update>
     <select id="selClubData" resultType="com.caimei365.user.model.vo.ClubVo">
@@ -216,37 +224,45 @@
         where id = #{remarksId}
     </delete>
     <select id="getClubById" resultType="com.caimei365.user.model.vo.ClubVo">
-        select clubID                    as clubId,
-               userID                    as userId,
+        select clubID                                                                                                as clubId,
+               userID                                                                                                as userId,
                name,
-               sname                     as shortName,
+               sname                                                                                                 as shortName,
                contractMobile,
                contractEmail,
                contractPhone,
                linkMan,
                linkManIdentity,
-               provinceID                as proviceId,
-               cityID                    as cityId,
-               townID                    as townId,
-               ifnull(address, '暂无')     as address,
-               headpic                   as shopPhoto,
-               businessLicenseImage      as businessLicense,
+               provinceID                                                                                            as proviceId,
+               cityID                                                                                                as cityId,
+               townID                                                                                                as townId,
+               ifnull(address, '暂无')                                                                                 as address,
+               headpic                                                                                               as shopPhoto,
+               businessLicenseImage                                                                                  as businessLicense,
                socialCreditCode,
                firstClubType,
                secondClubType,
                department,
-               medicalPracticeLicenseImg as medicalPracticeLicense,
-               mainpro                   as mainProduct,
+               medicalPracticeLicenseImg                                                                             as medicalPracticeLicense,
+               mainpro                                                                                               as mainProduct,
                fax,
-               info                      as profile,
-               spID                      as serviceProviderId,
+               info                                                                                                  as profile,
+               spID                                                                                                  as serviceProviderId,
                addTime,
                status,
                lastCheckOrderDate,
-               newDeal                   as newDeal,
-               (select userIdentity from user where userId = c.userId) as userIdentity,
-                (select activeState from cm_organ_value_system where stage = 0 and delType = 1 and userId = c.userId) as activeState,
-                (select customerValue from cm_organ_value_system where stage = 0 and delType = 1 and userId = c.userId) as customerValue
+               newDeal                                                                                               as newDeal,
+               (select userIdentity from user where userId = c.userId)                                               as userIdentity,
+               (select activeState
+                from cm_organ_value_system
+                where stage = 0
+                  and delType = 1
+                  and userId = c.userId)                                                                             as activeState,
+               (select customerValue
+                from cm_organ_value_system
+                where stage = 0
+                  and delType = 1
+                  and userId = c.userId)                                                                             as customerValue
         from club c
         where clubID = #{clubId}
     </select>
@@ -305,25 +321,25 @@
     </update>
     <update id="updateRemarks">
         update cm_club_remarks
-        set remarks         = #{remarks},
-            questionMan     = #{questionMan},
-            consultType     = #{consult},
-            clubType        = #{clubType},
-            pinceSensitve   = #{pinceSensitve},
-            satisfied       = #{satisfied},
-            followup        = #{followup},
-            extra           = #{extra},
-            productID       = #{productID},
-            reportID        = #{reportID},
-            communicationSituation  = #{communicationSituation},
-            communicationMethods    = #{communicationMethods},
-            customerSource          = #{customerSource},
-            customerGender          = #{customerGender},
-            customerAge             = #{customerAge},
-            groupAddition           = #{groupAddition},
-            trendsKeyword   = #{trendsKeyword},
-            stateKeyword    = #{stateKeyword}
-            where id = #{remarksId}
+        set remarks                = #{remarks},
+            questionMan            = #{questionMan},
+            consultType            = #{consult},
+            clubType               = #{clubType},
+            pinceSensitve          = #{pinceSensitve},
+            satisfied              = #{satisfied},
+            followup               = #{followup},
+            extra                  = #{extra},
+            productID              = #{productID},
+            reportID               = #{reportID},
+            communicationSituation = #{communicationSituation},
+            communicationMethods   = #{communicationMethods},
+            customerSource         = #{customerSource},
+            customerGender         = #{customerGender},
+            customerAge            = #{customerAge},
+            groupAddition          = #{groupAddition},
+            trendsKeyword          = #{trendsKeyword},
+            stateKeyword           = #{stateKeyword}
+        where id = #{remarksId}
     </update>
     <update id="updateQuestionMan">
         update cm_visitor_remarks
@@ -333,8 +349,8 @@
     </update>
     <update id="updateVisitorRemark">
         update cm_visitor_remarks
-        set remarks      = #{remarks},
-            consultType  = #{consult},
+        set remarks                = #{remarks},
+            consultType            = #{consult},
             clubType=#{clubType},
             pinceSensitve=#{pinceSensitve},
             satisfied=#{satisfied},
@@ -342,14 +358,14 @@
             extra=#{extra},
             reportID=#{reportId},
             productID=#{productId},
-            communicationSituation  = #{communicationSituation},
-            communicationMethods    = #{communicationMethods},
-            customerSource          = #{customerSource},
-            customerGender          = #{customerGender},
-            customerAge             = #{customerAge},
-            groupAddition           = #{groupAddition},
-            trendsKeyword   = #{trendsKeyword},
-            stateKeyword    = #{stateKeyword}
+            communicationSituation = #{communicationSituation},
+            communicationMethods   = #{communicationMethods},
+            customerSource         = #{customerSource},
+            customerGender         = #{customerGender},
+            customerAge            = #{customerAge},
+            groupAddition          = #{groupAddition},
+            trendsKeyword          = #{trendsKeyword},
+            stateKeyword           = #{stateKeyword}
         where id = #{remarksId}
     </update>
     <update id="updateVisit">
@@ -503,20 +519,31 @@
     </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 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
+        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
+                 left join club c on ccr.clubId = c.clubId
+        where c.userId = #{userId}
+        order by ccr.addTime desc
+        limit 1
     </select>
 
     <select id="getPriorKeywordList" resultType="java.util.Map">
         select cusf.keyword as label
         from cm_prior_keyword cpk
-        left join cm_user_search_frequency cusf on cpk.searchId = cusf.id
-        WHERE cpk.delFlag = 0 AND cusf.delStatus = 1
+                 left join cm_user_search_frequency cusf on cpk.searchId = cusf.id
+        WHERE cpk.delFlag = 0
+          AND cusf.delStatus = 1
         order by cusf.dynamicStatus DESC, cpk.addTime desc
     </select>
 
@@ -529,7 +556,8 @@
     </select>
 
     <insert id="insertLabel">
-        insert into cm_user_search_frequency(fromSearch, serviceProviderId, keyword, frequency, trueStatus, dynamicStatus, addTime)
+        insert into cm_user_search_frequency(fromSearch, serviceProviderId, keyword, frequency, trueStatus,
+                                             dynamicStatus, addTime)
         values (4, #{serviceProviderId}, #{keyword}, 0, #{trueStatus}, #{dynamicStatus}, now())
     </insert>
 
@@ -675,13 +703,16 @@
     <select id="getRemarksListByKey" resultType="com.caimei365.user.model.vo.RemarksVo">
 
         SELECT DISTINCT
-        ccr.id AS remarksId, ccr.remarks,ccr.addTime,ccr.questionMan,ccr.serviceProviderId as serviceProviderId, ccr.createServiceProviderId as createServiceProviderId,
+        ccr.id AS remarksId, ccr.remarks,ccr.addTime,ccr.questionMan,ccr.serviceProviderId as serviceProviderId,
+        ccr.createServiceProviderId as createServiceProviderId,
         csr.leaderId AS leaderId,IFNULL(ccr.consultType,'') as consult, c.Name as clubName,
-        ccr.clubType AS clubType,ccr.pinceSensitve AS pinceSensitve,ccr.satisfied AS satisfied,ccr.followup AS followup,ccr.extra AS extra,
+        ccr.clubType AS clubType,ccr.pinceSensitve AS pinceSensitve,ccr.satisfied AS satisfied,ccr.followup AS
+        followup,ccr.extra AS extra,
         ccr.communicationSituation, ccr.communicationMethods, ccr.customerSource, ccr.customerGender,
         ccr.groupAddition, ccr.customerAge, ccr.trendsKeyword, ccr.stateKeyword,
         (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID= csr.leaderId) AS leaderName,
-        (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.createServiceProviderId) as recordName,c.newDeal as newDeal,cmc.status as status
+        (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.createServiceProviderId) as
+        recordName,c.newDeal as newDeal,cmc.status as status
         # (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.oldserviceProviderId) AS oldName
         FROM cm_club_remarks ccr
         LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
@@ -690,7 +721,7 @@
         LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
         LEFT JOIN cm_club_report cmc ON cmc.ID = ccr.reportID
         where
-              (ccr.serviceProviderId=#{serviceProviderId} or ccr.createServiceProviderId=#{serviceProviderId})
+        (ccr.serviceProviderId=#{serviceProviderId} or ccr.createServiceProviderId=#{serviceProviderId})
 
         <if test="keyWord != null and keyWord != ''">
             AND (ccr.remarks LIKE CONCAT('%', #{keyWord}, '%')
@@ -738,7 +769,8 @@
         SELECT DISTINCT
         ccr.id as remarksId, ccr.questionManId, ccr.remarks, ccr.addTime as addDate,
         ccr.questionMan,IFNULL(ccr.consultType,'') as consult, ccr.createServiceProviderId as createServiceProviderId,
-        ccr.serviceProviderId,ccr.clubType,ccr.pinceSensitve,ccr.satisfied,ccr.followup,ccr.extra,ccr.trendsKeyword, ccr.stateKeyword,
+        ccr.serviceProviderId,ccr.clubType,ccr.pinceSensitve,ccr.satisfied,ccr.followup,ccr.extra,ccr.trendsKeyword,
+        ccr.stateKeyword,
         (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS recordName,
         (select name from serviceprovider s where s.serviceProviderID = csr.leaderId) as leaderName,cmc.status as status
         FROM cm_visitor_remarks ccr
@@ -959,8 +991,8 @@
         SELECT keyword as label
         FROM cm_user_search_frequency
         WHERE keyword like concat('%', #{keyword}, '%')
-        and dynamicStatus = #{type}
-        and delStatus = 1
+          and dynamicStatus = #{type}
+          and delStatus = 1
         order by addtime DESC
     </select>
 
@@ -1086,10 +1118,26 @@
         WHERE csg.serviceId = #{spId}
     </select>
     <select id="selTotal" resultType="com.caimei365.user.model.dto.CmPortraitDto">
-        SELECT (SELECT COUNT(shopOrderId) FROM cm_shop_order WHERE clubID = #{clubId} AND shopStatus != 4 AND shopStatus != 5 AND refundStatus != 2 AND orderTime <![CDATA[ < ]]> NOW()) AS orderTotal,
-               (SELECT IFNULL(SUM(totalAmount), 0) FROM cm_shop_order WHERE clubID = #{clubId} AND shopStatus != 4 AND shopStatus != 5 AND refundStatus != 2 AND orderTime <![CDATA[ < ]]> NOW()) AS orderTotalAmount,
-               (SELECT COUNT(cbr.recordID) FROM cm_behavior_record cbr LEFT JOIN club c ON cbr.userID = c.userID
-                WHERE cbr.pageType IN (8, 9) AND c.clubID = #{clubId} AND cbr.accessDate <![CDATA[ < ]]> now())                                                            AS totalkeywords,
+        SELECT (SELECT COUNT(shopOrderId)
+                FROM cm_shop_order
+                WHERE clubID = #{clubId}
+                  AND shopStatus != 4
+                  AND shopStatus != 5
+                  AND refundStatus != 2
+                  AND orderTime <![CDATA[ < ]]> NOW())                                                                 AS orderTotal,
+               (SELECT IFNULL(SUM(totalAmount), 0)
+                FROM cm_shop_order
+                WHERE clubID = #{clubId}
+                  AND shopStatus != 4
+                  AND shopStatus != 5
+                  AND refundStatus != 2
+                  AND orderTime <![CDATA[ < ]]> NOW())                                                                 AS orderTotalAmount,
+               (SELECT COUNT(cbr.recordID)
+                FROM cm_behavior_record cbr
+                         LEFT JOIN club c ON cbr.userID = c.userID
+                WHERE cbr.pageType IN (8, 9)
+                  AND c.clubID = #{clubId}
+                  AND cbr.accessDate <![CDATA[ < ]]> now())                                                            AS totalkeywords,
                (SELECT COUNT(remarks) FROM cm_club_remarks WHERE clubID = #{clubId} AND addTime <![CDATA[ < ]]> now()) AS remarksTotal
     </select>
     <select id="accessRecords" resultType="com.caimei365.user.model.vo.RecordVo">
@@ -1102,22 +1150,21 @@
         ORDER BY cbr.accessDate DESC
     </select>
     <select id="recordDetail" 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
+        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
@@ -1152,8 +1199,10 @@
 
     <select id="selOrderList" resultType="com.caimei365.user.model.po.NewOrderPo">
         SELECT
-        (SELECT COUNT(shopOrderId) FROM cm_shop_order WHERE clubID = #{clubId} AND shopStatus != 4 AND shopStatus != 5 AND refundStatus != 2 AND orderTime <![CDATA[ < ]]> NOW()) AS orderTotal,
-        (SELECT IFNULL(SUM(totalAmount), 0) FROM cm_shop_order WHERE clubID = #{clubId} AND shopStatus != 4 AND shopStatus != 5 AND refundStatus != 2 AND orderTime <![CDATA[ < ]]> NOW()) AS orderTotalAmount,
+        (SELECT COUNT(shopOrderId) FROM cm_shop_order WHERE clubID = #{clubId} AND shopStatus != 4 AND shopStatus != 5
+        AND refundStatus != 2 AND orderTime <![CDATA[ < ]]> NOW()) AS orderTotal,
+        (SELECT IFNULL(SUM(totalAmount), 0) FROM cm_shop_order WHERE clubID = #{clubId} AND shopStatus != 4 AND
+        shopStatus != 5 AND refundStatus != 2 AND orderTime <![CDATA[ < ]]> NOW()) AS orderTotalAmount,
         cso.clubID,
         co.secondHandOrderFlag,
         co.rebateFlag,
@@ -1165,7 +1214,8 @@
         LEFT JOIN cm_order co ON cso.orderId = co.orderId
         left join cm_order_product cop on cop.shopOrderId = cso.shopOrderId
         <where>
-            cso.clubID = #{clubId} AND cso.shopStatus != 4 AND cso.shopStatus != 5 AND cso.refundStatus != 2 AND cop.productId != 999
+            cso.clubID = #{clubId} AND cso.shopStatus != 4 AND cso.shopStatus != 5 AND cso.refundStatus != 2 AND
+            cop.productId != 999
             <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
                 AND cso.orderTime <![CDATA[ >= ]]> #{startTime} AND cso.orderTime <![CDATA[ <= ]]> #{endTime}
             </if>
@@ -1189,14 +1239,14 @@
     </select>
     <select id="selRegion" resultType="com.caimei365.user.model.vo.BehaviorRecodeVo">
         SELECT IP as ip,
-               accessSource,
-               accessTime,
-               pageType
+        accessSource,
+        accessTime,
+        pageType
         FROM cm_behavior_record_ref
         <where>
             <if test="type == 0">
-               IP = #{ip}
-               AND accessTime like concat('%', #{accessDate}, '%')
+                IP = #{ip}
+                AND accessTime like concat('%', #{accessDate}, '%')
             </if>
             <if test="type == 1">
                 <if test="accessDateList.size()>0">
@@ -1249,30 +1299,35 @@
                         bindMobile           as quickPayMobile,
                         bankUserName         as quickPayUserName,
                         idCard,
-                        cqi.bankCvvCode as cvvCode,
-                        cqi.bankExpireTime as quickPayBankExpireTime
+                        cqi.bankCvvCode      as cvvCode,
+                        cqi.bankExpireTime   as quickPayBankExpireTime
         FROM cm_quickpay_info cqi
                  LEFT JOIN cm_quickpay_bankcode cqb ON cqi.quickPayBankCode = cqb.bankCode
         where cqi.userId = #{userId}
           and cqi.delFlag = 0
     </select>
     <select id="selSpLinkMan" resultType="java.lang.String">
-        SELECT linkMan FROM serviceprovider WHERE serviceProviderID = #{choseServiceId}
+        SELECT linkMan
+        FROM serviceprovider
+        WHERE serviceProviderID = #{choseServiceId}
     </select>
     <select id="getSpIdRAND" resultType="java.lang.Integer">
-        SELECT sp.serviceProviderID FROM serviceprovider sp
+        SELECT sp.serviceProviderID
+        FROM serviceprovider sp
         WHERE sp.organizeID = 0
-          and sp.status=90
-          and sp.serviceProviderID NOT IN ( 1342 , 1353 , 1369)
+          and sp.status = 90
+          and sp.insiderFlag = 0
+          and sp.serviceProviderID != 1342
           and linkMan not LIKE '%测试%'
         ORDER BY RAND()
         LIMIT 0,1;
     </select>
     <select id="getSpUserId" resultType="java.lang.Integer">
-        SELECT sp.userId FROM serviceprovider sp
+        SELECT sp.userId
+        FROM serviceprovider sp
         WHERE sp.organizeID = 0
-          and sp.status=90
-          and sp.serviceProviderID=#{spId}
+          and sp.status = 90
+          and sp.serviceProviderID = #{spId}
         LIMIT 0,1;
     </select>
     <insert id="inProvider">

+ 49 - 52
src/main/resources/mapper/HeHeMapper.xml

@@ -5,83 +5,80 @@
 <mapper namespace="com.caimei365.user.mapper.HeHeMapper">
 
     <select id="findHeHeUserByOpenId" resultType="com.caimei365.user.model.vo.HeHeUserVo">
-        SELECT
-          userId,
-          NAME,
-          mobile,
-          userIdentity,
-          nickName,
-          headImgUrl,
-          openId
-        FROM
-          cm_hehe_user
-        WHERE
-          openId = #{openId}
+        SELECT userId,
+               NAME,
+               mobile,
+               userIdentity,
+               nickName,
+               headImgUrl,
+               openId
+        FROM cm_hehe_user
+        WHERE openId = #{openId}
     </select>
 
     <select id="findHeHeUserByMobile" resultType="com.caimei365.user.model.vo.HeHeUserVo">
-        SELECT
-          userId,
-          NAME,
-          mobile,
-          userIdentity,
-          nickName,
-          headImgUrl,
-          openId
-        FROM
-          cm_hehe_user
-        WHERE
-          mobile = #{mobile}
+        SELECT userId,
+               NAME,
+               mobile,
+               userIdentity,
+               nickName,
+               headImgUrl,
+               openId
+        FROM cm_hehe_user
+        WHERE mobile = #{mobile}
     </select>
     <select id="getCurrentCouponIds" resultType="java.lang.Integer">
         select id
         from cm_hehe_coupon
-        where couponType = #{couponType} and if(startNowFlag = 1,true, NOW() <![CDATA[  >=  ]]> startTime )
-          and if(permanentFlag = 1,true,NOW() <![CDATA[  <=  ]]> endTime) and delFlag = 0
+        where couponType = #{couponType}
+          and if(startNowFlag = 1, true, NOW() <![CDATA[  >=  ]]> startTime)
+          and if(permanentFlag = 1, true, NOW() <![CDATA[  <=  ]]> endTime)
+          and delFlag = 0
     </select>
     <select id="getCouponAmount" resultType="java.lang.Double">
-        select couponAmount from cm_hehe_coupon where id = #{couponId}
+        select couponAmount
+        from cm_hehe_coupon
+        where id = #{couponId}
     </select>
     <select id="findUserMobile" resultType="java.lang.String">
-        select mobile from cm_hehe_user where userId = #{shareUserId}
+        select mobile
+        from cm_hehe_user
+        where userId = #{shareUserId}
     </select>
     <select id="getGroupQrCode" resultType="java.lang.String">
-        select image from cm_hehe_related_images where id = 1;
+        select image
+        from cm_hehe_related_images
+        where id = 1;
     </select>
 
     <update id="updateHeHeUser">
         UPDATE
-          `cm_hehe_user`
-        SET
-          `nickName` = #{nickName},
-          `headImgUrl` = #{headImgUrl},
-          `openId` = #{openId}
-        WHERE
-          `userId` = #{userId}
+            `cm_hehe_user`
+        SET `nickName`   = #{nickName},
+            `headImgUrl` = #{headImgUrl},
+            `openId`     = #{openId}
+        WHERE `userId` = #{userId}
     </update>
 
     <insert id="insertHeHeUser">
         insert into cm_hehe_user (userId, `name`, mobile,
-          userIdentity, nickName, headImgUrl,
-          openId, addTime)
+                                  userIdentity, nickName, headImgUrl,
+                                  openId, addTime)
         values (#{userId}, #{name}, #{mobile},
-          #{userIdentity}, #{nickName}, #{headImgUrl},
-          #{openId}, #{addTime})
+                #{userIdentity}, #{nickName}, #{headImgUrl},
+                #{openId}, #{addTime})
     </insert>
 
-    <insert id="insertUser" parameterType="com.caimei365.user.model.po.UserPo" keyColumn="userID" keyProperty="userId" useGeneratedKeys="true">
-        INSERT INTO USER (
-		  bindMobile, userPermission, userIdentity,
-		  userName, password, name, registerTime,
-		  validFlag, registerUserTypeID
-		)
-		VALUES
-		  (
-			#{bindMobile}, #{userPermission}, #{userIdentity},
-			#{userName}, #{password}, #{name}, #{registerTime},
-			#{validFlag}, #{registerUserTypeId}
-		  )
+    <insert id="insertUser" parameterType="com.caimei365.user.model.po.UserPo" keyColumn="userID" keyProperty="userId"
+            useGeneratedKeys="true">
+        INSERT INTO USER (bindMobile, userIdentity,
+                          userName, password, name, registerTime,
+                          validFlag, registerUserTypeID)
+        VALUES (#{bindMobile}, #{userIdentity},
+                #{userName}, #{password}, #{name}, #{registerTime},
+                #{validFlag}, #{registerUserTypeId})
     </insert>
+
     <insert id="insertCouponShare">
         insert into cm_hehe_coupon_share (shareUserId, receiveUserId, shareCouponId, type, createTime)
         values (#{shareUserId}, #{receiveUserId}, #{shareCouponId}, 1, NOW())

+ 16 - 27
src/main/resources/mapper/LoginMapper.xml

@@ -11,11 +11,10 @@
                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,
+               (select status from club where userId = u.userId limit 1)          as clubStatus,
                u.manufacturerStatus as shopStatus
         from user u
         where u.userID = #{userId}
@@ -32,11 +31,10 @@
                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,
+               (select status from club where userId = u.userId limit 1)  as clubStatus,
                u.manufacturerStatus as shopStatus,
                cu.id                as operationId,
                cu.status            as operationStatus,
@@ -58,11 +56,10 @@
                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,
+               (select status from club where userId = u.userId limit 1) AS clubStatus,
                u.manufacturerStatus AS shopStatus,
                cu.id                AS operationId,
                cu.status            AS operationStatus,
@@ -85,15 +82,14 @@
                u.serviceProviderId  as serviceProviderId,
                u.userName           as userName,
                u.name               as name,
-               ( SELECT linkMan FROM club WHERE userId = u.userID) as clubLinkMan,
+               (SELECT linkMan FROM club WHERE userId = u.userID) as clubLinkMan,
                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,
+               (select status from club where userId = u.userId limit 1) as clubStatus,
                u.manufacturerStatus as shopStatus,
                u.serviceProviderStatus as serviceStatus,
                cu.id                as operationId,
@@ -116,11 +112,10 @@
                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,
+               (select status from club where userId = u.userId limit 1) AS clubStatus,
                u.manufacturerStatus AS shopStatus,
                u.serviceProviderStatus as serviceStatus,
                cu.id                AS operationId,
@@ -152,14 +147,12 @@
                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,
                cu.id                as operationId,
-               cu.status            as operationStatus,
+               (select status from club where userId = u.userId limit 1) as clubStatus,
                cu.mobile            as operationMobile
         from user u
                  left join cm_mall_operation_user cu on cu.userID = u.userID
@@ -176,10 +169,10 @@
                u.mobile            as mobile,
                u.bindMobile        as bindMobile,
                u.email             as email,
-               u.userPermission    as userPermission,
                u.userIdentity      as userIdentity,
                u.guideFlag         as guideFlag,
-               u.password          as password
+               u.password          as password,
+               s.insiderFlag       as insideFlag
         from serviceprovider s
                  left join user u on s.userID = u.userID
         where s.openid = #{openId}
@@ -210,11 +203,10 @@
         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,
+        (select status from club where userId = u.userId limit 1) as clubStatus,
         u.manufacturerStatus as shopStatus,
         o.unionId as unionId,
         o.status as operationStatus,
@@ -240,12 +232,11 @@
         u.mobile as mobile,
         u.bindMobile as bindMobile,
         u.email as email,
-        u.userPermission as userPermission,
         u.userIdentity as userIdentity,
         u.serviceProviderID as serviceProviderId,
         u.password as password,
         u.guideFlag as guideFlag,
-        u.clubStatus as clubStatus,
+        c.status as clubStatus,
         u.manufacturerStatus as shopStatus,
         u.serviceProviderStatus as serviceStatus,
         o.unionId as unionId,
@@ -274,11 +265,10 @@
         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,
+        (select status from club where userId = u.userId limit 1) as clubStatus,
         u.manufacturerStatus as shopStatus,
         o.unionId as unionId,
         o.status as operationStatus,
@@ -314,12 +304,11 @@
         u.mobile as mobile,
         u.bindMobile as bindMobile,
         u.email as email,
-        u.userPermission as userPermission,
         u.userIdentity as userIdentity,
         u.serviceProviderID as serviceProviderId,
         u.password as password,
         u.guideFlag as guideFlag,
-        u.clubStatus as clubStatus,
+        c.status as clubStatus,
         u.manufacturerStatus as shopStatus,
         o.unionId as unionId,
         o.status as operationStatus,
@@ -391,7 +380,7 @@
                ifnull(cou.userOrganizeID, 0) as organizeId,
                u.userIdentity,
                u.guideFlag          as guideFlag,
-               u.clubStatus         as clubStatus,
+               (select status from club where userId = u.userId limit 1) as clubStatus,
                u.manufacturerStatus as shopStatus,
                cou.invitationCodeTime,
                cou.mobile           as operationMobile,
@@ -413,7 +402,7 @@
                ifnull(cou.userOrganizeID, 0) as organizeId,
                u.userIdentity,
                u.guideFlag          as guideFlag,
-               u.clubStatus         as clubStatus,
+               (select status from club where userId = u.userId limit 1) as clubStatus,
                u.manufacturerStatus as shopStatus,
                cou.invitationCodeTime,
                cou.mobile           as operationMobile,
@@ -434,7 +423,7 @@
                u.name               as name,
                u.userIdentity,
                u.guideFlag          as guideFlag,
-               u.clubStatus         as clubStatus,
+               (select status from club where userId = u.userId limit 1) as clubStatus,
                u.manufacturerStatus as shopStatus,
                cou.invitationCodeTime,
                cou.mobile           as operationMobile,

+ 5 - 7
src/main/resources/mapper/RegisterMapper.xml

@@ -2,8 +2,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`, `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 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>
     <select id="selUser" resultType="com.caimei365.user.model.po.UserPo">
         select * from user where registerTime = #{registerTime}
@@ -26,8 +26,8 @@
                                     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`, `userPermission`, `manufacturerStatus` , `password`, `agreeFlag`, `validFlag`)
-        values(#{organizeId},#{registerTime},#{registerIp},#{ipAddress},#{source},#{registerUserTypeId},#{name},#{userName},#{bindMobile},#{email},#{userIdentity},#{userPermission},#{manufacturerStatus},#{password},#{agreeFlag},#{validFlag})
+        insert into user(`userOrganizeID`,`registerTime`, `registerIP`, `ipAddress`, `source`, `registerUserTypeID`, `name`, `userName`, `bindMobile`, `email`, `userIdentity`, `manufacturerStatus` , `password`, `agreeFlag`, `validFlag`)
+        values(#{organizeId},#{registerTime},#{registerIp},#{ipAddress},#{source},#{registerUserTypeId},#{name},#{userName},#{bindMobile},#{email},#{userIdentity},#{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)
@@ -42,8 +42,7 @@
     <update id="updateClubUserByUpgrade">
         update user set registerIP = #{registerIp},
                         email = #{email},
-                        name = #{name},
-                        clubStatus = #{clubStatus}
+                        name = #{name}
         where userID = #{userId}
     </update>
     <update id="updateShopUserByApply">
@@ -193,7 +192,6 @@
           user
         SET
           bindMobile = #{bindMobile},
-          userPermission = #{userPermission},
           userIdentity = #{userIdentity},
           email = #{email},
           userName = #{userName},

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

@@ -11,7 +11,6 @@
                u.bindMobile     as bindMobile,
                u.email          as email,
                u.guideFlag      as guideFlag,
-               u.userPermission as userPermission,
                u.userIdentity   as userIdentity,
                u.serviceProviderID as serviceProviderId,
                u.serviceProviderStatus as serviceStatus,
@@ -19,7 +18,6 @@
         from user u
         where u.mobile = #{mobile}
           and u.userIdentity = 1
-          and u.userPermission = 4
           and u.validFlag = 1
     </select>
     <update id="updateServiceProviderByUserId">

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

@@ -26,13 +26,6 @@
         values (#{userBeans}, 2, 0, now(), 14, #{userId}, 0)
     </insert>
 
-    <update id="updateUserPermission">
-        update user
-        set userPermission=#{userPermission}
-        where userId = #{userId}
-    </update>
-
-
     <update id="updateUserIdentity">
         update user
         set userIdentity=#{userIdentity}