返回列表 发布新帖

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

119 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");
大家来答
    热门讨论
    精选文章
    排错技巧 - 地中台查不到调用日志
    问题描述客户反馈:系统今天都有正常交易,但在EAI上却查不到日志记录,可能是什么原
    私有化效能问题排查
     需求背景在私有化环境中,客户的服务器环境可能在本地,也可能在云端,可能会受
    设定高代码应用的作业权限控制(纯DAP前后端)
    场景比较常见的运作场景是纯DAP的前端页面, 通常会有选单, 这时候, 就会有一个需求,
    数据驱动2.0_组合场景, 任务结束后走不同分支设定方式说明
    场景以下图为例, 当[订单签核]任务结束后, 希望依条件决定后面要走到[工单待签核]或[
    低代码的标准表格中高级查询指定字段的列值支持下拉配置
        需求背景            当用户在使用低代
    • 关注公众号
    Copyright © 2025 鼎捷数智股份有限公司 版权所有 All Rights Reserved. Powered by Discuz! X5.0
    关灯 在本版发帖
    即将开放
    返回顶部
    快速回复 返回顶部 返回列表