...
|
...
|
@@ -232,18 +232,6 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 更新用户领取记录
|
|
|
*
|
|
|
* @param id
|
|
|
* @param userType
|
|
|
*/
|
|
|
private void updateShareHistory(int id, int userType) {
|
|
|
log.info("start with updateShareHistory. id is {}, userType is {}", id, userType);
|
|
|
userShareHistoryDAO.updateShareHistoryNum(id, userType);
|
|
|
log.info("end with updateShareHistory.");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 发送优惠券
|
|
|
*
|
|
|
* @param couponId
|
...
|
...
|
@@ -265,7 +253,7 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService |
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public DrawOrderShareCouponRespBO drawOrderShareCoupon(String mobile, long orderCode) {
|
|
|
public DrawOrderShareCouponRespBO drawOrderShareCoupon(String mobile, String orderCode) {
|
|
|
log.info("drawOrderShareCoupon with mobile={}, orderCode={}", mobile, orderCode);
|
|
|
DrawOrderShareCouponRespBO respBO = new DrawOrderShareCouponRespBO(mobile, orderCode);
|
|
|
// 1、简单验证手机号
|
...
|
...
|
@@ -305,7 +293,7 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService |
|
|
}
|
|
|
|
|
|
// 4、判断老用户是否达到分享限制
|
|
|
if (isUpToOrderShareLimit(orderCode, activityInfo.getId())) {
|
|
|
if (isUpToOrderShareLimit(orderCode, activityInfo.getId(), profileInfo.getUid())) {
|
|
|
respBO.setReturnCode(Constant.ORDER_SHARE_OLDUSER_UPLIMIT);
|
|
|
respBO.setReturnMsg("优惠券已抢光");
|
|
|
log.warn("orderShare for Register user is over, orderCode: {}, activityId: {}", orderCode, activityInfo.getId());
|
...
|
...
|
@@ -331,7 +319,7 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService |
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public DrawOrderShareCouponRespBO registerAndSendCoupon(String mobile, long orderCode, String identifyCode) {
|
|
|
public DrawOrderShareCouponRespBO registerAndSendCoupon(String mobile, String orderCode, String identifyCode) {
|
|
|
DrawOrderShareCouponRespBO respBO = new DrawOrderShareCouponRespBO(mobile, orderCode);
|
|
|
|
|
|
// 1、检查活动是否结束
|
...
|
...
|
@@ -446,10 +434,10 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService |
|
|
* @param activityId
|
|
|
* @return
|
|
|
*/
|
|
|
private UserShareHistory getShareHistoryByOrderAndActivity(long orderCode, int activityId) {
|
|
|
UserShareHistory shareHistoryInfo = userShareHistoryDAO.selectByOrderAndActivity(String.valueOf(orderCode), activityId);
|
|
|
return shareHistoryInfo;
|
|
|
}
|
|
|
// private UserShareHistory getShareHistoryByOrderAndActivity(long orderCode, int activityId) {
|
|
|
// UserShareHistory shareHistoryInfo = userShareHistoryDAO.selectByOrderAndActivity(String.valueOf(orderCode), activityId);
|
|
|
// return shareHistoryInfo;
|
|
|
// }
|
|
|
|
|
|
/**
|
|
|
* 检查老用户当天是否已经领取过用户券
|
...
|
...
|
@@ -475,14 +463,11 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService |
|
|
* @param userType
|
|
|
* @return
|
|
|
*/
|
|
|
private boolean isUpToOrderShareLimit(long orderCode, int activityId) {
|
|
|
UserShareHistory shareHistoryInfo = getShareHistoryByOrderAndActivity(orderCode, activityId);
|
|
|
if (shareHistoryInfo == null) {
|
|
|
log.error("None order share, orderCode: {}, activityId: {}", orderCode, activityId);
|
|
|
return true;
|
|
|
}
|
|
|
private boolean isUpToOrderShareLimit(String orderCode, int activityId, int uid) {
|
|
|
log.info("isUpToOrderShareLimit with orderCode={}, activityId={}", orderCode, activityId);
|
|
|
int oldNum = userCouponHistoryDAO.selectOldUserCouponNum(activityId, uid, orderCode);
|
|
|
|
|
|
if (shareHistoryInfo.getOldUserNum() >= orderShareOldUserLimit) {
|
|
|
if (oldNum >= orderShareOldUserLimit) {
|
|
|
log.warn("Up to limit of orderShare for Register user");
|
|
|
return true;
|
|
|
}
|
...
|
...
|
@@ -498,17 +483,17 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService |
|
|
* @param couponId
|
|
|
* @param userType
|
|
|
*/
|
|
|
private void updateOrderShareRecord(int activityId, int uid, long orderCode, String couponId, int userType) {
|
|
|
private void updateOrderShareRecord(int activityId, int uid, String orderCode, String couponId, int userType) {
|
|
|
log.info("updateOrderShareRecord with activityId={}, uid={}, orderCode={}, couponId={}, userType={}", activityId, uid, orderCode, couponId, userType);
|
|
|
addCouponHistory(activityId, uid, String.valueOf(orderCode), couponId, userType);
|
|
|
log.info("updateOrderShareRecord addCouponHistory success with activityId={}, uid={}, orderCode={}, couponId={}, userType={}", activityId, uid, orderCode, couponId, userType);
|
|
|
UserShareHistory shareHistoryInfo = getShareHistoryByOrderAndActivity(orderCode, activityId);
|
|
|
log.info("updateOrderShareRecord getShareHistoryByOrderAndActivity success with activityId={}, uid={}, orderCode={}, couponId={}, userType={}, shareHistoryInfo={}", activityId, uid, orderCode, couponId, userType, shareHistoryInfo);
|
|
|
if (shareHistoryInfo == null) {
|
|
|
log.error("None order share, orderCode: {}, activityId: {}", orderCode, activityId);
|
|
|
return;
|
|
|
}
|
|
|
updateShareHistory(shareHistoryInfo.getId(), userType);
|
|
|
// UserShareHistory shareHistoryInfo = getShareHistoryByOrderAndActivity(orderCode, activityId);
|
|
|
// log.info("updateOrderShareRecord getShareHistoryByOrderAndActivity success with activityId={}, uid={}, orderCode={}, couponId={}, userType={}, shareHistoryInfo={}", activityId, uid, orderCode, couponId, userType, shareHistoryInfo);
|
|
|
// if (shareHistoryInfo == null) {
|
|
|
// log.error("None order share, orderCode: {}, activityId: {}", orderCode, activityId);
|
|
|
// return;
|
|
|
// }
|
|
|
// updateShareHistory(shareHistoryInfo.getId(), userType);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
|