diff --git a/opsli-api/src/main/java/org/opsli/api/wrapper/system/logs/LogsModel.java b/opsli-api/src/main/java/org/opsli/api/wrapper/system/logs/LogsModel.java index d35242f..f2ac9ea 100644 --- a/opsli-api/src/main/java/org/opsli/api/wrapper/system/logs/LogsModel.java +++ b/opsli-api/src/main/java/org/opsli/api/wrapper/system/logs/LogsModel.java @@ -37,6 +37,18 @@ public class LogsModel extends ApiWrapper { public static final String TYPE_EXCEPTION = "2"; + /** + * 多租户字段 + */ + @ApiModelProperty(value = "租户ID") + private String tenantId; + + /** + * 组织机构ID组 xxx,xxx + */ + @ApiModelProperty(value = "组织ID集合") + private String orgIds; + /** 日志类型(1:接入日志;2:错误日志) */ @ApiModelProperty(value = "日志类型") private String type; diff --git a/opsli-base-support/opsli-core/src/main/java/org/opsli/core/utils/LogUtil.java b/opsli-base-support/opsli-core/src/main/java/org/opsli/core/utils/LogUtil.java index 112a682..a23cd62 100644 --- a/opsli-base-support/opsli-core/src/main/java/org/opsli/core/utils/LogUtil.java +++ b/opsli-base-support/opsli-core/src/main/java/org/opsli/core/utils/LogUtil.java @@ -27,6 +27,7 @@ import org.aspectj.lang.reflect.MethodSignature; import org.opsli.api.wrapper.system.logs.LogsModel; import org.opsli.api.wrapper.system.menu.MenuModel; import org.opsli.api.wrapper.system.user.UserModel; +import org.opsli.api.wrapper.system.user.UserOrgRefModel; import org.opsli.common.annotation.EnableLog; import org.opsli.common.annotation.RequiresPermissionsCus; import org.opsli.common.utils.IPUtil; @@ -118,6 +119,15 @@ public final class LogUtil { logsModel.setUpdateBy(user.getId()); logsModel.setIzManual(true); + // 如果组织IDs 为空则进行默认赋值 + UserOrgRefModel userOrgRefModel = UserUtil.getUserDefOrgByUserId(user.getId()); + if(null != userOrgRefModel){ + logsModel.setOrgIds(userOrgRefModel.getOrgIds()); + } + + // 赋值 租户ID + logsModel.setTenantId(user.getTenantId()); + // 保存日志 LogsThreadPool.process(logsModel); } catch (Exception ex){