zhangjian
2023-11-01 83f9b165d1823e9cd59da1be57f5ce99c1caf0d8
ard-work/src/main/java/com/ruoyi/device/uav/service/UavService.java
@@ -26,8 +26,8 @@
@Service
@Slf4j(topic = "uav")
public class UavService {
    public static final String USERNAME = "ardbailu";//用户名
    public static final String PASSWORD = "ardkj12345";//密码
    public static final String USERNAME = "kaifabailu";//用户名
    public static final String PASSWORD = "ardkj@2014";//密码
    public static final String SALT = "0123456789012345";//盐
    private Map uavUser;//登录的用户信息
@@ -54,7 +54,8 @@
        //执行method
        this.getToken();//获取token验证,验证token有效性
        try {
            res = (String) requestMethod.invoke(this.uavClient, url, this.getToken(), data);
            String token = this.getToken();
            res = (String) requestMethod.invoke(this.uavClient, url, token, data);
        } catch (IllegalAccessException e) {
            System.out.println("doUavRequest 访问失败" + e.getMessage());
        } catch (InvocationTargetException e) {
@@ -76,6 +77,7 @@
        //验证token有效性
        try {
            String res = uavClient.GET("manage/api/v1/devices", token, "{}");
            System.out.println(res);
        } catch (ForestNetworkException fe) {
            if (fe.getStatusCode() == 401) {//token失效,重新登录
                this.login();
@@ -102,11 +104,8 @@
        } catch (ForestRuntimeException e) {
            log.error("无人机连接超时" + e.getMessage());
        } catch (JsonMappingException e) {
            e.printStackTrace();
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }