Commit 21a20e14 authored by Java—KA—李 青's avatar Java—KA—李 青

修改条件校验

parent bd4c32c6
......@@ -223,6 +223,10 @@ public class UserController implements IBaseController {
}
JsonResult successResult = validMap.get("success");
String phoneNo = successResult.getData().toString();
if (!ValidationUtil.validatePhoneNo(phoneNo)) {
LOGGER.info("用户快速注册失败,手机号错误, createdFrom:{},phoneNo:{}", createdFrom, phoneNo);
throw new UserNotExistException("手机号错误");
}
String verificationCode = successResult.getMsg();
// 执行短信验证码检查
smsValidForFastLogin(phoneNo, verificationCode);
......@@ -247,10 +251,6 @@ public class UserController implements IBaseController {
private User registerFastWhenLogin(String phoneNo, Long channelId, Long registerFrom, String appChannel, Long btRegisterChannelId,String dimension) {
String password = PasswordUtil.generateRandomPwd(15);
LOGGER.info("用户快速注册, phoneNo:{}, channelId:{}, registerFrom:{},appChannel:{},btRegisterChannelId", phoneNo, channelId, registerFrom, appChannel,btRegisterChannelId);
if (!ValidationUtil.validatePhoneNo(phoneNo)) {
LOGGER.info("用户快速注册失败,手机号错误, registerFrom:{}, phoneNo:{}", registerFrom, phoneNo);
throw new UserNotExistException("手机号错误");
}
if (null == registerFrom) {
registerFrom = 1L;
}
......
......@@ -16,6 +16,7 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
public class UserRegisterParam {
/** ======数据部分开始====== */
private Long registerFrom;
private String phoneNo;
private String password;
......@@ -26,10 +27,13 @@ public class UserRegisterParam {
private String dimension;
private Address address;
private String contacts;
private User user;
/** ======数据部分结束====== */
/** ======流程控制部分开始====== */
private boolean generateRandomPwd = false; // 是否生成随机密码
private boolean sendSms = true; // 是否发送短信
private boolean sendMq = true; // 是否发送mq
private User user;
private boolean sendSuccessSms = true; // 是否发送注册成功短信
private boolean sendAppSms = true; // 是否发送推送App短信
private boolean sendSuccessMq = true; // 是否发送注册成功mq
/** ======流程控制部分开始====== */
}
......@@ -31,7 +31,7 @@ public class BtUserRegisterHandler extends AbstractUserRegisterHandler {
Long channelId = userRegisterParam.getChannelId();
User user = userRegisterParam.getUser();
Long btRegisterChannelId = userRegisterParam.getBtRegisterChannelId();
if(null != user && channelId.equals(222L)){
if(null != user && channelId == 222L){
UserBtRegister userBtRegister = new UserBtRegister();
userBtRegister.setUserId(user.getId());
if(null == btRegisterChannelId){
......
......@@ -9,7 +9,9 @@ import cn.quantgroup.xyqb.service.auth.IIdCardService;
import cn.quantgroup.xyqb.service.register.handler.AbstractUserRegisterHandler;
import cn.quantgroup.xyqb.service.user.IUserDetailService;
import cn.quantgroup.xyqb.util.JsonUtil;
import cn.quantgroup.xyqb.util.ValidationUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
......@@ -52,6 +54,10 @@ public class DetailUserRegisterHandler extends AbstractUserRegisterHandler {
* @param userRegisterParam
*/
private void doHandleUserDetailRegister(UserRegisterParam userRegisterParam) throws Exception {
if (StringUtils.isAnyBlank(userRegisterParam.getIdNo(), userRegisterParam.getName()) ||
!ValidationUtil.validateChinese(userRegisterParam.getName())) {
return;
}
String phoneNo = userRegisterParam.getPhoneNo();
String name = userRegisterParam.getName();
String idNo = userRegisterParam.getIdNo();
......
......@@ -40,10 +40,15 @@ public class MqUserRegisterHandler extends AbstractUserRegisterHandler {
* @param userRegisterParam
*/
private void doHandleMqUserRegister(UserRegisterParam userRegisterParam) {
if (!userRegisterParam.isSendSuccessMq()){
return;
}
Long channelId = userRegisterParam.getChannelId();
String dimension = userRegisterParam.getDimension();
User user = userRegisterParam.getUser();
if (user != null){
MqUtils.sendRegisterMessage(channelId, dimension, user);
}
}
}
......@@ -44,6 +44,42 @@ public class SmsUserRegisterHandler extends AbstractUserRegisterHandler {
* @param userRegisterParam
*/
private void doHandleSmsUserRegister(UserRegisterParam userRegisterParam) {
// 发送注册成功短信
try {
doHandleSendSuccessSms(userRegisterParam);
} catch (Exception e) {
// 发送短信失败不影响注册流程
log.error("[exception][smsUserRegisterHandler_doHandleSendSuccessSms_exception]userRegisterParam={},error={}",
JsonUtil.toJson(userRegisterParam), e);
}
// 发送推送app短信
try {
doHandleSendAppSms(userRegisterParam);
} catch (Exception e) {
// 发送短信失败不影响注册流程
log.error("[exception][smsUserRegisterHandler_doHandleSendAppSms_exception]userRegisterParam={},error={}",
JsonUtil.toJson(userRegisterParam), e);
}
}
/**
* 执行发送推送app短信 TODO
* @param userRegisterParam
*/
private void doHandleSendAppSms(UserRegisterParam userRegisterParam) {
if (!userRegisterParam.isSendAppSms()){
return;
}
}
/**
* 执行发送注册成功短信
* @param userRegisterParam
*/
private void doHandleSendSuccessSms(UserRegisterParam userRegisterParam) {
if (!userRegisterParam.isSendSuccessSms()){
return;
}
Long registerFrom = userRegisterParam.getRegisterFrom();
String phoneNo = userRegisterParam.getPhoneNo();
if (registerFrom != 645L && registerFrom != 900L && registerFrom != 158412L) {
......
......@@ -36,7 +36,8 @@ public class UserRegisterServiceImpl extends AbstractUserRegisterService {
UserRegisterParam userRegisterParam = UserRegisterParam.builder()
.registerFrom(registerFrom).phoneNo(phoneNo).idNo(idNo).name(name)
.channelId(channelId).btRegisterChannelId(btRegisterChannelId)
.generateRandomPwd(true).sendSms(true).sendMq(true)
.generateRandomPwd(true).sendSuccessSms(true).sendAppSms(true)
.sendSuccessMq(true)
.build();
return registerDefault(userRegisterParam);
}
......@@ -47,7 +48,8 @@ public class UserRegisterServiceImpl extends AbstractUserRegisterService {
// 2、保存user
UserRegisterParam userRegisterParam = UserRegisterParam.builder()
.registerFrom(registerFrom).phoneNo(phoneNo).password(password)
.generateRandomPwd(false).sendSms(false).sendMq(false)
.generateRandomPwd(false).sendSuccessSms(true).sendAppSms(true)
.sendSuccessMq(false)
.build();
return registerDefault(userRegisterParam);
}
......@@ -63,7 +65,8 @@ public class UserRegisterServiceImpl extends AbstractUserRegisterService {
.registerFrom(registerFrom).phoneNo(phoneNo).password(password)
.channelId(channelId).btRegisterChannelId(btRegisterChannelId)
.dimension(dimension)
.generateRandomPwd(false).sendSms(true).sendMq(true)
.generateRandomPwd(false).sendSuccessSms(true).sendAppSms(true)
.sendSuccessMq(true)
.build();
User user = registerDefault(userRegisterParam);
return user != null;
......@@ -80,7 +83,8 @@ public class UserRegisterServiceImpl extends AbstractUserRegisterService {
.registerFrom(registerFrom).phoneNo(phoneNo)
.channelId(channelId).btRegisterChannelId(btRegisterChannelId)
.dimension(dimension)
.generateRandomPwd(true).sendSms(false).sendMq(true)
.generateRandomPwd(true).sendSuccessSms(false).sendAppSms(true)
.sendSuccessMq(true)
.build();
return registerDefault(userRegisterParam);
}
......@@ -106,7 +110,8 @@ public class UserRegisterServiceImpl extends AbstractUserRegisterService {
.registerFrom(registeredFrom).phoneNo(phoneNo).idNo(idNo).name(name)
.channelId(channelId).btRegisterChannelId(registeredFrom)
.address(addressObj).contacts(contacts)
.generateRandomPwd(true).sendSms(false).sendMq(false)
.generateRandomPwd(true).sendSuccessSms(false).sendAppSms(true)
.sendSuccessMq(false)
.build();
return registerExt(userRegisterParam);
}
......@@ -121,7 +126,8 @@ public class UserRegisterServiceImpl extends AbstractUserRegisterService {
UserRegisterParam userRegisterParam = UserRegisterParam.builder()
.registerFrom(registerFrom).phoneNo(phoneNo).idNo(idNo).name(name)
.channelId(channelId)
.generateRandomPwd(true).sendSms(true).sendMq(false)
.generateRandomPwd(true).sendSuccessSms(true).sendAppSms(true)
.sendSuccessMq(false)
.build();
return registerDefault(userRegisterParam);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment