2 커밋 a4982f3d42 ... 6790867e53

작성자 SHA1 메시지 날짜
  wanglang 6790867e53 Merge branch 'master' of http://192.168.0.200:3000/wanglang/trade-platform 1 개월 전
  wanglang ccfee568cb 登录校验 1 개월 전

+ 1 - 1
trade-client/src/main/java/com/trade/client/enterprise/customer/controller/CustomerUserController.java

@@ -59,7 +59,7 @@ public class CustomerUserController {
      */
     @ApiOperation(value = "登录", notes = "客户登录")
     @PostMapping("/login")
-    public ResponseResult<Map> login(@RequestBody @Valid LoginMo loginBody) {
+    public ResponseResult<Map> login(@RequestBody LoginMo loginBody) {
         return ResponseResult.success(customerUserLoginService.login(loginBody));
     }
 

+ 4 - 0
trade-client/src/main/java/com/trade/client/enterprise/customer/service/impl/CustomerUserLoginServiceImpl.java

@@ -9,6 +9,7 @@ import com.trade.common.constant.HttpStatus;
 import com.trade.common.context.AuthenticationContextHolder;
 import com.trade.common.exception.ServiceException;
 import com.trade.common.utils.LoggerUtil;
+import com.trade.common.utils.StringUtils;
 import org.slf4j.Logger;
 import org.springframework.security.authentication.AuthenticationManager;
 import org.springframework.security.authentication.BadCredentialsException;
@@ -37,6 +38,9 @@ public class CustomerUserLoginServiceImpl implements CustomerUserLoginService {
 
     @Override
     public Map<String, String> login(LoginMo login) {
+        if (StringUtils.isEmpty(login.getUserName()) || StringUtils.isEmpty(login.getPassword())) {
+            throw new ServiceException("账号与密码不能为空", HttpStatus.BAD_REQUEST);
+        }
         Map<String, String> tokenMap = new HashMap<>();
         // 用户验证
         Authentication authentication = null;