From eaa12de7404868ed9a9627bcf45468a6b452786f Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 22 Mar 2022 16:47:56 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=B0=E7=BE=A4?= =?UTF-8?q?=E5=8F=B7=EF=BC=9A167385320?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- ruoyi-ui/src/layout/index.vue | 2 +- ruoyi-ui/src/views/index.vue | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 07dbeebf9..1801b6d48 100644 --- a/README.md +++ b/README.md @@ -94,4 +94,4 @@ ## 若依前后端分离交流群 -QQ群: [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/已满-104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](https://img.shields.io/badge/已满-186866453-blue.svg)](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [![加入QQ群](https://img.shields.io/badge/已满-201396349-blue.svg)](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [![加入QQ群](https://img.shields.io/badge/已满-101456076-blue.svg)](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [![加入QQ群](https://img.shields.io/badge/已满-101539465-blue.svg)](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) [![加入QQ群](https://img.shields.io/badge/264312783-blue.svg)](https://jq.qq.com/?_wv=1027&k=EI9an8lJ) 点击按钮入群。 \ No newline at end of file +QQ群: [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/已满-104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](https://img.shields.io/badge/已满-186866453-blue.svg)](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [![加入QQ群](https://img.shields.io/badge/已满-201396349-blue.svg)](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [![加入QQ群](https://img.shields.io/badge/已满-101456076-blue.svg)](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [![加入QQ群](https://img.shields.io/badge/已满-101539465-blue.svg)](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) [![加入QQ群](https://img.shields.io/badge/已满-264312783-blue.svg)](https://jq.qq.com/?_wv=1027&k=EI9an8lJ) [![加入QQ群](https://img.shields.io/badge/167385320-blue.svg)](https://jq.qq.com/?_wv=1027&k=SWCtLnMz) 点击按钮入群。 \ No newline at end of file diff --git a/ruoyi-ui/src/layout/index.vue b/ruoyi-ui/src/layout/index.vue index 9540aa4b3..202cfcd60 100644 --- a/ruoyi-ui/src/layout/index.vue +++ b/ruoyi-ui/src/layout/index.vue @@ -102,7 +102,7 @@ export default { } .sidebarHide .fixed-header { - width: calc(100%); + width: 100%; } .mobile .fixed-header { diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index 1cf7954be..f5ee3b604 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -119,10 +119,10 @@

QQ群:满937441 - 满887144332 满180251782 满104180207 - 满186866453 满201396349 满101456076 满101539465 - - 264312783满887144332 满180251782 满104180207 满186866453 + 满201396349 满101456076 满101539465 满264312783 + + 167385320

From 098286fcafba866660f2bce8056792e3ec791b27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Clumingsyc=E2=80=9D?= Date: Fri, 25 Mar 2022 18:50:51 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9RedisCache=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=BD=A2=E5=8F=82=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ruoyi/common/core/redis/RedisCache.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java index 3246b7731..161a6faf1 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java @@ -213,12 +213,12 @@ public class RedisCache * 删除Hash中的数据 * * @param key - * @param mapkey + * @param hKey */ - public void delCacheMapValue(final String key, final String hkey) + public void delCacheMapValue(final String key, final String hKey) { HashOperations hashOperations = redisTemplate.opsForHash(); - hashOperations.delete(key, hkey); + hashOperations.delete(key, hKey); } /** From 6605bf35a845b8965981d72276734201e53c3826 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sat, 26 Mar 2022 17:28:58 +0800 Subject: [PATCH 3/9] reset pr 452 --- .../main/java/com/ruoyi/generator/controller/GenController.java | 1 + 1 file changed, 1 insertion(+) diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java index 97ff95c18..2e9e760a9 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java @@ -204,6 +204,7 @@ public class GenController extends BaseController private void genCode(HttpServletResponse response, byte[] data) throws IOException { response.reset(); + response.addHeader("Access-Control-Allow-Origin", "*"); response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); response.setHeader("Content-Disposition", "attachment; filename=\"ruoyi.zip\""); response.addHeader("Content-Length", "" + data.length); From 61034d4ddecd0b3056a7fb38a737b0e0cfc33b9c Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sun, 27 Mar 2022 14:36:31 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AF=BC=E5=87=BAexcel?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=A0=BC=E9=AA=8C=E8=AF=81,=E5=8C=85?= =?UTF-8?q?=E5=90=AB=E5=8F=98=E6=9B=B4=E4=B8=BA=E5=BC=80=E5=A4=B4.?= =?UTF-8?q?=E9=98=B2=E6=AD=A2=E6=AD=A3=E5=B8=B8=E5=86=85=E5=AE=B9=E8=A2=AB?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ruoyi/common/utils/poi/ExcelUtil.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index eb9407509..9a837c430 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -22,6 +22,7 @@ import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; +import org.apache.commons.lang3.RegExUtils; import org.apache.poi.hssf.usermodel.HSSFClientAnchor; import org.apache.poi.hssf.usermodel.HSSFPicture; import org.apache.poi.hssf.usermodel.HSSFPictureData; @@ -88,6 +89,8 @@ public class ExcelUtil { private static final Logger log = LoggerFactory.getLogger(ExcelUtil.class); + public static final String FORMULA_REGEX_STR = "=|-|\\+|@"; + public static final String[] FORMULA_STR = { "=", "-", "+", "@" }; /** @@ -714,9 +717,9 @@ public class ExcelUtil { String cellValue = Convert.toStr(value); // 对于任何以表达式触发字符 =-+@开头的单元格,直接使用tab字符作为前缀,防止CSV注入。 - if (StringUtils.containsAny(cellValue, FORMULA_STR)) + if (StringUtils.startsWithAny(cellValue, FORMULA_STR)) { - cellValue = StringUtils.replaceEach(cellValue, FORMULA_STR, new String[] { "\t=", "\t-", "\t+", "\t@" }); + cellValue = RegExUtils.replaceFirst(cellValue, FORMULA_REGEX_STR, "\t$0"); } cell.setCellValue(StringUtils.isNull(cellValue) ? attr.defaultValue() : cellValue + attr.suffix()); } From 2043d1f43944f30049c1c9fabda6b227341e58b9 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sun, 27 Mar 2022 14:36:48 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E4=BC=98=E5=8C=96IP=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=88=B0=E5=A4=9A=E4=B8=AA=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/common/utils/ip/IpUtils.java | 85 +++++++++++++++++-- 1 file changed, 77 insertions(+), 8 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java index 771e3f840..eecf8d65f 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ip/IpUtils.java @@ -4,7 +4,6 @@ import java.net.InetAddress; import java.net.UnknownHostException; import javax.servlet.http.HttpServletRequest; import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.html.EscapeUtil; /** * 获取IP方法 @@ -13,6 +12,12 @@ import com.ruoyi.common.utils.html.EscapeUtil; */ public class IpUtils { + /** + * 获取客户端IP + * + * @param request 请求对象 + * @return IP地址 + */ public static String getIpAddr(HttpServletRequest request) { if (request == null) @@ -41,15 +46,28 @@ public class IpUtils { ip = request.getRemoteAddr(); } - return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : EscapeUtil.clean(ip); + + return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : getMultistageReverseProxyIp(ip); } + /** + * 检查是否为内部IP地址 + * + * @param ip IP地址 + * @return 结果 + */ public static boolean internalIp(String ip) { byte[] addr = textToNumericFormatV4(ip); return internalIp(addr) || "127.0.0.1".equals(ip); } + /** + * 检查是否为内部IP地址 + * + * @param addr byte地址 + * @return 结果 + */ private static boolean internalIp(byte[] addr) { if (StringUtils.isNull(addr) || addr.length < 2) @@ -110,7 +128,8 @@ public class IpUtils { case 1: l = Long.parseLong(elements[0]); - if ((l < 0L) || (l > 4294967295L)) { + if ((l < 0L) || (l > 4294967295L)) + { return null; } bytes[0] = (byte) (int) (l >> 24 & 0xFF); @@ -120,12 +139,14 @@ public class IpUtils break; case 2: l = Integer.parseInt(elements[0]); - if ((l < 0L) || (l > 255L)) { + if ((l < 0L) || (l > 255L)) + { return null; } bytes[0] = (byte) (int) (l & 0xFF); l = Integer.parseInt(elements[1]); - if ((l < 0L) || (l > 16777215L)) { + if ((l < 0L) || (l > 16777215L)) + { return null; } bytes[1] = (byte) (int) (l >> 16 & 0xFF); @@ -136,13 +157,15 @@ public class IpUtils for (i = 0; i < 2; ++i) { l = Integer.parseInt(elements[i]); - if ((l < 0L) || (l > 255L)) { + if ((l < 0L) || (l > 255L)) + { return null; } bytes[i] = (byte) (int) (l & 0xFF); } l = Integer.parseInt(elements[2]); - if ((l < 0L) || (l > 65535L)) { + if ((l < 0L) || (l > 65535L)) + { return null; } bytes[2] = (byte) (int) (l >> 8 & 0xFF); @@ -152,7 +175,8 @@ public class IpUtils for (i = 0; i < 4; ++i) { l = Integer.parseInt(elements[i]); - if ((l < 0L) || (l > 255L)) { + if ((l < 0L) || (l > 255L)) + { return null; } bytes[i] = (byte) (int) (l & 0xFF); @@ -169,6 +193,11 @@ public class IpUtils return bytes; } + /** + * 获取IP地址 + * + * @return 本地IP地址 + */ public static String getHostIp() { try @@ -181,6 +210,11 @@ public class IpUtils return "127.0.0.1"; } + /** + * 获取主机名 + * + * @return 本地主机名 + */ public static String getHostName() { try @@ -192,4 +226,39 @@ public class IpUtils } return "未知"; } + + /** + * 从多级反向代理中获得第一个非unknown IP地址 + * + * @param ip 获得的IP地址 + * @return 第一个非unknown IP地址 + */ + public static String getMultistageReverseProxyIp(String ip) + { + // 多级反向代理检测 + if (ip != null && ip.indexOf(",") > 0) + { + final String[] ips = ip.trim().split(","); + for (String subIp : ips) + { + if (false == isUnknown(subIp)) + { + ip = subIp; + break; + } + } + } + return ip; + } + + /** + * 检测给定字符串是否为未知,多用于检测HTTP请求相关 + * + * @param checkString 被检测的字符串 + * @return 是否未知 + */ + public static boolean isUnknown(String checkString) + { + return StringUtils.isBlank(checkString) || "unknown".equalsIgnoreCase(checkString); + } } \ No newline at end of file From d5f9b5b74a64cb1eeeab5fa503ba38122733d05f Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 30 Mar 2022 10:38:51 +0800 Subject: [PATCH 6/9] =?UTF-8?q?topNav=E8=87=AA=E5=AE=9A=E4=B9=89=E9=9A=90?= =?UTF-8?q?=E8=97=8F=E4=BE=A7=E8=BE=B9=E6=A0=8F=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/components/TopNav/index.vue | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/ruoyi-ui/src/components/TopNav/index.vue b/ruoyi-ui/src/components/TopNav/index.vue index cabb25825..0cc24dba8 100644 --- a/ruoyi-ui/src/components/TopNav/index.vue +++ b/ruoyi-ui/src/components/TopNav/index.vue @@ -30,13 +30,14 @@