订单明细优惠金额
This commit is contained in:
parent
b7d3a0ef91
commit
c12cbc995f
@ -16,7 +16,8 @@ public enum EbikeOrderDetailType {
|
|||||||
OPERATION_AREA_DISPATCH_FEE(3, "运营区调度费用"),
|
OPERATION_AREA_DISPATCH_FEE(3, "运营区调度费用"),
|
||||||
OUT_OF_PARKING_AREA_FEE(4, "停车区外调度费用"),
|
OUT_OF_PARKING_AREA_FEE(4, "停车区外调度费用"),
|
||||||
NO_PARKING_ZONE_FEE(5, "禁停区调度费用"),
|
NO_PARKING_ZONE_FEE(5, "禁停区调度费用"),
|
||||||
HELMET_FEE(6, "头盔使用费用");
|
HELMET_FEE(6, "头盔使用费用"),
|
||||||
|
DISCOUNT_AMOUNT(7, "订单优惠金额");
|
||||||
|
|
||||||
private final Integer code;
|
private final Integer code;
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|||||||
@ -44,7 +44,7 @@ public class EbikeOrderDetail implements Serializable {
|
|||||||
private Long operatorId;
|
private Long operatorId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 费用类型:1-时长费用 2-起步费用 3-运营区调度费用 4-停车区外调度费用 5-禁停区调度费用 6-头盔使用费用
|
* 费用类型:1-时长费用 2-起步费用 3-运营区调度费用 4-停车区外调度费用 5-禁停区调度费用 6-头盔使用费用 7-优惠费用
|
||||||
*/
|
*/
|
||||||
private Integer detailType;
|
private Integer detailType;
|
||||||
|
|
||||||
|
|||||||
@ -194,4 +194,9 @@ public class EbikeOrderDetailVo {
|
|||||||
* 用户头盔费用
|
* 用户头盔费用
|
||||||
*/
|
*/
|
||||||
private BigDecimal userHelmetFee;
|
private BigDecimal userHelmetFee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠费用
|
||||||
|
*/
|
||||||
|
private BigDecimal discountAmount;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ public class EbikePaymentCostDetailVo implements Serializable {
|
|||||||
private Long detailId;
|
private Long detailId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 费用类型 1-时长费用 2-起步费用 3-运营区调度费用 4-停车区外调度费用 5-禁停区调度费用 6-头盔使用费用
|
* 费用类型 1-时长费用 2-起步费用 3-运营区调度费用 4-停车区外调度费用 5-禁停区调度费用 6-头盔使用费用 7-优惠费用
|
||||||
*/
|
*/
|
||||||
private Integer detailType;
|
private Integer detailType;
|
||||||
|
|
||||||
|
|||||||
@ -187,6 +187,10 @@ public class EbikeOrderServiceImpl extends ServiceImpl<EbikeOrderMapper, EbikeOr
|
|||||||
BigDecimal current = payDetailVo.getDetailAmount();
|
BigDecimal current = payDetailVo.getDetailAmount();
|
||||||
ebikeOrderDetailVo.setUserHelmetFee((current != null ? current : BigDecimal.ZERO));
|
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();
|
BigDecimal current = payDetailVo.getDetailAmount();
|
||||||
ebikeOrderDetailVo.setUserHelmetFee((current != null ? current : BigDecimal.ZERO));
|
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();
|
.update();
|
||||||
// 3 同步修改支付订单的cost_price(用于支付时的实际金额)
|
// 3 同步修改支付订单的cost_price(用于支付时的实际金额)
|
||||||
ebikePaymentService.updateCostPrice(ebikeOrder.getOrderId(), paymentAmountDto.getPrice());
|
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
|
@Transactional
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user