|
@@ -6,6 +6,7 @@ import com.github.microservice.net.ResultContent;
|
|
|
import com.github.microservice.pay.client.model.AccountModel;
|
|
import com.github.microservice.pay.client.model.AccountModel;
|
|
|
import com.github.microservice.pay.client.model.PayProductParameter;
|
|
import com.github.microservice.pay.client.model.PayProductParameter;
|
|
|
import com.github.microservice.pay.client.model.chinaSenseless.*;
|
|
import com.github.microservice.pay.client.model.chinaSenseless.*;
|
|
|
|
|
+import com.github.microservice.pay.client.model.ledger.TransactionLogModel;
|
|
|
import com.github.microservice.pay.client.model.ledger.TransferTransactionsModel;
|
|
import com.github.microservice.pay.client.model.ledger.TransferTransactionsModel;
|
|
|
import com.github.microservice.pay.client.product.senseless.chinaumsSenseless.conf.ChinaumsSenselessConf;
|
|
import com.github.microservice.pay.client.product.senseless.chinaumsSenseless.conf.ChinaumsSenselessConf;
|
|
|
import com.github.microservice.pay.client.ret.ResultState;
|
|
import com.github.microservice.pay.client.ret.ResultState;
|
|
@@ -281,7 +282,7 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
payProductParameter.setAccountName(projectAccountName);
|
|
payProductParameter.setAccountName(projectAccountName);
|
|
|
ChinaSenselessPayRequest request = new ChinaSenselessPayRequest();
|
|
ChinaSenselessPayRequest request = new ChinaSenselessPayRequest();
|
|
|
request.setMchntOrderId(orderNo);
|
|
request.setMchntOrderId(orderNo);
|
|
|
- request.setSrcReserve(JsonUtil.toJson(Map.of("userId", userId, "oid", oid, "projectOid", projectOid)));
|
|
|
|
|
|
|
+
|
|
|
request.setContractId(userSignInfo.getContractId());
|
|
request.setContractId(userSignInfo.getContractId());
|
|
|
request.setTotalAmount(total.toBigInteger().toString());
|
|
request.setTotalAmount(total.toBigInteger().toString());
|
|
|
request.setAttachedData(remark);
|
|
request.setAttachedData(remark);
|
|
@@ -306,7 +307,7 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
shareOrder.setShareOrderType(ShareOrderType.Pay);
|
|
shareOrder.setShareOrderType(ShareOrderType.Pay);
|
|
|
shareOrder.setShareOrderNo(shareOrderNo);
|
|
shareOrder.setShareOrderNo(shareOrderNo);
|
|
|
shareOrderDao.save(shareOrder);
|
|
shareOrderDao.save(shareOrder);
|
|
|
-
|
|
|
|
|
|
|
+ request.setSrcReserve(JsonUtil.toJson(Map.of("userId", userId, "oid", oid, "projectOid", projectOid, "shareOrder", shareOrder)));
|
|
|
payProductParameter.setMeta(BeanUtil.bean2Map(request));
|
|
payProductParameter.setMeta(BeanUtil.bean2Map(request));
|
|
|
com.github.microservice.pay.client.ret.ResultContent<Object> collectionResultContent = senselessPayService.collection(payProductParameter);
|
|
com.github.microservice.pay.client.ret.ResultContent<Object> collectionResultContent = senselessPayService.collection(payProductParameter);
|
|
|
return ResultContent.buildContent(collectionResultContent.getContent());
|
|
return ResultContent.buildContent(collectionResultContent.getContent());
|
|
@@ -337,7 +338,7 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
request.setMchntOrderId(orderNo);
|
|
request.setMchntOrderId(orderNo);
|
|
|
request.setRefundAmount(total.toString());
|
|
request.setRefundAmount(total.toString());
|
|
|
request.setTargetOrderId(refundOrderNo);
|
|
request.setTargetOrderId(refundOrderNo);
|
|
|
- request.setSysSource(JsonUtil.toJson(Map.of("userId", userId, "oid", oid, "projectOid", projectOid)));
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
ShareOrder shareOrder = shareOrderDao.findTopByOrderNoAndProjectOidAndOidAndShareOrderType(orderNo, projectOid, oid, ShareOrderType.Pay);
|
|
ShareOrder shareOrder = shareOrderDao.findTopByOrderNoAndProjectOidAndOidAndShareOrderType(orderNo, projectOid, oid, ShareOrderType.Pay);
|
|
|
String shareOrderNo = projectConf.getSysSourceNo() + DateUtils.paresTime(System.currentTimeMillis(), DateUtils.patternyyyyMMddHHmmssSSS) + CommonUtil.randomCode(7);
|
|
String shareOrderNo = projectConf.getSysSourceNo() + DateUtils.paresTime(System.currentTimeMillis(), DateUtils.patternyyyyMMddHHmmssSSS) + CommonUtil.randomCode(7);
|
|
@@ -361,14 +362,15 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
shareOrder.setAmount(total.toBigInteger().longValue());
|
|
shareOrder.setAmount(total.toBigInteger().longValue());
|
|
|
shareOrder.setShareOrderType(ShareOrderType.Refund);
|
|
shareOrder.setShareOrderType(ShareOrderType.Refund);
|
|
|
shareOrder.setShareOrderNo(shareOrderNo);
|
|
shareOrder.setShareOrderNo(shareOrderNo);
|
|
|
|
|
+ shareOrder.setOriShareOrderNo(shareOrder.getShareOrderNo());
|
|
|
shareOrderDao.save(refundShareOrder);
|
|
shareOrderDao.save(refundShareOrder);
|
|
|
-
|
|
|
|
|
|
|
+ request.setSysSource(JsonUtil.toJson(Map.of("userId", userId, "oid", oid, "projectOid", projectOid, "shareOrder", shareOrder)));
|
|
|
payProductParameter.setMeta(BeanUtil.bean2Map(request));
|
|
payProductParameter.setMeta(BeanUtil.bean2Map(request));
|
|
|
com.github.microservice.pay.client.ret.ResultContent<Object> refundResultContent = senselessPayService.refund(payProductParameter);
|
|
com.github.microservice.pay.client.ret.ResultContent<Object> refundResultContent = senselessPayService.refund(payProductParameter);
|
|
|
return ResultContent.buildContent(refundResultContent.getContent());
|
|
return ResultContent.buildContent(refundResultContent.getContent());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private Object handlePay(String projectOid, String oid, String userId, BigDecimal total, String orderNo, String remark) {
|
|
|
|
|
|
|
+ public com.github.microservice.pay.client.ret.ResultContent<List<TransactionLogModel>> handlePay(String projectOid, String oid, String userId, BigDecimal total, String orderNo, String remark) {
|
|
|
//TODO 判断支付状态
|
|
//TODO 判断支付状态
|
|
|
|
|
|
|
|
//获取项目总账
|
|
//获取项目总账
|
|
@@ -384,6 +386,7 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
TransferTransactionsModel.GeneralLedgerTransaction sourceTransaction = new TransferTransactionsModel.GeneralLedgerTransaction();
|
|
TransferTransactionsModel.GeneralLedgerTransaction sourceTransaction = new TransferTransactionsModel.GeneralLedgerTransaction();
|
|
|
sourceTransaction.setGeneralLedgerId(projectAccount.getLedgerId());
|
|
sourceTransaction.setGeneralLedgerId(projectAccount.getLedgerId());
|
|
|
sourceTransaction.setOrderNumber(orderNo);
|
|
sourceTransaction.setOrderNumber(orderNo);
|
|
|
|
|
+ //TODO 修改交易类型为:无感支付-借贷
|
|
|
sourceTransaction.setTransactionType(TransactionType.Pay);
|
|
sourceTransaction.setTransactionType(TransactionType.Pay);
|
|
|
sourceTransaction.setTransactionStatus(TransactionStatus.Success);
|
|
sourceTransaction.setTransactionStatus(TransactionStatus.Success);
|
|
|
sourceTransaction.setAmount(total.negate().longValue());
|
|
sourceTransaction.setAmount(total.negate().longValue());
|
|
@@ -395,6 +398,7 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
TransferTransactionsModel.GeneralLedgerTransaction destinationTransaction = new TransferTransactionsModel.GeneralLedgerTransaction();
|
|
TransferTransactionsModel.GeneralLedgerTransaction destinationTransaction = new TransferTransactionsModel.GeneralLedgerTransaction();
|
|
|
destinationTransaction.setGeneralLedgerId(userBalancePayment.getLedgerId());
|
|
destinationTransaction.setGeneralLedgerId(userBalancePayment.getLedgerId());
|
|
|
destinationTransaction.setOrderNumber(orderNo);
|
|
destinationTransaction.setOrderNumber(orderNo);
|
|
|
|
|
+ //TODO 修改交易类型为:无感支付-借贷
|
|
|
destinationTransaction.setTransactionType(TransactionType.Pay);
|
|
destinationTransaction.setTransactionType(TransactionType.Pay);
|
|
|
destinationTransaction.setTransactionStatus(TransactionStatus.Success);
|
|
destinationTransaction.setTransactionStatus(TransactionStatus.Success);
|
|
|
destinationTransaction.setAmount(total.longValue());
|
|
destinationTransaction.setAmount(total.longValue());
|
|
@@ -403,7 +407,7 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
transferModel.setDestinations(new TransferTransactionsModel.GeneralLedgerTransaction[]{destinationTransaction});
|
|
transferModel.setDestinations(new TransferTransactionsModel.GeneralLedgerTransaction[]{destinationTransaction});
|
|
|
transactionLogService.transfer(transferModel);
|
|
transactionLogService.transfer(transferModel);
|
|
|
|
|
|
|
|
- //支付:项目余额子账- 用户无感支付子账+
|
|
|
|
|
|
|
+ //支付:用户余额子账- 机构无感支付子账+
|
|
|
//构建转账参数
|
|
//构建转账参数
|
|
|
TransferTransactionsModel payTransferModel = new TransferTransactionsModel();
|
|
TransferTransactionsModel payTransferModel = new TransferTransactionsModel();
|
|
|
//构建出账账户
|
|
//构建出账账户
|
|
@@ -415,7 +419,7 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
userSourceTransaction.setAmount(total.negate().longValue());
|
|
userSourceTransaction.setAmount(total.negate().longValue());
|
|
|
userSourceTransaction.setRemark(remark);
|
|
userSourceTransaction.setRemark(remark);
|
|
|
userSourceTransaction.setMeta(Map.of("paymentType",PaymentType.UnionFrictionlessPay, "description", "银联无感支付"));
|
|
userSourceTransaction.setMeta(Map.of("paymentType",PaymentType.UnionFrictionlessPay, "description", "银联无感支付"));
|
|
|
- payTransferModel.setSource(new TransferTransactionsModel.GeneralLedgerTransaction[]{sourceTransaction});
|
|
|
|
|
|
|
+ payTransferModel.setSource(new TransferTransactionsModel.GeneralLedgerTransaction[]{userSourceTransaction});
|
|
|
|
|
|
|
|
//构建入账账户
|
|
//构建入账账户
|
|
|
TransferTransactionsModel.GeneralLedgerTransaction orgDestinationTransaction = new TransferTransactionsModel.GeneralLedgerTransaction();
|
|
TransferTransactionsModel.GeneralLedgerTransaction orgDestinationTransaction = new TransferTransactionsModel.GeneralLedgerTransaction();
|
|
@@ -426,9 +430,72 @@ public class ChinaumsSenselessPayService extends SuperService {
|
|
|
destinationTransaction.setAmount(total.longValue());
|
|
destinationTransaction.setAmount(total.longValue());
|
|
|
destinationTransaction.setRemark(remark);
|
|
destinationTransaction.setRemark(remark);
|
|
|
destinationTransaction.setMeta(Map.of("paymentType",PaymentType.UnionFrictionlessPay, "description", "银联无感支付"));
|
|
destinationTransaction.setMeta(Map.of("paymentType",PaymentType.UnionFrictionlessPay, "description", "银联无感支付"));
|
|
|
- payTransferModel.setDestinations(new TransferTransactionsModel.GeneralLedgerTransaction[]{destinationTransaction});
|
|
|
|
|
- transactionLogService.transfer(payTransferModel);
|
|
|
|
|
- return ResultContent.buildSuccess();
|
|
|
|
|
|
|
+ payTransferModel.setDestinations(new TransferTransactionsModel.GeneralLedgerTransaction[]{orgDestinationTransaction});
|
|
|
|
|
+ return transactionLogService.transfer(payTransferModel);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public com.github.microservice.pay.client.ret.ResultContent<List<TransactionLogModel>> handleRefund(String projectOid, String oid, String userId, BigDecimal total, String orderNo, String remark) {
|
|
|
|
|
+ //TODO 判断支付状态
|
|
|
|
|
+
|
|
|
|
|
+ //获取项目总账
|
|
|
|
|
+ PayAccount projectAccount = payAccountService.getProjectChildren(projectOid, PaymentChannelType.SecretFreePayment);
|
|
|
|
|
+ //获取用户无感支付子账户
|
|
|
|
|
+ PayAccount userBalancePayment = payAccountService.getUserChildren(projectOid, userId, PaymentChannelType.SecretFreePayment);
|
|
|
|
|
+ //获取机构待结算账户
|
|
|
|
|
+ PayAccount orgWaitSettle = payAccountService.getOrgChildren(projectOid, oid, PaymentChannelType.WaitSettle);
|
|
|
|
|
+ //支付:项目余额子账+ 用户无感支付子账-
|
|
|
|
|
+ //构建转账参数
|
|
|
|
|
+ TransferTransactionsModel transferModel = new TransferTransactionsModel();
|
|
|
|
|
+ //构建出账账户
|
|
|
|
|
+ TransferTransactionsModel.GeneralLedgerTransaction sourceTransaction = new TransferTransactionsModel.GeneralLedgerTransaction();
|
|
|
|
|
+ sourceTransaction.setGeneralLedgerId(userBalancePayment.getLedgerId());
|
|
|
|
|
+ sourceTransaction.setOrderNumber(orderNo);
|
|
|
|
|
+ //TODO 修改交易类型为:无感支付-借贷
|
|
|
|
|
+ sourceTransaction.setTransactionType(TransactionType.Pay);
|
|
|
|
|
+ sourceTransaction.setTransactionStatus(TransactionStatus.Success);
|
|
|
|
|
+ sourceTransaction.setAmount(total.negate().longValue());
|
|
|
|
|
+ sourceTransaction.setRemark(remark);
|
|
|
|
|
+ sourceTransaction.setMeta(Map.of("paymentType",PaymentType.UnionFrictionlessPay, "description", "银联无感支付"));
|
|
|
|
|
+ transferModel.setSource(new TransferTransactionsModel.GeneralLedgerTransaction[]{sourceTransaction});
|
|
|
|
|
+
|
|
|
|
|
+ //构建入账账户
|
|
|
|
|
+ TransferTransactionsModel.GeneralLedgerTransaction destinationTransaction = new TransferTransactionsModel.GeneralLedgerTransaction();
|
|
|
|
|
+ destinationTransaction.setGeneralLedgerId(projectAccount.getLedgerId());
|
|
|
|
|
+ destinationTransaction.setOrderNumber(orderNo);
|
|
|
|
|
+ //TODO 修改交易类型为:无感支付-借贷
|
|
|
|
|
+ destinationTransaction.setTransactionType(TransactionType.Pay);
|
|
|
|
|
+ destinationTransaction.setTransactionStatus(TransactionStatus.Success);
|
|
|
|
|
+ destinationTransaction.setAmount(total.longValue());
|
|
|
|
|
+ destinationTransaction.setRemark(remark);
|
|
|
|
|
+ destinationTransaction.setMeta(Map.of("paymentType",PaymentType.UnionFrictionlessPay, "description", "用户余额支付"));
|
|
|
|
|
+ transferModel.setDestinations(new TransferTransactionsModel.GeneralLedgerTransaction[]{destinationTransaction});
|
|
|
|
|
+ transactionLogService.transfer(transferModel);
|
|
|
|
|
+
|
|
|
|
|
+ //支付:机构余额子账- 用户无感支付子账+
|
|
|
|
|
+ //构建转账参数
|
|
|
|
|
+ TransferTransactionsModel payTransferModel = new TransferTransactionsModel();
|
|
|
|
|
+ //构建出账账户
|
|
|
|
|
+ TransferTransactionsModel.GeneralLedgerTransaction userSourceTransaction = new TransferTransactionsModel.GeneralLedgerTransaction();
|
|
|
|
|
+ userSourceTransaction.setGeneralLedgerId(orgWaitSettle.getLedgerId());
|
|
|
|
|
+ userSourceTransaction.setOrderNumber(orderNo);
|
|
|
|
|
+ userSourceTransaction.setTransactionType(TransactionType.Pay);
|
|
|
|
|
+ userSourceTransaction.setTransactionStatus(TransactionStatus.Success);
|
|
|
|
|
+ userSourceTransaction.setAmount(total.negate().longValue());
|
|
|
|
|
+ userSourceTransaction.setRemark(remark);
|
|
|
|
|
+ userSourceTransaction.setMeta(Map.of("paymentType",PaymentType.UnionFrictionlessPay, "description", "银联无感支付"));
|
|
|
|
|
+ payTransferModel.setSource(new TransferTransactionsModel.GeneralLedgerTransaction[]{userSourceTransaction});
|
|
|
|
|
+
|
|
|
|
|
+ //构建入账账户
|
|
|
|
|
+ TransferTransactionsModel.GeneralLedgerTransaction orgDestinationTransaction = new TransferTransactionsModel.GeneralLedgerTransaction();
|
|
|
|
|
+ destinationTransaction.setGeneralLedgerId(userBalancePayment.getLedgerId());
|
|
|
|
|
+ destinationTransaction.setOrderNumber(orderNo);
|
|
|
|
|
+ destinationTransaction.setTransactionType(TransactionType.Pay);
|
|
|
|
|
+ destinationTransaction.setTransactionStatus(TransactionStatus.Success);
|
|
|
|
|
+ destinationTransaction.setAmount(total.longValue());
|
|
|
|
|
+ destinationTransaction.setRemark(remark);
|
|
|
|
|
+ destinationTransaction.setMeta(Map.of("paymentType",PaymentType.UnionFrictionlessPay, "description", "银联无感支付"));
|
|
|
|
|
+ payTransferModel.setDestinations(new TransferTransactionsModel.GeneralLedgerTransaction[]{orgDestinationTransaction});
|
|
|
|
|
+ return transactionLogService.transfer(payTransferModel);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|