Authored by Ge

update

... ... @@ -48,6 +48,16 @@ public class TencentMktActivity extends BaseBO {
private Byte userNotOrder;
private Byte oldUser;
public Byte getOldUser() {
return oldUser;
}
public void setOldUser(Byte oldUser) {
this.oldUser = oldUser;
}
private String smsContent;
private String oldUserPopupContent;
... ... @@ -58,6 +68,7 @@ public class TencentMktActivity extends BaseBO {
private String buttomTextPic;
public String getOldUserPopupContent() {
return oldUserPopupContent;
}
... ...
... ... @@ -22,6 +22,7 @@
<result column="second_screen_pic" property="secondScreenPic" jdbcType="VARCHAR" />
<result column="coupon_id" property="couponId" jdbcType="VARCHAR" />
<result column="user_not_order" property="userNotOrder" jdbcType="VARCHAR" />
<result column="old_user" property="oldUser" jdbcType="VARCHAR"/>
<result column="sms_content" property="smsContent" jdbcType="VARCHAR" />
<result column="old_user_popup_content" property="oldUserPopupContent" jdbcType="VARCHAR" />
<result column="old_user_button_name" property="oldUserButtonName" jdbcType="VARCHAR" />
... ... @@ -31,7 +32,7 @@
<sql id="Base_Column_List" >
id, activity_code, activity_name, h5_title, activity_normal_pic, activity_end_pic,
share_img_url, share_title, share_content, pc_link, activity_desc, begin_time, end_time,
coupon_pic, button_link, create_time, status, second_screen_pic, coupon_id, user_not_order,sms_content,old_user_popup_content,old_user_button_name,old_user_button_link,buttom_text_pic
coupon_pic, button_link, create_time, status, second_screen_pic, coupon_id, user_not_order,sms_content,old_user_popup_content,old_user_button_name,old_user_button_link,buttom_text_pic,old_user
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
... ...
... ... @@ -4,6 +4,7 @@
package com.yoho.activity.service;
import com.yoho.error.exception.ServiceException;
import com.yoho.service.model.union.response.TencentMktActivityBO;
import com.yoho.service.model.union.response.TencentMktBO;
import com.yoho.unions.vo.ApiResponse;
... ... @@ -54,7 +55,7 @@ public interface ITencentMktService {
* @return
* @throws ServiceException
*/
public ApiResponse register(String area, String mobile, String client_type) throws ServiceException;
public ApiResponse register(String area, String mobile, String client_type,TencentMktActivityBO bo) throws ServiceException;
/**
... ...
... ... @@ -122,37 +122,40 @@ public class TencentMktServiceImpl implements ITencentMktService {
log.warn("call sendSms. user is exist. and have get coupon. area={}, mobile={}, activityCode={}", area, mobile, activityCode);
return new ApiResponse(503, "您已经领取过了!");
}
// 只有未注册过的用户 才可以领取优惠券
if (activity.getUserNotOrder() == null || activity.getUserNotOrder() == 0) {
// 配置了弹框 则走弹框的流程
if (StringUtils.isNotBlank(activity.getOldUserPopupContent())
&& StringUtils.isNotBlank(activity.getOldUserButtonName())
&& StringUtils.isNotBlank(activity.getOldUserButtonLink())){
log.warn("olderUserConfig exist. user is exist. area={}, mobile={}, activityCode={}", area, mobile, activityCode);
return new ApiResponse(505, "弹框显示错误消息!");
}
//配置不允许老用户领取
log.warn("call getUserprofileByEmailOrMobile. user is exist. area={}, mobile={}, activityCode={}", area, mobile, activityCode);
return new ApiResponse(502, "仅限新用户领取哦!");
}
//判断是否购买过
CountBO count = userServiceHelper.getOrderCountByUid(result.getUid());
if (count.getCount() > 0) {
//如果运营配置了老用户可以领,那就不用校验新客了
if (!(activity.getOldUser() != null && activity.getOldUser() == 1)) {
// 只有未注册过的用户 才可以领取优惠券
if (activity.getUserNotOrder() == null || activity.getUserNotOrder() == 0) {
// 配置了弹框 则走弹框的流程
if (StringUtils.isNotBlank(activity.getOldUserPopupContent())
&& StringUtils.isNotBlank(activity.getOldUserButtonName())
&& StringUtils.isNotBlank(activity.getOldUserButtonLink())) {
log.warn("olderUserConfig exist. user is exist. area={}, mobile={}, activityCode={}", area, mobile, activityCode);
return new ApiResponse(505, "弹框显示错误消息!");
}
// 配置了弹框 则走弹框的流程
if (StringUtils.isNotBlank(activity.getOldUserPopupContent())
&& StringUtils.isNotBlank(activity.getOldUserButtonName())
&& StringUtils.isNotBlank(activity.getOldUserButtonLink())){
log.warn("olderUserConfig exist. user is exist. area={}, mobile={}, activityCode={}", area, mobile, activityCode);
return new ApiResponse(505, "弹框显示错误消息!");
//配置不允许老用户领取
log.warn("call getUserprofileByEmailOrMobile. user is exist. area={}, mobile={}, activityCode={}", area, mobile, activityCode);
return new ApiResponse(502, "仅限新用户领取哦!");
}
log.warn("user have order list. area={}, mobile={}, activityCode={}, uid={}", area, mobile, activityCode, result.getUid());
return new ApiResponse(504, "仅限新用户领取哦!");
//判断是否购买过
CountBO count = userServiceHelper.getOrderCountByUid(result.getUid());
if (count.getCount() > 0) {
// 配置了弹框 则走弹框的流程
if (StringUtils.isNotBlank(activity.getOldUserPopupContent())
&& StringUtils.isNotBlank(activity.getOldUserButtonName())
&& StringUtils.isNotBlank(activity.getOldUserButtonLink())) {
log.warn("olderUserConfig exist. user is exist. area={}, mobile={}, activityCode={}", area, mobile, activityCode);
return new ApiResponse(505, "弹框显示错误消息!");
}
log.warn("user have order list. area={}, mobile={}, activityCode={}, uid={}", area, mobile, activityCode, result.getUid());
return new ApiResponse(504, "仅限新用户领取哦!");
}
}
}
... ... @@ -189,11 +192,13 @@ public class TencentMktServiceImpl implements ITencentMktService {
// 判断用户是否已经注册过,如果未注册,则调用注册接口
// 老用户则直接返回
response = register(area, mobile, "web");
//已注册的用户,再去判断是否是未购买的用户
//看一下这个活动是否设置了老用户也可以领取
//根据活动id,获取活动详情
TencentMktActivityBO bo = getActivityInfoByUnionType(activityCode);
response = register(area, mobile, "web",bo);
//已注册的用户,再去判断是否是未购买的用户
if (!checkUser(response, bo)) {
log.warn("validCodeAndSendCode error register error with code={}, area={}, mobile={}, activityCode={}", code, area, mobile, activityCode);
return response;
... ... @@ -426,7 +431,7 @@ public class TencentMktServiceImpl implements ITencentMktService {
@Override
public ApiResponse register(String area, String mobile, String client_type) throws ServiceException {
public ApiResponse register(String area, String mobile, String client_type,TencentMktActivityBO tencentMktActivityBO) throws ServiceException {
log.debug("register with area={}, mobile={},client_type={}", area, mobile, client_type);
... ... @@ -476,11 +481,13 @@ public class TencentMktServiceImpl implements ITencentMktService {
json.put("uid", model.getUid());
}
// 3.已注册用户,则返回,提示该用户已经注册过了
// 3.已注册用户,则返回,提示该用户已经注册过了--如果运营设置了,老用户也可以领,就让他领取
else {
log.warn("call getUserprofileByEmailOrMobile. result={}", result);
json.put("uid", result.getUid());
return new ApiResponse(502, "该用户已经注册过了", json);
if(!(tencentMktActivityBO.getOldUser()!=null &&tencentMktActivityBO.getOldUser()==1)){
return new ApiResponse(502, "该用户已经注册过了", json);
}
}
return new ApiResponse(json);
}
... ...