From 97a2277041e56c1c55bb0d3f5ce75a4f096ab6f3 Mon Sep 17 00:00:00 2001 From: hu177768073 <177768073@qq.com> Date: Tue, 15 Oct 2024 19:18:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/gas/impl/BsGasServiceImpl.java | 4 +-- .../service/order/OrderCreateService.java | 25 +++++++++++-------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/service/src/main/java/com/hfkj/service/gas/impl/BsGasServiceImpl.java b/service/src/main/java/com/hfkj/service/gas/impl/BsGasServiceImpl.java index 826320a..da2499b 100644 --- a/service/src/main/java/com/hfkj/service/gas/impl/BsGasServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/gas/impl/BsGasServiceImpl.java @@ -168,8 +168,8 @@ public class BsGasServiceImpl implements BsGasService { // 平台价 payPriceModel.setPricePlatform(pricePlatform); - // 加油升数,计算方式:加油金额 / 国标价 - payPriceModel.setOilLiters(refuelPrice.divide(priceGun, 2, BigDecimal.ROUND_HALF_DOWN)); + // 加油升数,计算方式:加油金额 / 油枪价 + payPriceModel.setOilLiters(refuelPrice.divide(priceGun, 2, BigDecimal.ROUND_HALF_UP)); // 平台折扣,我们平台或者代理商设置的折扣 payPriceModel.setDiscount(discount.compareTo(new BigDecimal("1.00")) == 0 ? new BigDecimal("1.00") : discount); diff --git a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java index 6a01f75..89d053b 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java @@ -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());