From 728c057bfa9342fba3a3611bc139ccd7bf7db43b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=87=A4=E5=90=89?= Date: Mon, 5 May 2025 11:29:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E9=97=A8=E4=B8=9A=E5=8A=A1=E6=8C=87?= =?UTF-8?q?=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iflytop/gd/app/cmd/debug/DebugDoorClose.java | 31 +++++++++++++++++++++ .../iflytop/gd/app/cmd/debug/DebugDoorOpen.java | 31 +++++++++++++++++++++ .../iflytop/gd/app/cmd/debug/DebugDoorOrigin.java | 29 ++++++++++++++++++++ .../com/iflytop/gd/app/cmd/debug/DebugDoorSet.java | 32 ++++++++++++++++++++++ .../iflytop/gd/app/cmd/debug/DebugDoorStop.java | 29 ++++++++++++++++++++ 5 files changed, 152 insertions(+) create mode 100644 src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorClose.java create mode 100644 src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorOpen.java create mode 100644 src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorOrigin.java create mode 100644 src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorSet.java create mode 100644 src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorStop.java diff --git a/src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorClose.java b/src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorClose.java new file mode 100644 index 0000000..93ccc9d --- /dev/null +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorClose.java @@ -0,0 +1,31 @@ +package com.iflytop.gd.app.cmd.debug; + +import com.iflytop.gd.app.core.BaseCommandHandler; +import com.iflytop.gd.app.model.dto.CmdDTO; +import com.iflytop.gd.app.service.DeviceCommandService; +import com.iflytop.gd.common.annotation.CommandMapping; +import com.iflytop.gd.common.cmd.CommandFuture; +import com.iflytop.gd.common.cmd.DeviceCommand; +import com.iflytop.gd.common.cmd.DeviceCommandGenerator; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * 门电机 关门 + */ +@Slf4j +@Component +@RequiredArgsConstructor +@CommandMapping("debug_door_close") +public class DebugDoorClose extends BaseCommandHandler { + private final DeviceCommandService deviceCommandService; + + @Override + public void handle(CmdDTO cmdDTO) throws Exception { + Double position = cmdDTO.getDoubleParam("position"); + DeviceCommand deviceCommand = DeviceCommandGenerator.doorMove(position); + CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); + commandWait(deviceCommandFuture); + } +} diff --git a/src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorOpen.java b/src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorOpen.java new file mode 100644 index 0000000..f0e44e2 --- /dev/null +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorOpen.java @@ -0,0 +1,31 @@ +package com.iflytop.gd.app.cmd.debug; + +import com.iflytop.gd.app.core.BaseCommandHandler; +import com.iflytop.gd.app.model.dto.CmdDTO; +import com.iflytop.gd.app.service.DeviceCommandService; +import com.iflytop.gd.common.annotation.CommandMapping; +import com.iflytop.gd.common.cmd.CommandFuture; +import com.iflytop.gd.common.cmd.DeviceCommand; +import com.iflytop.gd.common.cmd.DeviceCommandGenerator; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * 门电机 开门 + */ +@Slf4j +@Component +@RequiredArgsConstructor +@CommandMapping("debug_door_open") +public class DebugDoorOpen extends BaseCommandHandler { + private final DeviceCommandService deviceCommandService; + + @Override + public void handle(CmdDTO cmdDTO) throws Exception { + Double position = cmdDTO.getDoubleParam("position"); + DeviceCommand deviceCommand = DeviceCommandGenerator.doorMove(position); + CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); + commandWait(deviceCommandFuture); + } +} diff --git a/src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorOrigin.java b/src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorOrigin.java new file mode 100644 index 0000000..4c5e815 --- /dev/null +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorOrigin.java @@ -0,0 +1,29 @@ +package com.iflytop.gd.app.cmd.debug; + +import com.iflytop.gd.app.core.BaseCommandHandler; +import com.iflytop.gd.app.model.dto.CmdDTO; +import com.iflytop.gd.app.service.DeviceCommandService; +import com.iflytop.gd.common.annotation.CommandMapping; +import com.iflytop.gd.common.cmd.CommandFuture; +import com.iflytop.gd.common.cmd.DeviceCommand; +import com.iflytop.gd.common.cmd.DeviceCommandGenerator; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * 门电机 回原点 + */ +@Slf4j +@Component +@RequiredArgsConstructor +@CommandMapping("debug_door_stop") +public class DebugDoorOrigin extends BaseCommandHandler { + private final DeviceCommandService deviceCommandService; + @Override + public void handle(CmdDTO cmdDTO) throws Exception { + DeviceCommand deviceCommand = DeviceCommandGenerator.doorOrigin(); + CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); + commandWait(deviceCommandFuture); + } +} diff --git a/src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorSet.java b/src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorSet.java new file mode 100644 index 0000000..7f9d45d --- /dev/null +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorSet.java @@ -0,0 +1,32 @@ +package com.iflytop.gd.app.cmd.debug; + +import com.iflytop.gd.app.core.BaseCommandHandler; +import com.iflytop.gd.app.model.dto.CmdDTO; +import com.iflytop.gd.app.service.DeviceCommandService; +import com.iflytop.gd.common.annotation.CommandMapping; +import com.iflytop.gd.common.cmd.CommandFuture; +import com.iflytop.gd.common.cmd.DeviceCommand; +import com.iflytop.gd.common.cmd.DeviceCommandGenerator; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * 门电机 设置参数 + */ +@Slf4j +@Component +@RequiredArgsConstructor +@CommandMapping("debug_door_set") +public class DebugDoorSet extends BaseCommandHandler { + private final DeviceCommandService deviceCommandService; + + @Override + public void handle(CmdDTO cmdDTO) throws Exception { + Integer current = cmdDTO.getIntegerParam("current"); + Double speed = cmdDTO.getDoubleParam("speed"); + DeviceCommand deviceCommand = DeviceCommandGenerator.doorSet(current, speed); + CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); + commandWait(deviceCommandFuture); + } +} diff --git a/src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorStop.java b/src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorStop.java new file mode 100644 index 0000000..b784a56 --- /dev/null +++ b/src/main/java/com/iflytop/gd/app/cmd/debug/DebugDoorStop.java @@ -0,0 +1,29 @@ +package com.iflytop.gd.app.cmd.debug; + +import com.iflytop.gd.app.core.BaseCommandHandler; +import com.iflytop.gd.app.model.dto.CmdDTO; +import com.iflytop.gd.app.service.DeviceCommandService; +import com.iflytop.gd.common.annotation.CommandMapping; +import com.iflytop.gd.common.cmd.CommandFuture; +import com.iflytop.gd.common.cmd.DeviceCommand; +import com.iflytop.gd.common.cmd.DeviceCommandGenerator; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * 门电机 停止移动 + */ +@Slf4j +@Component +@RequiredArgsConstructor +@CommandMapping("debug_door_stop") +public class DebugDoorStop extends BaseCommandHandler { + private final DeviceCommandService deviceCommandService; + @Override + public void handle(CmdDTO cmdDTO) throws Exception { + DeviceCommand deviceCommand = DeviceCommandGenerator.doorStop(); + CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); + commandWait(deviceCommandFuture); + } +}