| @@ -219,13 +219,12 @@ public class CouponOrderExpiringSchedule { | |||||
| WxComposeChildOrderShare share = wxPayOrder.getChildOrderShare(co.getOrderId()); | WxComposeChildOrderShare share = wxPayOrder.getChildOrderShare(co.getOrderId()); | ||||
| if (share.getRateAmount() != null) { | if (share.getRateAmount() != null) { | ||||
| // 实际分账金额为 分账金额 + 通道费差 | // 实际分账金额为 分账金额 + 通道费差 | ||||
| wxSharingOrderDto.setShareAmount(share.getShareAmount()+share.getRateAmount()); | |||||
| wxSharingOrderDto.setMerchantShareAmount(share.getShareAmount()+share.getRateAmount()); | |||||
| } else { | } else { | ||||
| // 未设置通道费差 | // 未设置通道费差 | ||||
| wxSharingOrderDto.setShareAmount(share.getShareAmount()); | |||||
| wxSharingOrderDto.setMerchantShareAmount(share.getShareAmount()); | |||||
| } | } | ||||
| //wxSharingOrderDto.setShareAmount(wxPayOrder.getPayAmount()); | |||||
| wxProfitSharingOrderService.createSharingOrder(wxSharingOrderDto,wxPayOrder); | |||||
| wxProfitSharingOrderService.createSharingOrder(wxSharingOrderDto,wxPayOrder,co.getOrderId()); | |||||
| // wxProfitSharingOrderService.finishSharingOrder(wxPayOrder,wxSharingOrderDto,wxPayOrder.getPayVendor(),wxPayOrder.getShare()); | // wxProfitSharingOrderService.finishSharingOrder(wxPayOrder,wxSharingOrderDto,wxPayOrder.getPayVendor(),wxPayOrder.getShare()); | ||||
| } | } | ||||
| @@ -24,10 +24,10 @@ public class WxSharingOrderDto extends TenantEntity { | |||||
| private Long payMerchantId; | private Long payMerchantId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="支付时收款商户号",name="payMerchantMchId") | @io.swagger.annotations.ApiModelProperty(value="支付时收款商户号",name="payMerchantMchId") | ||||
| private String payMerchantMchId; | private String payMerchantMchId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="分账金额(总金额扣除手续费后的金额,系统扣点)",name="shareAmount") | |||||
| private Integer shareAmount; | |||||
| @io.swagger.annotations.ApiModelProperty(value="分账通道费差()",name="rateAmount") | |||||
| private Integer rateAmount; | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户分账金额",name="merchantShareAmount") | |||||
| private Integer merchantShareAmount; | |||||
| @io.swagger.annotations.ApiModelProperty(value="商场实际通道费",name="mallRealRateAmount") | |||||
| private Integer mallRealRateAmount; | |||||
| private Integer realRateAmount;//平台手续费(微信,抖音) | private Integer realRateAmount;//平台手续费(微信,抖音) | ||||
| private Integer commissionAmount;//平台佣金(微信,抖音) | private Integer commissionAmount;//平台佣金(微信,抖音) | ||||
| @@ -21,7 +21,7 @@ public interface WxProfitSharingOrderService { | |||||
| /** | /** | ||||
| * 创建分账订单 | * 创建分账订单 | ||||
| */ | */ | ||||
| ResultData createSharingOrder(WxSharingOrderDto wxSharingOrderDto,WxPayOrder payOrder); | |||||
| ResultData createSharingOrder(WxSharingOrderDto wxSharingOrderDto,WxPayOrder payOrder,Long orderId); | |||||
| /** | /** | ||||
| * 分账重试 | * 分账重试 | ||||
| @@ -1755,8 +1755,8 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| wxSharingOrderDto.setType(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode()); | wxSharingOrderDto.setType(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode()); | ||||
| } | } | ||||
| wxSharingOrderDto.setPayAmount(wxPayOrder.getPayAmount()); | wxSharingOrderDto.setPayAmount(wxPayOrder.getPayAmount()); | ||||
| wxSharingOrderDto.setShareAmount(childShare.getShareAmount()); | |||||
| wxSharingOrderDto.setRateAmount(childShare.getRateAmount()); | |||||
| wxSharingOrderDto.setMerchantShareAmount(childShare.getShareAmount()); | |||||
| wxSharingOrderDto.setMallRealRateAmount(childShare.getRateAmount()); | |||||
| wxSharingOrderDto.setRealRateAmount(childShare.getRealRateAmount()); | wxSharingOrderDto.setRealRateAmount(childShare.getRealRateAmount()); | ||||
| wxSharingOrderDto.setCommissionAmount(childShare.getCommissionAmount()); | wxSharingOrderDto.setCommissionAmount(childShare.getCommissionAmount()); | ||||
| wxSharingOrderDto.setSystemAmount(childShare.getSystemAmount()); | wxSharingOrderDto.setSystemAmount(childShare.getSystemAmount()); | ||||
| @@ -1765,7 +1765,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| wxSharingOrderDto.setPayTimeEnd(wxPayOrder.getPayTimeEnd()); | wxSharingOrderDto.setPayTimeEnd(wxPayOrder.getPayTimeEnd()); | ||||
| wxSharingOrderDto.updateTenantInfo(wxPayOrder); | wxSharingOrderDto.updateTenantInfo(wxPayOrder); | ||||
| wxSharingOrderDto.setTransactionId(wxPayOrder.getTransactionId()); | wxSharingOrderDto.setTransactionId(wxPayOrder.getTransactionId()); | ||||
| wxProfitSharingOrderService.createSharingOrder(wxSharingOrderDto,wxPayOrder); | |||||
| wxProfitSharingOrderService.createSharingOrder(wxSharingOrderDto,wxPayOrder,order.getId()); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("微信分账: " + e.getMessage()); | logger.error("微信分账: " + e.getMessage()); | ||||
| } | } | ||||
| @@ -2589,8 +2589,8 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| sharingOrder.setType(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode()); | sharingOrder.setType(EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode()); | ||||
| sharingOrder.setPayAmount(wxPayOrder.getPayAmount()); | sharingOrder.setPayAmount(wxPayOrder.getPayAmount()); | ||||
| WxComposeChildOrderShare share = wxPayOrder.getChildOrderShare(orderId); | WxComposeChildOrderShare share = wxPayOrder.getChildOrderShare(orderId); | ||||
| sharingOrder.setShareAmount(share.getShareAmount()); | |||||
| sharingOrder.setRateAmount(share.getRateAmount()); | |||||
| sharingOrder.setMerchantShareAmount(share.getShareAmount()); | |||||
| sharingOrder.setMallRealRateAmount(share.getRateAmount()); | |||||
| sharingOrder.setRealRateAmount(share.getRealRateAmount()); | sharingOrder.setRealRateAmount(share.getRealRateAmount()); | ||||
| sharingOrder.setCommissionAmount(share.getCommissionAmount()); | sharingOrder.setCommissionAmount(share.getCommissionAmount()); | ||||
| sharingOrder.setOrderId(wxPayOrder.getId()); | sharingOrder.setOrderId(wxPayOrder.getId()); | ||||
| @@ -2598,7 +2598,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| sharingOrder.setPayTimeEnd(wxPayOrder.getPayTimeEnd()); | sharingOrder.setPayTimeEnd(wxPayOrder.getPayTimeEnd()); | ||||
| sharingOrder.updateTenantInfo(wxPayOrder); | sharingOrder.updateTenantInfo(wxPayOrder); | ||||
| sharingOrder.setTransactionId(wxPayOrder.getTransactionId()); | sharingOrder.setTransactionId(wxPayOrder.getTransactionId()); | ||||
| wxProfitSharingOrderService.createSharingOrder(sharingOrder,wxPayOrder); | |||||
| wxProfitSharingOrderService.createSharingOrder(sharingOrder,wxPayOrder,orderId); | |||||
| } else { | } else { | ||||
| @@ -24,6 +24,7 @@ import com.iformall.pay.*; | |||||
| import com.iformall.service.ExcelService; | import com.iformall.service.ExcelService; | ||||
| import com.iformall.service.WxAppinfoService; | import com.iformall.service.WxAppinfoService; | ||||
| import com.iformall.service.WxProfitSharingOrderService; | import com.iformall.service.WxProfitSharingOrderService; | ||||
| import com.iformall.service.order.entity.WxComposeChildOrderShare; | |||||
| import com.iformall.service.pay.PayServiceFactory; | import com.iformall.service.pay.PayServiceFactory; | ||||
| import com.iformall.service.pay.service.share.PayShareAdapterService; | import com.iformall.service.pay.service.share.PayShareAdapterService; | ||||
| import com.iformall.service.pay.service.share.entity.PayShareCalculateAmount; | import com.iformall.service.pay.service.share.entity.PayShareCalculateAmount; | ||||
| @@ -139,14 +140,12 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||||
| @Override | @Override | ||||
| @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | ||||
| public ResultData redoSharingOrder(WxProfitSharingOrder sharingOrder,WxPayOrder payOrder) { | |||||
| public ResultData redoSharingOrder(WxProfitSharingOrder sharingOrder,WxPayOrder wxPayOrder) { | |||||
| if(!EnumProfitSharingOrderStatus.shareStatus().contains(sharingOrder.getSharingStatus())){ | if(!EnumProfitSharingOrderStatus.shareStatus().contains(sharingOrder.getSharingStatus())){ | ||||
| return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(),"分账状态不允许"); | return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(),"分账状态不允许"); | ||||
| } | } | ||||
| WxPayOrder wxPayOrder = wxPayOrderMapper.selectById(sharingOrder.getOrderId(),sharingOrder.getTenantId()); | |||||
| if (wxPayOrder == null) { | if (wxPayOrder == null) { | ||||
| throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND.getCode(),"wxProfitSharingOrder["+sharingOrder.getId()+"] 没有payOrder信息."); | throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND.getCode(),"wxProfitSharingOrder["+sharingOrder.getId()+"] 没有payOrder信息."); | ||||
| } | } | ||||
| @@ -166,29 +165,21 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||||
| jsonArray = JSONArray.parseArray(sharingOrder.getReceivers()); | jsonArray = JSONArray.parseArray(sharingOrder.getReceivers()); | ||||
| recordJsonArray = JSONArray.parseArray(sharingOrder.getReceivers()); | recordJsonArray = JSONArray.parseArray(sharingOrder.getReceivers()); | ||||
| } | } | ||||
| //TODO 我们的提成,绑定的销售提点,商场的提成要根据商户配置的提成点数来计算分账金额,wxPayOrder里面的金额是按照商场的统一比例算的,不对 | |||||
| // int rate = payShareAdapterService.getOfficialCommission(o,payAccount);//抖音分佣率 | |||||
| // PayShareCalculateAmount oShareAmount = payShareAdapterService.calculateAmount(o.getPayment(),rate, payAccount); | |||||
| // | |||||
| // | |||||
| // | |||||
| // | |||||
| // //直连模式 | |||||
| // if (EnumPayMchType.DIRECT.getCode() == payOrder.getMchType()) { | |||||
| // //当前商户的收款账号,为了加上收款记录 | |||||
| // WxProfitSharingReceiver receiver = payShareAdapterService.getReceiver(sharingOrder, sharingOrder.getMerchantId(), payOrder.getTtPayWay(), payOrder.getMchType()); | |||||
| // if (null == receiver) { | |||||
| // return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(),"当前商户未配置收款账号"); | |||||
| // } | |||||
| // StringBuffer sb = new StringBuffer("{").append("\"description\":").append(receiver.getId()).append(",\"amount\":").append(0).append("}"); | |||||
| // if (null == recordJsonArray) { | |||||
| // recordJsonArray = JSONArray.parseArray("["+sb.toString()+"]"); | |||||
| // }else { | |||||
| // recordJsonArray.add(JSON.parseObject(sb.toString())); | |||||
| // } | |||||
| // } | |||||
| //直连模式 | |||||
| if (EnumPayMchType.DIRECT.getCode() == wxPayOrder.getMchType()) { | |||||
| //当前商户的收款账号,为了加上收款记录 | |||||
| WxProfitSharingReceiver receiver = payShareAdapterService.getReceiver(sharingOrder, sharingOrder.getMerchantId(), wxPayOrder.getTtPayWay(), wxPayOrder.getMchType()); | |||||
| if (null == receiver) { | |||||
| return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(),"当前商户未配置收款账号"); | |||||
| } | |||||
| StringBuffer sb = new StringBuffer("{").append("\"description\":").append(receiver.getId()).append(",\"amount\":").append(0).append("}"); | |||||
| if (null == recordJsonArray) { | |||||
| recordJsonArray = JSONArray.parseArray("["+sb.toString()+"]"); | |||||
| }else { | |||||
| recordJsonArray.add(JSON.parseObject(sb.toString())); | |||||
| } | |||||
| } | |||||
| List<WxProfitSharingResult> resultList = new ArrayList<WxProfitSharingResult>(); | List<WxProfitSharingResult> resultList = new ArrayList<WxProfitSharingResult>(); | ||||
| if(jsonArray == null || jsonArray.isEmpty()){ | if(jsonArray == null || jsonArray.isEmpty()){ | ||||
| @@ -250,17 +241,19 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ | |||||
| @Override | @Override | ||||
| // @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | // @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | ||||
| public ResultData createSharingOrder(WxSharingOrderDto sharingOrderDto,WxPayOrder payOrder) { | |||||
| public ResultData createSharingOrder(WxSharingOrderDto sharingOrderDto,WxPayOrder payOrder,Long orderId) { | |||||
| PayShareAdapterService payShareAdapterService = payServiceFactory.getPayShareAdapterService(payOrder.getPayVendor(),payOrder.getPayVersion()); | PayShareAdapterService payShareAdapterService = payServiceFactory.getPayShareAdapterService(payOrder.getPayVendor(),payOrder.getPayVersion()); | ||||
| WxProfitSharingOrder record = payShareAdapterService.createSharingOrder(sharingOrderDto,payOrder.getMchType(),payOrder.getShare()); | |||||
| WxProfitSharingOrder record = payShareAdapterService.createSharingOrder(sharingOrderDto,payOrder); | |||||
| //抖音模式涉及到佣金,无法实时分账 | //抖音模式涉及到佣金,无法实时分账 | ||||
| if(EnumPayWay.PAY_WAY_TT.getCode().equals(payOrder.getPayVendor())){ | if(EnumPayWay.PAY_WAY_TT.getCode().equals(payOrder.getPayVendor())){ | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| //分账账号:系统扣点账号,销售提成账号,商场扣点账号 | |||||
| WxComposeChildOrderShare share = payOrder.getChildOrderShare(orderId); | |||||
| ResultData resultData = redoSharingOrder(record,payOrder); | ResultData resultData = redoSharingOrder(record,payOrder); | ||||
| return resultData; | return resultData; | ||||
| } | } | ||||
| @@ -17,8 +17,12 @@ public class WxComposeChildOrderShare { | |||||
| this.shareAmount = shareAmount; | this.shareAmount = shareAmount; | ||||
| this.rateAmount = rateAmount; | this.rateAmount = rateAmount; | ||||
| this.realRateAmount = realRateAmount; | this.realRateAmount = realRateAmount; | ||||
| this.commissionAmount = commissionAmount; | |||||
| this.systemAmount = systemAmount; | |||||
| if (null != commissionAmount) { | |||||
| this.commissionAmount = commissionAmount; | |||||
| } | |||||
| if (null != systemAmount) { | |||||
| this.systemAmount = systemAmount; | |||||
| } | |||||
| this.merchantId = merchantId; | this.merchantId = merchantId; | ||||
| this.merchantUid = merchantUid; | this.merchantUid = merchantUid; | ||||
| this.orderId = orderId; | this.orderId = orderId; | ||||
| @@ -29,8 +33,12 @@ public class WxComposeChildOrderShare { | |||||
| this.shareAmount = shareCalculateAmount.getMerchantShareAmount(); | this.shareAmount = shareCalculateAmount.getMerchantShareAmount(); | ||||
| this.rateAmount = shareCalculateAmount.getMallRealRateAmount(); | this.rateAmount = shareCalculateAmount.getMallRealRateAmount(); | ||||
| this.realRateAmount = shareCalculateAmount.getRealRateAmount(); | this.realRateAmount = shareCalculateAmount.getRealRateAmount(); | ||||
| this.commissionAmount = shareCalculateAmount.getCommissionAmount(); | |||||
| this.systemAmount = shareCalculateAmount.getSystemAmount(); | |||||
| if (null != shareCalculateAmount.getCommissionAmount()) { | |||||
| this.commissionAmount = shareCalculateAmount.getCommissionAmount(); | |||||
| } | |||||
| if (null != shareCalculateAmount.getSystemAmount()) { | |||||
| this.systemAmount = shareCalculateAmount.getSystemAmount(); | |||||
| } | |||||
| this.merchantId = merchantId; | this.merchantId = merchantId; | ||||
| this.merchantUid = merchantUid; | this.merchantUid = merchantUid; | ||||
| this.orderId = orderId; | this.orderId = orderId; | ||||
| @@ -44,9 +52,9 @@ public class WxComposeChildOrderShare { | |||||
| private Integer rateAmount;//商场实际通道费(扣除了支付通道费的) | private Integer rateAmount;//商场实际通道费(扣除了支付通道费的) | ||||
| private Integer realRateAmount;//平台手续费(微信,抖音) | private Integer realRateAmount;//平台手续费(微信,抖音) | ||||
| private Integer commissionAmount;//平台佣金(微信,抖音) | |||||
| private Integer commissionAmount = 0;//平台佣金(微信,抖音) | |||||
| private Integer systemAmount;//系统扣点费 | |||||
| private Integer systemAmount = 0;//系统扣点费 | |||||
| private Long merchantId;//收款商户 | private Long merchantId;//收款商户 | ||||
| private String merchantUid;//收款商户 | private String merchantUid;//收款商户 | ||||
| @@ -59,7 +59,7 @@ public interface PayShareAdapterService { | |||||
| * @param share | * @param share | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxProfitSharingOrder createSharingOrder(WxSharingOrderDto sharingOrderDto, Integer mchType,Integer share); | |||||
| WxProfitSharingOrder createSharingOrder(WxSharingOrderDto sharingOrderDto, WxPayOrder payOrder); | |||||
| /** | /** | ||||
| * 无分账接收方分账 ,钱直接分给小程序方 调用API分账 | * 无分账接收方分账 ,钱直接分给小程序方 调用API分账 | ||||
| @@ -61,15 +61,15 @@ public abstract class PayShareBaseAdapterService implements PayShareAdapterServi | |||||
| psReceiverList.stream().forEach(r-> | psReceiverList.stream().forEach(r-> | ||||
| { | { | ||||
| if (r.getParameter() == null){ | if (r.getParameter() == null){ | ||||
| r.setSharingAmount(sharingOrderDto.getShareAmount()); | |||||
| r.setRateAmount(sharingOrderDto.getRateAmount()); | |||||
| r.setSharingAmount(sharingOrderDto.getMerchantShareAmount()); | |||||
| r.setRateAmount(sharingOrderDto.getMallRealRateAmount()); | |||||
| r.setRealRateAmount(sharingOrderDto.getRealRateAmount()); | r.setRealRateAmount(sharingOrderDto.getRealRateAmount()); | ||||
| r.setCommissionAmount(sharingOrderDto.getCommissionAmount()); | r.setCommissionAmount(sharingOrderDto.getCommissionAmount()); | ||||
| } else { | } else { | ||||
| r.setSharingAmount(sharingOrderDto.getShareAmount()*Integer.valueOf(r.getParameter())/10000); | |||||
| r.setSharingAmount(sharingOrderDto.getMerchantShareAmount()*Integer.valueOf(r.getParameter())/10000); | |||||
| } | } | ||||
| }); | }); | ||||
| if (psReceiverList.stream().mapToInt(r->r.getSharingAmount()).sum() > sharingOrderDto.getShareAmount()){ | |||||
| if (psReceiverList.stream().mapToInt(r->r.getSharingAmount()).sum() > sharingOrderDto.getMerchantShareAmount()){ | |||||
| throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_UNKNOWN); | throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_UNKNOWN); | ||||
| } | } | ||||
| @@ -108,15 +108,15 @@ public abstract class PayShareBaseAdapterService implements PayShareAdapterServi | |||||
| psReceiverList.stream().forEach(r-> | psReceiverList.stream().forEach(r-> | ||||
| { | { | ||||
| if (r.getParameter() == null){ | if (r.getParameter() == null){ | ||||
| r.setSharingAmount(sharingOrderDto.getShareAmount()); | |||||
| r.setRateAmount(sharingOrderDto.getRateAmount()); | |||||
| r.setSharingAmount(sharingOrderDto.getMerchantShareAmount()); | |||||
| r.setRateAmount(sharingOrderDto.getMallRealRateAmount()); | |||||
| r.setRealRateAmount(sharingOrderDto.getRealRateAmount()); | r.setRealRateAmount(sharingOrderDto.getRealRateAmount()); | ||||
| r.setCommissionAmount(sharingOrderDto.getCommissionAmount()); | r.setCommissionAmount(sharingOrderDto.getCommissionAmount()); | ||||
| } else { | } else { | ||||
| r.setSharingAmount(sharingOrderDto.getShareAmount()*Integer.valueOf(r.getParameter())/10000); | |||||
| r.setSharingAmount(sharingOrderDto.getMerchantShareAmount()*Integer.valueOf(r.getParameter())/10000); | |||||
| } | } | ||||
| }); | }); | ||||
| if (psReceiverList.stream().mapToInt(r->r.getSharingAmount()).sum() > sharingOrderDto.getShareAmount()){ | |||||
| if (psReceiverList.stream().mapToInt(r->r.getSharingAmount()).sum() > sharingOrderDto.getMerchantShareAmount()){ | |||||
| throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_UNKNOWN); | throw new MallinkException(ErrorCode.PROFIT_SHARING_RECEIVER_UNKNOWN); | ||||
| } | } | ||||
| @@ -362,12 +362,7 @@ public class TtPayShareService extends PayShareBaseAdapterService{ | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxProfitSharingOrder createSharingOrder(WxSharingOrderDto sharingOrderDto, Integer mchType,Integer share) { | |||||
| // if(!EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE.getCode().equals(sharingOrderDto.getType()) | |||||
| // && !EnumProfitSharingOrderType.PROFIT_SHARING_SINGLE_FINISH.getCode().equals(sharingOrderDto.getType())){ | |||||
| // throw new MallinkException(ErrorCode.SYS_PARAMETER_TYPE_ERROR.getCode(),"抖音暂不支持多次分账"); | |||||
| // } | |||||
| public WxProfitSharingOrder createSharingOrder(WxSharingOrderDto sharingOrderDto, WxPayOrder payOrder) { | |||||
| WxProfitSharingOrder record = new WxProfitSharingOrder(); | WxProfitSharingOrder record = new WxProfitSharingOrder(); | ||||
| record.updateTenantInfo(sharingOrderDto); | record.updateTenantInfo(sharingOrderDto); | ||||
| record.setOrderId(sharingOrderDto.getOrderId()); | record.setOrderId(sharingOrderDto.getOrderId()); | ||||
| @@ -156,11 +156,11 @@ public class WxPayShareSFTService extends PayShareBaseAdapterService{ | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxProfitSharingOrder createSharingOrder(WxSharingOrderDto sharingOrderDto, Integer mchType,Integer share) { | |||||
| if(EnumPayMchType.DIRECT.getCode().equals(mchType)){ | |||||
| public WxProfitSharingOrder createSharingOrder(WxSharingOrderDto sharingOrderDto, WxPayOrder payOrder) { | |||||
| if(EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType())){ | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_TYPE_ERROR.getCode(),"微信直连模式待开发"); | throw new MallinkException(ErrorCode.SYS_PARAMETER_TYPE_ERROR.getCode(),"微信直连模式待开发"); | ||||
| } | } | ||||
| if(EnumYesOrNo.NO.getCode().equals(share)){ | |||||
| if(EnumYesOrNo.NO.getCode().equals(payOrder.getShare())){ | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_TYPE_ERROR.getCode(),"微信不分账"); | throw new MallinkException(ErrorCode.SYS_PARAMETER_TYPE_ERROR.getCode(),"微信不分账"); | ||||
| } | } | ||||
| @@ -345,11 +345,11 @@ public class WxPayShareService extends PayShareBaseAdapterService{ | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxProfitSharingOrder createSharingOrder(WxSharingOrderDto sharingOrderDto, Integer mchType,Integer share) { | |||||
| if(EnumPayMchType.DIRECT.getCode().equals(mchType)){ | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_TYPE_ERROR.getCode(),"微信直连模式待开发"); | |||||
| public WxProfitSharingOrder createSharingOrder(WxSharingOrderDto sharingOrderDto,WxPayOrder payOrder) { | |||||
| if(EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType())){ | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_TYPE_ERROR.getCode(),"微信支付2.0直连模式待开发"); | |||||
| } | } | ||||
| if(EnumYesOrNo.NO.getCode().equals(share)){ | |||||
| if(EnumYesOrNo.NO.getCode().equals(payOrder.getShare())){ | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_TYPE_ERROR.getCode(),"微信未开启分账"); | throw new MallinkException(ErrorCode.SYS_PARAMETER_TYPE_ERROR.getCode(),"微信未开启分账"); | ||||
| } | } | ||||
| //是否已创建分账订单 | //是否已创建分账订单 | ||||
| @@ -379,7 +379,7 @@ public class WxPayShareService extends PayShareBaseAdapterService{ | |||||
| wxProfitSharingOrderMapper.insert(record); | wxProfitSharingOrderMapper.insert(record); | ||||
| } | } | ||||
| WxProfitSharingReceiver psReceiver = getReceiver(sharingOrderDto, sharingOrderDto.getMerchantId(), null,mchType); | |||||
| WxProfitSharingReceiver psReceiver = getReceiver(sharingOrderDto, sharingOrderDto.getMerchantId(), null,payOrder.getMchType()); | |||||
| if (null != psReceiver) { | if (null != psReceiver) { | ||||
| List<WxProfitSharingReceiver> psReceiverList = new ArrayList<WxProfitSharingReceiver>(); | List<WxProfitSharingReceiver> psReceiverList = new ArrayList<WxProfitSharingReceiver>(); | ||||
| psReceiverList.add(psReceiver); | psReceiverList.add(psReceiver); | ||||
| @@ -77,8 +77,8 @@ public class WxPayShareV3Service extends PayShareBaseAdapterService{ | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxProfitSharingOrder createSharingOrder(WxSharingOrderDto sharingOrderDto, Integer mchType,Integer share) { | |||||
| if(EnumYesOrNo.NO.getCode().equals(share)){ | |||||
| public WxProfitSharingOrder createSharingOrder(WxSharingOrderDto sharingOrderDto, WxPayOrder payOrder) { | |||||
| if(EnumYesOrNo.NO.getCode().equals(payOrder.getShare())){ | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_TYPE_ERROR.getCode(),"微信分账未开启"); | throw new MallinkException(ErrorCode.SYS_PARAMETER_TYPE_ERROR.getCode(),"微信分账未开启"); | ||||
| } | } | ||||
| //是否已创建分账订单 | //是否已创建分账订单 | ||||
| @@ -98,7 +98,7 @@ public class WxPayShareV3Service extends PayShareBaseAdapterService{ | |||||
| record.setPayAmount(sharingOrderDto.getPayAmount()); | record.setPayAmount(sharingOrderDto.getPayAmount()); | ||||
| record.setMerchantId(sharingOrderDto.getMerchantId()); | record.setMerchantId(sharingOrderDto.getMerchantId()); | ||||
| //直连模式, | //直连模式, | ||||
| if (mchType == EnumPayMchType.DIRECT.getCode()) { | |||||
| if (payOrder.getMchType() == EnumPayMchType.DIRECT.getCode()) { | |||||
| if (null == sharingOrderDto.getPayMerchantId()) { | if (null == sharingOrderDto.getPayMerchantId()) { | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"直连模式当前订单的收款商户查询为空"); | throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"直连模式当前订单的收款商户查询为空"); | ||||
| } | } | ||||
| @@ -116,18 +116,18 @@ public class WxPayShareV3Service extends PayShareBaseAdapterService{ | |||||
| record.setType(sharingOrderDto.getType()); | record.setType(sharingOrderDto.getType()); | ||||
| wxProfitSharingOrderMapper.insert(record); | wxProfitSharingOrderMapper.insert(record); | ||||
| } | } | ||||
| //分账需要加上 我们的提成,绑定的销售提点,商场的提成要根据商户配置的提成点数来计算分账金额,wxPayOrder里面的金额是按照商场的统一比例算的,不对 | |||||
| //如果是总分模式,则需要加上收款账户 | |||||
| if (mchType == EnumPayMchType.TOTAL.getCode()) { | |||||
| WxProfitSharingReceiver psReceiver = getReceiver(sharingOrderDto, sharingOrderDto.getMerchantId(), null,mchType); | |||||
| //总分模式 | |||||
| if (payOrder.getMchType() == EnumPayMchType.TOTAL.getCode()) { | |||||
| WxProfitSharingReceiver psReceiver = getReceiver(sharingOrderDto, sharingOrderDto.getMerchantId(), null,payOrder.getMchType()); | |||||
| if (null != psReceiver) { | if (null != psReceiver) { | ||||
| List<WxProfitSharingReceiver> psReceiverList = new ArrayList<WxProfitSharingReceiver>(); | List<WxProfitSharingReceiver> psReceiverList = new ArrayList<WxProfitSharingReceiver>(); | ||||
| psReceiverList.add(psReceiver); | psReceiverList.add(psReceiver); | ||||
| record.setReceivers(calV3ReceiversAmount(sharingOrderDto, psReceiverList)); | record.setReceivers(calV3ReceiversAmount(sharingOrderDto, psReceiverList)); | ||||
| wxProfitSharingOrderMapper.updateById(record); | wxProfitSharingOrderMapper.updateById(record); | ||||
| } | } | ||||
| //直连的方式,暂时不支持分账 | |||||
| }else if (mchType == EnumPayMchType.DIRECT.getCode()) { | |||||
| //直连的方式 | |||||
| }else if (payOrder.getMchType() == EnumPayMchType.DIRECT.getCode()) { | |||||
| } | } | ||||
| return record; | return record; | ||||