Compare commits

...

6 Commits
test ... main

Author SHA1 Message Date
gyb 993967bd6d feat:去除空域的userid字段 2026-03-26 10:09:38 +08:00
gyb cec154a8b2 feat:修改分组查询标注 2026-03-25 15:51:40 +08:00
gyb b6777f4776 feat:新增标注返回groupid,标注属性保存 2026-03-24 08:40:14 +08:00
gyb 3b89fd90dd feat:新增标注返回groupid,标注属性保存 2026-03-24 08:29:31 +08:00
gyb ca475c5fb1 feat:新增标注返回groupid 2026-03-23 18:55:56 +08:00
gyb 3fcf45a6fb feat:新增标注返回groupid 2026-03-23 18:34:37 +08:00
10 changed files with 67 additions and 166 deletions

View File

@ -45,7 +45,11 @@ public class AirlineMarkerController extends BaseController {
marker.setCreateBy(SecurityUtils.getUserId().toString()); marker.setCreateBy(SecurityUtils.getUserId().toString());
marker.setUpdateBy(SecurityUtils.getUserId().toString()); marker.setUpdateBy(SecurityUtils.getUserId().toString());
AirlineMarkerDTO dto = AirlineMarkerControllerConvert.to(marker); AirlineMarkerDTO dto = AirlineMarkerControllerConvert.to(marker);
return toAjax(iAirlineMarkerGroupInfoService.insertMarker(dto)); AirlineMarkerDTO result = iAirlineMarkerGroupInfoService.insertMarker(dto);
if (result != null) {
return success(result);
}
return error("新增标注失败");
} }
/** /**

View File

@ -1,13 +1,12 @@
package com.ruoyi.airline.controller.convert; package com.ruoyi.airline.controller.convert;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.airline.api.domain.AirlineMarkerVO; import com.ruoyi.airline.api.domain.AirlineMarkerVO;
import com.ruoyi.airline.service.dto.AirlineMarkerDTO; import com.ruoyi.airline.service.dto.AirlineMarkerDTO;
import com.ruoyi.common.core.utils.BaseConvert; import com.ruoyi.common.core.utils.BaseConvert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 标注Controller转换类 * 标注Controller转换类
@ -17,8 +16,7 @@ import java.util.stream.Collectors;
*/ */
public class AirlineMarkerControllerConvert extends BaseConvert<AirlineMarkerDTO, AirlineMarkerVO> public class AirlineMarkerControllerConvert extends BaseConvert<AirlineMarkerDTO, AirlineMarkerVO>
{ {
private static final Logger log = LoggerFactory.getLogger(AirlineMarkerControllerConvert.class); private static final ObjectMapper objectMapper = new ObjectMapper();
private static final AirlineMarkerControllerConvert INSTANCE = new AirlineMarkerControllerConvert(); private static final AirlineMarkerControllerConvert INSTANCE = new AirlineMarkerControllerConvert();
private AirlineMarkerControllerConvert() { private AirlineMarkerControllerConvert() {
@ -54,20 +52,7 @@ public class AirlineMarkerControllerConvert extends BaseConvert<AirlineMarkerDTO
vo.setColor(dto.getColor()); vo.setColor(dto.getColor());
vo.setIcon(dto.getIcon()); vo.setIcon(dto.getIcon());
vo.setFontSize(dto.getFontSize()); vo.setFontSize(dto.getFontSize());
vo.setCoordinates(dto.getCoordinates());
// 转换coordinates
if (dto.getCoordinates() != null) {
vo.setCoordinates(dto.getCoordinates().stream()
.map(point -> {
AirlineMarkerVO.PointInfo voPoint = new AirlineMarkerVO.PointInfo();
voPoint.setLatitude(point.getLatitude());
voPoint.setLongitude(point.getLongitude());
voPoint.setAsl(point.getAsl());
return voPoint;
})
.collect(Collectors.toList()));
}
vo.setDescription(dto.getDescription()); vo.setDescription(dto.getDescription());
vo.setGroupId(dto.getGroupId()); vo.setGroupId(dto.getGroupId());
vo.setCreateBy(dto.getCreateBy()); vo.setCreateBy(dto.getCreateBy());
@ -91,17 +76,12 @@ public class AirlineMarkerControllerConvert extends BaseConvert<AirlineMarkerDTO
dto.setIcon(vo.getIcon()); dto.setIcon(vo.getIcon());
dto.setFontSize(vo.getFontSize()); dto.setFontSize(vo.getFontSize());
// 转换coordinates
if (vo.getCoordinates() != null) { if (vo.getCoordinates() != null) {
dto.setCoordinates(vo.getCoordinates().stream() try {
.map(point -> { dto.setCoordinates(objectMapper.writeValueAsString(vo.getCoordinates()));
AirlineMarkerDTO.PointInfo dtoPoint = new AirlineMarkerDTO.PointInfo(); } catch (JsonProcessingException e) {
dtoPoint.setLatitude(point.getLatitude()); dto.setCoordinates(null);
dtoPoint.setLongitude(point.getLongitude()); }
dtoPoint.setAsl(point.getAsl());
return dtoPoint;
})
.collect(Collectors.toList()));
} }
dto.setDescription(vo.getDescription()); dto.setDescription(vo.getDescription());

View File

@ -1,7 +1,5 @@
package com.ruoyi.airline.domain.convert; package com.ruoyi.airline.domain.convert;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.common.core.utils.BaseConvert; import com.ruoyi.common.core.utils.BaseConvert;
import com.ruoyi.airline.domain.model.AirlineMarker; import com.ruoyi.airline.domain.model.AirlineMarker;
import com.ruoyi.airline.mapper.entity.AirlineMarkerEntity; import com.ruoyi.airline.mapper.entity.AirlineMarkerEntity;
@ -17,7 +15,6 @@ import java.util.List;
public class AirlineMarkerDomainConvert extends BaseConvert<AirlineMarkerEntity, AirlineMarker> public class AirlineMarkerDomainConvert extends BaseConvert<AirlineMarkerEntity, AirlineMarker>
{ {
private static final AirlineMarkerDomainConvert INSTANCE = new AirlineMarkerDomainConvert(); private static final AirlineMarkerDomainConvert INSTANCE = new AirlineMarkerDomainConvert();
private static final ObjectMapper objectMapper = new ObjectMapper();
private AirlineMarkerDomainConvert() { private AirlineMarkerDomainConvert() {
super(AirlineMarkerEntity.class, AirlineMarker.class); super(AirlineMarkerEntity.class, AirlineMarker.class);
@ -52,16 +49,7 @@ public class AirlineMarkerDomainConvert extends BaseConvert<AirlineMarkerEntity,
model.setColor(entity.getColor()); model.setColor(entity.getColor());
model.setIcon(entity.getIcon()); model.setIcon(entity.getIcon());
model.setFontSize(entity.getFontSize()); model.setFontSize(entity.getFontSize());
model.setCoordinates(entity.getCoordinates());
// 从JSON字符串转换为List<PointInfo>
if (entity.getCoordinates() != null) {
try {
model.setCoordinates(objectMapper.readValue(entity.getCoordinates(), objectMapper.getTypeFactory().constructCollectionType(List.class, AirlineMarker.PointInfo.class)));
} catch (JsonProcessingException e) {
e.printStackTrace();
}
}
model.setDescription(entity.getDescription()); model.setDescription(entity.getDescription());
model.setCreateBy(entity.getCreateBy()); model.setCreateBy(entity.getCreateBy());
model.setCreateTime(entity.getCreateTime()); model.setCreateTime(entity.getCreateTime());
@ -84,16 +72,7 @@ public class AirlineMarkerDomainConvert extends BaseConvert<AirlineMarkerEntity,
entity.setColor(model.getColor()); entity.setColor(model.getColor());
entity.setIcon(model.getIcon()); entity.setIcon(model.getIcon());
entity.setFontSize(model.getFontSize()); entity.setFontSize(model.getFontSize());
entity.setCoordinates(model.getCoordinates());
// 从List<PointInfo>转换为JSON字符串
if (model.getCoordinates() != null) {
try {
entity.setCoordinates(objectMapper.writeValueAsString(model.getCoordinates()));
} catch (JsonProcessingException e) {
e.printStackTrace();
}
}
entity.setDescription(model.getDescription()); entity.setDescription(model.getDescription());
entity.setCreateBy(model.getCreateBy()); entity.setCreateBy(model.getCreateBy());
entity.setCreateTime(model.getCreateTime()); entity.setCreateTime(model.getCreateTime());

View File

@ -6,8 +6,6 @@ import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.List;
/** /**
* 标注 * 标注
* *
@ -52,9 +50,9 @@ public class AirlineMarker extends ExBaseEntity {
private Integer fontSize; private Integer fontSize;
/** /**
* 经纬度格式[,,asl高度] * 坐标JSON字符串
*/ */
private List<PointInfo> coordinates; private String coordinates;
/** /**
* 简介 * 简介
@ -66,24 +64,6 @@ public class AirlineMarker extends ExBaseEntity {
*/ */
private String remark; private String remark;
@Data
public static class PointInfo {
/**
* 纬度
*/
private Double latitude;
/**
* 经度
*/
private Double longitude;
/**
* 海拔高度
*/
private Double asl;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -12,7 +12,7 @@ import java.util.List;
*/ */
public interface IAirlineMarkerGroupInfoService { public interface IAirlineMarkerGroupInfoService {
int insertMarker(AirlineMarkerDTO dto); AirlineMarkerDTO insertMarker(AirlineMarkerDTO dto);
int deleteMarker(AirlineMarkerDTO dto); int deleteMarker(AirlineMarkerDTO dto);

View File

@ -5,7 +5,6 @@ import com.ruoyi.airline.domain.model.AirlineMarker;
import com.ruoyi.airline.service.dto.AirlineMarkerDTO; import com.ruoyi.airline.service.dto.AirlineMarkerDTO;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 标注Service转换类 * 标注Service转换类
@ -15,7 +14,6 @@ import java.util.stream.Collectors;
*/ */
public class AirlineMarkerServiceConvert extends BaseConvert<AirlineMarker, AirlineMarkerDTO> public class AirlineMarkerServiceConvert extends BaseConvert<AirlineMarker, AirlineMarkerDTO>
{ {
private static final AirlineMarkerServiceConvert INSTANCE = new AirlineMarkerServiceConvert(); private static final AirlineMarkerServiceConvert INSTANCE = new AirlineMarkerServiceConvert();
private AirlineMarkerServiceConvert() { private AirlineMarkerServiceConvert() {
@ -51,20 +49,7 @@ public class AirlineMarkerServiceConvert extends BaseConvert<AirlineMarker, Airl
dto.setColor(model.getColor()); dto.setColor(model.getColor());
dto.setIcon(model.getIcon()); dto.setIcon(model.getIcon());
dto.setFontSize(model.getFontSize()); dto.setFontSize(model.getFontSize());
dto.setCoordinates(model.getCoordinates());
// 转换coordinates
if (model.getCoordinates() != null) {
dto.setCoordinates(model.getCoordinates().stream()
.map(point -> {
AirlineMarkerDTO.PointInfo dtoPoint = new AirlineMarkerDTO.PointInfo();
dtoPoint.setLatitude(point.getLatitude());
dtoPoint.setLongitude(point.getLongitude());
dtoPoint.setAsl(point.getAsl());
return dtoPoint;
})
.collect(Collectors.toList()));
}
dto.setDescription(model.getDescription()); dto.setDescription(model.getDescription());
dto.setCreateBy(model.getCreateBy()); dto.setCreateBy(model.getCreateBy());
dto.setCreateTime(model.getCreateTime()); dto.setCreateTime(model.getCreateTime());
@ -86,20 +71,7 @@ public class AirlineMarkerServiceConvert extends BaseConvert<AirlineMarker, Airl
model.setColor(dto.getColor()); model.setColor(dto.getColor());
model.setIcon(dto.getIcon()); model.setIcon(dto.getIcon());
model.setFontSize(dto.getFontSize()); model.setFontSize(dto.getFontSize());
model.setCoordinates(dto.getCoordinates());
// 转换coordinates
if (dto.getCoordinates() != null) {
model.setCoordinates(dto.getCoordinates().stream()
.map(point -> {
AirlineMarker.PointInfo modelPoint = new AirlineMarker.PointInfo();
modelPoint.setLatitude(point.getLatitude());
modelPoint.setLongitude(point.getLongitude());
modelPoint.setAsl(point.getAsl());
return modelPoint;
})
.collect(Collectors.toList()));
}
model.setDescription(dto.getDescription()); model.setDescription(dto.getDescription());
model.setCreateBy(dto.getCreateBy()); model.setCreateBy(dto.getCreateBy());
model.setCreateTime(dto.getCreateTime()); model.setCreateTime(dto.getCreateTime());

View File

@ -6,8 +6,6 @@ import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.List;
/** /**
* 标注表 airline_marker * 标注表 airline_marker
* *
@ -52,9 +50,9 @@ public class AirlineMarkerDTO extends BaseEntity {
private Integer fontSize; private Integer fontSize;
/** /**
* 经纬度格式[,,asl高度] * 坐标JSON字符串
*/ */
private List<PointInfo> coordinates; private String coordinates;
/** /**
* 简介 * 简介
@ -66,24 +64,6 @@ public class AirlineMarkerDTO extends BaseEntity {
*/ */
private Long groupId; private Long groupId;
@Data
public static class PointInfo {
/**
* 纬度
*/
private Double latitude;
/**
* 经度
*/
private Double longitude;
/**
* 海拔高度
*/
private Double asl;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -35,20 +35,27 @@ public class AirlineMarkerGroupInfoServiceImpl implements IAirlineMarkerGroupInf
@Override @Override
public int insertMarker(AirlineMarkerDTO dto) { public AirlineMarkerDTO insertMarker(AirlineMarkerDTO dto) {
AirlineMarker model = AirlineMarkerServiceConvert.to(dto); AirlineMarker model = AirlineMarkerServiceConvert.to(dto);
int result = iAirlineMarkerDomain.insertMarker(model); int result = iAirlineMarkerDomain.insertMarker(model);
// 处理分组关系 // 处理分组关系
if (result > 0 && dto.getGroupId() != null) { if (result > 0) {
AirlineMarkerGroupInfo groupInfo = new AirlineMarkerGroupInfo(); Long groupId = dto.getGroupId();
groupInfo.setGroupId(dto.getGroupId()); if (groupId != null) {
groupInfo.setMarkerId(model.getId()); AirlineMarkerGroupInfo groupInfo = new AirlineMarkerGroupInfo();
groupInfo.setCreateBy(dto.getCreateBy()); groupInfo.setGroupId(groupId);
groupInfo.setUpdateBy(dto.getUpdateBy()); groupInfo.setMarkerId(model.getId());
iAirlineMarkerGroupInfoDomain.insertMarkerGroupInfo(groupInfo); groupInfo.setCreateBy(dto.getCreateBy());
groupInfo.setUpdateBy(dto.getUpdateBy());
iAirlineMarkerGroupInfoDomain.insertMarkerGroupInfo(groupInfo);
}
// 转换回 DTO 并设置 groupId
AirlineMarkerDTO resultDto = AirlineMarkerServiceConvert.from(model);
resultDto.setGroupId(groupId);
return resultDto;
} }
return result; return null;
} }
public int deleteMarker(AirlineMarkerDTO dto) { public int deleteMarker(AirlineMarkerDTO dto) {
@ -109,10 +116,23 @@ public class AirlineMarkerGroupInfoServiceImpl implements IAirlineMarkerGroupInf
List<Long> markerIds = airlineMarkerGroupInfos.stream().map(AirlineMarkerGroupInfo::getMarkerId).toList(); List<Long> markerIds = airlineMarkerGroupInfos.stream().map(AirlineMarkerGroupInfo::getMarkerId).toList();
if (markerIds != null && !markerIds.isEmpty()) { if (markerIds != null && !markerIds.isEmpty()) {
// 建立 markerId -> groupId 的映射
java.util.Map<Long, Long> markerGroupMap = new java.util.HashMap<>();
for (AirlineMarkerGroupInfo info : airlineMarkerGroupInfos) {
markerGroupMap.put(info.getMarkerId(), info.getGroupId());
}
// 根据ID列表查询标注详情 // 根据ID列表查询标注详情
List<AirlineMarker> markers = iAirlineMarkerDomain.selectMarkerListByIds(markerIds); List<AirlineMarker> markers = iAirlineMarkerDomain.selectMarkerListByIds(markerIds);
if (markers != null && !markers.isEmpty()) { if (markers != null && !markers.isEmpty()) {
List<AirlineMarkerDTO> markerDTOs = AirlineMarkerServiceConvert.fromList(markers); List<AirlineMarkerDTO> markerDTOs = new java.util.ArrayList<>();
for (AirlineMarker marker : markers) {
AirlineMarkerDTO markerDTO = AirlineMarkerServiceConvert.from(marker);
if (markerGroupMap.containsKey(marker.getId())) {
markerDTO.setGroupId(markerGroupMap.get(marker.getId()));
}
markerDTOs.add(markerDTO);
}
dto.setGroupInfos(markerDTOs); dto.setGroupInfos(markerDTOs);
} }
} }

View File

@ -8,7 +8,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap id="AirlineAreaGroupResult" type="com.ruoyi.airline.mapper.entity.AirlineAreaGroupEntity"> <resultMap id="AirlineAreaGroupResult" type="com.ruoyi.airline.mapper.entity.AirlineAreaGroupEntity">
<id property="groupId" column="group_id" /> <id property="groupId" column="group_id" />
<result property="groupName" column="group_name" /> <result property="groupName" column="group_name" />
<result property="userId" column="user_id" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
@ -26,9 +25,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="groupId != null"> <if test="groupId != null">
and group_id != #{groupId} and group_id != #{groupId}
</if> </if>
<if test="userId != null">
and user_id = #{userId}
</if>
</select> </select>
<!-- 删除分组(软删除) --> <!-- 删除分组(软删除) -->
@ -38,9 +34,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
deleted_by = #{deletedBy}, deleted_by = #{deletedBy},
deleted_time = now() deleted_time = now()
where group_id = #{groupId} where group_id = #{groupId}
<if test="userId != null">
and user_id = #{userId}
</if>
</update> </update>
<!-- 更新分组 --> <!-- 更新分组 -->
@ -51,35 +44,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update_time = now() update_time = now()
where group_id = #{groupId} where group_id = #{groupId}
and del_flag = 0 and del_flag = 0
<if test="userId != null">
and user_id = #{userId}
</if>
</update> </update>
<!-- 插入分组 --> <!-- 插入分组 -->
<insert id="insertGroup" parameterType="com.ruoyi.airline.mapper.entity.AirlineAreaGroupEntity"> <insert id="insertGroup" parameterType="com.ruoyi.airline.mapper.entity.AirlineAreaGroupEntity">
insert into airline_area_group (group_name, user_id, create_by, create_time, update_by, update_time, del_flag) insert into airline_area_group (group_name, create_by, create_time, update_by, update_time, del_flag)
values (#{groupName}, #{userId}, #{createBy}, now(), #{updateBy}, now(), 0) values (#{groupName}, #{createBy}, now(), #{updateBy}, now(), 0)
</insert> </insert>
<!-- 查询分组列表 --> <!-- 查询分组列表 -->
<select id="selectGroupList" parameterType="com.ruoyi.airline.mapper.entity.AirlineAreaGroupEntity" resultMap="AirlineAreaGroupResult"> <select id="selectGroupList" parameterType="com.ruoyi.airline.mapper.entity.AirlineAreaGroupEntity" resultMap="AirlineAreaGroupResult">
select group_id, group_name, user_id, create_by, create_time, update_by, update_time, del_flag, deleted_by, deleted_time select group_id, group_name, create_by, create_time, update_by, update_time, del_flag, deleted_by, deleted_time
from airline_area_group from airline_area_group
<where> <where>
del_flag = 0 del_flag = 0
<if test="groupName != null and groupName != ''"> <if test="groupName != null and groupName != ''">
and group_name like concat('%', #{groupName}, '%') and group_name like concat('%', #{groupName}, '%')
</if> </if>
<if test="userId != null">
and user_id = #{userId}
</if>
</where> </where>
</select> </select>
<!-- 根据ID查询分组 --> <!-- 根据ID查询分组 -->
<select id="selectGroupById" parameterType="java.lang.Long" resultMap="AirlineAreaGroupResult"> <select id="selectGroupById" parameterType="java.lang.Long" resultMap="AirlineAreaGroupResult">
select group_id, group_name, user_id, create_by, create_time, update_by, update_time, del_flag, deleted_by, deleted_time select group_id, group_name, create_by, create_time, update_by, update_time, del_flag, deleted_by, deleted_time
from airline_area_group from airline_area_group
where group_id = #{groupId} where group_id = #{groupId}
and del_flag = 0 and del_flag = 0

View File

@ -114,7 +114,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<foreach item="id" collection="list" open="(" separator="," close=")"> <foreach item="id" collection="list" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
and am.status = 1
order by am.update_time desc order by am.update_time desc
</select> </select>