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

.

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