包头bug修复
This commit is contained in:
parent
8505fd410a
commit
913d812c9b
@ -140,19 +140,22 @@ public class ElectricalTask {
|
||||
log.info("电箱实时数据" + execute.body());
|
||||
JSONObject result = JSONObject.parseObject(execute.body()).getJSONObject("result");
|
||||
JSONObject metric = result.getJSONObject("metric");
|
||||
String temperatures = String.format("%.1f", Double.parseDouble(result.getJSONArray("temperatures").getJSONObject(0).getString("temperature")));
|
||||
ElectricalData electricalData = new ElectricalData(devId,
|
||||
metric.getString("modified"),
|
||||
String.format("%.1f", Double.parseDouble(metric.getString("voltage_a"))),
|
||||
String.format("%.1f", Double.parseDouble(metric.getString("voltage_b"))),
|
||||
String.format("%.1f", Double.parseDouble(metric.getString("voltage_c"))),
|
||||
String.format("%.1f", Double.parseDouble(metric.getString("current_a"))),
|
||||
String.format("%.1f", Double.parseDouble(metric.getString("current_b"))),
|
||||
String.format("%.1f", Double.parseDouble(metric.getString("current_c"))),
|
||||
String.format("%.1f", Double.parseDouble(result.getJSONArray("leakages").getJSONObject(0).getString("leakage"))),
|
||||
temperatures, temperatures, temperatures,
|
||||
temperatures);
|
||||
electricalDataService.saveElectricalData(electricalData);
|
||||
JSONArray jsonArray = result.getJSONArray("temperatures");
|
||||
if (CollUtil.isNotEmpty(jsonArray)) {
|
||||
String temperatures = String.format("%.1f", Double.parseDouble(jsonArray.getJSONObject(0).getString("temperature")));
|
||||
ElectricalData electricalData = new ElectricalData(devId,
|
||||
metric.getString("modified"),
|
||||
String.format("%.1f", Double.parseDouble(metric.getString("voltage_a"))),
|
||||
String.format("%.1f", Double.parseDouble(metric.getString("voltage_b"))),
|
||||
String.format("%.1f", Double.parseDouble(metric.getString("voltage_c"))),
|
||||
String.format("%.1f", Double.parseDouble(metric.getString("current_a"))),
|
||||
String.format("%.1f", Double.parseDouble(metric.getString("current_b"))),
|
||||
String.format("%.1f", Double.parseDouble(metric.getString("current_c"))),
|
||||
String.format("%.1f", Double.parseDouble(result.getJSONArray("leakages").getJSONObject(0).getString("leakage"))),
|
||||
temperatures, temperatures, temperatures,
|
||||
temperatures);
|
||||
electricalDataService.saveElectricalData(electricalData);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user