Authored by LUOXC

添加作废优惠券功能

... ... @@ -7,10 +7,7 @@ import com.yoho.ufo.service.impl.BatchService;
import com.yoho.ufo.service.model.ApiResponse;
import com.yoho.ufo.service.model.ExportParam;
import com.yoho.ufo.util.HttpUtil;
import com.yohobuy.ufo.coupon.req.CouponQueryReq;
import com.yohobuy.ufo.coupon.req.CouponSaveUpdateReq;
import com.yohobuy.ufo.coupon.req.CouponSendReq;
import com.yohobuy.ufo.coupon.req.UserCouponQueryReq;
import com.yohobuy.ufo.coupon.req.*;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -94,8 +91,13 @@ public class CouponController {
@RequestMapping(value = "/couponSend")
public ApiResponse sendCoupon(CouponSendReq req){
LOGGER.info("enter couponSend, param is {}", req);
return couponService.sendCoupon(req);
LOGGER.info("enter couponSend, param is {}", req);
return couponService.sendCoupon(req);
}
@RequestMapping(value = "/invalidateUserCoupon")
public ApiResponse invalidateUserCoupon(UserCouponBaseRequest request){
return couponService.invalidateUserCoupon(request);
}
@CrossOrigin(origins = "*")
... ...
... ... @@ -3,10 +3,7 @@ package com.yoho.ufo.coupon.service;
import com.yoho.ufo.model.coupon.resp.UidCouponQueryResp;
import com.yoho.ufo.model.coupon.resp.UserCouponQueryResp;
import com.yoho.ufo.service.model.ApiResponse;
import com.yohobuy.ufo.coupon.req.CouponQueryReq;
import com.yohobuy.ufo.coupon.req.CouponSaveUpdateReq;
import com.yohobuy.ufo.coupon.req.CouponSendReq;
import com.yohobuy.ufo.coupon.req.UserCouponQueryReq;
import com.yohobuy.ufo.coupon.req.*;
import com.yohobuy.ufo.model.common.PageResponseBO;
import org.springframework.web.multipart.MultipartFile;
... ... @@ -29,4 +26,7 @@ public interface ICouponService {
ApiResponse sendCouponByImport(MultipartFile file, String couponToken) throws Exception;
PageResponseBO<UidCouponQueryResp> queryUserCouponList(UserCouponQueryReq req);
ApiResponse invalidateUserCoupon(UserCouponBaseRequest request);
}
... ...
... ... @@ -7,7 +7,6 @@ import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.core.rabbitmq.YhProducer;
import com.yoho.error.exception.ServiceException;
import com.yoho.ufo.coupon.service.ICouponService;
import com.yoho.ufo.dal.CouponMapper;
... ... @@ -26,15 +25,10 @@ import com.yoho.ufo.service.IBusinessExportService;
import com.yoho.ufo.service.impl.BatchService;
import com.yoho.ufo.service.impl.UserHelper;
import com.yoho.ufo.service.model.ApiResponse;
import com.yoho.ufo.util.CollectionUtil;
import com.yohobuy.ufo.coupon.req.CouponQueryReq;
import com.yohobuy.ufo.coupon.req.CouponSaveUpdateReq;
import com.yohobuy.ufo.coupon.req.CouponSendReq;
import com.yohobuy.ufo.coupon.req.UserCouponQueryReq;
import com.yohobuy.ufo.coupon.req.*;
import com.yohobuy.ufo.model.common.PageResponseBO;
import com.yohobuy.ufo.model.order.constants.SkupType;
import com.yohobuy.ufo.model.promotion.constant.CouponTypeEnum;
import com.yohobuy.ufo.model.promotion.constant.UserCouponsStatusEnum;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.math.NumberUtils;
... ... @@ -405,6 +399,15 @@ public class CouponServiceImpl implements ICouponService,IBusinessExportService{
return new PageResponseBO<>(total, result, req.getRows(), req.getPage());
}
@Override
public ApiResponse invalidateUserCoupon(UserCouponBaseRequest request) {
if (request == null || StringUtils.isEmpty(request.getCouponCode()) || Objects.isNull(request.getUid())) {
return new ApiResponse(201, "输入参数为空", null);
}
yhProducer.send("ufo.invalidateUserCoupon", request);
return new ApiResponse();
}
private List<UidCouponQueryResp> complateCouponInfo(List<UserCoupon> userCoupons) {
if (CollectionUtils.isEmpty(userCoupons)) {
return Lists.newArrayList();
... ...