|
|
|
@@ -116,15 +116,16 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { |
|
|
|
if (Objects.isNull(merchantIdStr)) { |
|
|
|
throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND); |
|
|
|
} |
|
|
|
WxCouponMerchant couponMerchantQ = new WxCouponMerchant(); |
|
|
|
couponMerchantQ.setTenantId(record.getTenantId()); |
|
|
|
couponMerchantQ.setProductId(record.getCouponId()); |
|
|
|
couponMerchantQ.setMerchantId(Long.parseLong(merchantIdStr)); |
|
|
|
couponMerchantQ.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); |
|
|
|
WxCouponMerchant couponMerchant = wxCouponMerchantMapper.selectOne(couponMerchantQ); |
|
|
|
if (Objects.isNull(couponMerchant)) { |
|
|
|
throw new MallinkException(ErrorCode.COUPON_MERCHANT_NOT_FOUND); |
|
|
|
} |
|
|
|
//产品需求,暂时不约束发券商户和券所属商户 |
|
|
|
//WxCouponMerchant couponMerchantQ = new WxCouponMerchant(); |
|
|
|
//couponMerchantQ.setTenantId(record.getTenantId()); |
|
|
|
//couponMerchantQ.setProductId(record.getCouponId()); |
|
|
|
//couponMerchantQ.setMerchantId(Long.parseLong(merchantIdStr)); |
|
|
|
//couponMerchantQ.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); |
|
|
|
//WxCouponMerchant couponMerchant = wxCouponMerchantMapper.selectOne(couponMerchantQ); |
|
|
|
//if (Objects.isNull(couponMerchant)) { |
|
|
|
// throw new MallinkException(ErrorCode.COUPON_MERCHANT_NOT_FOUND); |
|
|
|
//} |
|
|
|
int merchantLnventory = jo.getInteger(WxCouponSend.KEY_MERCHANT_LNVENTORY); |
|
|
|
//商家购券数不能大于总库存 |
|
|
|
if (merchantLnventory > wxCouponOfDb.getRemainInventory()) { |
|
|
|
|