余额支付, 校验消费金额 - 折扣金额 + 退款金额 = 支付金额

This commit is contained in:
Guoqs
2025-03-26 19:58:42 +08:00
parent 063c4f494f
commit 670a35c9a1
2 changed files with 39 additions and 3 deletions

View File

@@ -16,6 +16,7 @@ import com.jsowell.adapay.service.AdapayService;
import com.jsowell.adapay.vo.OrderSplitResult;
import com.jsowell.adapay.vo.PaymentInfo;
import com.jsowell.common.annotation.CostTime;
import com.jsowell.common.constant.RabbitConstants;
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.adapay.AdapayStatusEnum;
@@ -24,6 +25,7 @@ import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.*;
import com.jsowell.pile.dto.AfterSettleOrderDTO;
import com.jsowell.pile.dto.ApplyRefundDTO;
import com.jsowell.pile.dto.QueryOrderDTO;
import com.jsowell.pile.dto.SettleOrderReportDTO;
@@ -32,10 +34,13 @@ import com.jsowell.pile.mapper.PileMsgRecordMapper;
import com.jsowell.pile.service.*;
import com.jsowell.pile.service.programlogic.AbstractProgramLogic;
import com.jsowell.pile.service.programlogic.ProgramLogicFactory;
import com.jsowell.pile.transaction.dto.OrderTransactionDTO;
import com.jsowell.pile.transaction.service.TransactionService;
import com.jsowell.pile.vo.web.*;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -69,6 +74,12 @@ public class TempService {
@Autowired
private AdapayCallbackRecordService adapayCallbackRecordService;
@Autowired
protected TransactionService transactionService;
@Autowired
protected RabbitTemplate rabbitTemplate;
@Autowired
protected MemberGroupService memberGroupService;
@@ -901,6 +912,29 @@ public class TempService {
logger.info("testSettleOrderLogic, orderCode:{}, 支付金额:{}, 消费金额:{}, 折扣金额:{}, 退款金额:{}, 结算金额:{}",
orderBasicInfo.getOrderCode(), orderBasicInfo.getPayAmount(), orderBasicInfo.getOrderAmount(),
orderBasicInfo.getDiscountAmount(), orderBasicInfo.getRefundAmount(), orderBasicInfo.getSettleAmount());
// 更新数据库
OrderTransactionDTO dto = new OrderTransactionDTO();
dto.setOrderBasicInfo(orderBasicInfo);
dto.setOrderDetail(orderDetail);
transactionService.doUpdateOrder(dto);
// 组装after参数
AfterSettleOrderDTO afterSettleOrderDTO = AfterSettleOrderDTO.builder()
.orderCode(orderBasicInfo.getOrderCode())
.merchantId(orderBasicInfo.getMerchantId())
.stationId(orderBasicInfo.getStationId())
.orderPayAmount(orderBasicInfo.getPayAmount()) // 支付金额
.orderConsumeAmount(orderBasicInfo.getOrderAmount()) // 消费金额
.orderSettleAmount(orderBasicInfo.getSettleAmount()) // 结算金额
.orderElectricityAmount(orderDetail.getTotalElectricityAmount()) // 电费金额
.orderElectricityDiscountAmount(orderDetail.getDiscountElectricityAmount()) // 电费折扣金额
.orderServiceAmount(orderDetail.getTotalServiceAmount()) // 服务费金额
.orderServiceDiscountAmount(orderDetail.getDiscountServiceAmount()) // 服务费折扣金额
.orderRefundAmount(orderBasicInfo.getRefundAmount()) // 退款金额
.build();
rabbitTemplate.convertAndSend(RabbitConstants.YKC_EXCHANGE_NAME, RabbitConstants.QUEUE_CHARGE_ORDER_DATA, afterSettleOrderDTO);
}
}