diff --git a/README.md b/README.md
index c30be9ab7..c8d2829ef 100644
--- a/README.md
+++ b/README.md
@@ -24,6 +24,7 @@
* 容器改动 Tomcat 改为 并发性能更好的 undertow
* 代码生成模板 改为适配 Mybatis-Plus 的代码
* 项目修改为 maven多环境配置
+* 集成 Hutool 5.X 并重写RuoYi部分功能
* 集成 Feign 接口化管理 Http 请求(如三方请求 支付,短信,推送等)
* 升级MybatisPlus 3.4.2
* 增加demo模块示例(给不会增加模块的小伙伴做参考)
diff --git a/pom.xml b/pom.xml
index bef6fd071..f0e37d792 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,18 +21,17 @@
- * 版本号具有以下含意:
- *
- * 变体号具有以下含意:
- *
- * 60 位的时间戳值根据此 {@code UUID} 的 time_low、time_mid 和 time_hi 字段构造。
- * 时间戳值仅在在基于时间的 UUID(其 version 类型为 1)中才有意义。
- * 14 位的时钟序列值根据此 UUID 的 clock_seq 字段构造。clock_seq 字段用于保证在基于时间的 UUID 中的时间唯一性。
- *
- * {@code clockSequence} 值仅在基于时间的 UUID(其 version 类型为 1)中才有意义。 如果此 UUID 不是基于时间的 UUID,则此方法抛出
- * UnsupportedOperationException。
- *
- * @return 此 {@code UUID} 的时钟序列
- *
- * @throws UnsupportedOperationException 如果此 UUID 的 version 不为 1
- */
- public int clockSequence() throws UnsupportedOperationException
- {
- checkTimeBase();
- return (int) ((leastSigBits & 0x3FFF000000000000L) >>> 48);
- }
-
- /**
- * 与此 UUID 相关的节点值。
- *
- *
- * 48 位的节点值根据此 UUID 的 node 字段构造。此字段旨在用于保存机器的 IEEE 802 地址,该地址用于生成此 UUID 以保证空间唯一性。
- *
- * 节点值仅在基于时间的 UUID(其 version 类型为 1)中才有意义。
- * UUID 的字符串表示形式由此 BNF 描述:
- *
- *
- * UUID 的字符串表示形式由此 BNF 描述:
- *
- *
- * 当且仅当参数不为 {@code null}、而是一个 UUID 对象、具有与此 UUID 相同的 varriant、包含相同的值(每一位均相同)时,结果才为 {@code true}。
- *
- * @param obj 要与之比较的对象
- *
- * @return 如果对象相同,则返回 {@code true};否则返回 {@code false}
- */
- @Override
- public boolean equals(Object obj)
- {
- if ((null == obj) || (obj.getClass() != UUID.class))
- {
- return false;
- }
- UUID id = (UUID) obj;
- return (mostSigBits == id.mostSigBits && leastSigBits == id.leastSigBits);
- }
-
- // Comparison Operations
-
- /**
- * 将此 UUID 与指定的 UUID 比较。
- *
- *
- * 如果两个 UUID 不同,且第一个 UUID 的最高有效字段大于第二个 UUID 的对应字段,则第一个 UUID 大于第二个 UUID。
- *
- * @param val 与此 UUID 比较的 UUID
- *
- * @return 在此 UUID 小于、等于或大于 val 时,分别返回 -1、0 或 1。
- *
- */
- @Override
- public int compareTo(UUID val)
- {
- // The ordering is intentionally set up so that the UUIDs
- // can simply be numerically compared as two numbers
- return (this.mostSigBits < val.mostSigBits ? -1 : //
- (this.mostSigBits > val.mostSigBits ? 1 : //
- (this.leastSigBits < val.leastSigBits ? -1 : //
- (this.leastSigBits > val.leastSigBits ? 1 : //
- 0))));
- }
-
- // -------------------------------------------------------------------------------------------------------------------
- // Private method start
- /**
- * 返回指定数字对应的hex值
- *
- * @param val 值
- * @param digits 位
- * @return 值
- */
- private static String digits(long val, int digits)
- {
- long hi = 1L << (digits * 4);
- return Long.toHexString(hi | (val & (hi - 1))).substring(1);
- }
-
- /**
- * 检查是否为time-based版本UUID
- */
- private void checkTimeBase()
- {
- if (version() != 1)
- {
- throw new UnsupportedOperationException("Not a time-based UUID");
- }
- }
-
- /**
- * 获取{@link SecureRandom},类提供加密的强随机数生成器 (RNG)
- *
- * @return {@link SecureRandom}
- */
- public static SecureRandom getSecureRandom()
- {
- try
- {
- return SecureRandom.getInstance("SHA1PRNG");
- }
- catch (NoSuchAlgorithmException e)
- {
- throw new UtilException(e);
- }
- }
-
- /**
- * 获取随机数生成器对象
* 如果给定的值为null,或者转换失败,返回默认值
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
@@ -41,7 +42,7 @@ public class Convert
* 转换为字符串
* 如果给定的值为null,或者转换失败,返回默认值null
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @return 结果
*/
@@ -54,7 +55,7 @@ public class Convert
* 转换为字符
* 如果给定的值为null,或者转换失败,返回默认值
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
@@ -78,7 +79,7 @@ public class Convert
* 转换为字符
* 如果给定的值为null,或者转换失败,返回默认值null
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @return 结果
*/
@@ -91,7 +92,7 @@ public class Convert
* 转换为byte
* 如果给定的值为null,或者转换失败,返回默认值
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
@@ -129,7 +130,7 @@ public class Convert
* 转换为byte
* 如果给定的值为null,或者转换失败,返回默认值null
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @return 结果
*/
@@ -142,7 +143,7 @@ public class Convert
* 转换为Short
* 如果给定的值为null,或者转换失败,返回默认值
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
@@ -180,7 +181,7 @@ public class Convert
* 转换为Short
* 如果给定的值为null,或者转换失败,返回默认值null
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @return 结果
*/
@@ -193,7 +194,7 @@ public class Convert
* 转换为Number
* 如果给定的值为空,或者转换失败,返回默认值
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
@@ -227,7 +228,7 @@ public class Convert
* 转换为Number
* 如果给定的值为空,或者转换失败,返回默认值null
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @return 结果
*/
@@ -240,7 +241,7 @@ public class Convert
* 转换为int
* 如果给定的值为空,或者转换失败,返回默认值
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
@@ -278,7 +279,7 @@ public class Convert
* 转换为int
* 如果给定的值为null,或者转换失败,返回默认值null
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @return 结果
*/
@@ -289,7 +290,7 @@ public class Convert
/**
* 转换为Integer数组
- *
+ *
* @param str 被转换的值
* @return 结果
*/
@@ -300,7 +301,7 @@ public class Convert
/**
* 转换为Long数组
- *
+ *
* @param str 被转换的值
* @return 结果
*/
@@ -311,7 +312,7 @@ public class Convert
/**
* 转换为Integer数组
- *
+ *
* @param split 分隔符
* @param split 被转换的值
* @return 结果
@@ -334,7 +335,7 @@ public class Convert
/**
* 转换为Long数组
- *
+ *
* @param split 分隔符
* @param str 被转换的值
* @return 结果
@@ -357,7 +358,7 @@ public class Convert
/**
* 转换为String数组
- *
+ *
* @param str 被转换的值
* @return 结果
*/
@@ -368,7 +369,7 @@ public class Convert
/**
* 转换为String数组
- *
+ *
* @param split 分隔符
* @param split 被转换的值
* @return 结果
@@ -382,7 +383,7 @@ public class Convert
* 转换为long
* 如果给定的值为空,或者转换失败,返回默认值
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
@@ -421,7 +422,7 @@ public class Convert
* 转换为long
* 如果给定的值为null,或者转换失败,返回默认值null
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @return 结果
*/
@@ -434,7 +435,7 @@ public class Convert
* 转换为double
* 如果给定的值为空,或者转换失败,返回默认值
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
@@ -473,7 +474,7 @@ public class Convert
* 转换为double
* 如果给定的值为空,或者转换失败,返回默认值null
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @return 结果
*/
@@ -486,7 +487,7 @@ public class Convert
* 转换为Float
* 如果给定的值为空,或者转换失败,返回默认值
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
@@ -524,7 +525,7 @@ public class Convert
* 转换为Float
* 如果给定的值为空,或者转换失败,返回默认值null
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @return 结果
*/
@@ -537,7 +538,7 @@ public class Convert
* 转换为boolean
* String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
@@ -583,7 +584,7 @@ public class Convert
* 转换为boolean
* 如果给定的值为空,或者转换失败,返回默认值null
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @return 结果
*/
@@ -595,7 +596,7 @@ public class Convert
/**
* 转换为Enum对象
* 如果给定的值为空,或者转换失败,返回默认值
- *
+ *
* @param clazz Enum的Class
* @param value 值
* @param defaultValue 默认值
@@ -631,7 +632,7 @@ public class Convert
/**
* 转换为Enum对象
* 如果给定的值为空,或者转换失败,返回默认值null
- *
+ *
* @param clazz Enum的Class
* @param value 值
* @return Enum
@@ -645,7 +646,7 @@ public class Convert
* 转换为BigInteger
* 如果给定的值为空,或者转换失败,返回默认值
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
@@ -683,7 +684,7 @@ public class Convert
* 转换为BigInteger
* 如果给定的值为空,或者转换失败,返回默认值null
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @return 结果
*/
@@ -696,7 +697,7 @@ public class Convert
* 转换为BigDecimal
* 如果给定的值为空,或者转换失败,返回默认值
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
@@ -742,7 +743,7 @@ public class Convert
* 转换为BigDecimal
* 如果给定的值为空,或者转换失败,返回默认值
* 转换失败不会报错
- *
+ *
* @param value 被转换的值
* @return 结果
*/
@@ -754,7 +755,7 @@ public class Convert
/**
* 将对象转为字符串
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
- *
+ *
* @param obj 对象
* @return 字符串
*/
@@ -766,7 +767,7 @@ public class Convert
/**
* 将对象转为字符串
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
- *
+ *
* @param obj 对象
* @param charsetName 字符集
* @return 字符串
@@ -779,7 +780,7 @@ public class Convert
/**
* 将对象转为字符串
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
- *
+ *
* @param obj 对象
* @param charset 字符集
* @return 字符串
@@ -795,9 +796,14 @@ public class Convert
{
return (String) obj;
}
- else if (obj instanceof byte[] || obj instanceof Byte[])
+ else if (obj instanceof byte[])
{
- return str((Byte[]) obj, charset);
+ return str((byte[]) obj, charset);
+ }
+ else if (obj instanceof Byte[])
+ {
+ byte[] bytes = ArrayUtils.toPrimitive((Byte[]) obj);
+ return str(bytes, charset);
}
else if (obj instanceof ByteBuffer)
{
@@ -808,7 +814,7 @@ public class Convert
/**
* 将byte数组转为字符串
- *
+ *
* @param bytes byte数组
* @param charset 字符集
* @return 字符串
@@ -820,7 +826,7 @@ public class Convert
/**
* 解码字节码
- *
+ *
* @param data 字符串
* @param charset 字符集,如果此字段为空,则解码的结果取决于平台
* @return 解码后的字符串
@@ -841,7 +847,7 @@ public class Convert
/**
* 将编码的byteBuffer数据转换为字符串
- *
+ *
* @param data 数据
* @param charset 字符集,如果为空使用当前系统字符集
* @return 字符串
@@ -858,7 +864,7 @@ public class Convert
/**
* 将编码的byteBuffer数据转换为字符串
- *
+ *
* @param data 数据
* @param charset 字符集,如果为空使用当前系统字符集
* @return 字符串
@@ -875,7 +881,7 @@ public class Convert
// ----------------------------------------------------------------------- 全角半角转换
/**
* 半角转全角
- *
+ *
* @param input String.
* @return 全角字符串.
*/
@@ -886,7 +892,7 @@ public class Convert
/**
* 半角转全角
- *
+ *
* @param input String
* @param notConvertSet 不替换的字符集合
* @return 全角字符串.
@@ -917,7 +923,7 @@ public class Convert
/**
* 全角转半角
- *
+ *
* @param input String.
* @return 半角字符串
*/
@@ -928,7 +934,7 @@ public class Convert
/**
* 替换全角为半角
- *
+ *
* @param text 文本
* @param notConvertSet 不替换的字符集合
* @return 替换后的字符
@@ -960,7 +966,7 @@ public class Convert
/**
* 数字金额大写转换 先写个完整的然后将如零拾替换成零
- *
+ *
* @param n 数字
* @return 中文大写数字
*/
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/Arith.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/Arith.java
deleted file mode 100644
index 48a650e89..000000000
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/Arith.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package com.ruoyi.common.utils;
-
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-
-/**
- * 精确的浮点数运算
- *
- * @author ruoyi
- */
-public class Arith
-{
-
- /** 默认除法运算精度 */
- private static final int DEF_DIV_SCALE = 10;
-
- /** 这个类不能实例化 */
- private Arith()
- {
- }
-
- /**
- * 提供精确的加法运算。
- * @param v1 被加数
- * @param v2 加数
- * @return 两个参数的和
- */
- public static double add(double v1, double v2)
- {
- BigDecimal b1 = new BigDecimal(Double.toString(v1));
- BigDecimal b2 = new BigDecimal(Double.toString(v2));
- return b1.add(b2).doubleValue();
- }
-
- /**
- * 提供精确的减法运算。
- * @param v1 被减数
- * @param v2 减数
- * @return 两个参数的差
- */
- public static double sub(double v1, double v2)
- {
- BigDecimal b1 = new BigDecimal(Double.toString(v1));
- BigDecimal b2 = new BigDecimal(Double.toString(v2));
- return b1.subtract(b2).doubleValue();
- }
-
- /**
- * 提供精确的乘法运算。
- * @param v1 被乘数
- * @param v2 乘数
- * @return 两个参数的积
- */
- public static double mul(double v1, double v2)
- {
- BigDecimal b1 = new BigDecimal(Double.toString(v1));
- BigDecimal b2 = new BigDecimal(Double.toString(v2));
- return b1.multiply(b2).doubleValue();
- }
-
- /**
- * 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到
- * 小数点以后10位,以后的数字四舍五入。
- * @param v1 被除数
- * @param v2 除数
- * @return 两个参数的商
- */
- public static double div(double v1, double v2)
- {
- return div(v1, v2, DEF_DIV_SCALE);
- }
-
- /**
- * 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指
- * 定精度,以后的数字四舍五入。
- * @param v1 被除数
- * @param v2 除数
- * @param scale 表示表示需要精确到小数点以后几位。
- * @return 两个参数的商
- */
- public static double div(double v1, double v2, int scale)
- {
- if (scale < 0)
- {
- throw new IllegalArgumentException(
- "The scale must be a positive integer or zero");
- }
- BigDecimal b1 = new BigDecimal(Double.toString(v1));
- BigDecimal b2 = new BigDecimal(Double.toString(v2));
- if (b1.compareTo(BigDecimal.ZERO) == 0)
- {
- return BigDecimal.ZERO.doubleValue();
- }
- return b1.divide(b2, scale, RoundingMode.HALF_UP).doubleValue();
- }
-
- /**
- * 提供精确的小数位四舍五入处理。
- * @param v 需要四舍五入的数字
- * @param scale 小数点后保留几位
- * @return 四舍五入后的结果
- */
- public static double round(double v, int scale)
- {
- if (scale < 0)
- {
- throw new IllegalArgumentException(
- "The scale must be a positive integer or zero");
- }
- BigDecimal b = new BigDecimal(Double.toString(v));
- BigDecimal one = new BigDecimal("1");
- return b.divide(one, scale, RoundingMode.HALF_UP).doubleValue();
- }
-}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/VerifyCodeUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/VerifyCodeUtils.java
deleted file mode 100644
index 5fdf3a9d6..000000000
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/VerifyCodeUtils.java
+++ /dev/null
@@ -1,228 +0,0 @@
-package com.ruoyi.common.utils;
-
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.awt.geom.AffineTransform;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.security.SecureRandom;
-import java.util.Arrays;
-import java.util.Random;
-import javax.imageio.ImageIO;
-
-/**
- * 验证码工具类
- *
- * @author ruoyi
- */
-public class VerifyCodeUtils
-{
- // 使用到Algerian字体,系统里没有的话需要安装字体,字体只显示大写,去掉了1,0,i,o几个容易混淆的字符
- public static final String VERIFY_CODES = "123456789ABCDEFGHJKLMNPQRSTUVWXYZ";
-
- private static Random random = new SecureRandom();
-
- /**
- * 使用系统默认字符源生成验证码
- *
- * @param verifySize 验证码长度
- * @return
- */
- public static String generateVerifyCode(int verifySize)
- {
- return generateVerifyCode(verifySize, VERIFY_CODES);
- }
-
- /**
- * 使用指定源生成验证码
- *
- * @param verifySize 验证码长度
- * @param sources 验证码字符源
- * @return
- */
- public static String generateVerifyCode(int verifySize, String sources)
- {
- if (sources == null || sources.length() == 0)
- {
- sources = VERIFY_CODES;
- }
- int codesLen = sources.length();
- Random rand = new Random(System.currentTimeMillis());
- StringBuilder verifyCode = new StringBuilder(verifySize);
- for (int i = 0; i < verifySize; i++)
- {
- verifyCode.append(sources.charAt(rand.nextInt(codesLen - 1)));
- }
- return verifyCode.toString();
- }
-
- /**
- * 输出指定验证码图片流
- *
- * @param w
- * @param h
- * @param os
- * @param code
- * @throws IOException
- */
- public static void outputImage(int w, int h, OutputStream os, String code) throws IOException
- {
- int verifySize = code.length();
- BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
- Random rand = new Random();
- Graphics2D g2 = image.createGraphics();
- g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- Color[] colors = new Color[5];
- Color[] colorSpaces = new Color[] { Color.WHITE, Color.CYAN, Color.GRAY, Color.LIGHT_GRAY, Color.MAGENTA,
- Color.ORANGE, Color.PINK, Color.YELLOW };
- float[] fractions = new float[colors.length];
- for (int i = 0; i < colors.length; i++)
- {
- colors[i] = colorSpaces[rand.nextInt(colorSpaces.length)];
- fractions[i] = rand.nextFloat();
- }
- Arrays.sort(fractions);
-
- g2.setColor(Color.GRAY);// 设置边框色
- g2.fillRect(0, 0, w, h);
-
- Color c = getRandColor(200, 250);
- g2.setColor(c);// 设置背景色
- g2.fillRect(0, 2, w, h - 4);
-
- // 绘制干扰线
- Random random = new Random();
- g2.setColor(getRandColor(160, 200));// 设置线条的颜色
- for (int i = 0; i < 20; i++)
- {
- int x = random.nextInt(w - 1);
- int y = random.nextInt(h - 1);
- int xl = random.nextInt(6) + 1;
- int yl = random.nextInt(12) + 1;
- g2.drawLine(x, y, x + xl + 40, y + yl + 20);
- }
-
- // 添加噪点
- float yawpRate = 0.05f;// 噪声率
- int area = (int) (yawpRate * w * h);
- for (int i = 0; i < area; i++)
- {
- int x = random.nextInt(w);
- int y = random.nextInt(h);
- int rgb = getRandomIntColor();
- image.setRGB(x, y, rgb);
- }
-
- shear(g2, w, h, c);// 使图片扭曲
-
- g2.setColor(getRandColor(100, 160));
- int fontSize = h - 4;
- Font font = new Font("Algerian", Font.ITALIC, fontSize);
- g2.setFont(font);
- char[] chars = code.toCharArray();
- for (int i = 0; i < verifySize; i++)
- {
- AffineTransform affine = new AffineTransform();
- affine.setToRotation(Math.PI / 4 * rand.nextDouble() * (rand.nextBoolean() ? 1 : -1),
- (w / verifySize) * i + fontSize / 2, h / 2);
- g2.setTransform(affine);
- g2.drawChars(chars, i, 1, ((w - 10) / verifySize) * i + 5, h / 2 + fontSize / 2 - 10);
- }
-
- g2.dispose();
- ImageIO.write(image, "jpg", os);
- }
-
- private static Color getRandColor(int fc, int bc)
- {
- if (fc > 255) {
- fc = 255;
- }
- if (bc > 255) {
- bc = 255;
- }
- int r = fc + random.nextInt(bc - fc);
- int g = fc + random.nextInt(bc - fc);
- int b = fc + random.nextInt(bc - fc);
- return new Color(r, g, b);
- }
-
- private static int getRandomIntColor()
- {
- int[] rgb = getRandomRgb();
- int color = 0;
- for (int c : rgb)
- {
- color = color << 8;
- color = color | c;
- }
- return color;
- }
-
- private static int[] getRandomRgb()
- {
- int[] rgb = new int[3];
- for (int i = 0; i < 3; i++)
- {
- rgb[i] = random.nextInt(255);
- }
- return rgb;
- }
-
- private static void shear(Graphics g, int w1, int h1, Color color)
- {
- shearX(g, w1, h1, color);
- shearY(g, w1, h1, color);
- }
-
- private static void shearX(Graphics g, int w1, int h1, Color color)
- {
-
- int period = random.nextInt(2);
-
- boolean borderGap = true;
- int frames = 1;
- int phase = random.nextInt(2);
-
- for (int i = 0; i < h1; i++)
- {
- double d = (double) (period >> 1)
- * Math.sin((double) i / (double) period + (6.2831853071795862D * (double) phase) / (double) frames);
- g.copyArea(0, i, w1, 1, (int) d, 0);
- if (borderGap)
- {
- g.setColor(color);
- g.drawLine((int) d, i, 0, i);
- g.drawLine((int) d + w1, i, w1, i);
- }
- }
-
- }
-
- private static void shearY(Graphics g, int w1, int h1, Color color)
- {
-
- int period = random.nextInt(40) + 10; // 50;
-
- boolean borderGap = true;
- int frames = 20;
- int phase = 7;
- for (int i = 0; i < w1; i++)
- {
- double d = (double) (period >> 1)
- * Math.sin((double) i / (double) period + (6.2831853071795862D * (double) phase) / (double) frames);
- g.copyArea(i, 0, 1, h1, 0, (int) d);
- if (borderGap)
- {
- g.setColor(color);
- g.drawLine(i, (int) d, i, 0);
- g.drawLine(i, (int) d + h1, i, h1);
- }
-
- }
- }
-}
\ No newline at end of file
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java
index 86141df4c..2d1bc95f7 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java
@@ -2,6 +2,8 @@ package com.ruoyi.common.utils.file;
import java.io.File;
import java.io.IOException;
+
+import cn.hutool.core.util.IdUtil;
import org.apache.commons.io.FilenameUtils;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.config.RuoYiConfig;
@@ -11,7 +13,6 @@ import com.ruoyi.common.exception.file.FileSizeLimitExceededException;
import com.ruoyi.common.exception.file.InvalidExtensionException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.uuid.IdUtils;
/**
* 文件上传工具类
@@ -123,7 +124,7 @@ public class FileUploadUtils
{
String fileName = file.getOriginalFilename();
String extension = getExtension(file);
- fileName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension;
+ fileName = DateUtils.datePath() + "/" + IdUtil.fastUUID() + "." + extension;
return fileName;
}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Md5Utils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Md5Utils.java
deleted file mode 100644
index de77ee826..000000000
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/sign/Md5Utils.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.ruoyi.common.utils.sign;
-
-import java.security.MessageDigest;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Md5加密方法
- *
- * @author ruoyi
- */
-public class Md5Utils
-{
- private static final Logger log = LoggerFactory.getLogger(Md5Utils.class);
-
- private static byte[] md5(String s)
- {
- MessageDigest algorithm;
- try
- {
- algorithm = MessageDigest.getInstance("MD5");
- algorithm.reset();
- algorithm.update(s.getBytes("UTF-8"));
- byte[] messageDigest = algorithm.digest();
- return messageDigest;
- }
- catch (Exception e)
- {
- log.error("MD5 Error...", e);
- }
- return null;
- }
-
- private static final String toHex(byte hash[])
- {
- if (hash == null)
- {
- return null;
- }
- StringBuffer buf = new StringBuffer(hash.length * 2);
- int i;
-
- for (i = 0; i < hash.length; i++)
- {
- if ((hash[i] & 0xff) < 0x10)
- {
- buf.append("0");
- }
- buf.append(Long.toString(hash[i] & 0xff, 16));
- }
- return buf.toString();
- }
-
- public static String hash(String s)
- {
- try
- {
- return new String(toHex(md5(s)).getBytes("UTF-8"), "UTF-8");
- }
- catch (Exception e)
- {
- log.error("not supported charset...{}", e);
- return s;
- }
- }
-}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java
deleted file mode 100644
index 0d14f57d0..000000000
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/IdUtils.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.ruoyi.common.utils.uuid;
-
-import com.ruoyi.common.utils.uuid.UUID;
-
-/**
- * ID生成器工具类
- *
- * @author ruoyi
- */
-public class IdUtils
-{
- /**
- * 获取随机UUID
- *
- * @return 随机UUID
- */
- public static String randomUUID()
- {
- return UUID.randomUUID().toString();
- }
-
- /**
- * 简化的UUID,去掉了横线
- *
- * @return 简化的UUID,去掉了横线
- */
- public static String simpleUUID()
- {
- return UUID.randomUUID().toString(true);
- }
-
- /**
- * 获取随机UUID,使用性能更好的ThreadLocalRandom生成UUID
- *
- * @return 随机UUID
- */
- public static String fastUUID()
- {
- return UUID.fastUUID().toString();
- }
-
- /**
- * 简化的UUID,去掉了横线,使用性能更好的ThreadLocalRandom生成UUID
- *
- * @return 简化的UUID,去掉了横线
- */
- public static String fastSimpleUUID()
- {
- return UUID.fastUUID().toString(true);
- }
-}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java
deleted file mode 100644
index 062d6336c..000000000
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/uuid/UUID.java
+++ /dev/null
@@ -1,484 +0,0 @@
-package com.ruoyi.common.utils.uuid;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.SecureRandom;
-import java.util.Random;
-import java.util.concurrent.ThreadLocalRandom;
-import com.ruoyi.common.exception.UtilException;
-
-/**
- * 提供通用唯一识别码(universally unique identifier)(UUID)实现
- *
- * @author ruoyi
- */
-public final class UUID implements java.io.Serializable, Comparable
- *
- *
- * @return 此 {@code UUID} 的版本号
- */
- public int version()
- {
- // Version is bits masked by 0x000000000000F000 in MS long
- return (int) ((mostSigBits >> 12) & 0x0f);
- }
-
- /**
- * 与此 {@code UUID} 相关联的变体号。变体号描述 {@code UUID} 的布局。
- *
- *
- *
- * @return 此 {@code UUID} 相关联的变体号
- */
- public int variant()
- {
- // This field is composed of a varying number of bits.
- // 0 - - Reserved for NCS backward compatibility
- // 1 0 - The IETF aka Leach-Salz variant (used by this class)
- // 1 1 0 Reserved, Microsoft backward compatibility
- // 1 1 1 Reserved for future definition.
- return (int) ((leastSigBits >>> (64 - (leastSigBits >>> 62))) & (leastSigBits >> 63));
- }
-
- /**
- * 与此 UUID 相关联的时间戳值。
- *
- *
- * 所得到的时间戳以 100 毫微秒为单位,从 UTC(通用协调时间) 1582 年 10 月 15 日零时开始。
- *
- *
- * 如果此 {@code UUID} 不是基于时间的 UUID,则此方法抛出 UnsupportedOperationException。
- *
- * @throws UnsupportedOperationException 如果此 {@code UUID} 不是 version 为 1 的 UUID。
- */
- public long timestamp() throws UnsupportedOperationException
- {
- checkTimeBase();
- return (mostSigBits & 0x0FFFL) << 48//
- | ((mostSigBits >> 16) & 0x0FFFFL) << 32//
- | mostSigBits >>> 32;
- }
-
- /**
- * 与此 UUID 相关联的时钟序列值。
- *
- *
- * 如果此 UUID 不是基于时间的 UUID,则此方法抛出 UnsupportedOperationException。
- *
- * @return 此 {@code UUID} 的节点值
- *
- * @throws UnsupportedOperationException 如果此 UUID 的 version 不为 1
- */
- public long node() throws UnsupportedOperationException
- {
- checkTimeBase();
- return leastSigBits & 0x0000FFFFFFFFFFFFL;
- }
-
- /**
- * 返回此{@code UUID} 的字符串表现形式。
- *
- *
- * {@code
- * UUID =
- *
- *
- *
- * @return 此{@code UUID} 的字符串表现形式
- * @see #toString(boolean)
- */
- @Override
- public String toString()
- {
- return toString(false);
- }
-
- /**
- * 返回此{@code UUID} 的字符串表现形式。
- *
- *
- * {@code
- * UUID =
- *
- *
- *
- * @param isSimple 是否简单模式,简单模式为不带'-'的UUID字符串
- * @return 此{@code UUID} 的字符串表现形式
- */
- public String toString(boolean isSimple)
- {
- final StringBuilder builder = new StringBuilder(isSimple ? 32 : 36);
- // time_low
- builder.append(digits(mostSigBits >> 32, 8));
- if (false == isSimple)
- {
- builder.append('-');
- }
- // time_mid
- builder.append(digits(mostSigBits >> 16, 4));
- if (false == isSimple)
- {
- builder.append('-');
- }
- // time_high_and_version
- builder.append(digits(mostSigBits, 4));
- if (false == isSimple)
- {
- builder.append('-');
- }
- // variant_and_sequence
- builder.append(digits(leastSigBits >> 48, 4));
- if (false == isSimple)
- {
- builder.append('-');
- }
- // node
- builder.append(digits(leastSigBits, 12));
-
- return builder.toString();
- }
-
- /**
- * 返回此 UUID 的哈希码。
- *
- * @return UUID 的哈希码值。
- */
- @Override
- public int hashCode()
- {
- long hilo = mostSigBits ^ leastSigBits;
- return ((int) (hilo >> 32)) ^ (int) hilo;
- }
-
- /**
- * 将此对象与指定对象比较。
- *
- * ThreadLocalRandom是JDK 7之后提供并发产生随机数,能够解决多个线程发生的竞争争夺。
- *
- * @return {@link ThreadLocalRandom}
- */
- public static ThreadLocalRandom getRandom()
- {
- return ThreadLocalRandom.current();
- }
-}
diff --git a/ruoyi-framework/pom.xml b/ruoyi-framework/pom.xml
index 1100a2930..d738880e9 100644
--- a/ruoyi-framework/pom.xml
+++ b/ruoyi-framework/pom.xml
@@ -55,18 +55,6 @@
QQ群:满937441
- 满887144332 满180251782
- 104180207满887144332 满180251782 满104180207
+ 186866453
diff --git a/ruoyi-ui/src/views/monitor/logininfor/index.vue b/ruoyi-ui/src/views/monitor/logininfor/index.vue
index a7402d686..c1812671c 100644
--- a/ruoyi-ui/src/views/monitor/logininfor/index.vue
+++ b/ruoyi-ui/src/views/monitor/logininfor/index.vue
@@ -84,7 +84,7 @@
icon="el-icon-download"
size="mini"
@click="handleExport"
- v-hasPermi="['system:logininfor:export']"
+ v-hasPermi="['monitor:logininfor:export']"
>导出