Commit de088d39 authored by 于桐's avatar 于桐

vcc来源专用的用户注册保存,增加vcc推广注册渠道ID

parent abffdac4
......@@ -306,6 +306,33 @@ public class InnerController implements IBaseController {
return JsonResult.buildSuccessResult(null, new UserRet(user));
}
@RequestMapping("/user/save/vcc")
@ApiOperation(httpMethod = "POST", value = "Vcc注册用户")
public JsonResult saveUserVcc(String phoneNo, Long registeredFrom, Long vccRegisterChannelId) {
log.info("保存用户,phoneNo:{},registeredFrom:{}", phoneNo, registeredFrom);
//参数验证
if (StringUtils.isBlank(phoneNo)) {
return JsonResult.buildErrorStateResult("用户手机号不能为空.", null);
}
if (registeredFrom == null) {
registeredFrom = 0L;
}
User user = userService.findByPhoneWithCache(phoneNo);
if (user != null) {
//存在已注销
if (!user.getEnable()) {
log.info("用户已经注销,phoneNo:{}", phoneNo);
return JsonResult.buildErrorStateResult("用户已经注销", null);
}
//已存在用户
return JsonResult.buildSuccessResult(null, new UserRet(user));
}
//注册新用户
user = userRegisterService.registerVcc(registeredFrom, phoneNo, null, null, 0L, vccRegisterChannelId);
return JsonResult.buildSuccessResult(null, new UserRet(user));
}
/**
* 保存用户详细信息
* 适用于:创建 或 修改
......
......@@ -27,6 +27,13 @@ public interface IUserRegisterService {
*/
User register(Long registerFrom, String phoneNo, String idNo, String name, Long channelId, Long btRegisterChannelId);
/**
* vcc推荐注册渠道
* @param vccRegisterChannelId
* @return
*/
User registerVcc(Long registerFrom, String phoneNo, String idNo, String name, Long channelId, Long vccRegisterChannelId);
/**
* 替换UserController.register里的userService.register
......
package cn.quantgroup.xyqb.service.register.impl;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import javax.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import cn.quantgroup.xyqb.Constants;
import cn.quantgroup.xyqb.entity.Address;
import cn.quantgroup.xyqb.entity.Contact;
......@@ -9,24 +20,12 @@ import cn.quantgroup.xyqb.model.UserRegisterParam;
import cn.quantgroup.xyqb.service.register.IUserRegisterService;
import cn.quantgroup.xyqb.service.user.IUserService;
import cn.quantgroup.xyqb.util.PasswordUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.sql.Timestamp;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
/**
* @author liqing
* @date 2017/12/4 0004
*/
@Service("userRegisterService")
@Slf4j
public class UserRegisterServiceImpl implements IUserRegisterService {
@Resource
......@@ -70,6 +69,25 @@ public class UserRegisterServiceImpl implements IUserRegisterService {
return user;
}
@Transactional(rollbackFor = Exception.class)
@Override
public User registerVcc(Long registerFrom, String phoneNo, String idNo, String name, Long channelId, Long vccRegisterChannelId) {
UserRegisterParam userRegisterParam = UserRegisterParam.builder()
.registerFrom(registerFrom)
.phoneNo(phoneNo)
.idNo(idNo)
.name(name)
.channelId(channelId)
.vccRegisterChannelId(vccRegisterChannelId)
.sendSuccessSms(true)
.sendAppSms(true)
.sendSuccessMq(true)
.build();
User user = saveUser(userRegisterParam);
applicationEventPublisher.publishEvent(new RegisterEvent(this, userRegisterParam));
return user;
}
private User saveUser(UserRegisterParam userRegisterParam) {
String uuid = UUID.randomUUID().toString();
User user = new User();
......
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