feat:添加无人船慢速行驶指令
This commit is contained in:
+7
-1
@@ -49,7 +49,7 @@ public class BoatCommandManager {
|
||||
* 发送命令
|
||||
*
|
||||
* @param deviceSn 设备SN
|
||||
* @param commandType 命令类型(flighttask_prepare/flighttask_pause/flighttask_recovery/flighttask_undo)
|
||||
* @param commandType 命令类型(flighttask_prepare/flighttask_pause/flighttask_recovery/flighttask_undo/flighttask_slowly)
|
||||
* @param params 命令参数
|
||||
* @return 命令ID
|
||||
*/
|
||||
@@ -187,6 +187,12 @@ public class BoatCommandManager {
|
||||
}
|
||||
break;
|
||||
|
||||
case "flighttask_slowly":
|
||||
// 慢速行驶
|
||||
data.put("order_no", params.getString("order_no"));
|
||||
data.put("speed", params.getInteger("speed"));
|
||||
break;
|
||||
|
||||
default:
|
||||
data = params;
|
||||
break;
|
||||
|
||||
+10
@@ -2,6 +2,7 @@ package com.central.device.controller;
|
||||
|
||||
import com.central.common.model.Result;
|
||||
import com.central.device.model.dto.BoatManualControlDTO;
|
||||
import com.central.device.model.dto.BoatSlowlyDriveDTO;
|
||||
import com.central.device.service.IBoatControlService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@@ -61,6 +62,15 @@ public class BoatCommandController {
|
||||
return Result.succeed(null, "终止任务指令已下发");
|
||||
}
|
||||
|
||||
@Operation(summary = "慢速行驶")
|
||||
@PostMapping("/slowly")
|
||||
public Result<Void> slowly(
|
||||
@Parameter(description = "设备SN") @RequestParam String deviceSn,
|
||||
@RequestBody @Validated BoatSlowlyDriveDTO dto) {
|
||||
boatControlService.slowly(deviceSn, dto);
|
||||
return Result.succeed(null, "慢速行驶指令已下发");
|
||||
}
|
||||
|
||||
@Operation(summary = "返回起点")
|
||||
@PostMapping("/return")
|
||||
public Result<Void> returnToStart(
|
||||
|
||||
+9
@@ -1,6 +1,7 @@
|
||||
package com.central.device.service;
|
||||
|
||||
import com.central.device.model.dto.BoatManualControlDTO;
|
||||
import com.central.device.model.dto.BoatSlowlyDriveDTO;
|
||||
|
||||
/**
|
||||
* 无人船控制服务接口
|
||||
@@ -44,6 +45,14 @@ public interface IBoatControlService {
|
||||
*/
|
||||
void undoTask(String deviceSn, String missionCode);
|
||||
|
||||
/**
|
||||
* 慢速行驶
|
||||
*
|
||||
* @param deviceSn 设备SN
|
||||
* @param dto 慢速行驶参数
|
||||
*/
|
||||
void slowly(String deviceSn, BoatSlowlyDriveDTO dto);
|
||||
|
||||
/**
|
||||
* 返回起点
|
||||
*
|
||||
|
||||
+13
@@ -6,6 +6,7 @@ import com.central.device.boat.entity.BoatRoute;
|
||||
import com.central.device.boat.manager.BoatCommandManager;
|
||||
import com.central.device.model.AgeDevice;
|
||||
import com.central.device.model.dto.BoatManualControlDTO;
|
||||
import com.central.device.model.dto.BoatSlowlyDriveDTO;
|
||||
import com.central.device.service.IAgeDeviceService;
|
||||
import com.central.device.service.IBoatControlService;
|
||||
import com.central.device.service.IBoatRouteService;
|
||||
@@ -86,6 +87,18 @@ public class BoatControlServiceImpl implements IBoatControlService {
|
||||
boatCommandManager.sendCommand(deviceSn, "flighttask_undo", params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void slowly(String deviceSn, BoatSlowlyDriveDTO dto) {
|
||||
log.info("无人船慢速行驶: deviceSn={}, missionCode={}, speed={}",
|
||||
deviceSn, dto.getMissionCode(), dto.getSpeed());
|
||||
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("order_no", dto.getMissionCode());
|
||||
params.put("speed", dto.getSpeed());
|
||||
|
||||
boatCommandManager.sendCommand(deviceSn, "flighttask_slowly", params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void returnToStart(String deviceSn) {
|
||||
log.info("无人船返回起点: deviceSn={}", deviceSn);
|
||||
|
||||
Reference in New Issue
Block a user