Browse Source

// test

release_toaliyun_real
xhxu 3 years ago
parent
commit
f87fce1298
1 changed files with 13 additions and 3 deletions
  1. +13
    -3
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java

+ 13
- 3
mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java View File

@@ -1271,10 +1271,10 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
if(cm == null){
throw new MallinkException(ErrorCode.VERIFY_COUPON_ORDER_MERCHANT_IS_NULL);
}
if(EnumCouponVerifyType.VERIFY_B.equals(couponVerifyType) && !cm.getMerchantId().equals(bUser.getMerchantId())){
if(EnumCouponVerifyType.VERIFY_B.equals(couponVerifyType) && !verifyMerchant(bUser,cm.getMerchantId())){
throw new MallinkException(ErrorCode.VERIFY_COUPON_ORDER_MERCHANT_IS_NULL);
}
merchantId = cm.getMerchantId();
merchantId = bUser.getMerchantId();
}else if(EnumCouponType.COUPON_GIFT.getCode().equals(wxCoupon.getType())){
if (StringUtils.isBlank(wxCoupon.getGiftList())){
logger.error("券包: coupon-" + wxCoupon.getId() + "数据异常" + "couponOrder-" + couponOrder.getId());
@@ -1292,7 +1292,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
wxCouponMerchant.setProductId(wxCoupon.getId());
wxCouponMerchant.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode());
List<WxCouponMerchant> couponMerchantList = wxCouponMerchantMapper.findList(wxCouponMerchant);
if (!couponMerchantList.stream().anyMatch(cm -> cm.getMerchantId().equals(bUser.getMerchantId()))) {
if (!couponMerchantList.stream().anyMatch(cm -> verifyMerchant(bUser,cm.getMerchantId()))) {
logger.error("券: coupon-" + wxCoupon.getId() + "核销: couponMerchantId-" + bUser.getMerchantId());
throw new MallinkException(ErrorCode.VERIFY_COUPON_ORDER_MERCHANT_IS_NULL);
}
@@ -1362,6 +1362,16 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
couponOrder.setMerchantId(merchantId);
return couponOrder;
}

private boolean verifyMerchant(WxMerchantBUser bUser,Long merchantId){
if(bUser.getMerchantId().equals(merchantId)){
return true;
}
if(bUser.getOtherMerchantIds().contains(merchantId.toString())){
return true;
}
return false;
}
@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})


Loading…
Cancel
Save