From 62cb72eab9dfbf54ffa24ce2098506ab300854ef Mon Sep 17 00:00:00 2001 From: kdjj2006 Date: Mon, 25 Jul 2022 15:41:38 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9HashMap=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E5=AE=B9=E9=87=8F=EF=BC=8C=E5=87=8F=E5=B0=91=E4=B8=8D?= =?UTF-8?q?=E5=BF=85=E8=A6=81=E7=9A=84=E6=89=A9=E5=AE=B9=EF=BC=8C=E6=8F=90?= =?UTF-8?q?=E9=AB=98=E6=80=A7=E8=83=BD=20(#760)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 获取验证码逻辑,无需加锁,不涉及线程安全问题,提高效率 * 自定义生成策略时,Map容量设置不准确,会导致无必要的扩容 --- .../src/main/java/me/zhengjie/config/RedisConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java b/eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java index bad7f79f..95217a26 100644 --- a/eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java +++ b/eladmin-common/src/main/java/me/zhengjie/config/RedisConfig.java @@ -106,7 +106,7 @@ public class RedisConfig extends CachingConfigurerSupport { @Override public KeyGenerator keyGenerator() { return (target, method, params) -> { - Map container = new HashMap<>(4); + Map container = new HashMap<>(8); Class targetClassClass = target.getClass(); // 类地址 container.put("class",targetClassClass.toGenericString()); From 62fab6e76ef7efb970219ccd12362aab11670f82 Mon Sep 17 00:00:00 2001 From: yujr1990 <109193514+yujr1990@users.noreply.github.com> Date: Wed, 10 Aug 2022 11:12:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=88=A4=E6=96=AD=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @0001 @修改登录日志判断方式 Co-authored-by: yujr --- .../main/java/me/zhengjie/service/impl/LogServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eladmin-logging/src/main/java/me/zhengjie/service/impl/LogServiceImpl.java b/eladmin-logging/src/main/java/me/zhengjie/service/impl/LogServiceImpl.java index 729a7930..6d2d6611 100644 --- a/eladmin-logging/src/main/java/me/zhengjie/service/impl/LogServiceImpl.java +++ b/eladmin-logging/src/main/java/me/zhengjie/service/impl/LogServiceImpl.java @@ -96,9 +96,9 @@ public class LogServiceImpl implements LogService { log.setUsername(username); log.setParams(getParameter(method, joinPoint.getArgs())); // 记录登录用户,隐藏密码信息 - if(log.getDescription().equals("用户登录")){ + if(signature.getName().equals("login") && StringUtils.isNotEmpty(log.getParams())){ JSONObject obj = JSONUtil.parseObj(log.getParams()); - log.setUsername(obj.get("username").toString()); + log.setUsername(obj.getStr("username", "")); log.setParams(JSONUtil.toJsonStr(Dict.create().set("username", log.getUsername()))); } log.setBrowser(browser); @@ -120,7 +120,7 @@ public class LogServiceImpl implements LogService { //将RequestParam注解修饰的参数作为请求参数 RequestParam requestParam = parameters[i].getAnnotation(RequestParam.class); if (requestParam != null) { - Map map = new HashMap<>(4); + Map map = new HashMap<>(2); String key = parameters[i].getName(); if (!StringUtils.isEmpty(requestParam.value())) { key = requestParam.value();