项目管理查询
parent
9562afa842
commit
3b83a3f948
|
|
@ -11,6 +11,7 @@ import org.qinan.safetyeval.domain.entity.EvalProjectEntity;
|
|||
import org.qinan.safetyeval.domain.gateway.EvalProjectGateway;
|
||||
import org.qinan.safetyeval.domain.query.EvalProjectQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.ThreadLocalUserInfoAdapter;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.qinan.safetyeval.infrastructure.convertor.EvalProjectDoConvertor;
|
||||
import org.qinan.safetyeval.infrastructure.dataobject.EvalProjectDO;
|
||||
|
|
@ -30,6 +31,7 @@ import java.time.LocalDate;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
|
|
@ -145,6 +147,9 @@ public class EvalProjectGatewayImpl implements EvalProjectGateway {
|
|||
private LambdaQueryWrapper<EvalProjectDO> buildQueryWrapper(EvalProjectQuery query) {
|
||||
LambdaQueryWrapper<EvalProjectDO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(EvalProjectDO::getDeleteEnum, "false");
|
||||
if (Objects.isNull(query.getOrgId())) {
|
||||
query.setOrgId(ThreadLocalUserInfoAdapter.getOrgId());
|
||||
}
|
||||
if (query.getOrgId() != null) {
|
||||
wrapper.eq(EvalProjectDO::getOrgId, query.getOrgId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package org.qinan.safetyeval.infrastructure.support;
|
||||
|
||||
import org.qinan.safetyeval.domain.entity.OrgInfoEntity;
|
||||
import org.qinan.safetyeval.domain.exception.BizException;
|
||||
import org.qinan.safetyeval.domain.exception.ErrorCode;
|
||||
import org.qinan.safetyeval.domain.gateway.OrgInfoGateway;
|
||||
|
|
@ -22,15 +21,6 @@ public class InstitutionOrgSupport {
|
|||
if (orgId == null) {
|
||||
orgId = ThreadLocalUserInfoAdapter.get();
|
||||
}
|
||||
if (orgId == null && orgInfoGateway != null) {
|
||||
OrgInfoEntity orgInfo = orgInfoGateway.getInfo();
|
||||
if (orgInfo != null) {
|
||||
orgId = orgInfo.getId();
|
||||
}
|
||||
}
|
||||
if (orgId == null) {
|
||||
throw new BizException(ErrorCode.ORG_INFO_NOT_FOUND);
|
||||
}
|
||||
return orgId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,7 @@
|
|||
package org.qinan.safetyeval.infrastructure.support;
|
||||
|
||||
import org.qinan.safetyeval.domain.exception.BizException;
|
||||
import org.qinan.safetyeval.domain.exception.ErrorCode;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.ThreadLocalUserInfoAdapter;
|
||||
import org.qinan.safetyeval.infrastructure.adapter.auth.AuthUserContextAdapter;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.BindException;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 解析写入时的 orgId:优先实体值 → SSO 登录上下文(AuthUserContextAdapter) → ThreadLocal(UserInfoAdapter) → 配置回退(local 联调 org-id=1)。
|
||||
|
|
@ -20,10 +13,6 @@ public class OrgContextResolver {
|
|||
if (entityOrgId != null) {
|
||||
return entityOrgId;
|
||||
}
|
||||
Long orgId = ThreadLocalUserInfoAdapter.get();
|
||||
if (orgId == null) {
|
||||
throw new BizException(ErrorCode.ORG_INFO_NOT_FOUND);
|
||||
}
|
||||
return orgId;
|
||||
return ThreadLocalUserInfoAdapter.get();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue