|
|
|
@ -114,6 +114,13 @@ public class OrderCreateService { |
|
|
|
|
// 计算价格
|
|
|
|
|
GasPayPriceModel priceModel = gasService.refuelPriceCompute(orderChild.getProductPrice(), merchant.getMerNo(), orderChild.getGasOilNo(), orderChild.getAgentMerId(), orderDeduction.getUserCouponDiscountId()); |
|
|
|
|
|
|
|
|
|
// 油站结算 公式 1. 加油升数 * (油枪价 - 优惠价) = 优惠金额 2. 加油金额 - 优惠金额 = 扣款金额
|
|
|
|
|
BigDecimal gasSettlePrice = priceModel.getOilingPrice().subtract( |
|
|
|
|
// 优惠金额
|
|
|
|
|
priceModel.getOilLiters().multiply(priceModel.getPriceGun().subtract(priceModel.getPriceVip())) |
|
|
|
|
); |
|
|
|
|
gasOrder.setGasSettlePrice(gasSettlePrice); |
|
|
|
|
|
|
|
|
|
// 代理、业务员
|
|
|
|
|
if (orderChild.getAgentMerId() != null) { |
|
|
|
|
// 查询代理
|
|
|
|
@ -128,10 +135,13 @@ public class OrderCreateService { |
|
|
|
|
param.put("sourceType", MerchantAccountRecordSourceTypeEnum.type2.getType()); |
|
|
|
|
param.put("sourceOrderNo", gasOrder.getOrderNo()); |
|
|
|
|
param.put("sourceOrderContent", "创建加油订单:"+gasOrder.getOrderNo()); |
|
|
|
|
// 代理商余额扣除公式 1. 加油升数 * (油枪价 - (优惠价 * 代理折扣)) = 优惠金额 2. 加油金额 - 优惠金额 = 扣款金额
|
|
|
|
|
BigDecimal aasAgentSettlePrice = priceModel.getOilingPrice().subtract( |
|
|
|
|
// 优惠金额
|
|
|
|
|
priceModel.getOilLiters().multiply(priceModel.getPriceGun().subtract(priceModel.getPricePlatform())) |
|
|
|
|
|
|
|
|
|
// 代理商结算公式
|
|
|
|
|
// 1. 加油升数 * (优惠价 -(优惠价 * 代理折扣)) = 优惠金额
|
|
|
|
|
// 2. 油站(扣款金额)结算 + 优惠金额 = 扣款金额
|
|
|
|
|
BigDecimal aasAgentSettlePrice = gasOrder.getGasSettlePrice().add( |
|
|
|
|
// 代理商优惠金额
|
|
|
|
|
priceModel.getOilLiters().multiply(priceModel.getPriceVip().subtract(priceModel.getPricePlatform())) |
|
|
|
|
); |
|
|
|
|
gasOrder.setGasAgentSettlePrice(aasAgentSettlePrice); |
|
|
|
|
agentMerAccountService.consume(agentMer.getAgentId(), agentMer.getMerNo(), gasOrder.getGasAgentSettlePrice(), param); |
|
|
|
@ -147,13 +157,6 @@ public class OrderCreateService { |
|
|
|
|
gasOrder.setAgentStaffName(agentMer.getAgentStaffName()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 油站结算 公式 1. 加油升数 * (油枪价 - 优惠价) = 优惠金额 2. 加油金额 - 优惠金额 = 扣款金额
|
|
|
|
|
BigDecimal gasSettlePrice = priceModel.getOilingPrice().subtract( |
|
|
|
|
// 优惠金额
|
|
|
|
|
priceModel.getOilLiters().multiply(priceModel.getPriceGun().subtract(priceModel.getPriceVip())) |
|
|
|
|
); |
|
|
|
|
gasOrder.setGasSettlePrice(gasSettlePrice); |
|
|
|
|
|
|
|
|
|
gasOrder.setDeductionCouponPrice(priceModel.getDeductionCouponPrice()); |
|
|
|
|
gasOrder.setDeductionOilPrice(priceModel.getDeductionOilPrice()); |
|
|
|
|
gasOrder.setGasServiceFeeRate(priceModel.getServiceFeeRate()); |
|
|
|
|