From 6907ad5fd0e2ea4acce4c15d9a72616b83e42726 Mon Sep 17 00:00:00 2001 From: jiangzeyin Date: Thu, 25 Apr 2019 15:33:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=94=AF=E6=8C=81=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitee/ISSUE_TEMPLATE.zh-CN.md | 5 +++++ .../jpom/controller/IndexController.java | 3 +++ .../manage/ProjectListController.java | 13 +------------ .../jpom/model/data/ProjectInfoModel.java | 5 +---- .../keepbx/jpom/model/data/ScriptModel.java | 5 ++++- .../user/log/UserOptLogController.java | 12 ++++++++++++ .../server/src/main/resources/vm/node/list.vm | 1 + .../src/main/resources/vm/user/log/list.vm | 19 +++++++++++++++++++ modules/server/src/test/java/TestJvm.java | 3 ++- 9 files changed, 48 insertions(+), 18 deletions(-) create mode 100644 .gitee/ISSUE_TEMPLATE.zh-CN.md diff --git a/.gitee/ISSUE_TEMPLATE.zh-CN.md b/.gitee/ISSUE_TEMPLATE.zh-CN.md new file mode 100644 index 000000000..1637a6f7b --- /dev/null +++ b/.gitee/ISSUE_TEMPLATE.zh-CN.md @@ -0,0 +1,5 @@ +### 使用的JDK版本、Jpom版本、操作系统及系统版本 + +### 问题描述(包括截图) + +### 报错信息 \ No newline at end of file diff --git a/modules/agent/src/main/java/cn/keepbx/jpom/controller/IndexController.java b/modules/agent/src/main/java/cn/keepbx/jpom/controller/IndexController.java index 597e623d5..e8f6ddf83 100644 --- a/modules/agent/src/main/java/cn/keepbx/jpom/controller/IndexController.java +++ b/modules/agent/src/main/java/cn/keepbx/jpom/controller/IndexController.java @@ -1,5 +1,6 @@ package cn.keepbx.jpom.controller; +import cn.hutool.system.SystemUtil; import cn.jiangzeyin.common.JsonMessage; import cn.keepbx.jpom.BaseJpomApplication; import cn.keepbx.jpom.common.BaseAgentController; @@ -61,6 +62,8 @@ public class IndexController extends BaseAgentController { jsonObject.put("javaVirtualCount", JvmUtil.getJavaVirtualCount()); jsonObject.put("osName", BaseJpomApplication.OS_INFO.getName()); jsonObject.put("jpomVersion", JpomManifest.getInstance().getVersion()); + jsonObject.put("javaVersion", SystemUtil.getJavaRuntimeInfo().getVersion()); + if (projectInfoModels == null) { jsonObject.put("count", 0); jsonObject.put("runCount", 0); diff --git a/modules/agent/src/main/java/cn/keepbx/jpom/controller/manage/ProjectListController.java b/modules/agent/src/main/java/cn/keepbx/jpom/controller/manage/ProjectListController.java index 1fc31529b..2b64b7bc2 100644 --- a/modules/agent/src/main/java/cn/keepbx/jpom/controller/manage/ProjectListController.java +++ b/modules/agent/src/main/java/cn/keepbx/jpom/controller/manage/ProjectListController.java @@ -120,7 +120,7 @@ public class ProjectListController extends BaseAgentController { * @return obj */ @RequestMapping(value = "getProjectPort", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) - public String getProjectGroup(String ids) { + public String getProjectPort(String ids) { if (StrUtil.isEmpty(ids)) { return JsonMessage.getString(400, ""); } @@ -147,15 +147,4 @@ public class ProjectListController extends BaseAgentController { } return JsonMessage.getString(200, "", jsonObject); } - -// /** -// * 获取运行方式 -// * -// * @return array -// */ -// @RequestMapping(value = "getRunModes", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) -// public String getRunModes() { -// ProjectInfoModel.RunMode[] runModes = ProjectInfoModel.RunMode.values(); -// return JsonMessage.getString(200, "", runModes); -// } } diff --git a/modules/agent/src/main/java/cn/keepbx/jpom/model/data/ProjectInfoModel.java b/modules/agent/src/main/java/cn/keepbx/jpom/model/data/ProjectInfoModel.java index 5a69e912b..734767c78 100644 --- a/modules/agent/src/main/java/cn/keepbx/jpom/model/data/ProjectInfoModel.java +++ b/modules/agent/src/main/java/cn/keepbx/jpom/model/data/ProjectInfoModel.java @@ -89,13 +89,10 @@ public class ProjectInfoModel extends BaseModel { /** * 项目是否正在运行 * - * @param get 防止并发获取 + * @param get 防止自动获取 * @return true 正在运行 */ public boolean isStatus(boolean get) { - if (!get) { - return false; - } try { status = AbstractProjectCommander.getInstance().isRun(getId()); } catch (Exception e) { diff --git a/modules/agent/src/main/java/cn/keepbx/jpom/model/data/ScriptModel.java b/modules/agent/src/main/java/cn/keepbx/jpom/model/data/ScriptModel.java index 1dfe9dee4..8eb98540c 100644 --- a/modules/agent/src/main/java/cn/keepbx/jpom/model/data/ScriptModel.java +++ b/modules/agent/src/main/java/cn/keepbx/jpom/model/data/ScriptModel.java @@ -96,7 +96,10 @@ public class ScriptModel extends BaseModel { public void saveFile() { File file = getFile(true); FileUtil.writeString(getContext(), file, CharsetUtil.CHARSET_UTF_8); - CommandUtil.execCommand("chmod 755 " + FileUtil.getAbsolutePath(file)); + // 添加权限 + if (BaseJpomApplication.OS_INFO.isLinux()) { + CommandUtil.execCommand("chmod 755 " + FileUtil.getAbsolutePath(file)); + } } /** diff --git a/modules/server/src/main/java/cn/keepbx/jpom/controller/user/log/UserOptLogController.java b/modules/server/src/main/java/cn/keepbx/jpom/controller/user/log/UserOptLogController.java index 214f12edd..6ed2f8342 100644 --- a/modules/server/src/main/java/cn/keepbx/jpom/controller/user/log/UserOptLogController.java +++ b/modules/server/src/main/java/cn/keepbx/jpom/controller/user/log/UserOptLogController.java @@ -15,8 +15,10 @@ import cn.hutool.db.sql.Order; import cn.jiangzeyin.common.JsonMessage; import cn.keepbx.jpom.common.BaseServerController; import cn.keepbx.jpom.model.data.NodeModel; +import cn.keepbx.jpom.model.data.UserModel; import cn.keepbx.jpom.model.data.UserOperateLogV1; import cn.keepbx.jpom.service.node.NodeService; +import cn.keepbx.jpom.service.user.UserService; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import org.springframework.http.MediaType; @@ -40,6 +42,8 @@ import java.util.List; public class UserOptLogController extends BaseServerController { @Resource private NodeService nodeService; + @Resource + private UserService userService; /** * 展示用户列表 @@ -49,6 +53,9 @@ public class UserOptLogController extends BaseServerController { // 所有节点 List nodeModels = nodeService.list(); setAttribute("nodeArray", nodeModels); + // 用户 + List userModels = userService.list(); + setAttribute("userArray", userModels); return "user/log/list"; } @@ -83,6 +90,11 @@ public class UserOptLogController extends BaseServerController { entity.set("nodeId".toUpperCase(), selectNode); } + String selectUser = getParameter("selectUser"); + if (StrUtil.isNotEmpty(selectUser)) { + entity.set("userId".toUpperCase(), selectUser); + } + PageResult pageResult = Db.use().page(entity, page); CopyOptions copyOptions = new CopyOptions(); copyOptions.setIgnoreError(true); diff --git a/modules/server/src/main/resources/vm/node/list.vm b/modules/server/src/main/resources/vm/node/list.vm index 812f6e398..11a89e16e 100644 --- a/modules/server/src/main/resources/vm/node/list.vm +++ b/modules/server/src/main/resources/vm/node/list.vm @@ -61,6 +61,7 @@ var config = { cols: [[ {field: 'osName', title: '系统名', width: "10%"}, + {field: 'javaVersion', title: 'Java版本', width: "10%"}, {field: 'jpomVersion', title: 'Jpom版本', width: "10%"}, {field: 'count', title: '项目个数', width: "10%"}, {field: 'runCount', title: '运行中个数', width: "10%"}, diff --git a/modules/server/src/main/resources/vm/user/log/list.vm b/modules/server/src/main/resources/vm/user/log/list.vm index efda479cb..01c598470 100644 --- a/modules/server/src/main/resources/vm/user/log/list.vm +++ b/modules/server/src/main/resources/vm/user/log/list.vm @@ -65,6 +65,18 @@ +
+ +
+ +
+
@@ -107,6 +119,8 @@ renderDate(); // 选中 $("#selectNode option[value='" + apiWhere.selectNode + "']").attr("selected", "selected"); + $("#selectUser option[value='" + apiWhere.selectUser + "']").attr("selected", "selected"); + form.render(); } }); @@ -141,6 +155,11 @@ return true; }); + form.on('select(selectUser)', function (data) { + apiWhere.selectUser = data.value; + reloadTable(); + return true; + }); } function renderDate() { diff --git a/modules/server/src/test/java/TestJvm.java b/modules/server/src/test/java/TestJvm.java index bbdcfb67e..c11f382c2 100644 --- a/modules/server/src/test/java/TestJvm.java +++ b/modules/server/src/test/java/TestJvm.java @@ -1,3 +1,4 @@ +import cn.hutool.system.SystemUtil; import com.sun.tools.attach.AttachNotSupportedException; import sun.jvmstat.monitor.*; @@ -21,7 +22,7 @@ public class TestJvm { // Properties properties = virtualMachine.getAgentProperties(); // System.out.println(properties); // } - + System.out.println(SystemUtil.getJavaRuntimeInfo().getVersion()); // 获取监控主机 MonitoredHost local = MonitoredHost.getMonitoredHost("localhost");