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

@ -35,8 +35,9 @@ public class LoadCelueInit implements ApplicationRunner{
String gateway_5lqh = DevConstant.gateway.gateway_5lqh;//5楼网关
String format = String.format("{\"serial\":\"%s\",\"productId\":\"\",\"methodName\":\"celueListQuery\",\"inputData\":{\"devid\":\"%s\"}}", gateway_5lqh,gateway_5lqh);
JSONObject requestBody = JSONObject.parseObject(format);
JSONObject responseBody = IotUtils.postApi(IotApiEnum.getPathByText("向设备发送方法"), requestBody);
log.info(responseBody.toJSONString());
/*JSONObject responseBody = IotUtils.postApi(IotApiEnum.getPathByText("向设备发送方法"), requestBody);
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 data = responseBody.getJSONObject("data");
if (data!=null) {
JSONObject outputData = data.getJSONObject("outputData");
@ -56,6 +57,8 @@ public class LoadCelueInit implements ApplicationRunner{
}
}
zxCelue.setDevid(String.join(",",devidList));
//获取状态
zxCelue.setStatus(IotUtils.getCelueStatus(zxCelue.getCelueid()));
}
//更新库表
zxCelueService.saveOrUpdateBatch(zxCelues);

@ -110,6 +110,29 @@ public class IotUtils {
return false;
}
/**
*
* @param celueId id
* @return 1-,0-
*/
public static String getCelueStatus(String celueId){
String str="{\"serial\":\""+serial+"\",\"productId\":\"\",\"methodName\":\"celueStatusQuery\",\"inputData\":{\"devid\":\""+serial+"\",\"celueid\":\""+celueId+"\"}}";
JSONObject requestBody = JSONObject.parseObject(str);
JSONObject responseBody = IotUtils.getApi(IotApiEnum.getPathByText("查询方法历史数据"), requestBody);
JSONObject data = responseBody.getJSONObject("data");
try {
if (data!=null) {
JSONObject outputData = data.getJSONObject("outputData");
if (outputData!=null) {
return outputData.getString("status");
}
}
}catch (Exception e){
throw new BusinessException(e.getMessage());
}
return "0";
}
/**
*
* @param celueId id

@ -239,6 +239,8 @@ function loadTable(){
contentType: 'application/json;charset=utf-8',
success: function(res){
console.log(res)
},error:function (res){
layer.msg('更改失败,'+res.message, {icon: 1});
}
});
console.log(id)

Loading…
Cancel
Save