From a0ffd8ea5401be4a6d1e458e5de7411bd0f012e7 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 13 Apr 2023 17:03:04 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=B8=93=E5=AE=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../provider/impl/ExpertDataScopeProviderImpl.java | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/ExpertDataScopeProviderImpl.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/ExpertDataScopeProviderImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/ExpertDataScopeProviderImpl.java new file mode 100644 index 0000000..5634bdb --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/ExpertDataScopeProviderImpl.java @@ -0,0 +1,52 @@ +package com.ningdatech.pmapi.datascope.provider.impl; + +import com.google.common.collect.Lists; +import com.ningdatech.pmapi.common.constant.RegionConst; +import com.ningdatech.pmapi.common.helper.RegionCacheHelper; +import com.ningdatech.pmapi.common.helper.UserInfoHelper; +import com.ningdatech.pmapi.datascope.model.DataScopeDTO; +import com.ningdatech.pmapi.datascope.provider.DataScopeProvider; +import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; +import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; +import com.ningdatech.pmapi.user.util.LoginUserUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.Collection; +import java.util.Optional; +import java.util.stream.Collectors; + +/** + *

+ * 专家 数据看板角色 + *

+ * + * @author ZPF + * @since 2023/3/27 23:29 + */ +@Slf4j +@RequiredArgsConstructor +@Component("EXPERT") +public class ExpertDataScopeProviderImpl implements DataScopeProvider { + + private final RegionCacheHelper regionCacheHelper; + + private final UserInfoHelper userInfoHelper; + + @Override + public Optional findDataFieldProperty() { + UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + //所有 丽水市的code + Collection regionCodes = regionCacheHelper.listChildRegionCodeList(RegionConst.RC_LS, + RegionConst.RL_CITY); + + DataScopeDTO ds = new DataScopeDTO(); + ds.setRegionCodes(regionCodes.stream().collect(Collectors.toList())); + ds.setUserId(userFullInfo.getUserId()); + ds.setEmployeeCode(userFullInfo.getEmployeeCode()); + ds.setRole(RoleEnum.EXPERT); + return Optional.ofNullable(ds); + } + +} From 886657efc284646a956c6788644779188e044896 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 13 Apr 2023 17:06:01 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=B8=93=E5=AE=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/datascope/provider/impl/ExpertDataScopeProviderImpl.java | 1 - 1 file changed, 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/ExpertDataScopeProviderImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/ExpertDataScopeProviderImpl.java index 5634bdb..5689d2e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/ExpertDataScopeProviderImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/ExpertDataScopeProviderImpl.java @@ -1,6 +1,5 @@ package com.ningdatech.pmapi.datascope.provider.impl; -import com.google.common.collect.Lists; import com.ningdatech.pmapi.common.constant.RegionConst; import com.ningdatech.pmapi.common.helper.RegionCacheHelper; import com.ningdatech.pmapi.common.helper.UserInfoHelper;