zhangnaisong
2024-01-29 6d754022e36ce1b83c8f23bbd82178258304d493
ard-work/src/main/java/com/ruoyi/device/uav/service/UavService.java
@@ -60,8 +60,6 @@
    private void getUavConfig() {
        this.host = ConfigUtils.getConfigValue("uav_host");
        this.username = ConfigUtils.getConfigValue("uav_username");
        this.password = ConfigUtils.getConfigValue("uav_password");
        this.salt = ConfigUtils.getConfigValue("uav_salt");
        if (StringUtils.isEmpty(this.host) || StringUtils.isEmpty(this.username) || StringUtils.isEmpty(this.password) || StringUtils.isEmpty(this.salt)) {
            throw new RuntimeException("无人机参数配置缺失:");
@@ -80,7 +78,7 @@
            e.printStackTrace();
        }
        //执行method
        this.getToken();//获取token验证,验证token有效性
       // this.getToken();//获取token验证,验证token有效性
        try {
            String token = this.getToken();
            res = (String) requestMethod.invoke(this.uavClient, this.host + url, token, data);
@@ -105,6 +103,7 @@
        //验证token有效性
        try {
            String res = uavClient.GET(this.host+"manage/api/v1/devices", token, "{}");
            res+="";
            //System.out.println(res);
        } catch (ForestNetworkException fe) {
            if (fe.getStatusCode() == 401) {//token失效,重新登录
@@ -127,7 +126,7 @@
        log.debug("body:" + body);
        try {
            //uavClient.GET("logout", null, "{}");
            String res = uavClient.POST(this.host+"/login", null, body);
            String res = uavClient.POST(this.host+"login", null, body);
            Map resMap = om.readValue(res, Map.class);
            if (resMap != null) {
                redisCache.setCacheMap("uav:uavUser", (Map) resMap.get("data"));