提交 eda1d59b authored 作者: yangli's avatar yangli

.

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