Authored by 匡佳华

发券记录操作员信息

... ... @@ -281,10 +281,12 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{
}
private ApiResponse sendCouponByMQ(String couponToken, List<Integer> uidList){
UserHelper operator = new UserHelper();
LOGGER.info("sendCoupon with couponToken is {}, uidList is {}, operateUserId is {}, operateUserName is {}", couponToken, uidList, operator.getUserId(), operator.getUserName());
// ufo券校验 1.是否有效 2.可用数量是否大于所需发送人数
Coupon coupon = couponMapper.selectValidByToken(couponToken);
if(coupon == null){
LOGGER.info("sendCoupon failed with coupon isn't exist or isn't valid, token is {}", couponToken);
LOGGER.info("sendCoupon failed with coupon isn't exist or isn't valid, couponToken is {}", couponToken);
return new ApiResponse(201, "优惠券未在使用中!", null);
}
if(coupon.getEndTime() < DateUtil.getCurrentTimeSecond()){
... ... @@ -293,7 +295,7 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{
}
int availableNum = coupon.getCouponNum() - coupon.getSendNum();
if(uidList.size() > availableNum){
LOGGER.info("sendCoupon failed with couponNum isn't enough, uidSize is {}, availableCouponNum is {}", uidList.size(), availableNum);
LOGGER.info("sendCoupon failed with couponNum isn't enough,token is{}, uidSize is {}, availableCouponNum is {}",couponToken, uidList.size(), availableNum);
return new ApiResponse(201, "uid数量大于当前券可用数量:"+ availableNum + "!" , null);
}
// 发券
... ... @@ -305,6 +307,7 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{
sendCouponParam.put("couponTokens", Collections.singletonList(coupon.getCouponToken()));
sendCouponParam.put("sendType", "1");//sendType 为1时, 若这张券已经领过,则仍然可以领
yhProducer.send("ufo.couponSendWithTradeMqNotify", sendCouponParam, null);
LOGGER.info("sendCoupon by mq, token is {}, uid is {}, operateUserId is {}, operateUserName is {}", couponToken, uid, operator.getUserId(), operator.getUserName());
Thread.sleep(5);
}catch (Exception e){
failUidList.add(uid);
... ...