feat:提交标注代码
This commit is contained in:
parent
d56262fc34
commit
cac50ce393
|
|
@ -7,6 +7,7 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标注Controller转换类
|
* 标注Controller转换类
|
||||||
|
|
@ -24,23 +25,19 @@ public class AirlineMarkerControllerConvert extends BaseConvert<AirlineMarkerDTO
|
||||||
super(AirlineMarkerDTO.class, AirlineMarkerVO.class);
|
super(AirlineMarkerDTO.class, AirlineMarkerVO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AirlineMarkerVO from(AirlineMarkerDTO dto)
|
public static AirlineMarkerVO from(AirlineMarkerDTO dto) {
|
||||||
{
|
|
||||||
return INSTANCE.innerFrom(dto);
|
return INSTANCE.innerFrom(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AirlineMarkerDTO to(AirlineMarkerVO vo)
|
public static AirlineMarkerDTO to(AirlineMarkerVO vo) {
|
||||||
{
|
|
||||||
return INSTANCE.innerTo(vo);
|
return INSTANCE.innerTo(vo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<AirlineMarkerVO> fromList(List<AirlineMarkerDTO> dtoList)
|
public static List<AirlineMarkerVO> fromList(List<AirlineMarkerDTO> dtoList) {
|
||||||
{
|
|
||||||
return INSTANCE.innerFromList(dtoList);
|
return INSTANCE.innerFromList(dtoList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<AirlineMarkerDTO> toList(List<AirlineMarkerVO> voList)
|
public static List<AirlineMarkerDTO> toList(List<AirlineMarkerVO> voList) {
|
||||||
{
|
|
||||||
return INSTANCE.innerToList(voList);
|
return INSTANCE.innerToList(voList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -57,7 +54,20 @@ 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());
|
||||||
|
|
@ -80,7 +90,20 @@ public class AirlineMarkerControllerConvert extends BaseConvert<AirlineMarkerDTO
|
||||||
dto.setColor(vo.getColor());
|
dto.setColor(vo.getColor());
|
||||||
dto.setIcon(vo.getIcon());
|
dto.setIcon(vo.getIcon());
|
||||||
dto.setFontSize(vo.getFontSize());
|
dto.setFontSize(vo.getFontSize());
|
||||||
dto.setCoordinates(vo.getCoordinates());
|
|
||||||
|
// 转换coordinates
|
||||||
|
if (vo.getCoordinates() != null) {
|
||||||
|
dto.setCoordinates(vo.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(vo.getDescription());
|
dto.setDescription(vo.getDescription());
|
||||||
dto.setGroupId(vo.getGroupId());
|
dto.setGroupId(vo.getGroupId());
|
||||||
dto.setCreateBy(vo.getCreateBy());
|
dto.setCreateBy(vo.getCreateBy());
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
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;
|
||||||
|
|
@ -15,28 +17,25 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AirlineMarker from(AirlineMarkerEntity entity)
|
public static AirlineMarker from(AirlineMarkerEntity entity) {
|
||||||
{
|
|
||||||
return INSTANCE.innerFrom(entity);
|
return INSTANCE.innerFrom(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AirlineMarkerEntity to(AirlineMarker model)
|
public static AirlineMarkerEntity to(AirlineMarker model) {
|
||||||
{
|
|
||||||
return INSTANCE.innerTo(model);
|
return INSTANCE.innerTo(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<AirlineMarker> fromList(List<AirlineMarkerEntity> entityList)
|
public static List<AirlineMarker> fromList(List<AirlineMarkerEntity> entityList) {
|
||||||
{
|
|
||||||
return INSTANCE.innerFromList(entityList);
|
return INSTANCE.innerFromList(entityList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<AirlineMarkerEntity> toList(List<AirlineMarker> modelList)
|
public static List<AirlineMarkerEntity> toList(List<AirlineMarker> modelList) {
|
||||||
{
|
|
||||||
return INSTANCE.innerToList(modelList);
|
return INSTANCE.innerToList(modelList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -53,7 +52,16 @@ 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());
|
||||||
|
|
@ -76,7 +84,16 @@ 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());
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ 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,7 +54,7 @@ public class AirlineMarker extends ExBaseEntity {
|
||||||
/**
|
/**
|
||||||
* 经纬度,格式:[经,纬,asl高度]
|
* 经纬度,格式:[经,纬,asl高度]
|
||||||
*/
|
*/
|
||||||
private String coordinates;
|
private List<PointInfo> coordinates;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 简介
|
* 简介
|
||||||
|
|
@ -64,6 +66,24 @@ 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)
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ 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转换类
|
||||||
|
|
@ -21,23 +22,19 @@ public class AirlineMarkerServiceConvert extends BaseConvert<AirlineMarker, Airl
|
||||||
super(AirlineMarker.class, AirlineMarkerDTO.class);
|
super(AirlineMarker.class, AirlineMarkerDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AirlineMarkerDTO from(AirlineMarker model)
|
public static AirlineMarkerDTO from(AirlineMarker model) {
|
||||||
{
|
|
||||||
return INSTANCE.innerFrom(model);
|
return INSTANCE.innerFrom(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AirlineMarker to(AirlineMarkerDTO dto)
|
public static AirlineMarker to(AirlineMarkerDTO dto) {
|
||||||
{
|
|
||||||
return INSTANCE.innerTo(dto);
|
return INSTANCE.innerTo(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<AirlineMarkerDTO> fromList(List<AirlineMarker> modelList)
|
public static List<AirlineMarkerDTO> fromList(List<AirlineMarker> modelList) {
|
||||||
{
|
|
||||||
return INSTANCE.innerFromList(modelList);
|
return INSTANCE.innerFromList(modelList);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<AirlineMarker> toList(List<AirlineMarkerDTO> dtoList)
|
public static List<AirlineMarker> toList(List<AirlineMarkerDTO> dtoList) {
|
||||||
{
|
|
||||||
return INSTANCE.innerToList(dtoList);
|
return INSTANCE.innerToList(dtoList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,7 +51,20 @@ 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());
|
||||||
|
|
@ -76,7 +86,20 @@ 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());
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ 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,7 +54,7 @@ public class AirlineMarkerDTO extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 经纬度,格式:[经,纬,asl高度]
|
* 经纬度,格式:[经,纬,asl高度]
|
||||||
*/
|
*/
|
||||||
private String coordinates;
|
private List<PointInfo> coordinates;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 简介
|
* 简介
|
||||||
|
|
@ -64,6 +66,24 @@ 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)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue