|
@@ -1,12 +1,10 @@
|
|
|
package com.abi.qms.platform.infrastructure.util;
|
|
|
|
|
|
-import com.abi.task.common.api.exception.BusinessException;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
-import java.security.NoSuchAlgorithmException;
|
|
|
import java.util.Random;
|
|
|
|
|
|
-import static java.security.SecureRandom.getInstanceStrong;
|
|
|
+import static com.abi.qms.platform.infrastructure.util.RandomCodeUtils.getCaptcha;
|
|
|
|
|
|
/**
|
|
|
* 随机码工具类
|
|
@@ -17,14 +15,8 @@ public class RandomCodeUtils {
|
|
|
/**
|
|
|
* SecureRandom is preferred to Random
|
|
|
*/
|
|
|
- private static Random rand;
|
|
|
- static {
|
|
|
- try {
|
|
|
- rand = getInstanceStrong();
|
|
|
- } catch (NoSuchAlgorithmException e) {
|
|
|
- throw new BusinessException(404,"初始化随机数生成方法异常");
|
|
|
- }
|
|
|
- }
|
|
|
+ private static Random rand = new Random();
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 返回长度为n的随机字符串(随机包含数字or小写字母)
|