main
周文涛 2 years ago
parent 6a7527774d
commit b62a92b7cb

@ -31,13 +31,14 @@ public class LoadCelueInit implements ApplicationRunner{
IZxCelueService zxCelueService; IZxCelueService zxCelueService;
@Override @Override
public void run(ApplicationArguments args) throws Exception { public void run(ApplicationArguments args) throws Exception {
Thread.sleep(5000L);
//获取网关的数据,同步到数据库中 //获取网关的数据,同步到数据库中
String gateway_5lqh = DevConstant.gateway.gateway_5lqh;//5楼网关 String gateway_5lqh = DevConstant.gateway.gateway_5lqh;//5楼网关
String format = String.format("{\"serial\":\"%s\",\"productId\":\"\",\"methodName\":\"celueListQuery\",\"inputData\":{\"devid\":\"%s\"}}", gateway_5lqh,gateway_5lqh); String format = String.format("{\"serial\":\"%s\",\"productId\":\"\",\"methodName\":\"celueListQuery\",\"inputData\":{\"devid\":\"%s\"}}", gateway_5lqh,gateway_5lqh);
JSONObject requestBody = JSONObject.parseObject(format); JSONObject requestBody = JSONObject.parseObject(format);
/*JSONObject responseBody = IotUtils.postApi(IotApiEnum.getPathByText("向设备发送方法"), requestBody); JSONObject responseBody = IotUtils.postApi(IotApiEnum.getPathByText("向设备发送方法"), requestBody);
log.info(responseBody.toJSONString());*/ log.info(responseBody.toJSONString());
JSONObject responseBody = JSONObject.parseObject("{\"code\":\"0\",\"data\":{\"outputData\":{\"devid\":\"0cefafd605f7\",\"code\":1,\"list\":[{\"devid\":\"3381bbfeffea3590\",\"triggereTime\":\"20 18 * * 1,4,6\",\"name\":\"策略1\",\"action\":\"light00001.light.controlLight.ctrl_ch0_status=\\\"0\\\"&&chazuo000001.plug.controlPlug.ctrl_ch0_status=\\\"0\\\"\",\"startTime\":\"2023-11-12 10:00:00\",\"endTime\":\"2023-11-12 11:30:00\",\"celueid\":\"100000000001\"},{\"devid\":\"0cefafd605f7\",\"triggerCondition\":\"body0001.body_exist.status.report_status=\\\"0\\\"##900\",\"name\":\"策略2\",\"action\":\"light00001.light.controlLight.ctrl_ch0_status=\\\"0\\\"&&chazuo000001.plug.controlPlug.ctrl_ch0_status=\\\"0\\\"\",\"startTime\":\"2023-11-12 10:00:00\",\"endTime\":\"2023-11-12 11:30:00\",\"celueid\":\"100000000002\"},{\"devid\":\"0cefafd605f7\",\"triggereTime\":\"20 18 * * 1,4,6\",\"name\":\"策略3\",\"action\":\"e826ecfeff81f68c.light.controlLight.ctrl_ch0_status=\\\"0\\\"\",\"startTime\":\"2023-09-12 10:00:00\",\"endTime\":\"2023-09-30 11:30:00\",\"celueid\":\"100000000003\"}]}}}\n"); //JSONObject responseBody = JSONObject.parseObject("{\"code\":\"0\",\"data\":{\"outputData\":{\"devid\":\"0cefafd605f7\",\"code\":1,\"list\":[{\"devid\":\"3381bbfeffea3590\",\"triggereTime\":\"20 18 * * 1,4,6\",\"name\":\"策略1\",\"action\":\"light00001.light.controlLight.ctrl_ch0_status=\\\"0\\\"&&chazuo000001.plug.controlPlug.ctrl_ch0_status=\\\"0\\\"\",\"startTime\":\"2023-11-12 10:00:00\",\"endTime\":\"2023-11-12 11:30:00\",\"celueid\":\"100000000001\"},{\"devid\":\"0cefafd605f7\",\"triggerCondition\":\"body0001.body_exist.status.report_status=\\\"0\\\"##900\",\"name\":\"策略2\",\"action\":\"light00001.light.controlLight.ctrl_ch0_status=\\\"0\\\"&&chazuo000001.plug.controlPlug.ctrl_ch0_status=\\\"0\\\"\",\"startTime\":\"2023-11-12 10:00:00\",\"endTime\":\"2023-11-12 11:30:00\",\"celueid\":\"100000000002\"},{\"devid\":\"0cefafd605f7\",\"triggereTime\":\"20 18 * * 1,4,6\",\"name\":\"策略3\",\"action\":\"e826ecfeff81f68c.light.controlLight.ctrl_ch0_status=\\\"0\\\"\",\"startTime\":\"2023-09-12 10:00:00\",\"endTime\":\"2023-09-30 11:30:00\",\"celueid\":\"100000000003\"}]}}}\n");
JSONObject data = responseBody.getJSONObject("data"); JSONObject data = responseBody.getJSONObject("data");
if (data!=null) { if (data!=null) {
JSONObject outputData = data.getJSONObject("outputData"); JSONObject outputData = data.getJSONObject("outputData");

Loading…
Cancel
Save