zhangnaisong
2024-03-04 55d5a7502627bf794adbbdeb041e0274a99e304c
无人机加入开关提交
已修改2个文件
21 ■■■■ 文件已修改
ard-work/src/main/java/com/ruoyi/device/uav/controller/ArdUavController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/device/uav/service/UavService.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/device/uav/controller/ArdUavController.java
@@ -8,6 +8,7 @@
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
@@ -31,8 +32,14 @@
    @Autowired
    private UavService uavService;
    @Value("${uav.enabled}")
    private Boolean uavEnabled;
    @PostConstruct
    public void created() {
        if(!uavEnabled){//无人机加入开关
            return;
        }
        this.uavService.login();
    }
ard-work/src/main/java/com/ruoyi/device/uav/service/UavService.java
@@ -66,8 +66,14 @@
    @Autowired
    private RedisCache redisCache;
    @Value("${uav.enabled}")
    private Boolean uavEnabled;
    @PostConstruct
    public void created() {
        if(!uavEnabled){//无人机加入开关
            return;
        }
        getUavConfig();
        this.login();
@@ -76,14 +82,14 @@
    }
    private void getUavConfig() {
        this.host = ConfigUtils.getConfigValue("uav_host");
        /*this.host = ConfigUtils.getConfigValue("uav_host");
        this.username = ConfigUtils.getConfigValue("uav_username");
        this.password = ConfigUtils.getConfigValue("uav_password");
        this.salt = ConfigUtils.getConfigValue("uav_salt");
        /*this.host = "http://112.98.126.2:6100/";
        this.salt = ConfigUtils.getConfigValue("uav_salt");*/
        this.host = "http://112.98.126.2:6100/";
        this.username = "znstest";
        this.password = "znstest";
        this.salt = "0123456789012345";*/
        this.salt = "0123456789012345";
        if (StringUtils.isEmpty(this.host) || StringUtils.isEmpty(this.username) || StringUtils.isEmpty(this.password) || StringUtils.isEmpty(this.salt)) {
            throw new RuntimeException("无人机参数配置缺失:");
        }