提交 32df405f authored 作者: wangqiang's avatar wangqiang

install

上级 c7587c33
......@@ -32,13 +32,14 @@ public class InstalledProgramCache {
public void init() {
try {
loadProgramListJob();
log.info("程序List-Lines:{}", programList);
} catch (IOException e) {
log.error("初始化失败", e);
}
}
@Scheduled(fixedDelay = 3000)
@Scheduled(fixedDelay = 5000)
public void loadProgramListJob() throws IOException {
List<Map<String, String>> programs = new ArrayList<>();
String[] regPaths = {
......@@ -56,6 +57,7 @@ public class InstalledProgramCache {
process.destroy();
}
}
programList = programs;
}
......@@ -68,7 +70,6 @@ public class InstalledProgramCache {
String line;
while ((line = reader.readLine()) != null) {
line = line.trim();
log.info("程序List-Line:{}", line);
if (line.startsWith("DisplayName")) {
info.put("name", line.replace("DisplayName", "").replace("REG_SZ", "").trim());
} else if (line.startsWith("DisplayVersion")) {
......
......@@ -11,7 +11,6 @@ import com.priusis.client.data.kv.*;
import com.priusis.client.service.*;
import com.priusis.client.service.conf.*;
import com.priusis.client.service.data.*;
import com.priusis.client.util.JsonTools;
import com.priusis.controller.RemoteControlController;
import com.priusis.monitor.mqtt.*;
import com.priusis.util.MacAddrUtil;
......@@ -161,7 +160,6 @@ public class MqttServiceImpl implements MqttService, MqttHandler, MqttClientCall
}
@Override
public MqttDeliveryFuture onDeviceAttributesUpdate(List<KvEntry> attributes) {
final int msgId = msgIdSeq.incrementAndGet();
......@@ -534,6 +532,7 @@ public class MqttServiceImpl implements MqttService, MqttHandler, MqttClientCall
tbClient = MqttClient.create(mqttClientConfig, this);
tbClient.setCallback(this);
tbClient.setEventLoop(nioEventLoopGroup);
log.debug("try connect client");
connectTbClient();
......@@ -667,6 +666,7 @@ public class MqttServiceImpl implements MqttService, MqttHandler, MqttClientCall
log.warn("未获取到MAC地址");
return null;
}
log.info("获取到MAC地址:{}", mac);
deviceInfo = StrUtil.format(deviceInfo, mac);
String remoteDeviceVoJson = HttpUtil.get(gateway + deviceInfo, 3000);
......
......@@ -26,7 +26,6 @@ import oshi.util.FormatUtil;
import java.math.BigDecimal;
import java.net.InetAddress;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
......@@ -103,8 +102,9 @@ public class ApqInfoApplication {
.put(isNeedCollection(isNoneEven, diskModel, mapParams), diskModel, OshiUtil.getHardware().getDiskStores()[0].getModel())
.put(isNeedCollection(isNoneEven, diskCap, mapParams), diskCap, DataSizeUtil.format(OshiUtil.getHardware().getDiskStores()[0].getSize()))
.build();
log.info("采集数据,上报属性: mapData:{}", data);
Map mapR = restTemplate.postForObject("http://localhost:8765/uplink/oc-client", data, Map.class);
log.info("采集数据,上报属性: mapData:{}, ret:{}", data, mapR);
log.info("采集数据,上报属性: ret:{}", mapR);
} catch (Exception e) {
log.error("采集数据异常", e);
}
......
......@@ -17,10 +17,6 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -50,6 +46,14 @@ public class ApqRegisterApplication {
@Scheduled(fixedDelay = 30000L)
protected void registerProgramTask() {
log.info("软件检测上报=================");
/*
log.info("===================");
try {
WinExecuteUtils.killProc("Postman.exe");
} catch (Exception e) {
log.error("杀进程异常", e);
}*/
// 获取软件检测监控配置 params == data
ResponseEntity<MqttRpcDataMessage> forEntity = null;
try {
......@@ -63,7 +67,7 @@ public class ApqRegisterApplication {
if (StrUtil.isNotBlank(params)) {
Long sendTime = body.getSendTime();
long current = System.currentTimeMillis();
//long current = System.currentTimeMillis();
RegisterParamDto registerParamDto = JSONUtil.toBean(params, RegisterParamDto.class);
// 收到软件检测下发请求
......@@ -78,6 +82,7 @@ public class ApqRegisterApplication {
for (RegisterParamDto.RegisterDetailParamDto program : programs) {
String name = program.getName().trim();
log.info("软件检测软件: {}", name);
boolean isE = WinExecuteUtils.findProcess(name);
if (isE) {
// 杀进程
......
......@@ -26,10 +26,10 @@ DefaultGroupName={#MyAppName}
SetupIconFile=logo.ico
;安装包文件输出目录
OutputDir=D:\work\priusis\priusis-iot\apq-iot\apq-client\tools\install-package\dist\
OutputDir=..\dist\
;安装包文件名
OutputBaseFilename={#MyAppEnName}
OutputBaseFilename={#MyAppEnName}-install
;压缩文件
Compression=lzma
......@@ -46,7 +46,6 @@ VersionInfoVersion=1.0.0.1
[Languages]
Name: "chinese"; MessagesFile: "compiler:Languages/Chinese.isl"
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
Source: "../apq-client/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
......@@ -72,7 +71,8 @@ Type: dirifempty; Name: "{app}"
;操作注册表
[Registry]
Root: HKLM; Subkey: "Software\apq-client"; Flags: uninsdeletekey;
Root: HKLM; Subkey: "Software\{#MyAppEnName}"; Flags: uninsdeletekey;
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "{#MyAppEnName}"; ValueData: "{app}\{#MyAppExeName}"
[Code]
function CheckProcessRunning( aProcName,
......@@ -135,5 +135,7 @@ end;
function InitializeSetup: Boolean;
begin
// Do not use any user defined vars in here such as {app}
Result := not ( CheckProcessRunning( 'apq-client-service.exe', 'apq-client-service' ));
// Result := not ( CheckProcessRunning( 'apq-client-service.exe', 'apq-client-service' ));
CheckProcessRunning( 'apq.exe', 'apq' )
Result := not ( CheckProcessRunning( 'apq-client.exe', 'apq-client' ));
end;
\ No newline at end of file
......@@ -2,7 +2,7 @@ cd /d %~dp0 
setlocal enabledelayedexpansion
for /F "TOKENS=1,2,*" %%b in ('tasklist /FI "IMAGENAME eq apq.exe"') do TASKKILL /F /PID %%b
::taskkill -f -t -im %MyPID%
taskkill -f -t -im %MyPID%
for /F "TOKENS=1,2,*" %%a in ('jps -m ^| findstr apq-pc-client') do set SPID=%%a
TASKKILL /F /PID %SPID%
......
......@@ -2,7 +2,7 @@ cd /d %~dp0 
setlocal enabledelayedexpansion
for /F "TOKENS=1,2,*" %%b in ('tasklist /FI "IMAGENAME eq apq.exe"') do TASKKILL /F /PID %%b
::taskkill -f -t -im %MyPID%
taskkill -f -t -im %MyPID%
for /F "TOKENS=1,2,*" %%a in ('jps -m ^| findstr apq-pc-client') do set SPID=%%a
TASKKILL /F /PID %SPID%
......
......@@ -29,7 +29,7 @@ SetupIconFile=logo.ico
OutputDir=..\dist\
;安装包文件名
OutputBaseFilename={#MyAppEnName}
OutputBaseFilename={#MyAppEnName}-install
;压缩文件
Compression=lzma
......@@ -46,7 +46,6 @@ VersionInfoVersion=1.0.0.0
[Languages]
Name: "chinesesimp"; MessagesFile: "compiler:Languages/Chinese.isl"
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
Source: "../apq-control/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
......@@ -62,7 +61,7 @@ Name: "{commonstartup}\{#MyAppName}"; Filename: "{app}\service\
[Run]
Filename: "{app}\service\启动服务.bat"; Flags: runhidden;
;卸载后执行的操作(停止、删除各种服务)
;卸载后执行的操作(停止、删除各种服务)
[UninstallRun]
Filename: "{app}\service\删除服务.bat"; Flags: runhidden;
......@@ -73,8 +72,8 @@ Type: dirifempty; Name: "{app}"
;操作注册表
[Registry]
Root: HKLM; Subkey: "Software\apq-control"; Flags: uninsdeletekey;
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "testrun"; ValueData: "{app}\{#MyAppExeName}"
Root: HKLM; Subkey: "Software\{#MyAppEnName}"; Flags: uninsdeletekey;
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "{#MyAppEnName}"; ValueData: "{app}\{#MyAppExeName}";
[Code]
......@@ -138,5 +137,6 @@ end;
function InitializeSetup: Boolean;
begin
// Do not use any user defined vars in here such as {app}
Result := not ( CheckProcessRunning( 'apq-control-service.exe', 'apq-control-service' ));
// Result := not ( CheckProcessRunning( 'apq-control-service.exe', 'apq-control-service' ));
Result := not ( CheckProcessRunning( 'apq-control.exe', 'apq-control' ));
end;
\ No newline at end of file
cd /d %~dp0 
setlocal enabledelayedexpansion
for /F "TOKENS=1,2,*" %%a in ('jps -m ^| findstr apq-pc-control') do set SPID=%%a
TASKKILL /F /PID %SPID%
echo 删除服务完毕
exit
\ No newline at end of file
cd /d %~dp0 
::start xx.exe
start apq-control -Xms256m -Xmx256m -Dfile.encoding=utf-8 -jar "%~dp0\apq-pc-control-1.0-SNAPSHOT-boot.jar"
echo 启动服务完毕
exit
\ No newline at end of file
......@@ -26,10 +26,10 @@ DefaultGroupName={#MyAppName}
SetupIconFile=logo.ico
;安装包文件输出目录
OutputDir=D:\work\priusis\priusis-iot\apq-iot\apq-client\tools\install-package\dist\
OutputDir=..\dist\
;安装包文件名
OutputBaseFilename={#MyAppEnName}
OutputBaseFilename={#MyAppEnName}-install
;压缩文件
Compression=lzma
......@@ -44,7 +44,6 @@ VersionInfoVersion=1.0.0.0
[Languages]
Name: "chinesesimp"; MessagesFile: "compiler:Languages/Chinese.isl"
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
Source: "../apq-info/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
......@@ -68,14 +67,15 @@ Type: dirifempty; Name: "{app}"
;操作注册表
[Registry]
Root: HKLM; Subkey: "Software\SoftName"; Flags: uninsdeletekey;
Root: HKLM; Subkey: "Software\{#MyAppEnName}"; Flags: uninsdeletekey;
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "{#MyAppEnName}"; ValueData: "{app}\{#MyAppExeName}"
[Code]
function CheckProcessRunning( aProcName,
aProcDesc: string ): boolean;
var
ShellResult: boolean;
ResultCode: integer;
ResultCode: integer;
cmd: string;
sl: TStringList;
f: string;
......@@ -131,6 +131,6 @@ end;
function InitializeSetup: Boolean;
begin
// Do not use any user defined vars in here such as {app}
Result := not ( CheckProcessRunning( 'apq-info-service.exe', 'apq-info-service' ));
// and not ( CheckProcessRunning( 'apq-info.exe', 'apq-info' ))
// Result := not ( CheckProcessRunning( 'apq-info-service.exe', 'apq-info-service' ));
Result := not ( CheckProcessRunning( 'apq-info.exe', 'apq-info' ));
end;
\ No newline at end of file
cd /d %~dp0 
setlocal enabledelayedexpansion
for /F "TOKENS=1,2,*" %%a in ('jps -m ^| findstr apq-pc-info') do set SPID=%%a
TASKKILL /F /PID %SPID%
echo 删除服务完毕
exit
\ No newline at end of file
cd /d %~dp0 
::start xx.exe
start apq-info -Xms256m -Xmx256m -Dfile.encoding=utf-8 -jar "%~dp0\apq-pc-info-1.0-SNAPSHOT-boot.jar"
echo 启动服务完毕
exit
\ No newline at end of file
......@@ -26,25 +26,23 @@ DefaultGroupName={#MyAppName}
SetupIconFile=logo.ico
;安装包文件输出目录
OutputDir=D:\work\priusis\priusis-iot\apq-iot\apq-client\tools\install-package\dist\
OutputDir=..\dist\
;安装包文件名
OutputBaseFilename={#MyAppEnName}
OutputBaseFilename={#MyAppEnName}-install
;压缩文件
Compression=lzma
SolidCompression=yes
Compression=lzma
SolidCompression=yes
;以管理员权限运行
PrivilegesRequired=admin
UninstallDisplayIcon={app}/{#MyAppExeName}
VersionInfoVersion=1.0.0.0
[Languages]
Name: "chinesesimp"; MessagesFile: "compiler:Languages/Chinese.isl"
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
Source: "../apq-register/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
......@@ -56,7 +54,7 @@ Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
[Run]
Filename: "{app}\service\启动服务.bat"; Flags: runhidden;
;卸载后执行的操作(停止、删除各种服务)
;卸载后执行的操作(停止、删除各种服务)
[UninstallRun]
Filename: "{app}\service\删除服务.bat"; Flags: runhidden;
......@@ -67,7 +65,8 @@ Type: dirifempty; Name: "{app}"
;操作注册表
[Registry]
Root: HKLM; Subkey: "Software\SoftName"; Flags: uninsdeletekey;
Root: HKLM; Subkey: "Software\{#MyAppEnName}"; Flags: uninsdeletekey;
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "{#MyAppEnName}"; ValueData: "{app}\{#MyAppExeName}"
[Code]
......@@ -131,5 +130,6 @@ end;
function InitializeSetup: Boolean;
begin
// Do not use any user defined vars in here such as {app}
Result := not ( CheckProcessRunning( 'apq-register-service.exe', 'apq-register-service' ));
// Result := not ( CheckProcessRunning( 'apq-register-service.exe', 'apq-register-service' ));
Result := not ( CheckProcessRunning( 'apq-register.exe', 'apq-register' ));
end;
\ No newline at end of file
@ECHO OFF
setlocal enabledelayedexpansion
@ECHO Stopping apq-register-service ...
net stop apq-register-service
@ECHO Uninstalling apq-register-service ...
"%~dp0apq-register-service.exe" uninstall
@ECHO DONE.
:END
\ No newline at end of file
@ECHO OFF
setlocal ENABLEEXTENSIONS
@ECHO Installing apq-register-service ...
"%~dp0apq-register-service.exe" install
@ECHO runing apq-register-service ...
"%~dp0apq-register-service.exe" start
@ECHO DONE.
:END
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论