Bläddra i källkod

专家

tags/24080901
PoffyZhang 1 år sedan
förälder
incheckning
a0ffd8ea54
1 ändrade filer med 52 tillägg och 0 borttagningar
  1. +52
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/ExpertDataScopeProviderImpl.java

+ 52
- 0
pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/ExpertDataScopeProviderImpl.java Visa fil

@@ -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;

/**
* <p>
* 专家 数据看板角色
* </p>
*
* @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<DataScopeDTO> findDataFieldProperty() {
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
//所有 丽水市的code
Collection<String> 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);
}

}

Laddar…
Avbryt
Spara