Compare commits
4 Commits
b1cf0c1c4c
...
3e96d36b36
| Author | SHA1 | Date |
|---|---|---|
|
|
3e96d36b36 | |
|
|
276b4a0071 | |
|
|
47bd1e3d7c | |
|
|
e4461223b5 |
|
|
@ -15,10 +15,7 @@ import com.electromagnetic.industry.software.common.enums.PublishEnum;
|
|||
import com.electromagnetic.industry.software.common.exception.BizException;
|
||||
import com.electromagnetic.industry.software.common.pojo.UserLoginInfo;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
import com.electromagnetic.industry.software.common.util.AESUtils;
|
||||
import com.electromagnetic.industry.software.common.util.ElectromagneticResultUtil;
|
||||
import com.electromagnetic.industry.software.common.util.SignUtils;
|
||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||
import com.electromagnetic.industry.software.common.util.*;
|
||||
import com.electromagnetic.industry.software.manage.mapper.RoleMapper;
|
||||
import com.electromagnetic.industry.software.manage.mapper.TokenMapper;
|
||||
import com.electromagnetic.industry.software.manage.mapper.UserMapper;
|
||||
|
|
@ -326,12 +323,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|||
public ElectromagneticResult<?> changePassword(String userId, String newPassword) {
|
||||
User user = this.getById(userId);
|
||||
Assert.notNull(user, StrFormatter.format("用户ID {} 无效", userId));
|
||||
|
||||
String decodeNewPwd = AESUtils.decrypt(newPassword, UserConstants.SECRET_KEY);
|
||||
|
||||
Assert.isTrue(!decodeNewPwd.contains(user.getUserAccount()), "密码最小长度为8,必须至少包含一个大写字母、一个小写字母、一个特殊字符、数字、不可包含账号");
|
||||
Assert.isTrue(EleCommonUtil.isPwdValid(decodeNewPwd), "密码最小长度为8,必须至少包含一个大写字母、一个小写字母、一个特殊字符、数字、不可包含账号");
|
||||
user.setUserPwd(SignUtils.MD5(decodeNewPwd + user.getSalt()));
|
||||
|
||||
boolean success = this.updateById(user);
|
||||
|
||||
UserThreadLocal.setSuccessInfo("", userId, StrFormatter.format("修改了用户密码"));
|
||||
return ElectromagneticResultUtil.success(success);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
// // 辐射敏感均值曲线
|
||||
// @Test
|
||||
// public void addFsmgjz() {
|
||||
// List<String> parentIds = ListUtil.of("100424", "100436", "100437", "100438", "100439", "100440");
|
||||
// List<String> parentIds = ListUtil.of("100574");
|
||||
// String filePath = "D:\\datas\\struct\\辐射敏感均值曲线.txt";
|
||||
// add(parentIds, filePath);
|
||||
// }
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
// // 辐射敏感峰值曲线
|
||||
// @Test
|
||||
// public void addFsmgfz() {
|
||||
// List<String> parentIds = ListUtil.of("100425", "100441", "100442", "100443", "100444", "100445");
|
||||
// List<String> parentIds = ListUtil.of("100575");
|
||||
// String filePath = "D:\\datas\\struct\\辐射敏感峰值曲线.txt";
|
||||
// add(parentIds, filePath);
|
||||
// }
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
// // 传导敏感限值
|
||||
// @Test
|
||||
// public void addCdmgxz() {
|
||||
// List<String> parentIds = ListUtil.of("100423", "100431", "100432", "100433", "100434", "100435");
|
||||
// List<String> parentIds = ListUtil.of("100573");
|
||||
// String filePath = "D:\\datas\\struct\\传导敏感限值.txt";
|
||||
// add(parentIds, filePath);
|
||||
// }
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
// // PEC
|
||||
// @Test
|
||||
// public void addPec() {
|
||||
// List<String> parentIds = ListUtil.of("100060");
|
||||
// List<String> parentIds = ListUtil.of("100578");
|
||||
// String filePath = "D:\\datas\\struct\\PEC.txt";
|
||||
// add(parentIds, filePath);
|
||||
// }
|
||||
|
|
@ -70,11 +70,19 @@
|
|||
// // 色散材料
|
||||
// @Test
|
||||
// public void addSscl() {
|
||||
// List<String> parentIds = ListUtil.of("100058");
|
||||
// List<String> parentIds = ListUtil.of("100577");
|
||||
// String filePath = "D:\\datas\\struct\\色散材料.txt";
|
||||
// add(parentIds, filePath);
|
||||
// }
|
||||
//
|
||||
// // 一般材料
|
||||
// @Test
|
||||
// public void addybcl() {
|
||||
// List<String> parentIds = ListUtil.of("100576");
|
||||
// String filePath = "D:\\datas\\struct\\一般材料.txt";
|
||||
// add(parentIds, filePath);
|
||||
// }
|
||||
//
|
||||
// private void add(List<String> parentIds, String filePath) {
|
||||
// List<String> lines = FileUtil.readLines(filePath, Charset.defaultCharset());
|
||||
// for (String parendId : parentIds) {
|
||||
|
|
|
|||
|
|
@ -28,9 +28,12 @@ public final class EleCommonUtil {
|
|||
private static final Map<String, FileParse> PARSE_MAP = new HashMap<>();
|
||||
// 正则表达式模式,匹配中文字符、下划线、连字符、加号、数字和英文字符
|
||||
private static final String PATTERN = "^[\\u4e00-\\u9fa5a-zA-Z0-9._\\-+]+$";
|
||||
// 密码最小长度为8,必须至少包含一个大写字母、一个小写字母、一个特殊字符、数字
|
||||
private static final String PWD_PATTERN_STR = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,}$";
|
||||
private static final String TIME_FORMAT1 = "yyMMddHHmmssSSS";
|
||||
// 编译正则表达式
|
||||
private static final Pattern NAME_PATTERN = Pattern.compile(PATTERN);
|
||||
private static final Pattern PWD_PATTERN = Pattern.compile(PWD_PATTERN_STR);
|
||||
|
||||
static {
|
||||
PARSE_MAP.put("doc", new WordParse());
|
||||
|
|
@ -52,6 +55,13 @@ public final class EleCommonUtil {
|
|||
PARSE_MAP.put("pdf", new PdfParse());
|
||||
}
|
||||
|
||||
public static boolean isPwdValid(final String pwd) {
|
||||
if (StrUtil.isBlank(pwd)) {
|
||||
return false;
|
||||
}
|
||||
return PWD_PATTERN.matcher(pwd).matches();
|
||||
}
|
||||
|
||||
public static boolean isFileNameValid(String fileFullName) {
|
||||
if (StrUtil.isEmpty(fileFullName) || fileFullName.length() > 32) {
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue