fix: 优化图层逻辑
This commit is contained in:
parent
d88eca8b8f
commit
ca5ff32c27
@ -19,9 +19,12 @@ import com.yfd.platform.utils.SecurityUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -131,8 +134,13 @@ public class MapmoduleBServiceImpl extends ServiceImpl<MsMapmoduleBMapper, MsMap
|
||||
MapmoduleVo mapmoduleVo = new MapmoduleVo();
|
||||
|
||||
// 1. GIS图层区
|
||||
List<MapLayerVo> layer = mapLayerBizService.getMapLayerTree(
|
||||
mapmoduleB.getModuleId(), mapmoduleB.getSystemId(), templateId);
|
||||
List<MapLayerVo> layer;
|
||||
if (hasCurrentUserModulePermission(mapmoduleB.getModuleId())) {
|
||||
layer = mapLayerBizService.getMapLayerTree(
|
||||
mapmoduleB.getModuleId(), mapmoduleB.getSystemId(), templateId);
|
||||
} else {
|
||||
layer = new ArrayList<>();
|
||||
}
|
||||
mapmoduleVo.setMapLayerVos(layer);
|
||||
|
||||
// 2. 地图图例
|
||||
@ -180,4 +188,23 @@ public class MapmoduleBServiceImpl extends ServiceImpl<MsMapmoduleBMapper, MsMap
|
||||
}
|
||||
return msMaptoolboxBList;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasCurrentUserModulePermission(String moduleId) {
|
||||
if (StrUtil.isBlank(moduleId) || StrUtil.equalsIgnoreCase(moduleId, "common")) {
|
||||
return true;
|
||||
}
|
||||
String userId = SecurityUtils.getUserId();
|
||||
if (StrUtil.isBlank(userId)) {
|
||||
return false;
|
||||
}
|
||||
List<SysMenu> userMenus = sysMenuMapper.selectMenuByUserId(userId, null);
|
||||
if (userMenus == null || userMenus.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
Set<String> menuIds = userMenus.stream()
|
||||
.map(SysMenu::getId)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.collect(Collectors.toCollection(HashSet::new));
|
||||
return menuIds.contains(moduleId);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user