用户登录接口
This commit is contained in:
parent
391544d485
commit
484e7fa450
|
@ -4,6 +4,7 @@ import com.zjyr.beidouservice.common.impl.ErrorCode;
|
||||||
import com.zjyr.beidouservice.config.CommonConfigure;
|
import com.zjyr.beidouservice.config.CommonConfigure;
|
||||||
import com.zjyr.beidouservice.pojo.MyResp;
|
import com.zjyr.beidouservice.pojo.MyResp;
|
||||||
import com.zjyr.beidouservice.pojo.dto.LoginRspDTO;
|
import com.zjyr.beidouservice.pojo.dto.LoginRspDTO;
|
||||||
|
import com.zjyr.beidouservice.pojo.dto.auth.UserLoginReqDTO;
|
||||||
import com.zjyr.beidouservice.pojo.po.MulReturnType;
|
import com.zjyr.beidouservice.pojo.po.MulReturnType;
|
||||||
import com.zjyr.beidouservice.service.UserAccountService;
|
import com.zjyr.beidouservice.service.UserAccountService;
|
||||||
import com.zjyr.beidouservice.validation.TokenAuthInterface;
|
import com.zjyr.beidouservice.validation.TokenAuthInterface;
|
||||||
|
@ -13,6 +14,7 @@ import org.springframework.stereotype.Component;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
@ -46,18 +48,15 @@ public class AuthController {
|
||||||
*/
|
*/
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public MyResp<LoginRspDTO> userLogin(
|
public MyResp userLogin(@RequestBody UserLoginReqDTO userLoginReqDTO)
|
||||||
//@Validated(ValidGroups.LoginReqValid.class)
|
|
||||||
//@RequestBody ProtocolReqDTO<LoginReq> mr
|
|
||||||
)
|
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
LoginRspDTO rspInfo = LoginRspDTO.builder()
|
LoginRspDTO rspInfo = LoginRspDTO.builder()
|
||||||
.userName("username")
|
.userName("username")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// 登录
|
// 登录
|
||||||
MulReturnType<ErrorCode, String> ret = userAccountService.loginService("admin", "2DC5B63023999B5BC57EB6B74B2232E3");
|
MulReturnType<ErrorCode, String> ret = userAccountService.loginService(userLoginReqDTO.getUsername(), userLoginReqDTO.getPasswd());
|
||||||
|
//MulReturnType<ErrorCode, String> ret = userAccountService.loginService("admin", "2DC5B63023999B5BC57EB6B74B2232E3");
|
||||||
|
|
||||||
// 登录错误
|
// 登录错误
|
||||||
if (ret.getFirstParam() != ErrorCode.ERR_OK) {
|
if (ret.getFirstParam() != ErrorCode.ERR_OK) {
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.zjyr.beidouservice.pojo.dto.auth;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Schema(title = "用户登录请求体")
|
||||||
|
public class UserLoginReqDTO {
|
||||||
|
/**
|
||||||
|
* The Username.
|
||||||
|
*/
|
||||||
|
@Schema(title = "用户名", example = "test")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Password.
|
||||||
|
*/
|
||||||
|
@Schema(title = "密码", example = "test")
|
||||||
|
private String passwd;
|
||||||
|
}
|
Loading…
Reference in New Issue