zhanglei 2026-07-29 15:28:38 +08:00
parent 3d2048e90c
commit 08d42de602
1 changed files with 7 additions and 1 deletions

View File

@ -6,7 +6,9 @@ import org.qinan.safetyeval.domain.exception.ErrorCode;
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter; import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserInfo; import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserInfo;
import org.qinan.safetyeval.infrastructure.dataobject.AccountDO; import org.qinan.safetyeval.infrastructure.dataobject.AccountDO;
import org.qinan.safetyeval.infrastructure.dataobject.OrgPersonnelDO;
import org.qinan.safetyeval.infrastructure.mapper.AccountMapper; import org.qinan.safetyeval.infrastructure.mapper.AccountMapper;
import org.qinan.safetyeval.infrastructure.mapper.OrgPersonnelMapper;
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults; import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -17,6 +19,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Objects;
/** /**
* MyMetaObjectHandler org_id / tenant_id * MyMetaObjectHandler org_id / tenant_id
@ -35,6 +38,8 @@ public class GbsUserSyncInterceptor implements WebMvcConfigurer {
"/**/file/**", "/**/file/**",
"/**/tree/**" "/**/tree/**"
}; };
@Autowired
private OrgPersonnelMapper orgPersonnelMapper;
@Override @Override
public void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {
@ -50,7 +55,8 @@ public class GbsUserSyncInterceptor implements WebMvcConfigurer {
throw new BizException(ErrorCode.GBS_USER_ERROR); throw new BizException(ErrorCode.GBS_USER_ERROR);
} }
AccountDO accountDO = accountMapper.selectById(currentUser.getUserId()); AccountDO accountDO = accountMapper.selectById(currentUser.getUserId());
if (accountDO == null) { OrgPersonnelDO orgPersonnelDO = orgPersonnelMapper.selectById(currentUser.getUserId());
if (Objects.isNull(accountDO) && Objects.isNull(orgPersonnelDO)) {
// 用户没有gbs信息,自动填充一条数据类型默认监管端 // 用户没有gbs信息,自动填充一条数据类型默认监管端
AccountDO accountSave = new AccountDO(); AccountDO accountSave = new AccountDO();
accountSave.setId(currentUser.getUserId()); accountSave.setId(currentUser.getUserId());