接口日志

This commit is contained in:
2023-01-30 14:29:16 +08:00
parent 3a73d8f76a
commit 5c4576cb11
7 changed files with 161 additions and 11 deletions

View File

@@ -9,10 +9,7 @@ import org.nl.wms.sch.service.PointService;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@@ -37,4 +34,19 @@ public class InterfaceLogController {
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(interfaceLogService.queryAll(whereJson, page), HttpStatus.OK);
}
@DeleteMapping(value = "/delLogs")
@Log("删除所有接口日志")
@ApiOperation("删除所有接口日志")
public ResponseEntity<Object> delLogs(){
interfaceLogService.delLogs();
return new ResponseEntity<>(HttpStatus.OK);
}
@GetMapping("/logTypeList")
@Log("查询接口日志类型下拉框")
@ApiOperation("查询接口日志类型下拉框")
public ResponseEntity<Object> logTypeList() {
return new ResponseEntity<>(interfaceLogService.logTypeList(), HttpStatus.OK);
}
}

View File

@@ -15,6 +15,8 @@
*/
package org.nl.modules.logging.service;
import com.alibaba.fastjson.JSONArray;
import org.nl.modules.logging.InterfaceLogType;
import org.springframework.data.domain.Pageable;
import java.util.Map;
@@ -34,4 +36,10 @@ public interface InterfaceLogService {
Map<String,Object> queryAll(Map whereJson, Pageable page);
/**
* 删除所有日志
*/
void delLogs();
JSONArray logTypeList();
}

View File

@@ -15,16 +15,21 @@
*/
package org.nl.modules.logging.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.logging.InterfaceLogType;
import org.nl.modules.logging.service.InterfaceLogService;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.ResultBean;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.WqlUtil;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
@@ -39,9 +44,29 @@ public class InterfaceLogServiceImpl implements InterfaceLogService {
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable pageable) {
String where = "1=1";
ResultBean rb = WQLObject.getWQLObject("sys_interface_log").pagequery(WqlUtil.getHttpContext(pageable), where, "create_time desc ");
final JSONObject json = rb.pageResult();
HashMap map = new HashMap();
map.put("flag", "1");
map.put("blurry", whereJson.get("blurry"));
map.put("logType", whereJson.get("logType"));
map.put("begin_time", whereJson.get("begin_time"));
map.put("end_time", whereJson.get("end_time"));
JSONObject json = WQL.getWO("QSCH_INTERFACE_LOGS").addParamMap(map).pageQuery(WqlUtil.getHttpContext(pageable), "create_time desc");
return json;
}
@Override
public void delLogs() {
WQLObject logTab = WQLObject.getWQLObject("sys_interface_log");
logTab.delete("log_id is not null");
}
@Override
public JSONArray logTypeList() {
JSONArray jsonArray = new JSONArray();
InterfaceLogType[] values = InterfaceLogType.values();
for (InterfaceLogType value : values) {
jsonArray.add(value.getDesc());
}
return jsonArray;
}
}

View File

@@ -0,0 +1,68 @@
[交易说明]
交易名: 接口日志分页查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.blurry TYPEAS s_string
输入.logType TYPEAS s_string
输入.begin_time TYPEAS s_string
输入.end_time TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
*
FROM
sys_interface_log
WHERE
1=1
OPTION 输入.blurry <> ""
description like "%" 输入.blurry "%"
ENDOPTION
OPTION 输入.logType <> ""
log_type = 输入.logType
ENDOPTION
OPTION 输入.begin_time <> ""
create_time >= 输入.begin_time
ENDOPTION
OPTION 输入.end_time <> ""
create_time <= 输入.end_time
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF