|
@@ -1,8 +1,12 @@
|
|
|
package com.jiayue.ssi.util;
|
|
|
|
|
|
+import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
/**
|
|
|
* 初始/重置密码生成
|
|
|
*
|
|
@@ -18,6 +22,9 @@ public class RandomRulePwd {
|
|
|
|
|
|
public static String createPwd(String rule,int strLength){
|
|
|
String randomString="";
|
|
|
+ List<String> strList = Convert.toList(String.class,rule);
|
|
|
+ Collections.sort(strList);
|
|
|
+ rule = String.join(",",strList);
|
|
|
if ("A,B,C".equals(rule)){
|
|
|
while (!(StrUtil.containsAny(randomString,upperStr.split("")) && StrUtil.containsAny(randomString,lowerStr.split("")) && StrUtil.containsAny(randomString,numStr.split("")))){
|
|
|
randomString = cn.hutool.core.util.RandomUtil.randomString(upperStr + lowerStr + numStr, strLength);
|