10 changed files with 204 additions and 148 deletions
-
2src/main/java/com/qyft/gd/common/result/CMDResultCode.java
-
2src/main/java/com/qyft/gd/config/WebSocketServer.java
-
36src/main/java/com/qyft/gd/controller/directive/DirectiveController.java
-
16src/main/java/com/qyft/gd/model/dto/directive/DirectiveDto.java
-
2src/main/java/com/qyft/gd/model/vo/ExecutionResult.java
-
15src/main/java/com/qyft/gd/model/vo/WebsocketResult.java
-
152src/main/java/com/qyft/gd/service/CMDService.java
-
9src/main/java/com/qyft/gd/service/DirectiveService.java
-
18src/main/java/com/qyft/gd/service/impl/DirectiveServiceImpl.java
@ -1,4 +1,4 @@ |
|||||
package com.qyft.gd.service; |
|
||||
|
package com.qyft.gd.config; |
||||
|
|
||||
|
|
||||
import jakarta.websocket.*; |
import jakarta.websocket.*; |
@ -1,36 +0,0 @@ |
|||||
package com.qyft.gd.controller.directive; |
|
||||
|
|
||||
import com.qyft.gd.model.dto.directive.DirectiveDto; |
|
||||
import com.qyft.gd.service.DirectiveService; |
|
||||
import com.qyft.gd.system.common.result.Result; |
|
||||
import com.qyft.gd.system.service.UserService; |
|
||||
import io.swagger.v3.oas.annotations.Operation; |
|
||||
import io.swagger.v3.oas.annotations.tags.Tag; |
|
||||
import jakarta.annotation.Resource; |
|
||||
import lombok.RequiredArgsConstructor; |
|
||||
import lombok.extern.slf4j.Slf4j; |
|
||||
import org.springframework.web.bind.annotation.PostMapping; |
|
||||
import org.springframework.web.bind.annotation.RequestBody; |
|
||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||
import org.springframework.web.bind.annotation.RestController; |
|
||||
|
|
||||
/** |
|
||||
* 指令控制器 |
|
||||
*/ |
|
||||
@Tag(name = "指令") |
|
||||
@RestController |
|
||||
@RequestMapping("/api/directive") |
|
||||
@RequiredArgsConstructor |
|
||||
@Slf4j |
|
||||
public class DirectiveController { |
|
||||
|
|
||||
@Resource |
|
||||
private DirectiveService directiveService; |
|
||||
|
|
||||
@Operation(summary = "发送指令") |
|
||||
@PostMapping("/sendDirective") |
|
||||
public Result<String> sendDirective(@RequestBody DirectiveDto dto) { |
|
||||
directiveService.sendDirective(dto); |
|
||||
return Result.success(); |
|
||||
} |
|
||||
} |
|
@ -1,16 +0,0 @@ |
|||||
package com.qyft.gd.model.dto.directive; |
|
||||
|
|
||||
import com.qyft.gd.enums.DirectiveTypeEnum; |
|
||||
import io.swagger.v3.oas.annotations.media.Schema; |
|
||||
import lombok.Data; |
|
||||
|
|
||||
@Schema(name = "指令数据") |
|
||||
@Data |
|
||||
public class DirectiveDto { |
|
||||
|
|
||||
@Schema(description = "指令类型") |
|
||||
private DirectiveTypeEnum type; |
|
||||
|
|
||||
@Schema(description = "指令配置") |
|
||||
private String option; |
|
||||
} |
|
@ -0,0 +1,15 @@ |
|||||
|
package com.qyft.gd.model.vo; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class WebsocketResult { |
||||
|
/** |
||||
|
* 推送类型(指令 cmd,报警 warn ,状态 status) |
||||
|
*/ |
||||
|
private String type; |
||||
|
/** |
||||
|
* 执行结果 |
||||
|
*/ |
||||
|
private ExecutionResult data; |
||||
|
} |
@ -1,9 +0,0 @@ |
|||||
package com.qyft.gd.service; |
|
||||
|
|
||||
|
|
||||
import com.qyft.gd.model.dto.directive.DirectiveDto; |
|
||||
|
|
||||
public interface DirectiveService { |
|
||||
|
|
||||
void sendDirective(DirectiveDto dto); |
|
||||
} |
|
@ -1,18 +0,0 @@ |
|||||
package com.qyft.gd.service.impl; |
|
||||
|
|
||||
import com.qyft.gd.model.dto.directive.DirectiveDto; |
|
||||
import com.qyft.gd.service.DirectiveService; |
|
||||
import lombok.RequiredArgsConstructor; |
|
||||
import org.springframework.stereotype.Service; |
|
||||
|
|
||||
/** |
|
||||
* 指令实现类 |
|
||||
*/ |
|
||||
@Service |
|
||||
@RequiredArgsConstructor |
|
||||
public class DirectiveServiceImpl implements DirectiveService { |
|
||||
@Override |
|
||||
public void sendDirective(DirectiveDto dto) { |
|
||||
// 发送指令 |
|
||||
} |
|
||||
} |
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue