| @@ -76,13 +76,14 @@ public class WxPayOrder extends TenantEntity { | |||||
| public WxComposeChildOrderShare getChildOrderShare(Long wxOrderId) { | public WxComposeChildOrderShare getChildOrderShare(Long wxOrderId) { | ||||
| if (StringUtils.isBlank(this.childOrderShare)) { | if (StringUtils.isBlank(this.childOrderShare)) { | ||||
| return new WxComposeChildOrderShare(this.payAmount, this.shareAmount, this.rateAmount,null,null,null); | |||||
| return new WxComposeChildOrderShare(this.payAmount, this.shareAmount, this.rateAmount,null,null,null,null); | |||||
| } | } | ||||
| Map childs = JSON.parseObject(this.childOrderShare, Map.class); | Map childs = JSON.parseObject(this.childOrderShare, Map.class); | ||||
| JSONObject childOrderShare = (JSONObject) childs.get(String.valueOf(wxOrderId)); | JSONObject childOrderShare = (JSONObject) childs.get(String.valueOf(wxOrderId)); | ||||
| if (null != childOrderShare) { | if (null != childOrderShare) { | ||||
| return new WxComposeChildOrderShare(childOrderShare.getInteger("realPayMent"), childOrderShare.getInteger("shareAmount"), childOrderShare.getInteger("rateAmount"), | return new WxComposeChildOrderShare(childOrderShare.getInteger("realPayMent"), childOrderShare.getInteger("shareAmount"), childOrderShare.getInteger("rateAmount"), | ||||
| childOrderShare.getInteger("realRateAmount"), childOrderShare.getInteger("commissionAmount"), childOrderShare.getString("merchantUid")); | |||||
| childOrderShare.getInteger("realRateAmount"), childOrderShare.getInteger("commissionAmount"), | |||||
| childOrderShare.getLong("merchantId"),childOrderShare.getString("merchantUid")); | |||||
| } | } | ||||
| return null; | return null; | ||||
| } | } | ||||
| @@ -84,5 +84,8 @@ public interface WxCouponChannelService { | |||||
| ResultData updateOnline(WxCouponChannel wxCouponChannel); | ResultData updateOnline(WxCouponChannel wxCouponChannel); | ||||
| String getCouponOneMerchantUid(EnumPayWay payWay,Long couponChannelId, String tenantId); | |||||
| Long getCouponOneMerchantId(EnumPayWay payWay, Long couponChannelId, String tenantId); | |||||
| String getCouponOneMerchantUid(EnumPayWay payWay,Long merchantId, String tenantId); | |||||
| } | } | ||||
| @@ -829,7 +829,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public String getCouponOneMerchantUid(EnumPayWay payWay,Long couponChannelId, String tenantId) { | |||||
| public Long getCouponOneMerchantId(EnumPayWay payWay, Long couponChannelId, String tenantId) { | |||||
| WxCouponChannel couponChannel = wxCouponChannelMapper.selectById(couponChannelId, tenantId); | WxCouponChannel couponChannel = wxCouponChannelMapper.selectById(couponChannelId, tenantId); | ||||
| List<Long> merchantIds = wxCouponMerchantMapper.findMerchantIdListByProduct(couponChannel.getCouponId(), tenantId); | List<Long> merchantIds = wxCouponMerchantMapper.findMerchantIdListByProduct(couponChannel.getCouponId(), tenantId); | ||||
| Long merchantId = null; | Long merchantId = null; | ||||
| @@ -846,10 +846,15 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| merchantId = list.get(0); | merchantId = list.get(0); | ||||
| } | } | ||||
| } | } | ||||
| return merchantId; | |||||
| } | |||||
| @Override | |||||
| public String getCouponOneMerchantUid(EnumPayWay payWay,Long merchantId, String tenantId) { | |||||
| if(merchantId != null){ | if(merchantId != null){ | ||||
| WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver(); | WxProfitSharingReceiver psReceiverQ = new WxProfitSharingReceiver(); | ||||
| psReceiverQ.setTenantId(tenantId); | psReceiverQ.setTenantId(tenantId); | ||||
| psReceiverQ.setMerchantId(merchantIds.get(0)); | |||||
| psReceiverQ.setMerchantId(merchantId); | |||||
| psReceiverQ.setSharingType(payServiceFactory.getPayShareAdapterService(payWay.getCode()).getProfitSharingType()); | psReceiverQ.setSharingType(payServiceFactory.getPayShareAdapterService(payWay.getCode()).getProfitSharingType()); | ||||
| psReceiverQ.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | psReceiverQ.setStatus(EnumProfitSharingReceiverStatus.PROFIT_SHARING_RECEIVER_STATUS_VALID.getCode()); | ||||
| psReceiverQ.setPlat(payWay.getPlat().getCode()); | psReceiverQ.setPlat(payWay.getPlat().getCode()); | ||||
| @@ -452,9 +452,11 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| int rate_amount = 0; | int rate_amount = 0; | ||||
| //todo 注意购物车模式(需测试)每笔子订单算法可能与总订单算法有差 | //todo 注意购物车模式(需测试)每笔子订单算法可能与总订单算法有差 | ||||
| for (WxOrder o : orderList) { | for (WxOrder o : orderList) { | ||||
| Long merchant_id = null; | |||||
| String merchant_uid = ""; | String merchant_uid = ""; | ||||
| if(EnumPayMchType.DIRECT.equals(payMchType)){//直连模式记录收款商户 | if(EnumPayMchType.DIRECT.equals(payMchType)){//直连模式记录收款商户 | ||||
| merchant_uid = wxCouponChannelService.getCouponOneMerchantUid(payWay,o.getCouponChannelId(),o.getTenantId()); | |||||
| merchant_id = wxCouponChannelService.getCouponOneMerchantId(payWay,o.getCouponChannelId(),o.getTenantId()); | |||||
| merchant_uid = wxCouponChannelService.getCouponOneMerchantUid(payWay,merchant_id,o.getTenantId()); | |||||
| if(StringUtils.isBlank(merchant_uid)){ | if(StringUtils.isBlank(merchant_uid)){ | ||||
| throw new MallinkException(ErrorCode.PAY_ORDER_MERCHANT_UID_ERROR); | throw new MallinkException(ErrorCode.PAY_ORDER_MERCHANT_UID_ERROR); | ||||
| } | } | ||||
| @@ -465,7 +467,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| logger.info("佣金明细"+ JSON.toJSONString(oShareAmount)); | logger.info("佣金明细"+ JSON.toJSONString(oShareAmount)); | ||||
| share_amount += oShareAmount.getShareAmount(); | share_amount += oShareAmount.getShareAmount(); | ||||
| rate_amount += oShareAmount.getRateAmount(); | rate_amount += oShareAmount.getRateAmount(); | ||||
| childShares.put(String.valueOf(o.getId()), new WxComposeChildOrderShare(oShareAmount,merchant_uid)); | |||||
| childShares.put(String.valueOf(o.getId()), new WxComposeChildOrderShare(oShareAmount,merchant_id,merchant_uid)); | |||||
| } | } | ||||
| record.setShareAmount(share_amount); | record.setShareAmount(share_amount); | ||||
| record.setRateAmount(rate_amount); | record.setRateAmount(rate_amount); | ||||
| @@ -11,21 +11,24 @@ import lombok.Data; | |||||
| @Data | @Data | ||||
| public class WxComposeChildOrderShare { | public class WxComposeChildOrderShare { | ||||
| public WxComposeChildOrderShare(Integer realPayMent,Integer shareAmount,Integer rateAmount,Integer realRateAmount,Integer commissionAmount,String merchantUid) { | |||||
| public WxComposeChildOrderShare(Integer realPayMent,Integer shareAmount,Integer rateAmount,Integer realRateAmount,Integer commissionAmount, | |||||
| Long merchantId,String merchantUid) { | |||||
| this.realPayMent = realPayMent; | this.realPayMent = realPayMent; | ||||
| this.shareAmount = shareAmount; | this.shareAmount = shareAmount; | ||||
| this.rateAmount = rateAmount; | this.rateAmount = rateAmount; | ||||
| this.realRateAmount = realRateAmount; | this.realRateAmount = realRateAmount; | ||||
| this.commissionAmount = commissionAmount; | this.commissionAmount = commissionAmount; | ||||
| this.merchantId = merchantId; | |||||
| this.merchantUid = merchantUid; | this.merchantUid = merchantUid; | ||||
| } | } | ||||
| public WxComposeChildOrderShare(PayShareCalculateAmount shareCalculateAmount,String merchantUid) { | |||||
| public WxComposeChildOrderShare(PayShareCalculateAmount shareCalculateAmount,Long merchantId,String merchantUid) { | |||||
| this.realPayMent = shareCalculateAmount.getPayAmount(); | this.realPayMent = shareCalculateAmount.getPayAmount(); | ||||
| this.shareAmount = shareCalculateAmount.getShareAmount(); | this.shareAmount = shareCalculateAmount.getShareAmount(); | ||||
| this.rateAmount = shareCalculateAmount.getRateAmount(); | this.rateAmount = shareCalculateAmount.getRateAmount(); | ||||
| this.realRateAmount = shareCalculateAmount.getRealRateAmount(); | this.realRateAmount = shareCalculateAmount.getRealRateAmount(); | ||||
| this.commissionAmount = shareCalculateAmount.getCommissionAmount(); | this.commissionAmount = shareCalculateAmount.getCommissionAmount(); | ||||
| this.merchantId = merchantId; | |||||
| this.merchantUid = merchantUid; | this.merchantUid = merchantUid; | ||||
| } | } | ||||
| @@ -38,5 +41,6 @@ public class WxComposeChildOrderShare { | |||||
| private Integer realRateAmount;//平台手续费 | private Integer realRateAmount;//平台手续费 | ||||
| private Integer commissionAmount;//平台佣金 | private Integer commissionAmount;//平台佣金 | ||||
| private Long merchantId;//收款商户 | |||||
| private String merchantUid;//收款商户 | private String merchantUid;//收款商户 | ||||
| } | } | ||||