From 55d5a7502627bf794adbbdeb041e0274a99e304c Mon Sep 17 00:00:00 2001
From: zhangnaisong <2434969829@qq.com>
Date: 星期一, 04 三月 2024 09:38:54 +0800
Subject: [PATCH] 无人机加入开关提交
---
ard-work/src/main/java/com/ruoyi/device/uav/controller/ArdUavController.java | 7 +++++++
ard-work/src/main/java/com/ruoyi/device/uav/service/UavService.java | 14 ++++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/device/uav/controller/ArdUavController.java b/ard-work/src/main/java/com/ruoyi/device/uav/controller/ArdUavController.java
index b04234e..3e9d4b1 100644
--- a/ard-work/src/main/java/com/ruoyi/device/uav/controller/ArdUavController.java
+++ b/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();
}
diff --git a/ard-work/src/main/java/com/ruoyi/device/uav/service/UavService.java b/ard-work/src/main/java/com/ruoyi/device/uav/service/UavService.java
index 4fc1e7a..b6391b0 100644
--- a/ard-work/src/main/java/com/ruoyi/device/uav/service/UavService.java
+++ b/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("鏃犱汉鏈哄弬鏁伴厤缃己澶�:");
}
--
Gitblit v1.9.3