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 11eba696f..edf0e8dd8 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -551,8 +551,11 @@ public class WxCouponServiceImpl implements WxCouponService { } //判断直连检查收款帐号(必须),总分模式直接收款到小程序的收款帐号 - checkCouponMakeMerchant(record); - + ResultData merchantResultData = checkCouponMakeMerchant(record); + if(Result.SUCCESS != merchantResultData.code){ + return merchantResultData; + } + //平台券先不设置商户 Map tenantMerchantMap = null; if (EnumCouponType.checkCreateWithMerchants(record.getType())) { @@ -897,9 +900,10 @@ public class WxCouponServiceImpl implements WxCouponService { WxProfitPaymentReceiver receiver = payShareServie.getPaymantReceiver(mallTenantEntity, merchant.getId()); if (receiver == null) { badNames.add(merchant.getName()); - } - if(!MerchantImportStatus.improt_success.getCode().equals(receiver.getAlipayImportStatus())){ - badNames.add(merchant.getName()); + }else{ + if(!MerchantImportStatus.improt_success.getCode().equals(receiver.getAlipayImportStatus())){ + badNames.add(merchant.getName()); + } } } } @@ -1560,7 +1564,7 @@ public class WxCouponServiceImpl implements WxCouponService { couponQ.setIds(giftIds); List giftList = wxCouponMapper.findList(couponQ); if(giftList == null || giftList.isEmpty()){ - throw new MallinkException(ErrorCode.COUPON_IS_EMPTY_GIFT.getCode(), "未找到相应子券"); + return new ResultData(ErrorCode.COUPON_IS_EMPTY_GIFT.getCode(), "未找到相应子券"); } for (WxCoupon gift:giftList) { if(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(gift.getStatus())){ @@ -1586,11 +1590,11 @@ public class WxCouponServiceImpl implements WxCouponService { EnumPayWay payWay = EnumAppPlat.getPayWay(plat); WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(wxCoupon.getTenantId(),plat); if (cAppInfo == null) { - throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); + return new ResultData(ErrorCode.APP_ID_NOT_FOUND); } WxPayAccount payAccount = payAccountService.getByIdFromRedis(cAppInfo.getPayId()); if (payAccount == null) { - throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND); + return new ResultData(ErrorCode.API_KEY_NOT_FOUND); } EnumPayMchType payMchType = EnumPayMchType.getEnum(payAccount.getMchType()); if(EnumPayMchType.DIRECT.equals(payMchType)){ @@ -1602,7 +1606,7 @@ public class WxCouponServiceImpl implements WxCouponService { //品牌券,查询集团品牌商户 }else if (EnumCouponType.COUPON_DOUYIN_BRAND.getCode().equals(wxCoupon.getType())) { if(wxCoupon.getBrand() == null){ - throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未选择品牌"); + return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未选择品牌"); } wxCoupon.setMerchantType(EnumCouponMerchantType.MULTIPLE_MERCHANT.getCode()); makeMerchant = wxMerchantService.findBrandAdmin(wxCoupon,wxCoupon.getBrand()); @@ -1610,7 +1614,7 @@ public class WxCouponServiceImpl implements WxCouponService { }else { List merchantParamList = JSONObject.parseArray(wxCoupon.getMerchantParams(), JSONObject.class); if(merchantParamList == null || merchantParamList.isEmpty()){ - throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),"所属商户为空"); + return new ResultData(ErrorCode.MERCHANT_INFO_NOT_FOUND.getCode(),"所属商户为空"); } //多门店券 if(merchantParamList.size() > 1 || EnumCouponMerchantType.MULTIPLE_MERCHANT.getCode().equals(wxCoupon.getMerchantType())){ @@ -1623,7 +1627,7 @@ public class WxCouponServiceImpl implements WxCouponService { } } if (makeMerchant == null) { - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未找到所属商户"); + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未找到所属商户"); } wxCoupon.setMakeMerchantId(makeMerchant.getId()); @@ -1631,7 +1635,7 @@ public class WxCouponServiceImpl implements WxCouponService { PayShareAdapterService payShareServie = payServiceFactory.getPayShareAdapterService(payWay.getCode(),payAccount.getPayVersion()); WxProfitPaymentReceiver receiver = payShareServie.getPaymantReceiver(makeMerchant, makeMerchant.getId()); if (receiver == null) { - throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "所属商户[\""+makeMerchant.getName()+"\"]未配置收款账户"); + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "所属商户[\""+makeMerchant.getName()+"\"]未配置收款账户"); } //如果是直连,抖音,多商户券必须只配置支付宝 @@ -1639,14 +1643,14 @@ public class WxCouponServiceImpl implements WxCouponService { 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()+"\"]未配置收款账户"); + return new ResultData(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()+"\"]配置收款账户错误,只能配置支付宝."); + return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "所属商户[\""+makeMerchant.getName()+"\"]配置收款账户错误,只能配置支付宝."); } } }