From eec2c1eb56a6e82561d43a99944b7d0aa0d74c2a Mon Sep 17 00:00:00 2001
From: chenjinlong <22208488@qq.com>
Date: Wed, 13 Jan 2021 19:46:38 +0800
Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97?=
=?UTF-8?q?=E3=80=91=E3=80=90=E7=99=BB=E5=BD=95=E6=97=A5=E5=BF=97=E3=80=91?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=96=B0=E5=A2=9E=E4=B8=8E=E5=AE=8C=E5=96=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 6 +
.../guns/modular/log/LogViewController.java | 26 +++-
.../modular/log/LoginLogViewController.java | 26 ++--
src/main/resources/application-dev.yml | 2 +-
.../webapp/assets/modular/system/log/log.js | 121 ++++++++++--------
.../assets/modular/system/log/log_detail.js | 10 ++
.../assets/modular/system/log/login_log.js | 42 +++---
.../webapp/pages/modular/system/log/log.html | 19 +--
.../pages/modular/system/log/log_detail.html | 99 ++++++++++++++
.../pages/modular/system/log/login_log.html | 5 +-
10 files changed, 247 insertions(+), 109 deletions(-)
create mode 100644 src/main/webapp/assets/modular/system/log/log_detail.js
create mode 100644 src/main/webapp/pages/modular/system/log/log_detail.html
diff --git a/pom.xml b/pom.xml
index cd2825f0..bc10a469 100644
--- a/pom.xml
+++ b/pom.xml
@@ -108,6 +108,12 @@
1.0.0
+
+ cn.stylefeng.roses
+ message-spring-boot-starter
+ 1.0.0
+
+
org.springframework.boot
spring-boot-starter-data-redis
diff --git a/src/main/java/cn/stylefeng/guns/modular/log/LogViewController.java b/src/main/java/cn/stylefeng/guns/modular/log/LogViewController.java
index 344e8c68..c68b246c 100644
--- a/src/main/java/cn/stylefeng/guns/modular/log/LogViewController.java
+++ b/src/main/java/cn/stylefeng/guns/modular/log/LogViewController.java
@@ -6,12 +6,10 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
/**
- * 操作业务日志管理控制器界面渲染
+ * 业务日志视图控制器
*
- * @param
- * @return
- * @author TSQ
- * @date 2021/1/5 14:44
+ * @author chenjinlong
+ * @date 2021/1/13 19:45
*/
@Controller
@Slf4j
@@ -28,9 +26,23 @@ public class LogViewController {
* @author TSQ
* @date 2021/1/5 15:18
*/
- @GetResource(name="操作日志管理列表", path ="", requiredPermission = false, requiredLogin = false)
- public String indexView(){
+ @GetResource(name = "操作日志管理列表", path = "")
+ public String indexView() {
return PREFIX + "/log.html";
}
+
+ /**
+ * 业务日志详情-视图
+ *
+ * @param
+ * @return
+ * @author chenjinlong
+ * @date 2021/1/13 19:45
+ */
+ @GetResource(name = "业务日志详情-视图", path = "detailView")
+ public String detailView() {
+ return PREFIX + "/log_detail.html";
+ }
+
}
diff --git a/src/main/java/cn/stylefeng/guns/modular/log/LoginLogViewController.java b/src/main/java/cn/stylefeng/guns/modular/log/LoginLogViewController.java
index 24c73672..6ab0d26b 100644
--- a/src/main/java/cn/stylefeng/guns/modular/log/LoginLogViewController.java
+++ b/src/main/java/cn/stylefeng/guns/modular/log/LoginLogViewController.java
@@ -6,30 +6,28 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
/**
- * 登陆日志管理控制器界面渲染
+ * 登录日志视图控制器
*
- * @param
- * @return
- * @author TSQ
- * @date 2021/1/5 14:42
+ * @author chenjinlong
+ * @date 2021/1/13 19:45
*/
@Controller
@Slf4j
-@ApiResource(name = "登陆日志管理相关的界面渲染", path = "loginLog")
+@ApiResource(name = "登陆日志管理相关的界面渲染", path = "/view/loginLog")
public class LoginLogViewController {
private String PREFIX = "/modular/system/log";
/**
- * 登陆日志管理列表
- *
- * @param
- * @return
- * @author TSQ
- * @date 2021/1/5 15:17
+ * 登录日志-视图
+ *
+ * @param
+ * @return
+ * @author chenjinlong
+ * @date 2021/1/13 19:44
*/
- @GetResource(name="登陆日志管理列表" , path = "", requiredPermission = false ,requiredLogin = false)
- public String indexView(){
+ @GetResource(name = "登录日志-视图", path = "")
+ public String indexView() {
return PREFIX + "/login_log.html";
}
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index 2fb083f2..3834840e 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -3,7 +3,7 @@ spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://114.215.203.183:3306/guns_beetl_dev?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=CTT
- username: beetl_dev
+ username: root
password: sksTykzfZeMFbwJf
# 连接池大小根据实际情况调整
diff --git a/src/main/webapp/assets/modular/system/log/log.js b/src/main/webapp/assets/modular/system/log/log.js
index 9de2c030..c074702d 100644
--- a/src/main/webapp/assets/modular/system/log/log.js
+++ b/src/main/webapp/assets/modular/system/log/log.js
@@ -1,4 +1,4 @@
-layui.use(['HttpRequest', 'treeTable', 'laydate', 'func' ,'form'], function () {
+layui.use(['HttpRequest', 'treeTable', 'laydate', 'func', 'form'], function () {
var $ = layui.$;
var table = layui.table;
var HttpRequest = layui.HttpRequest;
@@ -20,10 +20,9 @@ layui.use(['HttpRequest', 'treeTable', 'laydate', 'func' ,'form'], function () {
return [[
{type: 'checkbox'},
{field: 'logId', hide: true, sort: true, title: 'id'},
- /*{field: 'logType', align: "center", sort: true, title: '日志类型'},*/
{field: 'logName', align: "center", sort: true, title: '日志名称'},
- {field: 'createUser', align: "center", sort: true, title: '用户名称'},
- {field: 'appName', align: "center", sort: true, title: '服务器名'},
+ {field: 'userId', align: "center", sort: true, title: '用户名称'},
+ {field: 'appName', align: "center", sort: true, title: '服务名称'},
{field: 'requestUrl', align: "center", sort: true, title: '方法名'},
{field: 'createTime', align: "center", sort: true, title: '时间'},
{field: 'logContent', align: "center", sort: true, title: '具体消息'},
@@ -36,63 +35,70 @@ layui.use(['HttpRequest', 'treeTable', 'laydate', 'func' ,'form'], function () {
*/
Log.search = function () {
var queryData = {};
- queryData['beginDateTime'] = $("#beginTime").val();
- queryData['endDateTime'] = $("#endTime").val();
+ queryData['beginDate'] = $("#beginDate").val();
+ queryData['endDate'] = $("#endDate").val();
queryData['logName'] = $("#logName").val();
+ queryData['appName'] = $("#appName").val();
// queryData['logType'] = $("#logType").val();
table.reload(Log.tableId, {
where: queryData, page: {curr: 1}
});
};
+ // 点击详情
+ Log.openDetailDlg = function (data) {
+ func.open({
+ height: 800,
+ title: '日志详情',
+ content: Feng.ctxPath + '/view/log/detailView?logId=' + data.logId,
+ tableId: Log.tableId
+ });
+ };
+
/**
* 导出excel按钮
*/
- // Log.exportExcel = function () {
- // var checkRows = table.checkStatus(Log.tableId);
- // if (checkRows.data.length === 0) {
- // Feng.error("请选择要导出的数据");
- // } else {
- // table.exportFile(tableResult.config.id, checkRows.data, 'xls');
- // }
- // };
-
- /**
- * 日志详情
- */
- // Log.logDetail = function (param) {
- // var ajax = new $ax(Feng.ctxPath + "/log/detail/" + param.operationLogId, function (data) {
- // Feng.infoDetail("日志详情", data.regularMessage);
- // }, function (data) {
- // Feng.error("获取详情失败!");
- // });
- // ajax.start();
- // };
+ Log.exportExcel = function () {
+ var checkRows = table.checkStatus(Log.tableId);
+ if (checkRows.data.length === 0) {
+ Feng.error("请选择要导出的数据");
+ } else {
+ table.exportFile(tableResult.config.id, checkRows.data, 'xls');
+ }
+ };
/**
* 清空日志
*/
- // Log.cleanLog = function () {
- // Feng.confirm("是否清空所有日志?", function () {
- // var ajax = new $ax(Feng.ctxPath + "/log/delLog", function (data) {
- // Feng.success("清空日志成功!");
- // Log.search();
- // }, function (data) {
- // Feng.error("清空日志失败!");
- // });
- // ajax.start();
- // });
- // };
+ Log.cleanLog = function () {
+ var queryData = {};
+ queryData['beginDateTime'] = $("#beginDate").val();
+ queryData['endDateTime'] = $("#endDate").val();
+ queryData['appName'] = $("#appName").val();
+ if (queryData.beginDateTime == "" || queryData.endDateTime == "" || queryData.appName == "") {
+ Feng.error("请选择开始时间、结束时间和服务名称");
+ return false;
+ }
+ var operation = function () {
+ new HttpRequest(Feng.ctxPath + '/logManager/delete', 'post', function (data) {
+ Feng.success("删除日志成功!");
+ table.reload(Log.tableId);
+ }, function (data) {
+ Feng.error("删除日志失败!" + data.message + "!");
+ }).set(setData).start(true);
+ };
+ Feng.confirm("是否删除日志?", operation);
+ };
// 渲染时间选择框
laydate.render({
- elem: '#createTime'
+ elem: '#beginDate'
});
- // 渲染时间选择框
- // laydate.render({
- // elem: '#createTime'
- // });
+ //渲染时间选择框
+ laydate.render({
+ elem: '#endDate'
+ });
// 渲染表格
var tableResult = table.render({
@@ -111,18 +117,23 @@ layui.use(['HttpRequest', 'treeTable', 'laydate', 'func' ,'form'], function () {
Log.search();
});
- // 搜索按钮点击事件
- // $('#btnClean').click(function () {
- // Log.cleanLog();
- // });
+ // 清空按钮点击事件
+ $('#btnClean').click(function () {
+ Log.cleanLog();
+ });
- // 工具条点击事件
- // table.on('tool(' + Log.tableId + ')', function (obj) {
- // var data = obj.data;
- // var layEvent = obj.event;
- //
- // if (layEvent === 'detail') {
- // Log.logDetail(data);
- // }
- // });
+ // 导出excel
+ $('#btnExp').click(function () {
+ Log.exportExcel();
+ });
+
+
+ //工具条点击事件
+ table.on('tool(' + Log.tableId + ')', function (obj) {
+ var data = obj.data;
+ var layEvent = obj.event;
+ if (layEvent === 'detail') {
+ Log.openDetailDlg(data);
+ }
+ });
});
diff --git a/src/main/webapp/assets/modular/system/log/log_detail.js b/src/main/webapp/assets/modular/system/log/log_detail.js
new file mode 100644
index 00000000..6c4c6f4f
--- /dev/null
+++ b/src/main/webapp/assets/modular/system/log/log_detail.js
@@ -0,0 +1,10 @@
+layui.use(['form', 'HttpRequest'], function () {
+ var form = layui.form;
+ var HttpRequest = layui.HttpRequest;
+
+ //获取信息详情填充表单
+ var request = new HttpRequest(Feng.ctxPath + "/logManager/detail?logId=" + Feng.getUrlParam("logId"), 'get');
+ var result = request.start();
+ form.val('logForm', result.data);
+
+});
\ No newline at end of file
diff --git a/src/main/webapp/assets/modular/system/log/login_log.js b/src/main/webapp/assets/modular/system/log/login_log.js
index d2aa4715..0b114cec 100644
--- a/src/main/webapp/assets/modular/system/log/login_log.js
+++ b/src/main/webapp/assets/modular/system/log/login_log.js
@@ -1,7 +1,6 @@
-layui.use(['layer', 'table', 'ax', 'laydate'], function () {
+layui.use(['layer', 'table', 'HttpRequest', 'laydate'], function () {
var $ = layui.$;
- var $ax = layui.ax;
- var layer = layui.layer;
+ var HttpRequest = layui.HttpRequest;
var table = layui.table;
var laydate = layui.laydate;
@@ -18,12 +17,13 @@ layui.use(['layer', 'table', 'ax', 'laydate'], function () {
LoginLog.initColumn = function () {
return [[
{type: 'checkbox'},
- {field: 'menuId', hide: true, sort: true, title: 'id'},
- {field: 'logName', align: "center", sort: true, title: '日志名称'},
- {field: 'userName', align: "center", sort: true, title: '用户名称'},
+ {field: 'menuId', hide: true, sort: true, title: 'id'},
+ {field: 'userId', align: "center", sort: true, title: '用户名'},
+ {field: 'llgName', align: "center", sort: true, title: '日志名称'},
+ {field: 'llgSucceed', align: "center", sort: true, title: '执行结果'},
{field: 'createTime', align: "center", sort: true, title: '时间'},
- {field: 'regularMessage', align: "center", sort: true, title: '具体消息'},
- {field: 'ipAddress', align: "center", sort: true, title: 'ip'}
+ {field: 'llgMessage', align: "center", sort: true, title: '具体消息'},
+ {field: 'llgIpAddress', align: "center", sort: true, title: 'IP'}
]];
};
@@ -34,7 +34,9 @@ layui.use(['layer', 'table', 'ax', 'laydate'], function () {
var queryData = {};
queryData['beginTime'] = $("#beginTime").val();
queryData['endTime'] = $("#endTime").val();
- queryData['logName'] = $("#logName").val();
+ queryData['llgName'] = $("#llgName").val();
+
+ console.log(queryData);
table.reload(LoginLog.tableId, {
where: queryData, page: {curr: 1}
});
@@ -54,15 +56,16 @@ layui.use(['layer', 'table', 'ax', 'laydate'], function () {
//清空日志
LoginLog.cleanLog = function () {
- Feng.confirm("是否清空所有日志?", function () {
- var ajax = new $ax(Feng.ctxPath + "/loginLog/delLoginLog", function (data) {
+ var operation = function () {
+ new HttpRequest(Feng.ctxPath + '/loginLog/deleteAll', 'get', function (data) {
Feng.success("清空日志成功!");
- LoginLog.search();
+ table.reload(LoginLog.tableId);
}, function (data) {
- Feng.error("清空日志失败!");
- });
- ajax.start();
- });
+ Feng.error("清空日志失败!" + data.message + "!");
+ }).start();
+ };
+ Feng.confirm("是否清空所有日志?", operation);
+
};
//渲染时间选择框
@@ -78,11 +81,12 @@ layui.use(['layer', 'table', 'ax', 'laydate'], function () {
// 渲染表格
var tableResult = table.render({
elem: '#' + LoginLog.tableId,
- url: Feng.ctxPath + '/loginLog/list',
+ url: Feng.ctxPath + '/loginLog/page',
page: true,
height: "full-98",
cellMinWidth: 100,
- cols: LoginLog.initColumn()
+ cols: LoginLog.initColumn(),
+ parseData: Feng.parseData
});
// 搜索按钮点击事件
@@ -90,7 +94,7 @@ layui.use(['layer', 'table', 'ax', 'laydate'], function () {
LoginLog.search();
});
- // 搜索按钮点击事件
+ // 清空按钮点击事件
$('#btnClean').click(function () {
LoginLog.cleanLog();
});
diff --git a/src/main/webapp/pages/modular/system/log/log.html b/src/main/webapp/pages/modular/system/log/log.html
index a22fcff6..27e9a751 100644
--- a/src/main/webapp/pages/modular/system/log/log.html
+++ b/src/main/webapp/pages/modular/system/log/log.html
@@ -12,25 +12,20 @@
@}
\ No newline at end of file
diff --git a/src/main/webapp/pages/modular/system/log/log_detail.html b/src/main/webapp/pages/modular/system/log/log_detail.html
new file mode 100644
index 00000000..917a5d68
--- /dev/null
+++ b/src/main/webapp/pages/modular/system/log/log_detail.html
@@ -0,0 +1,99 @@
+@layout("/layout/_form.html",{js:["/assets/modular/system/log/log_detail.js"]}){
+
+
+
+@}
\ No newline at end of file
diff --git a/src/main/webapp/pages/modular/system/log/login_log.html b/src/main/webapp/pages/modular/system/log/login_log.html
index 9b964657..f790a03a 100644
--- a/src/main/webapp/pages/modular/system/log/login_log.html
+++ b/src/main/webapp/pages/modular/system/log/login_log.html
@@ -18,7 +18,7 @@
-
+
搜索
@@ -32,4 +32,7 @@
+
+
+
@}
\ No newline at end of file