diff --git a/luoo_common/src/main/java/constants/ErrorConstants.java b/luoo_common/src/main/java/constants/ErrorConstants.java index cbfb4b0..bc41f6f 100644 --- a/luoo_common/src/main/java/constants/ErrorConstants.java +++ b/luoo_common/src/main/java/constants/ErrorConstants.java @@ -50,4 +50,6 @@ public class ErrorConstants { public final static String AMOUNT_MUST_BE_GREATER_THAN_0 = "金额必须大于0"; public final static String USER_ALREADY_EXISTS_ARTIST = "用户已发起过音乐人审核"; + + public final static String USER_STATUS_ERROR = "用户状态错误"; } diff --git a/luoo_user/src/main/java/com/luoo/user/controller/LoginController.java b/luoo_user/src/main/java/com/luoo/user/controller/LoginController.java index 5de8c16..4286978 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/LoginController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/LoginController.java @@ -1,40 +1,45 @@ package com.luoo.user.controller; -import annotation.GlobalInterceptor; -import annotation.VerifyParam; -import api.Result; -import api.StatusCode; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.*; +import java.util.concurrent.TimeUnit; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + import com.alibaba.fastjson.JSONObject; -import com.luoo.user.dto.UserNameLoginDto; import com.luoo.user.dto.request.*; -import com.luoo.user.dto.response.CountryCodeDTO; -import com.luoo.user.dto.response.CreateImageCode; -import com.luoo.user.pojo.UserInfo; -import com.luoo.user.service.UserInfoService; import com.luoo.user.service.WeChatAouth2Service; import com.luoo.user.util.IOSTokenUtils; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.web.bind.annotation.*; + import constants.Constants; import controller.BaseController; + +import com.luoo.user.dto.response.CountryCodeDTO; +import com.luoo.user.dto.response.CreateImageCode; +import com.luoo.user.pojo.UserInfo; +import com.luoo.user.service.UserInfoService; +import com.luoo.user.util.NickNameUtil; + +import annotation.GlobalInterceptor; +import annotation.VerifyParam; +import api.Result; +import api.StatusCode; import enums.RequestFrequencyTypeEnum; +import enums.VerifyRegexEnum; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; -import org.apache.commons.lang.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; +import util.IdWorker; import util.JwtUtil; import util.StringTools; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.*; -import java.util.concurrent.TimeUnit; - /** * 控制器层 * @@ -367,6 +372,10 @@ public class LoginController extends BaseController { String userName = userNameLoginDto.getUserName(); String password = userNameLoginDto.getPassword(); UserInfo userInfo = userInfoService.findByUserNameAndPassword(userName, password); + if(ObjectUtils.notEqual(UserStatusEnum.ENABLE.getStatus(), userInfo.getStatus())){ + // 用户状态错误 + throw new BizException(ErrorConstants.USER_STATUS_ERROR); + } if (userInfo !=null) { //生成token String token = jwtUtil.createJWT(userInfo.getId(),userInfo.getUserName(),"artist",""); diff --git a/luoo_user/src/main/java/com/luoo/user/service/ArtistService.java b/luoo_user/src/main/java/com/luoo/user/service/ArtistService.java index 515b3bd..7da499c 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/ArtistService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/ArtistService.java @@ -134,7 +134,7 @@ public class ArtistService { throw new BizException(ErrorConstants.USER_ALREADY_EXISTS_ARTIST); } Integer count = userInfoDao.countByUserNameAndUserNameNotNull(artistRegisterDto.getUserName()); - if (count == 0) { + if (count > 0) { throw new BizException("该用户名已存在,请重新输入!"); } // 新增用户基本信息