提交代码

dev
胡锐 3 weeks ago
parent 6d363b7c50
commit 97a2277041
  1. 4
      service/src/main/java/com/hfkj/service/gas/impl/BsGasServiceImpl.java
  2. 25
      service/src/main/java/com/hfkj/service/order/OrderCreateService.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);

@ -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());

Loading…
Cancel
Save