bugfix 后管通过运营商id查询站点列表增加权限校验

This commit is contained in:
Lemon
2024-08-01 14:52:52 +08:00
parent 7294d82a7e
commit 2df857b39c
4 changed files with 34 additions and 2 deletions

View File

@@ -45,6 +45,14 @@ public interface PileStationInfoService {
*/
public List<PileStationInfo> selectStationListByMerchantId(Long merchantId);
/**
* 通过运营商id查询站点信息(带权限校验)
*
* @param merchantId 运营商id
* @return 站点信息列表
*/
public List<PileStationInfo> selectStationListByMerchantIdWithAuth(Long merchantId);
/**
* 新增充电站信息
*

View File

@@ -270,6 +270,30 @@ public class PileStationInfoServiceImpl implements PileStationInfoService {
return pileStationInfoMapper.selectStationListByMerchantId(merchantId);
}
/**
* 通过运营商id查询站点信息(带权限校验)
*
* @param merchantId 运营商id
* @return 站点信息列表
*/
@Override
public List<PileStationInfo> selectStationListByMerchantIdWithAuth(Long merchantId) {
AuthorizedDeptVO authorizedMap = UserUtils.getAuthorizedMap();
if (authorizedMap == null) {
return null;
}
List<PileStationInfo> pileStationInfos = pileStationInfoMapper.selectStationListByMerchantId(merchantId);
// 站点管理员
if (CollectionUtils.isNotEmpty(authorizedMap.getStationDeptIds())) {
List<String> stationDeptIds = authorizedMap.getStationDeptIds();
// 筛选出来符合deptIds的数据
pileStationInfos = pileStationInfos.stream()
.filter(pileStationInfo -> stationDeptIds.contains(pileStationInfo.getDeptId()))
.collect(Collectors.toList());
}
return pileStationInfos;
}
/**
* 新增充电站信息
*