use of com.mendmix.common.model.AuthUser in project jeesuite-libs by vakinge.
the class BaseMybatisTest method init.
@Before
public void init() {
CurrentRuntimeContext.setTenantId("1");
AuthUser user = new AuthUser();
user.setId("user01");
user.setDeptId("dept01");
user.setName("admin");
CurrentRuntimeContext.setAuthUser(user);
MybatisRuntimeContext.addDataProfileMappings("type", "0");
MybatisRuntimeContext.addDataProfileMappings("organization", MatchPolicy.exact.name());
}
use of com.mendmix.common.model.AuthUser in project jeesuite-libs by vakinge.
the class LogMessageFormat method buildLogHeader.
/**
* 生成日志消息
* @param actionKey 操作关键词
* @param bizKey 业务关键信息如:订单号
* @return
*/
public static String buildLogHeader(String actionKey, Serializable bizKey) {
StringBuilder builder = new StringBuilder();
builder.append(actionKey);
builder.append("<bizKey:").append(bizKey).append(">");
String requestId = CurrentRuntimeContext.getRequestId();
if (requestId != null)
builder.append("<requestId:").append(requestId).append(">");
String tenantId = CurrentRuntimeContext.getTenantId(false);
if (tenantId != null)
builder.append("<tenantId:").append(tenantId).append(">");
AuthUser currentUser = CurrentRuntimeContext.getCurrentUser();
if (currentUser != null)
builder.append("<currentUser:").append(currentUser.getName()).append(">");
return builder.toString();
}
use of com.mendmix.common.model.AuthUser in project jeesuite-libs by vakinge.
the class ActionLogCollector method onRequestStart.
public static ActionLog onRequestStart(String httpMethod, String uri, String requestIp) {
ActionLog actionLog = new ActionLog();
actionLog.setActionKey(String.format(ACTION_KEY_FORMAT, httpMethod, uri));
actionLog.setRequestIp(requestIp);
actionLog.setEnv(GlobalRuntimeContext.ENV);
actionLog.setAppId(StringUtils.defaultIfBlank(GlobalRuntimeContext.SYSTEM_ID, GlobalRuntimeContext.APPID));
actionLog.setModuleId(GlobalRuntimeContext.APPID);
actionLog.setRequestAt(new Date());
actionLog.setRequestId(CurrentRuntimeContext.getRequestId());
AuthUser currentUser = CurrentRuntimeContext.getCurrentUser();
if (currentUser != null) {
actionLog.setUserId(currentUser.getId());
actionLog.setUserName(currentUser.getName());
}
actionLog.setClientType(CurrentRuntimeContext.getClientType());
actionLog.setPlatformType(CurrentRuntimeContext.getPlatformType());
actionLog.setTenantId(CurrentRuntimeContext.getTenantId());
return actionLog;
}
Aggregations