opt:优化日志查询
This commit is contained in:
@@ -0,0 +1,58 @@
|
|||||||
|
package org.nl.common.utils;
|
||||||
|
|
||||||
|
|
||||||
|
import org.nl.modules.logging.annotation.Log;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.context.SmartLifecycle;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.method.HandlerMethod;
|
||||||
|
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
|
||||||
|
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.lang.annotation.Annotation;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @author ZZQ
|
||||||
|
* @Date 2023/10/17 14:51
|
||||||
|
* 接口文档工具
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class ApiDocScan implements SmartLifecycle {
|
||||||
|
@Resource
|
||||||
|
@Qualifier("requestMappingHandlerMapping")
|
||||||
|
public RequestMappingHandlerMapping requestHandlers;
|
||||||
|
|
||||||
|
public static Map<String,String> Log_Url;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() {
|
||||||
|
Map<RequestMappingInfo, HandlerMethod> handlerMethods = requestHandlers.getHandlerMethods();
|
||||||
|
HashMap map = new HashMap<>();
|
||||||
|
handlerMethods.forEach((a,b)->{
|
||||||
|
Set<String> patterns = a.getPatternsCondition().getPatterns();
|
||||||
|
String name = patterns.iterator().next();
|
||||||
|
Annotation[] annotations = b.getMethod().getDeclaredAnnotations();
|
||||||
|
for (Annotation annotation : annotations) {
|
||||||
|
if (annotation instanceof Log){
|
||||||
|
Log log = (Log) annotation;
|
||||||
|
String urlName = log.value();
|
||||||
|
map.put(urlName,name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Log_Url = map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop() {
|
||||||
|
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean isRunning() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package org.nl.common.utils;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
public
|
||||||
|
interface ReturnLockProcess<T> {
|
||||||
|
T process() throws IOException;
|
||||||
|
}
|
||||||
32
lms/nladmin-system/src/main/java/org/nl/wms/util/IPUtil.java
Normal file
32
lms/nladmin-system/src/main/java/org/nl/wms/util/IPUtil.java
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
package org.nl.wms.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.net.NetUtil;
|
||||||
|
|
||||||
|
import java.net.*;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class IPUtil {
|
||||||
|
public static void main(String[] args) throws SocketException {
|
||||||
|
List<String> localhostStrs = getLocalhostStrs();
|
||||||
|
System.out.println(localhostStrs);
|
||||||
|
}
|
||||||
|
public static List<String> getLocalhostStrs(){
|
||||||
|
List<String> ips = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
|
||||||
|
while (interfaces.hasMoreElements()){
|
||||||
|
NetworkInterface nextElement = interfaces.nextElement();
|
||||||
|
for (InterfaceAddress address : nextElement.getInterfaceAddresses()) {
|
||||||
|
InetAddress inetAddress = address.getAddress();
|
||||||
|
if (inetAddress instanceof Inet4Address){
|
||||||
|
ips.add(inetAddress.getHostAddress());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ips;
|
||||||
|
}catch (Exception ex){
|
||||||
|
return ips;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
ENV = 'development'
|
ENV = 'development'
|
||||||
|
|
||||||
# 接口地址
|
# 接口地址
|
||||||
VUE_APP_BASE_API = 'http://localhost:9999'
|
VUE_APP_BASE_API = 'http://localhost:8013'
|
||||||
VUE_APP_WS_API = 'ws://localhost:9999'
|
VUE_APP_WS_API = 'ws://localhost:8013'
|
||||||
|
|
||||||
# 是否启用 babel-plugin-dynamic-import-node插件
|
# 是否启用 babel-plugin-dynamic-import-node插件
|
||||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||||
|
|||||||
Reference in New Issue
Block a user