|
|
@@ -21,13 +21,11 @@ import com.iformall.enums.*; |
|
|
import com.iformall.exception.MallinkException; |
|
|
import com.iformall.exception.MallinkException; |
|
|
import com.iformall.mapper.*; |
|
|
import com.iformall.mapper.*; |
|
|
import com.iformall.pay.*; |
|
|
import com.iformall.pay.*; |
|
|
import com.iformall.service.ExcelService; |
|
|
|
|
|
import com.iformall.service.WxAppinfoService; |
|
|
|
|
|
import com.iformall.service.WxMerchantService; |
|
|
|
|
|
import com.iformall.service.WxProfitSharingOrderService; |
|
|
|
|
|
|
|
|
import com.iformall.service.*; |
|
|
import com.iformall.service.order.entity.WxComposeChildOrderShare; |
|
|
import com.iformall.service.order.entity.WxComposeChildOrderShare; |
|
|
import com.iformall.service.order.util.OrderHelper; |
|
|
import com.iformall.service.order.util.OrderHelper; |
|
|
import com.iformall.service.pay.PayServiceFactory; |
|
|
import com.iformall.service.pay.PayServiceFactory; |
|
|
|
|
|
import com.iformall.service.pay.service.pay.douyin.v1.miniApp.EnumTtPayChannel; |
|
|
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; |
|
|
import com.iformall.service.pay.service.share.entity.PayShareQueryResult; |
|
|
import com.iformall.service.pay.service.share.entity.PayShareQueryResult; |
|
|
@@ -45,6 +43,7 @@ import org.apache.commons.lang3.StringUtils; |
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.LoggerFactory; |
|
|
import org.slf4j.LoggerFactory; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
import org.springframework.context.annotation.Lazy; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Isolation; |
|
|
import org.springframework.transaction.annotation.Isolation; |
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
@@ -106,6 +105,10 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ |
|
|
@Autowired |
|
|
@Autowired |
|
|
ExcelService excelService; |
|
|
ExcelService excelService; |
|
|
|
|
|
|
|
|
|
|
|
@Lazy |
|
|
|
|
|
@Autowired |
|
|
|
|
|
WxCouponOrderService wxCouponOrderService; |
|
|
|
|
|
|
|
|
final JSONObject errorMap = JSON.parseObject("{" + |
|
|
final JSONObject errorMap = JSON.parseObject("{" + |
|
|
"\"SYSTEMERROR\":{\"detail\":\"接口返回错误\",\"reason\":\"系统超时\",\"resolution\":\"系统异常,请用相同参数重新调用\"}," + |
|
|
"\"SYSTEMERROR\":{\"detail\":\"接口返回错误\",\"reason\":\"系统超时\",\"resolution\":\"系统异常,请用相同参数重新调用\"}," + |
|
|
"\"AMOUNT_OVERDUE\":{\"detail\":\"分账金额超限\",\"reason\":\"分账金额大于可分金额 或大于分账最大比例 \",\"resolution\":\"请调整分账金额\"}," + |
|
|
"\"AMOUNT_OVERDUE\":{\"detail\":\"分账金额超限\",\"reason\":\"分账金额大于可分金额 或大于分账最大比例 \",\"resolution\":\"请调整分账金额\"}," + |
|
|
@@ -185,21 +188,10 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ |
|
|
return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(),"分账状态不允许"); |
|
|
return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(),"分账状态不允许"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WxMerchant merchant = wxMerchantService.getById(sharingOrder.getMerchantId()); |
|
|
WxMerchant merchant = wxMerchantService.getById(sharingOrder.getMerchantId()); |
|
|
|
|
|
|
|
|
Date currentDate = new Date(); |
|
|
Date currentDate = new Date(); |
|
|
if(EnumPayWay.PAY_WAY_WECHAT.getCode().equals(payOrder.getPayVendor()) |
|
|
|
|
|
&& DateUtils.daysBetween(payOrder.getCreateTime(),currentDate) > 30){ |
|
|
|
|
|
WxProfitSharingOrder updSharingOrder = new WxProfitSharingOrder(); |
|
|
|
|
|
updSharingOrder.updateTenantInfo(sharingOrder); |
|
|
|
|
|
updSharingOrder.setId(sharingOrder.getId()); |
|
|
|
|
|
updSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_FAILED.getCode()); |
|
|
|
|
|
updSharingOrder.setErrorMsg("微信支付超30天无法分账"); |
|
|
|
|
|
updSharingOrder.setUpdateTime(currentDate); |
|
|
|
|
|
wxProfitSharingOrderMapper.updateById(updSharingOrder); |
|
|
|
|
|
|
|
|
|
|
|
return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(),"微信支付超30天无法分账"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
PayShareAdapterService payShareAdapterService = payServiceFactory.getPayShareAdapterService(payOrder.getPayVendor(),payOrder.getPayVersion()); |
|
|
PayShareAdapterService payShareAdapterService = payServiceFactory.getPayShareAdapterService(payOrder.getPayVendor(),payOrder.getPayVersion()); |
|
|
|
|
|
|
|
|
@@ -207,7 +199,6 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ |
|
|
|
|
|
|
|
|
//获取达人佣金 |
|
|
//获取达人佣金 |
|
|
int cpsCommission = payShareAdapterService.getCPSCommission(sharingOrder,sharingOrder.getSingleOrderId()); |
|
|
int cpsCommission = payShareAdapterService.getCPSCommission(sharingOrder,sharingOrder.getSingleOrderId()); |
|
|
|
|
|
|
|
|
if(cpsCommission < 0){ |
|
|
if(cpsCommission < 0){ |
|
|
WxProfitSharingOrder updSharingOrder = new WxProfitSharingOrder(); |
|
|
WxProfitSharingOrder updSharingOrder = new WxProfitSharingOrder(); |
|
|
updSharingOrder.updateTenantInfo(sharingOrder); |
|
|
updSharingOrder.updateTenantInfo(sharingOrder); |
|
|
@@ -216,8 +207,9 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ |
|
|
updSharingOrder.setErrorMsg("未获取到达人佣金"); |
|
|
updSharingOrder.setErrorMsg("未获取到达人佣金"); |
|
|
updSharingOrder.setUpdateTime(currentDate); |
|
|
updSharingOrder.setUpdateTime(currentDate); |
|
|
wxProfitSharingOrderMapper.updateById(updSharingOrder); |
|
|
wxProfitSharingOrderMapper.updateById(updSharingOrder); |
|
|
return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(),"未获取到达人佣金"); |
|
|
|
|
|
|
|
|
return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(),"未获取到达人佣金");//等待重试 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
JSONArray receivers = new JSONArray();//分账参数json |
|
|
JSONArray receivers = new JSONArray();//分账参数json |
|
|
EnumPayWay enumPayWay = EnumPayWay.getEnum(payOrder.getPayVendor()); |
|
|
EnumPayWay enumPayWay = EnumPayWay.getEnum(payOrder.getPayVendor()); |
|
|
EnumAppPlat enumPlat = enumPayWay.getPlat(); |
|
|
EnumAppPlat enumPlat = enumPayWay.getPlat(); |
|
|
@@ -232,15 +224,21 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ |
|
|
wxComposeChildOrderShare = payOrder.getSingleChildOrderShare(); |
|
|
wxComposeChildOrderShare = payOrder.getSingleChildOrderShare(); |
|
|
} |
|
|
} |
|
|
wxComposeChildOrderShare.setCpsCommission(cpsCommission); |
|
|
wxComposeChildOrderShare.setCpsCommission(cpsCommission); |
|
|
|
|
|
|
|
|
//官方手续费千6 |
|
|
//官方手续费千6 |
|
|
int realRateAmount = PayUtils.getPayRate(wxComposeChildOrderShare.getRealPayMent(), payAccount.getRealRate(), true); |
|
|
int realRateAmount = PayUtils.getPayRate(wxComposeChildOrderShare.getRealPayMent(), payAccount.getRealRate(), true); |
|
|
wxComposeChildOrderShare.setRealRateAmount(realRateAmount); |
|
|
wxComposeChildOrderShare.setRealRateAmount(realRateAmount); |
|
|
|
|
|
|
|
|
//官方平台抽佣 |
|
|
//官方平台抽佣 |
|
|
int rate = payShareAdapterService.getOfficialCommission(wxComposeChildOrderShare.getOrderId(),payAccount); |
|
|
int rate = payShareAdapterService.getOfficialCommission(wxComposeChildOrderShare.getOrderId(),payAccount); |
|
|
int commissionAmount = PayUtils.getPayRate(wxComposeChildOrderShare.getRealPayMent(), rate, true); |
|
|
int commissionAmount = PayUtils.getPayRate(wxComposeChildOrderShare.getRealPayMent(), rate, true); |
|
|
wxComposeChildOrderShare.setCommissionAmount(commissionAmount); |
|
|
wxComposeChildOrderShare.setCommissionAmount(commissionAmount); |
|
|
|
|
|
|
|
|
int surplus = 0;//当广场抽成帐号与收款帐号相等,无法添加分账方,计入商管商户中 |
|
|
int surplus = 0;//当广场抽成帐号与收款帐号相等,无法添加分账方,计入商管商户中 |
|
|
if(EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType()) && EnumYesOrNo.YES.getCode().equals(payAccount.getIsCommission())){ |
|
|
|
|
|
|
|
|
//只有抖音直连才有分账 |
|
|
|
|
|
if(EnumPayWay.PAY_WAY_TT.getCode().equals(payOrder.getPayVendor()) |
|
|
|
|
|
&& EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType()) |
|
|
|
|
|
&& EnumYesOrNo.YES.getCode().equals(payAccount.getIsCommission())){ |
|
|
//销售抽点+系统抽点 |
|
|
//销售抽点+系统抽点 |
|
|
int selSysAmount = PayUtils.getPayRate(wxComposeChildOrderShare.getRealPayMent(), payAccount.getSellRate()+payAccount.getSystemRate(), false); |
|
|
int selSysAmount = PayUtils.getPayRate(wxComposeChildOrderShare.getRealPayMent(), payAccount.getSellRate()+payAccount.getSystemRate(), false); |
|
|
//销售抽点 |
|
|
//销售抽点 |
|
|
@@ -322,68 +320,126 @@ public class WxProfitSharingOrderServiceImpl implements WxProfitSharingOrderServ |
|
|
//商户所得 |
|
|
//商户所得 |
|
|
int shareAmount = wxComposeChildOrderShare.getShareAmount() + surplus; |
|
|
int shareAmount = wxComposeChildOrderShare.getShareAmount() + surplus; |
|
|
|
|
|
|
|
|
WxProfitSharingReceiver receiver = payShareAdapterService.getReceiver(merchant,sharingOrder.getMerchantId(),payOrder.getTtPayWay(),payOrder.getMchType()); |
|
|
|
|
|
if(EnumPayMchType.TOTAL.getCode().equals(payOrder.getMchType()) && EnumPayShare.YES.getCode().equals(payOrder.getShare())){ |
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
|
jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); |
|
|
|
|
|
jo.put("account",receiver.getReceiverAccount()); |
|
|
|
|
|
jo.put("amount", shareAmount); |
|
|
|
|
|
jo.put("merchantId",receiver.getMerchantId()); |
|
|
|
|
|
jo.put("bTenantId",receiver.getTenantId()); |
|
|
|
|
|
jo.put("description",receiver.getId()); |
|
|
|
|
|
receivers.add(jo); |
|
|
|
|
|
|
|
|
boolean isCallSharing = false;//是否调用分账 |
|
|
|
|
|
boolean isCreateSubsidy = false;//是否需要记账 |
|
|
|
|
|
boolean isSharingResult = false;//是否需要记录Result |
|
|
|
|
|
if(EnumPayWay.PAY_WAY_WECHAT.getCode().equals(payOrder.getPayVendor()) |
|
|
|
|
|
&& DateUtils.daysBetween(payOrder.getCreateTime(),currentDate) > 30){ |
|
|
|
|
|
isCallSharing = false; |
|
|
|
|
|
if(EnumPayShare.YES.getCode().equals(payOrder.getShare())){ |
|
|
|
|
|
isCreateSubsidy = true; |
|
|
|
|
|
} |
|
|
|
|
|
isSharingResult = true; |
|
|
|
|
|
}else{ |
|
|
|
|
|
isCallSharing = true; |
|
|
|
|
|
WxProfitSharingReceiver receiver = payShareAdapterService.getReceiver(merchant,sharingOrder.getMerchantId(),payOrder.getTtPayWay(),payOrder.getMchType()); |
|
|
|
|
|
if(EnumPayMchType.TOTAL.getCode().equals(payOrder.getMchType()) && EnumPayShare.YES.getCode().equals(payOrder.getShare())){ |
|
|
|
|
|
//总分 分账 抖音不支持 不支持开通 |
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
|
jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); |
|
|
|
|
|
jo.put("account",receiver.getReceiverAccount()); |
|
|
|
|
|
jo.put("amount", shareAmount); |
|
|
|
|
|
jo.put("merchantId",receiver.getMerchantId()); |
|
|
|
|
|
jo.put("bTenantId",receiver.getTenantId()); |
|
|
|
|
|
jo.put("description",receiver.getId()); |
|
|
|
|
|
receivers.add(jo); |
|
|
|
|
|
}else if(EnumPayWay.PAY_WAY_TT.getCode().equals(payOrder.getPayVendor()) |
|
|
|
|
|
&& EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType()) |
|
|
|
|
|
&& !sharingOrder.getMerchantId().equals(wxComposeChildOrderShare.getMerchantId()) |
|
|
|
|
|
&& EnumTtPayChannel.ALI_PAY.getCode().equals(payOrder.getTtPayWay())){ |
|
|
|
|
|
//抖音 直连 多商户 支付宝支付 进件支付宝 分账 否则记账 |
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
|
jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); |
|
|
|
|
|
jo.put("account",receiver.getReceiverAccount()); |
|
|
|
|
|
jo.put("amount", shareAmount); |
|
|
|
|
|
jo.put("merchantId",receiver.getMerchantId()); |
|
|
|
|
|
jo.put("bTenantId",receiver.getTenantId()); |
|
|
|
|
|
jo.put("description",receiver.getId()); |
|
|
|
|
|
receivers.add(jo); |
|
|
|
|
|
}else if(EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType()) |
|
|
|
|
|
&& !sharingOrder.getMerchantId().equals(wxComposeChildOrderShare.getMerchantId())){ |
|
|
|
|
|
isCreateSubsidy = true; |
|
|
|
|
|
isSharingResult = true; |
|
|
|
|
|
}else{ |
|
|
|
|
|
isSharingResult = true; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(receivers.isEmpty()){ |
|
|
|
|
|
shareResult = payShareAdapterService.noReciverShare(cAppInfo, payAccount, sharingOrder); |
|
|
|
|
|
|
|
|
if(isCallSharing){ |
|
|
|
|
|
if(receivers.isEmpty()){ |
|
|
|
|
|
shareResult = payShareAdapterService.noReciverShare(cAppInfo, payAccount, sharingOrder); |
|
|
|
|
|
}else{ |
|
|
|
|
|
shareResult = payShareAdapterService.haveReciversShare(cAppInfo, payAccount, sharingOrder, receivers); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (null == shareResult) { |
|
|
|
|
|
return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(),"当前支付模式调用分账未返回结果"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
WxProfitSharingOrder updSharingOrder = new WxProfitSharingOrder(); |
|
|
|
|
|
updSharingOrder.updateTenantInfo(sharingOrder); |
|
|
|
|
|
updSharingOrder.setId(sharingOrder.getId()); |
|
|
|
|
|
updSharingOrder.setOutSettleNo(sharingOrder.getOutSettleNo()); |
|
|
|
|
|
|
|
|
|
|
|
updSharingOrder.setUpdateTime(currentDate); |
|
|
|
|
|
|
|
|
|
|
|
if(shareResult.isSuccess()){ |
|
|
|
|
|
updSharingOrder.setPayTimeEnd(currentDate); |
|
|
|
|
|
updSharingOrder.setSharingOrderNo(shareResult.getShareOrderNo()); |
|
|
|
|
|
updSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_ACCEPTED.getCode()); |
|
|
|
|
|
updSharingOrder.setErrorMsg(shareResult.getMsg()); |
|
|
|
|
|
}else{ |
|
|
|
|
|
updSharingOrder.setSharingStatus(shareResult.getCode()); |
|
|
|
|
|
updSharingOrder.setErrorMsg(shareResult.getMsg()); |
|
|
|
|
|
} |
|
|
|
|
|
updSharingOrder.setPointDeduction(JSON.toJSONString(wxComposeChildOrderShare)); |
|
|
|
|
|
updSharingOrder.setReceivers(JSON.toJSONString(receivers)); |
|
|
|
|
|
wxProfitSharingOrderMapper.updateById(updSharingOrder); |
|
|
}else{ |
|
|
}else{ |
|
|
shareResult = payShareAdapterService.haveReciversShare(cAppInfo, payAccount, sharingOrder, receivers); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (null == shareResult) { |
|
|
|
|
|
return new ResultData(ErrorCode.PROFIT_SHARING_REQUEST_FAILED.getCode(),"当前支付模式调用分账未返回结果"); |
|
|
|
|
|
|
|
|
WxProfitSharingOrder updSharingOrder = new WxProfitSharingOrder(); |
|
|
|
|
|
updSharingOrder.updateTenantInfo(sharingOrder); |
|
|
|
|
|
updSharingOrder.setId(sharingOrder.getId()); |
|
|
|
|
|
updSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_DONE.getCode()); |
|
|
|
|
|
updSharingOrder.setErrorMsg("微信支付超30天已自动解冻"); |
|
|
|
|
|
updSharingOrder.setPointDeduction(JSON.toJSONString(wxComposeChildOrderShare)); |
|
|
|
|
|
updSharingOrder.setReceivers(JSON.toJSONString(receivers)); |
|
|
|
|
|
updSharingOrder.setUpdateTime(currentDate); |
|
|
|
|
|
wxProfitSharingOrderMapper.updateById(updSharingOrder); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
WxProfitSharingOrder updSharingOrder = new WxProfitSharingOrder(); |
|
|
|
|
|
updSharingOrder.updateTenantInfo(sharingOrder); |
|
|
|
|
|
updSharingOrder.setId(sharingOrder.getId()); |
|
|
|
|
|
updSharingOrder.setOutSettleNo(sharingOrder.getOutSettleNo()); |
|
|
|
|
|
|
|
|
|
|
|
updSharingOrder.setUpdateTime(currentDate); |
|
|
|
|
|
|
|
|
|
|
|
if(shareResult.isSuccess()){ |
|
|
|
|
|
updSharingOrder.setPayTimeEnd(currentDate); |
|
|
|
|
|
updSharingOrder.setSharingOrderNo(shareResult.getShareOrderNo()); |
|
|
|
|
|
updSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_ACCEPTED.getCode()); |
|
|
|
|
|
updSharingOrder.setErrorMsg(shareResult.getMsg()); |
|
|
|
|
|
}else{ |
|
|
|
|
|
updSharingOrder.setSharingStatus(shareResult.getCode()); |
|
|
|
|
|
updSharingOrder.setErrorMsg(shareResult.getMsg()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isCreateSubsidy){ |
|
|
|
|
|
try { |
|
|
|
|
|
// 微信超过30天无法分账的, |
|
|
|
|
|
WxOrder order = wxOrderMapper.selectById(sharingOrder.getSingleOrderId(), sharingOrder.getTenantId()); |
|
|
|
|
|
wxCouponOrderService.recordAfterVerified(order, merchant); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
logger.error("核销记账失败"+e.getMessage(),e); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
updSharingOrder.setPointDeduction(JSON.toJSONString(wxComposeChildOrderShare)); |
|
|
|
|
|
updSharingOrder.setReceivers(JSON.toJSONString(receivers)); |
|
|
|
|
|
wxProfitSharingOrderMapper.updateById(updSharingOrder); |
|
|
|
|
|
|
|
|
|
|
|
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("bTenantId",payOrder.getTenantId()); |
|
|
|
|
|
jo.put("description",0); |
|
|
|
|
|
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()); |
|
|
|
|
|
jo.put("amount", shareAmount); |
|
|
|
|
|
jo.put("merchantId",receiver.getMerchantId()); |
|
|
|
|
|
jo.put("bTenantId",receiver.getTenantId()); |
|
|
|
|
|
jo.put("description",receiver.getId()); |
|
|
|
|
|
receivers.add(jo); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(isSharingResult){ |
|
|
|
|
|
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("bTenantId",payOrder.getTenantId()); |
|
|
|
|
|
jo.put("description",0); |
|
|
|
|
|
receivers.add(jo); |
|
|
|
|
|
}else if(EnumPayMchType.DIRECT.getCode().equals(payOrder.getMchType())){ |
|
|
|
|
|
WxProfitSharingReceiver receiver = payShareAdapterService.getReceiver(sharingOrder,wxComposeChildOrderShare.getMerchantId(),payOrder.getTtPayWay(),payOrder.getMchType()); |
|
|
|
|
|
//解冻给收款方(门店) |
|
|
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
|
jo.put("type",payShareAdapterService.getShareAccount(receiver.getReceiverType()).getMessage()); |
|
|
|
|
|
jo.put("account",receiver.getReceiverAccount()); |
|
|
|
|
|
jo.put("amount", shareAmount); |
|
|
|
|
|
jo.put("merchantId",receiver.getMerchantId()); |
|
|
|
|
|
jo.put("bTenantId",receiver.getTenantId()); |
|
|
|
|
|
jo.put("description",receiver.getId()); |
|
|
|
|
|
receivers.add(jo); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
try{ |
|
|
try{ |
|
|
|