提交 0cb73058 authored 作者: wangqiang's avatar wangqiang

Merge remote-tracking branch 'origin/master'

......@@ -51,6 +51,9 @@ public class RemoteControlController {
@Value(value = "${apq.url.device_info}")
private String deviceInfoUrl;
@Value(value = "${apq.url.send-control-req}")
private String sendControlReqUrl;
@Resource
private InstalledProgramCache installedProgramCache;
......@@ -70,6 +73,11 @@ public class RemoteControlController {
throws IOException, ConfigParser.DuplicateSectionException, ConfigParser.NoSectionException {
Boolean hasRequest = Convert.toBool(SysConfigUtil.saveProperty("control.request", "0"), false);
if (!hasRequest) return R.error("无远程请求");
return startVncServer(minutes);
}
private R<Void> startVncServer(long minutes)
throws IOException, ConfigParser.DuplicateSectionException, ConfigParser.NoSectionException {
// 查询设备的远程ID
String remoteId = getRemoteId();
if (StrUtil.isBlank(remoteId)) return R.error("未查询到设备的远程ID");
......@@ -116,6 +124,16 @@ public class RemoteControlController {
return R.success();
}
@GetMapping(value = "send_request")
public R<Void> sendRequest(@RequestParam @NotNull Long minutes)
throws IOException, ConfigParser.DuplicateSectionException, ConfigParser.NoSectionException {
JSONObject rsp = JSONUtil.parseObj(HttpUtil.post(gateway + sendControlReqUrl,
JSONUtil.createObj().set("minutes", minutes).set("macAddress", getMacAddress()).toString()));
if (ObjectUtil.notEqual(rsp.getInt("code"), 0)) return R.error(rsp.getStr("msg"));
startVncServer(minutes);
return R.success();
}
private String getMacAddress() throws UnknownHostException, SocketException {
NetworkIF networkIF = new NetworkIF();
......
......@@ -43,9 +43,10 @@ apq:
iot-gateway: 192.168.124.19:7002
url:
device_info: /facility/facility/getByMacAddress?macAddress={}
install: /ops/install/getList?macAddress={}&pageNum={}&pageSize={}
install: /ops/install/getClientList?macAddress={}&pageNum={}&pageSize={}
upgrade: /ops/upgrade/getList?macAddress={}&pageNum={}&pageSize={}
add-program: /ops/program/addFacProgram
send-control-req: /
# VNC中继服务器
vnc-repeater: 120.24.236.245:5500
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论