用户模块
This commit is contained in:
parent
a7d6d981a1
commit
13b800073e
|
@ -0,0 +1,23 @@
|
|||
package com.greenorange.promotion.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@Configuration
|
||||
public class HttpClientConfig {
|
||||
|
||||
@Bean
|
||||
public RestTemplate restTemplate() {
|
||||
return new RestTemplate(clientHttpRequestFactory());
|
||||
}
|
||||
|
||||
private ClientHttpRequestFactory clientHttpRequestFactory() {
|
||||
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
|
||||
factory.setConnectTimeout(500); // 设置连接超时为5秒
|
||||
factory.setReadTimeout(50); // 设置读取超时为5秒
|
||||
return factory;
|
||||
}
|
||||
}
|
|
@ -172,6 +172,25 @@ public class UserInfoController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* web端用户根据jwt获取用户信息
|
||||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping("get/jwt/web")
|
||||
@Operation(summary = "web端用户根据jwt获取用户信息", description = "参数:无,权限:管理员(boss, admin),方法名:getWebUserInfoByJWT")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "用户管理", content = "web端用户根据jwt获取用户信息")
|
||||
public BaseResponse<UserInfoVO> getWebUserInfoByJWT(HttpServletRequest request) {
|
||||
String userAccount = (String) request.getAttribute("userAccount");
|
||||
LambdaQueryWrapper<UserInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(UserInfo::getUserAccount, userAccount);
|
||||
UserInfo userInfo = userInfoService.getOne(lambdaQueryWrapper);
|
||||
UserInfoVO userInfoVO = commonService.copyProperties(userInfo, UserInfoVO.class);
|
||||
return ResultUtils.success(userInfoVO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户根据jwt获取用户信息
|
||||
* @return 用户信息
|
||||
|
@ -350,6 +369,11 @@ public class UserInfoController {
|
|||
@RequiresPermission(mustRole = UserConstant.BOSS_ROLE)
|
||||
@SysLog(title = "用户管理", content = "web端管理员根据id查询用户")
|
||||
public BaseResponse<UserInfoVO> queryUserInfoById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Long id = commonRequest.getId();
|
||||
UserInfo userInfo = userInfoService.getById(id);
|
||||
ThrowUtils.throwIf(userInfo == null, ErrorCode.OPERATION_ERROR, "当前用户不存在");
|
||||
|
|
|
@ -10,6 +10,7 @@ spring:
|
|||
|
||||
|
||||
|
||||
|
||||
data:
|
||||
redis:
|
||||
port: 6379
|
||||
|
@ -32,11 +33,7 @@ springdoc:
|
|||
server:
|
||||
port: 3456
|
||||
|
||||
servlet:
|
||||
session:
|
||||
timeout: 720h
|
||||
cookie:
|
||||
max-age: 2592000
|
||||
|
||||
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath:mapper/*.xml
|
||||
|
|
Loading…
Reference in New Issue
Block a user