From 4357e8eff68228939f0b4279225eb99ece809ee7 Mon Sep 17 00:00:00 2001 From: zhangzq Date: Mon, 3 Mar 2025 21:26:24 +0800 Subject: [PATCH] =?UTF-8?q?opt:=E4=BC=98=E5=8C=96=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/logging/rest/EsLogController.java | 4 --- .../service/impl/LuceneLogServiceImpl.java | 33 ++++++++++++++----- .../src/main/java/org/nl/wms/sch/AcsUtil.java | 1 - lms/nladmin-ui/public/config.js | 4 +-- lms/nladmin-ui/src/views/loki/view/index.vue | 30 +++++++++++++---- lms/nladmin-ui/vue.config.js | 2 +- 6 files changed, 50 insertions(+), 24 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/modules/logging/rest/EsLogController.java b/lms/nladmin-system/src/main/java/org/nl/modules/logging/rest/EsLogController.java index ae5169a7b..b79e23c7e 100644 --- a/lms/nladmin-system/src/main/java/org/nl/modules/logging/rest/EsLogController.java +++ b/lms/nladmin-system/src/main/java/org/nl/modules/logging/rest/EsLogController.java @@ -24,21 +24,17 @@ import org.springframework.web.bind.annotation.*; public class EsLogController { private final EsLogService esLogService; - @GetMapping("/labels/{type}") - public ResponseEntity labelsValues(@PathVariable String type) { return new ResponseEntity<>(esLogService.getLabelsValues(type), HttpStatus.OK); } @PostMapping("/query") - public ResponseEntity queryAll(@RequestBody LogQuery query) { return new ResponseEntity<>(esLogService.query(query), HttpStatus.OK); } @DeleteMapping("/clearLogs") - public ResponseEntity clearLogs(@RequestBody LogQuery query) { esLogService.clearLogs(query); return new ResponseEntity<>(HttpStatus.OK); diff --git a/lms/nladmin-system/src/main/java/org/nl/modules/logging/service/impl/LuceneLogServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/modules/logging/service/impl/LuceneLogServiceImpl.java index 92a557fc5..e43ffa406 100644 --- a/lms/nladmin-system/src/main/java/org/nl/modules/logging/service/impl/LuceneLogServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/modules/logging/service/impl/LuceneLogServiceImpl.java @@ -16,6 +16,7 @@ import org.apache.lucene.queryparser.classic.QueryParser; import org.apache.lucene.search.*; import org.apache.lucene.store.FSDirectory; import org.apache.lucene.util.BytesRef; +import org.nl.common.utils.ApiDocScan; import org.nl.config.lucene.LuceneAppender; import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.logging.service.EsLogService; @@ -24,13 +25,11 @@ import org.nl.modules.logging.service.dto.LogRepositoryDTO; import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; import org.wltea.analyzer.lucene.IKAnalyzer; import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.List; +import java.util.*; /** * @author ldjun @@ -70,11 +69,27 @@ public class LuceneLogServiceImpl implements EsLogService { @Override public JSONArray getLabelsValues(String type) { JSONArray result = new JSONArray(); - for (String v : INFO_LEVEL) { - JSONObject item = new JSONObject(); - item.put("label", v); - item.put("value", v); - result.add(item); + switch (type){ + case "logLevel": + for (String v : INFO_LEVEL) { + JSONObject item = new JSONObject(); + item.put("label", v); + item.put("value", v); + result.add(item); + } + break; + case "interface": + if (!CollectionUtils.isEmpty(ApiDocScan.Log_Url)){ + Set strings = ApiDocScan.Log_Url.keySet(); + for (String label : strings) { + String value = ApiDocScan.Log_Url.get(label); + JSONObject item = new JSONObject(); + item.put("label", label); + item.put("value", value); + result.add(item); + } + } + break; } return result; } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/AcsUtil.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/AcsUtil.java index 5b65d7be5..6f94a8866 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/AcsUtil.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/AcsUtil.java @@ -29,7 +29,6 @@ public class AcsUtil { return jsonObject; } - @InterfaceLog public JSONObject notifyAcs3(String api, JSONArray list) { log.info("下发ACS参数----------------------------------------+" + api + ",---" + list.toString()); //判断是否连接ACS系统 diff --git a/lms/nladmin-ui/public/config.js b/lms/nladmin-ui/public/config.js index 5fc1438c5..60da82920 100644 --- a/lms/nladmin-ui/public/config.js +++ b/lms/nladmin-ui/public/config.js @@ -1,9 +1,9 @@ window.g = { dev: { - VUE_APP_BASE_API: 'http://localhost:8020' + VUE_APP_BASE_API: 'http://localhost:8013' }, prod: { - VUE_APP_BASE_API: 'http://localhost:8020' + VUE_APP_BASE_API: 'http://localhost:8013' } diff --git a/lms/nladmin-ui/src/views/loki/view/index.vue b/lms/nladmin-ui/src/views/loki/view/index.vue index 3b5987867..b5f94375a 100644 --- a/lms/nladmin-ui/src/views/loki/view/index.vue +++ b/lms/nladmin-ui/src/views/loki/view/index.vue @@ -7,7 +7,7 @@ + + + + + @@ -200,6 +215,7 @@ export default { return { labelsOptions: [], // 所有标签和对应所有值数据 systemOptions: [], // 所有标签和对应所有值数据 + interfaces: [], // 所有标签和对应所有值数据 logLevelValue: '', system: '', timeRange: [], @@ -274,7 +290,7 @@ export default { }, created() { this.initLabelsValues('logLevel') - this.initLabelsValues('system') + this.initLabelsValues('interface') }, methods: { fontType(level) { @@ -294,8 +310,8 @@ export default { if (type === 'logLevel') { this.labelsOptions = res } - if (type === 'system') { - this.systemOptions = res + if (type === 'interface') { + this.interfaces = res } }) }, diff --git a/lms/nladmin-ui/vue.config.js b/lms/nladmin-ui/vue.config.js index 9cea9e1b6..43e738a3d 100644 --- a/lms/nladmin-ui/vue.config.js +++ b/lms/nladmin-ui/vue.config.js @@ -7,7 +7,7 @@ function resolve(dir) { } const name = defaultSettings.title // 网址标题 -const port = 8013 // 端口配置 +const port = 8081 // 端口配置 // All configuration item explanations can be find in https://cli.vuejs.org/config/ module.exports = {