|
@@ -3,13 +3,17 @@ package com.qs.mp.web.controller.api.channel;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.qs.mp.admin.domain.Coupon;
|
|
|
import com.qs.mp.admin.domain.CouponChannel;
|
|
|
import com.qs.mp.admin.service.ICouponChannelService;
|
|
|
+import com.qs.mp.admin.service.ICouponService;
|
|
|
import com.qs.mp.channel.domain.ChannelCouponVerifyLog;
|
|
|
import com.qs.mp.channel.service.IChannelCouponVerifyLogService;
|
|
|
import com.qs.mp.channel.service.IChannelService;
|
|
|
import com.qs.mp.common.core.domain.AjaxResult;
|
|
|
import com.qs.mp.common.core.page.TableDataInfo;
|
|
|
+import com.qs.mp.common.enums.CouponTypeEnum;
|
|
|
+import com.qs.mp.common.enums.CouponUseAreaEnum;
|
|
|
import com.qs.mp.common.enums.ErrorCodeEnum;
|
|
|
import com.qs.mp.common.enums.UserCouponStatusEnum;
|
|
|
import com.qs.mp.user.domain.UserCoupon;
|
|
@@ -61,6 +65,9 @@ public class ChannelCouponVerifyController extends BaseApiController {
|
|
|
@Autowired
|
|
|
private ICouponChannelService couponChannelService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ICouponService couponService;
|
|
|
+
|
|
|
/**
|
|
|
* 优惠券查询
|
|
|
*
|
|
@@ -107,12 +114,16 @@ public class ChannelCouponVerifyController extends BaseApiController {
|
|
|
.eq(UserCouponChannel::getUserCouponId, userCoupon.getId())
|
|
|
.eq(UserCouponChannel::getChannelId, channelId));
|
|
|
if (null == couponChannel) {
|
|
|
-
|
|
|
- int count = couponChannelService.count(new LambdaQueryWrapper<CouponChannel>()
|
|
|
- .eq(CouponChannel::getCouponId, userCoupon.getCouponId())
|
|
|
- .eq(CouponChannel::getChannelId, channelId));
|
|
|
- if (count <= 0) {
|
|
|
- result = error("无权核销该券");
|
|
|
+ Coupon coupon = couponService.getById(userCoupon.getCouponId());
|
|
|
+ if (CouponTypeEnum.SITE_CONSUME.equals(coupon.getType())) {
|
|
|
+ if (CouponUseAreaEnum.PRE_SCOPE.equals(coupon.getUseArea())) {
|
|
|
+ int count = couponChannelService.count(new LambdaQueryWrapper<CouponChannel>()
|
|
|
+ .eq(CouponChannel::getCouponId, userCoupon.getCouponId())
|
|
|
+ .eq(CouponChannel::getChannelId, channelId));
|
|
|
+ if (count <= 0) {
|
|
|
+ result = error("无权核销该券");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return result;
|