| @@ -4,9 +4,9 @@ package com.iformall.enums; | |||||
| * Created by Stormeye on 2018/08/09. | * Created by Stormeye on 2018/08/09. | ||||
| */ | */ | ||||
| public enum EnumProfitSharingReceiverType { | 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_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"), | PROFIT_SHARING_RECEIVER_PERSONAL_SUB_OPENID(3, "PERSONAL_SUB_OPENID"), | ||||
| ; | ; | ||||
| @@ -338,8 +338,17 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||||
| updSharingOrder.setReceivers(JSON.toJSONString(receivers)); | updSharingOrder.setReceivers(JSON.toJSONString(receivers)); | ||||
| wxProfitSharingOrderMapper.updateById(updSharingOrder); | 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(); | JSONObject jo = new JSONObject(); | ||||
| jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); | jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); | ||||
| jo.put("account",receiver.getReceiverAccount()); | jo.put("account",receiver.getReceiverAccount()); | ||||
| @@ -348,6 +357,7 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||||
| jo.put("description",receiver.getId()); | jo.put("description",receiver.getId()); | ||||
| receivers.add(jo); | receivers.add(jo); | ||||
| } | } | ||||
| try{ | try{ | ||||
| int delete = wxProfitSharingResultMapper.deleteBySharingOrderId(sharingOrder.getId(),sharingOrder.getTenantId()); | int delete = wxProfitSharingResultMapper.deleteBySharingOrderId(sharingOrder.getId(),sharingOrder.getTenantId()); | ||||
| final IdWorker idworker = IdWorker.get(); | final IdWorker idworker = IdWorker.get(); | ||||
| @@ -84,12 +84,13 @@ public class WxPayShareV3Service extends PayShareBaseAdapterService{ | |||||
| } | } | ||||
| WxProfitSharingReceiver receiver = null; | 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); | 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) { | // if (null == receiver) { | ||||
| // throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(),"该商户未设置分账账号."); | // throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_INVALID.getCode(),"该商户未设置分账账号."); | ||||
| // } | // } | ||||
| @@ -266,7 +266,7 @@ | |||||
| psre.receiver_type,psre.receiver_account,psre.receiver_comments,psre.sharing_type,psre.`status` | psre.receiver_type,psre.receiver_account,psre.receiver_comments,psre.sharing_type,psre.`status` | ||||
| from wx_profit_sharing_result psr | from wx_profit_sharing_result psr | ||||
| left join wx_profit_sharing_receiver psre on psr.sharing_receiver_id = psre.id | 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} | |||||
| <if test=" null != isPrivate "> | <if test=" null != isPrivate "> | ||||
| and psr.`is_private` = #{isPrivate} | and psr.`is_private` = #{isPrivate} | ||||