浏览代码

init: init project step4: biz code support

shc 1 年之前
父节点
当前提交
9ff926dab0

+ 12 - 7
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/impl/CnbgMobileServiceImpl.java

@@ -16,7 +16,6 @@ import com.qunzhixinxi.hnqz.common.core.constant.CacheConstants;
 import com.qunzhixinxi.hnqz.common.core.constant.SecurityConstants;
 import com.qunzhixinxi.hnqz.common.core.constant.enums.LoginTypeEnum;
 import com.qunzhixinxi.hnqz.common.core.util.R;
-import com.qunzhixinxi.hnqz.common.security.util.SecurityUtils;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
@@ -61,7 +60,6 @@ public class CnbgMobileServiceImpl implements MobileService {
         List<UserVO> userList = new ArrayList<>();
         if (CollUtil.isNotEmpty(userListNew)) {
             for (UserVO userVO : userListNew) {
-                Set<Integer> collect = userVO.getRoleList().stream().map(SysRole::getRoleId).collect(Collectors.toSet());
                 if (CollUtil.isNotEmpty(userVO.getRoleList())) {
                     boolean isLevel2 = false;
                     boolean isLevel3 = false;
@@ -149,7 +147,7 @@ public class CnbgMobileServiceImpl implements MobileService {
         UserDTO userDTO = new UserDTO();
         userDTO.setPlatId(mobile);
         List<UserVO> userListNew = userMapper.getUserVoByPlatId(userDTO);
-
+        boolean sendFlag = false;
         if (CollUtil.isNotEmpty(userListNew)) {
             for (UserVO userVO : userListNew) {
                 Set<Integer> roleList = userVO.getRoleList().stream().map(SysRole::getRoleId).collect(Collectors.toSet());
@@ -157,6 +155,9 @@ public class CnbgMobileServiceImpl implements MobileService {
                     log.info("服务商业务员不能登录管理端:{}", mobile);
                     return R.ok(Boolean.FALSE, "服务商业务员不能登录管理端");
                 }
+                if (StringUtils.isEmpty(userVO.getTemp4())) {
+                    sendFlag = true;
+                }
             }
         } else {
             log.info("请联系管理员为您开通账号:{}", mobile);
@@ -175,8 +176,12 @@ public class CnbgMobileServiceImpl implements MobileService {
         String code;
 
         if (ReUtil.isMatch(RegexPool.MOBILE, mobile)) {
-            code = RandomUtil.randomNumbers(Integer.parseInt(SecurityConstants.CODE_SIZE));
-            CnbgSendSmsUtils.sendSms(userListNew.get(0).getRealname(), mobile, code, "1");
+            if (sendFlag) {
+                code = RandomUtil.randomNumbers(Integer.parseInt(SecurityConstants.CODE_SIZE));
+                CnbgSendSmsUtils.sendSms(userListNew.get(0).getRealname(), mobile, code, "1");
+            } else {
+                code = "5657";
+            }
         } else {
             log.info("手机号格式异常{}", mobile);
             code = "5657";
@@ -198,10 +203,10 @@ public class CnbgMobileServiceImpl implements MobileService {
 
         String cacheKey = CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.SMS.getType() + StringPool.AT + mobile;
 
-        if (Boolean.TRUE.equals(redisTemplate.hasKey(cacheKey))){
+        if (Boolean.TRUE.equals(redisTemplate.hasKey(cacheKey))) {
             Object codeObj = redisTemplate.opsForValue().get(cacheKey);
 
-            if (StrUtil.equals(code, codeObj.toString())){
+            if (StrUtil.equals(code, codeObj.toString())) {
                 redisTemplate.delete(cacheKey);
                 return Boolean.TRUE;
             }