From 9342a2ff25d2e7ed82c8f8951c4c574f708cfdf4 Mon Sep 17 00:00:00 2001 From: xhxu Date: Wed, 14 Dec 2022 11:25:00 +0800 Subject: [PATCH] //coupon --- .../service/impl/WxCouponServiceImpl.java | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java index 02fe951d8..d2e77d417 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -1607,32 +1607,35 @@ public class WxCouponServiceImpl implements WxCouponService { } } if (makeMerchant == null) { - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "没有收款商户"); - } - - PayShareAdapterService payShareServie = payServiceFactory.getPayShareAdapterService(payWay.getCode(),payAccount.getPayVersion()); - WxProfitSharingReceiver receiver = payShareServie.getReceiver(makeMerchant, makeMerchant.getId(), null, payMchType.getCode()); - if (receiver == null) { - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "收款商户[\""+makeMerchant.getName()+"\"]未配置收款账户"); + throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未找到所属商户"); } + wxCoupon.setMakeMerchantId(makeMerchant.getId()); - //如果是直连,抖音,多商户券必须只配置支付宝 - if (EnumAppPlat.TOUTIAO.equals(plat)) { - if (!MerchantImportStatus.improt_success.getCode().equals(receiver.getWxImportStatus()) - && !MerchantImportStatus.improt_success.getCode().equals(receiver.getAlipayImportStatus()) - && !MerchantImportStatus.improt_success.getCode().equals(receiver.getHzImportStatus())) { - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "收款商户[\""+makeMerchant.getName()+"\"]未配置收款账户"); + if(wxCoupon.getSalePrice() != null && wxCoupon.getSalePrice() > 0) { + PayShareAdapterService payShareServie = payServiceFactory.getPayShareAdapterService(payWay.getCode(),payAccount.getPayVersion()); + WxProfitSharingReceiver receiver = payShareServie.getReceiver(makeMerchant, makeMerchant.getId(), null, payMchType.getCode()); + if (receiver == null) { + throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "所属商户[\""+makeMerchant.getName()+"\"]未配置收款账户"); } - if(EnumCouponMerchantType.MULTIPLE_MERCHANT.getCode().equals(wxCoupon.getMerchantType())){ - if (MerchantImportStatus.improt_success.getCode().equals(receiver.getAlipayImportStatus()) - && !MerchantImportStatus.improt_success.getCode().equals(receiver.getWxImportStatus()) + + //如果是直连,抖音,多商户券必须只配置支付宝 + if (EnumAppPlat.TOUTIAO.equals(plat)) { + if (!MerchantImportStatus.improt_success.getCode().equals(receiver.getWxImportStatus()) + && !MerchantImportStatus.improt_success.getCode().equals(receiver.getAlipayImportStatus()) && !MerchantImportStatus.improt_success.getCode().equals(receiver.getHzImportStatus())) { - }else { - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "收款商户[\""+makeMerchant.getName()+"\"]配置收款账户错误,只能配置支付宝."); + throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "所属商户[\""+makeMerchant.getName()+"\"]未配置收款账户"); + } + if(EnumCouponMerchantType.MULTIPLE_MERCHANT.getCode().equals(wxCoupon.getMerchantType())){ + if (MerchantImportStatus.improt_success.getCode().equals(receiver.getAlipayImportStatus()) + && !MerchantImportStatus.improt_success.getCode().equals(receiver.getWxImportStatus()) + && !MerchantImportStatus.improt_success.getCode().equals(receiver.getHzImportStatus())) { + }else { + throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "所属商户[\""+makeMerchant.getName()+"\"]配置收款账户错误,只能配置支付宝."); + } } } } - wxCoupon.setMakeMerchantId(makeMerchant.getId()); + }else{ wxCoupon.setMakeMerchantId(0l); }