mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
update 计算订单会员折扣逻辑
This commit is contained in:
@@ -2360,8 +2360,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
@Override
|
||||
public Map<String, Object> generateOrderByCard(GenerateOrderDTO dto) throws Exception {
|
||||
logger.info("充电桩主动申请启动充电生成订单 param:{}", JSON.toJSONString(dto));
|
||||
// BigDecimal totalAccountAmount = BigDecimal.ZERO;
|
||||
BigDecimal accountBalance = BigDecimal.ZERO;
|
||||
BigDecimal accountBalance;
|
||||
String payMode;
|
||||
// 判断当前用户是否为平台测试员
|
||||
PlatformTesterVO platformTesterVO = memberBasicInfoService.selectPlatformTesterStatus(dto.getMemberId());
|
||||
@@ -2375,7 +2374,6 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
// 是平台测试员
|
||||
accountBalance = Constants.whitelistDefaultAmount;
|
||||
payMode = OrderPayModeEnum.PAYMENT_OF_WHITELIST.getValue();
|
||||
|
||||
} else if (pileStationWhitelist != null) {
|
||||
// 站点白名单
|
||||
accountBalance = Constants.whitelistDefaultAmount;
|
||||
|
||||
@@ -584,13 +584,19 @@ public class DelayMerchantProgramLogic extends AbstractProgramLogic {
|
||||
Map<String, List<OrderPayRecord>> payRecordMap = payRecordList.stream().collect(Collectors.groupingBy(OrderPayRecord::getPayMode));
|
||||
// 获取本金支付的记录
|
||||
List<OrderPayRecord> principalPayRecordList = payRecordMap.get(OrderPayRecordEnum.PRINCIPAL_BALANCE_PAYMENT.getValue());
|
||||
BigDecimal principalPay = principalPayRecordList.stream().map(OrderPayRecord::getPayAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
BigDecimal principalPay = null;
|
||||
if (CollectionUtils.isNotEmpty(principalPayRecordList)) {
|
||||
principalPay = principalPayRecordList.stream().map(OrderPayRecord::getPayAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
}
|
||||
// 获取赠送金支付的记录
|
||||
List<OrderPayRecord> giftPayRecordList = payRecordMap.get(OrderPayRecordEnum.GIFT_BALANCE_PAYMENT.getValue());
|
||||
BigDecimal giftPay = giftPayRecordList.stream().map(OrderPayRecord::getPayAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
BigDecimal giftPay = null;
|
||||
if (CollectionUtils.isNotEmpty(giftPayRecordList)) {
|
||||
giftPay = giftPayRecordList.stream().map(OrderPayRecord::getPayAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
}
|
||||
|
||||
// 计算需要退回的金额
|
||||
Map<String, BigDecimal> returnAmountMap = calculateReturnAmount(principalPay, giftPay, orderAmount);
|
||||
Map<String, BigDecimal> returnAmountMap = calculateReturnAmount(principalPay, giftPay, orderAmount, orderBasicInfo.getDiscountAmount());
|
||||
logger.info("结算订单:{}, 剩余金额退回余额, 订单消费金额:{}, 本金支付金额:{}, 赠送支付金额:{}, 退回金额map:{}",
|
||||
orderCode, orderAmount, principalPay, null, JSONObject.toJSONString(returnAmountMap));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user