From 07eb68ce50536f98a9413ad01177bca754181466 Mon Sep 17 00:00:00 2001 From: xhxu Date: Fri, 24 Feb 2023 16:29:19 +0800 Subject: [PATCH 1/2] //couponmerchant --- .../service/impl/WxCouponServiceImpl.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 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 11eba696f..395718f21 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())) { @@ -1560,7 +1563,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 +1589,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 +1605,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 +1613,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 +1626,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 +1634,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 +1642,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()+"\"]配置收款账户错误,只能配置支付宝."); } } } From 569a04f9df310c2cca7eec426cfdcefce8f575ef Mon Sep 17 00:00:00 2001 From: xhxu Date: Fri, 24 Feb 2023 17:00:31 +0800 Subject: [PATCH 2/2] //couponmerchant --- .../com/iformall/service/impl/WxCouponServiceImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 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 395718f21..edf0e8dd8 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -900,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()); + } } } }