From e2b395793db64ae9a118d786d6e28ffaeb667583 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期二, 12 九月 2023 11:45:35 +0800
Subject: [PATCH] 设备健康点位
---
ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java | 18 +++++++++---------
ard-work/src/main/java/com/ruoyi/health/client/EquipmentsHealthClient.java | 11 +++++------
2 files changed, 14 insertions(+), 15 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 da380b2..6c58c28 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
@@ -87,7 +87,6 @@
try {
String message = responseBody.string();
- System.out.println("////////////");
System.out.println(message);
Map<String,Object> result = (Map<String, Object>) JSON.parse(message);
return result;
@@ -98,13 +97,14 @@
}
}
- public static Map<String,Object> GetPartsAlertLeve(String url,String token){//鑾峰彇鍗曞彴娌逛簳淇℃伅鍜屾祴鐐�
+ public static Map<String,Object> GetPartsAlertLeve(String url,String token,Integer id){
OkHttpClient okHttpClient = new OkHttpClient();
- RequestBody formBody = new FormBody.Builder()
+// MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
+// RequestBody formBody = RequestBody.create(mediaType, "");
+ RequestBody formBody = new Builder()
+ .add("equipId", 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();
@@ -117,7 +117,6 @@
try {
String message = responseBody.string();
- System.out.println("////////////");
System.out.println(message);
Map<String,Object> result = (Map<String, Object>) JSON.parse(message);
return result;
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 25a597c..79c9c9e 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
@@ -3,7 +3,6 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.domain.entity.SysConfig;
-import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.health.client.EquipmentsHealthClient;
import com.ruoyi.health.param.GetFMTrendParam;
import com.ruoyi.health.param.GetTrendParam;
@@ -283,25 +282,26 @@
@PreAuthorize("@ss.hasPermi('sy:syCar:GetPartsAlertLeve')")
@ApiOperation("鑾峰彇鐐�")
@GetMapping("GetPartsAlertLeve")
- public Results GetPartsAlertLeve(){
+ public Results GetPartsAlertLeve(Integer id){
List<SysConfig> sysConfigs = configService.getAccPwd();
- String acc = null,pwd = null,hu = null;
+ String account = null,password = null,url = null;
for (int i = 0; i < sysConfigs.size(); i++) {
SysConfig sysConfig = sysConfigs.get(i);
if("eqHealthUrl".equals(sysConfig.getConfigKey())){
- hu = sysConfig.getConfigValue();
+ url = sysConfig.getConfigValue();
}
if("eqHealthAccount".equals(sysConfig.getConfigKey())){
- acc = sysConfig.getConfigValue();
+ account = sysConfig.getConfigValue();
}
if("eqHealthPassword".equals(sysConfig.getConfigKey())){
- pwd = sysConfig.getConfigValue();
+ password = sysConfig.getConfigValue();
}
}
- Map<String, Object> loginResult = EquipmentsHealthClient.getToken(hu, acc, pwd);
+ 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 = hu + "/RoadFlowApi/ZX/MeasureData/GetPartsAlertLeve";
- Map<String, Object> map = EquipmentsHealthClient.GetPartsAlertLeve(GetPartsAlertLeveUrl, token);
+ String GetPartsAlertLeveUrl = url + "/RoadFlowApi/ZX/MeasureData/GetPartsAlertLevel";
+ Map<String, Object> map = EquipmentsHealthClient.GetPartsAlertLeve(GetPartsAlertLeveUrl, token,id);
return Results.succeed(map);
}
}
--
Gitblit v1.9.3