|
|
@ -1028,6 +1028,38 @@ private VideoController videoController; |
|
|
|
|
|
|
|
return getAjaxResult(deviceId, functionId, props); |
|
|
|
|
|
|
|
} |
|
|
|
@ApiOperation("设备功能调用") |
|
|
|
@PostMapping("/functions2/{deviceId}/{functionId}") |
|
|
|
public AjaxResult invokedFunction2( |
|
|
|
@PathVariable String deviceId, |
|
|
|
@PathVariable String functionId, |
|
|
|
@RequestBody HashMap<String, Object> props) throws HttpException, IOException { |
|
|
|
//public AjaxResult invokedFunction(@PathVariable String deviceId,@PathVariable String functionId,@RequestBody HashMap<String, Object> props,int operType) throws HttpException, IOException { todo
|
|
|
|
if (!StringUtils.hasText(deviceId) || !StringUtils.hasText(functionId)) { |
|
|
|
return AjaxResult.error(UniversalEnum.DEVICE_NOT_CONNECTED.getValue()); |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
OkHttp okHttp = new OkHttp(); |
|
|
|
|
|
|
|
RequestParams requestParams = new RequestParams(props); |
|
|
|
|
|
|
|
|
|
|
|
Response response // 请求响应
|
|
|
|
= okHttp |
|
|
|
.url(iotAddress + UniversalEnum.DEVICE_FUNCTION_CALL.getValue() + deviceId + UniversalEnum.SLASH.getValue() + functionId) // 请求地址
|
|
|
|
.data(requestParams) |
|
|
|
.post(); // 请求方法
|
|
|
|
if (response.body() != null) { |
|
|
|
return AjaxResult.success(); |
|
|
|
} |
|
|
|
return AjaxResult.error(); |
|
|
|
} catch (Exception e) { |
|
|
|
return AjaxResult.error(UniversalEnum.REQUEST_FAILED.getValue()); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public AjaxResult getAjaxResult(String deviceId, String functionId, HashMap<String, Object> props) { |
|
|
|