手机号授权:旧校验替换
This commit is contained in:
@@ -189,7 +189,7 @@ public class CommonUtil {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String maskPhone(String phone) {
|
public static String maskPhone(String phone) {
|
||||||
if(!checkIsPhone(phone)){
|
if(!checkNumberOnly(phone)){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -237,8 +237,8 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
|||||||
* @param phone
|
* @param phone
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String maskPhone(String phone) {
|
public static String maskPhone(String phoneAreaCode,String phone) {
|
||||||
if(!isPhone(phone)){
|
if(CommonUtil.checkPhoneFormat(phoneAreaCode,phone)){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -23,4 +23,5 @@ public class InvitedUserVO {
|
|||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
private String phone;
|
private String phone;
|
||||||
|
private String phoneAreaCode;
|
||||||
}
|
}
|
||||||
|
@@ -1110,7 +1110,7 @@
|
|||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="listInvitedUsers" resultType="com.accompany.core.vo.user.InvitedUserVO">
|
<select id="listInvitedUsers" resultType="com.accompany.core.vo.user.InvitedUserVO">
|
||||||
select a.uid, a.phone, u.nick, u.avatar, u.gender, a.sign_time createTime,
|
select a.uid, a.phone,a.phone_area_code, u.nick, u.avatar, u.gender, a.sign_time createTime,
|
||||||
case when u.nick is null and u.gender is null then 0 else 1 end hasLoginActived from account a left join users u on u.uid = a.uid
|
case when u.nick is null and u.gender is null then 0 else 1 end hasLoginActived from account a left join users u on u.uid = a.uid
|
||||||
where ((a.prefill_invite_uid = ${uid} and u.nick is null and u.gender is null)
|
where ((a.prefill_invite_uid = ${uid} and u.nick is null and u.gender is null)
|
||||||
or u.invite_uid = ${uid})
|
or u.invite_uid = ${uid})
|
||||||
|
@@ -625,7 +625,7 @@ public class MidyearActivityService extends ActivityBaseService {
|
|||||||
//防刷
|
//防刷
|
||||||
//被关注者
|
//被关注者
|
||||||
Users users = this.usersService.getUsersByUid(likedUid);
|
Users users = this.usersService.getUsersByUid(likedUid);
|
||||||
if (users == null || StringUtils.isEmpty(users.getPhone()) || !CommonUtil.checkIsPhone(users.getPhone())) {
|
if (users == null || StringUtils.isEmpty(users.getPhone()) || !CommonUtil.checkPhoneFormat(users.getPhoneAreaCode(),users.getPhone())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//关注者
|
//关注者
|
||||||
|
@@ -16,6 +16,7 @@ import com.accompany.common.redis.RedisKey;
|
|||||||
import com.accompany.common.result.BusiResult;
|
import com.accompany.common.result.BusiResult;
|
||||||
import com.accompany.common.status.BusiStatus;
|
import com.accompany.common.status.BusiStatus;
|
||||||
import com.accompany.common.utils.BlankUtil;
|
import com.accompany.common.utils.BlankUtil;
|
||||||
|
import com.accompany.common.utils.CommonUtil;
|
||||||
import com.accompany.common.utils.DateTimeUtil;
|
import com.accompany.common.utils.DateTimeUtil;
|
||||||
import com.accompany.common.utils.StringUtils;
|
import com.accompany.common.utils.StringUtils;
|
||||||
import com.accompany.core.exception.ServiceException;
|
import com.accompany.core.exception.ServiceException;
|
||||||
@@ -118,7 +119,7 @@ public class VoiceBottleActivityService extends ActivityBaseService {
|
|||||||
String redisKey = RedisKey.activity_rank_voice_bottle_like.getKey();
|
String redisKey = RedisKey.activity_rank_voice_bottle_like.getKey();
|
||||||
this.verifyActivity(uid, new Date(messTime)); //条件检验
|
this.verifyActivity(uid, new Date(messTime)); //条件检验
|
||||||
Users users = usersService.getUsersByUid(uid);
|
Users users = usersService.getUsersByUid(uid);
|
||||||
if (users == null || StringUtils.isEmpty(users.getPhone()) || StringUtils.isNotPhone(users.getPhone())){
|
if (users == null || StringUtils.isEmpty(users.getPhone()) || CommonUtil.checkPhoneFormat(users.getPhoneAreaCode(),users.getPhone())){
|
||||||
logger.info("update like user num failed, users is not exist or no bind mobile phone uid = {}", uid);
|
logger.info("update like user num failed, users is not exist or no bind mobile phone uid = {}", uid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -404,7 +404,7 @@ public class UserDrawService {
|
|||||||
Users users = this.getUsersByUid(uid);
|
Users users = this.getUsersByUid(uid);
|
||||||
if (users !=null){
|
if (users !=null){
|
||||||
//如果手机号码为空,或者手机号码为平台号
|
//如果手机号码为空,或者手机号码为平台号
|
||||||
if(StringUtils.isEmpty(users.getPhone()) || !CommonUtil.checkIsPhone(users.getPhone())) {
|
if(StringUtils.isEmpty(users.getPhone()) || !CommonUtil.checkPhoneFormat(users.getPhoneAreaCode(),users.getPhone())) {
|
||||||
throw new ApiException(BusiStatus.RADISH_DRAW_PHONE_BIND);
|
throw new ApiException(BusiStatus.RADISH_DRAW_PHONE_BIND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -445,7 +445,7 @@ public class MissionService extends BaseService {
|
|||||||
*/
|
*/
|
||||||
public boolean existsUserPhone(Long uid){
|
public boolean existsUserPhone(Long uid){
|
||||||
Users user = this.usersService.getUsersByUid(uid);
|
Users user = this.usersService.getUsersByUid(uid);
|
||||||
return user!=null && CommonUtil.checkValidPhone(user.getPhone());
|
return user!=null && CommonUtil.checkPhoneFormat(user.getPhoneAreaCode(),user.getPhone());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -12,6 +12,7 @@ import com.accompany.common.constant.AppEnum;
|
|||||||
import com.accompany.common.constant.Constant;
|
import com.accompany.common.constant.Constant;
|
||||||
import com.accompany.common.device.DeviceInfo;
|
import com.accompany.common.device.DeviceInfo;
|
||||||
import com.accompany.common.redis.RedisKey;
|
import com.accompany.common.redis.RedisKey;
|
||||||
|
import com.accompany.common.utils.CommonUtil;
|
||||||
import com.accompany.core.model.Room;
|
import com.accompany.core.model.Room;
|
||||||
import com.accompany.core.service.user.UsersBaseService;
|
import com.accompany.core.service.user.UsersBaseService;
|
||||||
import com.accompany.core.vo.user.InvitePageVO;
|
import com.accompany.core.vo.user.InvitePageVO;
|
||||||
@@ -262,10 +263,11 @@ public class InviteCodeService extends BaseService {
|
|||||||
List<InvitedUserVO> users = usersMapper.listInvitedUsers(uid, sigupApps);
|
List<InvitedUserVO> users = usersMapper.listInvitedUsers(uid, sigupApps);
|
||||||
users.stream().forEach(it -> {
|
users.stream().forEach(it -> {
|
||||||
if (!it.getHasLoginActived()) {
|
if (!it.getHasLoginActived()) {
|
||||||
it.setNick(StringUtils.maskPhone(it.getPhone()));
|
it.setNick(StringUtils.maskPhone(it.getPhoneAreaCode(),it.getPhone()));
|
||||||
}
|
}
|
||||||
|
|
||||||
it.setPhone(null);
|
it.setPhone(null);
|
||||||
|
it.setPhoneAreaCode(null);
|
||||||
});
|
});
|
||||||
pageVO.setInviteList(users);
|
pageVO.setInviteList(users);
|
||||||
return pageVO;
|
return pageVO;
|
||||||
|
@@ -60,7 +60,7 @@ public class UserBankAccountService extends BaseService {
|
|||||||
if(null == users) {
|
if(null == users) {
|
||||||
throw new ServiceException(BusiStatus.USERNOTEXISTS);
|
throw new ServiceException(BusiStatus.USERNOTEXISTS);
|
||||||
}
|
}
|
||||||
if(!CommonUtil.checkValidPhone(users.getPhone())) {
|
if(!CommonUtil.checkPhoneFormat(users.getPhoneAreaCode(),users.getPhone())) {
|
||||||
throw new ServiceException(BusiStatus.PHONE_NO_BIND);
|
throw new ServiceException(BusiStatus.PHONE_NO_BIND);
|
||||||
}
|
}
|
||||||
boolean check = smsService.verifySmsCode(users.getPhone(), req.getSmsCode());
|
boolean check = smsService.verifySmsCode(users.getPhone(), req.getSmsCode());
|
||||||
|
@@ -392,7 +392,7 @@ public class UsersService extends BaseService {
|
|||||||
userInfoSkillVo, userExpand);
|
userInfoSkillVo, userExpand);
|
||||||
Account account = accountService.getById(uid);
|
Account account = accountService.getById(uid);
|
||||||
// TODO 延用之前代码的手机绑定判断规则
|
// TODO 延用之前代码的手机绑定判断规则
|
||||||
userVo.setIsBindPhone(CommonUtil.checkValidPhone(user.getPhone()));
|
userVo.setIsBindPhone(CommonUtil.checkPhoneFormat(user.getPhoneAreaCode(),user.getPhone()));
|
||||||
// 是否绑定了登录密码
|
// 是否绑定了登录密码
|
||||||
userVo.setIsBindPasswd(!StringUtils.isEmpty(account.getPassword()));
|
userVo.setIsBindPasswd(!StringUtils.isEmpty(account.getPassword()));
|
||||||
// 是否绑定了支付宝
|
// 是否绑定了支付宝
|
||||||
@@ -472,7 +472,7 @@ public class UsersService extends BaseService {
|
|||||||
userVo = new UserVo();
|
userVo = new UserVo();
|
||||||
userVo.setUid(uid);
|
userVo.setUid(uid);
|
||||||
userVo.setIsBindPhone(
|
userVo.setIsBindPhone(
|
||||||
account.getPhone() != null && CommonUtil.checkValidPhone(account.getPhone()));
|
account.getPhone() != null && CommonUtil.checkPhoneFormat(account.getPhoneAreaCode(),account.getPhone()));
|
||||||
userVo.setPrefillInviteCode(account.getPrefillInviteCode());
|
userVo.setPrefillInviteCode(account.getPrefillInviteCode());
|
||||||
userVo.setPrefillInviteUid(account.getPrefillInviteUid());
|
userVo.setPrefillInviteUid(account.getPrefillInviteUid());
|
||||||
return userVo;
|
return userVo;
|
||||||
@@ -494,7 +494,7 @@ public class UsersService extends BaseService {
|
|||||||
UserExpandVo userExpand = userExpandService.getUserExpandVo(uid);
|
UserExpandVo userExpand = userExpandService.getUserExpandVo(uid);
|
||||||
userVo = converToUserVo(user, nobleUsers, userLevelVo, carport, userHeadwearVo, familyId, hallMember == null ? null : hallMember.getHallId(),
|
userVo = converToUserVo(user, nobleUsers, userLevelVo, carport, userHeadwearVo, familyId, hallMember == null ? null : hallMember.getHallId(),
|
||||||
userInfoSkillVo, userExpand);
|
userInfoSkillVo, userExpand);
|
||||||
userVo.setIsBindPhone(CommonUtil.checkValidPhone(account.getPhone())
|
userVo.setIsBindPhone(CommonUtil.checkPhoneFormat(account.getPhoneAreaCode(),account.getPhone())
|
||||||
|| user.getDefUser().byteValue() == Constant.DefUser.LABOR_UNION);
|
|| user.getDefUser().byteValue() == Constant.DefUser.LABOR_UNION);
|
||||||
// 是否绑定了登录密码
|
// 是否绑定了登录密码
|
||||||
userVo.setIsBindPasswd(!StringUtils.isEmpty(account.getPassword()));
|
userVo.setIsBindPasswd(!StringUtils.isEmpty(account.getPassword()));
|
||||||
@@ -660,7 +660,7 @@ public class UsersService extends BaseService {
|
|||||||
userVo.setHasPrettyErbanNo(user.getHasPrettyErbanNo());
|
userVo.setHasPrettyErbanNo(user.getHasPrettyErbanNo());
|
||||||
userVo.setUid(user.getUid());
|
userVo.setUid(user.getUid());
|
||||||
userVo.setErbanNo(user.getErbanNo());
|
userVo.setErbanNo(user.getErbanNo());
|
||||||
userVo.setPhone(StringUtils.maskPhone(user.getPhone()));
|
userVo.setPhone(StringUtils.maskPhone(user.getPhoneAreaCode(),user.getPhone()));
|
||||||
userVo.setPhoneAreaCode(user.getPhoneAreaCode());
|
userVo.setPhoneAreaCode(user.getPhoneAreaCode());
|
||||||
userVo.setAvatar(user.getAvatar());
|
userVo.setAvatar(user.getAvatar());
|
||||||
userVo.setBirth(user.getBirth());
|
userVo.setBirth(user.getBirth());
|
||||||
@@ -1185,7 +1185,7 @@ public class UsersService extends BaseService {
|
|||||||
return new BusiResult(BusiStatus.USERNOTEXISTS);
|
return new BusiResult(BusiStatus.USERNOTEXISTS);
|
||||||
}
|
}
|
||||||
String phone = users.getPhone();
|
String phone = users.getPhone();
|
||||||
if (CommonUtil.checkValidPhone(phone)) {
|
if (CommonUtil.checkPhoneFormat(users.getPhoneAreaCode(),phone)) {
|
||||||
return busiResult;
|
return busiResult;
|
||||||
}
|
}
|
||||||
return new BusiResult(BusiStatus.PHONEINVALID);
|
return new BusiResult(BusiStatus.PHONEINVALID);
|
||||||
|
@@ -102,7 +102,7 @@ public class WithdrawService extends ServiceImpl<WithdrawMapper,WithdrawRecord>
|
|||||||
if (StringUtils.isNoneBlank(users.getAlipayAccountName())) {
|
if (StringUtils.isNoneBlank(users.getAlipayAccountName())) {
|
||||||
withDrawVo.setZxcAccountName(users.getAlipayAccountName());
|
withDrawVo.setZxcAccountName(users.getAlipayAccountName());
|
||||||
}
|
}
|
||||||
withDrawVo.setIsNotBoundPhone(CommonUtil.checkValidPhone(users.getPhone()) ? false : true);
|
withDrawVo.setIsNotBoundPhone(CommonUtil.checkPhoneFormat(users.getPhoneAreaCode(),users.getPhone()) ? false : true);
|
||||||
// 青少年模式开关和青少年提现开关
|
// 青少年模式开关和青少年提现开关
|
||||||
if(users.getParentMode() != null){
|
if(users.getParentMode() != null){
|
||||||
withDrawVo.setIsTeen(users.getParentMode());
|
withDrawVo.setIsTeen(users.getParentMode());
|
||||||
|
@@ -42,7 +42,7 @@ public class ActivitiesAnnualController extends BaseController {
|
|||||||
if (uid == null || StringUtils.isEmpty(phone) || StringUtils.isEmpty(phoneAreaCode)){
|
if (uid == null || StringUtils.isEmpty(phone) || StringUtils.isEmpty(phoneAreaCode)){
|
||||||
return new BusiResult(BusiStatus.PARAMERROR);
|
return new BusiResult(BusiStatus.PARAMERROR);
|
||||||
}
|
}
|
||||||
if (!CommonUtil.checkValidPhone(phone)){
|
if (!CommonUtil.checkPhoneFormat(phoneAreaCode,phone)){
|
||||||
return new BusiResult(BusiStatus.PARAMERROR);
|
return new BusiResult(BusiStatus.PARAMERROR);
|
||||||
}
|
}
|
||||||
return activitiesAnnualService.bindPhone(uid, phone,phoneAreaCode);
|
return activitiesAnnualService.bindPhone(uid, phone,phoneAreaCode);
|
||||||
|
@@ -43,7 +43,7 @@ public class SuperAdminGrantService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CustomOAuth2Exception exception = new CustomOAuth2Exception(CustomOAuth2Exception.INVALID_SUPER_USER, "Bad credentials");
|
CustomOAuth2Exception exception = new CustomOAuth2Exception(CustomOAuth2Exception.INVALID_SUPER_USER, "Bad credentials");
|
||||||
if(!CommonUtil.checkValidPhone(account.getPhone())){
|
if(!CommonUtil.checkPhoneFormat(account.getPhoneAreaCode(),account.getPhone())){
|
||||||
logger.error("super-admin login error.:{}",phone);
|
logger.error("super-admin login error.:{}",phone);
|
||||||
exception.addAdditionalInformation("msgWithValue","账号异常,未绑定手机号码");
|
exception.addAdditionalInformation("msgWithValue","账号异常,未绑定手机号码");
|
||||||
throw exception;
|
throw exception;
|
||||||
|
Reference in New Issue
Block a user