返回列表 发布新帖

微服务中如何取得用户资讯

160 1
发表于 2024-12-27 23:30:00 | 查看全部 阅读模式
问答

紧急程度

已完结
微服务中如何取得用户资讯

最佳答案

查看完整内容

租户及用户资讯可以在服务上下文中取得。请参考以下代码范例: // 取出服务上下文 DWServiceContext context = DWServiceContext.getContext(); Map tProfile = DWServiceContext.getContext().getProfile(); // 取得租户SID long tenantSid = (long) tProfile.get("tenantSid"); // 取得租户ID String tenantId = (String) tProfile.get("tenantId"); // 取得租户名称 String tenantName = (String) tProfile.get("tenantName"); ...

评论1

admin楼主Lv.9 发表于 2024-12-27 23:30:00 | 查看全部
租户及用户资讯可以在服务上下文中取得。请参考以下代码范例:
// 取出服务上下文
DWServiceContext context = DWServiceContext.getContext();
Map tProfile = DWServiceContext.getContext().getProfile();
// 取得租户SID
long tenantSid = (long) tProfile.get("tenantSid");
// 取得租户ID
String tenantId = (String) tProfile.get("tenantId");
// 取得租户名称
String tenantName = (String) tProfile.get("tenantName");
// 取得用户ID
String userId = (String) tProfile.get("userId");
// 取得租户名称
String userName = (String) tProfile.get("userName");
大家来答
    精选文章
    DAP后端应用写法-使用DWDataSet进行数据库的新增/修改
    场景使用高代码后端要去数据库变更数据, 除了直接下SQL的方式外, 更可用java物件的方
    DAP后端应用写法-使用DWQueryInfo进行数据库的查询
    场景使用高代码后端要去数据库查资料, 除了直接下SQL的方式外, 更可用java物件的方式,
    排錯技巧 - 雅典娜签核,间歇性会报错
     问题描述顾问反馈:雅典娜签核套件点击OA送签或查看签核流程时,间歇性会报错。
    鼎捷雅典娜-运营单元
     背景说明鼎捷雅典娜是云地整合的架构,在新客户期初导入时,需要针对新客户租户
    排错技巧 - 地中台无法启用
    问题描述顾问反馈:客户在完成新版更新后,服务无法正常启用! 错误信息如下,地中台
    • 关注公众号
    Copyright © 2025 鼎捷数智股份有限公司 版权所有 All Rights Reserved. Powered by Discuz! X5.0
    关灯 在本版发帖
    即将开放
    返回顶部
    快速回复 返回顶部 返回列表