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

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

huangzhiguo 1 год назад
Родитель
Сommit
758a3be7cb

+ 28 - 5
src/main/java/com/caimei365/user/components/CommonService.java

@@ -130,9 +130,27 @@ public class CommonService {
         // 查找用户表是否存在
         Integer dbUserId = baseMapper.getUserIdByOrganize(organizeId,mobile);
         if (null != dbUserId && dbUserId > 0) {
+            UserLoginVo user = loginMapper.getLoginUserByUserId(dbUserId);
+            String showName = ValidateUtil.nameConversion(user.getUserName());
+            if (2 == user.getUserIdentity() || 4 == user.getUserIdentity()) {
+                return "该手机号已绑定机构(" + showName + ")联系人,请重新填写手机号";
+            } else if (3 == user.getUserIdentity()) {
+                return "该手机号已绑定供应商(" + showName + ")联系人,请重新填写手机号";
+            }
+            flag = true;
+        }
+        // 查找运营人员表是否存在
+        Integer dbOperationId = baseMapper.getOrganizeOperationIdByMobile(mobile, organizeId);
+        if (null != dbOperationId && dbOperationId > 0) {
+            UserLoginVo operation = loginMapper.getOrganizeByOperationId(dbOperationId, organizeId);
+            String showName = ValidateUtil.nameConversion(operation.getUserName());
+            if (2 == operation.getUserIdentity() || 4 == operation.getUserIdentity()) {
+                return "该手机号已绑定机构(" + showName + ")运营人员,请重新填写手机号";
+            } else if (3 == operation.getUserIdentity()) {
+                return "该手机号已绑定供应商(" + showName + ")运营人员,请重新填写手机号";
+            }
             flag = true;
         }
-
         if (flag) {
             return "该手机号已被使用";
         }
@@ -142,21 +160,26 @@ public class CommonService {
     /**
      * 查询使用该手机号的运营人员或用户
      */
-    public String operationBindCheck(String mobile, String smsCode) {
+    public String operationBindCheck(String mobile, String smsCode, Integer organizeId) {
         // 手机号验证
-        String result = mobileAndCodeValidate(mobile, smsCode);
+        String result = "";
+        if (0 == organizeId) {
+            result = mobileAndCodeValidate(mobile, smsCode);
+        } else {
+            result = organizeMobileValidate(mobile, smsCode, organizeId);
+        }
         if ("手机验证码错误".equals(result)) {
             return result;
         }
         if (result != null) {
             // 查询使用该手机号的运营人员或用户
-            UserLoginVo dbUser = loginMapper.getLoginUserByMobile(mobile);
+            UserLoginVo dbUser = loginMapper.getLoginUserByMobile(mobile, organizeId);
             boolean offlineClub = false;
             boolean offlineShop = false;
             if (null != dbUser) {
                 if (mobile.equals(dbUser.getBindMobile())) {
                     // 判断运营人员手机号的唯一性
-                    Integer dbOperationId = baseMapper.getOperationIdByMobile(mobile);
+                    Integer dbOperationId = baseMapper.getOrganizeOperationIdByMobile(mobile, organizeId);
                     if (dbOperationId != null && dbOperationId > 0) {
                         return "该手机号已注册并绑定微信!";
                     }

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

@@ -92,6 +92,14 @@ public interface BaseMapper {
      */
     Integer getOperationIdByMobile(@Param("mobile") String mobile);
 
+    /**
+     * 根据手机号、组织Id获取运营人员Id
+     * @param mobile
+     * @param organizeId
+     * @return
+     */
+    Integer getOrganizeOperationIdByMobile(@Param("mobile") String mobile, @Param("organizeId") Integer organizeId);
+
     /**
      * 省
      *

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

@@ -59,7 +59,7 @@ public interface LoginMapper {
      * @param mobile 手机号/邮箱
      * @return BaseUser
      */
-    UserLoginVo getLoginUserByMobile(@Param("mobile") String mobile);
+    UserLoginVo getLoginUserByMobile(@Param("mobile") String mobile, @Param("organizeId") Integer organizeId);
     /**
      * 根据openId获取协销
      * @param openId openId
@@ -130,6 +130,14 @@ public interface LoginMapper {
      * @return
      */
     UserLoginVo getOperationUserByOperationId(Integer operationId);
+
+    /**
+     * 根据Id、组织Id 获取运营人员用户信息(关联user)
+     * @param operationId
+     * @param organizeId
+     * @return
+     */
+    UserLoginVo getOrganizeByOperationId(@Param("operationId") Integer operationId,@Param("organizeId") Integer organizeId);
     /**
      * 根据openId获取用户Id
      * @param openId

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

@@ -1044,7 +1044,7 @@ public class LoginServiceImpl implements LoginService {
 
         if (null != user && item) {
             // 查询使用该手机号的运营人员或用户
-            String checkRust = commonService.operationBindCheck(mobile, smsCode);
+            String checkRust = commonService.operationBindCheck(mobile, smsCode, 0);
             if (checkRust != null) {
                 return ResponseJson.error(checkRust, null);
             }
@@ -1358,7 +1358,7 @@ public class LoginServiceImpl implements LoginService {
             return ResponseJson.error("参数异常:unionId不能为空!", null);
         }
         // 查询使用该手机号的运营人员或用户
-        String checkRust = commonService.operationBindCheck(mobile, smsCode);
+        String checkRust = commonService.operationBindCheck(mobile, smsCode, 0);
         if (checkRust != null) {
             return ResponseJson.error(checkRust, null);
         }

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

@@ -62,7 +62,7 @@ public class OperationServiceImpl implements OperationService {
         // 获取用户组织Id
         Integer organizeId = userCenterMapper.getUserOrganizeId(operationDto.getUserId());
         // 查询使用该手机号的运营人员或用户
-        String checkRust = commonService.operationBindCheck(operationDto.getMobile(), null);
+        String checkRust = commonService.operationBindCheck(operationDto.getMobile(), null, organizeId);
         if (checkRust != null) {
             return ResponseJson.error(checkRust, null);
         }

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

@@ -117,6 +117,13 @@
           and delFlag = '0'
         limit 1
     </select>
+    <select id="getOrganizeOperationIdByMobile" resultType="java.lang.Integer">
+        select id
+        from cm_mall_operation_user
+        where mobile = #{mobile} and userOrganizeID = #{organizeId}
+          and delFlag = '0'
+        limit 1
+    </select>
     <select id="getProvince" resultType="com.caimei365.user.model.vo.ProvinceVo">
         select provinceID as provinceId, name, validFlag, deliveryFee, freeMinTotalPrice
         from province

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

@@ -164,7 +164,7 @@
         from user u
                  left join cm_mall_operation_user cu on cu.userID = u.userID
         where (u.bindMobile = #{mobile} or (cu.mobile = #{mobile} and cu.delFlag != 1))
-          and u.userOrganizeID = 0
+          and u.userOrganizeID = #{organizeId}
           and u.userIdentity in (1, 2, 3, 4)
         limit 1
     </select>
@@ -432,6 +432,27 @@
           AND cou.userOrganizeID = 0
           AND u.userIdentity in (2, 3, 4)
     </select>
+    <select id="getOrganizeByOperationId" 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,
+               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.id = #{operationId}
+          AND cou.userOrganizeID = #{organizeId}
+          AND u.userIdentity in (2, 3, 4)
+    </select>
     <select id="getClubCountByClubName" resultType="java.lang.Integer">
         SELECT count(*)
         FROM club