From 7c03c4786a2ed0a4db10fd5dbace879544ccea5a Mon Sep 17 00:00:00 2001 From: hupeng Date: Wed, 5 Sep 2018 18:02:09 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=94=AF=E4=BB=98][=E4=BF=AE=E6=94=B9]:?= =?UTF-8?q?=E5=88=86=E8=B4=A6=E9=83=A8=E5=88=86APPID,MCHID=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=96=B9=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/WxProfitSharingOrderServiceImpl.java | 28 +++++-------- .../WxProfitSharingReceiverServiceImpl.java | 42 +++++++------------ 2 files changed, 26 insertions(+), 44 deletions(-) diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingOrderServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingOrderServiceImpl.java index 43a429ac0..62069f960 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingOrderServiceImpl.java @@ -142,10 +142,8 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ try { - WxAppinfo subAppInfo = getAppinfo(wxPayOrder); - WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(subAppInfo.getPayId()); - //WxPayAccount mainPayAccount = wxPayAccountMapper.selectByPrimaryKey(new Long(EnumPayDomain.PAY_DOMAIN_MASTER_ACCOUNT_ID.getCode())); - //WxAppinfo mainAppInfo = wxAppinfoMapper.selectByPrimaryKey(new Long(EnumPayDomain.PAY_DOMAIN_MASTER_APPINFO_ID.getCode())); + WxAppinfo appInfo = getAppinfo(wxPayOrder); + WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId()); WxOrder wxOrder = wxOrderMapper.selectByPrimaryKey(wxPayOrder.getOrderId()); @@ -173,12 +171,10 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ //分账提交 WxProfitSharingP wxProfitSharingP = new WxProfitSharingP(); - //wxProfitSharingP.setAppid(mainAppInfo.getAppId()); - //wxProfitSharingP.setMch_id(mainPayAccount.getMchId()); - wxProfitSharingP.setAppid(subAppInfo.getAppId()); + wxProfitSharingP.setAppid(appInfo.getParentAppId()); wxProfitSharingP.setMch_id(payAccount.getMchId()); - wxProfitSharingP.setSub_appid(subAppInfo.getAppId()); - wxProfitSharingP.setSub_mch_id(payAccount.getMchId()); + wxProfitSharingP.setSub_appid(appInfo.getAppId()); + wxProfitSharingP.setSub_mch_id(payAccount.getSubMchId()); wxProfitSharingP.setNonce_str(Utility.generate32UUID()); wxProfitSharingP.setTransaction_id(wxPayOrder.getTransactionId()); wxProfitSharingP.setOut_trade_no(record.getId().toString()); @@ -256,11 +252,8 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ WxProfitSharingOrder record = new WxProfitSharingOrder(); try { - WxAppinfo subAppInfo = getAppinfo(wxPayOrder); - WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(subAppInfo.getPayId()); - //WxPayAccount mainPayAccount = wxPayAccountMapper.selectByPrimaryKey(new Long(EnumPayDomain.PAY_DOMAIN_MASTER_ACCOUNT_ID.getCode())); - - WxOrder wxOrder = wxOrderMapper.selectByPrimaryKey(wxPayOrder.getOrderId()); + WxAppinfo appInfo = getAppinfo(wxPayOrder); + WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId()); //是否已创建分账订单 record.setOrderId(wxPayOrder.getId()); @@ -268,11 +261,10 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ if (record == null) throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND.getCode(), ErrorCode.ORDER_IS_NOT_FIND.getMessage()); - //分账提交 - WxProfitSharingQueryP wxProfitSharingQueryP = new WxProfitSharingQueryP(); - //wxProfitSharingP.setMch_id(mainPayAccount.getMchId()); + //分账查询提交 + WxProfitSharingQueryP wxProfitSharingQueryP = new WxProfitSharingQueryP();; wxProfitSharingQueryP.setMch_id(payAccount.getMchId()); - wxProfitSharingQueryP.setSub_mch_id(payAccount.getMchId()); + wxProfitSharingQueryP.setSub_mch_id(payAccount.getSubMchId()); wxProfitSharingQueryP.setNonce_str(Utility.generate32UUID()); wxProfitSharingQueryP.setTransaction_id(wxPayOrder.getTransactionId()); wxProfitSharingQueryP.setOut_trade_no(record.getId().toString()); diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingReceiverServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingReceiverServiceImpl.java index a487d10ba..38959562f 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingReceiverServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxProfitSharingReceiverServiceImpl.java @@ -85,15 +85,12 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv @Override public ResultData addReceiver(WxMerchant merchant) { - WxAppinfo subAppInfo = new WxAppinfo(); - subAppInfo.setTenantId(merchant.getTenantId()); - subAppInfo.setType(EnumAppType.C.getCode()); - - subAppInfo = wxAppinfoMapper.findList(subAppInfo).get(0); - WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(subAppInfo.getPayId()); - //WxPayAccount mainPayAccount = wxPayAccountMapper.selectByPrimaryKey(new Long(EnumPayDomain.PAY_DOMAIN_MASTER_ACCOUNT_ID.getCode())); - //WxAppinfo mainAppInfo = wxAppinfoMapper.selectByPrimaryKey(new Long(EnumPayDomain.PAY_DOMAIN_MASTER_APPINFO_ID.getCode())); + WxAppinfo appInfo = new WxAppinfo(); + appInfo.setTenantId(merchant.getTenantId()); + appInfo.setType(EnumAppType.C.getCode()); + appInfo = wxAppinfoMapper.findList(appInfo).get(0); + WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId()); WxProfitSharingReceiver receiver = new WxProfitSharingReceiver(); receiver.setMerchantId(merchant.getId()); @@ -108,12 +105,10 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv //添加分账账户 WxProfitSharingReceiverP wxProfitSharingReceiverP = new WxProfitSharingReceiverP(); - //wxProfitSharingP.setAppid(mainAppInfo.getAppId()); - //wxProfitSharingP.setMch_id(mainPayAccount.getMchId()); - wxProfitSharingReceiverP.setAppid(subAppInfo.getAppId()); + wxProfitSharingReceiverP.setAppid(appInfo.getParentAppId()); wxProfitSharingReceiverP.setMch_id(payAccount.getMchId()); - wxProfitSharingReceiverP.setSub_appid(subAppInfo.getAppId()); - wxProfitSharingReceiverP.setSub_mch_id(payAccount.getMchId()); + wxProfitSharingReceiverP.setSub_appid(appInfo.getAppId()); + wxProfitSharingReceiverP.setSub_mch_id(payAccount.getSubMchId()); wxProfitSharingReceiverP.setNonce_str(Utility.generate32UUID()); @@ -151,15 +146,12 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv @Override public ResultData delReceiver(WxMerchant merchant) { - WxAppinfo subAppInfo = new WxAppinfo(); - subAppInfo.setTenantId(merchant.getTenantId()); - subAppInfo.setType(EnumAppType.C.getCode()); - - subAppInfo = wxAppinfoMapper.findList(subAppInfo).get(0); - WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(subAppInfo.getPayId()); - //WxPayAccount mainPayAccount = wxPayAccountMapper.selectByPrimaryKey(new Long(EnumPayDomain.PAY_DOMAIN_MASTER_ACCOUNT_ID.getCode())); - //WxAppinfo mainAppInfo = wxAppinfoMapper.selectByPrimaryKey(new Long(EnumPayDomain.PAY_DOMAIN_MASTER_APPINFO_ID.getCode())); + WxAppinfo appInfo = new WxAppinfo(); + appInfo.setTenantId(merchant.getTenantId()); + appInfo.setType(EnumAppType.C.getCode()); + appInfo = wxAppinfoMapper.findList(appInfo).get(0); + WxPayAccount payAccount = wxPayAccountMapper.selectByPrimaryKey(appInfo.getPayId()); WxProfitSharingReceiver receiver = new WxProfitSharingReceiver(); receiver.setMerchantId(merchant.getId()); @@ -174,12 +166,10 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv //删除分账账户 WxProfitSharingReceiverP wxProfitSharingReceiverP = new WxProfitSharingReceiverP(); - //wxProfitSharingP.setAppid(mainAppInfo.getAppId()); - //wxProfitSharingP.setMch_id(mainPayAccount.getMchId()); - wxProfitSharingReceiverP.setAppid(subAppInfo.getAppId()); + wxProfitSharingReceiverP.setAppid(appInfo.getParentAppId()); wxProfitSharingReceiverP.setMch_id(payAccount.getMchId()); - wxProfitSharingReceiverP.setSub_appid(subAppInfo.getAppId()); - wxProfitSharingReceiverP.setSub_mch_id(payAccount.getMchId()); + wxProfitSharingReceiverP.setSub_appid(appInfo.getAppId()); + wxProfitSharingReceiverP.setSub_mch_id(payAccount.getSubMchId()); wxProfitSharingReceiverP.setNonce_str(Utility.generate32UUID());