|
|
|
@ -46,11 +46,15 @@ public class GatewayController {
|
|
|
|
|
String format = String.format("{\"serial\":\"%s\",\"productId\":\"\",\"methodName\":\"celueListQuery\",\"inputData\":{\"devid\":\"%s\"}}", devid,devid);
|
|
|
|
|
JSONObject requestBody = JSONObject.parseObject(format);
|
|
|
|
|
JSONObject responseBody = IotUtils.postApi(IotApiEnum.getPathByText("向设备发送方法"), requestBody);
|
|
|
|
|
JSONObject data = requestBody.getJSONObject("data");
|
|
|
|
|
//JSONObject responseBody= JSONObject.parseObject("{\t\"code\":\"0\",\t\"data\":{\t\t\"outputData\":{\t\t\t\"devid\":\"0cefafd605f7\",\t\t\t\"code\":1,\t\t\t\"list\":[\t\t\t\t{\t\t\t\t\t\"devid\":\"0cefafd605f7\",\t\t\t\t\t\"triggerCondition\":\"body0001.body_exist.status.report_status=\\\"0\\\"##900\",\t\t\t\t\t\"name\":\"策略1\",\t\t\t\t\t\"action\":\"light00001.light.controlLight.ctrl_ch0_status=\\\"0\\\"&&chazuo000001.plug.controlPlug.ctrl_ch0_status=\\\"0\\\"\",\t\t\t\t\t\"startTime\":\"2023-11-12 10:00:00\",\t\t\t\t\t\"endTime\":\"2023-11-12 11:30:00\",\t\t\t\t\t\"celueid\":\"100000000001\"\t\t\t\t},\t\t\t\t{\t\t\t\t\t\"devid\":\"0cefafd605f7\",\t\t\t\t\t\"triggerCondition\":\"body0001.body_exist.status.report_status=\\\"0\\\"##900\",\t\t\t\t\t\"name\":\"策略2\",\t\t\t\t\t\"action\":\"light00001.light.controlLight.ctrl_ch0_status=\\\"0\\\"&&chazuo000001.plug.controlPlug.ctrl_ch0_status=\\\"0\\\"\",\t\t\t\t\t\"startTime\":\"2023-11-12 10:00:00\",\t\t\t\t\t\"endTime\":\"2023-11-12 11:30:00\",\t\t\t\t\t\"celueid\":\"100000000002\"\t\t\t\t}\t\t\t]\t\t}\t}}");
|
|
|
|
|
JSONObject data = responseBody.getJSONObject("data");
|
|
|
|
|
if (data!=null) {
|
|
|
|
|
JSONObject outputData = data.getJSONObject("outputData");
|
|
|
|
|
if (outputData!=null) {
|
|
|
|
|
List<JSONObject> list = outputData.getJSONArray("list").toJavaList(JSONObject.class);
|
|
|
|
|
if (pageNum==0) {
|
|
|
|
|
pageNum=1;
|
|
|
|
|
}
|
|
|
|
|
List<JSONObject> subList = list.stream().skip((long) (pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
|
|
|
|
|
outputData.put("list",subList);
|
|
|
|
|
outputData.put("total",list.size());
|
|
|
|
|