Forráskód Böngészése

Merge remote-tracking branch 'origin/dev' into dev

miloma93@163.com 3 hónapja
szülő
commit
517da37730

+ 29 - 0
src/main/java/com/sw/patroleditor/controller/LocationController.java

@@ -0,0 +1,29 @@
+package com.sw.patroleditor.controller;
+
+import com.sw.patroleditor.common.ResultData;
+import com.sw.patroleditor.service.LocationService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+/**
+ * Created by shiwn on 2024/7/26 15:07
+ */
+@Api(tags = {"标点接口"})
+@RestController
+
+@RequestMapping("location")
+public class LocationController {
+    @Resource
+    private LocationService locationService;
+
+    @ApiOperation(value = "保存点位")
+    @PostMapping("/save")
+    public ResultData save() {
+        return ResultData.success(locationService.save());
+    }
+}

+ 58 - 0
src/main/java/com/sw/patroleditor/domain/dto/AimDTO.java

@@ -0,0 +1,58 @@
+package com.sw.patroleditor.domain.dto;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * Created by shiwn on 2024/7/30 10:53
+ */
+@Data
+@TableName("aim")
+public class AimDTO {
+    private Long id;
+    /**
+     * 云台滚转角
+     */
+    private Integer roll;
+    /**
+     * 云台俯仰角
+     */
+    private Integer pitch;
+    /**
+     * 云台方位角
+     */
+    private Integer yaw;
+    /**
+     * ???
+     */
+    private Integer height;
+    /**
+     * 云台焦距
+     */
+    private Integer focus;
+    /**
+     * 云台放大倍数
+     */
+    private Integer ratio;
+    /**
+     * 云台光圈大小
+     */
+    private Integer aperture;
+
+    /**
+     * 目标框选左上角X坐标
+     */
+    private Integer topleftX;
+    /**
+     * 目标框选左上角Y坐标
+     */
+    private Integer topleftY;
+    /**
+     * 目标框选右下角X坐标
+     */
+    private Integer botrightX;
+    /**
+     * 目标框选右下角Y坐标
+     */
+    private Integer botrightY;
+}

+ 54 - 0
src/main/java/com/sw/patroleditor/domain/dto/ZoominDTO.java

@@ -0,0 +1,54 @@
+package com.sw.patroleditor.domain.dto;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * Created by shiwn on 2024/7/30 10:53
+ */
+@Data
+@TableName("zoomin")
+public class ZoominDTO {
+    private Long id;
+    /**
+     * 云台滚转角
+     */
+    private Integer roll;
+    /**
+     * 云台俯仰角
+     */
+    private Integer pitch;
+    /**
+     * 云台方位角
+     */
+    private Integer yaw;
+    /**
+     * 云台焦距
+     */
+    private Integer focus;
+    /**
+     * 云台放大倍数
+     */
+    private Integer ratio;
+    /**
+     * 云台光圈大小
+     */
+    private Integer aperture;
+
+    /**
+     * 目标框选左上角X坐标
+     */
+    private Integer topleftX;
+    /**
+     * 目标框选左上角Y坐标
+     */
+    private Integer topleftY;
+    /**
+     * 目标框选右下角X坐标
+     */
+    private Integer botrightX;
+    /**
+     * 目标框选右下角Y坐标
+     */
+    private Integer botrightY;
+}

+ 12 - 0
src/main/java/com/sw/patroleditor/mapper/AimMapper.java

@@ -0,0 +1,12 @@
+package com.sw.patroleditor.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.sw.patroleditor.domain.dto.AimDTO;
+import org.springframework.stereotype.Component;
+
+/**
+ * Created by shiwn on 2024/7/30 10:59
+ */
+@Component
+public interface AimMapper extends BaseMapper<AimDTO> {
+}

+ 12 - 0
src/main/java/com/sw/patroleditor/mapper/ZoominMapper.java

@@ -0,0 +1,12 @@
+package com.sw.patroleditor.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.sw.patroleditor.domain.dto.ZoominDTO;
+import org.springframework.stereotype.Component;
+
+/**
+ * Created by shiwn on 2024/7/30 10:58
+ */
+@Component
+public interface ZoominMapper extends BaseMapper<ZoominDTO> {
+}

+ 8 - 0
src/main/java/com/sw/patroleditor/service/LocationService.java

@@ -0,0 +1,8 @@
+package com.sw.patroleditor.service;
+
+/**
+ * Created by shiwn on 2024/7/26 15:07
+ */
+public interface LocationService {
+    int save();
+}

+ 57 - 0
src/main/java/com/sw/patroleditor/service/impl/LocationServiceImpl.java

@@ -0,0 +1,57 @@
+package com.sw.patroleditor.service.impl;
+
+import com.sw.patroleditor.component.rosBridge.RobotDataCallBack;
+import com.sw.patroleditor.component.rosBridge.RobotDataModel;
+import com.sw.patroleditor.domain.dto.AimDTO;
+import com.sw.patroleditor.domain.dto.ZoominDTO;
+import com.sw.patroleditor.service.LocationService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+/**
+ * Created by shiwn on 2024/7/26 15:08
+ */
+@Service
+public class LocationServiceImpl implements LocationService {
+    @Resource
+    private RobotDataCallBack robotDataCallBack;
+
+    /**
+     * @Description: 保存点位
+     * @Date: 2024/7/26 15:09
+     * @Author: shiwn
+     */
+    @Override
+    public int save() {
+        RobotDataModel robotDataModel = robotDataCallBack.getRobotDataModel();
+        Long id = System.currentTimeMillis();
+        AimDTO aimDTO = new AimDTO();
+        aimDTO.setId(id);
+        aimDTO.setRoll(robotDataModel.getRoll());
+        aimDTO.setPitch(robotDataModel.getPitch());
+        aimDTO.setYaw(robotDataModel.getYaw());
+//        aimDTO.setHeight();
+        aimDTO.setFocus(robotDataModel.getFocalDistance());
+        aimDTO.setRatio(robotDataModel.getRatio());
+        aimDTO.setAperture(robotDataModel.getDiaphragm());
+//        aimDTO.setTopleftX();
+//        aimDTO.setTopleftY();
+//        aimDTO.setBotrightX();
+//        aimDTO.setBotrightY();
+
+        ZoominDTO zoominDTO = new ZoominDTO();
+        zoominDTO.setId(id);
+        zoominDTO.setRoll(robotDataModel.getRoll());
+        zoominDTO.setPitch(robotDataModel.getPitch());
+        zoominDTO.setYaw(robotDataModel.getYaw());
+        zoominDTO.setFocus(robotDataModel.getFocalDistance());
+        zoominDTO.setRatio(robotDataModel.getRatio());
+        zoominDTO.setAperture(robotDataModel.getDiaphragm());
+//        zoominDTO.setTopleftX();
+//        zoominDTO.setTopleftY();
+//        zoominDTO.setBotrightX();
+//        zoominDTO.setBotrightY();
+        return 1;
+    }
+}

+ 1 - 1
src/main/resources/application-dev.properties

@@ -1,6 +1,6 @@
 ### Mysql\u6570\u636E\u5E93\u914D\u7F6E\u4FE1\u606F\uFF08\u7528\u6237\u6570\u636E\u6301\u4E45\u5316\u5B58\u50A8\uFF09
 spring.datasource.drive-class-name=com.mysql.cj.jdbc.Driver
-spring.datasource.url=jdbc:mysql://192.168.1.144:3306/bird_db_v1?serverTimezone=GMT%2B8&characterSetResults=UTF-8&characterEncoding=UTF-8&useUnicode=yes&useSSL=false
+spring.datasource.url=jdbc:mysql://192.168.1.144:3306/agvdb?serverTimezone=GMT%2B8&characterSetResults=UTF-8&characterEncoding=UTF-8&useUnicode=yes&useSSL=false
 #\u6570\u636E\u5E93\u8D26\u53F7
 spring.datasource.username=root
 #\u6570\u636E\u5E93\u8BBF\u95EE\u5BC6\u7801