mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package com.jsowell.adapay.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class OrderSettleResult {
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 确认金额
|
||||
*/
|
||||
private String confirm_amt;
|
||||
|
||||
/**
|
||||
* 支付确认手续费金额
|
||||
*/
|
||||
private String fee_amt;
|
||||
|
||||
/**
|
||||
* 附加说明
|
||||
*/
|
||||
private String description;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.jsowell.pile.service;
|
||||
|
||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||
import com.jsowell.adapay.response.PaymentConfirmResponse;
|
||||
import com.jsowell.adapay.vo.OrderSettleResult;
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
|
||||
import com.jsowell.pile.domain.AdapayMemberAccount;
|
||||
@@ -19,7 +19,6 @@ import com.jsowell.pile.vo.uniapp.SendMessageVO;
|
||||
import com.jsowell.pile.vo.web.IndexOrderInfoVO;
|
||||
import com.jsowell.pile.vo.web.OrderListVO;
|
||||
import com.jsowell.pile.vo.web.OrderTotalDataVO;
|
||||
import com.jsowell.pile.dto.ApplyRefundDTO;
|
||||
import com.jsowell.wxpay.response.WechatPayRefundResponse;
|
||||
|
||||
import java.text.ParseException;
|
||||
@@ -156,7 +155,7 @@ public interface IOrderBasicInfoService {
|
||||
* @return
|
||||
* @throws BaseAdaPayException
|
||||
*/
|
||||
PaymentConfirmResponse doPaymentConfirm(OrderBasicInfo orderBasicInfo, AdapayMemberAccount adapayMemberAccount) throws BaseAdaPayException;
|
||||
OrderSettleResult doPaymentConfirm(OrderBasicInfo orderBasicInfo, AdapayMemberAccount adapayMemberAccount) throws BaseAdaPayException;
|
||||
|
||||
/**
|
||||
* 批量查询订单
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.huifu.adapay.model.Refund;
|
||||
import com.jsowell.adapay.common.CreateAdaPaymentParam;
|
||||
import com.jsowell.adapay.common.DivMember;
|
||||
import com.jsowell.adapay.response.PaymentConfirmResponse;
|
||||
import com.jsowell.adapay.vo.OrderSettleResult;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
|
||||
@@ -626,7 +627,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
}
|
||||
// 消费金额就是订单总金额
|
||||
BigDecimal orderAmount = new BigDecimal(data.getConsumptionAmount());
|
||||
orderBasicInfo.setOrderAmount(orderAmount);
|
||||
orderBasicInfo.setOrderAmount(orderAmount); // 订单总金额
|
||||
|
||||
// 付款金额 - 实际消费金额,如果有剩余,需要走退款操作 当使用余额支付时payAmount = principalPay + giftPay
|
||||
BigDecimal payAmount = orderBasicInfo.getPayAmount();
|
||||
@@ -655,7 +656,6 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
OrderDetail orderDetail = getOrderDetailByOrderCode(orderCode);
|
||||
|
||||
// 把交易记录中的用电量,金额等信息 更新到orderBasicInfo和orderDetail
|
||||
// orderBasicInfo.setOrderAmount(orderAmount); // 订单总金额
|
||||
orderBasicInfo.setVirtualAmount(virtualAmount); // 虚拟金额
|
||||
orderBasicInfo.setSettleAmount(orderAmount.subtract(virtualAmount)); // 结算金额
|
||||
orderBasicInfo.setOrderStatus(OrderStatusEnum.ORDER_COMPLETE.getValue());
|
||||
@@ -924,9 +924,9 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
// 执行分账
|
||||
for (OrderBasicInfo orderBasicInfo : orderBasicInfos) {
|
||||
try {
|
||||
PaymentConfirmResponse paymentConfirmResponse = doPaymentConfirm(orderBasicInfo, adapayMemberAccount);
|
||||
if (paymentConfirmResponse != null && AdapayStatusEnum.SUCCEEDED.getValue().equals(paymentConfirmResponse.getStatus())) {
|
||||
JSONObject jsonObject = JSON.parseObject(paymentConfirmResponse.getDescription());
|
||||
OrderSettleResult orderSettleResult = doPaymentConfirm(orderBasicInfo, adapayMemberAccount);
|
||||
if (orderSettleResult != null && AdapayStatusEnum.SUCCEEDED.getValue().equals(orderSettleResult.getStatus())) {
|
||||
JSONObject jsonObject = JSON.parseObject(orderSettleResult.getDescription());
|
||||
String orderCode = (String) jsonObject.get("orderCode");
|
||||
|
||||
// 应收金额 = 订单结算金额汇总
|
||||
@@ -934,13 +934,13 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
// 应清分金额 = 订单产生的电费+服务费实际消费 汇总
|
||||
shouldClearingAmount = shouldClearingAmount.add(orderBasicInfo.getSettleAmount());
|
||||
// 实际清分金额 = 汇付清分接口返回的清分金额
|
||||
actualClearingAmount = actualClearingAmount.add(new BigDecimal(paymentConfirmResponse.getConfirm_amt()));
|
||||
actualClearingAmount = actualClearingAmount.add(new BigDecimal(orderSettleResult.getConfirm_amt()));
|
||||
// 手续费金额 = 汇付清分接口返回的手续费金额
|
||||
feeAmount = feeAmount.add(new BigDecimal(paymentConfirmResponse.getFee_amt()));
|
||||
feeAmount = feeAmount.add(new BigDecimal(orderSettleResult.getFee_amt()));
|
||||
// 可提现金额 = 实际清分金额 - 手续费金额
|
||||
withdrawableAmount = withdrawableAmount
|
||||
.add(new BigDecimal(paymentConfirmResponse.getConfirm_amt()))
|
||||
.subtract(new BigDecimal(paymentConfirmResponse.getFee_amt()));
|
||||
.add(new BigDecimal(orderSettleResult.getConfirm_amt()))
|
||||
.subtract(new BigDecimal(orderSettleResult.getFee_amt()));
|
||||
|
||||
ClearingBillDetail clearingBillDetail = ClearingBillDetail.builder()
|
||||
.clearingBillCode(clearingBillCode)
|
||||
@@ -1035,9 +1035,9 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
// 执行分账
|
||||
for (OrderBasicInfo orderBasicInfo : orderBasicInfos) {
|
||||
try {
|
||||
PaymentConfirmResponse paymentConfirmResponse = doPaymentConfirm(orderBasicInfo, adapayMemberAccount);
|
||||
if (paymentConfirmResponse != null && AdapayStatusEnum.SUCCEEDED.getValue().equals(paymentConfirmResponse.getStatus())) {
|
||||
JSONObject jsonObject = JSON.parseObject(paymentConfirmResponse.getDescription());
|
||||
OrderSettleResult orderSettleResult = doPaymentConfirm(orderBasicInfo, adapayMemberAccount);
|
||||
if (orderSettleResult != null && AdapayStatusEnum.SUCCEEDED.getValue().equals(orderSettleResult.getStatus())) {
|
||||
JSONObject jsonObject = JSON.parseObject(orderSettleResult.getDescription());
|
||||
String orderCode = (String) jsonObject.get("orderCode");
|
||||
|
||||
// 应收金额 = 订单结算金额汇总
|
||||
@@ -1045,13 +1045,13 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
// // 应清分金额 = 订单产生的电费+服务费实际消费 汇总
|
||||
// shouldClearingAmount = shouldClearingAmount.add(orderBasicInfo.getSettleAmount());
|
||||
// // 实际清分金额 = 汇付清分接口返回的清分金额
|
||||
// actualClearingAmount = actualClearingAmount.add(new BigDecimal(paymentConfirmResponse.getConfirm_amt()));
|
||||
// actualClearingAmount = actualClearingAmount.add(new BigDecimal(orderSettleResult.getConfirm_amt()));
|
||||
// // 手续费金额 = 汇付清分接口返回的手续费金额
|
||||
// feeAmount = feeAmount.add(new BigDecimal(paymentConfirmResponse.getFee_amt()));
|
||||
// feeAmount = feeAmount.add(new BigDecimal(orderSettleResult.getFee_amt()));
|
||||
// // 可提现金额 = 实际清分金额 - 手续费金额
|
||||
// withdrawableAmount = withdrawableAmount
|
||||
// .add(new BigDecimal(paymentConfirmResponse.getConfirm_amt()))
|
||||
// .subtract(new BigDecimal(paymentConfirmResponse.getFee_amt()));
|
||||
// .add(new BigDecimal(orderSettleResult.getConfirm_amt()))
|
||||
// .subtract(new BigDecimal(orderSettleResult.getFee_amt()));
|
||||
|
||||
// ClearingBillDetail clearingBillDetail = ClearingBillDetail.builder()
|
||||
// .clearingBillCode(clearingBillCode)
|
||||
@@ -1084,13 +1084,13 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 交易确认
|
||||
* 延迟交易订单 交易确认
|
||||
* @param orderBasicInfo 订单
|
||||
* @param adapayMemberAccount 结算账户
|
||||
* @throws BaseAdaPayException
|
||||
*/
|
||||
@Override
|
||||
public PaymentConfirmResponse doPaymentConfirm(OrderBasicInfo orderBasicInfo, AdapayMemberAccount adapayMemberAccount) throws BaseAdaPayException {
|
||||
public OrderSettleResult doPaymentConfirm(OrderBasicInfo orderBasicInfo, AdapayMemberAccount adapayMemberAccount) throws BaseAdaPayException {
|
||||
// 查询订单的交易id
|
||||
AdapayCallbackRecord adapayCallbackRecord = adapayCallbackRecordService.selectByOrderCode(orderBasicInfo.getOrderCode());
|
||||
if (adapayCallbackRecord == null) {
|
||||
@@ -1128,7 +1128,13 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
Map<String, Object> paymentConfirm = PaymentConfirm.create(confirmParams);
|
||||
logger.info("调分账接口param:{}, result:{}", JSON.toJSONString(confirmParams), JSON.toJSONString(paymentConfirm));
|
||||
// 分账接口返回的信息
|
||||
return JSONObject.parseObject(JSON.toJSONString(paymentConfirm), PaymentConfirmResponse.class);
|
||||
PaymentConfirmResponse paymentConfirmResponse = JSONObject.parseObject(JSON.toJSONString(paymentConfirm), PaymentConfirmResponse.class);
|
||||
OrderSettleResult result = new OrderSettleResult();
|
||||
result.setConfirm_amt(paymentConfirmResponse.getConfirm_amt());
|
||||
result.setStatus(paymentConfirmResponse.getStatus());
|
||||
result.setFee_amt(paymentConfirmResponse.getFee_amt());
|
||||
result.setDescription(paymentConfirmResponse.getDescription());
|
||||
return result;
|
||||
}
|
||||
|
||||
// uniApp 发送停止充电订阅消息
|
||||
|
||||
Reference in New Issue
Block a user