generated from msb_55675/Demo
parent
13b1585eaf
commit
fed573aa48
@ -0,0 +1,25 @@
|
||||
package com.mashibing.apipassenger.controller;
|
||||
|
||||
import com.mashibing.apipassenger.service.UserService;
|
||||
import com.mashibing.common.dto.ResponseResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@RestController
|
||||
public class UserController {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@GetMapping("/users")
|
||||
public ResponseResult getUser(HttpServletRequest request){
|
||||
String token = request.getHeader("Authorization");
|
||||
|
||||
return userService.getUserByToken(token);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.mashibing.apipassenger.service;
|
||||
|
||||
import com.mashibing.apipassenger.remote.ServicePassengerUserClient;
|
||||
import com.mashibing.common.dto.PassengerUser;
|
||||
import com.mashibing.common.dto.ResponseResult;
|
||||
import com.mashibing.common.dto.TokenResult;
|
||||
import com.mashibing.common.request.VerificationCodeDTO;
|
||||
import com.mashibing.common.util.JwtUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class UserService {
|
||||
|
||||
@Autowired
|
||||
private ServicePassengerUserClient servicePassengerUserClient;
|
||||
public ResponseResult getUserByToken(String token){
|
||||
//校验token
|
||||
log.info("userService--token:" + token);
|
||||
//根据手机号获取用户信息
|
||||
TokenResult tokenResult = JwtUtils.checkToken(token);
|
||||
String phone = tokenResult.getPhone();
|
||||
log.info("手机号: " + phone);
|
||||
|
||||
ResponseResult userByPhone = servicePassengerUserClient.getUserByPhone(phone);
|
||||
|
||||
return ResponseResult.success(userByPhone.getData());
|
||||
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,13 @@
|
||||
com\mashibing\apipassenger\ApiPassengerApplication.class
|
||||
com\mashibing\apipassenger\controller\TestController.class
|
||||
com\mashibing\apipassenger\controller\VerificationCodeController.class
|
||||
com\mashibing\apipassenger\remote\ServiceVefificationcodeClient.class
|
||||
com\mashibing\apipassenger\service\TokenService.class
|
||||
com\mashibing\apipassenger\interceptor\InterceptorConfig.class
|
||||
com\mashibing\apipassenger\interceptor\JwtInterceptor.class
|
||||
com\mashibing\apipassenger\controller\UserController.class
|
||||
com\mashibing\apipassenger\request\VerificationCodeDTO.class
|
||||
com\mashibing\apipassenger\service\VerificationCodeService.class
|
||||
com\mashibing\apipassenger\service\UserService.class
|
||||
com\mashibing\apipassenger\remote\ServicePassengerUserClient.class
|
||||
com\mashibing\apipassenger\controller\TokenController.class
|
@ -0,0 +1,13 @@
|
||||
D:\Works\workspaces\online-taxi-public\api-passenger\src\main\java\com\mashibing\apipassenger\service\VerificationCodeService.java
|
||||
D:\Works\workspaces\online-taxi-public\api-passenger\src\main\java\com\mashibing\apipassenger\remote\ServicePassengerUserClient.java
|
||||
D:\Works\workspaces\online-taxi-public\api-passenger\src\main\java\com\mashibing\apipassenger\controller\TokenController.java
|
||||
D:\Works\workspaces\online-taxi-public\api-passenger\src\main\java\com\mashibing\apipassenger\ApiPassengerApplication.java
|
||||
D:\Works\workspaces\online-taxi-public\api-passenger\src\main\java\com\mashibing\apipassenger\controller\VerificationCodeController.java
|
||||
D:\Works\workspaces\online-taxi-public\api-passenger\src\main\java\com\mashibing\apipassenger\request\VerificationCodeDTO.java
|
||||
D:\Works\workspaces\online-taxi-public\api-passenger\src\main\java\com\mashibing\apipassenger\interceptor\InterceptorConfig.java
|
||||
D:\Works\workspaces\online-taxi-public\api-passenger\src\main\java\com\mashibing\apipassenger\service\TokenService.java
|
||||
D:\Works\workspaces\online-taxi-public\api-passenger\src\main\java\com\mashibing\apipassenger\interceptor\JwtInterceptor.java
|
||||
D:\Works\workspaces\online-taxi-public\api-passenger\src\main\java\com\mashibing\apipassenger\service\UserService.java
|
||||
D:\Works\workspaces\online-taxi-public\api-passenger\src\main\java\com\mashibing\apipassenger\controller\UserController.java
|
||||
D:\Works\workspaces\online-taxi-public\api-passenger\src\main\java\com\mashibing\apipassenger\controller\TestController.java
|
||||
D:\Works\workspaces\online-taxi-public\api-passenger\src\main\java\com\mashibing\apipassenger\remote\ServiceVefificationcodeClient.java
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1,11 @@
|
||||
com\mashibing\common\dto\ResponseResult.class
|
||||
com\mashibing\common\constant\CommonStatusEnum.class
|
||||
com\mashibing\common\dto\PassengerUser.class
|
||||
com\mashibing\common\response\NumberCodeResponse.class
|
||||
com\mashibing\common\util\RedisPrefixUtils.class
|
||||
com\mashibing\common\util\JwtUtils.class
|
||||
com\mashibing\common\constant\IdentityConstant.class
|
||||
com\mashibing\common\request\VerificationCodeDTO.class
|
||||
com\mashibing\common\dto\TokenResult.class
|
||||
com\mashibing\common\response\TokenResponse.class
|
||||
com\mashibing\common\constant\TokenConstants.class
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,5 @@
|
||||
com\mashibing\serviceDriverUser\mapper\PassengerUserMapper.class
|
||||
com\mashibing\serviceDriverUser\service\UserService.class
|
||||
com\mashibing\serviceDriverUser\controller\TestController.class
|
||||
com\mashibing\serviceDriverUser\controller\UserController.class
|
||||
com\mashibing\serviceDriverUser\ServicePassengerUserApplication.class
|
@ -0,0 +1,3 @@
|
||||
com\mashibing\service\controller\NumberCodeController.class
|
||||
com\mashibing\service\ServiceVerificationcodeApplication.class
|
||||
com\mashibing\service\controller\TestController.class
|
Loading…
Reference in new issue