萨达接口数据调整
This commit is contained in:
parent
26db3b59a3
commit
b3f3437432
@ -93,7 +93,7 @@ public class ElectricalTask {
|
||||
/**
|
||||
* 获取电箱情况 每5分钟触发任务
|
||||
*/
|
||||
@Scheduled(cron = "0 30 * * * ?")
|
||||
@Scheduled(cron = "0 0/1 * * * ?")
|
||||
@RequestMapping("/xmgl/task/getElectricData")
|
||||
public void getElectricData() {
|
||||
log.info("获取设备数据 每1分钟触发任务");
|
||||
@ -140,11 +140,16 @@ public class ElectricalTask {
|
||||
log.info("电箱实时数据" + execute.body());
|
||||
JSONObject result = JSONObject.parseObject(execute.body()).getJSONObject("result");
|
||||
JSONObject metric = result.getJSONObject("metric");
|
||||
String temperatures = result.getJSONArray("temperatures").getJSONObject(0).getString("temperature");
|
||||
ElectricalData electricalData = new ElectricalData(devId, metric.getString("modified"), metric.getString("voltage_a"),
|
||||
metric.getString("voltage_b"),
|
||||
metric.getString("voltage_c"), metric.getString("current_a"), metric.getString("current_b"), metric.getString("current_c"),
|
||||
result.getJSONArray("leakages").getJSONObject(0).getString("leakage"),
|
||||
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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user