|
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.management.platform.config.SuperSonicConfig;
|
|
import com.management.platform.constant.Constant;
|
|
import com.management.platform.constant.Constant;
|
|
import com.management.platform.entity.*;
|
|
import com.management.platform.entity.*;
|
|
import com.management.platform.entity.vo.SysRichFunction;
|
|
import com.management.platform.entity.vo.SysRichFunction;
|
|
@@ -240,18 +241,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
@Resource
|
|
@Resource
|
|
private SysDictService sysDictService;
|
|
private SysDictService sysDictService;
|
|
|
|
|
|
-
|
|
|
|
- @Value("${supersonic.ip:localhost}")
|
|
|
|
- private String supersonicIP;
|
|
|
|
-
|
|
|
|
- @Value("${supersonic.port:9080}")
|
|
|
|
- private String supersonicPort;
|
|
|
|
-
|
|
|
|
- @Value("${supersonic.username:admin}")
|
|
|
|
- private String supersonicUserName;
|
|
|
|
-
|
|
|
|
- @Value("${supersonic.password:e6+jQ26AESREiBBuKM1u1A==}")
|
|
|
|
- private String supersonicPassWord;
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private SuperSonicConfig superSonicConfig;
|
|
|
|
|
|
|
|
|
|
//登录网页端
|
|
//登录网页端
|
|
@@ -320,27 +311,29 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
//获取当前角色的权限菜单
|
|
//获取当前角色的权限菜单
|
|
setUserRoleMenu(userVO);
|
|
setUserRoleMenu(userVO);
|
|
//获取supersonicToken
|
|
//获取supersonicToken
|
|
- String superSonicToken = getSuperSonicToken();
|
|
|
|
- if(org.apache.commons.lang3.StringUtils.isBlank(superSonicToken)){
|
|
|
|
- httpRespMsg.setError(MessageUtils.message("user.supersonicLogin"));
|
|
|
|
- return httpRespMsg;
|
|
|
|
- }else{
|
|
|
|
- userVO.setSupersonicToken(superSonicToken);
|
|
|
|
- Integer count = sysConfigMapper.selectCount(new LambdaQueryWrapper<SysConfig>()
|
|
|
|
- .eq(SysConfig::getParamKey, "supersonicToken")
|
|
|
|
- );
|
|
|
|
- if(count > 0){
|
|
|
|
- sysConfigMapper.update(null,new LambdaUpdateWrapper<SysConfig>()
|
|
|
|
|
|
+ if(superSonicConfig.getSupersonicUse()){
|
|
|
|
+ String superSonicToken = getSuperSonicToken();
|
|
|
|
+ if(org.apache.commons.lang3.StringUtils.isBlank(superSonicToken)){
|
|
|
|
+ httpRespMsg.setError(MessageUtils.message("user.supersonicLogin"));
|
|
|
|
+ return httpRespMsg;
|
|
|
|
+ }else{
|
|
|
|
+ userVO.setSupersonicToken(superSonicToken);
|
|
|
|
+ Integer count = sysConfigMapper.selectCount(new LambdaQueryWrapper<SysConfig>()
|
|
.eq(SysConfig::getParamKey, "supersonicToken")
|
|
.eq(SysConfig::getParamKey, "supersonicToken")
|
|
- .set(SysConfig::getParamValue, superSonicToken)
|
|
|
|
);
|
|
);
|
|
- }else{
|
|
|
|
- SysConfig sysConfig = new SysConfig();
|
|
|
|
- sysConfig.setParamKey("supersonicToken");
|
|
|
|
- sysConfig.setParamValue(superSonicToken);
|
|
|
|
- sysConfigMapper.insert(sysConfig);
|
|
|
|
- }
|
|
|
|
|
|
+ if(count > 0){
|
|
|
|
+ sysConfigMapper.update(null,new LambdaUpdateWrapper<SysConfig>()
|
|
|
|
+ .eq(SysConfig::getParamKey, "supersonicToken")
|
|
|
|
+ .set(SysConfig::getParamValue, superSonicToken)
|
|
|
|
+ );
|
|
|
|
+ }else{
|
|
|
|
+ SysConfig sysConfig = new SysConfig();
|
|
|
|
+ sysConfig.setParamKey("supersonicToken");
|
|
|
|
+ sysConfig.setParamValue(superSonicToken);
|
|
|
|
+ sysConfigMapper.insert(sysConfig);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
httpRespMsg.data = userVO;
|
|
httpRespMsg.data = userVO;
|
|
}else {
|
|
}else {
|
|
@@ -352,12 +345,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
|
|
|
public String getSuperSonicToken(){
|
|
public String getSuperSonicToken(){
|
|
String token = "";
|
|
String token = "";
|
|
- String apiUrl = "http://"+supersonicIP+":"+supersonicPort+"/api/auth/user/login";
|
|
|
|
|
|
+ String apiUrl = "http://"+superSonicConfig.getSupersonicIP()+":"+superSonicConfig.getSupersonicPort()+"/api/auth/user/login";
|
|
HttpHeaders headers = new HttpHeaders();
|
|
HttpHeaders headers = new HttpHeaders();
|
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
|
JSONObject params = new JSONObject();
|
|
JSONObject params = new JSONObject();
|
|
- params.put("name", supersonicUserName);
|
|
|
|
- params.put("password", supersonicPassWord);
|
|
|
|
|
|
+ params.put("name", superSonicConfig.getSupersonicUserName());
|
|
|
|
+ params.put("password", superSonicConfig.getSupersonicPassWord());
|
|
String requestBody = params.toJSONString();
|
|
String requestBody = params.toJSONString();
|
|
HttpEntity<String> entity = new HttpEntity<>(requestBody, headers);
|
|
HttpEntity<String> entity = new HttpEntity<>(requestBody, headers);
|
|
ResponseEntity<String> responseEntity = restTemplate.exchange(apiUrl, HttpMethod.POST, entity, String.class);
|
|
ResponseEntity<String> responseEntity = restTemplate.exchange(apiUrl, HttpMethod.POST, entity, String.class);
|