图例数据管理代码提交,查询 新增 修改 删除
This commit is contained in:
parent
94c189c8df
commit
27cf1e504c
@ -73,6 +73,7 @@ public class SecurityConfig {
|
||||
// .requestMatchers("/fh/**").permitAll()
|
||||
// .requestMatchers("/data/**").permitAll()
|
||||
.requestMatchers("/mapLayer/**").permitAll()
|
||||
.requestMatchers("/mapmodule/**").permitAll()
|
||||
.requestMatchers("/mapLegend/**").permitAll()
|
||||
.requestMatchers("/sms/**").permitAll()
|
||||
.requestMatchers(HttpMethod.GET, "/").permitAll()
|
||||
|
||||
@ -164,10 +164,10 @@ public class SwaggerConfig {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public GroupedOpenApi groupSysMlgApi() {
|
||||
public GroupedOpenApi groupSysMcfgApi() {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("5.1 图例结构管理")
|
||||
.packagesToScan("com.yfd.platform.qgc_sys.mapLegend.controller")
|
||||
.packagesToScan("com.yfd.platform.qgc_sys.mapcfg.controller")
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,11 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.yfd.platform.common.DataSourceResult;
|
||||
import com.yfd.platform.common.exception.BizException;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaplayerB;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaplegendB;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLayerAo;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.service.IMapLayerBizService;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.service.IMapLayerService;
|
||||
@ -37,7 +39,24 @@ public class MapLayerController {
|
||||
@PostMapping("/getAllMapLayerTree")
|
||||
public ResponseResult getAllMapLayerTree(@RequestBody MapLayerAo flag) {
|
||||
List<MsMaplayerB> tree = mapLayerBizService.getMapLayerTree(flag);
|
||||
return ResponseResult.successData(tree);
|
||||
// 构建 Kendo 数据源结果
|
||||
DataSourceResult<MsMaplayerB> dataSourceResult = new DataSourceResult<>();
|
||||
dataSourceResult.setData(tree);
|
||||
// 计算总节点数
|
||||
long total = countTreeNodes(tree);
|
||||
dataSourceResult.setTotal(tree.size());
|
||||
return ResponseResult.successData(dataSourceResult);
|
||||
}
|
||||
private long countTreeNodes(List<MsMaplayerB> nodes) {
|
||||
if (nodes == null) return 0;
|
||||
long count = 0;
|
||||
for (MsMaplayerB node : nodes) {
|
||||
count++; // 当前节点
|
||||
if (node.getChildren() != null && !node.getChildren().isEmpty()) {
|
||||
count += countTreeNodes(node.getChildren());
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -3,21 +3,32 @@ package com.yfd.platform.qgc_sys.mapLayer.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.common.DataSourceRequest;
|
||||
import com.yfd.platform.common.DataSourceResult;
|
||||
import com.yfd.platform.common.exception.BizException;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaplayerB;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaplegendB;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.mapper.MsMaplayerBMapper;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.service.IMapLayerService;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.service.IMapLegendService;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLegendVo;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.service.IMapLegendBizService;
|
||||
import com.yfd.platform.utils.DataSourceRequestUtil;
|
||||
import com.yfd.platform.utils.SecurityUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 地图图例管理
|
||||
@ -32,6 +43,11 @@ public class MapLegendController {
|
||||
@Resource
|
||||
private IMapLegendService mapLegendService;
|
||||
|
||||
@Resource
|
||||
private IMapLegendBizService mapLegendBizService;
|
||||
|
||||
@Resource
|
||||
private MsMaplayerBMapper msMaplayerBMapper; // 新增注入
|
||||
/**
|
||||
* 条件过滤数据列表(Kendo UI 数据源)
|
||||
*/
|
||||
@ -54,6 +70,68 @@ public class MapLegendController {
|
||||
resultPage.setTotal(list.size());
|
||||
}
|
||||
|
||||
List<MsMaplegendB> records = resultPage.getRecords();
|
||||
if (records != null && !records.isEmpty()) {
|
||||
// ---------- 2. 批量获取父级信息(用于 parentCode、parentName)----------
|
||||
Set<String> parentIds = records.stream()
|
||||
.filter(e -> e.getDataType() != null && e.getDataType() == 2) // 只处理图例数据
|
||||
.map(MsMaplegendB::getParentId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Map<String, MsMaplegendB> parentMap = new HashMap<>();
|
||||
if (!parentIds.isEmpty()) {
|
||||
List<MsMaplegendB> parents = mapLegendService.listByIds(parentIds);
|
||||
parentMap = parents.stream()
|
||||
.collect(Collectors.toMap(MsMaplegendB::getId, Function.identity()));
|
||||
}
|
||||
|
||||
// ---------- 3. 批量获取图层名称(根据 layerCode 查 MS_MAPLAYER_B)----------
|
||||
Set<String> layerCodes = records.stream()
|
||||
.map(MsMaplegendB::getLayerCode)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Map<String, String> layerCodeNameMap = new HashMap<>();
|
||||
if (!layerCodes.isEmpty()) {
|
||||
// 使用 Mapper 查询
|
||||
List<MsMaplayerB> layerList = msMaplayerBMapper.selectList(
|
||||
new LambdaQueryWrapper<MsMaplayerB>()
|
||||
.in(MsMaplayerB::getCode, layerCodes)
|
||||
);
|
||||
layerCodeNameMap = layerList.stream()
|
||||
.collect(Collectors.toMap(MsMaplayerB::getCode, MsMaplayerB::getTitle));
|
||||
}
|
||||
|
||||
// ---------- 4. 遍历记录,填充三个额外字段 ----------
|
||||
for (MsMaplegendB entity : records) {
|
||||
// 4.1 填充 parentCode / parentName(仅 dataType=2)
|
||||
if (entity.getDataType() != null && entity.getDataType() == 2) {
|
||||
String parentId = entity.getParentId();
|
||||
if (parentId != null && parentMap.containsKey(parentId)) {
|
||||
MsMaplegendB parent = parentMap.get(parentId);
|
||||
entity.setParentCode(parent.getCode());
|
||||
entity.setParentName(parent.getName());
|
||||
} else {
|
||||
entity.setParentCode(null);
|
||||
entity.setParentName(null);
|
||||
}
|
||||
} else {
|
||||
// 非 dataType=2 的记录,这两个字段置空
|
||||
entity.setParentCode(null);
|
||||
entity.setParentName(null);
|
||||
}
|
||||
|
||||
// 4.2 填充 layerCodeName(所有记录均可填充,如果图层不存在则置空)
|
||||
String layerCode = entity.getLayerCode();
|
||||
if (layerCode != null && layerCodeNameMap.containsKey(layerCode)) {
|
||||
entity.setLayerCodeName(layerCodeNameMap.get(layerCode));
|
||||
} else {
|
||||
entity.setLayerCodeName(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 构建 Kendo 数据源结果
|
||||
DataSourceResult<MsMaplegendB> dataSourceResult = new DataSourceResult<>();
|
||||
dataSourceResult.setData(resultPage.getRecords());
|
||||
@ -86,6 +164,15 @@ public class MapLegendController {
|
||||
if (legend.getDataType() == 2 && StrUtil.isBlank(legend.getLayerCode())) {
|
||||
throw new BizException("关联的图层编码(layerCode)不能为空.");
|
||||
}
|
||||
if (StrUtil.isNotBlank(legend.getName())){
|
||||
if(StrUtil.isBlank(legend.getGroupName())){
|
||||
legend.setGroupName(legend.getName());
|
||||
}
|
||||
if(StrUtil.isBlank(legend.getParentName())){
|
||||
legend.setGroupName(legend.getName());
|
||||
}
|
||||
}
|
||||
legend.setRecordUser(SecurityUtils.getUserId());
|
||||
mapLegendService.saveOrUpdate(legend);
|
||||
return ResponseResult.success("保存成功.");
|
||||
}
|
||||
@ -99,4 +186,14 @@ public class MapLegendController {
|
||||
mapLegendService.delelteByIds(ids);
|
||||
return ResponseResult.success("删除成功.");
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图图例管理图层树(下拉选)
|
||||
*/
|
||||
@Operation(summary = "地图图例管理图层树(下拉选)")
|
||||
@GetMapping("/getAllMapLegendTree")
|
||||
public ResponseResult getAllMapLayerTree(Integer flag) {
|
||||
List<MapLegendVo> tree = mapLegendBizService.getMapLegendTree(flag);
|
||||
return ResponseResult.successData(tree);
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,4 +131,10 @@ public class MsMaplegendB implements Serializable {
|
||||
|
||||
@TableField("IS_FILTER")
|
||||
private Integer isFilter;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String layerCodeName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String parentCode;
|
||||
}
|
||||
@ -80,11 +80,14 @@ public class MsMapmoduleB implements Serializable {
|
||||
@TableField("TEMPLATE_ID")
|
||||
private String templateId;
|
||||
|
||||
@TableField("SYSTEM_ID")
|
||||
private String systemId;
|
||||
|
||||
/**
|
||||
* 归属的系统ID(非数据库字段,用于字典翻译)
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String systemId;
|
||||
private String systemName;
|
||||
|
||||
/**
|
||||
* 菜单名称(非数据库字段,用于字典翻译)
|
||||
|
||||
@ -0,0 +1,186 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地图工具箱表
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
@Data
|
||||
@TableName("MS_MAPTOOLBOX_B")
|
||||
public class MsMaptoolboxB implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@TableField("NAME")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 名称(英文)
|
||||
*/
|
||||
@TableField("NAME_EN")
|
||||
private String nameEn;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@TableField("CODE")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 地图模式
|
||||
*/
|
||||
@TableField("MAP_MODEL")
|
||||
private String mapModel;
|
||||
|
||||
/**
|
||||
* 所属父节点
|
||||
*/
|
||||
@TableField("PATENT_ID")
|
||||
private String patentId;
|
||||
|
||||
/**
|
||||
* 树全路径
|
||||
*/
|
||||
@TableField("FULL_PATH")
|
||||
private String fullPath;
|
||||
|
||||
/**
|
||||
* 层级
|
||||
*/
|
||||
@TableField("TREE_LEVEL")
|
||||
private Integer treeLevel;
|
||||
|
||||
/**
|
||||
* 是否有子集
|
||||
*/
|
||||
@TableField("HAS_CHILDREN")
|
||||
private Integer hasChildren;
|
||||
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
@TableField("ICON")
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField("DESCRIPTION")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@TableField("ENABLE")
|
||||
private Integer enable;
|
||||
|
||||
/**
|
||||
* 系统内置项
|
||||
*/
|
||||
@TableField("INTERNAL")
|
||||
private Integer internal;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@TableField("ORDER_INDEX")
|
||||
private Integer orderIndex;
|
||||
|
||||
/**
|
||||
* 过滤内容
|
||||
*/
|
||||
@TableField("FILTER_CONTENT")
|
||||
private String filterContent;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField("RECORD_USER")
|
||||
private String recordUser;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("RECORD_TIME")
|
||||
private Date recordTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@TableField("MODIFY_USER")
|
||||
private String modifyUser;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField("MODIFY_TIME")
|
||||
private Date modifyTime;
|
||||
|
||||
/**
|
||||
* 是否已删除
|
||||
*/
|
||||
@TableField("IS_DELETED")
|
||||
private Integer isDeleted;
|
||||
|
||||
/**
|
||||
* 删除人
|
||||
*/
|
||||
@TableField("DELETE_USER")
|
||||
private String deleteUser;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
@TableField("DELETE_TIME")
|
||||
private Date deleteTime;
|
||||
|
||||
/**
|
||||
* 类型:0-功能区 1-地形 2-图例
|
||||
*/
|
||||
@TableField("TOOL_TYPE")
|
||||
private Integer toolType;
|
||||
|
||||
/**
|
||||
* 归属的系统ID(非数据库字段,来自MS_MAPMODULE_B关联)
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String systemId;
|
||||
|
||||
/**
|
||||
* 是否默认勾选(非数据库字段,来自MS_MAPMODULE_B关联)
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer checked;
|
||||
|
||||
/**
|
||||
* 是否可勾选(非数据库字段,来自MS_MAPMODULE_B关联)
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer canBeChecked;
|
||||
|
||||
/**
|
||||
* 是否多选(非数据库字段,来自MS_MAPMODULE_B关联)
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer multiSelect;
|
||||
|
||||
/** 子级集合(非数据库字段) */
|
||||
@TableField(exist = false)
|
||||
private List<MsMaptoolboxB> children;
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.entity.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地图图层管理封装VO
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "地图图层管理封装VO")
|
||||
public class MapLayerVo {
|
||||
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "父id")
|
||||
private String parentId;
|
||||
|
||||
@Schema(description = "标题名称")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "图层标识")
|
||||
@JsonProperty(value = "key")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "标签层级")
|
||||
@JsonProperty(value = "labelLevel")
|
||||
private Integer labelLevel;
|
||||
|
||||
@Schema(description = "是否可以选择:0=否 1=是")
|
||||
private Integer checkable;
|
||||
|
||||
@Schema(description = "图层分类")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "图层上下层层级关系")
|
||||
@JsonProperty(value = "zIndex")
|
||||
private String zIndex;
|
||||
|
||||
@Schema(description = "各类站点图层对应类型")
|
||||
private String sttpType;
|
||||
|
||||
@Schema(description = "图层展示数据格式")
|
||||
private String layers;
|
||||
|
||||
@Schema(description = "url地址")
|
||||
private String url;
|
||||
|
||||
@Schema(description = "3D url地址")
|
||||
private String urlThd;
|
||||
|
||||
@Schema(description = "图层透明度")
|
||||
private BigDecimal opacity;
|
||||
|
||||
@Schema(description = "子级集合")
|
||||
private List<MapLayerVo> children;
|
||||
|
||||
@Schema(description = "参数json")
|
||||
private String paramJson;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private String orderIndex;
|
||||
|
||||
@Schema(description = "是否默认勾选:0=否 1=是")
|
||||
private Integer checked;
|
||||
|
||||
@Schema(description = "是否可勾选:0=否 1=是")
|
||||
private Integer canBeChecked;
|
||||
|
||||
@Schema(description = "是否多选:0=否 1=是")
|
||||
private Integer multiSelect;
|
||||
@Schema(description = "参数设置:steady=静态 dynamic=动态")
|
||||
private String options;
|
||||
}
|
||||
@ -0,0 +1,97 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.entity.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地图图例VO
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "地图图例VO")
|
||||
public class MapLegendVo {
|
||||
|
||||
@Schema(description = "图例id")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "父级id")
|
||||
private String parentId;
|
||||
|
||||
@Schema(description = "分组名")
|
||||
private String groupName;
|
||||
|
||||
@Schema(description = "层级名称")
|
||||
private String parentName;
|
||||
|
||||
@Schema(description = "图例名")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "图例code")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "图例icon")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "图例英文(对应描点数据中的状态)")
|
||||
private String nameEn;
|
||||
|
||||
@Schema(description = "图层code")
|
||||
private String layerCode;
|
||||
|
||||
@Schema(description = "是否多选;0=否;1=是")
|
||||
private Integer multiSelect;
|
||||
|
||||
@Schema(description = "是否默认勾选;0=否;1=是")
|
||||
private Integer checked;
|
||||
|
||||
@Schema(description = "是否可勾选;0=否;1=是")
|
||||
private Integer canBeChecked;
|
||||
|
||||
@Schema(description = "子排序")
|
||||
private Integer orderIndex;
|
||||
|
||||
@Schema(description = "父排序")
|
||||
private Integer pSort;
|
||||
|
||||
@Schema(description = "最小缩放等级")
|
||||
private Integer minZoom;
|
||||
|
||||
@Schema(description = "最大缩放等级")
|
||||
private Integer maxZoom;
|
||||
|
||||
@Schema(description = "最小高程-三维")
|
||||
private BigDecimal minHeightThd;
|
||||
|
||||
@Schema(description = "最大高程-三维")
|
||||
private BigDecimal maxHeightThd;
|
||||
|
||||
@Schema(description = "是否显示;0=否;1=是")
|
||||
private Integer ifShow;
|
||||
|
||||
@Schema(description = "是否过滤;0=否;1=是")
|
||||
private Integer isFilter;
|
||||
|
||||
@JsonProperty(value = "color")
|
||||
@Schema(description = "图例颜色")
|
||||
private String color;
|
||||
|
||||
@JsonProperty(value = "shape")
|
||||
@Schema(description = "图例形状")
|
||||
private String shape;
|
||||
|
||||
@JsonProperty(value = "minVal")
|
||||
@Schema(description = "区间最小值")
|
||||
private BigDecimal minVal;
|
||||
|
||||
@JsonProperty(value = "maxVal")
|
||||
@Schema(description = "区间最大值")
|
||||
private BigDecimal maxVal;
|
||||
|
||||
@Schema(description = "子级")
|
||||
private List<MapLegendVo> childrenList;
|
||||
}
|
||||
@ -2,7 +2,14 @@ package com.yfd.platform.qgc_sys.mapLayer.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMapmoduleB;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaptoolboxB;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLayerVo;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLegendVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地图与菜单映射表 Mapper 接口
|
||||
@ -11,4 +18,73 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
*/
|
||||
@Mapper
|
||||
public interface MsMapmoduleBMapper extends BaseMapper<MsMapmoduleB> {
|
||||
|
||||
/**
|
||||
* 查询地图图层树(关联MS_MAPMODULE_B与MS_MAPLAYER_B)
|
||||
*/
|
||||
@Select("<script>"
|
||||
+ "SELECT DISTINCT BML.ID, BML.PARENT_ID AS parentId, BML.TITLE, BML.CODE, BML.LABEL_LEVEL AS labelLevel, "
|
||||
+ "BML.CHECKABLE, BML.TYPE, BML.Z_INDEX AS zIndex, BML.STTP_TYPE AS sttpType, BML.LAYERS, "
|
||||
+ "BML.PARAMJSON AS paramJson, BML.URL, BML.URL_THD AS urlThd, BML.OPACITY, BML.SYSTEM_ID AS systemId, "
|
||||
+ "BML.OPTIONS, BMM.MULTI_SELECT AS multiSelect, BMM.CAN_BE_CHECKED AS canBeChecked, "
|
||||
+ "CASE WHEN BMM.CHECKED IS NULL THEN 0 ELSE BMM.CHECKED END AS checked, BML.ORDER_INDEX "
|
||||
+ "FROM MS_MAPLAYER_B BML LEFT JOIN MS_MAPMODULE_B BMM ON BML.ID = BMM.RES_ID "
|
||||
+ "<if test=\"moduleId != null and moduleId != ''\"> AND BMM.MODULE_ID = #{moduleId}</if>"
|
||||
+ "<if test=\"sid != null and sid != ''\"> AND BMM.SYSTEM_ID = #{sid}</if>"
|
||||
+ "<choose>"
|
||||
+ "<when test=\"templateId != null and templateId != ''\"> AND BMM.TEMPLATE_ID = #{templateId}</when>"
|
||||
+ "<otherwise> AND (BMM.TEMPLATE_ID IS NULL OR BMM.TEMPLATE_ID = '00000000-0000-0000-0000-000000000000')</otherwise>"
|
||||
+ "</choose>"
|
||||
+ "WHERE BML.ENABLE = 1 AND (BML.TYPE NOT IN ('YXDT','DXDT','SLDT') OR BML.TYPE IS NULL) "
|
||||
+ "ORDER BY BML.ORDER_INDEX"
|
||||
+ "</script>")
|
||||
List<MapLayerVo> getMapLayerTree(@Param("moduleId") String moduleId, @Param("sid") String sid,
|
||||
@Param("templateId") String templateId);
|
||||
|
||||
/**
|
||||
* 查询地图工具箱(关联MS_MAPMODULE_B与MS_MAPTOOLBOX_B)
|
||||
*/
|
||||
@Select("<script>"
|
||||
+ "SELECT DISTINCT MTB.ID, MTB.NAME, MTB.NAME_EN AS nameEn, MTB.MAP_MODEL AS mapModel, "
|
||||
+ "MTB.FULL_PATH AS fullPath, MTB.TREE_LEVEL AS treeLevel, MTB.HAS_CHILDREN AS hasChildren, "
|
||||
+ "MTB.PATENT_ID AS patentId, MTB.ICON, MTB.DESCRIPTION, MTB.ENABLE, MTB.INTERNAL, "
|
||||
+ "MTB.ORDER_INDEX AS orderIndex, MTB.RECORD_USER AS recordUser, MTB.RECORD_TIME AS recordTime, "
|
||||
+ "MTB.IS_DELETED AS isDeleted, MTB.TOOL_TYPE AS toolType, "
|
||||
+ "BMM.MULTI_SELECT AS multiSelect, BMM.CAN_BE_CHECKED AS canBeChecked, "
|
||||
+ "CASE WHEN BMM.CHECKED IS NULL AND MTB.NAME_EN NOT IN ('left','right','bottom') THEN 0 ELSE BMM.CHECKED END AS checked, "
|
||||
+ "BMM.SYSTEM_ID AS systemId, MTB.ORDER_INDEX "
|
||||
+ "FROM MS_MAPTOOLBOX_B MTB LEFT JOIN MS_MAPMODULE_B BMM ON MTB.ID = BMM.RES_ID "
|
||||
+ "<if test=\"moduleId != null and moduleId != ''\"> AND BMM.MODULE_ID = #{moduleId}</if>"
|
||||
+ "<if test=\"sid != null and sid != ''\"> AND BMM.SYSTEM_ID = #{sid}</if>"
|
||||
+ "<choose>"
|
||||
+ "<when test=\"templateId != null and templateId != ''\"> AND BMM.TEMPLATE_ID = #{templateId}</when>"
|
||||
+ "<otherwise> AND (BMM.TEMPLATE_ID IS NULL OR BMM.TEMPLATE_ID = '00000000-0000-0000-0000-000000000000')</otherwise>"
|
||||
+ "</choose>"
|
||||
+ "WHERE MTB.ENABLE = 1 ORDER BY MTB.ORDER_INDEX"
|
||||
+ "</script>")
|
||||
List<MsMaptoolboxB> getMapToolBox(@Param("moduleId") String moduleId, @Param("sid") String sid,
|
||||
@Param("templateId") String templateId);
|
||||
|
||||
/**
|
||||
* 查询模块关联的图例列表(关联MS_MAPMODULE_B与MS_MAPLEGEND_B)
|
||||
*/
|
||||
@Select("<script>"
|
||||
+ "SELECT DISTINCT BML.PARENT_NAME AS parentName, BML.GROUP_NAME AS groupName, BML.NAME, BML.CODE, "
|
||||
+ "BML.ICON, BML.NAME_EN AS nameEn, BMM.MULTI_SELECT AS multiSelect, BMM.CHECKED AS checked, "
|
||||
+ "BMM.CAN_BE_CHECKED AS canBeChecked, BML.ORDER_INDEX, BMM.ORDER_INDEX AS pSort, "
|
||||
+ "BML.LAYER_CODE AS layerCode, BML.MIN_ZOOM AS minZoom, BML.MAX_ZOOM AS maxZoom, "
|
||||
+ "BML.MIN_HEIGHT_THD AS minHeightThd, BML.MAX_HEIGHT_THD AS maxHeightThd, "
|
||||
+ "BMM.ORDER_INDEX, BML.ORDER_INDEX "
|
||||
+ "FROM MS_MAPLEGEND_B BML LEFT JOIN MS_MAPMODULE_B BMM ON BML.ID = BMM.RES_ID AND BMM.IS_DELETED = 0 "
|
||||
+ "WHERE BMM.RES_TYPE = 'legend' AND BML.ENABLE = 1 AND BML.IS_DELETED = 0 "
|
||||
+ "<if test=\"moduleId != null and moduleId != ''\"> AND BMM.MODULE_ID = #{moduleId}</if>"
|
||||
+ "<if test=\"sid != null and sid != ''\"> AND BMM.SYSTEM_ID = #{sid}</if>"
|
||||
+ "<choose>"
|
||||
+ "<when test=\"templateId != null and templateId != ''\"> AND BMM.TEMPLATE_ID = #{templateId}</when>"
|
||||
+ "<otherwise> AND (BMM.TEMPLATE_ID IS NULL OR BMM.TEMPLATE_ID = '00000000-0000-0000-0000-000000000000')</otherwise>"
|
||||
+ "</choose>"
|
||||
+ "ORDER BY BMM.ORDER_INDEX, BML.ORDER_INDEX"
|
||||
+ "</script>")
|
||||
List<MapLegendVo> getModuleMapLegendList(@Param("moduleId") String moduleId, @Param("sid") String sid,
|
||||
@Param("templateId") String templateId);
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaptoolboxB;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 地图工具箱表 Mapper 接口
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
@Mapper
|
||||
public interface MsMaptoolboxBMapper extends BaseMapper<MsMaptoolboxB> {
|
||||
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.yfd.platform.qgc_sys.mapLayer.service;
|
||||
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaplayerB;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLayerAo;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLayerVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -19,4 +20,15 @@ public interface IMapLayerBizService {
|
||||
* @return 图层树列表
|
||||
*/
|
||||
List<MsMaplayerB> getMapLayerTree(MapLayerAo flag);
|
||||
|
||||
/**
|
||||
* 根据模块ID、系统ID、模板ID获取地图图层树(关联MS_MAPMODULE_B)
|
||||
*
|
||||
* @param moduleId 模块ID
|
||||
* @param systemId 系统ID
|
||||
* @param templateId 模板ID
|
||||
* @return 图层树列表
|
||||
*/
|
||||
List<MapLayerVo> getMapLayerTree(String moduleId, String systemId, String templateId);
|
||||
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.service;
|
||||
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLegendVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地图图例业务服务接口
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
public interface IMapLegendBizService {
|
||||
|
||||
/**
|
||||
* 获取地图图例树(下拉选)
|
||||
*
|
||||
* @param flag 数据类型过滤:null=全部, 1=结构, 2=数据
|
||||
* @return 图例树
|
||||
*/
|
||||
List<MapLegendVo> getMapLegendTree(Integer flag);
|
||||
|
||||
|
||||
/**
|
||||
* 根据模块ID、系统ID、模板ID获取模块关联的图例列表
|
||||
*
|
||||
* @param moduleId 模块ID
|
||||
* @param systemId 系统ID
|
||||
* @param templateId 模板ID
|
||||
* @return 图例列表
|
||||
*/
|
||||
List<MapLegendVo> getModuleMapLegendList(String moduleId, String systemId, String templateId);
|
||||
|
||||
}
|
||||
@ -4,7 +4,9 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaplayerB;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLayerAo;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLayerVo;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.mapper.MsMaplayerBMapper;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.mapper.MsMapmoduleBMapper;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.service.IMapLayerBizService;
|
||||
import com.yfd.platform.system.domain.SysDictionary;
|
||||
import com.yfd.platform.system.domain.SysDictionaryItems;
|
||||
@ -38,6 +40,9 @@ public class MapLayerBizServiceImpl implements IMapLayerBizService {
|
||||
@Resource
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
@Resource
|
||||
private MsMapmoduleBMapper msMapmoduleBMapper;
|
||||
|
||||
@Override
|
||||
public List<MsMaplayerB> getMapLayerTree(MapLayerAo flag) {
|
||||
// 1. 查询字典 "DTZJLX" 获取需要排除的图层类型
|
||||
@ -159,6 +164,50 @@ public class MapLayerBizServiceImpl implements IMapLayerBizService {
|
||||
if (children != null && !children.isEmpty()) {
|
||||
parent.setChildren(children);
|
||||
convertTree(children, childrenMap);
|
||||
}else {
|
||||
// 当没有子节点时,显式设置为空列表,保证 JSON 输出为 [] 而不是 null
|
||||
parent.setChildren(new ArrayList<>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapLayerVo> getMapLayerTree(String moduleId, String systemId, String templateId) {
|
||||
// 通过 JOIN 查询 MS_MAPLAYER_B 和 MS_MAPMODULE_B
|
||||
List<MapLayerVo> allLayers = msMapmoduleBMapper.getMapLayerTree(moduleId, systemId, templateId);
|
||||
|
||||
if (allLayers == null || allLayers.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
// 取第一级
|
||||
List<MapLayerVo> parents = allLayers.stream()
|
||||
.filter(p -> StrUtil.isBlank(p.getParentId()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 通过父级id分组子节点
|
||||
Map<String, List<MapLayerVo>> childrenMap = allLayers.stream()
|
||||
.filter(p -> StrUtil.isNotBlank(p.getParentId()))
|
||||
.collect(Collectors.groupingBy(MapLayerVo::getParentId));
|
||||
|
||||
// 递归构建树
|
||||
convertLayerVoTree(parents, childrenMap);
|
||||
return parents;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归转换图层VO为树结构
|
||||
*/
|
||||
private void convertLayerVoTree(List<MapLayerVo> parents, Map<String, List<MapLayerVo>> childrenMap) {
|
||||
if (parents == null || parents.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (MapLayerVo parent : parents) {
|
||||
String id = parent.getId();
|
||||
List<MapLayerVo> children = childrenMap.get(id);
|
||||
if (children != null && !children.isEmpty()) {
|
||||
parent.setChildren(children);
|
||||
convertLayerVoTree(children, childrenMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,145 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaplegendB;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLegendVo;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.mapper.MsMapmoduleBMapper;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.service.IMapLegendBizService;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.service.IMapLegendService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 地图图例业务服务实现类
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
@Service
|
||||
public class MapLegendBizServiceImpl implements IMapLegendBizService {
|
||||
|
||||
@Resource
|
||||
private IMapLegendService legendService;
|
||||
@Resource
|
||||
private MsMapmoduleBMapper msMapmoduleBMapper;
|
||||
/**
|
||||
* 数据类型枚举:1=结构
|
||||
*/
|
||||
private static final int DATA_TYPE_STRUCT = 1;
|
||||
/**
|
||||
* 数据类型枚举:2=数据
|
||||
*/
|
||||
private static final int DATA_TYPE_DATA = 2;
|
||||
|
||||
@Override
|
||||
public List<MapLegendVo> getMapLegendTree(Integer flag) {
|
||||
// 查询所有数据
|
||||
LambdaQueryWrapper<MsMaplegendB> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(MsMaplegendB::getIsDeleted, 0);
|
||||
if (flag != null) {
|
||||
if (flag == DATA_TYPE_STRUCT) {
|
||||
wrapper.eq(MsMaplegendB::getDataType, DATA_TYPE_STRUCT);
|
||||
} else if (flag == DATA_TYPE_DATA) {
|
||||
wrapper.eq(MsMaplegendB::getDataType, DATA_TYPE_DATA);
|
||||
}
|
||||
}
|
||||
List<MsMaplegendB> legendList = legendService.list(wrapper);
|
||||
|
||||
// 转换为VO
|
||||
List<MapLegendVo> list = new ArrayList<>();
|
||||
for (MsMaplegendB legend : legendList) {
|
||||
MapLegendVo vo = new MapLegendVo();
|
||||
BeanUtil.copyProperties(legend, vo);
|
||||
list.add(vo);
|
||||
}
|
||||
|
||||
// 取第一级
|
||||
List<MapLegendVo> parents = list.stream()
|
||||
.filter(p -> StringUtils.isBlank(p.getParentId()))
|
||||
.sorted(Comparator.comparing(MapLegendVo::getOrderIndex, Comparator.nullsLast(Integer::compareTo)))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 通过父级id分组
|
||||
Map<String, List<MapLegendVo>> mapList = list.stream()
|
||||
.filter(p -> StringUtils.isNotBlank(p.getParentId()))
|
||||
.collect(Collectors.groupingBy(MapLegendVo::getParentId));
|
||||
|
||||
// 递归转换数据为树结构
|
||||
convertTree(parents, mapList);
|
||||
return parents;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归转换树结构
|
||||
*/
|
||||
private void convertTree(List<MapLegendVo> parents, Map<String, List<MapLegendVo>> subList) {
|
||||
if (parents == null || parents.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (MapLegendVo p : parents) {
|
||||
String id = p.getId();
|
||||
for (Map.Entry<String, List<MapLegendVo>> entry : subList.entrySet()) {
|
||||
String pid = entry.getKey();
|
||||
List<MapLegendVo> children = entry.getValue();
|
||||
if (id.equals(pid)) {
|
||||
p.setChildrenList(children);
|
||||
convertTree(children, subList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<MapLegendVo> getModuleMapLegendList(String moduleId, String systemId, String templateId) {
|
||||
List<MapLegendVo> list = new ArrayList<>();
|
||||
// 通过 JOIN 查询 MS_MAPLEGEND_B 和 MS_MAPMODULE_B
|
||||
List<MapLegendVo> bbiMapLegendList = msMapmoduleBMapper.getModuleMapLegendList(moduleId, systemId, templateId);
|
||||
|
||||
if (bbiMapLegendList == null || bbiMapLegendList.isEmpty()) {
|
||||
return list;
|
||||
}
|
||||
|
||||
// 按父级分组
|
||||
Map<String, List<MapLegendVo>> collect = bbiMapLegendList.stream()
|
||||
.collect(Collectors.groupingBy(MapLegendVo::getParentName));
|
||||
|
||||
// 遍历
|
||||
collect.forEach((str, mapLegendVoList) -> {
|
||||
MapLegendVo mapLegendVo = new MapLegendVo();
|
||||
mapLegendVo.setName(str);
|
||||
mapLegendVo.setPSort(mapLegendVoList.get(0).getPSort());
|
||||
// 按子级分组名分组
|
||||
Map<String, List<MapLegendVo>> collect1 = mapLegendVoList.stream()
|
||||
.collect(Collectors.groupingBy(MapLegendVo::getGroupName));
|
||||
List<MapLegendVo> childrenList = new ArrayList<>();
|
||||
for (String groupNameStr : collect1.keySet()) {
|
||||
List<MapLegendVo> list1 = collect1.get(groupNameStr);
|
||||
// 如果子级和父级名称相同,则不用子级
|
||||
if (groupNameStr.equalsIgnoreCase(str)) {
|
||||
childrenList = list1;
|
||||
} else {
|
||||
MapLegendVo mapLegendVoChild = new MapLegendVo();
|
||||
mapLegendVoChild.setName(groupNameStr);
|
||||
if (null != list1 && list1.size() > 0) {
|
||||
mapLegendVoChild.setPSort(list1.get(0).getPSort());
|
||||
}
|
||||
mapLegendVoChild.setChildrenList(list1);
|
||||
childrenList.add(mapLegendVoChild);
|
||||
}
|
||||
}
|
||||
List<MapLegendVo> collect2 = childrenList.stream()
|
||||
.sorted(Comparator.comparing(MapLegendVo::getPSort, Comparator.nullsLast(Integer::compareTo)))
|
||||
.collect(Collectors.toList());
|
||||
mapLegendVo.setChildrenList(collect2);
|
||||
list.add(mapLegendVo);
|
||||
});
|
||||
return list.stream()
|
||||
.sorted(Comparator.comparing(MapLegendVo::getPSort, Comparator.nullsLast(Integer::compareTo)))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package com.yfd.platform.qgc_sys.mapcfg.controller;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.common.DataSourceRequest;
|
||||
@ -8,13 +9,17 @@ import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.common.exception.BizException;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMapmoduleB;
|
||||
import com.yfd.platform.qgc_sys.mapcfg.service.IMapmoduleBService;
|
||||
import com.yfd.platform.qgc_sys.mapcfg.entity.MapmoduleVo;
|
||||
import com.yfd.platform.system.domain.SysMenu;
|
||||
import com.yfd.platform.system.mapper.SysMenuMapper;
|
||||
import com.yfd.platform.utils.DataSourceRequestUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 地图菜单配置控制层
|
||||
@ -29,6 +34,9 @@ public class MapmoduleBController {
|
||||
@Resource
|
||||
private IMapmoduleBService mapmoduleBService;
|
||||
|
||||
@Resource
|
||||
private SysMenuMapper sysMenuMapper;
|
||||
|
||||
/**
|
||||
* 条件过滤数据列表(Kendo UI 数据源)
|
||||
*/
|
||||
@ -57,9 +65,55 @@ public class MapmoduleBController {
|
||||
dataSourceResult.setData(dataList);
|
||||
dataSourceResult.setTotal(resultPage.getTotal());
|
||||
|
||||
// 翻译字典值(菜单名称)
|
||||
// 翻译字典值(原有逻辑,可能处理其他字段)
|
||||
if (dataList != null && !dataList.isEmpty()) {
|
||||
mapmoduleBService.translateDict(dataList);
|
||||
|
||||
// ----- 新增:填充 moduleName -----
|
||||
// 1. 先收集需要从数据库查询的 moduleId(排除 "tycd")
|
||||
Set<String> needQueryIds = dataList.stream()
|
||||
.map(MsMapmoduleB::getModuleId)
|
||||
.filter(id -> id != null && !"tycd".equals(id)) // 过滤掉 "tycd"
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Map<String, String> menuNameMap = new HashMap<>();
|
||||
if (!needQueryIds.isEmpty()) {
|
||||
// 查询 SYS_MENU 表(假设实体为 SysMenu,Mapper 为 sysMenuMapper)
|
||||
List<SysMenu> menus = sysMenuMapper.selectList(
|
||||
new LambdaQueryWrapper<SysMenu>()
|
||||
.in(SysMenu::getId, needQueryIds) // 注意 id 类型需匹配
|
||||
);
|
||||
menuNameMap = menus.stream()
|
||||
.collect(Collectors.toMap(
|
||||
menu -> String.valueOf(menu.getId()), // 统一转为字符串
|
||||
SysMenu::getName
|
||||
));
|
||||
}
|
||||
|
||||
// 2. 遍历 dataList 设置 moduleName
|
||||
for (MsMapmoduleB entity : dataList) {
|
||||
String moduleId = entity.getModuleId();
|
||||
if (moduleId == null) {
|
||||
entity.setModuleName(null);
|
||||
} else if ("tycd".equals(moduleId)) {
|
||||
// 特殊处理:固定为 "通用菜单"
|
||||
entity.setModuleName("通用菜单");
|
||||
} else {
|
||||
// 从查询结果中获取
|
||||
entity.setModuleName(menuNameMap.get(moduleId));
|
||||
// 如果 menuNameMap 中不存在,则置 null(或保留原值,视业务而定)
|
||||
if (entity.getModuleName() == null) {
|
||||
entity.setModuleName(null); // 或者 entity.setModuleName("");
|
||||
}
|
||||
}
|
||||
}
|
||||
// ========== 2. 处理 systemName 特殊值 ==========
|
||||
for (MsMapmoduleB entity : dataList) {
|
||||
if ("qgc".equals(entity.getSystemId())) {
|
||||
entity.setSystemName("qgc");
|
||||
}
|
||||
// 其他 systemId 保留字典翻译的结果
|
||||
}
|
||||
}
|
||||
|
||||
return ResponseResult.successData(dataSourceResult);
|
||||
@ -98,4 +152,15 @@ public class MapmoduleBController {
|
||||
mapmoduleBService.delelteByIds(ids);
|
||||
return ResponseResult.success("删除成功.");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 地图图层管理数据
|
||||
*/
|
||||
@Operation(summary = "地图图层管理数据")
|
||||
@PostMapping("/getMapData")
|
||||
public ResponseResult getMapData(@RequestBody MsMapmoduleB mapmoduleB) {
|
||||
MapmoduleVo result = mapmoduleBService.getMapData(mapmoduleB);
|
||||
return ResponseResult.successData(result);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package com.yfd.platform.qgc_sys.mapcfg.entity;
|
||||
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaptoolboxB;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLayerVo;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLegendVo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地图与菜单查询返回实体类
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "地图菜单配置实体类")
|
||||
public class MapmoduleVo {
|
||||
|
||||
/** GIS地图多功能区 */
|
||||
@Schema(description = "GIS地图多功能区")
|
||||
private List<MsMaptoolboxB> maptoolbox;
|
||||
|
||||
/** GIS默认数据加载 - 地形 */
|
||||
@Schema(description = "GIS默认数据加载 - 地形")
|
||||
private List<MsMaptoolboxB> terrain;
|
||||
|
||||
/** GIS默认数据加载 - 图例 */
|
||||
@Schema(description = "GIS默认数据加载 - 图例")
|
||||
private List<MsMaptoolboxB> legend;
|
||||
|
||||
/** GIS默认数据加载 - 内容模块 */
|
||||
@Schema(description = "GIS默认数据加载 - 内容模块")
|
||||
private List<MsMaptoolboxB> content;
|
||||
|
||||
/** GIS默认数据加载 - 环保监测 */
|
||||
@Schema(description = "GIS默认数据加载 - 环保监测")
|
||||
private List<MsMaptoolboxB> hbcj;
|
||||
|
||||
/** GIS图层区 */
|
||||
@Schema(description = "GIS图层区")
|
||||
private List<MapLayerVo> mapLayerVos;
|
||||
|
||||
/** 地图图例 */
|
||||
@Schema(description = "地图图例")
|
||||
private List<MapLegendVo> mapLegendVos;
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.yfd.platform.qgc_sys.mapcfg.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMapmoduleB;
|
||||
import com.yfd.platform.qgc_sys.mapcfg.entity.MapmoduleVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -33,4 +34,12 @@ public interface IMapmoduleBService extends IService<MsMapmoduleB> {
|
||||
* @param ids ID列表
|
||||
*/
|
||||
void delelteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 获取地图数据(图层树、图例、工具箱)
|
||||
*
|
||||
* @param mapmoduleB 查询参数
|
||||
* @return 地图数据
|
||||
*/
|
||||
MapmoduleVo getMapData(MsMapmoduleB mapmoduleB);
|
||||
}
|
||||
@ -4,8 +4,15 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMapmoduleB;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaptoolboxB;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.mapper.MsMapmoduleBMapper;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.service.IMapLayerBizService;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.service.IMapLegendBizService;
|
||||
import com.yfd.platform.qgc_sys.mapcfg.service.IMapmoduleBService;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLayerVo;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLegendVo;
|
||||
import com.yfd.platform.qgc_sys.mapcfg.entity.MapmoduleVo;
|
||||
|
||||
import com.yfd.platform.system.domain.SysMenu;
|
||||
import com.yfd.platform.system.mapper.SysMenuMapper;
|
||||
import com.yfd.platform.utils.SecurityUtils;
|
||||
@ -29,6 +36,13 @@ public class MapmoduleBServiceImpl extends ServiceImpl<MsMapmoduleBMapper, MsMap
|
||||
@Resource
|
||||
private SysMenuMapper sysMenuMapper;
|
||||
|
||||
@Resource
|
||||
private IMapLayerBizService mapLayerBizService;
|
||||
|
||||
@Resource
|
||||
private IMapLegendBizService mapLegendBizService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean saveOrUpdate(MsMapmoduleB entity) {
|
||||
@ -89,4 +103,81 @@ public class MapmoduleBServiceImpl extends ServiceImpl<MsMapmoduleBMapper, MsMap
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MapmoduleVo getMapData(MsMapmoduleB mapmoduleB) {
|
||||
// 模板ID:暂时不使用MS_TEMPLATE_B表,直接取传入的templateId
|
||||
String templateId = mapmoduleB.getTemplateId();
|
||||
|
||||
// ========== 以下代码预留:后续启用MS_TEMPLATE_B表时使用 ==========
|
||||
// String templateId = null;
|
||||
// // getDescription用于区分是在模块页面中还是在系统配置中调用该接口
|
||||
// if (StrUtil.isBlank(mapmoduleB.getTemplateId()) && StrUtil.isNotBlank(mapmoduleB.getDescription())) {
|
||||
// // 如果用户没有该模块的模板权限,但该模块有指定默认模板,则返回默认模板数据。
|
||||
// LambdaQueryWrapper<MsTemplateB> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// lambdaQueryWrapper.eq(MsTemplateB::getIsDefault, 1);
|
||||
// lambdaQueryWrapper.eq(MsTemplateB::getIsDeleted, 0);
|
||||
// lambdaQueryWrapper.eq(MsTemplateB::getModuleId, mapmoduleB.getModuleId());
|
||||
// MsTemplateB msTemplateB = msTemplateBMapper.selectOne(lambdaQueryWrapper);
|
||||
// if (msTemplateB != null) {
|
||||
// templateId = msTemplateB.getId();
|
||||
// }
|
||||
// } else {
|
||||
// templateId = mapmoduleB.getTemplateId();
|
||||
// }
|
||||
// ========== 预留代码结束 ==========
|
||||
|
||||
MapmoduleVo mapmoduleVo = new MapmoduleVo();
|
||||
|
||||
// 1. GIS图层区
|
||||
List<MapLayerVo> layer = mapLayerBizService.getMapLayerTree(
|
||||
mapmoduleB.getModuleId(), mapmoduleB.getSystemId(), templateId);
|
||||
mapmoduleVo.setMapLayerVos(layer);
|
||||
|
||||
// 2. 地图图例
|
||||
List<MapLegendVo> legend = mapLegendBizService.getModuleMapLegendList(
|
||||
mapmoduleB.getModuleId(), mapmoduleB.getSystemId(), templateId);
|
||||
mapmoduleVo.setMapLegendVos(legend);
|
||||
|
||||
// 3. 地图工具箱
|
||||
List<MsMaptoolboxB> mapToolBox = baseMapper.getMapToolBox(
|
||||
mapmoduleB.getModuleId(), mapmoduleB.getSystemId(), templateId);
|
||||
|
||||
// 按toolType分组
|
||||
Map<Integer, List<MsMaptoolboxB>> groupedByType = mapToolBox.stream()
|
||||
.collect(Collectors.groupingBy(MsMaptoolboxB::getToolType));
|
||||
|
||||
// 图例(toolType=2)
|
||||
mapmoduleVo.setLegend(groupedByType.get(2));
|
||||
|
||||
// 内容模块(toolType=3)
|
||||
List<MsMaptoolboxB> contentLayerTree = getContentLayerTree(groupedByType);
|
||||
mapmoduleVo.setContent(contentLayerTree);
|
||||
|
||||
// 环保监测(toolType=4)
|
||||
mapmoduleVo.setHbcj(groupedByType.get(4));
|
||||
|
||||
return mapmoduleVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取内容模块图层树
|
||||
*/
|
||||
private List<MsMaptoolboxB> getContentLayerTree(Map<Integer, List<MsMaptoolboxB>> groupedByType) {
|
||||
List<MsMaptoolboxB> msMaptoolboxBList = new java.util.ArrayList<>();
|
||||
List<MsMaptoolboxB> contentToolBoxList = groupedByType.get(3);
|
||||
if (contentToolBoxList != null) {
|
||||
for (MsMaptoolboxB msMaptoolboxB : contentToolBoxList) {
|
||||
if (StrUtil.isNotBlank(msMaptoolboxB.getPatentId())) {
|
||||
// 如果内容模块没有进行配置,则默认全部勾选
|
||||
if (msMaptoolboxB.getChecked() == null) {
|
||||
msMaptoolboxB.setChecked(1);
|
||||
}
|
||||
msMaptoolboxBList.add(msMaptoolboxB);
|
||||
}
|
||||
}
|
||||
}
|
||||
return msMaptoolboxBList;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user