提交 840a0cc4 authored 作者: yangli's avatar yangli

.

上级 2d22ae6e
...@@ -27,7 +27,7 @@ public class InstalledProgramCache { ...@@ -27,7 +27,7 @@ public class InstalledProgramCache {
@Scheduled(fixedDelay = 3000) @Scheduled(fixedDelay = 3000)
protected void loadProgramListJob() throws IOException { public void loadProgramListJob() throws IOException {
List<Map<String, String>> programs = new ArrayList<>(); List<Map<String, String>> programs = new ArrayList<>();
String[] regPaths = { String[] regPaths = {
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\",
......
...@@ -53,10 +53,10 @@ public class ProgramController { ...@@ -53,10 +53,10 @@ public class ProgramController {
@Value(value = "${apq.url.upgrade}") @Value(value = "${apq.url.upgrade}")
private String upgradeUrl; private String upgradeUrl;
@Value(value = "apq.url.install-status-upissue") @Value(value = "${apq.url.install-status-upissue}")
private String installStatusUpIssueUrl; private String installStatusUpIssueUrl;
@Value(value = "apq.url.upgrade-status-upissue") @Value(value = "${apq.url.upgrade-status-upissue}")
private String upgradeStatusUpIssueUrl; private String upgradeStatusUpIssueUrl;
@Value(value = "${apq.url.add-program}") @Value(value = "${apq.url.add-program}")
...@@ -158,8 +158,10 @@ public class ProgramController { ...@@ -158,8 +158,10 @@ public class ProgramController {
} }
MAP.remove(key); MAP.remove(key);
if (exitVal == 0) { if (exitVal == 0) {
HttpUtil.post(StrUtil.format(type.equals("install") ? installStatusUpIssueUrl : upgradeStatusUpIssueUrl, String reqUrl = gateway + StrUtil.format(type.equals("install") ? installStatusUpIssueUrl : upgradeStatusUpIssueUrl,
MacAddrUtil.get(), id), (String) null); MacAddrUtil.get(), id);
System.out.println(reqUrl);
HttpUtil.post(reqUrl, (String) null);
} }
})); }));
MAP.get(key).start(); MAP.get(key).start();
...@@ -173,6 +175,7 @@ public class ProgramController { ...@@ -173,6 +175,7 @@ public class ProgramController {
@GetMapping(value = "get_version") @GetMapping(value = "get_version")
public R<String> getVersion(@RequestParam @NotBlank String name) throws IOException { public R<String> getVersion(@RequestParam @NotBlank String name) throws IOException {
installedProgramCache.loadProgramListJob();
return installedProgramCache.getPrograms().stream() return installedProgramCache.getPrograms().stream()
.collect(Collectors.toMap(p -> StrUtil.similar(p.get("name").toLowerCase(), name.toLowerCase()), .collect(Collectors.toMap(p -> StrUtil.similar(p.get("name").toLowerCase(), name.toLowerCase()),
p -> p.getOrDefault("version", ""), (l, r) -> r)) p -> p.getOrDefault("version", ""), (l, r) -> r))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论