mirror of https://gitee.com/stylefeng/roses
【7.6.0】【sys】【首页用户详情接口】更新填充用户的websocket url获取
parent
2feb5182c0
commit
e8aded49a5
|
@ -47,14 +47,4 @@ public interface MessageConstants {
|
||||||
*/
|
*/
|
||||||
String RECEIVE_ALL_USER_FLAG = "all";
|
String RECEIVE_ALL_USER_FLAG = "all";
|
||||||
|
|
||||||
/**
|
|
||||||
* 默认websocket-url
|
|
||||||
*/
|
|
||||||
String DEFAULT_WS_URL = "ws://localhost:8080/webSocket/{token}";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 系统配置中websocket url的变量编码
|
|
||||||
*/
|
|
||||||
String WEB_SOCKET_WS_URL_CONFIG_CODE = "WEB_SOCKET_WS_URL";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,9 @@
|
||||||
* 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns
|
* 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns
|
||||||
* 6.若您的项目无法满足以上几点,可申请商业授权
|
* 6.若您的项目无法满足以上几点,可申请商业授权
|
||||||
*/
|
*/
|
||||||
package cn.stylefeng.roses.kernel.message.api.expander;
|
package cn.stylefeng.roses.kernel.sys.modular.login.expander;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.config.api.context.ConfigContext;
|
import cn.stylefeng.roses.kernel.config.api.context.ConfigContext;
|
||||||
import cn.stylefeng.roses.kernel.message.api.constants.MessageConstants;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* websocket相关配置快速获取
|
* websocket相关配置快速获取
|
||||||
|
@ -42,7 +41,7 @@ public class WebSocketConfigExpander {
|
||||||
* @since 2021/1/25 20:34
|
* @since 2021/1/25 20:34
|
||||||
*/
|
*/
|
||||||
public static String getWebSocketWsUrl() {
|
public static String getWebSocketWsUrl() {
|
||||||
return ConfigContext.me().getSysConfigValueWithDefault("WEB_SOCKET_WS_URL", String.class, MessageConstants.DEFAULT_WS_URL);
|
return ConfigContext.me().getSysConfigValueWithDefault("WEB_SOCKET_WS_URL", String.class, "null");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package cn.stylefeng.roses.kernel.sys.modular.login.service;
|
package cn.stylefeng.roses.kernel.sys.modular.login.service;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
|
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
|
||||||
import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
|
import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
|
||||||
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
|
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
|
||||||
|
@ -11,6 +12,7 @@ import cn.stylefeng.roses.kernel.sys.api.SysUserServiceApi;
|
||||||
import cn.stylefeng.roses.kernel.sys.api.pojo.user.SimpleUserDTO;
|
import cn.stylefeng.roses.kernel.sys.api.pojo.user.SimpleUserDTO;
|
||||||
import cn.stylefeng.roses.kernel.sys.api.pojo.user.UserOrgDTO;
|
import cn.stylefeng.roses.kernel.sys.api.pojo.user.UserOrgDTO;
|
||||||
import cn.stylefeng.roses.kernel.sys.modular.app.service.SysAppService;
|
import cn.stylefeng.roses.kernel.sys.modular.app.service.SysAppService;
|
||||||
|
import cn.stylefeng.roses.kernel.sys.modular.login.expander.WebSocketConfigExpander;
|
||||||
import cn.stylefeng.roses.kernel.sys.modular.login.pojo.IndexUserAppInfo;
|
import cn.stylefeng.roses.kernel.sys.modular.login.pojo.IndexUserAppInfo;
|
||||||
import cn.stylefeng.roses.kernel.sys.modular.login.pojo.IndexUserMenuInfo;
|
import cn.stylefeng.roses.kernel.sys.modular.login.pojo.IndexUserMenuInfo;
|
||||||
import cn.stylefeng.roses.kernel.sys.modular.login.pojo.IndexUserOrgInfo;
|
import cn.stylefeng.roses.kernel.sys.modular.login.pojo.IndexUserOrgInfo;
|
||||||
|
@ -93,10 +95,11 @@ public class UserIndexInfoService {
|
||||||
this.fillMenuUrlAppIdMap(userIndexInfo, userMenuList);
|
this.fillMenuUrlAppIdMap(userIndexInfo, userMenuList);
|
||||||
|
|
||||||
// 7. 构建websocket url
|
// 7. 构建websocket url
|
||||||
|
this.fillWebSocketUrl(loginUser, userIndexInfo);
|
||||||
|
|
||||||
// 8. 更新用户的session信息,因为可能更新了loginUser中的值
|
// 8. 更新用户的session信息,因为可能更新了loginUser中的值
|
||||||
|
|
||||||
|
|
||||||
return userIndexInfo;
|
return userIndexInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,4 +312,22 @@ public class UserIndexInfoService {
|
||||||
|
|
||||||
userIndexInfo.setMenuUrlAppIdMap(menuUrlAppIdMap);
|
userIndexInfo.setMenuUrlAppIdMap(menuUrlAppIdMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 填充用户的websocket url
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2023/6/19 23:13
|
||||||
|
*/
|
||||||
|
private void fillWebSocketUrl(LoginUser loginUser, UserIndexInfo userIndexInfo) {
|
||||||
|
|
||||||
|
// 从sys_config中获取配置
|
||||||
|
String webSocketWsUrl = WebSocketConfigExpander.getWebSocketWsUrl();
|
||||||
|
Map<String, String> params = new HashMap<>(1);
|
||||||
|
params.put("token", loginUser.getToken());
|
||||||
|
webSocketWsUrl = StrUtil.format(webSocketWsUrl, params);
|
||||||
|
|
||||||
|
userIndexInfo.setWebsocketUrl(webSocketWsUrl);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue