mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-17 08:18:34 +08:00
电单车订单,按实际退款
This commit is contained in:
@@ -609,32 +609,43 @@ public class DelayMerchantProgramLogic extends AbstractProgramLogic {
|
|||||||
// 查询订单信息
|
// 查询订单信息
|
||||||
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderBasicInfo.getOrderCode());
|
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderBasicInfo.getOrderCode());
|
||||||
// 订单消费金额, 除了充满自停是需要计算实际消费, 其他金额都是按次收费
|
// 订单消费金额, 除了充满自停是需要计算实际消费, 其他金额都是按次收费
|
||||||
BigDecimal orderAmount;
|
BigDecimal orderAmount = BigDecimal.ZERO;
|
||||||
// 耗电量
|
// 耗电量
|
||||||
BigDecimal consumedEnergy = message.getConsumedEnergy();
|
BigDecimal consumedEnergy = message.getConsumedEnergy();
|
||||||
if (fullOfSelfStopping.compareTo(orderBasicInfo.getPayAmount()) == 0) {
|
|
||||||
// 计费模板, 只取平时段的价格
|
// 计算实际消费金额
|
||||||
BigDecimal flatElectricityPrice = orderDetail.getFlatElectricityPrice() != null ? orderDetail.getFlatElectricityPrice() : BigDecimal.ZERO; // x元/每度
|
// 计费模板, 只取平时段的价格
|
||||||
// BigDecimal flatServicePrice = orderDetail.getFlatServicePrice() != null ? orderDetail.getFlatServicePrice() : BigDecimal.ZERO; // x元/每度
|
BigDecimal flatElectricityPrice = orderDetail.getFlatElectricityPrice() != null ? orderDetail.getFlatElectricityPrice() : BigDecimal.ZERO; // x元/每度
|
||||||
BigDecimal flatServicePrice = BigDecimal.ZERO; // x元/每度 服务费默认0
|
// BigDecimal flatServicePrice = orderDetail.getFlatServicePrice() != null ? orderDetail.getFlatServicePrice() : BigDecimal.ZERO; // x元/每度
|
||||||
// 单价 = 电费单价 + 服务费单价
|
BigDecimal flatServicePrice = BigDecimal.ZERO; // x元/每度 服务费默认0
|
||||||
BigDecimal price = flatElectricityPrice.add(flatServicePrice);
|
// 单价 = 电费单价 + 服务费单价
|
||||||
// 如果耗电量或单价为空或者为0,则订单消费为0
|
BigDecimal price = flatElectricityPrice.add(flatServicePrice);
|
||||||
// if (consumedEnergy == null || consumedEnergy.compareTo(BigDecimal.ZERO) == 0 || price.compareTo(BigDecimal.ZERO) == 0) {
|
// 计算实际消费, 保留两位小数
|
||||||
// logger.info("计算电单车退款逻辑,耗电量或计费模板为空,不执行退款逻辑, orderCode:{}, 耗电量:{}, 每度电费:{}", orderBasicInfo.getOrderCode(), consumedEnergy, price);
|
orderAmount = consumedEnergy.multiply(price).setScale(2, RoundingMode.UP);
|
||||||
// return;
|
|
||||||
// }
|
// if (fullOfSelfStopping.compareTo(orderBasicInfo.getPayAmount()) == 0) {
|
||||||
// 计算实际消费, 保留两位小数
|
// // 计费模板, 只取平时段的价格
|
||||||
orderAmount = consumedEnergy.multiply(price).setScale(2, RoundingMode.UP);
|
// BigDecimal flatElectricityPrice = orderDetail.getFlatElectricityPrice() != null ? orderDetail.getFlatElectricityPrice() : BigDecimal.ZERO; // x元/每度
|
||||||
} else {
|
// // BigDecimal flatServicePrice = orderDetail.getFlatServicePrice() != null ? orderDetail.getFlatServicePrice() : BigDecimal.ZERO; // x元/每度
|
||||||
// 2025.07.28如果耗电量为 0,也进行退款
|
// BigDecimal flatServicePrice = BigDecimal.ZERO; // x元/每度 服务费默认0
|
||||||
if (consumedEnergy.compareTo(BigDecimal.ZERO) == 0) {
|
// // 单价 = 电费单价 + 服务费单价
|
||||||
orderAmount = BigDecimal.ZERO;
|
// BigDecimal price = flatElectricityPrice.add(flatServicePrice);
|
||||||
}else {
|
// // 如果耗电量或单价为空或者为0,则订单消费为0
|
||||||
// 其他金额、并且耗电量不为 0 ,都是按次收费, 不退款
|
// // if (consumedEnergy == null || consumedEnergy.compareTo(BigDecimal.ZERO) == 0 || price.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
orderAmount = orderBasicInfo.getPayAmount();
|
// // logger.info("计算电单车退款逻辑,耗电量或计费模板为空,不执行退款逻辑, orderCode:{}, 耗电量:{}, 每度电费:{}", orderBasicInfo.getOrderCode(), consumedEnergy, price);
|
||||||
}
|
// // return;
|
||||||
}
|
// // }
|
||||||
|
// // 计算实际消费, 保留两位小数
|
||||||
|
// orderAmount = consumedEnergy.multiply(price).setScale(2, RoundingMode.UP);
|
||||||
|
// } else {
|
||||||
|
// // 2025.07.28如果耗电量为 0,也进行退款
|
||||||
|
// if (consumedEnergy.compareTo(BigDecimal.ZERO) == 0) {
|
||||||
|
// orderAmount = BigDecimal.ZERO;
|
||||||
|
// }else {
|
||||||
|
// // 其他金额、并且耗电量不为 0 ,都是按次收费, 不退款
|
||||||
|
// orderAmount = orderBasicInfo.getPayAmount();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// 退款金额 = 支付金额 - 优惠后总消费金额
|
// 退款金额 = 支付金额 - 优惠后总消费金额
|
||||||
BigDecimal refundAmount = orderBasicInfo.getPayAmount().subtract(orderAmount);
|
BigDecimal refundAmount = orderBasicInfo.getPayAmount().subtract(orderAmount);
|
||||||
|
|||||||
Reference in New Issue
Block a user