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());