提交 16e05229 authored 作者: wangqiang's avatar wangqiang

apq-client

上级 30027566
package com.priusis.client.service;
import cn.hutool.json.JSONUtil;
import com.priusis.ApqClientApplication;
import com.priusis.client.service.conf.PcPersistenceConfiguration;
import com.priusis.dto.RegisterParamDto;
import com.sun.jna.Platform;
import lombok.extern.slf4j.Slf4j;
......
......@@ -10,6 +10,7 @@ import com.priusis.lib.R;
import com.priusis.utils.SysConfigUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
......@@ -33,6 +34,9 @@ public class ConfigController {
@Autowired
private TenantManagerService service;
@Value(value = "${apq.webrtc_path}")
private String webrtcPath;
@GetMapping(value = "get_download_path")
public R<String> getDownloadPath() throws IOException {
String path = SysConfigUtil.getProperty("download.path",
......@@ -42,6 +46,11 @@ public class ConfigController {
return R.success(path);
}
@GetMapping(value = "get_webrtc_path")
public R<String> getWebRtcPath() {
return R.success(webrtcPath);
}
@PostMapping(value = "save_download_path")
public R<Void> saveDownloadPath(@RequestBody Map<String, String> params) throws IOException {
String path = params.get("path");
......
......@@ -2,22 +2,28 @@ package com.priusis.controller;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.google.common.collect.Maps;
import com.priusis.lib.R;
import com.priusis.utils.MacAddrUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* <p>
* 设备表控制器
* </p>
*/
@Slf4j
@RestController
@RequestMapping("/facility")
@Validated
......@@ -29,6 +35,24 @@ public class FacilityController {
@Value(value = "${apq.url.voiceCall}")
private String voiceCallUrl;
@Value(value = "${apq.url.voiceCallPush}")
private String voiceCallPushUrl;
@Value(value = "${apq.url.device_info_g}")
private String deviceInfoUrl;
@PostMapping("voiceCallPush")
public R voiceCallPush() {
String reqUrl = gateway + voiceCallPushUrl;
String mac = MacAddrUtil.get();
JSONObject rsp = JSONUtil.parseObj(HttpUtil.post(reqUrl,
JSONUtil.createObj().set("macAddress", mac).toString()));
if (ObjectUtil.notEqual(rsp.getInt("code"), 0)) return R.error(rsp.getStr("msg"));
return R.success();
}
@PostMapping("voiceCall")
public R voiceCall() {
String reqUrl = gateway + voiceCallUrl;
......@@ -37,6 +61,25 @@ public class FacilityController {
JSONObject rsp = JSONUtil.parseObj(HttpUtil.post(reqUrl,
JSONUtil.createObj().set("macAddress", mac).toString()));
if (ObjectUtil.notEqual(rsp.getInt("code"), 0)) return R.error(rsp.getStr("msg"));
return R.success(mac);
JSONObject rsp2 = JSONUtil.parseObj(HttpUtil.get(gateway + StrUtil.format(deviceInfoUrl, mac)));
if (ObjectUtil.notEqual(rsp2.getInt("code"), 0)) {
log.error("查询设备信息失败, msg: {}", rsp.getStr("msg"));
return R.error("查询设备信息失败");
}
Long operationId = rsp2.getJSONObject("data").getLong("operationId");
Long sysUserId = rsp2.getJSONObject("data").getLong("sysUserId");
Long callUserId = operationId;
if (null == callUserId) {
callUserId = sysUserId;
}
if (null == callUserId) {
return R.error("语音通话失败,目前接听用户不存在");
}
Map<String, Object> result = Maps.newHashMap();
result.put("mac", mac);
result.put("callUserId", callUserId);
return R.success(result);
}
}
......@@ -19,6 +19,7 @@ import com.google.common.collect.Lists;
import com.priusis.cache.InstalledProgramCache;
import com.priusis.lib.R;
import com.priusis.utils.MacAddrUtil;
import com.priusis.utils.ProcessExtensionsApqUtil;
import com.priusis.utils.SysConfigUtil;
import com.priusis.vo.FacilityProgramVo;
import lombok.SneakyThrows;
......@@ -156,7 +157,7 @@ public class ProgramController {
})
.collect(Collectors.toList());
return R.success(page.setRecords(list));
} catch (IOException e) {
} catch (Exception e) {
log.error("客户端系统异常", e);
return R.error("客户端正在初始化,请稍后再试!");
}
......@@ -370,7 +371,7 @@ public class ProgramController {
}
public static void main(String[] args) throws InterruptedException {
public static void main(String[] args) throws InterruptedException, IOException {
/*int exitVal = -1;
try {
exitVal = Runtime.getRuntime().exec("cmd /c \"D:\\work\\priusis\\priusis-iot\\apq-iot\\apq-client\\tools\\install-package\boot\\dist\\apq-info-install.exe\"").waitFor();
......@@ -391,30 +392,48 @@ public class ProgramController {
System.out.println(exitVal);*/
// =================================================================
String url = "http://apuqi.oss-cn-zhangjiakou.aliyuncs.com/ossdata/20220420/f65fe478633c43f493a0b60d13717504.exe";
String fileName = url.substring(url.lastIndexOf("/") + 1);
System.out.println(fileName);
Runtime.getRuntime().exec("cmd /c \"C:\\apqdownloads\\f65fe478633c43f493a0b60d13717504.exe\"");
System.out.println(11);
}
@Scheduled(fixedDelay = 60000)
@Scheduled(fixedDelay = 120000)
protected void autoUpgradeJob() {
try {
String controlRequestTimeStr = SysConfigUtil.getProperty("control.request.time");
if (StrUtil.isNotBlank(controlRequestTimeStr) && System.currentTimeMillis() - NumberUtil.toBigDecimal(controlRequestTimeStr).longValue() < 10 * 1000) {
if (StrUtil.isNotBlank(controlRequestTimeStr) && System.currentTimeMillis() - NumberUtil.toBigDecimal(controlRequestTimeStr).longValue() < 120 * 1000) {
boolean autoUpgrade = Convert.toBool(SysConfigUtil.getProperty("auto.upgrade"), false);
if (!autoUpgrade) return;
File dir = new File(SysConfigUtil.getProperty("download.path",
System.getProperty("user.dir").substring(0, 3) + "apqdownloads"));
String downloadPath = SysConfigUtil.getProperty("download.path",
System.getProperty("user.dir").substring(0, 3) + "apqdownloads");
File dir = new File(downloadPath);
if (!dir.exists()) dir.mkdirs();
list("upgrade", 1, 10000).getData().getRecords()
.parallelStream()
.filter(m -> ObjectUtil.notEqual(m.get("version"), m.get("localVersion")))
.forEach(m -> {
HttpResponse rsp = HttpUtil.createGet(m.get("url")).execute(true);
File file = rsp.writeBodyForFile(dir, null);
String url = m.get("url");
String fileName = url.substring(url.lastIndexOf("/") + 1);
File fileE = new File(downloadPath + File.separator + fileName);
if (!fileE.exists()) {
HttpResponse rsp = HttpUtil.createGet(url).execute(true);
fileE = rsp.writeBodyForFile(dir, null);
}
int exitVal = -1;
try {
exitVal = Runtime.getRuntime().exec("cmd /c \"" + file.getPath() + "\" /sp- /silent /norestart /suppressmsgboxes").waitFor();
String exeCmd = "autoExe.bat \"" + fileE.getPath() + "\"";
ProcessExtensionsApqUtil.apq_CreateProcessAsUser(exeCmd);
log.info("执行安装文件 {} ", exeCmd);
// Runtime.getRuntime().exec("cmd /c \"C:\\apqdownloads\\f65fe478633c43f493a0b60d13717504.exe\" /sp- /silent /norestart /suppressmsgboxes");
} catch (Exception e) {
log.error("执行安装文件 {} 失败", file.getPath(), e);
log.error("执行安装文件 {} 失败", fileE.getPath(), e);
}
log.info("执行安装文件 ==============");
if (exitVal == 0) {
String reqUrl = gateway + StrUtil.format(upgradeStatusUpIssueUrl, MacAddrUtil.get(), m.get("id"));
HttpUtil.post(reqUrl, (String) null);
......
apq:
iot-gateway: 39.98.116.19:80/api
webrtc_path: https://ceshi.priusis.com:8443
client:
productId: 286
tenantId: 138
......
apq:
iot-gateway: 39.98.116.19:80/api
webrtc_path: https://ceshi.priusis.com:8443
client:
productId: 292
tenantId: 252
job:
type: all
control:
request:
isTimeSet: false
PC_HOST: 39.98.116.19
PC_PORT: 1883
vnc-repeater: 39.98.116.19:5500
\ No newline at end of file
apq:
iot-gateway: 10.2.68.40:7033
iot-gateway: 10.2.68.45:7033
webrtc_path: http://10.2.68.41:81
client:
productId: 210
tenantId: 156
productId: 1
tenantId: 148
job:
type: all
control:
request:
isTimeSet: false
PC_HOST: 10.2.68.40
vnc-repeater: 10.2.68.41:5500
\ No newline at end of file
PC_HOST: 10.2.68.45
vnc-repeater: 10.2.68.45:5500
\ No newline at end of file
......@@ -42,12 +42,14 @@ apq:
antivirus:
type: P360
iot-gateway: 192.168.124.19:7002
webrtc_path: https://ceshi.priusis.com:8443
client:
productId: 210
tenantId: 156
url:
device_info_g: /facility/facility/getByMacAddress?macAddress={}
voiceCall: /facility/facility/voiceCall
voiceCallPush: /facility/facility/voiceCallPush
device_info: /facility/facility/pcAdd
install: /ops/install/getClientList?macAddress={}&pageNum={}&pageSize={}
upgrade: /ops/upgrade/getClientList?macAddress={}&pageNum={}&pageSize={}
......
......@@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "阿普奇检测客户端"
#define MyAppVersion "V1.0"
#define MyAppVersion "V1.2"
#define MyAppPublisher "阿普奇"
#define MyAppURL "https://www.apq.com/"
#define MyAppDirName "apq-client"
......@@ -19,7 +19,7 @@
; (生成新的GUID,点击 工具|在IDE中生成GUID。)
; Tell Windows Explorer to reload the environment
ChangesEnvironment=yes
DisableDirPage=no
DisableDirPage=yes
; AlwaysRestart=yes
AppId={{1394783A-5D3C-48CD-0000-E2DFBB844E42}
AppName={#MyAppName}
......@@ -37,7 +37,7 @@ SetupIconFile=logo.ico
OutputDir=..\dist\
;安装包文件名
OutputBaseFilename={#MyAppName}_x32
OutputBaseFilename={#MyAppName}
;压缩文件
Compression=lzma
......@@ -63,6 +63,7 @@ Source: "../../runtime/VC_redist.x86.exe"; DestDir: "{app}/service/runtime"; Fla
Source: "../../core/*"; DestDir: "{app}/service/core"; Flags: ignoreversion recursesubdirs createallsubdirs;
Source: "../../vnc/x32/*"; DestDir: "{app}/vnc"; Flags: ignoreversion recursesubdirs createallsubdirs;
Source: "../../client/x32/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
Source: "../../../../apq-pc-client/target/apq-pc-client-0.0.1-SNAPSHOT-boot.jar"; DestDir: "{app}/service"; Flags: ignoreversion recursesubdirs createallsubdirs;
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
......@@ -103,11 +104,11 @@ begin
//Result := Password;
end;
function CheckPassword(Password: String): Boolean;
begin
if GetMD5OfStringApq(Password)='{#MyAppInstallPwd}' then
result:=true;
end;
//function CheckPassword(Password: String): Boolean;
//begin
//if GetMD5OfStringApq(Password)='{#MyAppInstallPwd}' then
//result:=true;
//end;
function CheckProcessRunning( aProcName,
aProcDesc: string ): boolean;
......@@ -165,7 +166,6 @@ begin
DeleteFile( d + f2 );
end;
function AskPassword(): Boolean;
var
Form: TSetupForm;
......@@ -233,7 +233,7 @@ function InitializeSetup: Boolean;
var
CurVer: string;
CurVerStr: string;
begin
begin
// Do not use any user defined vars in here such as {app}
// Result := not ( CheckProcessRunning( 'apq-client-service.exe', 'apq-client-service' ));
CheckProcessRunning( 'apq-control.exe', 'apq客户端插件' )
......
apq:
iot-gateway: 10.2.68.45:7033
webrtc_path: http://10.2.68.44:81
client:
productId: 1
tenantId: 148
job:
type: all
control:
request:
isTimeSet: false
PC_HOST: 10.2.68.45
vnc-repeater: 10.2.68.45:5500
\ No newline at end of file
owner: PanJiaChen
repo: vue-element-admin
provider: github
updaterCacheDirName: apq-updater
ECHO 处于打开状态。
ECHO 处于打开状态。
ECHO 处于打开状态。
ECHO 处于打开状态。
ECHO 处于打开状态。
ECHO 处于打开状态。
ECHO 处于打开状态。
ECHO 处于打开状态。
ECHO 处于打开状态。
ECHO 处于打开状态。
ECHO 处于打开状态。
ECHO 处于打开状态。
C:/apqdownloads/82756009c1fa44e3aece58b32ec2ff69.exe
cd /d "%~dp0"
echo %1 >> ./childprocess.txt
start /b cmd /c %1
exit
\ No newline at end of file
"D:\tools\signtool.exe" sign /v /f "D:\tools\apq.pfx" /p apq0011 /t http://timestamp.verisign.com/scripts/timestamp.dll D:\work\priusis\priusis-iot\apq-iot\apq-client\tools\install-package\boot\dist\阿普奇检测客户端.exe
"D:\tools\signtool.exe" sign /v /f "D:\tools\apq.pfx" /p apq0011 /t http://timestamp.verisign.com/scripts/timestamp.dll D:\work\priusis\priusis-iot\apq-iot\apq-client\tools\install-package\boot\dist\阿普奇检测客户端.exe
"D:\tools\signtool.exe" sign /v /f "D:\tools\apq.pfx" /p apq0011 /t http://timestamp.verisign.com/scripts/timestamp.dll D:\work\priusis\priusis-iot\apq-iot\apq-client\tools\install-package\boot\dist\阿普奇检测客户端_x32.exe
"D:\tools\signtool.exe" sign /v /f "D:\tools\apq.pfx" /p apq0011 /t http://timestamp.verisign.com/scripts/timestamp.dll D:\work\priusis\priusis-iot\apq-iot\apq-client\tools\install-package\boot\dist\阿普奇检测客户端_x32.exe
"D:\tools\signtool.exe" sign /v /f "D:\tools\apq.pfx" /p apq0011 /t http://timestamp.verisign.com/scripts/timestamp.dll D:\work\priusis\priusis-iot\apq-iot\apq-client\tools\install-package\client\x64\client-soft\apq.exe
......@@ -8,4 +8,6 @@
"D:\tools\signtool.exe" sign /v /f "D:\tools\apq.pfx" /p apq0011 /t http://timestamp.verisign.com/scripts/timestamp.dll D:\work\priusis\priusis-iot\apq-iot\apq-client\tools\install-package\java\x64\jre\bin\apq-client.exe
"D:\tools\signtool.exe" sign /v /f "D:\tools\apq.pfx" /p apq0011 /t http://timestamp.verisign.com/scripts/timestamp.dll D:\work\priusis\priusis-iot\apq-iot\apq-client\tools\install-package\java\x32\jre\bin\apq-client.exe
\ No newline at end of file
"D:\tools\signtool.exe" sign /v /f "D:\tools\apq.pfx" /p apq0011 /t http://timestamp.verisign.com/scripts/timestamp.dll D:\work\priusis\priusis-iot\apq-iot\apq-client\tools\install-package\java\x32\jre\bin\apq-client.exe
pause
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论