|
@@ -11,6 +11,8 @@ import com.qs.mp.admin.service.ICouponService;
|
|
|
import com.qs.mp.admin.service.ICouponTicketService;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.qs.mp.channel.domain.Channel;
|
|
|
+import com.qs.mp.channel.service.IChannelService;
|
|
|
import com.qs.mp.common.enums.CouponUseAreaEnum;
|
|
|
import com.qs.mp.common.enums.UserCouponStatusEnum;
|
|
|
import com.qs.mp.common.exception.ServiceException;
|
|
@@ -47,13 +49,13 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme
|
|
|
|
|
|
@Autowired
|
|
|
private ICouponService couponService;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private IUserCouponService userCouponService;
|
|
|
|
|
|
@Autowired
|
|
|
private IUserCouponChannelService userCouponChannelService;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private ICouponTicketService couponTicketService;
|
|
|
|
|
@@ -63,6 +65,9 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme
|
|
|
@Autowired
|
|
|
private IUserTicketOrderItemService userTicketOrderItemService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IChannelService channelService;
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void distribute(Ticket ticket, Long userId, String couponId) {
|
|
@@ -80,7 +85,7 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme
|
|
|
userCoupon.setValidEnd(coupon.getValidEnd());
|
|
|
}
|
|
|
userCoupon.setStatus(UserCouponStatusEnum.UNUSED);
|
|
|
- userCouponService.save(userCoupon);
|
|
|
+
|
|
|
|
|
|
// 确定限定范围
|
|
|
if (coupon.getUseArea() == CouponUseAreaEnum.POST_SCOPE) {
|
|
@@ -94,9 +99,12 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme
|
|
|
userCouponChannel.setUserCouponId(userCoupon.getId());
|
|
|
userCouponChannel.setChannelId(orderItem.getChannelId());
|
|
|
userCouponChannelService.save(userCouponChannel);
|
|
|
+ Channel channel = channelService.getById(orderItem.getChannelId());
|
|
|
+ userCoupon.setUseAreaDesc(channel.getName());
|
|
|
}
|
|
|
+ userCouponService.save(userCoupon);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void saveCoupon(Coupon coupon, List<CouponTicket> ticketList) {
|
|
@@ -146,7 +154,7 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme
|
|
|
}else {
|
|
|
throw new ServiceException("请联系管理员");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|