Commit 60b854e9 authored by yangyang's avatar yangyang

大屏数据格式转换

parent f12fde25
...@@ -14,6 +14,7 @@ import org.springframework.util.CollectionUtils; ...@@ -14,6 +14,7 @@ import org.springframework.util.CollectionUtils;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -110,9 +111,13 @@ public class EnergyAccessServiceImpl implements EnergyAccessService { ...@@ -110,9 +111,13 @@ public class EnergyAccessServiceImpl implements EnergyAccessService {
String oldName = ""; String oldName = "";
JSONObject jsonObject = (JSONObject) result; JSONObject jsonObject = (JSONObject) result;
String rate = jsonObject.getString("rate"); String rate = jsonObject.getString("rate");
String newRate = "";
if (StringUtils.isNotEmpty(rate)) { if (StringUtils.isNotEmpty(rate)) {
jsonObject.put("rate", rate.replace("%", "")); newRate = rate.replace("%", "");
jsonObject.put("rate", newRate);
} }
jsonObject.put("seriesData", StringUtils.isNotEmpty(newRate) ? Arrays.asList(Double.parseDouble(newRate)) : 0D);
jsonObject.put("axisData", Arrays.asList("RATE"));
if ("1".equals(tp)) { if ("1".equals(tp)) {
oldName = jsonObject.getString("station_name"); oldName = jsonObject.getString("station_name");
jsonObject.remove("station_name"); jsonObject.remove("station_name");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment