From 7c787762010464025c45ba0adf285ac7c333b62e Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期三, 13 九月 2023 17:25:42 +0800
Subject: [PATCH] 设备健康列表
---
ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java | 4 ++--
ard-work/src/main/java/com/ruoyi/health/client/EquipmentsHealthClient.java | 30 ++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/health/client/EquipmentsHealthClient.java b/ard-work/src/main/java/com/ruoyi/health/client/EquipmentsHealthClient.java
index 6c58c28..421a75b 100644
--- a/ard-work/src/main/java/com/ruoyi/health/client/EquipmentsHealthClient.java
+++ b/ard-work/src/main/java/com/ruoyi/health/client/EquipmentsHealthClient.java
@@ -126,4 +126,34 @@
return new HashMap();
}
}
+
+ public static Map<String,Object> GetEquipmentAlertInfo(String url,String token,Integer id){
+ OkHttpClient okHttpClient = new OkHttpClient();
+// MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
+// RequestBody formBody = RequestBody.create(mediaType, "");
+ RequestBody formBody = new Builder()
+ .add("partid", String.valueOf(id))
+ .build();
+ Request request = new Request.Builder().url(url).post(formBody).addHeader("roadflow-token",token).build();
+ Response response = null;
+ try {
+ response = okHttpClient.newCall(request).execute();
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+
+ ResponseBody responseBody = response.body();
+
+ try {
+ String message = responseBody.string();
+ System.out.println(message);
+ Map<String,Object> result = (Map<String, Object>) JSON.parse(message);
+ return result;
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ return new HashMap();
+ }
+ }
}
diff --git a/ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java b/ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java
index 4f02ab1..b4f8d2f 100644
--- a/ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java
+++ b/ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java
@@ -340,8 +340,8 @@
String tokenUrl = url+"/RoadFlowApi/Home/ValidLogin";
Map<String, Object> loginResult = EquipmentsHealthClient.getToken(tokenUrl, account, password);
String token = (String) ((Map<String, Object>) ((Map<String, Object>) loginResult.get("data")).get("data")).get("token");
- String GetPartsAlertLeveUrl = url + "/RoadFlowApi/ZX/MeasureData/GetEquipmentAlertInfo";
- Map<String, Object> map = EquipmentsHealthClient.GetPartsAlertLeve(GetPartsAlertLeveUrl, token,id);
+ String GetEquipmentAlertInfoUrl = url + "/RoadFlowApi/ZX/MeasureData/GetEquipmentAlertInfo";
+ Map<String, Object> map = EquipmentsHealthClient.GetEquipmentAlertInfo(GetEquipmentAlertInfoUrl, token,id);
return Results.succeed(map);
}
}
--
Gitblit v1.9.3