parent
ac98d3d8fb
commit
448c49d735
@ -0,0 +1,38 @@
|
|||||||
|
package com.example.zxweb.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.example.zxweb.common.api.vo.Result;
|
||||||
|
import com.example.zxweb.common.constant.enums.IotApiEnum;
|
||||||
|
import com.example.zxweb.utils.AssertUtils;
|
||||||
|
import com.example.zxweb.utils.IotUtils;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description
|
||||||
|
* @Author ZhouWenTao
|
||||||
|
* @Date 2023/9/12 10:28
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/gateway")
|
||||||
|
@Slf4j
|
||||||
|
@Api(tags = "网关设备管理")
|
||||||
|
public class GatewayController {
|
||||||
|
/**
|
||||||
|
* 获取网关策略列表
|
||||||
|
* @param devid 网关设备id
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/celueListQuery")
|
||||||
|
public Result<?> celueListQuery(@RequestParam(value = "devid")String devid){
|
||||||
|
AssertUtils.notEmpty(devid,"请输入-[devid]");
|
||||||
|
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);
|
||||||
|
return Result.OK(responseBody);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.example.zxweb.vo;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description
|
||||||
|
* @Author ZhouWenTao
|
||||||
|
* @Date 2023/9/12 11:28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class IotRquestBodyPVO implements Serializable {
|
||||||
|
@ApiModelProperty(value = "serial")
|
||||||
|
private String serial;
|
||||||
|
@ApiModelProperty(value = "productId")
|
||||||
|
private String productId;
|
||||||
|
@ApiModelProperty(value = "方法名")
|
||||||
|
private String methodName;
|
||||||
|
@ApiModelProperty(value = "方法执行参数")
|
||||||
|
private JSONObject inputData;
|
||||||
|
|
||||||
|
public IotRquestBodyPVO() {}
|
||||||
|
|
||||||
|
public IotRquestBodyPVO(String serial, String productId, String methodName, JSONObject inputData) {
|
||||||
|
this.serial = serial;
|
||||||
|
this.productId = productId;
|
||||||
|
this.methodName = methodName;
|
||||||
|
this.inputData = inputData;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue