diff --git a/yzg-util-base/src/main/java/com/yanzuoguang/util/helper/UrlHelper.java b/yzg-util-base/src/main/java/com/yanzuoguang/util/helper/UrlHelper.java index b54ad5edcb4d6796f665a2af69b4eafca085d047..2a78c9b04b6bae2a598034d90f1ff455d229162c 100644 --- a/yzg-util-base/src/main/java/com/yanzuoguang/util/helper/UrlHelper.java +++ b/yzg-util-base/src/main/java/com/yanzuoguang/util/helper/UrlHelper.java @@ -21,10 +21,10 @@ public class UrlHelper { */ public static String encoding(String from, String encoding) { try { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); for (int i = 0; i < from.length(); i++) { char c = from.charAt(i); - if (c >= 0 && c <= 255) { + if (c <= 255) { sb.append(c); } else { String t = URLEncoder.encode("" + c, encoding); diff --git a/yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/AspectWeb.java b/yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/AspectWeb.java index f643dcc9bab5985baed7968bbc42a0a5b0952a66..9abf01ebd9b7a6af5d3736ecc4d6b2c03bdaea1d 100644 --- a/yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/AspectWeb.java +++ b/yzg-util-cloud/src/main/java/com/yanzuoguang/cloud/aop/AspectWeb.java @@ -7,6 +7,7 @@ import com.yanzuoguang.token.TokenHelper; import com.yanzuoguang.util.exception.ExceptionHelper; import com.yanzuoguang.util.helper.JsonHelper; import com.yanzuoguang.util.helper.TypeHelper; +import com.yanzuoguang.util.helper.UrlHelper; import com.yanzuoguang.util.log.Log; import com.yanzuoguang.util.vo.CloudConfig; import com.yanzuoguang.util.vo.ResponseResult; @@ -90,7 +91,7 @@ public class AspectWeb { } Object requestBody = aspectLogBody.getRequestBody(joinPoint); boolean clear = aspectLog.requestLogInit(); - LogInfoVo log = aspectLog.start(declaringType, TAG, url, requestBody, clear); + LogInfoVo log = aspectLog.start(declaringType, TAG, UrlHelper.getPage(url), String.format("请求地å€:%s 请求内容:%s", url, requestBody), clear); Exception ex = null; boolean isInit = false; diff --git a/yzg-util-db/src/main/java/com/yanzuoguang/log/LogCountTime.java b/yzg-util-db/src/main/java/com/yanzuoguang/log/LogCountTime.java index b83d6112adf584f38db497b17ab4265d94a0a180..9f53579ab5131e8516fc7b6df68d6eeaf3b7e223 100644 --- a/yzg-util-db/src/main/java/com/yanzuoguang/log/LogCountTime.java +++ b/yzg-util-db/src/main/java/com/yanzuoguang/log/LogCountTime.java @@ -65,15 +65,8 @@ public class LogCountTime implements ThreadNext.Next, InitializingBean { private LogUrlCountVo getCount(String tag, String urlFrom, int level) { // åˆå§‹åŒ–日期 initToday(); - // ç›®æ ‡åœ°å€ - String urlTo; - if (urlFrom.contains(URL_PARA_START)) { - urlTo = urlFrom.substring(0, urlFrom.indexOf(URL_PARA_START)); - } else { - urlTo = urlFrom; - } // å…³é”®å— - String key = StringHelper.getId(tag, urlTo, level); + String key = StringHelper.getId(tag, urlFrom, level); // 缓å˜ä¸èŽ·å–对象 LogUrlCountVo ret = todayMemoryCache.get(key); if (ret != null) { @@ -85,7 +78,7 @@ public class LogCountTime implements ThreadNext.Next, InitializingBean { if (ret != null) { return ret; } - ret = new LogUrlCountVo(tag, urlTo, level); + ret = new LogUrlCountVo(tag, urlFrom, level); todayMemoryCache.put(key, ret); return ret; } diff --git a/yzg-util-db/src/main/java/com/yanzuoguang/log/LogLocal.java b/yzg-util-db/src/main/java/com/yanzuoguang/log/LogLocal.java index b8f98e2fd94c922c62750d63d73bec6a3cbf027d..d0e08f1f2f9abce161f6b5148887b9aeee927d31 100644 --- a/yzg-util-db/src/main/java/com/yanzuoguang/log/LogLocal.java +++ b/yzg-util-db/src/main/java/com/yanzuoguang/log/LogLocal.java @@ -2,6 +2,7 @@ package com.yanzuoguang.log; import com.yanzuoguang.util.cache.MemoryCache; import com.yanzuoguang.util.helper.StringHelper; +import com.yanzuoguang.util.helper.UrlHelper; import com.yanzuoguang.util.thread.ThreadNext; import com.yanzuoguang.util.vo.CloudConfig; import org.springframework.beans.factory.InitializingBean; @@ -78,6 +79,8 @@ public class LogLocal implements ThreadNext.Next, InitializingBean { } else { useTime = log.getUseTime(); } + // ä¿®å¤å½“å‰åœ°å€ + log.setUrl(UrlHelper.getPage(log.getUrl())); // 获å–当å‰è¯·æ±‚的级别 int level = 0;