From 0fdb456e2cc347a97be6f25d450a7ecbda1d988e Mon Sep 17 00:00:00 2001 From: menghao <1584479611@qq.com> Date: Mon, 9 Mar 2026 14:40:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=88=AA=E7=BA=BF=E9=A2=9C=E8=89=B2=E7=AD=89?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E6=98=BE=E7=A4=BA=E3=80=81=E5=8F=B3=E9=94=AE?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E9=A1=B9=E6=98=BE=E7=A4=BA=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E3=80=81=E6=8E=A7=E5=88=B6=E5=9C=B0=E5=9B=BE=E6=8B=96=E5=8A=A8?= =?UTF-8?q?=E5=B0=8F=E6=89=8B=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/system/domain/RouteWaypoints.java | 65 +++++- .../ruoyi/system/domain/WaypointDisplayStyle.java | 62 ++++++ .../WaypointDisplayStyleTypeHandler.java | 59 +++++ .../mapper/system/RouteWaypointsMapper.xml | 14 +- .../system/route_waypoints_display_style_json.sql | 27 +++ ruoyi-ui/.env.development | 2 +- ruoyi-ui/src/layout/components/TagsView/index.vue | 8 +- ruoyi-ui/src/views/cesiumMap/ContextMenu.vue | 19 +- ruoyi-ui/src/views/cesiumMap/index.vue | 240 +++++++++++++++------ ruoyi-ui/src/views/childRoom/TopHeader.vue | 47 ++++ ruoyi-ui/src/views/childRoom/index.vue | 17 +- ruoyi-ui/src/views/dialogs/RouteEditDialog.vue | 67 +++++- ruoyi-ui/src/views/dialogs/WaypointEditDialog.vue | 104 +++++++-- ruoyi-ui/src/views/selectRoom/index.vue | 15 +- ruoyi-ui/vue.config.js | 2 +- 15 files changed, 618 insertions(+), 130 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/WaypointDisplayStyle.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/typehandler/WaypointDisplayStyleTypeHandler.java create mode 100644 ruoyi-system/src/main/resources/mapper/system/route_waypoints_display_style_json.sql diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/RouteWaypoints.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/RouteWaypoints.java index b2aea1b..eca27b8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/RouteWaypoints.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/RouteWaypoints.java @@ -1,6 +1,7 @@ package com.ruoyi.system.domain; import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonIgnore; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; @@ -63,11 +64,8 @@ public class RouteWaypoints extends BaseEntity @Excel(name = "盘旋参数") private String holdParams; - /** 航点标签文字大小(px),用于地图显示 */ - private Integer labelFontSize; - - /** 航点标签文字颜色(如 #333333),用于地图显示 */ - private String labelColor; + /** 航点显示样式 JSON:字号、文字颜色、标记大小与颜色等,对应表 display_style 列 */ + private WaypointDisplayStyle displayStyle; public void setId(Long id) { @@ -185,20 +183,66 @@ public class RouteWaypoints extends BaseEntity return holdParams; } + @JsonIgnore + public WaypointDisplayStyle getDisplayStyle() { + return displayStyle; + } + + @JsonIgnore + public void setDisplayStyle(WaypointDisplayStyle displayStyle) { + this.displayStyle = displayStyle; + } + + private WaypointDisplayStyle getOrCreateDisplayStyle() { + if (displayStyle == null) { + displayStyle = new WaypointDisplayStyle(); + } + return displayStyle; + } + + /** API/前端:地图上航点名称字号,默认 16 */ public void setLabelFontSize(Integer labelFontSize) { - this.labelFontSize = labelFontSize; + getOrCreateDisplayStyle().setLabelFontSize(labelFontSize); } public Integer getLabelFontSize() { - return labelFontSize; + return displayStyle != null && displayStyle.getLabelFontSize() != null ? displayStyle.getLabelFontSize() : 16; } + /** API/前端:地图上航点名称颜色,默认 #000000 */ public void setLabelColor(String labelColor) { - this.labelColor = labelColor; + getOrCreateDisplayStyle().setLabelColor(labelColor); } public String getLabelColor() { - return labelColor; + return displayStyle != null && displayStyle.getLabelColor() != null ? displayStyle.getLabelColor() : "#000000"; + } + + /** API/前端:航点圆点填充色,默认 #ffffff */ + public void setColor(String color) { + getOrCreateDisplayStyle().setColor(color); + } + + public String getColor() { + return displayStyle != null && displayStyle.getColor() != null ? displayStyle.getColor() : "#ffffff"; + } + + /** API/前端:航点圆点直径(像素),默认 12 */ + public void setPixelSize(Integer pixelSize) { + getOrCreateDisplayStyle().setPixelSize(pixelSize); + } + + public Integer getPixelSize() { + return displayStyle != null && displayStyle.getPixelSize() != null ? displayStyle.getPixelSize() : 12; + } + + /** API/前端:航点圆点边框颜色,默认 #000000 */ + public void setOutlineColor(String outlineColor) { + getOrCreateDisplayStyle().setOutlineColor(outlineColor); + } + + public String getOutlineColor() { + return displayStyle != null && displayStyle.getOutlineColor() != null ? displayStyle.getOutlineColor() : "#000000"; } @Override @@ -216,8 +260,7 @@ public class RouteWaypoints extends BaseEntity .append("turnAngle", getTurnAngle()) .append("pointType", getPointType()) .append("holdParams", getHoldParams()) - .append("labelFontSize", getLabelFontSize()) - .append("labelColor", getLabelColor()) + .append("displayStyle", displayStyle) .toString(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/WaypointDisplayStyle.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/WaypointDisplayStyle.java new file mode 100644 index 0000000..7371896 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/WaypointDisplayStyle.java @@ -0,0 +1,62 @@ +package com.ruoyi.system.domain; + +import java.io.Serializable; + +/** + * 航点显示样式(地图上名称字号/颜色、标记大小/颜色),对应表字段 display_style 的 JSON 结构。 + */ +public class WaypointDisplayStyle implements Serializable { + + private static final long serialVersionUID = 1L; + + /** 航点名称在地图上的字号,默认 16 */ + private Integer labelFontSize; + /** 航点名称在地图上的颜色,默认 #000000 */ + private String labelColor; + /** 航点圆点填充色,默认 #ffffff */ + private String color; + /** 航点圆点直径(像素),默认 12 */ + private Integer pixelSize; + /** 航点圆点边框颜色,默认 #000000 */ + private String outlineColor; + + public Integer getLabelFontSize() { + return labelFontSize; + } + + public void setLabelFontSize(Integer labelFontSize) { + this.labelFontSize = labelFontSize; + } + + public String getLabelColor() { + return labelColor; + } + + public void setLabelColor(String labelColor) { + this.labelColor = labelColor; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + public Integer getPixelSize() { + return pixelSize; + } + + public void setPixelSize(Integer pixelSize) { + this.pixelSize = pixelSize; + } + + public String getOutlineColor() { + return outlineColor; + } + + public void setOutlineColor(String outlineColor) { + this.outlineColor = outlineColor; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/typehandler/WaypointDisplayStyleTypeHandler.java b/ruoyi-system/src/main/java/com/ruoyi/system/typehandler/WaypointDisplayStyleTypeHandler.java new file mode 100644 index 0000000..616f150 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/typehandler/WaypointDisplayStyleTypeHandler.java @@ -0,0 +1,59 @@ +package com.ruoyi.system.typehandler; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ruoyi.system.domain.WaypointDisplayStyle; +import org.apache.ibatis.type.BaseTypeHandler; +import org.apache.ibatis.type.JdbcType; +import org.apache.ibatis.type.MappedTypes; + +import java.sql.CallableStatement; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +/** + * MyBatis 类型处理器:display_style 列(TEXT/JSON)与 WaypointDisplayStyle 互转。 + */ +@MappedTypes(WaypointDisplayStyle.class) +public class WaypointDisplayStyleTypeHandler extends BaseTypeHandler { + + private static final ObjectMapper MAPPER = new ObjectMapper(); + + @Override + public void setNonNullParameter(PreparedStatement ps, int i, WaypointDisplayStyle parameter, JdbcType jdbcType) throws SQLException { + try { + ps.setString(i, MAPPER.writeValueAsString(parameter)); + } catch (Exception e) { + throw new SQLException("WaypointDisplayStyle serialize error", e); + } + } + + @Override + public WaypointDisplayStyle getNullableResult(ResultSet rs, String columnName) throws SQLException { + String json = rs.getString(columnName); + return parse(json); + } + + @Override + public WaypointDisplayStyle getNullableResult(ResultSet rs, int columnIndex) throws SQLException { + String json = rs.getString(columnIndex); + return parse(json); + } + + @Override + public WaypointDisplayStyle getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { + String json = cs.getString(columnIndex); + return parse(json); + } + + private static WaypointDisplayStyle parse(String json) { + if (json == null || json.trim().isEmpty()) { + return null; + } + try { + return MAPPER.readValue(json, WaypointDisplayStyle.class); + } catch (Exception e) { + return null; + } + } +} diff --git a/ruoyi-system/src/main/resources/mapper/system/RouteWaypointsMapper.xml b/ruoyi-system/src/main/resources/mapper/system/RouteWaypointsMapper.xml index 7971efc..707b059 100644 --- a/ruoyi-system/src/main/resources/mapper/system/RouteWaypointsMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/RouteWaypointsMapper.xml @@ -17,12 +17,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - + - select id, route_id, name, seq, lat, lng, alt, speed, start_time, turn_angle, point_type, hold_params, label_font_size, label_color from route_waypoints + select id, route_id, name, seq, lat, lng, alt, speed, start_time, turn_angle, point_type, hold_params, display_style from route_waypoints