From a784e13ef4642a1b7af494e97fcdb57611e83a07 Mon Sep 17 00:00:00 2001 From: xhxu Date: Wed, 21 Sep 2022 15:15:40 +0800 Subject: [PATCH] //shar --- .../enums/EnumProfitSharingReceiverType.java | 4 ++-- .../impl/WxProfitSharingOrderServiceImpl.java | 14 ++++++++++++-- .../service/share/wx/v3/WxPayShareV3Service.java | 9 +++++---- .../mapper/WxProfitSharingOrderMapper.xml | 2 +- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/enums/EnumProfitSharingReceiverType.java b/mallinkService/src/main/java/com/iformall/enums/EnumProfitSharingReceiverType.java index c50e60140..77c1e9fde 100644 --- a/mallinkService/src/main/java/com/iformall/enums/EnumProfitSharingReceiverType.java +++ b/mallinkService/src/main/java/com/iformall/enums/EnumProfitSharingReceiverType.java @@ -4,9 +4,9 @@ package com.iformall.enums; * Created by Stormeye on 2018/08/09. */ public enum EnumProfitSharingReceiverType { - PROFIT_SHARING_RECEIVER_MERCHANT_ID(0, "MERCHANT_ID"), + PROFIT_SHARING_RECEIVER_MERCHANT_ID(0, "MERCHANT_ID"),//v2,v3 PROFIT_SHARING_RECEIVER_PERSONAL_WECHATID(1, "PERSONAL_WECHATID"), - PROFIT_SHARING_RECEIVER_PERSONAL_OPENID(2, "PERSONAL_OPENID"), + PROFIT_SHARING_RECEIVER_PERSONAL_OPENID(2, "PERSONAL_OPENID"),//v2,v3 PROFIT_SHARING_RECEIVER_PERSONAL_SUB_OPENID(3, "PERSONAL_SUB_OPENID"), ; diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java index f2c93978b..8c1f9b489 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingOrderServiceImpl.java @@ -338,8 +338,17 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ updSharingOrder.setReceivers(JSON.toJSONString(receivers)); wxProfitSharingOrderMapper.updateById(updSharingOrder); - if(EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType()) || EnumPayShare.NO.getCode().equals(payOrder.getShare())){ - //如果是直连 把分给商户的钱记录下来 + if(EnumPayMchType.TOTAL.getCode().equals(payOrder.getMchType()) && EnumPayShare.NO.getCode().equals(payOrder.getShare())){ + //解冻给收款方(广场) + JSONObject jo = new JSONObject(); + jo.put("type",EnumProfitSharingReceiverType.PROFIT_SHARING_RECEIVER_MERCHANT_ID.getMessage()); + jo.put("account",payAccount.getSubMchId()); + jo.put("amount", shareAmount); + jo.put("merchantId",0); + jo.put("description",receiver.getId()); + receivers.add(jo); + }else if(EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType())){ + //解冻给收款方(门店) JSONObject jo = new JSONObject(); jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); jo.put("account",receiver.getReceiverAccount()); @@ -348,6 +357,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ jo.put("description",receiver.getId()); receivers.add(jo); } + try{ int delete = wxProfitSharingResultMapper.deleteBySharingOrderId(sharingOrder.getId(),sharingOrder.getTenantId()); final IdWorker idworker = IdWorker.get(); diff --git a/mallinkService/src/main/java/com/iformall/service/pay/service/share/wx/v3/WxPayShareV3Service.java b/mallinkService/src/main/java/com/iformall/service/pay/service/share/wx/v3/WxPayShareV3Service.java index ea8ba2170..380c030e5 100644 --- a/mallinkService/src/main/java/com/iformall/service/pay/service/share/wx/v3/WxPayShareV3Service.java +++ b/mallinkService/src/main/java/com/iformall/service/pay/service/share/wx/v3/WxPayShareV3Service.java @@ -84,12 +84,13 @@ public class WxPayShareV3Service extends PayShareBaseAdapterService{ } WxProfitSharingReceiver receiver = null; //直连,必须是特约商户号 - if (EnumPayMchType.DIRECT.getCode() == mchType) { +// if (EnumPayMchType.DIRECT.getCode() == mchType) { receiver = wxProfitSharingReceiverService.findReceiver(tenantEntity, merchantId,EnumAppPlat.WX,EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT_v2); //总分 - }else if (EnumPayMchType.TOTAL.getCode() == mchType) { - receiver = wxProfitSharingReceiverService.findReceiver(tenantEntity, merchantId,EnumAppPlat.WX,EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT); - } +// }else if (EnumPayMchType.TOTAL.getCode() == mchType) { +// receiver = wxProfitSharingReceiverService.findReceiver(tenantEntity, merchantId,EnumAppPlat.WX,EnumProfitSharingType.PROFIT_SHARING_TYPE_WECHAT); +// } + // if (null == receiver) { // throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(),"该商户未设置分账账号."); // } diff --git a/mallinkService/src/main/resources/mapper/WxProfitSharingOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxProfitSharingOrderMapper.xml index f8d5050b9..f330580d6 100644 --- a/mallinkService/src/main/resources/mapper/WxProfitSharingOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxProfitSharingOrderMapper.xml @@ -266,7 +266,7 @@ psre.receiver_type,psre.receiver_account,psre.receiver_comments,psre.sharing_type,psre.`status` from wx_profit_sharing_result psr left join wx_profit_sharing_receiver psre on psr.sharing_receiver_id = psre.id - where psr.sharing_order_id = #{id} and psr.tenant_id = #{tenantId} and psr.sharing_receiver_id != 0 + where psr.sharing_order_id = #{id} and psr.tenant_id = #{tenantId} and psr.`is_private` = #{isPrivate}