|
|
|
@@ -1473,16 +1473,30 @@ public class WxCouponServiceImpl implements WxCouponService { |
|
|
|
} |
|
|
|
return merchantAutoShareMap; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<Long, Boolean> couponMerchantAutoShare(WxCoupon wxCoupon) throws Exception { |
|
|
|
if (null == wxCoupon.getMerchantIds() || null == wxCoupon.getId()) { |
|
|
|
if (null == wxCoupon.getMerchantIds()) { |
|
|
|
throw new MallinkException(Result.ERROR,"缺少参数"); |
|
|
|
} |
|
|
|
WxCoupon coupon = wxCouponMapper.selectById(wxCoupon.getId(), wxCoupon.getTenantId()); |
|
|
|
if (null == coupon) { |
|
|
|
throw new MallinkException(Result.ERROR,"未查询到券"); |
|
|
|
|
|
|
|
Integer couponType = wxCoupon.getType(); |
|
|
|
Integer couponMerchantType = wxCoupon.getMerchantType(); |
|
|
|
//新增 |
|
|
|
if (null == wxCoupon.getId()) { |
|
|
|
if (null == wxCoupon.getType() || null == wxCoupon.getMerchantType()) { |
|
|
|
throw new MallinkException(Result.ERROR,"缺少参数"); |
|
|
|
} |
|
|
|
//更新 |
|
|
|
}else { |
|
|
|
WxCoupon coupon = wxCouponMapper.selectById(wxCoupon.getId(), wxCoupon.getTenantId()); |
|
|
|
if (null == coupon) { |
|
|
|
throw new MallinkException(Result.ERROR,"未查询到券"); |
|
|
|
} |
|
|
|
couponType = coupon.getType(); |
|
|
|
couponMerchantType = coupon.getMerchantType(); |
|
|
|
} |
|
|
|
EnumAppPlat plat = EnumCouponType.getAppPlat(coupon.getType()); |
|
|
|
EnumAppPlat plat = EnumCouponType.getAppPlat(couponType); |
|
|
|
EnumPayWay payWay = EnumAppPlat.getPayWay(plat); |
|
|
|
WxAppinfo cAppInfo = wxAppinfoService.getCAppInfo(wxCoupon,plat); |
|
|
|
if (cAppInfo == null) { |
|
|
|
@@ -1497,7 +1511,7 @@ public class WxCouponServiceImpl implements WxCouponService { |
|
|
|
PayShareAdapterService payShareServie = payServiceFactory.getPayShareAdapterService(payWay.getCode(),payAccount.getPayVersion()); |
|
|
|
//直连模式,如果是单商户券,则都可以;如果是多商户券,抖音则只要开通了支付宝就可以,微信则不行。 |
|
|
|
if (payMchType == EnumPayMchType.DIRECT) { |
|
|
|
if (EnumCouponMerchantType.ONE_MERCHANT.getCode() == coupon.getMerchantType()) { |
|
|
|
if (EnumCouponMerchantType.ONE_MERCHANT.getCode() == couponMerchantType) { |
|
|
|
return generateMerchantAutoShareAll(wxCoupon.getMerchantIds(),true); |
|
|
|
}else { |
|
|
|
if (plat == EnumAppPlat.TOUTIAO) { |
|
|
|
|