订单明细优惠金额

This commit is contained in:
yanglei 2026-02-26 16:39:19 +08:00
parent b7d3a0ef91
commit c12cbc995f
5 changed files with 27 additions and 3 deletions

View File

@ -16,7 +16,8 @@ public enum EbikeOrderDetailType {
OPERATION_AREA_DISPATCH_FEE(3, "运营区调度费用"),
OUT_OF_PARKING_AREA_FEE(4, "停车区外调度费用"),
NO_PARKING_ZONE_FEE(5, "禁停区调度费用"),
HELMET_FEE(6, "头盔使用费用");
HELMET_FEE(6, "头盔使用费用"),
DISCOUNT_AMOUNT(7, "订单优惠金额");
private final Integer code;
private final String name;

View File

@ -44,7 +44,7 @@ public class EbikeOrderDetail implements Serializable {
private Long operatorId;
/**
* 费用类型1-时长费用 2-起步费用 3-运营区调度费用 4-停车区外调度费用 5-禁停区调度费用 6-头盔使用费用
* 费用类型1-时长费用 2-起步费用 3-运营区调度费用 4-停车区外调度费用 5-禁停区调度费用 6-头盔使用费用 7-优惠费用
*/
private Integer detailType;

View File

@ -194,4 +194,9 @@ public class EbikeOrderDetailVo {
* 用户头盔费用
*/
private BigDecimal userHelmetFee;
/**
* 优惠费用
*/
private BigDecimal discountAmount;
}

View File

@ -24,7 +24,7 @@ public class EbikePaymentCostDetailVo implements Serializable {
private Long detailId;
/**
* 费用类型 1-时长费用 2-起步费用 3-运营区调度费用 4-停车区外调度费用 5-禁停区调度费用 6-头盔使用费用
* 费用类型 1-时长费用 2-起步费用 3-运营区调度费用 4-停车区外调度费用 5-禁停区调度费用 6-头盔使用费用 7-优惠费用
*/
private Integer detailType;

View File

@ -187,6 +187,10 @@ public class EbikeOrderServiceImpl extends ServiceImpl<EbikeOrderMapper, EbikeOr
BigDecimal current = payDetailVo.getDetailAmount();
ebikeOrderDetailVo.setUserHelmetFee((current != null ? current : BigDecimal.ZERO));
}
case 7 -> {
BigDecimal current = payDetailVo.getDetailAmount();
ebikeOrderDetailVo.setDiscountAmount((current != null ? current : BigDecimal.ZERO));
}
}
}
}
@ -394,6 +398,10 @@ public class EbikeOrderServiceImpl extends ServiceImpl<EbikeOrderMapper, EbikeOr
BigDecimal current = payDetailVo.getDetailAmount();
ebikeOrderDetailVo.setUserHelmetFee((current != null ? current : BigDecimal.ZERO));
}
case 7 -> {
BigDecimal current = payDetailVo.getDetailAmount();
ebikeOrderDetailVo.setDiscountAmount((current != null ? current : BigDecimal.ZERO));
}
}
}
}
@ -441,6 +449,16 @@ public class EbikeOrderServiceImpl extends ServiceImpl<EbikeOrderMapper, EbikeOr
.update();
// 3 同步修改支付订单的cost_price(用于支付时的实际金额)
ebikePaymentService.updateCostPrice(ebikeOrder.getOrderId(), paymentAmountDto.getPrice());
// 4 生成订单明细优惠金额
EbikeOrderDetail orderDetail = EbikeOrderDetail.builder()
.orderId(ebikeOrder.getOrderId())
.operatorId(ebikeOrder.getOperatorId())
.detailType(EbikeOrderDetailType.DISCOUNT_AMOUNT.getCode())
.detailDescription("运维人员修改订单减免金额")
.detailName(EbikeOrderDetailType.DISCOUNT_AMOUNT.getName())
.detailAmount(ebikeOrder.getTotalAmount().subtract(paymentAmountDto.getPrice()))
.build();
ebikeOrderDetailService.save(orderDetail);
}
@Transactional