zhanglei 2026-07-29 16:43:27 +08:00
parent 08d42de602
commit 469994fa9d
1 changed files with 14 additions and 2 deletions

View File

@ -18,8 +18,10 @@ import org.qinan.safetyeval.domain.service.AccountDomainService;
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
import org.qinan.safetyeval.infrastructure.adapter.gbs.GbsUserFacadeClient;
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.OrgInfoMapper;
import org.qinan.safetyeval.infrastructure.mapper.OrgPersonnelMapper;
import org.qinan.safetyeval.infrastructure.remote.SmsRemote;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -27,6 +29,8 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Objects;
/**
* App
*
@ -51,6 +55,8 @@ public class AccountExecutor implements AccountApi {
private OrgInfoMapper orgInfoMapper;
@Autowired
private AccountMapper accountMapper;
@Autowired
private OrgPersonnelMapper orgPersonnelMapper;
@Override
@Transactional(rollbackFor = Exception.class)
@ -162,10 +168,16 @@ public class AccountExecutor implements AccountApi {
log.info("同步用户信息:{}", AuthUserContextAdapter.getCurrentUser());
System.err.println(AuthUserContextAdapter.getCurrentUser());
AccountEntity accountEntity = accountDomainService.get(AuthUserContextAdapter.getCurrentUserId());
if (accountEntity == null || accountEntity.getType() == null) {
OrgPersonnelDO orgPersonnelDO = orgPersonnelMapper.selectById(AuthUserContextAdapter.getCurrentUserId());
int type;
if (Objects.nonNull(accountEntity) && accountEntity.getType() != null) {
type = accountEntity.getType();
} else if (Objects.nonNull(orgPersonnelDO)) {
type = 1;
} else {
throw new BizException(ErrorCode.ACCOUNT_NOT_FOUND);
}
return SingleResponse.success(accountEntity.getType());
return SingleResponse.success(type);
}
private AccountCO toCO(AccountEntity entity) {