|
|
@ -63,8 +63,15 @@ public class DcDeviceController extends BaseController { |
|
|
|
@Resource |
|
|
|
private IDcDeviceService dcDeviceService; |
|
|
|
|
|
|
|
/* |
|
|
|
@Value("${iot.address}") |
|
|
|
private String iotAddress; |
|
|
|
*/ |
|
|
|
private static String iotAddress; |
|
|
|
@Value("${iot.address}") |
|
|
|
public void setIotAddress(String url) { |
|
|
|
iotAddress = url; |
|
|
|
} |
|
|
|
|
|
|
|
@Resource |
|
|
|
private BroadcastController broadcastController; |
|
|
@ -405,7 +412,7 @@ public class DcDeviceController extends BaseController { |
|
|
|
parameter.put("deviceType","15"); |
|
|
|
parameter.put("endStakeMark",endStakeMark); |
|
|
|
parameter.put("startStakeMark",startStakeMark); |
|
|
|
// parameter.put("deviceState","1");
|
|
|
|
parameter.put("deviceState","1"); |
|
|
|
// 创建一个映射来存储按小时汇总的数据
|
|
|
|
Map<String, Double> allDevicesHourlyAggregates = new TreeMap<>(); |
|
|
|
|
|
|
@ -471,7 +478,7 @@ public class DcDeviceController extends BaseController { |
|
|
|
parameters.put("deviceType", "15"); |
|
|
|
parameters.put("endStakeMark", endStakeMark); |
|
|
|
parameters.put("startStakeMark", startStakeMark); |
|
|
|
// parameters.put("deviceState", "1");
|
|
|
|
parameters.put("deviceState", "1"); |
|
|
|
|
|
|
|
// List<String> propertyIds = Arrays.asList("visibility", "wetSlipperyCoefficient", "waterFilmIceSnowValue");
|
|
|
|
//generatingPower 发电功率 //"cumulativeElectricityConsumptionInTheYear", //当年累计用电量
|
|
|
@ -1385,6 +1392,7 @@ public class DcDeviceController extends BaseController { |
|
|
|
public AjaxResult ConfluenceAreaEarlyWarningDeviceBatteryLowWarning() throws HttpException, IOException, InterruptedException { |
|
|
|
DcDevice dcDevice = new DcDevice(); |
|
|
|
dcDevice.setDeviceType(UniversalEnum.FIFTEEN.getValue()); |
|
|
|
dcDevice.setDeviceState(UniversalEnum.ONE.getValue()); |
|
|
|
IDcDeviceService dcDeviceService = SpringUtils.getBean(IDcDeviceService.class); |
|
|
|
|
|
|
|
List<DcDevice> dcDeviceList = dcDeviceService.listDevice(dcDevice); |
|
|
@ -1415,7 +1423,24 @@ public class DcDeviceController extends BaseController { |
|
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
|
jsonObject.put("devices", devices); |
|
|
|
jsonObject.put("functions", functions); |
|
|
|
return batchInvokedFunction(jsonObject); |
|
|
|
return batchInvokedFunction2(jsonObject); |
|
|
|
} |
|
|
|
public AjaxResult batchInvokedFunction2(@RequestBody Map<String, Object> props) throws HttpException, IOException, InterruptedException { |
|
|
|
ArrayList<JSONObject> devices = (ArrayList<JSONObject>) props.get("devices"); |
|
|
|
ArrayList<JSONObject> functions = (ArrayList<JSONObject>) props.get("functions"); |
|
|
|
JSONArray resultArray = new JSONArray(); |
|
|
|
for (Object dev : devices) { |
|
|
|
JSONObject device = (JSONObject) JSON.toJSON(dev); |
|
|
|
String iotDeviceId = device.getString("iotDeviceId"); |
|
|
|
for (Object function : functions) { |
|
|
|
JSONObject functionJSONObject = (JSONObject) JSON.toJSON(function); |
|
|
|
String functionId = functionJSONObject.getString("functionId"); |
|
|
|
JSONObject jsonObject = functionJSONObject.getJSONObject("params") != null ? functionJSONObject.getJSONObject("params") : new JSONObject(); |
|
|
|
JSONObject result = getResult(device, iotDeviceId, functionId, jsonObject); |
|
|
|
resultArray.add(result); |
|
|
|
} |
|
|
|
} |
|
|
|
return AjaxResult.success(resultArray); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|