航线导入字段逻辑优化
This commit is contained in:
parent
00687e6718
commit
c2867200b7
|
|
@ -123,9 +123,9 @@ public class RouteDTO implements Serializable {
|
|||
private String expectFlightTime;
|
||||
|
||||
@JsonProperty(required = true)
|
||||
@NotNull(message = "{route.is.accurate.import.require}", groups = {AddGroup.class, UpdateGroup.class})
|
||||
@Schema(description = "是否精准导入")
|
||||
private Boolean isAccurateImport;
|
||||
@NotNull(message = "{route.is.accurate.import.require}", groups = {UpdateGroup.class})
|
||||
@Schema(description = "导入类型 0不是导入 1普通导入 2精准导入")
|
||||
private Integer importType;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||
|
|
|
|||
|
|
@ -26,9 +26,8 @@ public class UploadRouteDTO {
|
|||
// @Schema(description = "机库SN")
|
||||
private String dockSn;
|
||||
|
||||
@NotNull(message = "是否精准导入不能为空")
|
||||
// @Schema(description = "是否精准导入 true false")
|
||||
private Boolean accurateImport;
|
||||
@NotNull(message = "导入类型 1普通导入 2精准导入")
|
||||
private Integer importType;
|
||||
|
||||
// @Schema(description = "返航高度")
|
||||
private Double globalRthHeight;
|
||||
|
|
@ -41,7 +40,7 @@ public class UploadRouteDTO {
|
|||
@Schema(hidden = true)
|
||||
@AssertTrue(message = "返航高度不能为空")
|
||||
public boolean isGlobalRthHeightValid() {
|
||||
if (accurateImport) {
|
||||
if (importType == 2) {
|
||||
return globalRthHeight != null;
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -102,9 +102,9 @@ public class RouteEntity extends BaseEntity {
|
|||
*/
|
||||
private String expectFlightTime;
|
||||
/**
|
||||
* 是否精准导入
|
||||
* 导入类型 0不是导入 1普通导入 2精准导入
|
||||
*/
|
||||
private Boolean isAccurateImport;
|
||||
private Integer importType;
|
||||
/**
|
||||
* 删除标志
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ public class Q20RouteUploadDTO {
|
|||
@JsonProperty(value = "flight_height", access = WRITE_ONLY)
|
||||
private Float flightHeight;
|
||||
|
||||
@Schema(description = "是否精准导入,仅本地存储用,不下发给设备")
|
||||
@JsonProperty(value = "accurate_import", access = WRITE_ONLY)
|
||||
private Boolean accurateImport;
|
||||
@Schema(description = "导入类型 0不是导入 1普通导入 2精准导入")
|
||||
@JsonProperty(value = "import_type", access = WRITE_ONLY)
|
||||
private Integer importType;
|
||||
|
||||
@Schema(description = "航线ID(存储用)")
|
||||
private String wayline;
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ public class Q20RouteServiceImpl implements Q20RouteService {
|
|||
|
||||
// 前端传入的可选覆盖字段
|
||||
if (dto.getFlightHeight() != null) route.setFlightHeight(dto.getFlightHeight().doubleValue());
|
||||
if (dto.getAccurateImport() != null) route.setIsAccurateImport(dto.getAccurateImport());
|
||||
if (dto.getImportType() != null) route.setImportType(dto.getImportType());
|
||||
|
||||
// 补全 NOT NULL 字段默认值
|
||||
if (route.getFlightHeight() == null) route.setFlightHeight(100.0);
|
||||
|
|
@ -454,7 +454,7 @@ public class Q20RouteServiceImpl implements Q20RouteService {
|
|||
if (route.getFlyToWaylineMode() == null) route.setFlyToWaylineMode("safely");
|
||||
if (route.getTotalDistance() == null) route.setTotalDistance(0.0);
|
||||
if (route.getExpectFlightTime() == null) route.setExpectFlightTime("0");
|
||||
if (route.getIsAccurateImport() == null) route.setIsAccurateImport(false);
|
||||
if (route.getImportType() == null) route.setImportType(0);
|
||||
|
||||
routeDao.insert(route);
|
||||
Long routeId = route.getId();
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ public class RouteServiceImpl extends CrudServiceImpl<RouteDao, RouteEntity, Rou
|
|||
routeEntity.setWaypointNum(routeWaypointList.size());
|
||||
String imgUrl = routeDTO.getImgUrl();
|
||||
routeEntity.setImgUrl(imgUrl.replaceAll(BusinessConstant.IMAGE_PATH, ""));
|
||||
routeEntity.setImportType(0);
|
||||
baseDao.insert(routeEntity);
|
||||
|
||||
//保存航点信息
|
||||
|
|
@ -235,13 +236,14 @@ public class RouteServiceImpl extends CrudServiceImpl<RouteDao, RouteEntity, Rou
|
|||
//判断航线名称是否已存在
|
||||
checkRouteExist(null, name);
|
||||
|
||||
Integer importType = dto.getImportType();
|
||||
RouteDTO routeDTO = null;
|
||||
try {
|
||||
Map<String, byte[]> kmzInfo = KmzUtils.extractKmzAsBytes(file.getInputStream());
|
||||
byte[] template = kmzInfo.get("template.kml");
|
||||
routeDTO = WpmlKmlParser.parseKmlFile(template, dto.getAccurateImport());
|
||||
routeDTO = WpmlKmlParser.parseKmlFile(template, importType == 2);
|
||||
byte[] waylines = kmzInfo.get("waylines.wpml");
|
||||
WpmlKmlParser.parseWpmlFile(waylines, routeDTO, dto.getAccurateImport());
|
||||
WpmlKmlParser.parseWpmlFile(waylines, routeDTO, importType == 2);
|
||||
|
||||
log.debug("解析结果:{}", JsonUtils.toJsonString(routeDTO));
|
||||
} catch (Exception e) {
|
||||
|
|
@ -251,7 +253,7 @@ public class RouteServiceImpl extends CrudServiceImpl<RouteDao, RouteEntity, Rou
|
|||
}
|
||||
|
||||
routeDTO.setRouteName(name);
|
||||
if (dto.getAccurateImport()) {
|
||||
if (importType == 2) {
|
||||
routeDTO.setGlobalRthHeight(dto.getGlobalRthHeight());
|
||||
}
|
||||
String path = dto.getDockSn() + "/" + originalFilename;
|
||||
|
|
@ -262,7 +264,7 @@ public class RouteServiceImpl extends CrudServiceImpl<RouteDao, RouteEntity, Rou
|
|||
throw new RenException(ErrorCode.OSS_UPLOAD_FILE_ERROR);
|
||||
}
|
||||
routeDTO.setKmzUrl(BusinessConstant.ROUTE_KMZ_BUCKET + "/" + path);
|
||||
routeDTO.setIsAccurateImport(dto.getAccurateImport());
|
||||
routeDTO.setImportType(importType);
|
||||
routeDTO.setDockSn(dto.getDockSn());
|
||||
|
||||
//航点动作处理
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ CREATE TABLE "public"."bus_route"
|
|||
"waypoint_num" int4,
|
||||
"total_distance" float4 NOT NULL,
|
||||
"expect_flight_time" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
|
||||
"is_accurate_import" bool NOT NULL,
|
||||
"import_type" int2 NOT NULL,
|
||||
"del_flag" int2 DEFAULT 0,
|
||||
"creator" int8,
|
||||
"create_date" timestamp(6),
|
||||
|
|
@ -458,7 +458,7 @@ ON COLUMN "public"."bus_route"."total_distance" IS '总距离';
|
|||
COMMENT
|
||||
ON COLUMN "public"."bus_route"."expect_flight_time" IS '预计飞行时长';
|
||||
COMMENT
|
||||
ON COLUMN "public"."bus_route"."is_accurate_import" IS '是否精准导入';
|
||||
ON COLUMN "public"."bus_route"."import_type" IS '导入类型 0不是导入 1普通导入 2精准导入';
|
||||
COMMENT
|
||||
ON COLUMN "public"."bus_route"."del_flag" IS '删除标志';
|
||||
COMMENT
|
||||
|
|
|
|||
Loading…
Reference in New Issue