|
|
@@ -7,6 +7,7 @@ import com.github.microservice.pay.client.ret.ResultState;
|
|
|
import com.github.microservice.types.OrderState;
|
|
|
import com.github.microservice.types.payment.PaymentType;
|
|
|
import com.zhongshu.card.client.model.operLogs.OperationLogsAddParam;
|
|
|
+import com.zhongshu.card.client.model.pay.SatInfoModel;
|
|
|
import com.zhongshu.card.client.model.payment.ExpenseRefundParam;
|
|
|
import com.zhongshu.card.client.type.LogsLevel;
|
|
|
import com.zhongshu.card.client.type.MessageType;
|
|
|
@@ -18,6 +19,8 @@ import com.zhongshu.card.client.utils.PayExceptionToShowUtil;
|
|
|
import com.zhongshu.card.server.core.dao.payment.ExpenseFlowDao;
|
|
|
import com.zhongshu.card.server.core.dao.payment.PaymentProcessDao;
|
|
|
import com.zhongshu.card.server.core.domain.org.Organization;
|
|
|
+import com.zhongshu.card.server.core.domain.paySetting.ProjectMainPaySetting;
|
|
|
+import com.zhongshu.card.server.core.domain.paySetting.ProjectOrgPaySettingInfo;
|
|
|
import com.zhongshu.card.server.core.domain.payment.ExpenseFlow;
|
|
|
import com.zhongshu.card.server.core.domain.payment.PaymentProcess;
|
|
|
import com.zhongshu.card.server.core.domain.payment.RefundRecord;
|
|
|
@@ -203,6 +206,8 @@ public class PayCallService extends SuperService {
|
|
|
paymentProcess.setPayStartTime(System.currentTimeMillis());
|
|
|
|
|
|
entity.setPayStartTime(System.currentTimeMillis());
|
|
|
+ // 封装分账信息
|
|
|
+
|
|
|
com.github.microservice.pay.client.ret.ResultContent<List<TransactionLogModel>> resultContent = balancePayService.balancePay(entity.getProjectOid(), entity.getShopOid(), entity.getUserId(), entity.getPayAmount(), entity.getPaymentNo(), entity.getRemark());
|
|
|
if (resultContent.getState() == com.github.microservice.pay.client.ret.ResultState.Success) {
|
|
|
// 关联参数
|
|
|
@@ -305,7 +310,10 @@ public class PayCallService extends SuperService {
|
|
|
payAmount = payAmount.stripTrailingZeros();
|
|
|
|
|
|
log.info("开始支付时间:{}", DateUtils.paresTime(System.currentTimeMillis(), DateUtils.patternyyyySSS));
|
|
|
- com.github.microservice.net.ResultContent resultContent = chinaumsSenselessPayService.senselessPay(entity.getProjectOid(), entity.getShopOid(), entity.getUserId(), payAmount, entity.getPaymentNo(), entity.getRemark());
|
|
|
+ List<SatInfoModel> satInfoModel = buildShare(entity, paymentProcess.getPaymentType());
|
|
|
+ com.github.microservice.net.ResultContent resultContent = chinaumsSenselessPayService.senselessPay(
|
|
|
+ entity.getProjectOid(), entity.getShopOid(), entity.getUserId(),
|
|
|
+ payAmount, entity.getPaymentNo(), entity.getRemark(), satInfoModel);
|
|
|
if (resultContent.getState() == com.github.microservice.net.ResultState.Success) {
|
|
|
// 关联参数
|
|
|
String msg = "支付中";
|
|
|
@@ -758,4 +766,42 @@ public class PayCallService extends SuperService {
|
|
|
return paymentType;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 组装分账的数据
|
|
|
+ *
|
|
|
+ * @param entity
|
|
|
+ */
|
|
|
+ public List<SatInfoModel> buildShare(ExpenseFlow entity, PaymentType paymentType) {
|
|
|
+ List<SatInfoModel> satInfoModel = new ArrayList<>();
|
|
|
+ ProjectMainPaySetting paySetting = projectMainPaySettingService.getProjectMainPaySetting(entity.getProjectOid(), paymentType);
|
|
|
+ if (ObjectUtils.isNotEmpty(paySetting)) {
|
|
|
+ // 消费的金额
|
|
|
+ BigDecimal payAmount = entity.getPayAmount();
|
|
|
+ Long minSharing = paySetting.getMinSharing();
|
|
|
+ if (minSharing != null && minSharing > 0 && BigDecimal.valueOf(minSharing).compareTo(payAmount) <= 0) {
|
|
|
+ ProjectOrgPaySettingInfo childPaySettingInfo = paySetting.getChildPaySettingInfo();
|
|
|
+ if (ObjectUtils.isNotEmpty(childPaySettingInfo)) {
|
|
|
+ String mainOid = childPaySettingInfo.getBelongOig();
|
|
|
+ String shopOid = entity.getShopOid();
|
|
|
+
|
|
|
+ BigDecimal projectScale = paySetting.getProjectScale();
|
|
|
+ if (projectScale != null) {
|
|
|
+ BigDecimal orgScale = paySetting.getOrgScale();
|
|
|
+ SatInfoModel plat = new SatInfoModel();
|
|
|
+ plat.setOid(mainOid);
|
|
|
+ plat.setRatio(projectScale);
|
|
|
+
|
|
|
+ SatInfoModel shop = new SatInfoModel();
|
|
|
+ shop.setOid(shopOid);
|
|
|
+ shop.setRatio(orgScale);
|
|
|
+
|
|
|
+ satInfoModel.add(plat);
|
|
|
+ satInfoModel.add(shop);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return satInfoModel;
|
|
|
+ }
|
|
|
+
|
|
|
}
|