|
|
@@ -9,6 +9,7 @@ import com.ningdatech.basic.model.PageVo; |
|
|
|
import com.ningdatech.pmapi.common.enumeration.BoolDisplayEnum; |
|
|
|
import com.ningdatech.pmapi.common.helper.RegionLimitHelper; |
|
|
|
import com.ningdatech.pmapi.common.model.CommonPage; |
|
|
|
import com.ningdatech.pmapi.common.util.StrUtils; |
|
|
|
import com.ningdatech.pmapi.expert.assembler.ExpertAdminExpertManageAssembler; |
|
|
|
import com.ningdatech.pmapi.expert.assembler.ExpertInfoCmdAssembler; |
|
|
|
import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum; |
|
|
@@ -49,10 +50,7 @@ import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author liuxinxin |
|
|
@@ -82,6 +80,9 @@ public class ExpertAdminManage { |
|
|
|
public PageVo<ExpertAdminExpertManageListVO> getExpertLibraryList(ExpertAdminExpertManageQuery query) { |
|
|
|
Long userId = LoginUserUtil.getUserId(); |
|
|
|
ExpertAdminExpertManageQueryCmd queryCmd = buildExpertAdminExpertManageQueryCmd(query, userId); |
|
|
|
if (queryCmd.isHasNonData()) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
CommonPage<ExpertAdminExpertManageListDTO> pageResult = expertAdminManageService.getExpertLibraryList(queryCmd); |
|
|
|
|
|
|
|
PageVo<ExpertAdminExpertManageListVO> pageVo = new PageVo<>(); |
|
|
@@ -95,10 +96,10 @@ public class ExpertAdminManage { |
|
|
|
ExpertAdminExpertManageQueryCmd queryCmd = new ExpertAdminExpertManageQueryCmd(); |
|
|
|
queryCmd.setPageNumber(query.getPageNumber()); |
|
|
|
queryCmd.setPageSize(query.getPageSize()); |
|
|
|
if (StringUtils.isNotBlank(query.getExpertName())) { |
|
|
|
if (StrUtils.isNotBlank(query.getExpertName())) { |
|
|
|
queryCmd.setExpertName(query.getExpertName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getCompany())) { |
|
|
|
if (StrUtils.isNotBlank(query.getCompany())) { |
|
|
|
queryCmd.setCompany(query.getCompany()); |
|
|
|
} |
|
|
|
List<ExpertDictionaryQuery> expertDictQueryList = new ArrayList<>(); |
|
|
@@ -134,8 +135,8 @@ public class ExpertAdminManage { |
|
|
|
expertTagQueryList.add(expertTagQuery); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getExpertAccountStatus())) { |
|
|
|
QueryExpertAccountStatusEnum queryExpertAccountStatusEnum = QueryExpertAccountStatusEnum.of(query.getExpertAccountStatus()); |
|
|
|
switch (queryExpertAccountStatusEnum) { |
|
|
|
QueryExpertAccountStatusEnum queryExpertAccountStatus = QueryExpertAccountStatusEnum.of(query.getExpertAccountStatus()); |
|
|
|
switch (queryExpertAccountStatus) { |
|
|
|
case NORMAL: |
|
|
|
queryCmd.setExpertAccountStatusList(CollectionUtil.toList(ExpertAccountStatusEnum.AVAILABLE)); |
|
|
|
break; |
|
|
@@ -151,7 +152,8 @@ public class ExpertAdminManage { |
|
|
|
|
|
|
|
List<RegionContainsBO> expertAdminContainsRegionList; |
|
|
|
// 如果为超级管理员,可以查看所有的专家,包括没有层级的专家 |
|
|
|
if (!permissionCheckHelper.isSuperAdmin()) { |
|
|
|
boolean isSuperAdmin; |
|
|
|
if (!(isSuperAdmin = permissionCheckHelper.isSuperAdmin())) { |
|
|
|
expertAdminContainsRegionList = regionLimitHelper.getExpertAdminContainsRegion(userId); |
|
|
|
} else { |
|
|
|
expertAdminContainsRegionList = Collections.emptyList(); |
|
|
@@ -161,7 +163,15 @@ public class ExpertAdminManage { |
|
|
|
if (Objects.nonNull(query.getExpertRegionInfo())) { |
|
|
|
RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(query.getExpertRegionInfo().getRegionLevel() |
|
|
|
, query.getExpertRegionInfo().getRegionCode()); |
|
|
|
containsRegion = regionLimitHelper.queryContainsRegionAssembler(containsRegionBo, expertAdminContainsRegionList); |
|
|
|
if (isSuperAdmin) { |
|
|
|
containsRegion = Collections.singletonList(containsRegionBo); |
|
|
|
} else { |
|
|
|
containsRegion = regionLimitHelper.queryContainsRegionAssembler(containsRegionBo, expertAdminContainsRegionList); |
|
|
|
if (containsRegion.isEmpty()) { |
|
|
|
queryCmd.setHasNonData(true); |
|
|
|
return queryCmd; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
List<RegionContainsBO> intentionRegions = null; |
|
|
@@ -169,7 +179,15 @@ public class ExpertAdminManage { |
|
|
|
ExpertRegionInfo intentionRegionInfo = query.getIntentionRegionInfo(); |
|
|
|
RegionContainsBO containsRegionBo = regionLimitHelper.getContainsRegionBo(intentionRegionInfo.getRegionLevel() |
|
|
|
, intentionRegionInfo.getRegionCode()); |
|
|
|
intentionRegions = regionLimitHelper.queryContainsRegionAssembler(containsRegionBo, expertAdminContainsRegionList); |
|
|
|
if (isSuperAdmin) { |
|
|
|
intentionRegions = Collections.singletonList(containsRegionBo); |
|
|
|
} else { |
|
|
|
intentionRegions = regionLimitHelper.queryContainsRegionAssembler(containsRegionBo, expertAdminContainsRegionList); |
|
|
|
if (intentionRegions.isEmpty()) { |
|
|
|
queryCmd.setHasNonData(true); |
|
|
|
return queryCmd; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (containsRegion == null && intentionRegions == null) { |
|
|
|
containsRegion = expertAdminContainsRegionList; |
|
|
|