fix: 修复 操作日志 组织机构为空 默认取 request token 的BUG

pull/14/head
Carina 3 years ago
parent 447fd369b3
commit 07fa65ed69

@ -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;

@ -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){

Loading…
Cancel
Save