...
|
...
|
@@ -212,9 +212,9 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService |
|
|
|
|
|
|
|
|
@Override
|
|
|
public DrawOrderShareCouponRespBO drawOrderShareCoupon(String mobile,
|
|
|
int activityId, long orderCode) {
|
|
|
DrawOrderShareCouponRespBO respBO = new DrawOrderShareCouponRespBO(mobile, activityId, orderCode);
|
|
|
public DrawOrderShareCouponRespBO drawOrderShareCoupon(String mobile, long orderCode) {
|
|
|
|
|
|
DrawOrderShareCouponRespBO respBO = new DrawOrderShareCouponRespBO(mobile, orderCode);
|
|
|
//1、简单验证手机号
|
|
|
if(!validMobile(mobile)) {
|
|
|
respBO.setReturnCode(Constant.ORDER_SHARE_MOBILE_ERROR);
|
...
|
...
|
@@ -224,11 +224,11 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService |
|
|
}
|
|
|
|
|
|
//2、检查活动是否结束
|
|
|
OrderShareActivity activityInfo = getActvivity(activityId);
|
|
|
OrderShareActivityBO activityInfo = getActivityInfoById();
|
|
|
if(activityInfo == null || isAcitvityExpire(activityInfo)) {
|
|
|
respBO.setReturnCode(Constant.ORDER_SHARE_ACTIVITY_EXPIRE);
|
|
|
respBO.setReturnMsg("活动已经过期");
|
|
|
log.warn("the acitivity is out of date, mobile: {}, activity: {}", mobile, activityId);
|
|
|
log.warn("the acitivity is out of date, mobile: {}, activity: {}", mobile, activityInfo.getId());
|
|
|
return respBO;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -243,10 +243,10 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService |
|
|
}
|
|
|
|
|
|
//4、判断老用户是否达到分享限制
|
|
|
if(isUpToOrderShareLimit(orderCode, activityId)) {
|
|
|
if(isUpToOrderShareLimit(orderCode, activityInfo.getId())) {
|
|
|
respBO.setReturnCode(Constant.ORDER_SHARE_OLDUSER_UPLIMIT);
|
|
|
respBO.setReturnMsg("优惠券已抢光");
|
|
|
log.warn("orderShare for Register user is over, orderCode: {}, activityId: {}", orderCode, activityId);
|
|
|
log.warn("orderShare for Register user is over, orderCode: {}, activityId: {}", orderCode, activityInfo.getId());
|
|
|
return respBO;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -261,7 +261,8 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService |
|
|
}
|
|
|
|
|
|
//4、记录用户领券的记录
|
|
|
updateOrderShareRecord(activityId, profileInfo.getUid(), orderCode, activityInfo.getRegistCouponId(), 1);
|
|
|
respBO.setCoupon(couponCode);
|
|
|
updateOrderShareRecord(activityInfo.getId(), profileInfo.getUid(), orderCode, activityInfo.getRegistCouponId(), 1);
|
|
|
|
|
|
return respBO;
|
|
|
}
|
...
|
...
|
@@ -269,15 +270,15 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService |
|
|
|
|
|
@Override
|
|
|
public DrawOrderShareCouponRespBO registerAndSendCoupon(String mobile,
|
|
|
int activityId, long orderCode, String identifyCode) {
|
|
|
DrawOrderShareCouponRespBO respBO = new DrawOrderShareCouponRespBO(mobile, activityId, orderCode);
|
|
|
long orderCode, String identifyCode) {
|
|
|
DrawOrderShareCouponRespBO respBO = new DrawOrderShareCouponRespBO(mobile, orderCode);
|
|
|
|
|
|
//1、检查活动是否结束
|
|
|
OrderShareActivity activityInfo = getActvivity(activityId);
|
|
|
OrderShareActivityBO activityInfo = getActivityInfoById();
|
|
|
if(activityInfo == null) {
|
|
|
respBO.setReturnCode(Constant.ORDER_SHARE_ACTIVITY_EXPIRE);
|
|
|
respBO.setReturnMsg("活动已经过期");
|
|
|
log.warn("the acitivity not exists, activity: {}", activityId);
|
|
|
log.warn("the acitivity not exists, activity: {}", activityInfo.getId());
|
|
|
return respBO;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -313,7 +314,8 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService |
|
|
return respBO;
|
|
|
}
|
|
|
//4、记录用户领券的记录
|
|
|
updateOrderShareRecord(activityId, uid, orderCode, activityInfo.getUnregistCouponId(), 0);
|
|
|
respBO.setCoupon(couponCode);
|
|
|
updateOrderShareRecord(activityInfo.getId(), uid, orderCode, activityInfo.getUnregistCouponId(), 0);
|
|
|
return respBO;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -369,7 +371,7 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService |
|
|
* @param activityInfo
|
|
|
* @return
|
|
|
*/
|
|
|
private boolean isAcitvityExpire(OrderShareActivity activityInfo) {
|
|
|
private boolean isAcitvityExpire(OrderShareActivityBO activityInfo) {
|
|
|
if(activityInfo == null) {
|
|
|
return true;
|
|
|
}
|
...
|
...
|
|