feat: 拦截器同步用户调整
parent
1501cfdd23
commit
8ebdfdfcae
|
|
@ -7,6 +7,7 @@ import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
|||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserInfo;
|
||||
import org.qinan.safetyeval.infrastructure.dataobject.AccountDO;
|
||||
import org.qinan.safetyeval.infrastructure.mapper.AccountMapper;
|
||||
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
|
|
@ -36,7 +37,7 @@ public class GbsUserSyncInterceptor implements WebMvcConfigurer {
|
|||
return true;
|
||||
}
|
||||
AuthUserInfo currentUser = AuthUserContextAdapter.getCurrentUser();
|
||||
if (currentUser == null) {
|
||||
if (currentUser == null || currentUser.getUserId() == null) {
|
||||
throw new BizException(ErrorCode.GBS_USER_ERROR);
|
||||
}
|
||||
AccountDO accountDO = accountMapper.selectById(currentUser.getUserId());
|
||||
|
|
@ -45,10 +46,11 @@ public class GbsUserSyncInterceptor implements WebMvcConfigurer {
|
|||
AccountDO accountSave = new AccountDO();
|
||||
accountSave.setId(currentUser.getUserId());
|
||||
accountSave.setUserName(currentUser.getUserName());
|
||||
accountSave.setAccount(currentUser.getAccount());
|
||||
accountSave.setPhone(currentUser.getMobile());
|
||||
accountSave.setAccount(currentUser.getAccount() == null ? "" : currentUser.getAccount());
|
||||
accountSave.setPhone(currentUser.getMobile() == null ? "" : currentUser.getMobile());
|
||||
accountSave.setTenantId(currentUser.getTenantId());
|
||||
accountSave.setType(2);
|
||||
InsertFieldDefaults.applyIgnoreOrgId(accountSave);
|
||||
accountMapper.insert(accountSave);
|
||||
log.info("用户{}同步gbs信息成功", currentUser.getUserName());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue