update 优化空校验处理

This commit is contained in:
疯狂的狮子li 2021-09-24 11:17:25 +08:00
parent 77bce8b1e8
commit 6f870e11ff
2 changed files with 11 additions and 4 deletions

View File

@ -27,6 +27,9 @@ public class AddressUtils {
public static String getRealAddressByIP(String ip) { public static String getRealAddressByIP(String ip) {
String address = UNKNOWN; String address = UNKNOWN;
if (StringUtils.isBlank(ip)){
return address;
}
// 内网不查询 // 内网不查询
ip = "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : HtmlUtil.cleanHtmlTag(ip); ip = "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : HtmlUtil.cleanHtmlTag(ip);
if (NetUtil.isInnerIP(ip)) { if (NetUtil.isInnerIP(ip)) {

View File

@ -1,5 +1,6 @@
package com.ruoyi.framework.config; package com.ruoyi.framework.config;
import cn.hutool.core.util.ArrayUtil;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -41,10 +42,13 @@ public class AsyncConfig extends AsyncConfigurerSupport {
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return (throwable, method, objects) -> { return (throwable, method, objects) -> {
throwable.printStackTrace(); throwable.printStackTrace();
throw new ServiceException( StringBuilder sb = new StringBuilder();
"Exception message - " + throwable.getMessage() sb.append("Exception message - ").append(throwable.getMessage())
+ ", Method name - " + method.getName() .append(", Method name - ").append(method.getName());
+ ", Parameter value - " + Arrays.toString(objects)); if (ArrayUtil.isNotEmpty(objects)) {
sb.append(", Parameter value - ").append(Arrays.toString(objects));
}
throw new ServiceException(sb.toString());
}; };
} }