Forráskód Böngészése

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

huangzhiguo 1 éve
szülő
commit
c8a595003d

+ 4 - 6
src/main/java/com/caimei365/user/components/WeChatService.java

@@ -143,7 +143,7 @@ public class WeChatService {
         byte[] keyByte = Base64.decodeBase64(key);
         // 偏移量
         byte[] ivByte = Base64.decodeBase64(iv);
-//        try {
+        try {
             Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding");
             SecretKeySpec spec = new SecretKeySpec(keyByte, "AES");
             AlgorithmParameters parameters = AlgorithmParameters.getInstance("AES");
@@ -157,10 +157,10 @@ public class WeChatService {
                 return new String(resultByte, encodingFormat);
             }
             return null;
-        /*} catch (Exception e) {
+        } catch (Exception e) {
             e.printStackTrace();
-        }*/
-//        return null;
+        }
+        return null;
     }
 
     /**
@@ -376,8 +376,6 @@ public class WeChatService {
      *
      * @param accessToken 微信公众号
      * @param openid      公众号的openid
-     * @param title       标题
-     * @param name        商品名称
      * @param remarkText  备注
      * @param pagePath    跳转链接
      */

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

@@ -119,7 +119,16 @@ public class LoginApi {
         String unionId = loginPasswordDto.getUnionId();
         return sellerService.passwordLogin(mobile, password, unionId);
     }
-
+    /**
+     * 采购员登录(手机号,验证码) --组织
+     *
+     * @return UserLoginVo
+     */
+    @ApiOperation("采购员登录(手机号,验证码) --组织")
+    @PostMapping("/organizeSeller")
+    public ResponseJson<UserLoginVo> organizesellerLogin(LoginCodeDto loginCodeDto) {
+        return sellerService.organizeCodeLogin(loginCodeDto);
+    }
     /**
      * 微信授权登录(小程序),用户数据存入Redis,key前缀:wxInfo:applets:
      * <p>
@@ -391,6 +400,30 @@ public class LoginApi {
         return loginService.invitationCodeLogin(invitationCode, nickName, avatarUrl, unionId);
     }
 
+    /**
+     * 运营人员邀请码授权登录 -- 组织
+     * <p>
+     * spi旧接口:/club/invitationCode
+     *
+     * @param authInvitationDto {
+     *                          invitationCode 邀请码
+     *                          nickName       微信昵称
+     *                          avatarUrl      微信头像(headimgurl)
+     *                          unionId        微信unionId
+     *                          }
+     * @return UserLoginVo
+     */
+    @ApiOperation("运营人员邀请码授权登录 -- 组织")
+    @PostMapping("/auth/invitationOrganize")
+    public ResponseJson<UserLoginVo> invitationCodeOrganizeLogin(AuthInvitationOrganizeDto authInvitationDto) {
+        String invitationCode = authInvitationDto.getInvitationCode();
+        String nickName = authInvitationDto.getNickName();
+        String avatarUrl = authInvitationDto.getAvatarUrl();
+        String unionId = authInvitationDto.getUnionId();
+        Integer organizeId = authInvitationDto.getOrganizeId();
+        return loginService.invitationCodeOrganizeLogin(invitationCode, nickName, avatarUrl, unionId, organizeId);
+    }
+
     /**
      * 运营人员绑定微信
      * <p>

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

@@ -51,13 +51,19 @@ public interface BaseMapper {
      */
     Integer getUserIdByOrganize(@Param("organizeId") Integer organizeId, @Param("mobile") String mobile);
 
+    /**
+     * 获取协销信息
+     * @param mobile
+     * @return
+     */
+    UserLoginVo getServiceProvider(@Param("mobile") String mobile);
     /**
      * 获取组织机构审核状态
      * @param organizeId
      * @param mobile
      * @return
      */
-    Integer getUserIdByOrganizeStatus(@Param("organizeId") Integer organizeId, @Param("mobile") String mobile);
+    UserLoginVo getUserIdByOrganizeStatus(@Param("organizeId") Integer organizeId, @Param("mobile") String mobile);
     /**
      * 根据运营人员手机号获用户Id
      *

+ 9 - 2
src/main/java/com/caimei365/user/mapper/LoginMapper.java

@@ -65,7 +65,7 @@ public interface LoginMapper {
      * @param openId openId
      * @return BaseUser
      */
-    UserLoginVo getServiceProviderUserByOpenId(@Param("openId") String openId);
+    UserLoginVo getServiceProviderUserByOpenId(@Param("openId") String openId,@Param("organizeId") Integer organizeId);
 
     /**
      * 根据用户ID更新协销unionId
@@ -115,8 +115,15 @@ public interface LoginMapper {
      * @param invitationCode
      * @return
      */
-    UserLoginVo getOperationUserByInvitationCode(String invitationCode);
+    UserLoginVo getOperationUserByInvitationCode(String invitationCode, Integer organizeId);
 
+    /**
+     * 根据邀请码获取运营人员 -- 组织
+     * @param invitationCode
+     * @param organizeId
+     * @return
+     */
+    UserLoginVo getOperationOrganizeUserByInvitationCode(String invitationCode, Integer organizeId);
     /**
      * 根据Id获取运营人员用户信息(关联user)
      * @param operationId    用户Id

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

@@ -60,6 +60,13 @@ public interface OperationMapper {
      * 查找供应商名称
      */
     String findShopNameById(Integer shopId);
+    /**
+     * 根据手机号查询运营人员信息
+     * @param mobile
+     * @param organizeId
+     * @return
+     */
+    OperationPo getInfoByMobile(@Param("mobile") String mobile, @Param("organizeId") Integer organizeId);
     /**
      * 新增运营人员
      */

+ 45 - 0
src/main/java/com/caimei365/user/model/dto/AuthInvitationOrganizeDto.java

@@ -0,0 +1,45 @@
+package com.caimei365.user.model.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2023/6/1
+ */
+@ApiModel("运营人员邀请码授权登录--组织")
+@Data
+public class AuthInvitationOrganizeDto implements Serializable {
+    /**
+     * 邀请码
+     */
+    @NotNull
+    @ApiModelProperty("邀请码")
+    private String invitationCode;
+    /**
+     * 微信昵称
+     */
+    @ApiModelProperty("微信昵称")
+    private String nickName;
+    /**
+     * 微信头像(headimgurl)
+     */
+    @ApiModelProperty("微信头像(headimgurl)")
+    private String avatarUrl;
+    /**
+     * 微信unionId
+     */
+    @ApiModelProperty("微信unionId")
+    private String unionId;
+    /**
+     * 组织Id
+     */
+    @ApiModelProperty("组织Id")
+    private Integer organizeId;
+}

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

@@ -54,6 +54,10 @@ public class UserLoginVo implements Serializable {
      */
     @ApiModelProperty("机构名称")
     private String name;
+    /**
+     * 机构联系人
+     */
+    private String clubLinkMan;
     /**
      * 用户名
      */
@@ -109,6 +113,11 @@ public class UserLoginVo implements Serializable {
      */
     @ApiModelProperty("供应商状态:90:已上线")
     private Integer shopStatus;
+    /**
+     * 协销状态: 90:已上线
+     */
+    @ApiModelProperty("协销状态: 90:已上线")
+    private Integer serviceStatus;
     /**
      * 运营人员状态:1未绑定,2已绑定
      */

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

@@ -172,6 +172,17 @@ public interface LoginService {
      */
     ResponseJson<UserLoginVo> invitationCodeLogin(String invitationCode, String nickName, String avatarUrl, String unionId);
 
+    /**
+     * 邀请码登录
+     *
+     * @param invitationCode    邀请码
+     * @param nickName          微信昵称
+     * @param avatarUrl         微信头像(headimgurl)
+     * @param unionId           微信unionId
+     * @param organizeId        组织Id
+     * @return UserLoginVo
+     */
+    ResponseJson<UserLoginVo> invitationCodeOrganizeLogin(String invitationCode, String nickName, String avatarUrl, String unionId, Integer organizeId);
     /**
      * 运营人员绑定微信
      *

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

@@ -2,6 +2,7 @@ package com.caimei365.user.service;
 
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.ClubTemporaryDto;
+import com.caimei365.user.model.dto.LoginCodeDto;
 import com.caimei365.user.model.po.ServiceProviderPo;
 import com.caimei365.user.model.vo.ClubTemporaryVo;
 import com.caimei365.user.model.vo.ClubVo;
@@ -39,6 +40,12 @@ public interface SellerService {
      */
     ResponseJson<UserLoginVo> passwordLogin(String mobile, String password, String unionId);
 
+    /**
+     * 采购员验证码登录 --组织
+     * @param loginCodeDto
+     * @return
+     */
+    ResponseJson<UserLoginVo> organizeCodeLogin(LoginCodeDto loginCodeDto);
     /**
      * 待注册机构列表
      *

+ 65 - 39
src/main/java/com/caimei365/user/service/impl/BaseServiceImpl.java

@@ -120,7 +120,7 @@ public class BaseServiceImpl implements BaseService {
      * 获取短信验证码
      *
      * @param mobile           手机号
-     * @param activateCodeType 1:找回密码,2:手机号注册机构,3:供应商注册,4:修改手机号-旧手机验证码,5:修改手机号-新手机验证码,7:手机验证码登录,8:联合丽格注册,9:联合丽格登录验证,10:联合丽格找回密码,11:联合丽格更换手机号
+     * @param activateCodeType 1:找回密码,2:手机号注册机构,3:供应商注册,4:修改手机号-旧手机验证码,5:修改手机号-新手机验证码,7:手机验证码登录,8:联合丽格注册,9:联合丽格登录验证,10:联合丽格找回密码,11:联合丽格更换手机号--旧手机验证码,12:联合丽格更换手机号--新手机验证码,13联合丽格采购员登录
      * @param platformType     0:www,1:crm/h5,2:小程序
      * @param isCheckCaptcha   是否检查图片验证码,0:检查,1:不检查
      * @param imgCode          图片验证码
@@ -181,21 +181,12 @@ public class BaseServiceImpl implements BaseService {
             String content = "验证码" + randomCode + ",您正在尝试变更重要信息,请妥善保管账户信息。";
             sendFlag = isBeta || remoteCallService.remoteSendSms(0, 1, mobile, content);
             codeTypeTxt = "更换联系人(旧手机号验证码)";
-        } else if (5 == activateCodeType || 11 == activateCodeType) {
+        } else if (5 == activateCodeType) {
             if (null != userId && userId > 0) {
                 return ResponseJson.error("该手机号已被使用");
             }
-            String content = "";
-            // 采美
-            if (5 == activateCodeType) {
-                // 您正在更换联系人手机号,您的验证码为:${code}。
-                content = "验证码" + randomCode + ",您正在尝试变更重要信息,请妥善保管账户信息。";
-            }
-            // 联合丽格
-            if (11 == activateCodeType){
-                // 您正在更改手机号,验证码为:{s6},5分钟内有效,请勿泄漏他人。
-                content = "【丽格集采联盟】您正在更改手机号,验证码为:" + randomCode + ",5分钟内有效,请勿泄漏他人。";
-            }
+            // 您正在更换联系人手机号,您的验证码为:${code}。
+            String content = "验证码" + randomCode + ",您正在尝试变更重要信息,请妥善保管账户信息。";
             sendFlag = isBeta || remoteCallService.remoteSendSms(0, 1, mobile, content);
             codeTypeTxt = "更换联系人(新手机号验证码)";
         } else if (6 == activateCodeType) {
@@ -229,9 +220,17 @@ public class BaseServiceImpl implements BaseService {
                 if (dbUserId == null) {
                     return ResponseJson.error("该手机号暂未注册");
                 }
-                Integer clubStatus = baseMapper.getUserIdByOrganizeStatus(4, mobile);
-                if ( null != clubStatus && 1 == clubStatus) {
-                    return ResponseJson.error(-1,"账号待审核,请耐心等待",null);
+                UserLoginVo userLoginVo = baseMapper.getUserIdByOrganizeStatus(4, mobile);
+                if ( null != userLoginVo.getClubStatus()) {
+                    if (1 == userLoginVo.getClubStatus()) {
+                        return ResponseJson.error(-1, "账号待审核,请耐心等待审核结果", null);
+                    }
+                    if (91 == userLoginVo.getClubStatus()) {
+                        return ResponseJson.error(-1, "该手机号已下线", null);
+                    }
+                }
+                if (1 == userLoginVo.getUserIdentity()) {
+                    return ResponseJson.error(-1, "该手机号,暂未注册成为机构用户", null);
                 }
                 // 欢迎登录联合丽格,您的验证码为:{s6},5分钟内有效,请勿泄漏他人。
                 content = "【丽格集采联盟】欢迎登录联合丽格,您的验证码为:" + randomCode + ",5分钟内有效,请勿泄漏他人。";
@@ -280,6 +279,38 @@ public class BaseServiceImpl implements BaseService {
                 sendFlag = remoteCallService.remoteSendSms(0,1,mobile,content);
             }
             codeTypeTxt = "联合丽格找回密码";
+        } else if (11 == activateCodeType){
+                // 联合丽格
+                // 您正在更改手机号,验证码为:{s6},5分钟内有效,请勿泄漏他人。
+                String content = "【丽格集采联盟】您正在更改手机号,验证码为:" + randomCode + ",5分钟内有效,请勿泄漏他人。";
+
+                sendFlag = isBeta || remoteCallService.remoteSendSms(0, 1, mobile, content);
+                codeTypeTxt = "更换联系人(旧手机号验证码)";
+        } else if (12 == activateCodeType) {
+            // 联合丽格
+            if (null != userId && userId > 0) {
+                return ResponseJson.error("该手机号已被使用");
+            }
+            // 您正在更改手机号,验证码为:{s6},5分钟内有效,请勿泄漏他人。
+            String content = "【丽格集采联盟】您正在更改手机号,验证码为:" + randomCode + ",5分钟内有效,请勿泄漏他人。";
+            sendFlag = isBeta || remoteCallService.remoteSendSms(0, 1, mobile, content);
+            codeTypeTxt = "更换联系人(新手机号验证码)";
+        } else if (13 == activateCodeType) {
+            UserLoginVo loginVo = baseMapper.getServiceProvider(mobile);
+            if (null == loginVo) {
+                return ResponseJson.error(-1, "该手机号暂未添加为采购员", null);
+            }
+            if (90 != loginVo.getOperationStatus()) {
+                return ResponseJson.error(-1, "该采购员账号已下线", null);
+            }
+            // 【丽格集采联盟】您的验证码为:{s6},5分钟内有效,请勿泄漏他人。
+            String content = "【丽格集采联盟】您的验证码为:" + randomCode + ",5分钟内有效,请勿泄漏他人。";
+            sendFlag = isBeta || remoteCallService.remoteSendSms(0,1,mobile,content);
+            if (!sendFlag) {
+                // 短信发送失败重试一次
+                sendFlag = remoteCallService.remoteSendSms(0,1,mobile,content);
+            }
+            codeTypeTxt = "联合丽格采购员登录";
         } else {
             return ResponseJson.error("参数错误:activateCodeType");
         }
@@ -656,29 +687,24 @@ public class BaseServiceImpl implements BaseService {
         if (null == mobileDto.getUserId()) {
             return ResponseJson.error("参数异常:用户Id不能为空!");
         }
-        // 获取用户组织Id
-        Integer organizeId = userCenterMapper.getUserOrganizeId(mobileDto.getUserId());
-        String result = "";
-        if (0 == organizeId) {
-            if (StringUtils.isBlank(mobileDto.getMobile())) {
-                return ResponseJson.error("参数异常:旧手机号不能为空!");
-            }
-            if (StringUtils.isBlank(mobileDto.getSmsCode())) {
-                return ResponseJson.error("参数异常:旧手机号验证码不能为空!");
-            }
-            // 旧手机号与验证码校验
-            result = ValidateUtil.validateMobile(mobileDto.getMobile());
-            if (result != null) {
-                return ResponseJson.error(result);
-            }
-            String smsCode = (String) redisService.get("code:" + mobileDto.getMobile());
-            // 开发 和 测试环境 固定短信验证码 666666
-            if ("dev".equals(profile) || "beta".equals(profile)) {
-                smsCode = (null != smsCode && !"null".equals(smsCode) ? smsCode : "666666");
-            }
-            if (!mobileDto.getSmsCode().equals(smsCode)) {
-                return ResponseJson.error("旧手机验证码错误");
-            }
+        if (StringUtils.isBlank(mobileDto.getMobile())) {
+            return ResponseJson.error("参数异常:旧手机号不能为空!");
+        }
+        if (StringUtils.isBlank(mobileDto.getSmsCode())) {
+            return ResponseJson.error("参数异常:旧手机号验证码不能为空!");
+        }
+        // 旧手机号与验证码校验
+        String result = ValidateUtil.validateMobile(mobileDto.getMobile());
+        if (result != null) {
+            return ResponseJson.error(result);
+        }
+        String smsCode = (String) redisService.get("code:" + mobileDto.getMobile());
+        // 开发 和 测试环境 固定短信验证码 666666
+        if ("dev".equals(profile) || "beta".equals(profile)) {
+            smsCode = (null != smsCode && !"null".equals(smsCode) ? smsCode : "666666");
+        }
+        if (!mobileDto.getSmsCode().equals(smsCode)) {
+            return ResponseJson.error("旧手机验证码错误");
         }
         UserLoginVo user = loginMapper.getLoginUserByUserId(mobileDto.getUserId());
         if (null == user) {

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

@@ -181,6 +181,10 @@ public class LoginServiceImpl implements LoginService {
         }
         //处理比对密码
         UserLoginVo baseUser = loginMapper.getLoginOrganizeUserByMobileOrEmail(mobileOrEmail);
+        // 机构下线,登录失败
+        if (91 == baseUser.getClubStatus()) {
+            return ResponseJson.error(-1,"您的企业账号已被冻结,请联系客服处理", null);
+        }
         if (null != baseUser) {
             // 绑定微信信息
             Integer operationUser = loginMapper.getOperationUser(mobileOrEmail);
@@ -192,8 +196,8 @@ public class LoginServiceImpl implements LoginService {
                 operationVo.setUserType(1);
                 operationVo.setUserId(baseUser.getUserId());
                 operationVo.setClubId(baseUser.getClubId());
-                operationVo.setMobile(baseUser.getMobile());
-                operationVo.setLinkName(baseUser.getUserName());
+                operationVo.setMobile(baseUser.getBindMobile());
+                operationVo.setLinkName(baseUser.getClubLinkMan());
                 operationVo.setStatus(2);
                 operationVo.setUnionId(unionId);
                 operationVo.setBindTime(new Date());
@@ -359,7 +363,7 @@ public class LoginServiceImpl implements LoginService {
                         operationVo.setUserType(1);
                         operationVo.setUserId(baseUser.getUserId());
                         operationVo.setClubId(baseUser.getClubId());
-                        operationVo.setMobile(baseUser.getMobile());
+                        operationVo.setMobile(baseUser.getBindMobile());
                         operationVo.setLinkName(baseUser.getUserName());
                         operationVo.setStatus(2);
                         operationVo.setUnionId(unionId);
@@ -367,7 +371,6 @@ public class LoginServiceImpl implements LoginService {
                         operationVo.setAddTime(new Date());
                         operationVo.setDelFlag(0);
                         loginMapper.insertOperation(operationVo);
-                        log.info("operationVo***"+operationVo);
                     }
                     // 如果前端传入unionId,则存入返回前端
                     baseUser.setUnionId(unionId);
@@ -438,7 +441,7 @@ public class LoginServiceImpl implements LoginService {
         redisService.setMap("wxInfo:applets:" + unionId, infoData);
         log.info("小程序授权登录,返回unionId给前端,用户数据存入Redis,key:wxInfo:applets:" + unionId);
         // 协销授权登录
-        UserLoginVo seller = loginMapper.getServiceProviderUserByOpenId(openId);
+        UserLoginVo seller = loginMapper.getServiceProviderUserByOpenId(openId, 0);
         if (null != seller) {
             loginMapper.updateServiceProviderUnionId(seller.getUserId(), unionId);
             String token = JwtUtil.createToken(seller.getUserId());
@@ -497,13 +500,24 @@ public class LoginServiceImpl implements LoginService {
         }
         // 用户数据存入Redis,key前缀:wxInfo:applets:
         redisService.setMap("wxInfo:applets:" + unionId, infoData);
-        log.info("小程序授权登录,返回unionId给前端,用户数据存入Redis,key:wxInfo:applets:" + unionId);
-        /*UserLoginVo userLoginVo = loginMapper.organizeUserInfo(openId);
-        if (userLoginVo == null) {
-            userLoginVo = new UserLoginVo();
-            userLoginVo.setOpenId(openId);
-            return ResponseJson.error(-2, "用户未注册", userLoginVo);
-        }*/
+        log.info("小程序授权登录,返回unionId给前端,用户数据存入Redis,key:wxInfo:applets:" + unionId + "operId" + openId);
+        // 采购员授权登录
+        UserLoginVo seller = loginMapper.getServiceProviderUserByOpenId(openId, 4);
+        if (null != seller) {
+            loginMapper.updateServiceProviderUnionId(seller.getUserId(), unionId);
+            String token = JwtUtil.createToken(seller.getUserId());
+            seller.setToken(token);
+            seller.setUnionId(unionId);
+            seller.setOpenId(openId);
+            // 生成token给协销用户
+            String sellerToken = JwtUtil.createToken(seller.getUserId());
+            // 为了过期续签,将token存入redis,并设置超时时间
+            redisService.set(sellerToken, sellerToken, JwtUtil.getExpireTime());
+            seller.setToken(sellerToken);
+            seller.setManager(sellerMapper.findManagerByUser(seller.getUserId()));
+            seller.setLeaderId(sellerMapper.findLeaderId(seller.getUserId()));
+            return ResponseJson.success(seller);
+        }
         return organizeOperationAuthLogin(openId, unionId, "mini");
     }
 
@@ -792,16 +806,16 @@ public class LoginServiceImpl implements LoginService {
         loginUser.setToken(token);
         if (null != loginUser.getClubStatus() && 91 == loginUser.getClubStatus()) {
             //机构
-            return ResponseJson.error(-2, "您的企业账号已被冻结,请联系客服处理", null);
+            return ResponseJson.error(-1, "您的企业账号已被冻结,请联系客服处理", loginUser);
         }
         // 供应商
         if (null != loginUser.getShopStatus() && null != loginUser.getUserIdentity() && 3 == loginUser.getUserIdentity()) {
 
             if (3 == loginUser.getShopStatus()) {
-                return ResponseJson.error(-2, "您的企业账号正在加速审核中,审核通过后即可登录", null);
+                return ResponseJson.error(-1, "您的企业账号正在加速审核中,审核通过后即可登录", loginUser);
             }
             if (91 == loginUser.getShopStatus()) {
-                return ResponseJson.error(-2, "您的企业账号已被冻结,请联系客服处理", null);
+                return ResponseJson.error(-1, "您的企业账号已被冻结,请联系客服处理", loginUser);
             }
             if (92 == loginUser.getShopStatus()) {
                 return ResponseJson.error(-3, "您的企业账号审核未通过", loginUser);
@@ -1104,7 +1118,7 @@ public class LoginServiceImpl implements LoginService {
         if (StringUtils.isBlank(invitationCode)) {
             return ResponseJson.error("邀请码不能为空", null);
         }
-        UserLoginVo operation = loginMapper.getOperationUserByInvitationCode(invitationCode);
+        UserLoginVo operation = loginMapper.getOperationUserByInvitationCode(invitationCode, 0);
         if (operation == null) {
             return ResponseJson.error("邀请码错误", null);
         }
@@ -1113,7 +1127,7 @@ public class LoginServiceImpl implements LoginService {
         calendar.setTime(operation.getInvitationCodeTime());
         calendar.add(Calendar.DATE, validTime);
         if (1 == operation.getOperationStatus() && date.getTime() > calendar.getTime().getTime() && 0 == operation.getDelFlag()) {
-            return ResponseJson.error("邀请码已失效", null);
+            return ResponseJson.error("邀请码已过期,请联系邀请人更新邀请码", null);
         }
         if (2 == operation.getOperationStatus() && 0 == operation.getDelFlag()) {
             return ResponseJson.error("邀请码已被使用", null);
@@ -1121,10 +1135,10 @@ public class LoginServiceImpl implements LoginService {
         // 用户身份:1机构,2供应商
         int userIdentity = 3 == operation.getUserIdentity() ? 2 : 1;
         if (1 == userIdentity && operation.getClubStatus() != null && 91 == operation.getClubStatus()) {
-            return ResponseJson.error("您的机构已冻结", null);
+            return ResponseJson.error("您的机构已下线", null);
         }
         if (2 == userIdentity && operation.getShopStatus() != null && 91 == operation.getShopStatus()) {
-            return ResponseJson.error("您的企业账号已被冻结,请联系客服处理", null);
+            return ResponseJson.error("您的企业账号已下线,请联系客服处理", null);
         }
         if (0 != operation.getDelFlag()) {
             return ResponseJson.error("您的邀请码已被删除,请重新添加运营人员", null);
@@ -1142,87 +1156,164 @@ public class LoginServiceImpl implements LoginService {
         operationPo.setAvatarUrl(avatarUrl);
         // 绑定状态,1未绑定,2已绑定
         operationPo.setStatus(2);
+        // 采美进行消息推送
+        if (0 == operation.getOrganizeId()) {
+            if (1 == userIdentity) {
+                // 机构Id
+                operationPo.setClubId(operation.getClubId());
+                // 用户类型
+                operationPo.setUserType(1);
+
+                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                String current = dateFormat.format(new Date());
+                MessageCenter messageCenter = new MessageCenter();
+                messageCenter.setShopId(null);
+                messageCenter.setClubId(operation.getClubId());
+                messageCenter.setUserType(1);
+                messageCenter.setMessageType(2);
+                messageCenter.setAccountType(7);
+                messageCenter.setContent(nickName);
+                messageCenter.setTime(current);
+                messageCenterMapper.addMessageCenter(messageCenter);
+                //发短信
+                String message = "【采美365】恭喜您成功成为运营人员,您可通过微信直接登录采美商城进行采购。";
+                String mobile = messageCenterMapper.contractMobile(operation.getClubId());
+                if (mobile != null && mobile != "") {
+                    remoteCallService.remoteSendSms(2, 3, mobile, message);
+                }
 
-        if (1 == userIdentity) {
-            // 机构Id
-            operationPo.setClubId(operation.getClubId());
-            // 用户类型
-            operationPo.setUserType(1);
-
-            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-            String current = dateFormat.format(new Date());
-            MessageCenter messageCenter = new MessageCenter();
-            messageCenter.setShopId(null);
-            messageCenter.setClubId(operation.getClubId());
-            messageCenter.setUserType(1);
-            messageCenter.setMessageType(2);
-            messageCenter.setAccountType(7);
-            messageCenter.setContent(nickName);
-            messageCenter.setTime(current);
-            messageCenterMapper.addMessageCenter(messageCenter);
-            //发短信
-            String message = "【采美365】恭喜您成功成为运营人员,您可通过微信直接登录采美商城进行采购。";
-            String mobile = messageCenterMapper.contractMobile(operation.getClubId());
-            if (mobile != null && mobile != "") {
-                remoteCallService.remoteSendSms(2, 3, mobile, message);
-            }
+                try {
+                    log.info("***********机构通过邀请码登入微信公众号推送************");
+                    String accessToken = weChatService.getAccessToken();
+                    String openid = messageCenterMapper.getOpenidListByPermission(unionId);
+                    String time = current;
+                    String remarkText = "绑定成功后,您可通过微信直接访问采美商城进行采购。";
+                    // 跳转到【小程序付款-选择支付方式页面】
+                    String pagePath = "https://www.caimei365.com/";
+                    // sendTemplateMsg(openid, 标题, 金额, 收款日期, 备注, 跳转链接
+                    log.error("获取openid>>>>>" + openid);
+                    weChatService.sendTemplateMessg(accessToken, openid, nickName, time, remarkText, pagePath);
+                } catch (Exception e) {
+                    log.error("【机构通过邀请码登入通知】获取微信公众号access_token异常!", e);
+                }
 
-            try {
-                log.info("***********机构通过邀请码登入微信公众号推送************");
-                String accessToken = weChatService.getAccessToken();
-                String openid = messageCenterMapper.getOpenidListByPermission(unionId);
-                String time = current;
-                String remarkText = "绑定成功后,您可通过微信直接访问采美商城进行采购。";
-                // 跳转到【小程序付款-选择支付方式页面】
-                String pagePath = "https://www.caimei365.com/";
-                // sendTemplateMsg(openid, 标题, 金额, 收款日期, 备注, 跳转链接
-                log.error("获取openid>>>>>" + openid);
-                weChatService.sendTemplateMessg(accessToken, openid, nickName, time, remarkText, pagePath);
-            } catch (Exception e) {
-                log.error("【机构通过邀请码登入通知】获取微信公众号access_token异常!", e);
-            }
 
+            } else {
+                // 供应商Id
+                operationPo.setShopId(operation.getShopId());
+                // 用户类型
+                operationPo.setUserType(2);
+
+                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                String current = dateFormat.format(new Date());
+                MessageCenter messageCenter = new MessageCenter();
+                messageCenter.setShopId(operation.getShopId());
+                messageCenter.setClubId(null);
+                messageCenter.setUserType(2);
+                messageCenter.setMessageType(2);
+                messageCenter.setShopMessType(2);
+                messageCenter.setContent(nickName);
+                messageCenter.setTime(current);
+                messageCenterMapper.addMessageCenter(messageCenter);
+
+                //发短信
+                String message = "【采美365】恭喜您成功成为运营人员,您可通过微信直接登录采美商城进行采购。";
+                String mobile = messageCenterMapper.contractMobiles(operation.getShopId());
+                if (mobile != null && mobile != "") {
+                    remoteCallService.remoteSendSms(2, 3, mobile, message);
+                }
+                try {
+                    log.info("***********供应商通过邀请码登入微信公众号推送************");
+                    String accessToken = weChatService.getAccessToken();
+                    String openid = messageCenterMapper.getOpenidListByPermission(unionId);
+                    String time = current;
+                    String remarkText = "绑定成功后,您可通过微信直接访问采美商城进行采购。";
+                    // 跳转到【小程序付款-选择支付方式页面】
+                    String pagePath = "https://www.caimei365.com/";
+                    // sendTemplateMsg(openid, 标题, 金额, 收款日期, 备注, 跳转链接
+                    log.error("获取openid>>>>>" + openid);
+                    weChatService.sendTemplateMessg(accessToken, openid, nickName, time, remarkText, pagePath);
+                } catch (Exception e) {
+                    log.error("【供应商通过邀请码登入通知】获取微信公众号access_token异常!", e);
+                }
 
+            }
         } else {
-            // 供应商Id
-            operationPo.setShopId(operation.getShopId());
+            // 机构Id
+            operationPo.setClubId(operation.getClubId());
             // 用户类型
-            operationPo.setUserType(2);
-
-            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-            String current = dateFormat.format(new Date());
-            MessageCenter messageCenter = new MessageCenter();
-            messageCenter.setShopId(operation.getShopId());
-            messageCenter.setClubId(null);
-            messageCenter.setUserType(2);
-            messageCenter.setMessageType(2);
-            messageCenter.setShopMessType(2);
-            messageCenter.setContent(nickName);
-            messageCenter.setTime(current);
-            messageCenterMapper.addMessageCenter(messageCenter);
-
-            //发短信
-            String message = "【采美365】恭喜您成功成为运营人员,您可通过微信直接登录采美商城进行采购。";
-            String mobile = messageCenterMapper.contractMobiles(operation.getShopId());
-            if (mobile != null && mobile != "") {
-                remoteCallService.remoteSendSms(2, 3, mobile, message);
-            }
-            try {
-                log.info("***********供应商通过邀请码登入微信公众号推送************");
-                String accessToken = weChatService.getAccessToken();
-                String openid = messageCenterMapper.getOpenidListByPermission(unionId);
-                String time = current;
-                String remarkText = "绑定成功后,您可通过微信直接访问采美商城进行采购。";
-                // 跳转到【小程序付款-选择支付方式页面】
-                String pagePath = "https://www.caimei365.com/";
-                // sendTemplateMsg(openid, 标题, 金额, 收款日期, 备注, 跳转链接
-                log.error("获取openid>>>>>" + openid);
-                weChatService.sendTemplateMessg(accessToken, openid, nickName, time, remarkText, pagePath);
-            } catch (Exception e) {
-                log.error("【供应商通过邀请码登入通知】获取微信公众号access_token异常!", e);
-            }
+            operationPo.setUserType(1);
+        }
+        operationPo.setUpdateTime(new Date());
+        operationPo.setBindTime(new Date());
+        // 更新运营人员信息
+        operationMapper.updateOperationByInvitation(operationPo);
+        // 返回登录校验结果
+        return logonVerify(operation);
+    }
 
+    /**
+     * 邀请码登录
+     *
+     * @param invitationCode 邀请码
+     * @param nickName       微信昵称
+     * @param avatarUrl      微信头像(headimgurl)
+     * @param unionId        微信unionId
+     * @param organizeId     组织Id
+     * @return UserLoginVo
+     */
+    @Override
+    public ResponseJson<UserLoginVo> invitationCodeOrganizeLogin(String invitationCode, String nickName, String avatarUrl, String unionId, Integer organizeId) {
+        // 参数校验
+        if (StringUtils.isBlank(invitationCode)) {
+            return ResponseJson.error("邀请码不能为空", null);
         }
+        UserLoginVo operation = loginMapper.getOperationOrganizeUserByInvitationCode(invitationCode, organizeId);
+        if (operation == null) {
+            return ResponseJson.error("邀请码错误", null);
+        }
+        Date date = new Date();
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(operation.getInvitationCodeTime());
+        calendar.add(Calendar.DATE, validTime);
+        if (1 == operation.getOperationStatus() && date.getTime() > calendar.getTime().getTime() && 0 == operation.getDelFlag()) {
+            return ResponseJson.error("邀请码已过期,请联系邀请人更新邀请码", null);
+        }
+        if (2 == operation.getOperationStatus() && 0 == operation.getDelFlag()) {
+            return ResponseJson.error("邀请码已被使用", null);
+        }
+        // 用户身份:1机构,2供应商
+        int userIdentity = 3 == operation.getUserIdentity() ? 2 : 1;
+        if (1 == userIdentity && operation.getClubStatus() != null && 91 == operation.getClubStatus()) {
+            return ResponseJson.error("您的机构已冻结", null);
+        }
+        if (2 == userIdentity && operation.getShopStatus() != null && 91 == operation.getShopStatus()) {
+            return ResponseJson.error("您的企业账号已被冻结,请联系客服处理", null);
+        }
+        if (0 != operation.getDelFlag()) {
+            return ResponseJson.error("您的邀请码已被删除,请重新添加运营人员", null);
+        }
+        OperationPo operationPo = new OperationPo();
+        operationPo.setId(operation.getOperationId());
+        // 微信unionId
+        operationPo.setUnionId(unionId);
+        Map<Object, Object> infoData = redisService.getEntries("wxInfo:applets:" + unionId);
+        // 微信openId
+        operationPo.setOpenId((String) infoData.get(WeChatService.Keys.OPEN_ID));
+        // 微信昵称
+        operationPo.setNickName(nickName);
+        // 微信头像
+        operationPo.setAvatarUrl(avatarUrl);
+        // 绑定状态,1未绑定,2已绑定
+        operationPo.setStatus(2);
+
+        // 联合丽格没有运营人员为机构运营人员
+        // 机构Id
+        operationPo.setClubId(operation.getClubId());
+        // 用户类型
+        operationPo.setUserType(1);
+        operationPo.setUpdateTime(new Date());
+        operationPo.setBindTime(new Date());
         // 更新运营人员信息
         operationMapper.updateOperationByInvitation(operationPo);
         // 返回登录校验结果

+ 34 - 5
src/main/java/com/caimei365/user/service/impl/OperationServiceImpl.java

@@ -3,6 +3,7 @@ package com.caimei365.user.service.impl;
 import com.caimei365.user.components.CommonService;
 import com.caimei365.user.mapper.MessageCenterMapper;
 import com.caimei365.user.mapper.OperationMapper;
+import com.caimei365.user.mapper.UserCenterMapper;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.OperationDto;
 import com.caimei365.user.model.po.OperationPo;
@@ -41,6 +42,8 @@ public class OperationServiceImpl implements OperationService {
     private RemoteCallService remoteCallService;
     @Resource
     private MessageCenterMapper messageCenterMapper;
+    @Resource
+    private UserCenterMapper userCenterMapper;
 
     /**
      * 添加运营人员
@@ -56,6 +59,8 @@ public class OperationServiceImpl implements OperationService {
      */
     @Override
     public ResponseJson addOperation(OperationDto operationDto) {
+        // 获取用户组织Id
+        Integer organizeId = userCenterMapper.getUserOrganizeId(operationDto.getUserId());
         // 查询使用该手机号的运营人员或用户
         String checkRust = commonService.operationBindCheck(operationDto.getMobile(), null);
         if (checkRust != null) {
@@ -102,8 +107,23 @@ public class OperationServiceImpl implements OperationService {
             }
             String mobile = operationDto.getMobile();
             if (StringUtils.isNotEmpty(mobile)) {
-                // 欢迎成为${name}的运营人员,您的邀请码为${code}。
-                String content = "欢迎成为" + name + "的运营人员,您的邀请码为" + invitationCode + "。您可使用以下两种方式激活您的身份:1. 您可在微信搜索“采美采购商城”小程序,使用邀请码登录并绑定微信;2. 进入“采美采购商城”小程序后,使用邀请码登录并绑定微信。绑定微信后,您可通过微信授权直接登录“采美采购商城”小程序或微信扫码直接登录采美365网站。";
+                String content = "";
+                if (0 == organizeId) {
+                    // 采美
+                    // 欢迎成为${name}的运营人员,您的邀请码为${code}。
+                    content = "欢迎成为" + name + "的运营人员,您的邀请码为" + invitationCode + "。您可使用以下两种方式激活您的身份:1. 您可在微信搜索“采美采购商城”小程序,使用邀请码登录并绑定微信;2. 进入“采美采购商城”小程序后,使用邀请码登录并绑定微信。绑定微信后,您可通过微信授权直接登录“采美采购商城”小程序或微信扫码直接登录采美365网站。";
+                } else {
+                    // 联合丽格
+                    OperationPo operationPo = operationMapper.getInfoByMobile(mobile, organizeId);
+                    if (null != operationPo) {
+                        if (operationPo.getClubId().equals(operationDto.getClubId())) {
+                            return ResponseJson.error(-1, "该手机号已绑定本机构运营人员", null);
+                        }
+                        return ResponseJson.error(-1, "该手机号已绑定其他机构运营人员", null);
+                    }
+                    // 您被邀请成为【机构名称】的运营人员,邀请码为:{s6},请直接使用邀请码登录“丽格集采联盟”小程序。
+                    content = "【丽格集采联盟】您被邀请成为【" + name + "】的运营人员,邀请码为:" + invitationCode + ",请直接使用邀请码登录“丽格集采联盟”小程序。";
+                }
                 remoteCallService.remoteSendSms(0, 1, mobile, content);
                 log.info("欢迎成为" + name + "的运营人员,您的邀请码为:" + invitationCode);
             }
@@ -116,7 +136,7 @@ public class OperationServiceImpl implements OperationService {
         operation.setAddTime(date);
         operation.setUpdateTime(date);
         operation.setDelFlag(0);
-        operation.setOrganizeId(0);
+        operation.setOrganizeId(organizeId);
         int flag = 0;
         if (operation.getId() == null) {
             operation.setAccount(operationDto.getMobile() + CodeUtil.generateAccount(2));
@@ -162,9 +182,18 @@ public class OperationServiceImpl implements OperationService {
                 name = operationMapper.findShopNameById(operation.getShopId());
             }
             String mobile = operation.getMobile();
+            Integer organizeId = operation.getOrganizeId();
             if (StringUtils.isNotEmpty(mobile)) {
-                // 欢迎成为${name}的运营人员,您更新的邀请码为${code}。
-                String content = "欢迎成为" + name + "的运营人员,您的邀请码为" + invitationCode + "。您可使用以下两种方式激活您的身份:1. 您可在微信搜索“采美采购商城”小程序,使用邀请码登录并绑定微信;2. 进入“采美采购商城”小程序后,使用邀请码登录并绑定微信。绑定微信后,您可通过微信授权直接登录“采美采购商城”小程序或微信扫码直接登录采美365网站。";
+                String content = "";
+                if (0 == organizeId) {
+                    // 采美
+                    // 欢迎成为${name}的运营人员,您更新的邀请码为${code}。
+                    content = "欢迎成为" + name + "的运营人员,您的邀请码为" + invitationCode + "。您可使用以下两种方式激活您的身份:1. 您可在微信搜索“采美采购商城”小程序,使用邀请码登录并绑定微信;2. 进入“采美采购商城”小程序后,使用邀请码登录并绑定微信。绑定微信后,您可通过微信授权直接登录“采美采购商城”小程序或微信扫码直接登录采美365网站。";
+                } else {
+                    // 联合丽格
+                    // 【丽格集采联盟】您被邀请成为【{s}】的运营人员,邀请码已更新为:{s6},请直接使用邀请码登录“丽格集采联盟”小程序。
+                    content = "【丽格集采联盟】您被邀请成为【" + name + "】的运营人员,邀请码已更新为:" + invitationCode + ",请直接使用邀请码登录“丽格集采联盟”小程序。";
+                }
                 remoteCallService.remoteSendSms(0, 1, mobile, content);
                 log.info("欢迎成为" + name + "的运营人员,您更新的邀请码为:" + invitationCode);
             }

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

@@ -469,7 +469,7 @@ public class RegisterServiceImpl implements RegisterService {
         // 用户状态,1正常,0冻结
         user.setValidFlag(1);
         // 协销Id,默认采美官方
-        user.setServiceProviderId(1342);
+        // user.setServiceProviderId(1342);
         // 协销状态,已上线
         user.setServiceProviderStatus(90);
         /*
@@ -500,7 +500,7 @@ public class RegisterServiceImpl implements RegisterService {
         // 用户Id
         club.setUserId(user.getUserId());
         // 协销Id(spId)
-        club.setServiceProviderId(1342);
+        // club.setServiceProviderId(1342);
         // 注册时间
         club.setAddTime(current);
         club.setSocialCreditCode(organizeRegisterDto.getSocialCreditCode());

+ 95 - 8
src/main/java/com/caimei365/user/service/impl/SellerServiceImpl.java

@@ -2,16 +2,15 @@ package com.caimei365.user.service.impl;
 
 import com.caimei365.user.components.RedisService;
 import com.caimei365.user.components.WeChatService;
+import com.caimei365.user.mapper.LoginMapper;
 import com.caimei365.user.mapper.SellerMapper;
 import com.caimei365.user.mapper.SuperVipMapper;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.ClubTemporaryDto;
+import com.caimei365.user.model.dto.LoginCodeDto;
 import com.caimei365.user.model.po.ServiceProviderPo;
 import com.caimei365.user.model.po.SuperVipPo;
-import com.caimei365.user.model.vo.ClubTemporaryVo;
-import com.caimei365.user.model.vo.ClubVo;
-import com.caimei365.user.model.vo.ServiceProviderVo;
-import com.caimei365.user.model.vo.UserLoginVo;
+import com.caimei365.user.model.vo.*;
 import com.caimei365.user.service.SellerService;
 import com.caimei365.user.utils.JwtUtil;
 import com.caimei365.user.utils.Md5Util;
@@ -19,13 +18,11 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * Description
@@ -45,6 +42,8 @@ public class SellerServiceImpl implements SellerService {
     private SellerMapper sellerMapper;
     @Resource
     private SuperVipMapper vipMapper;
+    @Resource
+    private LoginMapper loginMapper;
 
     /**
      * 协销机构列表
@@ -146,6 +145,94 @@ public class SellerServiceImpl implements SellerService {
         return ResponseJson.success(seller);
     }
 
+    /**
+     * 采购员验证码登录 --组织
+     *
+     * @param loginCodeDto
+     * @return
+     */
+    @Override
+    public ResponseJson<UserLoginVo> organizeCodeLogin(LoginCodeDto loginCodeDto) {
+        String mobile = loginCodeDto.getMobile();
+        String unionId = loginCodeDto.getUnionId();
+        String code = loginCodeDto.getCode();
+        if (StringUtils.isBlank(mobile)) {
+            return ResponseJson.error("请输入账号密码", null);
+        }
+        if (StringUtils.isBlank(unionId)) {
+            return ResponseJson.error("请输入微信unionId", null);
+        }
+        if (StringUtils.isBlank(code)) {
+            return ResponseJson.error("请输入验证码", null);
+        }
+        // 判断redis中是否存在
+        boolean exists = redisService.exists("code:" + mobile);
+        if (exists) {
+            // 查看验证码是否过期
+            long expireTime = redisService.getExpireTime("code:" + mobile);
+            if (expireTime < 0) {
+                return ResponseJson.error(-1, "验证码已失效,请重新获取", null);
+            }
+            // 获取redis手机短信验证码
+            Object randomCode = redisService.get("code:" + mobile);
+
+            if (!ObjectUtils.isEmpty(randomCode)) {
+                if (code.equals(randomCode.toString())) {
+                    redisService.remove("code:" + mobile);
+                    // 根据手机号获取协销
+                    UserLoginVo seller = sellerMapper.getLoginSellerByMobile(mobile);
+                    // 生成token
+                    String token = JwtUtil.createToken(seller.getUserId());
+                    // 为了过期续签,将token存入redis,并设置超时时间
+                    redisService.set(token, token, JwtUtil.getExpireTime());
+                    seller.setToken(token);
+                    Map<Object, Object> infoData = redisService.getEntries("wxInfo:applets:" + unionId);
+                    String openId = (String) infoData.get(WeChatService.Keys.OPEN_ID);
+                    sellerMapper.updateServiceProviderByUserId(seller.getUserId(), openId, unionId);
+                    log.info("采购员登录openid>>>>" + openId + " ,unionId>>>>>" + unionId);
+                    // seller.setManager(sellerMapper.findManager(mobile));
+
+                    // 根据手机号获取用户信息
+                    UserLoginVo baseUser = loginMapper.getLoginOrganizeUserByMobileOrEmail(mobile);
+                    // 协销下线不在登录协销登录
+                    if (null != baseUser.getUserIdentity() && 1 == baseUser.getUserIdentity()) {
+                        if ( null != baseUser.getServiceStatus() && 90 != baseUser.getServiceStatus()) {
+                            seller = new UserLoginVo();
+                            seller.setOpenId(openId);
+                            seller.setUnionId(unionId);
+                            return ResponseJson.error(-1,"采购员已下线",seller);
+                        }
+                    }
+                    // 绑定微信信息
+                    Integer operationUser = loginMapper.getOperationUser(mobile);
+                    log.info("operationUser==="+operationUser);
+                    /*if (null == operationUser) {
+                        // 绑定微信
+                        OperationVo operationVo = new OperationVo();
+                        operationVo.setOrganizeId(baseUser.getOrganizeId());
+                        operationVo.setUserType(1);
+                        operationVo.setUserId(baseUser.getUserId());
+                        operationVo.setClubId(baseUser.getClubId());
+                        operationVo.setMobile(baseUser.getMobile());
+                        operationVo.setLinkName(baseUser.getUserName());
+                        operationVo.setStatus(2);
+                        operationVo.setUnionId(unionId);
+                        operationVo.setBindTime(new Date());
+                        operationVo.setAddTime(new Date());
+                        operationVo.setDelFlag(0);
+                        loginMapper.insertOperation(operationVo);
+                    }*/
+                    return ResponseJson.success(seller);
+                } else {
+                    return ResponseJson.error(-1, "验证码错误,请确认验证码输入",null);
+                }
+            } else {
+                return ResponseJson.error(-1, "验证码错误, 请重新获取",null);
+            }
+        }
+        return ResponseJson.error();
+    }
+
     /**
      * 待注册机构列表
      *

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

@@ -82,8 +82,11 @@
           AND u.userIdentity IN (1, 2, 3, 4)
         LIMIT 1
     </select>
-    <select id="getUserIdByOrganizeStatus" resultType="java.lang.Integer">
-        SELECT clubStatus
+    <select id="getServiceProvider" resultType="com.caimei365.user.model.vo.UserLoginVo">
+        SELECT serviceProviderID as serviceProviderId, status as operationStatus FROM serviceprovider WHERE contractMobile = #{mobile}
+    </select>
+    <select id="getUserIdByOrganizeStatus" resultType="com.caimei365.user.model.vo.UserLoginVo">
+        SELECT userId, userIdentity, clubStatus
         FROM USER
         WHERE userOrganizeID = #{organizeId}
           AND bindMobile = #{mobile}

+ 32 - 1
src/main/resources/mapper/LoginMapper.xml

@@ -85,6 +85,7 @@
                u.serviceProviderId  as serviceProviderId,
                u.userName           as userName,
                u.name               as name,
+               ( SELECT linkMan FROM club WHERE userId = u.userID) as clubLinkMan,
                u.mobile             as mobile,
                u.bindMobile         as bindMobile,
                u.email              as email,
@@ -94,6 +95,7 @@
                u.guideFlag          as guideFlag,
                u.clubStatus         as clubStatus,
                u.manufacturerStatus as shopStatus,
+               u.serviceProviderStatus as serviceStatus,
                cu.id                as operationId,
                cu.status            as operationStatus,
                cu.mobile            as operationMobile
@@ -110,6 +112,7 @@
                u.serviceProviderId  AS serviceProviderId,
                u.userName           AS userName,
                u.name               AS NAME,
+               ( SELECT linkMan FROM club WHERE userId = u.userID) as clubLinkMan,
                u.mobile             AS mobile,
                u.bindMobile         AS bindMobile,
                u.email              AS email,
@@ -119,6 +122,7 @@
                u.guideFlag          AS guideFlag,
                u.clubStatus         AS clubStatus,
                u.manufacturerStatus AS shopStatus,
+               u.serviceProviderStatus as serviceStatus,
                cu.id                AS operationId,
                cu.status            AS operationStatus,
                cu.mobile            AS operationMobile
@@ -179,6 +183,7 @@
         from serviceprovider s
                  left join user u on s.userID = u.userID
         where s.openid = #{openId}
+          and s.organizeId = #{organizeId}
           and u.validFlag = 1
         limit 1
     </select>
@@ -231,10 +236,12 @@
         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,
         u.manufacturerStatus as shopStatus,
+        u.serviceProviderStatus as serviceStatus,
         o.unionId as unionId,
         o.status as operationStatus,
         o.mobile as operationMobile,
@@ -303,6 +310,7 @@
         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,
@@ -366,6 +374,7 @@
                u.shopID             as shopId,
                u.userName           as userName,
                u.name               as name,
+               ifnull(cou.userOrganizeID, 0) as organizeId,
                u.userIdentity,
                u.guideFlag          as guideFlag,
                u.clubStatus         as clubStatus,
@@ -377,7 +386,29 @@
         FROM cm_mall_operation_user cou
                  LEFT JOIN user u ON u.userID = cou.userID
         WHERE cou.invitationCode = #{invitationCode}
-          AND cou.userOrganizeID = 0
+          AND cou.userOrganizeID = #{organizeId}
+          AND u.userIdentity in (2, 3, 4)
+    </select>
+    <select id="getOperationOrganizeUserByInvitationCode" resultType="com.caimei365.user.model.vo.UserLoginVo">
+        SELECT cou.id               as operationId,
+               u.userID             as userId,
+               u.clubID             as clubId,
+               u.shopID             as shopId,
+               u.userName           as userName,
+               u.name               as name,
+               ifnull(cou.userOrganizeID, 0) as organizeId,
+               u.userIdentity,
+               u.guideFlag          as guideFlag,
+               u.clubStatus         as clubStatus,
+               u.manufacturerStatus as shopStatus,
+               cou.invitationCodeTime,
+               cou.mobile           as operationMobile,
+               cou.status           as operationStatus,
+               cou.delFlag
+        FROM cm_mall_operation_user cou
+                 LEFT JOIN user u ON u.userID = cou.userID
+        WHERE cou.invitationCode = #{invitationCode}
+          AND cou.userOrganizeID = #{organizeId}
           AND u.userIdentity in (2, 3, 4)
     </select>
     <select id="getOperationUserByOperationId" resultType="com.caimei365.user.model.vo.UserLoginVo">

+ 15 - 0
src/main/resources/mapper/OperationMapper.xml

@@ -24,8 +24,21 @@
         select name from shop
         where shopID = #{shopId}
     </select>
+    <select id="getInfoByMobile" resultType="com.caimei365.user.model.po.OperationPo">
+        select id as id,
+               userID as userId,
+               mobile as mobile,
+               clubID as clubId,
+               shopID as shopId,
+               status as status,
+               nickName as nickName
+        from cm_mall_operation_user
+        where mobile = #{mobile} and userOrganizeID = #{organizeId} AND delFlag = 0
+        limit 1
+    </select>
     <select id="getOperationCodeInfoById" resultType="com.caimei365.user.model.po.OperationPo">
         select o.id as id,
+               ifnull(o.userOrganizeID, 0) as organizeId,
                o.mobile as mobile,
                o.clubID as clubId,
                o.shopID as shopId,
@@ -65,6 +78,8 @@
             nickName = #{nickName},
             headimgurl = #{avatarUrl},
             status = #{status},
+            bindTime = #{bindTime},
+            updateTime = #{updateTime},
             <if test="clubId != null and clubId != ''">
                 clubId = #{clubId},
                 shopId = null,

+ 9 - 4
src/main/resources/mapper/SellerMapper.xml

@@ -13,6 +13,8 @@
                u.guideFlag      as guideFlag,
                u.userPermission as userPermission,
                u.userIdentity   as userIdentity,
+               u.serviceProviderID as serviceProviderId,
+               u.serviceProviderStatus as serviceStatus,
                u.password       as password
         from user u
         where u.mobile = #{mobile}
@@ -236,7 +238,7 @@
         FROM cm_serviceteam_group csg
         LEFT JOIN cm_serviceteam_role csr ON csr.id=csg.teamId
         left join serviceprovider s on csg.serviceId=s.serviceProviderID
-        WHERE csr.leaderId = #{spId}
+        WHERE csr.leaderId = #{spId} and s.organizeID = 0
         <if test="status == 1">
             AND csg.serviceId != #{spId}
         </if>
@@ -245,9 +247,12 @@
         SELECT csg.serviceId AS serviceProviderId,s.linkMan AS NAME
         FROM cm_serviceteam_group csg
         LEFT JOIN serviceprovider s ON csg.serviceId=s.serviceProviderID
-        <if test="status == 1">
-            WHERE csg.serviceId != #{spId}
-        </if>
+        <where>
+            s.organizeID = 0
+            <if test="status == 1">
+                and csg.serviceId != #{spId}
+            </if>
+        </where>
     </select>
 
 </mapper>