Browse Source

接口调用日志

limeng 2 years ago
parent
commit
b72d289ec6

+ 11 - 1
mybusiness/src/main/java/com/sooka/system/controller/TULogController.java

@@ -104,8 +104,18 @@ public class TULogController extends BaseController
     }
 
     /**
-     * 修改保存接口调用日志
+     * 查看接口调用日志详情
      */
+    @GetMapping("/detail/{id}")
+    public String detail(@PathVariable("id") String id, ModelMap mmap) {
+        TULog tULog = tULogService.selectTULogById(id);
+        mmap.put("tULog", tULog);
+        return prefix + "/detail";
+    }
+
+        /**
+         * 修改保存接口调用日志
+         */
     @RequiresPermissions("system:log:edit")
     @Log(title = "接口调用日志", businessType = BusinessType.UPDATE)
     @PostMapping("/edit")

+ 127 - 0
mybusiness/src/main/resources/templates/system/log/detail.html

@@ -0,0 +1,127 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
+<head>
+    <th:block th:include="include :: header('修改接口调用日志')" />
+    <th:block th:include="include :: jsonview-css" />
+    <th:block th:include="include :: bootstrap-select-css" />
+</head>
+<body class="white-bg">
+<div class="wrapper wrapper-content animated fadeInRight ibox-content">
+    <form class="form-horizontal m" id="form-log-edit" th:object="${tULog}">
+        <input name="id" th:field="*{id}" type="hidden">
+        <div class="form-group">
+            <label class="col-sm-3 control-label">登录人:</label>
+            <div class="col-sm-8">
+                <input name="loginUser" th:disabled="disabled" th:field="*{loginUser}" class="form-control" type="text">
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">登录名:</label>
+            <div class="col-sm-8">
+                <input name="loginName" th:disabled="disabled" th:field="*{loginName}" class="form-control" type="text">
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">调用接口id:</label>
+            <div class="col-sm-8">
+                <input name="interfaceinfoId" th:disabled="disabled" th:field="*{interfaceinfoId}" class="form-control" type="text">
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">调用接口名:</label>
+            <div class="col-sm-8">
+                <input name="interfaceinfoName" th:disabled="disabled" th:field="*{interfaceinfoName}" class="form-control" type="text">
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">ip地址:</label>
+            <div class="col-sm-8">
+                <input name="ipaddress" th:disabled="disabled" th:field="*{ipaddress}" class="form-control" type="text">
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">操作系统:</label>
+            <div class="col-sm-8">
+                <textarea name="os" class="form-control" style="height:80px;resize:none;" th:field="*{os}" th:readonly="readonly" />
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">平台接口类型:</label>
+            <div class="col-sm-8">
+                <select name="platformInterfacetype" th:disabled="disabled" class="form-control m-b"
+                        th:with="type=${@dict.getType('platform_interfacetype')}">
+                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{platformInterfacetype}"></option>
+                </select>
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">访问浏览器:</label>
+            <div class="col-sm-8">
+                <input name="browser" th:disabled="disabled" th:field="*{browser}" class="form-control" type="text">
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">参数条件:</label>
+            <div class="col-sm-8">
+                <pre id="param"></pre>
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">操作状态:</label>
+            <div class="col-sm-8">
+                <span th:if="${tULog.operationStatus == 1}" class="badge badge-primary">成功</span>
+                <span th:if="${tULog.operationStatus == 0}"class="badge badge-danger">失败</span>
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">返回结果:</label>
+            <div class="col-sm-8">
+                <pre id="results"></pre>
+            </div>
+        </div>
+        <div class="form-group">
+            <label class="col-sm-3 control-label">异常记录:</label>
+            <div class="col-sm-8">
+                <pre id="exceptionLog"></pre>
+            </div>
+        </div>
+    </form>
+</div>
+<th:block th:include="include :: footer" />
+<th:block th:include="include :: jsonview-js" />
+<script th:inline="javascript">
+    let prefix = ctx + "system/log";
+    let platform_interfacetype_datas = [[${@dict.getType('platform_interfacetype')}]];
+    $("#form-log-edit").validate({
+        focusCleanup: true
+    });
+
+    function submitHandler() {
+        if ($.validate.form()) {
+            $.operate.save(prefix + "/edit", $('#form-log-edit').serialize());
+        }
+    }
+
+    $(function() {
+        let param = [[${tULog.param}]];
+        if ($.common.isNotEmpty(param) && param.length < 2000) {
+            $("#param").JSONView(param);
+        } else {
+            $("#param").text(param);
+        }
+        let results = [[${tULog.results}]];
+        if ($.common.isNotEmpty(results) && results.length < 2000) {
+            $("#results").JSONView(results);
+        } else {
+            $("#results").text(results);
+        }
+        let exceptionLog = [[${tULog.exceptionLog}]];
+        if ($.common.isNotEmpty(exceptionLog) && exceptionLog.length < 2000) {
+            $("#exceptionLog").JSONView(exceptionLog);
+        } else {
+            $("#exceptionLog").text(exceptionLog);
+        }
+    });
+</script>
+</body>
+</html>

+ 15 - 11
mybusiness/src/main/resources/templates/system/log/log.html

@@ -50,18 +50,14 @@
 </div>
 <th:block th:include="include :: footer"/>
 <script th:inline="javascript">
-    var editFlag = [[${@permission.hasPermi('system:log:edit')}]];
-    var removeFlag = [[${@permission.hasPermi('system:log:remove')}]];
-    var prefix = ctx + "system/log";
-
-    var platform_interfacetype_datas = [[${@dict.getType('platform_interfacetype')}]];
+    let viewFlag = [[${@permission.hasPermi('system:log:view')}]];
+    let prefix = ctx + "system/log";
+    let platform_interfacetype_datas = [[${@dict.getType('platform_interfacetype')}]];
 
     $(function () {
         var options = {
             url: prefix + "/list",
-            createUrl: prefix + "/add",
-            updateUrl: prefix + "/edit/{id}",
-            removeUrl: prefix + "/remove",
+            detailUrl: prefix + "/detail/{id}",
             exportUrl: prefix + "/export",
             modalName: "接口调用日志",
             columns: [{
@@ -105,6 +101,13 @@
                     title: '调用接口名'
                 },
                 {
+                    field: 'operationStatus',
+                    title: '调用结果',
+                    formatter: function (value,row,index) {
+                        return value == 1 ? '<span class="badge badge-primary">成功</span>' : '<span class="badge badge-danger">失败</span>';
+                    }
+                },
+                {
                     field: 'ipaddress',
                     title: 'ip地址'
                 },
@@ -112,7 +115,7 @@
                     field: 'os',
                     title: '操作系统',
                     cellStyle:formatTableUnit,
-                    formatter :paramsMatter
+                    formatter: paramsMatter
 
                 },
                 {
@@ -124,7 +127,8 @@
                 },
                 {
                     field: 'browser',
-                    title: '访问浏览器'
+                    title: '访问浏览器',
+                    visible: false
                 },
                 {
                     field: 'param',
@@ -156,7 +160,7 @@
                     align: 'center',
                     formatter: function(value, row, index) {
                         var actions = [];
-                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-search"></i>详情</a> ');
+                        actions.push('<a class="btn btn-warning btn-xs ' + viewFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-search"></i>详情</a> ');
                         return actions.join('');
                     }
                 }