|
@@ -0,0 +1,66 @@
|
|
|
|
+package com.sw.patroleditor.controller;
|
|
|
|
+
|
|
|
|
+import com.sw.patroleditor.common.ResultData;
|
|
|
|
+import com.sw.patroleditor.controller.api.RobotCtrlApi;
|
|
|
|
+import com.sw.patroleditor.domain.vo.RobotModelVO;
|
|
|
|
+import com.sw.patroleditor.domain.vo.RobotMoveCtrlVO;
|
|
|
|
+import com.sw.patroleditor.domain.vo.RobotSpecialCtrlVO;
|
|
|
|
+import com.sw.patroleditor.domain.vo.RobotToolCtrlVO;
|
|
|
|
+import com.sw.patroleditor.exception.ErrorCode;
|
|
|
|
+import com.sw.patroleditor.service.RobotCtrlService;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 机器人控制 controller
|
|
|
|
+ * Created by shiwn on 2021/5/12 10:28
|
|
|
|
+ */
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping("robotCtrl")
|
|
|
|
+public class RobotCtrlController implements RobotCtrlApi {
|
|
|
|
+ @Autowired
|
|
|
|
+ RobotCtrlService robotCtrlService;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @PostMapping("/specialCtrl")
|
|
|
|
+ public ResultData specialCtrl(@RequestBody RobotSpecialCtrlVO vo) {
|
|
|
|
+ boolean flag = robotCtrlService.specialCtrl(vo);
|
|
|
|
+ if (flag) {
|
|
|
|
+ return ResultData.success();
|
|
|
|
+ }
|
|
|
|
+ return ResultData.fail(ErrorCode.OPERATION_FAILED);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @PostMapping("/robotMoveCtrl")
|
|
|
|
+ public ResultData robotMoveCtrl(@RequestBody RobotMoveCtrlVO vo) {
|
|
|
|
+ boolean flag = robotCtrlService.robotMoveCtrl(vo);
|
|
|
|
+ if (flag) {
|
|
|
|
+ return ResultData.success();
|
|
|
|
+ }
|
|
|
|
+ return ResultData.fail(ErrorCode.OPERATION_FAILED);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @PostMapping("/toolCtrl")
|
|
|
|
+ public ResultData toolCtrl(@RequestBody RobotToolCtrlVO vo) {
|
|
|
|
+ boolean flag = robotCtrlService.toolCtrl(vo);
|
|
|
|
+ if (flag) {
|
|
|
|
+ return ResultData.success();
|
|
|
|
+ }
|
|
|
|
+ return ResultData.fail(ErrorCode.OPERATION_FAILED);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @PostMapping("/modelChange")
|
|
|
|
+ public ResultData modelChange(@RequestBody RobotModelVO vo) {
|
|
|
|
+ boolean flag = robotCtrlService.modelChange(vo);
|
|
|
|
+ if (flag) {
|
|
|
|
+ return ResultData.success();
|
|
|
|
+ }
|
|
|
|
+ return ResultData.fail(ErrorCode.OPERATION_FAILED);
|
|
|
|
+ }
|
|
|
|
+}
|