From 0cbee75268be328b0ac969360969c464217a94a2 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期四, 21 九月 2023 16:32:44 +0800
Subject: [PATCH] 设备健康
---
ard-work/src/main/java/com/ruoyi/health/controller/HealthController.java | 33 +++++++++++++++++++--------------
1 files changed, 19 insertions(+), 14 deletions(-)
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 9fd511f..4783e76 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
@@ -296,7 +296,7 @@
@PreAuthorize("@ss.hasPermi('sy:syCar:getTrend')")
@ApiOperation("鑾峰彇鏌愭补浜曚竴娈垫椂闂寸殑娴嬮噺瓒嬪娍")
@GetMapping("getTrend")
- public Results getTrend(GetTrendParam getTrendParam){
+ public JSONObject getTrend(GetTrendParam getTrendParam){
String url = configService.getHealth();
Map<String , Object> map = new HashMap<String , Object>();
map.put("MeasureKey", getTrendParam.getMeasureKey());
@@ -305,29 +305,34 @@
JSONObject j = new JSONObject();
String result = ARDSoapUtil.postSoapResult(url ,"GetTrend" , map);
if ("".equals(result)){
- return Results.succeed("娌℃湁娴嬬偣淇℃伅");
+ j.put("msg", "娌℃湁娴嬬偣淇℃伅");
+ j.put("code", 500);
}
Map<String,Object> mapResult = (Map<String, Object>) JSON.parse((String)result);
if ( (int) mapResult.get("code") == 200){
j.put("code", mapResult.get("code"));
List<Map<String , Object>> listResult = (List<Map<String, Object>>)JSON.parse((String)mapResult.get("resdata"));
- for(int i = 0 ; i<listResult.size(); i++){
- Map<String , Object> mapTemp = listResult.get(i);
- int id = (Integer)mapTemp.get("id"); //涓婚敭id
- BigDecimal value = (BigDecimal)mapTemp.get("Value"); //鏁板��
- String measureStr = (String)mapTemp.get("MeasureDate"); //娴嬮噺鏃堕棿
- measureStr = measureStr.substring(measureStr.indexOf("(")+1, measureStr.indexOf(")",2));
- SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- String measureDate = f.format(Long.valueOf(measureStr));
- mapTemp.put("MeasureDate", measureDate);
- j.put(id +"" , mapTemp);
+ if(listResult.size()>0){
+ for(int i = 0 ; i<listResult.size(); i++){
+ Map<String , Object> mapTemp = listResult.get(i);
+ int id = (Integer)mapTemp.get("id"); //涓婚敭id
+ BigDecimal value = (BigDecimal)mapTemp.get("Value"); //鏁板��
+ String measureStr = (String)mapTemp.get("MeasureDate"); //娴嬮噺鏃堕棿
+ measureStr = measureStr.substring(measureStr.indexOf("(")+1, measureStr.indexOf(")",2));
+ SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ String measureDate = f.format(Long.valueOf(measureStr));
+ mapTemp.put("MeasureDate", measureDate);
+ j.put(id +"" , mapTemp);
+ }
+ }else {
+ j.put("msg","鏃犳暟鎹�");
}
}else{
//閿欒鎻愮ず
- j.put("errmsg", mapResult.get("errmsg"));
+ j.put("msg", mapResult.get("errmsg"));
j.put("code", mapResult.get("code"));
}
- return Results.succeed(j);
+ return j;
}
@PreAuthorize("@ss.hasPermi('sy:syCar:getWaveDataByIndex')")
--
Gitblit v1.9.3