Authored by ping

update

... ... @@ -5,6 +5,7 @@ package com.yoho.activity.common.helper;
import javax.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
... ... @@ -36,6 +37,11 @@ public class SendCouponHelper {
*/
public String sendCoupon(String couponId, int uid) throws ServiceException {
log.info("start with sendCoupon. couponId is {}, uid is {}", couponId, uid);
if (StringUtils.isEmpty(couponId)) {
return "0";
}
CouponForm form = new CouponForm();
form.setCouponId(couponId);
form.setUid(String.valueOf(uid));
... ...
... ... @@ -20,6 +20,7 @@ import com.yoho.activity.common.bo.OrderShareBO;
import com.yoho.activity.common.bo.OrderShareCouponVO;
import com.yoho.activity.common.constatns.Constant;
import com.yoho.activity.common.convert.OrderShareActivityConvert;
import com.yoho.activity.common.helper.SendCouponHelper;
import com.yoho.activity.common.helper.SendSMSHelper;
import com.yoho.activity.common.redis.CacheKeyHelper;
import com.yoho.activity.common.utils.DateUtils;
... ... @@ -39,7 +40,6 @@ import com.yoho.coupon.dal.model.UserCouponHistory;
import com.yoho.coupon.dal.model.UserShareHistory;
import com.yoho.coupon.dal.model.UserShareHistoryRequest;
import com.yoho.service.model.activity.drawline.response.DrawOrderShareCouponRespBO;
import com.yoho.service.model.promotion.CouponForm;
import com.yoho.service.model.request.ProfileRequestBO;
import com.yoho.service.model.request.RegisterReqBO;
import com.yoho.service.model.response.ProfileInfoRsp;
... ... @@ -85,6 +85,8 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService
@Resource
SendSMSHelper sendSMSHelper;
@Resource
SendCouponHelper sendCouponHelper;
//订单分享活动缓存KEY(当前只有一个)
public static final String ORDER_SHARE_ACTIVITY_CACHEKEY = "yh:activity:ordershare:activitykey";
... ... @@ -245,27 +247,6 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService
log.info("end with addCouponHistory.");
}
/**
* 发送优惠券
*
* @param couponId
* @param uid
*/
private String sendCoupon(String couponId, String uid) {
log.info("start with sendCoupon. couponId is {}, uid is {}", couponId, uid);
CouponForm form = new CouponForm();
form.setCouponId(couponId);
form.setUid(uid);
String couponCode = "";
try {
couponCode = serviceCaller.call("promotion.sendCoupon", form, String.class);
} catch (Exception e) {
log.error("sendCoupon failed, ex: {}", e.getMessage());
}
log.info("end with sendCoupon. couponCode is {}", couponCode);
return couponCode;
}
@Override
public DrawOrderShareCouponRespBO drawOrderShareCoupon(String mobile, String orderCode) {
log.info("drawOrderShareCoupon with mobile={}, orderCode={}", mobile, orderCode);
... ... @@ -539,7 +520,7 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService
//发送优惠券
log.info("orderShare sendCoupon, uid: {}, couponId: {}", uid, coupon.getCouponId());
String couponCode = sendCoupon(coupon.getCouponId(), String.valueOf(uid));
String couponCode = sendCouponHelper.sendCoupon(coupon.getCouponId(), uid);
if(StringUtils.isEmpty(couponCode)) {
log.error("sendCoupon failed, uid: {}, couponId: {}", uid, coupon.getCouponId());
return couponVO;
... ...