Commit 66817f6b 66817f6ba9b7ba85f756f0457087fd94648a6b7a by xianghan

1.修改会员属性信息时检验手机号码

1 parent 8f0b2f33
...@@ -6,6 +6,7 @@ import com.topdraw.business.module.member.profile.domain.MemberProfileBuilder; ...@@ -6,6 +6,7 @@ import com.topdraw.business.module.member.profile.domain.MemberProfileBuilder;
6 import com.topdraw.business.module.member.service.MemberService; 6 import com.topdraw.business.module.member.service.MemberService;
7 import com.topdraw.business.module.member.service.dto.MemberDTO; 7 import com.topdraw.business.module.member.service.dto.MemberDTO;
8 import com.topdraw.util.Base64Util; 8 import com.topdraw.util.Base64Util;
9 import com.topdraw.util.RegexUtil;
9 import com.topdraw.utils.RedisUtils; 10 import com.topdraw.utils.RedisUtils;
10 import com.topdraw.utils.ValidationUtil; 11 import com.topdraw.utils.ValidationUtil;
11 import com.topdraw.business.module.member.profile.repository.MemberProfileRepository; 12 import com.topdraw.business.module.member.profile.repository.MemberProfileRepository;
...@@ -141,6 +142,13 @@ public class MemberProfileServiceImpl implements MemberProfileService { ...@@ -141,6 +142,13 @@ public class MemberProfileServiceImpl implements MemberProfileService {
141 memberProfile.setGender(_memberProfileDTO1.getGender()); 142 memberProfile.setGender(_memberProfileDTO1.getGender());
142 } 143 }
143 144
145 String phone = resources.getPhone();
146 if (StringUtils.isNotBlank(phone) && RegexUtil.mobileRegex(phone)) {
147 memberProfile.setPhone(phone);
148 } else {
149 memberProfile.setPhone(_memberProfileDTO1.getPhone());
150 }
151
144 MemberProfile _memberProfile = this.memberProfileRepository.save(memberProfile); 152 MemberProfile _memberProfile = this.memberProfileRepository.save(memberProfile);
145 153
146 MemberProfileDTO memberProfileDTO = new MemberProfileDTO(); 154 MemberProfileDTO memberProfileDTO = new MemberProfileDTO();
......
1 package com.topdraw.util;
2
3 import java.util.regex.Matcher;
4 import java.util.regex.Pattern;
5
6 /**
7 * @author :
8 * @description:
9 * @function :
10 * @date :Created in 2022/8/14 0:05
11 * @version: :
12 * @modified By:
13 * @since : modified in 2022/8/14 0:05
14 */
15 public class RegexUtil {
16
17 public static boolean mobileRegex(String mobile){
18 // String pattern = "0?(13|14|15|17|18|19)[0-9]{9}";
19 String pattern = "^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$";
20 Pattern r = Pattern.compile(pattern);
21 Matcher m = r.matcher(mobile);
22 return m.find();
23 }
24
25 public static boolean appPasswordRegex(String password) {
26 String pattern = "^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9]{8,25}$";
27 Pattern r = Pattern.compile(pattern);
28 Matcher m = r.matcher(password);
29 return m.find();
30 }
31
32 }