Commit 5b800aeb authored by 技术部-任文超's avatar 技术部-任文超

Merge branch 'master' into 20180301-Fixed_LogException

parents 953c4bf0 73189d4d
...@@ -24,6 +24,12 @@ public class RegisterMqConfig { ...@@ -24,6 +24,12 @@ public class RegisterMqConfig {
private String queueName; private String queueName;
@Value("${register.rabbitmq.exchange}") @Value("${register.rabbitmq.exchange}")
private String registerMqExchange; private String registerMqExchange;
@Value("${register.rabbitmq.queue.qq_gdt}")
private String queueName4Gdt;
@Value("${register.rabbitmq.routing_key.qq_gdt}")
private String routingKey4Gdt;
@Value("${register.rabbitmq.exchange.qq_gdt}")
private String exchange4Gdt;
@Value("${register.rabbitmq.connection.host}") @Value("${register.rabbitmq.connection.host}")
private String host; private String host;
...@@ -75,11 +81,36 @@ public class RegisterMqConfig { ...@@ -75,11 +81,36 @@ public class RegisterMqConfig {
return binding; return binding;
} }
@Bean(name = "registerRabbitTemplate") @Bean(name = "registerRabbitTemplate")
public RabbitTemplate registerTemplate(@Qualifier("registerMqFactory") ConnectionFactory registerMqFactory) { public RabbitTemplate registerTemplate(@Qualifier("registerMqFactory") ConnectionFactory registerMqFactory) {
RabbitTemplate template = new RabbitTemplate(registerMqFactory); RabbitTemplate template = new RabbitTemplate(registerMqFactory);
template.setExchange(registerMqExchange); template.setExchange(registerMqExchange);
return template; return template;
} }
@Bean(name = "registerMqExchange4Gdt")
public FanoutExchange registerMqExchange4Gdt() {
return new FanoutExchange(exchange4Gdt);
}
@Bean(name = "registerMqQueue4Gdt")
public Queue registerMqQueue4Gdt() {
return new Queue(queueName4Gdt);
}
@Bean(name = "registerMqBinding4Gdt")
public Binding registerMqBinding4Gdt(@Qualifier("registerMqAmqpAdmin")AmqpAdmin registerMqAmqpAdmin, @Qualifier("registerMqQueue4Gdt")Queue registerMqQueue4Gdt, @Qualifier("registerMqExchange4Gdt")FanoutExchange registerMqExchange4Gdt) {
Binding binding = BindingBuilder.bind(registerMqQueue4Gdt).to(registerMqExchange4Gdt);
registerMqAmqpAdmin.declareBinding(binding);
return binding;
}
@Bean(name = "registerRabbitTemplate4Gdt")
public RabbitTemplate registerTemplate4Gdt(@Qualifier("registerMqFactory") ConnectionFactory registerMqFactory) {
RabbitTemplate template = new RabbitTemplate(registerMqFactory);
template.setExchange(exchange4Gdt);
return template;
}
} }
package cn.quantgroup.xyqb.controller.external.captcha; package cn.quantgroup.xyqb.controller.external.captcha;
import cn.quantgroup.xyqb.Constants; import cn.quantgroup.xyqb.Constants;
import cn.quantgroup.xyqb.aspect.captcha.CaptchaValidator;
import cn.quantgroup.xyqb.model.JsonResult; import cn.quantgroup.xyqb.model.JsonResult;
import cn.quantgroup.xyqb.thirdparty.jcaptcha.AbstractManageableImageCaptchaService; import cn.quantgroup.xyqb.thirdparty.jcaptcha.AbstractManageableImageCaptchaService;
import java.util.*; import java.util.*;
...@@ -58,5 +59,13 @@ public class ImageCaptchaController { ...@@ -58,5 +59,13 @@ public class ImageCaptchaController {
data.put("image", String.format(IMG_BASE64_PATTREN, imageBase64)); data.put("image", String.format(IMG_BASE64_PATTREN, imageBase64));
return JsonResult.buildSuccessResult("", data); return JsonResult.buildSuccessResult("", data);
} }
/**
* 图片验证码验证
* 注意:本方法有中间层在用,用于QG图形验证码检验
*/
@CaptchaValidator
@RequestMapping("/verification_image_code")
public JsonResult verificationImageCode() {
return JsonResult.buildSuccessResult("", null);
}
} }
...@@ -237,8 +237,8 @@ public class InnerController implements IBaseController { ...@@ -237,8 +237,8 @@ public class InnerController implements IBaseController {
*/ */
@RequestMapping("/user_detail/save") @RequestMapping("/user_detail/save")
public JsonResult saveUserDetail(Long userId, String phoneNo, String name, String idNo, public JsonResult saveUserDetail(Long userId, String phoneNo, String name, String idNo,
String email, Long id) { String email, String qq, Long id) {
LOGGER.info("保存用户详细信息,phoneNo:{},userId;{},name:{},idNo:{},email;{}", phoneNo, userId, name, idNo, email); LOGGER.info("保存用户详细信息,phoneNo:{},userId;{},name:{},idNo:{},email;{},qq;{}", phoneNo, userId, name, idNo, email, qq);
//参数验证 //参数验证
if (userId == null || userId == 0L) { if (userId == null || userId == 0L) {
return JsonResult.buildErrorStateResult("用户id为空.", null); return JsonResult.buildErrorStateResult("用户id为空.", null);
...@@ -282,6 +282,7 @@ public class InnerController implements IBaseController { ...@@ -282,6 +282,7 @@ public class InnerController implements IBaseController {
userDetail.setIdType(IdType.ID_CARD); userDetail.setIdType(IdType.ID_CARD);
userDetail.setGender(info.getGender()); userDetail.setGender(info.getGender());
userDetail.setEmail(email); userDetail.setEmail(email);
userDetail.setQq(qq);
userDetail = userDetailService.saveUserDetail(userDetail); userDetail = userDetailService.saveUserDetail(userDetail);
if (userDetail != null) { if (userDetail != null) {
return JsonResult.buildSuccessResult(null, UserDetailRet.getUserDetail(userDetail)); return JsonResult.buildSuccessResult(null, UserDetailRet.getUserDetail(userDetail));
...@@ -1156,6 +1157,9 @@ public class InnerController implements IBaseController { ...@@ -1156,6 +1157,9 @@ public class InnerController implements IBaseController {
}else { }else {
return JsonResult.buildErrorStateResult("校验失败", ""); return JsonResult.buildErrorStateResult("校验失败", "");
} }
if (user == null) {
user = userRegisterService.register(phoneNo, "", null);
}
if (Objects.isNull(user)) { if (Objects.isNull(user)) {
return JsonResult.buildErrorStateResult("用户不存在", ""); return JsonResult.buildErrorStateResult("用户不存在", "");
}else{ }else{
......
...@@ -8,6 +8,8 @@ import cn.quantgroup.xyqb.model.session.SessionStruct; ...@@ -8,6 +8,8 @@ import cn.quantgroup.xyqb.model.session.SessionStruct;
import cn.quantgroup.xyqb.service.http.IHttpService; import cn.quantgroup.xyqb.service.http.IHttpService;
import cn.quantgroup.xyqb.service.user.IUserBtRegisterService; import cn.quantgroup.xyqb.service.user.IUserBtRegisterService;
import cn.quantgroup.xyqb.service.user.IUserService; import cn.quantgroup.xyqb.service.user.IUserService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -46,6 +48,8 @@ public class AuthInfoController implements IBaseController { ...@@ -46,6 +48,8 @@ public class AuthInfoController implements IBaseController {
context.setBtMerchantId(sessionStruct.getValues().getLoginProperties().getBtMerchantId()); context.setBtMerchantId(sessionStruct.getValues().getLoginProperties().getBtMerchantId());
//有ThreadLocal不释放的问题,不可再使用原来方式了 //有ThreadLocal不释放的问题,不可再使用原来方式了
loginInfo.setLoginContext(context); loginInfo.setLoginContext(context);
log.info("[/auth/info/login] SessionStruct数据:{}", JSONObject.toJSONString(sessionStruct));
log.info("[/auth/info/login] LoginInfo数据:{}", JSONObject.toJSONString(loginInfo));
return JsonResult.buildSuccessResult("", loginInfo); return JsonResult.buildSuccessResult("", loginInfo);
} }
return JsonResult.buildErrorStateResult("用户未登录",null); return JsonResult.buildErrorStateResult("用户未登录",null);
......
package cn.quantgroup.xyqb.controller.internal.user; package cn.quantgroup.xyqb.controller.internal.user;
import cn.quantgroup.tech.util.TechEnvironment;
import cn.quantgroup.xyqb.Constants; import cn.quantgroup.xyqb.Constants;
import cn.quantgroup.xyqb.aspect.captcha.CaptchaFiniteValidator; import cn.quantgroup.xyqb.aspect.captcha.CaptchaFiniteValidator;
import cn.quantgroup.xyqb.aspect.lock.PasswordErrorFiniteValidator; import cn.quantgroup.xyqb.aspect.lock.PasswordErrorFiniteValidator;
...@@ -26,6 +27,8 @@ import cn.quantgroup.xyqb.util.IPUtil; ...@@ -26,6 +27,8 @@ import cn.quantgroup.xyqb.util.IPUtil;
import cn.quantgroup.xyqb.util.MqUtils; import cn.quantgroup.xyqb.util.MqUtils;
import cn.quantgroup.xyqb.util.PasswordUtil; import cn.quantgroup.xyqb.util.PasswordUtil;
import cn.quantgroup.xyqb.util.ValidationUtil; import cn.quantgroup.xyqb.util.ValidationUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -114,31 +117,6 @@ public class UserController implements IBaseController { ...@@ -114,31 +117,6 @@ public class UserController implements IBaseController {
return login(channelId, appChannel, createdFrom, userId, key, request, openId, dimension); return login(channelId, appChannel, createdFrom, userId, key, request, openId, dimension);
} }
/**
* 快速登录(手机号 + 短信验证码),H5专用入口
* 短信验证码错误达到限定次数时执行图形验证码校验
* 图形验证码累计错误达到限定次数时须重新获取
*
* @param channelId
* @param appChannel
* @param createdFrom
* @param key
* @param btRegisterChannelId
* @param dimension
* @param request
* @return
*/
@RequestMapping("/login/fastV1")
public JsonResult loginFastV1(
@RequestParam(required = false, defaultValue = "1") Long channelId, String appChannel,
@RequestParam(required = false, defaultValue = "1") Long createdFrom,
@RequestParam(required = false,defaultValue = "xyqb") String key,
@RequestParam(required = false)Long btRegisterChannelId,
@RequestParam(required = false) String dimension ,HttpServletRequest request) {
LOGGER.info("login/fastV1 -> channelId:{},appChennel:{},createdFrom:{},key:{},btRegisterChannelId:{},dimension:{}",channelId, appChannel, createdFrom, key, btRegisterChannelId, dimension);
return loginFast(channelId, appChannel, createdFrom, key, btRegisterChannelId, dimension, request);
}
@LogHttpCaller @LogHttpCaller
@PasswordErrorFiniteValidator @PasswordErrorFiniteValidator
@RequestMapping("/login") @RequestMapping("/login")
...@@ -162,15 +140,44 @@ public class UserController implements IBaseController { ...@@ -162,15 +140,44 @@ public class UserController implements IBaseController {
} }
} }
/**
* 快速登录(手机号 + 短信验证码),H5专用入口
* 短信验证码错误达到限定次数时执行图形验证码校验
* 图形验证码累计错误达到限定次数时须重新获取
*
* @param channelId
* @param appChannel
* @param createdFrom
* @param key
* @param btRegisterChannelId
* @param dimension
* @param request
* @return
*/
@RequestMapping("/login/fastV1")
public JsonResult loginFastV1(
@RequestParam(required = false, defaultValue = "1") Long channelId, String appChannel,
@RequestParam(required = false, defaultValue = "1") Long createdFrom,
@RequestParam(required = false,defaultValue = "xyqb") String key,
@RequestParam(required = false) Long btRegisterChannelId,
@RequestParam(required = false) String dimension,
@RequestParam(name = "click_id", required = false) String clickId,
HttpServletRequest request) {
LOGGER.info("login/fastV1 -> channelId:{},appChennel:{},createdFrom:{},key:{},btRegisterChannelId:{},dimension:{},clickId:{}",channelId, appChannel, createdFrom, key, btRegisterChannelId, dimension, clickId);
return loginFast(channelId, appChannel, createdFrom, key, btRegisterChannelId, dimension, clickId, request);
}
@RequestMapping("/login/fast") @RequestMapping("/login/fast")
public JsonResult loginFast( public JsonResult loginFast(
@RequestParam(required = false, defaultValue = "1") Long channelId, String appChannel, @RequestParam(required = false, defaultValue = "1") Long channelId, String appChannel,
@RequestParam(required = false, defaultValue = "1") Long createdFrom, @RequestParam(required = false, defaultValue = "1") Long createdFrom,
@RequestParam(required = false,defaultValue = "xyqb") String key, @RequestParam(required = false,defaultValue = "xyqb") String key,
@RequestParam(required = false)Long btRegisterChannelId, @RequestParam(required = false)Long btRegisterChannelId,
@RequestParam(required = false) String dimension ,HttpServletRequest request) { @RequestParam(required = false) String dimension,
@RequestParam(name = "click_id", required = false) String clickId,
HttpServletRequest request) {
Map<String, JsonResult> validMap = getHeaderParam(request); Map<String, JsonResult> validMap = getHeaderParam(request);
LOGGER.info("login/fast -> channelId:{},appChannel:{},createdFrom:{},btRegisterChannelId:{},key:{},dimension:{}",channelId,appChannel,createdFrom,btRegisterChannelId,key,dimension); LOGGER.info("login/fast -> channelId:{},appChannel:{},createdFrom:{},btRegisterChannelId:{},key:{},dimension:{},clickId:{}",channelId,appChannel,createdFrom,btRegisterChannelId,key,dimension, clickId);
if (null != validMap.get("fail")) { if (null != validMap.get("fail")) {
return validMap.get("fail"); return validMap.get("fail");
} }
...@@ -181,29 +188,31 @@ public class UserController implements IBaseController { ...@@ -181,29 +188,31 @@ public class UserController implements IBaseController {
JsonResult successResult = validMap.get("success"); JsonResult successResult = validMap.get("success");
String phoneNo = successResult.getData().toString(); String phoneNo = successResult.getData().toString();
if (!ValidationUtil.validatePhoneNo(phoneNo)) { if (!ValidationUtil.validatePhoneNo(phoneNo)) {
LOGGER.info("用户快速登录失败,手机号错误, createdFrom:{},phoneNo:{}", createdFrom, phoneNo); LOGGER.info("用户快速注册失败,手机号错误, createdFrom:{},phoneNo:{}", createdFrom, phoneNo);
throw new UserNotExistException("手机号错误"); throw new UserNotExistException("手机号错误");
} }
String verificationCode = successResult.getMsg(); String verificationCode = successResult.getMsg();
// 执行短信验证码检查 // 执行短信验证码检查
verifyPhoneAndCode(phoneNo, verificationCode); verifyPhoneAndCode(phoneNo, verificationCode);
User user = userService.findByPhoneWithCache(phoneNo); User user = userService.findByPhoneWithCache(phoneNo);
// 缓存未命中时查DB
if (user == null) {
user = userService.findByPhoneInDb(phoneNo);
}
if (user != null && !user.getEnable()) { if (user != null && !user.getEnable()) {
LOGGER.error("用户不存在,或者已经注销,phoneNo:{}",phoneNo); LOGGER.error("用户不存在,或者已经注销,phoneNo:{}",phoneNo);
return JsonResult.buildErrorStateResult("登录失败", null); return JsonResult.buildErrorStateResult("登录失败", null);
} }
UserStatistics statistics = null;
JSONObject qqGdt = null;
if (user == null) { if (user == null) {
user = userRegisterService.register(phoneNo, channelId, createdFrom, appChannel,btRegisterChannelId,dimension); user = userRegisterService.register(phoneNo, channelId, createdFrom, appChannel,btRegisterChannelId,dimension);
if (user == null) { if (user == null) {
throw new UserNotExistException("用户未找到"); throw new UserNotExistException("用户未找到");
} }
//广点通转化注册 - 发送消息 - 方法内过滤
MqUtils.sendRegisterMessageForGdt(phoneNo, clickId);
statistics = new UserStatistics(user,dimension,2,channelId);
}else{
statistics = new UserStatistics(user,dimension,3,channelId);
} }
//增加登陆统计发送 //增加登陆统计发送
UserStatistics statistics=new UserStatistics(user,dimension,3,channelId);
MqUtils.sendLoanVest(statistics); MqUtils.sendLoanVest(statistics);
return new JsonResult(sessionService.createSession(channelId, createdFrom, appChannel, user, merchant)); return new JsonResult(sessionService.createSession(channelId, createdFrom, appChannel, user, merchant));
// return createSession(channelId, createdFrom, appChannel, user); // return createSession(channelId, createdFrom, appChannel, user);
...@@ -452,7 +461,7 @@ public class UserController implements IBaseController { ...@@ -452,7 +461,7 @@ public class UserController implements IBaseController {
//用户信息存在,更新session中的最后访问时间,重新写入缓存. //用户信息存在,更新session中的最后访问时间,重新写入缓存.
if (null != user || !user.getEnable()) { if (null != user || !user.getEnable()) {
//增加登陆统计发送 //增加登陆统计发送
UserStatistics statistics=new UserStatistics(user,dimension,1,channelId); UserStatistics statistics=new UserStatistics(user,dimension,4,channelId);
MqUtils.sendLoanVest(statistics); MqUtils.sendLoanVest(statistics);
return new JsonResult(sessionService.createSession(channelId, createdFrom, appChannel, user, merchant)); return new JsonResult(sessionService.createSession(channelId, createdFrom, appChannel, user, merchant));
} else { } else {
...@@ -495,6 +504,10 @@ public class UserController implements IBaseController { ...@@ -495,6 +504,10 @@ public class UserController implements IBaseController {
* @param verificationCode * @param verificationCode
*/ */
private void verifyPhoneAndCode(String phoneNo, String verificationCode) { private void verifyPhoneAndCode(String phoneNo, String verificationCode) {
// 非生产环境直接跳过验证码检验
if(!TechEnvironment.isPro()){
return;
}
if (!smsService.verifyPhoneAndCode(phoneNo, verificationCode)) { if (!smsService.verifyPhoneAndCode(phoneNo, verificationCode)) {
smsReSendOrNot(phoneNo); smsReSendOrNot(phoneNo);
LOGGER.info("验证码校验失败,phoneNo:{} , verificationCode:{}", phoneNo, verificationCode); LOGGER.info("验证码校验失败,phoneNo:{} , verificationCode:{}", phoneNo, verificationCode);
......
...@@ -12,17 +12,29 @@ import java.io.Serializable; ...@@ -12,17 +12,29 @@ import java.io.Serializable;
@Data @Data
public class UserQueryInfo implements Serializable { public class UserQueryInfo implements Serializable {
private static final long serialVersionUID = -1L; private static final long serialVersionUID = -1L;
/**
* 用户主键
*/
private Long userId; private Long userId;
/**
* 登录手机号/账号
*/
private String phoneNo; private String phoneNo;
/**
* 姓名
*/
private String name;
/**
* 银行卡号
*/
private String bankCards; private String bankCards;
/**
//证件号 * 证件号
*/
private String idNo; private String idNo;
/**
//0 身份证 1 军官证 2 护照 * 地址
*/
private String address; private String address;
......
...@@ -12,7 +12,13 @@ public class UserStatistics { ...@@ -12,7 +12,13 @@ public class UserStatistics {
private String uuid; private String uuid;
private Long registerFrom; private Long registerFrom;
private String dimension; private String dimension;
private int action;//登录0,注册1,快捷登录2,免密登录3 /**
* 1-登录
* 2-注册
* 3-快捷登录
* 4-免密登录
*/
private int action;
private Long channel; private Long channel;
public UserStatistics() { public UserStatistics() {
......
package cn.quantgroup.xyqb.service.mq; package cn.quantgroup.xyqb.service.mq;
import cn.quantgroup.xyqb.model.UserRegisterMqMessage; import java.io.Serializable;
import cn.quantgroup.xyqb.model.UserStatistics;
/** /**
* Created by xuran on 2017/9/7. * Created by xuran on 2017/9/7.
* 用户注册信息广播 * 用户注册信息广播
*/ */
public interface IRegisterMqService { public interface IRegisterMqService {
void send(UserRegisterMqMessage message); void send(Serializable message);
void send4Gdt(Serializable message);
} }
package cn.quantgroup.xyqb.service.mq.Impl; package cn.quantgroup.xyqb.service.mq.Impl;
import cn.quantgroup.xyqb.model.UserRegisterMqMessage;
import cn.quantgroup.xyqb.service.mq.IRegisterMqService; import cn.quantgroup.xyqb.service.mq.IRegisterMqService;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -12,6 +11,8 @@ import org.springframework.beans.factory.annotation.Qualifier; ...@@ -12,6 +11,8 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.Serializable;
/** /**
* Created by xuran on 2017/9/7. * Created by xuran on 2017/9/7.
*/ */
...@@ -22,34 +23,44 @@ public class IRegisterMqServiceImpl implements IRegisterMqService { ...@@ -22,34 +23,44 @@ public class IRegisterMqServiceImpl implements IRegisterMqService {
@Autowired @Autowired
@Qualifier("registerRabbitTemplate") @Qualifier("registerRabbitTemplate")
RabbitTemplate registerRabTemplate; RabbitTemplate registerRabTemplate;
@Autowired
@Qualifier("registerRabbitTemplate4Gdt")
RabbitTemplate registerRabbitTemplate4Gdt;
@Autowired @Autowired
@Qualifier(value = "registerMqQueue") @Qualifier(value = "registerMqQueue")
Queue registerMqQueue; Queue registerMqQueue;
/** /**
* 发送用登陆统计信息 * 发送用登陆统计信息
* @param message 订单信息 * @param message 订单信息
*/ */
@Override
@Async @Async
public void send(UserRegisterMqMessage message){ public void send(Serializable message){
if(null==message){ if(null==message){
LOGGER.error("广播用户注册消息不能为空"); LOGGER.error("广播用户注册消息不能为空");
} }
LOGGER.info("广播用户注册消息,message={}",message); LOGGER.info("广播用户注册消息,message={}",message);
String msg = JSONObject.toJSONString(message); String msg = JSONObject.toJSONString(message);
registerRabTemplate.convertAndSend(msg); registerRabTemplate.convertAndSend(msg);
LOGGER.info("广播用户注册消息,message={}",msg); LOGGER.info("广播用户注册消息,message={}",msg);
} }
/**
* 发送用登陆统计信息
* @param message 订单信息
*/
@Override
@Async
public void send4Gdt(Serializable message){
if(null==message){
LOGGER.error("广点通用户注册消息不能为空");
}
LOGGER.info("广点通用户注册消息,message={}",message);
String msg = JSONObject.toJSONString(message);
registerRabbitTemplate4Gdt.convertAndSend(msg);
LOGGER.info("广点通用户注册消息,message={}",msg);
}
} }
...@@ -62,6 +62,7 @@ public class SessionServiceImpl implements ISessionService { ...@@ -62,6 +62,7 @@ public class SessionServiceImpl implements ISessionService {
sessionStruct.setAttribute("channelId", String.valueOf(channelId)); sessionStruct.setAttribute("channelId", String.valueOf(channelId));
sessionStruct.setAttribute("createdFrom", String.valueOf(createdFrom)); sessionStruct.setAttribute("createdFrom", String.valueOf(createdFrom));
sessionStruct.setAttribute("appChannel", String.valueOf(appChannel)); sessionStruct.setAttribute("appChannel", String.valueOf(appChannel));
sessionStruct.getValues().setLoginProperties(properties);
authBean.setPhoneNo(user.getPhoneNo()); authBean.setPhoneNo(user.getPhoneNo());
authBean.setToken(sessionStruct.getSid()); authBean.setToken(sessionStruct.getSid());
persistSession(sessionStruct.getSid(), sessionStruct.getValues()); persistSession(sessionStruct.getSid(), sessionStruct.getValues());
......
...@@ -48,12 +48,16 @@ public class SmsServiceImpl implements ISmsService { ...@@ -48,12 +48,16 @@ public class SmsServiceImpl implements ISmsService {
} }
/**
* 24-“【信用钱包】么么哒,等您好久了~感谢您注册信用钱包,我们来给您送钱啦,点击提交借款申请,万元现金立即到手 s.xyqb.com/a”
* 1005-“【信用钱包】等您好久了~感谢您的注册,尊享息费5折优惠。登录 s.xyqb.com/a 享更多优惠(合理消费,理性借贷)”
* @param phoneNo
*/
@Override @Override
public void sendAfterRegister(String phoneNo) { public void sendAfterRegister(String phoneNo) {
try { try {
MsgParams msgParams = MsgParams msgParams =
new MsgParams(Collections.singletonList(2), phoneNo, "1", "24", Collections.emptyList()); new MsgParams(Collections.singletonList(2), phoneNo, "1", "1005", Collections.emptyList());
getSmsSender().sendMsg(msgParams); getSmsSender().sendMsg(msgParams);
//smsSender.sendAndForget(new SendAndForgetMsg(Collections.emptyList(), "24", "1", phoneNo)); //smsSender.sendAndForget(new SendAndForgetMsg(Collections.emptyList(), "24", "1", phoneNo));
log.info("注册完成,发送短信, phoneNo:{}", phoneNo); log.info("注册完成,发送短信, phoneNo:{}", phoneNo);
......
...@@ -6,7 +6,9 @@ import cn.quantgroup.xyqb.model.UserRet; ...@@ -6,7 +6,9 @@ import cn.quantgroup.xyqb.model.UserRet;
import cn.quantgroup.xyqb.model.UserStatistics; import cn.quantgroup.xyqb.model.UserStatistics;
import cn.quantgroup.xyqb.service.mq.IRegisterMqService; import cn.quantgroup.xyqb.service.mq.IRegisterMqService;
import cn.quantgroup.xyqb.service.mq.IVestService; import cn.quantgroup.xyqb.service.mq.IVestService;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
/** /**
* Created by xuran on 2017/6/23. * Created by xuran on 2017/6/23.
...@@ -26,6 +28,7 @@ public class MqUtils { ...@@ -26,6 +28,7 @@ public class MqUtils {
vest, e); vest, e);
} }
} }
/** /**
* 用户注册消息进行广播 * 用户注册消息进行广播
* @param message * @param message
...@@ -50,4 +53,25 @@ public class MqUtils { ...@@ -50,4 +53,25 @@ public class MqUtils {
MqUtils.sendRegisterMessage(registerMqMessage); MqUtils.sendRegisterMessage(registerMqMessage);
return userRet; return userRet;
} }
/**
* 腾讯广点通转化的用户注册消息推送
* @param phoneNo - 转化成功的用户手机号
* @param clickId - 转化成功的点击动作唯一标识
*/
public static void sendRegisterMessageForGdt(String phoneNo, String clickId){
if(ValidationUtil.validatePhoneNo(phoneNo) && StringUtils.isNotBlank(clickId)){
//填充广点通消息
JSONObject message = new JSONObject();
message.put("phoneNo", phoneNo);
message.put("clickId", clickId);
try {
IRegisterMqService rService = ApplicationContextHolder.getBean("registerMqService");
rService.send4Gdt(message);
} catch (Exception e) {
log.error("[MQUtils][MQUtils_exception]发送广点通用户注册信息,message={},error={}",
message, e);
}
}
}
} }
...@@ -6,23 +6,39 @@ import java.util.Base64; ...@@ -6,23 +6,39 @@ import java.util.Base64;
public class TestStringCode { public class TestStringCode {
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(base64("13511112222", "000000")); System.out.println(ap_base64("13511112222", "000000"));
System.out.println(base64("18022223333", "000000")); System.out.println(pc_base64("15566660006", "0000"));
} }
final static String AUTHORIZATION = "authorization"; final static String AUTHORIZATION = "authorization";
final static String PREFIX = "Basic "; final static String PREFIX_AP = "Basic ";
final static String PREFIX_PC = "Verification ";
/* /*
* 4.153 * 4.153
* 13576450525 123456 318e235d3e52648b236faa3f748000d5 * 13576450525 123456 318e235d3e52648b236faa3f748000d5
* 13724823305 123456 318e235d3e52648b236faa3f748000d5 * 13724823305 123456 318e235d3e52648b236faa3f748000d5
* Basic MTM1MTExMTIyMjI6MDAwMDAw
* Basic MTgwMjIyMjMzMzM6MDAwMDAw
* *
* 4.155 * 4.155
* 13511112222 000000 c8937b92506c0e2918de053dea69edd3 * 13511112222 000000 c8937b92506c0e2918de053dea69edd3
* 18022223333 000000 c8937b92506c0e2918de053dea69edd3 * 18022223333 000000 c8937b92506c0e2918de053dea69edd3
*/ */
final static String base64(String account, String password) { final static String ap_base64(String account, String password) {
String authorization = PREFIX + new String(Base64.getEncoder().encodeToString((account+":"+password).getBytes(Charset.forName("UTF-8")))); String authorization = PREFIX_AP + new String(Base64.getEncoder().encodeToString((account+":"+password).getBytes(Charset.forName("UTF-8"))));
return authorization;
}
/*
* 4.153
* 13576450525 123456 318e235d3e52648b236faa3f748000d5
* 13724823305 123456 318e235d3e52648b236faa3f748000d5
*
* 4.155
* 13511112222 000000 c8937b92506c0e2918de053dea69edd3
* 18022223333 000000 c8937b92506c0e2918de053dea69edd3
*/
final static String pc_base64(String phone, String code) {
String authorization = PREFIX_PC + new String(Base64.getEncoder().encodeToString((phone+":"+code).getBytes(Charset.forName("UTF-8"))));
return authorization; return authorization;
} }
......
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