From b4cbe90b2f84798a6664bfb57c7dbbe16b3c3c51 Mon Sep 17 00:00:00 2001
From: Xiajijian <1176061145@qq.com>
Date: Tue, 04 Nov 2025 20:15:21 +0800
Subject: [PATCH] 1.文件业务权限管理优化。 2.文件夹业务权限管理优化。 3.航线信息接口业务逻辑优化。 4.解析kmz文件接口,异常处理。 5.增加解析kmz文件接口业务,符合智云3.0整体业务。 6.优化公共方法类。 7.新增文件异常处理优化。 8.解决文件夹查询异常报错。 9.根据前端业务增加业务字段。 10.修改代码注释。 11.抽取公共方法。
---
ard-route/src/main/java/com/ard/route/util/RouteFileUtils.java | 163 ++++++++++++++++++++++++++++--------------------------
1 files changed, 85 insertions(+), 78 deletions(-)
diff --git a/ard-route/src/main/java/com/ard/route/util/RouteFileUtils.java b/ard-route/src/main/java/com/ard/route/util/RouteFileUtils.java
index b888454..628b2b1 100644
--- a/ard-route/src/main/java/com/ard/route/util/RouteFileUtils.java
+++ b/ard-route/src/main/java/com/ard/route/util/RouteFileUtils.java
@@ -21,21 +21,12 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
+import static com.ard.route.util.ToolUtils.XML_HEADER;
+
/**
* 航线文件操作工具类
*/
public class RouteFileUtils {
-
- /**
- * XML 头部
- */
- private static final String XML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
-
- /**
- * 生成的本地 kmz 文件存储路径
- */
- private static final String LOCAL_KMZ_FILE_PATH = "file" + File.separator + "kmz" + File.separator;
-
/**
* kml文件解析
@@ -175,13 +166,18 @@
kmlFolder.setAutoFlightSpeed(String.valueOf(kmlParams.getAutoFlightSpeed()));
if (StringUtils.equals(fileType, FileTypeConstants.KML)) {
kmlFolder.setTemplateType(kmlParams.getTemplateType());
- kmlFolder.setWaylineCoordinateSysParam(buildKmlWayLineCoordinateSysParam(TemplateTypeEnums.WAYPOINT.getValue()));
+ kmlFolder.setWaylineCoordinateSysParam(buildKmlWayLineCoordinateSysParam(kmlParams.getTemplateType(), HeightModeEnums.RELATIVE_TO_START_POINT.getValue(),
+ String.valueOf(kmlParams.getGlobalHeight())));
kmlFolder.setPayloadParam(buildKmlPayloadParam(kmlParams));
}
if (StringUtils.equals(fileType, FileTypeConstants.WPML)) {
kmlFolder.setWaylineId("0");
kmlFolder.setExecuteHeightMode(ExecuteHeightModeEnums.RELATIVE_TO_START_POINT.getValue());
- // TODO 航线初始动作
+ if (CollectionUtil.isNotEmpty(kmlParams.getStartActionList())) {
+ KmlActionGroup kmlActionGroup = new KmlActionGroup();
+ kmlActionGroup.setAction(getKmlActionList(kmlParams.getStartActionList(), kmlParams));
+ kmlFolder.setStartActionGroup(kmlActionGroup);
+ }
}
// 航点类型模板航线配置
if (StringUtils.equals(kmlFolder.getTemplateType(), TemplateTypeEnums.WAYPOINT.getValue())) {
@@ -222,12 +218,6 @@
if (CollectionUtil.isNotEmpty(routePointList)) {
List<KmlPlacemark> kmlPlacemarkList = new ArrayList<>();
for (RoutePointInfo routePointInfo : routePointList) {
-// ActionTriggerReq actionTriggerReq = new ActionTriggerReq();
-// actionTriggerReq.setActionTriggerType(StringUtils.equals(kmlParams.getMappingTypeReq().getShootType(), ShootTypeEnums.TIME.getValue()) ?
-// ActionTriggerTypeEnums.MULTIPLE_TIMING.getValue() :
-// ActionTriggerTypeEnums.MULTIPLE_DISTANCE.getValue());
-// actionTriggerReq.setActionTriggerParam(2.0);
-// RoutePointInfo.setActionTriggerReq(actionTriggerReq);
kmlPlacemarkList.add(buildKmlPlacemark(routePointInfo, kmlParams, fileType));
}
kmlFolder.setPlacemarkList(kmlPlacemarkList);
@@ -237,17 +227,56 @@
return kmlFolder;
}
- public static KmlWayLineCoordinateSysParam buildKmlWayLineCoordinateSysParam(String templateType) {
+ /**
+ * 构建航点动作
+ *
+ * @param actionList 航点动作列表
+ * @param kmlParams
+ * @return
+ */
+ private static List<KmlAction> getKmlActionList(List<PointActionReq> actionList, KmlParams kmlParams) {
+ List<KmlAction> kmlActionList = new ArrayList<>();
+ for (PointActionReq pointActionReq : actionList) {
+ if (ObjectUtil.isNotNull(pointActionReq.getHoverTime())) {
+ kmlActionList.add(buildKmlAction(String.valueOf(pointActionReq.getActionIndex()), ActionActuatorFuncEnums.HOVER.getValue(), pointActionReq, kmlParams));
+ } else if (ObjectUtil.isNotNull(pointActionReq.getAircraftHeading())) {
+ kmlActionList.add(buildKmlAction(String.valueOf(pointActionReq.getActionIndex()), ActionActuatorFuncEnums.ROTATE_YAW.getValue(), pointActionReq, kmlParams));
+ } else if (ObjectUtil.isNotNull(pointActionReq.getTakePhotoType()) && ObjectUtil.equals(pointActionReq.getTakePhotoType(), 0)) {
+ kmlActionList.add(buildKmlAction(String.valueOf(pointActionReq.getActionIndex()), ActionActuatorFuncEnums.TAKE_PHOTO.getValue(), pointActionReq, kmlParams));
+ } else if ((ObjectUtil.isNotNull(pointActionReq.getGimbalYawRotateAngle())) || (ObjectUtil.isNotNull(pointActionReq.getGimbalPitchRotateAngle()))) {
+ kmlActionList.add(buildKmlAction(String.valueOf(pointActionReq.getActionIndex()), ActionActuatorFuncEnums.GIMBAL_ROTATE.getValue(), pointActionReq, kmlParams));
+ } else if (ObjectUtil.isNotNull(pointActionReq.getZoom())) {
+ kmlActionList.add(buildKmlAction(String.valueOf(pointActionReq.getActionIndex()), ActionActuatorFuncEnums.ZOOM.getValue(), pointActionReq, kmlParams));
+ } else if (ObjectUtil.isNotNull(pointActionReq.getTakePhotoType()) && ObjectUtil.equals(pointActionReq.getTakePhotoType(), 1)) {
+ kmlActionList.add(buildKmlAction(String.valueOf(pointActionReq.getActionIndex()), ActionActuatorFuncEnums.PANO_SHOT.getValue(), pointActionReq, kmlParams));
+ } else if (ObjectUtil.isNotNull(pointActionReq.getStartRecord()) && pointActionReq.getStartRecord()) {
+ kmlActionList.add(buildKmlAction(String.valueOf(pointActionReq.getActionIndex()), ActionActuatorFuncEnums.START_RECORD.getValue(), pointActionReq, kmlParams));
+ } else if (ObjectUtil.isNotNull(pointActionReq.getStopRecord()) && pointActionReq.getStopRecord()) {
+ kmlActionList.add(buildKmlAction(String.valueOf(pointActionReq.getActionIndex()), ActionActuatorFuncEnums.STOP_RECORD.getValue(), pointActionReq, kmlParams));
+ }
+ }
+ return kmlActionList;
+ }
+
+ /**
+ * 构造坐标系参数信息
+ *
+ * @param templateType 航线模板类型
+ * @param heightMode 高度模式
+ * @param height 高度
+ * @return 坐标系参数信息
+ */
+ public static KmlWayLineCoordinateSysParam buildKmlWayLineCoordinateSysParam(String templateType, String heightMode, String height) {
KmlWayLineCoordinateSysParam kmlWayLineCoordinateSysParam = new KmlWayLineCoordinateSysParam();
kmlWayLineCoordinateSysParam.setCoordinateMode("WGS84");
- kmlWayLineCoordinateSysParam.setHeightMode(HeightModeEnums.RELATIVE_TO_START_POINT.getValue());
+ kmlWayLineCoordinateSysParam.setHeightMode(heightMode);
kmlWayLineCoordinateSysParam.setPositioningType(PositioningTypeEnums.GPS.getValue());
if (StringUtils.equals(templateType, TemplateTypeEnums.MAPPING2D.getValue()) ||
StringUtils.equals(templateType, TemplateTypeEnums.MAPPING3D.getValue()) ||
StringUtils.equals(templateType, TemplateTypeEnums.MAPPING_STRIP.getValue())) {
- kmlWayLineCoordinateSysParam.setGlobalShootHeight("50");
+ kmlWayLineCoordinateSysParam.setGlobalShootHeight(height);
kmlWayLineCoordinateSysParam.setSurfaceFollowModeEnable("1");
- kmlWayLineCoordinateSysParam.setSurfaceRelativeHeight("100");
+ kmlWayLineCoordinateSysParam.setSurfaceRelativeHeight(height);
}
return kmlWayLineCoordinateSysParam;
}
@@ -287,6 +316,7 @@
kmlPlacemark.setIsRisky("0");
kmlPlacemark.setKmlPoint(buildKmlPoint(String.valueOf(routePointInfo.getLongitude()), String.valueOf(routePointInfo.getLatitude())));
kmlPlacemark.setIndex(String.valueOf(routePointInfo.getRoutePointIndex()));
+
handleHeight(routePointInfo, kmlParams, fileType, kmlPlacemark);
handleSpeed(routePointInfo, kmlParams, fileType, kmlPlacemark);
handleWaypointHeadingParam(routePointInfo, kmlParams, fileType, kmlPlacemark);
@@ -296,8 +326,12 @@
kmlPlacemark.setGimbalPitchAngle(String.valueOf(routePointInfo.getGimbalPitchAngle()));
}
}
- if (CollectionUtil.isNotEmpty(routePointInfo.getActions())) {
- kmlPlacemark.setActionGroup(buildKmlActionGroup(routePointInfo, kmlParams));
+ if (CollectionUtil.isNotEmpty(routePointInfo.getActionGroupList())) {
+ List<KmlActionGroup> kmlActionGroupList = new ArrayList<>();
+ for (ActionGroupReq actionGroupReq : routePointInfo.getActionGroupList()) {
+ kmlActionGroupList.add(buildKmlActionGroup(actionGroupReq, kmlParams));
+ }
+ kmlPlacemark.setActionGroup(kmlActionGroupList);
}
return kmlPlacemark;
}
@@ -321,22 +355,16 @@
private static KmlOverlap buildKmlOverlap(String collectionMethod, String lensType, Integer overlapH, Integer overlapW) {
KmlOverlap overlap = new KmlOverlap();
- if (StringUtils.equals(collectionMethod, CollectionMethodEnums.ORTHO.getValue())) {
- if (StringUtils.equals(lensType, LensTypeEnums.LIDAR.getValue())) {
- overlap.setOrthoLidarOverlapH(String.valueOf(overlapH));
- overlap.setOrthoLidarOverlapW(String.valueOf(overlapW));
- } else {
- overlap.setOrthoCameraOverlapH(String.valueOf(overlapH));
- overlap.setOrthoCameraOverlapW(String.valueOf(overlapW));
- }
+ if (StringUtils.equals(collectionMethod, LensTypeEnums.CAMERA.getValue())) {
+ overlap.setOrthoCameraOverlapH(String.valueOf(overlapH));
+ overlap.setOrthoCameraOverlapW(String.valueOf(overlapW));
+ overlap.setInclinedCameraOverlapW(String.valueOf(overlapW));
+ overlap.setInclinedCameraOverlapH(String.valueOf(overlapH));
} else {
- if (StringUtils.equals(lensType, LensTypeEnums.LIDAR.getValue())) {
- overlap.setInclinedLidarOverlapH(String.valueOf(overlapH));
- overlap.setInclinedCameraOverlapW(String.valueOf(overlapW));
- } else {
- overlap.setInclinedCameraOverlapH(String.valueOf(overlapH));
- overlap.setInclinedCameraOverlapW(String.valueOf(overlapW));
- }
+ overlap.setOrthoLidarOverlapH(String.valueOf(overlapH));
+ overlap.setOrthoLidarOverlapW(String.valueOf(overlapW));
+ overlap.setInclinedLidarOverlapH(String.valueOf(overlapH));
+ overlap.setInclinedLidarOverlapW(String.valueOf(overlapW));
}
return overlap;
}
@@ -462,44 +490,15 @@
return kmlWaypointTurnParam;
}
- public static KmlActionGroup buildKmlActionGroup(RoutePointInfo routePointInfo, KmlParams kmlParams) {
+ public static KmlActionGroup buildKmlActionGroup(ActionGroupReq actionGroupReq, KmlParams kmlParams) {
KmlActionGroup kmlActionGroup = new KmlActionGroup();
- kmlActionGroup.setActionGroupId(String.valueOf(routePointInfo.getRoutePointIndex()));
- kmlActionGroup.setActionGroupStartIndex(String.valueOf(routePointInfo.getRoutePointIndex()));
- kmlActionGroup.setActionGroupEndIndex(String.valueOf(ObjectUtil.isNotNull(routePointInfo.getEndIntervalRouteIndex()) ?
- routePointInfo.getEndIntervalRouteIndex() : routePointInfo.getRoutePointIndex()));
+ kmlActionGroup.setActionGroupId(String.valueOf(actionGroupReq.getActionGroupId()));
+ kmlActionGroup.setActionGroupStartIndex(String.valueOf(actionGroupReq.getActionGroupStartIndex()));
+ kmlActionGroup.setActionGroupEndIndex(String.valueOf(actionGroupReq.getActionGroupEndIndex()));
kmlActionGroup.setActionGroupMode(ActionGroupModeEnums.SEQUENCE.getValue());
- String actionTriggerType = ActionTriggerTypeEnums.REACH_POINT.getValue();
- Double actionTriggerParam = 0.0;
- if (ObjectUtil.isNotNull(routePointInfo.getTimeInterval())) {
- actionTriggerType = ActionTriggerTypeEnums.MULTIPLE_TIMING.getValue();
- actionTriggerParam = routePointInfo.getTimeInterval();
- } else if (ObjectUtil.isNotNull(routePointInfo.getDistanceInterval())) {
- actionTriggerType = ActionTriggerTypeEnums.MULTIPLE_DISTANCE.getValue();
- actionTriggerParam = routePointInfo.getDistanceInterval();
- }
- kmlActionGroup.setActionTrigger(buildKmlActionTrigger(actionTriggerType, actionTriggerParam));
- List<KmlAction> kmlActionList = new ArrayList<>();
- for (PointActionReq pointActionReq : routePointInfo.getActions()) {
- if (ObjectUtil.isNotNull(pointActionReq.getHoverTime())) {
- kmlActionList.add(buildKmlAction(String.valueOf(pointActionReq.getActionIndex()), ActionActuatorFuncEnums.HOVER.getValue(), pointActionReq, kmlParams));
- } else if (ObjectUtil.isNotNull(pointActionReq.getAircraftHeading())) {
- kmlActionList.add(buildKmlAction(String.valueOf(pointActionReq.getActionIndex()), ActionActuatorFuncEnums.ROTATE_YAW.getValue(), pointActionReq, kmlParams));
- } else if (ObjectUtil.isNotNull(pointActionReq.getTakePhotoType()) && ObjectUtil.equals(pointActionReq.getTakePhotoType(), 0)) {
- kmlActionList.add(buildKmlAction(String.valueOf(pointActionReq.getActionIndex()), ActionActuatorFuncEnums.TAKE_PHOTO.getValue(), pointActionReq, kmlParams));
- } else if ((ObjectUtil.isNotNull(pointActionReq.getGimbalYawRotateAngle())) || (ObjectUtil.isNotNull(pointActionReq.getGimbalPitchRotateAngle()))) {
- kmlActionList.add(buildKmlAction(String.valueOf(pointActionReq.getActionIndex()), ActionActuatorFuncEnums.GIMBAL_ROTATE.getValue(), pointActionReq, kmlParams));
- } else if (ObjectUtil.isNotNull(pointActionReq.getZoom())) {
- kmlActionList.add(buildKmlAction(String.valueOf(pointActionReq.getActionIndex()), ActionActuatorFuncEnums.ZOOM.getValue(), pointActionReq, kmlParams));
- } else if (ObjectUtil.isNotNull(pointActionReq.getTakePhotoType()) && ObjectUtil.equals(pointActionReq.getTakePhotoType(), 1)) {
- kmlActionList.add(buildKmlAction(String.valueOf(pointActionReq.getActionIndex()), ActionActuatorFuncEnums.PANO_SHOT.getValue(), pointActionReq, kmlParams));
- } else if (ObjectUtil.isNotNull(pointActionReq.getStartRecord()) && pointActionReq.getStartRecord()) {
- kmlActionList.add(buildKmlAction(String.valueOf(pointActionReq.getActionIndex()), ActionActuatorFuncEnums.START_RECORD.getValue(), pointActionReq, kmlParams));
- } else if (ObjectUtil.isNotNull(pointActionReq.getStopRecord()) && pointActionReq.getStopRecord()) {
- kmlActionList.add(buildKmlAction(String.valueOf(pointActionReq.getActionIndex()), ActionActuatorFuncEnums.STOP_RECORD.getValue(), pointActionReq, kmlParams));
- }
- }
- kmlActionGroup.setAction(kmlActionList);
+
+ kmlActionGroup.setActionTrigger(buildKmlActionTrigger(actionGroupReq.getActionTriggerType(), actionGroupReq.getActionTriggerParam()));
+ kmlActionGroup.setAction(getKmlActionList(actionGroupReq.getActions(), kmlParams));
return kmlActionGroup;
}
@@ -526,7 +525,11 @@
if (StringUtils.equals(actionActuatorFunc, ActionActuatorFuncEnums.TAKE_PHOTO.getValue()) ||
StringUtils.equals(actionActuatorFunc, ActionActuatorFuncEnums.START_RECORD.getValue())) {
kmlActionActuatorFuncParam.setPayloadPositionIndex(String.valueOf(kmlParams.getPayloadPosition()));
- kmlActionActuatorFuncParam.setFileSuffix("");
+ if (pointActionReq.getFileSuffix() != null){
+ kmlActionActuatorFuncParam.setFileSuffix(pointActionReq.getFileSuffix());
+ }else {
+ kmlActionActuatorFuncParam.setFileSuffix("panoramicPhoto_360");
+ }
kmlActionActuatorFuncParam.setUseGlobalPayloadLensIndex(String.valueOf(pointActionReq.getUseGlobalImageFormat()));
if (ObjectUtil.equals(pointActionReq.getUseGlobalImageFormat(), 0)) {
kmlActionActuatorFuncParam.setPayloadLensIndex(pointActionReq.getImageFormat());
@@ -568,7 +571,11 @@
} else if (StringUtils.equals(actionActuatorFunc, ActionActuatorFuncEnums.PANO_SHOT.getValue())) {
kmlActionActuatorFuncParam.setPayloadPositionIndex(String.valueOf(kmlParams.getPayloadPosition()));
kmlActionActuatorFuncParam.setUseGlobalPayloadLensIndex(String.valueOf(pointActionReq.getUseGlobalImageFormat()));
- kmlActionActuatorFuncParam.setPanoShotSubMode("panoShot_360");
+ if (pointActionReq.getFileSuffix()!=null){
+ kmlActionActuatorFuncParam.setPanoShotSubMode(pointActionReq.getPanoShotSubMode());
+ }else {
+ kmlActionActuatorFuncParam.setPanoShotSubMode("panoShot_360");
+ }
if (ObjectUtil.equals(pointActionReq.getUseGlobalImageFormat(), 0)) {
kmlActionActuatorFuncParam.setPayloadLensIndex(pointActionReq.getImageFormat());
} else {
--
Gitblit v1.9.3