From 8ddd71a8184802f4cad6e3c8e51001c9ead40397 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期一, 12 七月 2021 14:29:49 +0800
Subject: [PATCH] update 使用hutool重构 判断是否url

---
 /dev/null                                                                        |   28 ----------------------------
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java |    6 +++---
 ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MetaVo.java                |    4 ++--
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java |    4 ++--
 4 files changed, 7 insertions(+), 35 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java
index f418541..246abf4 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java
@@ -1,5 +1,6 @@
 package com.ruoyi.web.controller.system;
 
+import cn.hutool.core.lang.Validator;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.constant.UserConstants;
 import com.ruoyi.common.core.controller.BaseController;
@@ -9,7 +10,6 @@
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.ServletUtils;
-import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.framework.web.service.TokenService;
 import com.ruoyi.system.service.ISysMenuService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -97,7 +97,7 @@
         {
             return AjaxResult.error("鏂板鑿滃崟'" + menu.getMenuName() + "'澶辫触锛岃彍鍗曞悕绉板凡瀛樺湪");
         }
-        else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
+        else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !Validator.isUrl(menu.getPath()))
         {
             return AjaxResult.error("鏂板鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屽湴鍧�蹇呴』浠ttp(s)://寮�澶�");
         }
@@ -117,7 +117,7 @@
         {
             return AjaxResult.error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛岃彍鍗曞悕绉板凡瀛樺湪");
         }
-        else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !StringUtils.ishttp(menu.getPath()))
+        else if (UserConstants.YES_FRAME.equals(menu.getIsFrame()) && !Validator.isUrl(menu.getPath()))
         {
             return AjaxResult.error("淇敼鑿滃崟'" + menu.getMenuName() + "'澶辫触锛屽湴鍧�蹇呴』浠ttp(s)://寮�澶�");
         }
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java
deleted file mode 100644
index f3f29f4..0000000
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/StringUtils.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.ruoyi.common.utils;
-
-import cn.hutool.core.util.StrUtil;
-import com.ruoyi.common.constant.Constants;
-
-/**
- * 瀛楃涓插伐鍏风被
- *
- * @author ruoyi
- */
-public class StringUtils extends org.apache.commons.lang3.StringUtils {
-	/** 绌哄瓧绗︿覆 */
-	private static final String NULLSTR = "";
-
-	/** 涓嬪垝绾� */
-	private static final char SEPARATOR = '_';
-
-	/**
-	 * 鏄惁涓篽ttp(s)://寮�澶�
-	 *
-	 * @param link 閾炬帴
-	 * @return 缁撴灉
-	 */
-	public static boolean ishttp(String link) {
-		return StrUtil.startWithAny(link, Constants.HTTP, Constants.HTTPS);
-	}
-
-}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MetaVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MetaVo.java
index 495db54..dbe7a6e 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MetaVo.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MetaVo.java
@@ -1,6 +1,6 @@
 package com.ruoyi.system.domain.vo;
 
-import com.ruoyi.common.utils.StringUtils;
+import cn.hutool.core.lang.Validator;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
@@ -56,7 +56,7 @@
 		this.title = title;
 		this.icon = icon;
 		this.noCache = noCache;
-		if (StringUtils.ishttp(link)) {
+		if (Validator.isUrl(link)) {
 			this.link = link;
 		}
 	}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
index f23e661..e1b4314 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java
@@ -11,7 +11,6 @@
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.domain.SysRoleMenu;
 import com.ruoyi.system.domain.vo.MetaVo;
 import com.ruoyi.system.domain.vo.RouterVo;
@@ -19,6 +18,7 @@
 import com.ruoyi.system.mapper.SysRoleMapper;
 import com.ruoyi.system.mapper.SysRoleMenuMapper;
 import com.ruoyi.system.service.ISysMenuService;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -371,7 +371,7 @@
      * @return 缁撴灉
      */
     public boolean isInnerLink(SysMenu menu) {
-        return menu.getIsFrame().equals(UserConstants.NO_FRAME) && StringUtils.ishttp(menu.getPath());
+        return menu.getIsFrame().equals(UserConstants.NO_FRAME) && Validator.isUrl(menu.getPath());
     }
 
     /**

--
Gitblit v1.9.3