提交 2f7cf16c authored 作者: wangqiang's avatar wangqiang

客户端更新

上级 394317ef
......@@ -32,30 +32,36 @@ public class InstalledProgramCache {
}
// @Scheduled(fixedDelay = 1800000)
// @Scheduled(fixedDelay = 1800000)
@Scheduled(fixedDelay = 180000)
public void loadProgramListJob() throws IOException {
public void loadProgramListJob() {
log.info("load安装程序开始");
programInfoKey4NameCache.clear();
List<Map<String, String>> programs = new ArrayList<>();
String[] regPaths = {
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\",
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"
};
for (String regPath : regPaths) {
Process process = Runtime.getRuntime().exec("cmd /c reg query " + regPath);
try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream(), "GBK"))) {
String key;
while ((key = reader.readLine()) != null) {
if (StrUtil.isBlank(key)) {
continue;
try {
for (String regPath : regPaths) {
Process process = Runtime.getRuntime().exec("cmd /c reg query " + regPath);
try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream(), "GBK"))) {
String key;
while ((key = reader.readLine()) != null) {
if (StrUtil.isBlank(key)) {
continue;
}
Map<String, String> info = queryProgramInfo(key);
if (null != info) programs.add(info);
}
Map<String, String> info = queryProgramInfo(key);
if (null != info) programs.add(info);
process.destroy();
}
process.destroy();
}
} catch (IOException e) {
log.error("load安装程序异常", e);
}
programList = programs;
log.info("load安装程序结束,programs:{}", programs);
}
private static final Map<String, Map<String, String>> programInfoCache = new ConcurrentHashMap<>();
......
......@@ -14,11 +14,9 @@ import com.priusis.client.service.conf.*;
import com.priusis.client.service.data.*;
import com.priusis.controller.ProgramController;
import com.priusis.controller.RemoteControlController;
import com.priusis.lib.R;
import com.priusis.monitor.mqtt.*;
import com.priusis.utils.MacAddrUtil;
import com.priusis.utils.ParseUrlUtil;
import com.priusis.utils.ProcessExtensionsApqUtil;
import com.priusis.utils.SysConfigUtil;
import com.priusis.utils.*;
import io.netty.buffer.ByteBuf;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.handler.ssl.SslContext;
......@@ -396,7 +394,8 @@ public class MqttServiceImpl implements MqttService, MqttHandler, MqttClientCall
return;
} else {
Long minutes = Convert.toLong(mqttRpcDataMessage.getParams());
remoteControlController.startVncServer(minutes);
R<Void> startVncResult = remoteControlController.startVncServer(minutes);
log.info("远程控制请求接受!!! startVncResult: {}", startVncResult.getMsg());
return;
}
}
......@@ -408,8 +407,11 @@ public class MqttServiceImpl implements MqttService, MqttHandler, MqttClientCall
if ("remote_rtc".equals(mqttRpcDataMessage.getMethod())) {
log.info("收到语音通话请求");
try {
String apqExePath = ParseUrlUtil.parseAbsolutePath("apq.exe", "../../../tools/install-package/client/x64/client-soft", "../client-soft");
ProcessExtensionsApqUtil.apq_CreateProcessAsUser(apqExePath);
boolean hasApqExeProcess = WinExecuteUtils.findProcess("apq.exe");
if(!hasApqExeProcess) {
String apqExePath = ParseUrlUtil.parseAbsolutePath("apq.exe", "../../../tools/install-package/client/x64/client-soft", "../client-soft");
ProcessExtensionsApqUtil.apq_CreateProcessAsUser(apqExePath);
}
SysConfigUtil.saveProperty("control.request", "2");
} catch (Exception e) {
log.error("语音通话请求异常", e);
......
......@@ -33,6 +33,7 @@ public class FacilityController {
public R voiceCall() {
String reqUrl = gateway + voiceCallUrl;
String mac = MacAddrUtil.get();
// String mac = "68:ED:A4:1D:E8:00";
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"));
......
......@@ -310,6 +310,7 @@ public class ProgramController {
// 已安装软件列表
List<FacilityProgramVo> programNames = installedProgramCache.getPrograms()
.stream().map(FacilityProgramVo::toFacilityProgramVoFromCache).sorted().collect(Collectors.toList());
log.info("收到平台扫描软件请求,已安装软件:{}", programNames.size());
// 扫描进程列表
Set<String> processNames = new HashSet<>();
Process process = Runtime.getRuntime().exec("cmd /c tasklist"
......@@ -337,13 +338,14 @@ public class ProgramController {
for (String processName : processNames) {
processNameVos.add(FacilityProgramVo.toFacilityProgramVoFromProcessName(processName));
}
log.info("收到平台扫描软件请求,扫描进程列表:{}", processNameVos.size());
String postResult = HttpUtil.post(gateway + addProgramUrl,
JSONUtil.createObj()
.set("macAddress", mac)
.set("programList", programNames)
.set("processList", processNameVos)
.toString());
log.info("设备软件扫描,result:{}", postResult);
log.info("设备软件扫描,result:{},programList:{},processList:{}", postResult, programNames.size(), processNameVos.size());
}
private boolean containsOfCache(String taskProcess) {
......
package com.priusis.utils;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.system.oshi.OshiUtil;
import lombok.extern.slf4j.Slf4j;
import org.hyperic.sigar.NetFlags;
import org.hyperic.sigar.NetInterfaceConfig;
import org.hyperic.sigar.Sigar;
import org.hyperic.sigar.SigarException;
import oshi.hardware.NetworkIF;
/**
* @author yangli
......@@ -35,4 +31,8 @@ public final class MacAddrUtil {
}
return null;
}
public static void main(String[] args) {
System.out.println(MacAddrUtil.get());
}
}
......@@ -2,8 +2,8 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "阿普奇检测客户端"
#define MyAppVersion "V1.0"
#define MyAppPublisher "阿普奇"
#define MyAppVersion "V1.0"
#define MyAppPublisher "阿普奇"
#define MyAppURL "https://www.apq.com/"
#define MyAppDirName "apq-client"
#define MyAppEnName "apq-client"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论