mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-12-03 20:38:52 +08:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
0c98c64709
@ -63,19 +63,14 @@ public class IndexController extends BaseAgentController {
|
|||||||
|
|
||||||
@RequestMapping(value = "info", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(value = "info", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public String info() {
|
public String info() {
|
||||||
int code;
|
|
||||||
if (whitelistDirectoryService.isInstalled()) {
|
|
||||||
code = 200;
|
|
||||||
} else {
|
|
||||||
code = 201;
|
|
||||||
}
|
|
||||||
JpomManifest instance = JpomManifest.getInstance();
|
JpomManifest instance = JpomManifest.getInstance();
|
||||||
RemoteVersion remoteVersion = RemoteVersion.cacheInfo();
|
RemoteVersion remoteVersion = RemoteVersion.cacheInfo();
|
||||||
//
|
//
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("manifest", instance);
|
jsonObject.put("manifest", instance);
|
||||||
jsonObject.put("remoteVersion", remoteVersion);
|
jsonObject.put("remoteVersion", remoteVersion);
|
||||||
return JsonMessage.getString(code, "", jsonObject);
|
return JsonMessage.getString(200, "", jsonObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,6 +68,8 @@ public class CheckMonitor {
|
|||||||
// 加载构建定时器
|
// 加载构建定时器
|
||||||
BuildInfoService buildInfoService = SpringUtil.getBean(BuildInfoService.class);
|
BuildInfoService buildInfoService = SpringUtil.getBean(BuildInfoService.class);
|
||||||
buildInfoService.startCron();
|
buildInfoService.startCron();
|
||||||
|
//
|
||||||
|
RemoteVersion.loadRemoteInfo();
|
||||||
});
|
});
|
||||||
// 开启版本检测调度
|
// 开启版本检测调度
|
||||||
CronUtils.upsert("system_monitor", "0 0 0,12 * * ?", () -> {
|
CronUtils.upsert("system_monitor", "0 0 0,12 * * ?", () -> {
|
||||||
|
@ -158,13 +158,15 @@ public class InitDb implements DisposableBean, InitializingBean {
|
|||||||
LoadBuildJsonToDB.getInstance().doJsonToSql();
|
LoadBuildJsonToDB.getInstance().doJsonToSql();
|
||||||
// @author bwcx_jzy @date 2021-12-02
|
// @author bwcx_jzy @date 2021-12-02
|
||||||
LoadJsonConfigToDb instance = LoadJsonConfigToDb.getInstance();
|
LoadJsonConfigToDb instance = LoadJsonConfigToDb.getInstance();
|
||||||
instance.loadIpConfig();
|
|
||||||
instance.loadMailConfig();
|
|
||||||
instance.loadOutGivingWhitelistConfig();
|
|
||||||
// init workspace
|
// init workspace
|
||||||
WorkspaceService workspaceService = SpringUtil.getBean(WorkspaceService.class);
|
WorkspaceService workspaceService = SpringUtil.getBean(WorkspaceService.class);
|
||||||
try {
|
try {
|
||||||
BaseServerController.resetInfo(UserModel.EMPTY);
|
BaseServerController.resetInfo(UserModel.EMPTY);
|
||||||
|
//
|
||||||
|
instance.loadIpConfig();
|
||||||
|
instance.loadMailConfig();
|
||||||
|
instance.loadOutGivingWhitelistConfig();
|
||||||
|
//
|
||||||
instance.loadUserInfo();
|
instance.loadUserInfo();
|
||||||
workspaceService.checkInitDefault();
|
workspaceService.checkInitDefault();
|
||||||
//
|
//
|
||||||
|
@ -33,7 +33,6 @@ import cn.jiangzeyin.common.spring.SpringUtil;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import io.jpom.common.BaseServerController;
|
|
||||||
import io.jpom.model.data.*;
|
import io.jpom.model.data.*;
|
||||||
import io.jpom.model.log.MonitorNotifyLog;
|
import io.jpom.model.log.MonitorNotifyLog;
|
||||||
import io.jpom.service.dblog.DbMonitorNotifyLogService;
|
import io.jpom.service.dblog.DbMonitorNotifyLogService;
|
||||||
@ -151,7 +150,6 @@ public class LoadJsonConfigToDb {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
BaseServerController.resetInfo(UserModel.EMPTY);
|
|
||||||
JSON json = JsonFileUtil.readJson(file.getAbsolutePath());
|
JSON json = JsonFileUtil.readJson(file.getAbsolutePath());
|
||||||
JSONArray jsonArray = JsonFileUtil.formatToArray((JSONObject) json);
|
JSONArray jsonArray = JsonFileUtil.formatToArray((JSONObject) json);
|
||||||
List<UserModel> userModels = jsonArray.toJavaList(UserModel.class);
|
List<UserModel> userModels = jsonArray.toJavaList(UserModel.class);
|
||||||
@ -174,8 +172,6 @@ public class LoadJsonConfigToDb {
|
|||||||
DefaultSystemLog.getLog().info("{} mv to {}", FileUtil.getAbsolutePath(file), FileUtil.getAbsolutePath(backupOldData));
|
DefaultSystemLog.getLog().info("{} mv to {}", FileUtil.getAbsolutePath(file), FileUtil.getAbsolutePath(backupOldData));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
DefaultSystemLog.getLog().error("load user info error ", e);
|
DefaultSystemLog.getLog().error("load user info error ", e);
|
||||||
} finally {
|
|
||||||
BaseServerController.remove();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +193,7 @@ public class LoadJsonConfigToDb {
|
|||||||
//
|
//
|
||||||
nodeModel.setProtocol(StrUtil.emptyToDefault(nodeModel.getProtocol(), "http"));
|
nodeModel.setProtocol(StrUtil.emptyToDefault(nodeModel.getProtocol(), "http"));
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
BaseServerController.resetInfo(UserModel.EMPTY);
|
|
||||||
NodeService nodeService = SpringUtil.getBean(NodeService.class);
|
NodeService nodeService = SpringUtil.getBean(NodeService.class);
|
||||||
nodeService.insert(nodeModels);
|
nodeService.insert(nodeModels);
|
||||||
// 将 json 文件转移到备份目录
|
// 将 json 文件转移到备份目录
|
||||||
@ -205,8 +201,6 @@ public class LoadJsonConfigToDb {
|
|||||||
DefaultSystemLog.getLog().info("{} mv to {}", FileUtil.getAbsolutePath(file), FileUtil.getAbsolutePath(backupOldData));
|
DefaultSystemLog.getLog().info("{} mv to {}", FileUtil.getAbsolutePath(file), FileUtil.getAbsolutePath(backupOldData));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
DefaultSystemLog.getLog().error("load node error ", e);
|
DefaultSystemLog.getLog().error("load node error ", e);
|
||||||
} finally {
|
|
||||||
BaseServerController.remove();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +218,6 @@ public class LoadJsonConfigToDb {
|
|||||||
if (sshModels == null) {
|
if (sshModels == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BaseServerController.resetInfo(UserModel.EMPTY);
|
|
||||||
SshService sshService = SpringUtil.getBean(SshService.class);
|
SshService sshService = SpringUtil.getBean(SshService.class);
|
||||||
sshService.insert(sshModels);
|
sshService.insert(sshModels);
|
||||||
// 将 json 文件转移到备份目录
|
// 将 json 文件转移到备份目录
|
||||||
@ -232,8 +225,6 @@ public class LoadJsonConfigToDb {
|
|||||||
DefaultSystemLog.getLog().info("{} mv to {}", FileUtil.getAbsolutePath(file), FileUtil.getAbsolutePath(backupOldData));
|
DefaultSystemLog.getLog().info("{} mv to {}", FileUtil.getAbsolutePath(file), FileUtil.getAbsolutePath(backupOldData));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
DefaultSystemLog.getLog().error("load ssh error ", e);
|
DefaultSystemLog.getLog().error("load ssh error ", e);
|
||||||
} finally {
|
|
||||||
BaseServerController.remove();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,7 +242,7 @@ public class LoadJsonConfigToDb {
|
|||||||
if (monitorModels == null) {
|
if (monitorModels == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BaseServerController.resetInfo(UserModel.EMPTY);
|
|
||||||
MonitorService monitorService = SpringUtil.getBean(MonitorService.class);
|
MonitorService monitorService = SpringUtil.getBean(MonitorService.class);
|
||||||
monitorService.insert(monitorModels);
|
monitorService.insert(monitorModels);
|
||||||
// 将 json 文件转移到备份目录
|
// 将 json 文件转移到备份目录
|
||||||
@ -259,8 +250,6 @@ public class LoadJsonConfigToDb {
|
|||||||
DefaultSystemLog.getLog().info("{} mv to {}", FileUtil.getAbsolutePath(file), FileUtil.getAbsolutePath(backupOldData));
|
DefaultSystemLog.getLog().info("{} mv to {}", FileUtil.getAbsolutePath(file), FileUtil.getAbsolutePath(backupOldData));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
DefaultSystemLog.getLog().error("load monitor error ", e);
|
DefaultSystemLog.getLog().error("load monitor error ", e);
|
||||||
} finally {
|
|
||||||
BaseServerController.remove();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,7 +268,7 @@ public class LoadJsonConfigToDb {
|
|||||||
if (outGivingModels == null) {
|
if (outGivingModels == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BaseServerController.resetInfo(UserModel.EMPTY);
|
|
||||||
OutGivingServer outGivingServer = SpringUtil.getBean(OutGivingServer.class);
|
OutGivingServer outGivingServer = SpringUtil.getBean(OutGivingServer.class);
|
||||||
outGivingServer.insert(outGivingModels);
|
outGivingServer.insert(outGivingModels);
|
||||||
// 将 json 文件转移到备份目录
|
// 将 json 文件转移到备份目录
|
||||||
@ -287,8 +276,6 @@ public class LoadJsonConfigToDb {
|
|||||||
DefaultSystemLog.getLog().info("{} mv to {}", FileUtil.getAbsolutePath(file), FileUtil.getAbsolutePath(backupOldData));
|
DefaultSystemLog.getLog().info("{} mv to {}", FileUtil.getAbsolutePath(file), FileUtil.getAbsolutePath(backupOldData));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
DefaultSystemLog.getLog().error("load OUTGIVING error ", e);
|
DefaultSystemLog.getLog().error("load OUTGIVING error ", e);
|
||||||
} finally {
|
|
||||||
BaseServerController.remove();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,19 +94,17 @@ export default {
|
|||||||
// 加载数据
|
// 加载数据
|
||||||
loadData() {
|
loadData() {
|
||||||
systemInfo(this.nodeId).then((res) => {
|
systemInfo(this.nodeId).then((res) => {
|
||||||
if (res.code === 200) {
|
this.temp = res.data?.manifest;
|
||||||
this.temp = res.data?.manifest;
|
//
|
||||||
|
// vueTimeStamp
|
||||||
|
this.temp = { ...this.temp, vueTimeStamp: parseTime(this.getMeta("build-time")) };
|
||||||
|
//
|
||||||
|
changelog(this.nodeId).then((resLog) => {
|
||||||
|
this.changelog = resLog.data;
|
||||||
//
|
//
|
||||||
// vueTimeStamp
|
// res.data.
|
||||||
this.temp.vueTimeStamp = parseTime(this.getMeta("build-time"));
|
this.showVersion(false, res.data?.remoteVersion);
|
||||||
//
|
});
|
||||||
changelog(this.nodeId).then((resLog) => {
|
|
||||||
this.changelog = resLog.data;
|
|
||||||
//
|
|
||||||
// res.data.
|
|
||||||
this.showVersion(false, res.data?.remoteVersion);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getMeta(metaName) {
|
getMeta(metaName) {
|
||||||
|
Loading…
Reference in New Issue
Block a user