From 6d363b7c50cb9186cb8d85d9c44eee2eb8b48e88 Mon Sep 17 00:00:00 2001 From: hu177768073 <177768073@qq.com> Date: Wed, 9 Oct 2024 10:51:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8A=A0=E6=B2=B9=E7=BB=93?= =?UTF-8?q?=E7=AE=97=E5=85=AC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bweb/controller/BsGasOrderController.java | 14 ++ .../hfkj/dao/BsAgentMerAccountMapperExt.java | 6 +- .../java/com/hfkj/dao/BsGasOrderMapper.java | 24 ++-- .../com/hfkj/dao/BsGasOrderSqlProvider.java | 28 ++++ .../main/java/com/hfkj/entity/BsGasOrder.java | 32 +++++ .../com/hfkj/entity/BsGasOrderExample.java | 120 ++++++++++++++++++ .../hfkj/model/order/ExportGasOrderModel.java | 14 +- .../service/order/OrderCancelService.java | 4 +- .../service/order/OrderCreateService.java | 24 +++- .../service/order/OrderPaySuccessService.java | 6 +- .../service/order/OrderRefundBusiness.java | 8 +- 11 files changed, 255 insertions(+), 25 deletions(-) diff --git a/bweb/src/main/java/com/bweb/controller/BsGasOrderController.java b/bweb/src/main/java/com/bweb/controller/BsGasOrderController.java index b7e7cc6..16d2a84 100644 --- a/bweb/src/main/java/com/bweb/controller/BsGasOrderController.java +++ b/bweb/src/main/java/com/bweb/controller/BsGasOrderController.java @@ -299,8 +299,11 @@ public class BsGasOrderController { model.setGasOilNo(gasOrder.getGasOilNo() + "#"); model.setGasGunNo(gasOrder.getGasGunNo() + "号枪"); model.setGasPricePlatform(gasOrder.getGasPricePlatform()); + model.setGasPriceVip(gasOrder.getGasPriceVip()); model.setGasPriceGun(gasOrder.getGasPriceGun()); model.setGasPriceOfficial(gasOrder.getGasPriceOfficial()); + model.setGasSettlePrice(gasOrder.getGasSettlePrice()); + model.setGasAgentSettlePrice(gasOrder.getGasAgentSettlePrice()); model.setPayTypeName(gasOrder.getPayType()!=null? OrderPayTypeEnum.getDataByType(gasOrder.getPayType()).getName():"未支付"); model.setTotalDeductionPrice(gasOrder.getTotalDeductionPrice()); model.setDeductionCouponPrice(gasOrder.getDeductionCouponPrice()); @@ -334,6 +337,7 @@ public class BsGasOrderController { includeColumnFiledNames.add("gasGunNo"); includeColumnFiledNames.add("gasDiscount"); includeColumnFiledNames.add("gasPricePlatform"); + includeColumnFiledNames.add("gasPriceVip"); includeColumnFiledNames.add("gasPriceGun"); includeColumnFiledNames.add("gasPriceOfficial"); includeColumnFiledNames.add("payTypeName"); @@ -360,29 +364,39 @@ public class BsGasOrderController { includeColumnFiledNames.add("channelType"); includeColumnFiledNames.add("channelOrderNo"); includeColumnFiledNames.add("userPhone"); + includeColumnFiledNames.add("gasSettlePrice"); + includeColumnFiledNames.add("gasAgentSettlePrice"); } else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type2.getCode()) ) { includeColumnFiledNames.add("userPhone"); includeColumnFiledNames.add("gasStaffName"); + } else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type3.getCode()) ) { includeColumnFiledNames.add("userPhone"); + } else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type4.getCode()) ) { includeColumnFiledNames.add("agentStaffName"); includeColumnFiledNames.add("merName"); includeColumnFiledNames.add("channelType"); includeColumnFiledNames.add("channelOrderNo"); + includeColumnFiledNames.add("gasSettlePrice"); + includeColumnFiledNames.add("gasAgentSettlePrice"); } else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type5.getCode()) ) { includeColumnFiledNames.add("merName"); includeColumnFiledNames.add("channelType"); includeColumnFiledNames.add("channelOrderNo"); + includeColumnFiledNames.add("gasSettlePrice"); + includeColumnFiledNames.add("gasAgentSettlePrice"); } else if (sessionObject.getAccount().getObjectType().equals(SecUserObjectTypeEnum.type6.getCode()) ) { includeColumnFiledNames.add("merName"); includeColumnFiledNames.add("userPhone"); includeColumnFiledNames.add("gasStaffName"); + includeColumnFiledNames.add("gasSettlePrice"); + includeColumnFiledNames.add("gasAgentSettlePrice"); } EasyExcel.write(fileUrl+pathName) diff --git a/service/src/main/java/com/hfkj/dao/BsAgentMerAccountMapperExt.java b/service/src/main/java/com/hfkj/dao/BsAgentMerAccountMapperExt.java index 61e8bb6..49851bc 100644 --- a/service/src/main/java/com/hfkj/dao/BsAgentMerAccountMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/BsAgentMerAccountMapperExt.java @@ -19,12 +19,14 @@ public interface BsAgentMerAccountMapperExt { " b.mer_no merNo," + " b.mer_name merName," + " b.address," + - " a.amount " + + " a.amount," + + " c.amount merAmount " + " FROM" + " bs_agent_mer_account a" + " LEFT JOIN bs_merchant b ON a.mer_no = b.mer_no" + + " LEFT JOIN bs_merchant_account c on c.mer_id = b.id" + " where 1 = 1 and a.status = 1" + - " and mer_id in (select mer_id from bs_agent_mer where agent_staff_id = #{param.agentStaffId} and `status` = 1) " + + " and a.mer_id in (select mer_id from bs_agent_mer where agent_staff_id = #{param.agentStaffId} and `status` = 1) " + " and b.province_code = #{param.provinceCode} " + " and b.city_code = #{param.cityCode} " + " and b.area_code = #{param.areaCode} " + diff --git a/service/src/main/java/com/hfkj/dao/BsGasOrderMapper.java b/service/src/main/java/com/hfkj/dao/BsGasOrderMapper.java index 74fb1e5..1380131 100644 --- a/service/src/main/java/com/hfkj/dao/BsGasOrderMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsGasOrderMapper.java @@ -50,6 +50,7 @@ public interface BsGasOrderMapper extends BsGasOrderMapperExt { "deduction_coupon_price, deduction_oil_price, ", "pay_integral, payable_price, ", "actual_pay_price, gas_refuel_price, ", + "gas_settle_price, gas_agent_settle_price, ", "gas_service_fee_rate, gas_service_fee_price, ", "gas_oil_no, gas_gun_no, ", "gas_oil_type, gas_price_official, ", @@ -80,6 +81,7 @@ public interface BsGasOrderMapper extends BsGasOrderMapperExt { "#{deductionCouponPrice,jdbcType=DECIMAL}, #{deductionOilPrice,jdbcType=DECIMAL}, ", "#{payIntegral,jdbcType=BIGINT}, #{payablePrice,jdbcType=DECIMAL}, ", "#{actualPayPrice,jdbcType=DECIMAL}, #{gasRefuelPrice,jdbcType=DECIMAL}, ", + "#{gasSettlePrice,jdbcType=DECIMAL}, #{gasAgentSettlePrice,jdbcType=DECIMAL}, ", "#{gasServiceFeeRate,jdbcType=DECIMAL}, #{gasServiceFeePrice,jdbcType=DECIMAL}, ", "#{gasOilNo,jdbcType=VARCHAR}, #{gasGunNo,jdbcType=VARCHAR}, ", "#{gasOilType,jdbcType=INTEGER}, #{gasPriceOfficial,jdbcType=DECIMAL}, ", @@ -133,6 +135,8 @@ public interface BsGasOrderMapper extends BsGasOrderMapperExt { @Result(column="payable_price", property="payablePrice", jdbcType=JdbcType.DECIMAL), @Result(column="actual_pay_price", property="actualPayPrice", jdbcType=JdbcType.DECIMAL), @Result(column="gas_refuel_price", property="gasRefuelPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="gas_settle_price", property="gasSettlePrice", jdbcType=JdbcType.DECIMAL), + @Result(column="gas_agent_settle_price", property="gasAgentSettlePrice", jdbcType=JdbcType.DECIMAL), @Result(column="gas_service_fee_rate", property="gasServiceFeeRate", jdbcType=JdbcType.DECIMAL), @Result(column="gas_service_fee_price", property="gasServiceFeePrice", jdbcType=JdbcType.DECIMAL), @Result(column="gas_oil_no", property="gasOilNo", jdbcType=JdbcType.VARCHAR), @@ -181,14 +185,14 @@ public interface BsGasOrderMapper extends BsGasOrderMapperExt { "agent_staff_id, agent_staff_name, user_id, user_phone, mer_chain_brand_id, mer_chain_brand_name, ", "mer_id, mer_no, mer_name, mer_address, total_deduction_price, deduction_coupon_price, ", "deduction_oil_price, pay_integral, payable_price, actual_pay_price, gas_refuel_price, ", - "gas_service_fee_rate, gas_service_fee_price, gas_oil_no, gas_gun_no, gas_oil_type, ", - "gas_price_official, gas_price_gun, gas_price_vip, gas_price_platform, gas_price_cost, ", - "gas_oil_liters, gas_discount, gas_oil_subsidy, gas_liters_preferences, gas_price_preferences, ", - "gas_class_group_id, gas_class_group_name, gas_class_group_task_id, gas_staff_id, ", - "gas_staff_name, receipt_status, receipt_fail_remark, pay_type, pay_serial_no, ", - "pay_channel_order_no, `status`, create_time, cancel_time, pay_time, refund_time, ", - "refund_remarks, abnormal, abnormal_content, ext_1, ext_2, ext_3, ext_4, ext_5, ", - "ext_6", + "gas_settle_price, gas_agent_settle_price, gas_service_fee_rate, gas_service_fee_price, ", + "gas_oil_no, gas_gun_no, gas_oil_type, gas_price_official, gas_price_gun, gas_price_vip, ", + "gas_price_platform, gas_price_cost, gas_oil_liters, gas_discount, gas_oil_subsidy, ", + "gas_liters_preferences, gas_price_preferences, gas_class_group_id, gas_class_group_name, ", + "gas_class_group_task_id, gas_staff_id, gas_staff_name, receipt_status, receipt_fail_remark, ", + "pay_type, pay_serial_no, pay_channel_order_no, `status`, create_time, cancel_time, ", + "pay_time, refund_time, refund_remarks, abnormal, abnormal_content, ext_1, ext_2, ", + "ext_3, ext_4, ext_5, ext_6", "from bs_gas_order", "where id = #{id,jdbcType=BIGINT}" }) @@ -217,6 +221,8 @@ public interface BsGasOrderMapper extends BsGasOrderMapperExt { @Result(column="payable_price", property="payablePrice", jdbcType=JdbcType.DECIMAL), @Result(column="actual_pay_price", property="actualPayPrice", jdbcType=JdbcType.DECIMAL), @Result(column="gas_refuel_price", property="gasRefuelPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="gas_settle_price", property="gasSettlePrice", jdbcType=JdbcType.DECIMAL), + @Result(column="gas_agent_settle_price", property="gasAgentSettlePrice", jdbcType=JdbcType.DECIMAL), @Result(column="gas_service_fee_rate", property="gasServiceFeeRate", jdbcType=JdbcType.DECIMAL), @Result(column="gas_service_fee_price", property="gasServiceFeePrice", jdbcType=JdbcType.DECIMAL), @Result(column="gas_oil_no", property="gasOilNo", jdbcType=JdbcType.VARCHAR), @@ -293,6 +299,8 @@ public interface BsGasOrderMapper extends BsGasOrderMapperExt { "payable_price = #{payablePrice,jdbcType=DECIMAL},", "actual_pay_price = #{actualPayPrice,jdbcType=DECIMAL},", "gas_refuel_price = #{gasRefuelPrice,jdbcType=DECIMAL},", + "gas_settle_price = #{gasSettlePrice,jdbcType=DECIMAL},", + "gas_agent_settle_price = #{gasAgentSettlePrice,jdbcType=DECIMAL},", "gas_service_fee_rate = #{gasServiceFeeRate,jdbcType=DECIMAL},", "gas_service_fee_price = #{gasServiceFeePrice,jdbcType=DECIMAL},", "gas_oil_no = #{gasOilNo,jdbcType=VARCHAR},", diff --git a/service/src/main/java/com/hfkj/dao/BsGasOrderSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsGasOrderSqlProvider.java index 7f2deaf..8d13f7c 100644 --- a/service/src/main/java/com/hfkj/dao/BsGasOrderSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsGasOrderSqlProvider.java @@ -120,6 +120,14 @@ public class BsGasOrderSqlProvider { sql.VALUES("gas_refuel_price", "#{gasRefuelPrice,jdbcType=DECIMAL}"); } + if (record.getGasSettlePrice() != null) { + sql.VALUES("gas_settle_price", "#{gasSettlePrice,jdbcType=DECIMAL}"); + } + + if (record.getGasAgentSettlePrice() != null) { + sql.VALUES("gas_agent_settle_price", "#{gasAgentSettlePrice,jdbcType=DECIMAL}"); + } + if (record.getGasServiceFeeRate() != null) { sql.VALUES("gas_service_fee_rate", "#{gasServiceFeeRate,jdbcType=DECIMAL}"); } @@ -309,6 +317,8 @@ public class BsGasOrderSqlProvider { sql.SELECT("payable_price"); sql.SELECT("actual_pay_price"); sql.SELECT("gas_refuel_price"); + sql.SELECT("gas_settle_price"); + sql.SELECT("gas_agent_settle_price"); sql.SELECT("gas_service_fee_rate"); sql.SELECT("gas_service_fee_price"); sql.SELECT("gas_oil_no"); @@ -461,6 +471,14 @@ public class BsGasOrderSqlProvider { sql.SET("gas_refuel_price = #{record.gasRefuelPrice,jdbcType=DECIMAL}"); } + if (record.getGasSettlePrice() != null) { + sql.SET("gas_settle_price = #{record.gasSettlePrice,jdbcType=DECIMAL}"); + } + + if (record.getGasAgentSettlePrice() != null) { + sql.SET("gas_agent_settle_price = #{record.gasAgentSettlePrice,jdbcType=DECIMAL}"); + } + if (record.getGasServiceFeeRate() != null) { sql.SET("gas_service_fee_rate = #{record.gasServiceFeeRate,jdbcType=DECIMAL}"); } @@ -649,6 +667,8 @@ public class BsGasOrderSqlProvider { sql.SET("payable_price = #{record.payablePrice,jdbcType=DECIMAL}"); sql.SET("actual_pay_price = #{record.actualPayPrice,jdbcType=DECIMAL}"); sql.SET("gas_refuel_price = #{record.gasRefuelPrice,jdbcType=DECIMAL}"); + sql.SET("gas_settle_price = #{record.gasSettlePrice,jdbcType=DECIMAL}"); + sql.SET("gas_agent_settle_price = #{record.gasAgentSettlePrice,jdbcType=DECIMAL}"); sql.SET("gas_service_fee_rate = #{record.gasServiceFeeRate,jdbcType=DECIMAL}"); sql.SET("gas_service_fee_price = #{record.gasServiceFeePrice,jdbcType=DECIMAL}"); sql.SET("gas_oil_no = #{record.gasOilNo,jdbcType=VARCHAR}"); @@ -790,6 +810,14 @@ public class BsGasOrderSqlProvider { sql.SET("gas_refuel_price = #{gasRefuelPrice,jdbcType=DECIMAL}"); } + if (record.getGasSettlePrice() != null) { + sql.SET("gas_settle_price = #{gasSettlePrice,jdbcType=DECIMAL}"); + } + + if (record.getGasAgentSettlePrice() != null) { + sql.SET("gas_agent_settle_price = #{gasAgentSettlePrice,jdbcType=DECIMAL}"); + } + if (record.getGasServiceFeeRate() != null) { sql.SET("gas_service_fee_rate = #{gasServiceFeeRate,jdbcType=DECIMAL}"); } diff --git a/service/src/main/java/com/hfkj/entity/BsGasOrder.java b/service/src/main/java/com/hfkj/entity/BsGasOrder.java index c5ecddf..8db0573 100644 --- a/service/src/main/java/com/hfkj/entity/BsGasOrder.java +++ b/service/src/main/java/com/hfkj/entity/BsGasOrder.java @@ -134,6 +134,16 @@ public class BsGasOrder implements Serializable { */ private BigDecimal gasRefuelPrice; + /** + * 【加油站】油站结算金额 + */ + private BigDecimal gasSettlePrice; + + /** + * 【加油站】代理商结算金额 + */ + private BigDecimal gasAgentSettlePrice; + /** * 【加油站】加油服务费比例 */ @@ -511,6 +521,22 @@ public class BsGasOrder implements Serializable { this.gasRefuelPrice = gasRefuelPrice; } + public BigDecimal getGasSettlePrice() { + return gasSettlePrice; + } + + public void setGasSettlePrice(BigDecimal gasSettlePrice) { + this.gasSettlePrice = gasSettlePrice; + } + + public BigDecimal getGasAgentSettlePrice() { + return gasAgentSettlePrice; + } + + public void setGasAgentSettlePrice(BigDecimal gasAgentSettlePrice) { + this.gasAgentSettlePrice = gasAgentSettlePrice; + } + public BigDecimal getGasServiceFeeRate() { return gasServiceFeeRate; } @@ -859,6 +885,8 @@ public class BsGasOrder implements Serializable { && (this.getPayablePrice() == null ? other.getPayablePrice() == null : this.getPayablePrice().equals(other.getPayablePrice())) && (this.getActualPayPrice() == null ? other.getActualPayPrice() == null : this.getActualPayPrice().equals(other.getActualPayPrice())) && (this.getGasRefuelPrice() == null ? other.getGasRefuelPrice() == null : this.getGasRefuelPrice().equals(other.getGasRefuelPrice())) + && (this.getGasSettlePrice() == null ? other.getGasSettlePrice() == null : this.getGasSettlePrice().equals(other.getGasSettlePrice())) + && (this.getGasAgentSettlePrice() == null ? other.getGasAgentSettlePrice() == null : this.getGasAgentSettlePrice().equals(other.getGasAgentSettlePrice())) && (this.getGasServiceFeeRate() == null ? other.getGasServiceFeeRate() == null : this.getGasServiceFeeRate().equals(other.getGasServiceFeeRate())) && (this.getGasServiceFeePrice() == null ? other.getGasServiceFeePrice() == null : this.getGasServiceFeePrice().equals(other.getGasServiceFeePrice())) && (this.getGasOilNo() == null ? other.getGasOilNo() == null : this.getGasOilNo().equals(other.getGasOilNo())) @@ -928,6 +956,8 @@ public class BsGasOrder implements Serializable { result = prime * result + ((getPayablePrice() == null) ? 0 : getPayablePrice().hashCode()); result = prime * result + ((getActualPayPrice() == null) ? 0 : getActualPayPrice().hashCode()); result = prime * result + ((getGasRefuelPrice() == null) ? 0 : getGasRefuelPrice().hashCode()); + result = prime * result + ((getGasSettlePrice() == null) ? 0 : getGasSettlePrice().hashCode()); + result = prime * result + ((getGasAgentSettlePrice() == null) ? 0 : getGasAgentSettlePrice().hashCode()); result = prime * result + ((getGasServiceFeeRate() == null) ? 0 : getGasServiceFeeRate().hashCode()); result = prime * result + ((getGasServiceFeePrice() == null) ? 0 : getGasServiceFeePrice().hashCode()); result = prime * result + ((getGasOilNo() == null) ? 0 : getGasOilNo().hashCode()); @@ -1000,6 +1030,8 @@ public class BsGasOrder implements Serializable { sb.append(", payablePrice=").append(payablePrice); sb.append(", actualPayPrice=").append(actualPayPrice); sb.append(", gasRefuelPrice=").append(gasRefuelPrice); + sb.append(", gasSettlePrice=").append(gasSettlePrice); + sb.append(", gasAgentSettlePrice=").append(gasAgentSettlePrice); sb.append(", gasServiceFeeRate=").append(gasServiceFeeRate); sb.append(", gasServiceFeePrice=").append(gasServiceFeePrice); sb.append(", gasOilNo=").append(gasOilNo); diff --git a/service/src/main/java/com/hfkj/entity/BsGasOrderExample.java b/service/src/main/java/com/hfkj/entity/BsGasOrderExample.java index b935b80..e09c63b 100644 --- a/service/src/main/java/com/hfkj/entity/BsGasOrderExample.java +++ b/service/src/main/java/com/hfkj/entity/BsGasOrderExample.java @@ -1666,6 +1666,126 @@ public class BsGasOrderExample { return (Criteria) this; } + public Criteria andGasSettlePriceIsNull() { + addCriterion("gas_settle_price is null"); + return (Criteria) this; + } + + public Criteria andGasSettlePriceIsNotNull() { + addCriterion("gas_settle_price is not null"); + return (Criteria) this; + } + + public Criteria andGasSettlePriceEqualTo(BigDecimal value) { + addCriterion("gas_settle_price =", value, "gasSettlePrice"); + return (Criteria) this; + } + + public Criteria andGasSettlePriceNotEqualTo(BigDecimal value) { + addCriterion("gas_settle_price <>", value, "gasSettlePrice"); + return (Criteria) this; + } + + public Criteria andGasSettlePriceGreaterThan(BigDecimal value) { + addCriterion("gas_settle_price >", value, "gasSettlePrice"); + return (Criteria) this; + } + + public Criteria andGasSettlePriceGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("gas_settle_price >=", value, "gasSettlePrice"); + return (Criteria) this; + } + + public Criteria andGasSettlePriceLessThan(BigDecimal value) { + addCriterion("gas_settle_price <", value, "gasSettlePrice"); + return (Criteria) this; + } + + public Criteria andGasSettlePriceLessThanOrEqualTo(BigDecimal value) { + addCriterion("gas_settle_price <=", value, "gasSettlePrice"); + return (Criteria) this; + } + + public Criteria andGasSettlePriceIn(List values) { + addCriterion("gas_settle_price in", values, "gasSettlePrice"); + return (Criteria) this; + } + + public Criteria andGasSettlePriceNotIn(List values) { + addCriterion("gas_settle_price not in", values, "gasSettlePrice"); + return (Criteria) this; + } + + public Criteria andGasSettlePriceBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("gas_settle_price between", value1, value2, "gasSettlePrice"); + return (Criteria) this; + } + + public Criteria andGasSettlePriceNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("gas_settle_price not between", value1, value2, "gasSettlePrice"); + return (Criteria) this; + } + + public Criteria andGasAgentSettlePriceIsNull() { + addCriterion("gas_agent_settle_price is null"); + return (Criteria) this; + } + + public Criteria andGasAgentSettlePriceIsNotNull() { + addCriterion("gas_agent_settle_price is not null"); + return (Criteria) this; + } + + public Criteria andGasAgentSettlePriceEqualTo(BigDecimal value) { + addCriterion("gas_agent_settle_price =", value, "gasAgentSettlePrice"); + return (Criteria) this; + } + + public Criteria andGasAgentSettlePriceNotEqualTo(BigDecimal value) { + addCriterion("gas_agent_settle_price <>", value, "gasAgentSettlePrice"); + return (Criteria) this; + } + + public Criteria andGasAgentSettlePriceGreaterThan(BigDecimal value) { + addCriterion("gas_agent_settle_price >", value, "gasAgentSettlePrice"); + return (Criteria) this; + } + + public Criteria andGasAgentSettlePriceGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("gas_agent_settle_price >=", value, "gasAgentSettlePrice"); + return (Criteria) this; + } + + public Criteria andGasAgentSettlePriceLessThan(BigDecimal value) { + addCriterion("gas_agent_settle_price <", value, "gasAgentSettlePrice"); + return (Criteria) this; + } + + public Criteria andGasAgentSettlePriceLessThanOrEqualTo(BigDecimal value) { + addCriterion("gas_agent_settle_price <=", value, "gasAgentSettlePrice"); + return (Criteria) this; + } + + public Criteria andGasAgentSettlePriceIn(List values) { + addCriterion("gas_agent_settle_price in", values, "gasAgentSettlePrice"); + return (Criteria) this; + } + + public Criteria andGasAgentSettlePriceNotIn(List values) { + addCriterion("gas_agent_settle_price not in", values, "gasAgentSettlePrice"); + return (Criteria) this; + } + + public Criteria andGasAgentSettlePriceBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("gas_agent_settle_price between", value1, value2, "gasAgentSettlePrice"); + return (Criteria) this; + } + + public Criteria andGasAgentSettlePriceNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("gas_agent_settle_price not between", value1, value2, "gasAgentSettlePrice"); + return (Criteria) this; + } + public Criteria andGasServiceFeeRateIsNull() { addCriterion("gas_service_fee_rate is null"); return (Criteria) this; diff --git a/service/src/main/java/com/hfkj/model/order/ExportGasOrderModel.java b/service/src/main/java/com/hfkj/model/order/ExportGasOrderModel.java index 301158d..b8f30ef 100644 --- a/service/src/main/java/com/hfkj/model/order/ExportGasOrderModel.java +++ b/service/src/main/java/com/hfkj/model/order/ExportGasOrderModel.java @@ -72,6 +72,10 @@ public class ExportGasOrderModel { @ExcelProperty({ "加油信息", "平台价"}) private BigDecimal gasPricePlatform; + @ColumnWidth(10) + @ExcelProperty({ "加油信息", "优惠价"}) + private BigDecimal gasPriceVip; + @ColumnWidth(10) @ExcelProperty({ "加油信息", "油站价"}) private BigDecimal gasPriceGun; @@ -105,7 +109,15 @@ public class ExportGasOrderModel { private BigDecimal payIntegral; @ColumnWidth(15) - @ExcelProperty({ "支付信息", "实付金额"}) + @ExcelProperty({ "支付信息", "油站结算"}) + private BigDecimal gasSettlePrice; + + @ColumnWidth(15) + @ExcelProperty({ "支付信息", "代理商结算"}) + private BigDecimal gasAgentSettlePrice; + + @ColumnWidth(15) + @ExcelProperty({ "支付信息", "用户实付"}) private String payPrice; @ColumnWidth(15) diff --git a/service/src/main/java/com/hfkj/service/order/OrderCancelService.java b/service/src/main/java/com/hfkj/service/order/OrderCancelService.java index 02034c1..f8da651 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderCancelService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderCancelService.java @@ -81,8 +81,8 @@ public class OrderCancelService { Map param = new HashMap<>(); param.put("sourceType", MerchantAccountRecordSourceTypeEnum.type4.getType()); param.put("sourceOrderNo", gasOrder.getOrderNo()); - param.put("sourceOrderContent", "取消加油订单:"+gasOrder.getOrderNo()+",金额:¥" + gasOrder.getGasRefuelPrice()); - agentMerAccountService.orderCancel(gasOrder.getAgentId(), gasOrder.getMerNo(), gasOrder.getGasRefuelPrice(), param); + param.put("sourceOrderContent", "取消加油订单:"+gasOrder.getOrderNo()); + agentMerAccountService.orderCancel(gasOrder.getAgentId(), gasOrder.getMerNo(), gasOrder.getGasAgentSettlePrice(), param); } } catch (BaseException e) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, e.getErrorMsg()); 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 c8208f0..6a01f75 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java @@ -108,6 +108,11 @@ public class OrderCreateService { gasOrder.setMerAddress(merchant.getAddress()); gasOrder.setStatus(OrderOilStatus.STATUS1.getNumber()); gasOrder.setReceiptStatus(GasOrderReceiptStatusEnum.status0.getStatus()); + gasOrder.setGasSettlePrice(new BigDecimal("0")); + gasOrder.setGasAgentSettlePrice(new BigDecimal("0")); + + // 计算价格 + GasPayPriceModel priceModel = gasService.refuelPriceCompute(orderChild.getProductPrice(), merchant.getMerNo(), orderChild.getGasOilNo(), orderChild.getAgentMerId(), orderDeduction.getUserCouponDiscountId()); // 代理、业务员 if (orderChild.getAgentMerId() != null) { @@ -122,8 +127,14 @@ public class OrderCreateService { Map param = new HashMap<>(); param.put("sourceType", MerchantAccountRecordSourceTypeEnum.type2.getType()); param.put("sourceOrderNo", gasOrder.getOrderNo()); - param.put("sourceOrderContent", "创建加油订单:"+gasOrder.getOrderNo()+",加油金额:¥" +orderChild.getProductPrice()); - agentMerAccountService.consume(agentMer.getAgentId(), agentMer.getMerNo(), orderChild.getProductPrice(), param); + param.put("sourceOrderContent", "创建加油订单:"+gasOrder.getOrderNo()); + // 代理商余额扣除公式 1. 加油升数 * (油枪价 - (优惠价 * 代理折扣)) = 优惠金额 2. 加油金额 - 优惠金额 = 扣款金额 + BigDecimal aasAgentSettlePrice = priceModel.getOilingPrice().subtract( + // 优惠金额 + priceModel.getOilLiters().multiply(priceModel.getPriceGun().subtract(priceModel.getPricePlatform())) + ); + gasOrder.setGasAgentSettlePrice(aasAgentSettlePrice); + agentMerAccountService.consume(agentMer.getAgentId(), agentMer.getMerNo(), gasOrder.getGasAgentSettlePrice(), param); } } catch (BaseException e) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, e.getErrorMsg()); @@ -136,15 +147,18 @@ public class OrderCreateService { gasOrder.setAgentStaffName(agentMer.getAgentStaffName()); } - // 计算价格 - 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); gasOrder.setDeductionCouponPrice(priceModel.getDeductionCouponPrice()); gasOrder.setDeductionOilPrice(priceModel.getDeductionOilPrice()); gasOrder.setGasServiceFeeRate(priceModel.getServiceFeeRate()); gasOrder.setGasServiceFeePrice(priceModel.getServiceFeePrice()); gasOrder.setTotalDeductionPrice(priceModel.getTotalPreferences()); - gasOrder.setPayablePrice(priceModel.getPayPrice()); gasOrder.setPayablePrice(gasOrder.getPayablePrice().compareTo(new BigDecimal("0"))>=0?gasOrder.getPayablePrice():new BigDecimal("0")); diff --git a/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java b/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java index d0c647d..76a9ac7 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java @@ -103,7 +103,7 @@ public class OrderPaySuccessService { consumeMap.put("sourceType", MerchantAccountRecordSourceTypeEnum.type2.getType()); consumeMap.put("sourceId", gasOrder.getId()); consumeMap.put("sourceOrderNo", gasOrder.getOrderNo()); - merchantChainBrandAccountService.consume(merchant.getChainBrandId(), gasOrder.getMerNo(), gasOrder.getGasRefuelPrice(), consumeMap); + merchantChainBrandAccountService.consume(merchant.getChainBrandId(), gasOrder.getMerNo(), gasOrder.getGasSettlePrice(), consumeMap); } else if (merchant.getChainBrandSettleType().equals(MerchantChainBrandSettleTypeEnum.type2.getNumber())) { // 商户额度 @@ -111,7 +111,7 @@ public class OrderPaySuccessService { consumeMap.put("sourceType", MerchantAccountRecordSourceTypeEnum.type2.getType()); consumeMap.put("sourceId", gasOrder.getId()); consumeMap.put("sourceOrderNo", gasOrder.getOrderNo()); - merchantAccountService.consume(gasOrder.getMerNo(), gasOrder.getGasRefuelPrice(), consumeMap); + merchantAccountService.consume(gasOrder.getMerNo(), gasOrder.getGasSettlePrice(), consumeMap); } } else { // 商户额度 @@ -119,7 +119,7 @@ public class OrderPaySuccessService { consumeMap.put("sourceType", MerchantAccountRecordSourceTypeEnum.type2.getType()); consumeMap.put("sourceId", gasOrder.getId()); consumeMap.put("sourceOrderNo", gasOrder.getOrderNo()); - merchantAccountService.consume(gasOrder.getMerNo(), gasOrder.getGasRefuelPrice(), consumeMap); + merchantAccountService.consume(gasOrder.getMerNo(), gasOrder.getGasSettlePrice(), consumeMap); } } diff --git a/service/src/main/java/com/hfkj/service/order/OrderRefundBusiness.java b/service/src/main/java/com/hfkj/service/order/OrderRefundBusiness.java index 04914be..48fbbc7 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderRefundBusiness.java +++ b/service/src/main/java/com/hfkj/service/order/OrderRefundBusiness.java @@ -113,7 +113,7 @@ public class OrderRefundBusiness { if (gasOrder.getAgentId() != null && MerchantSourceTypeEnum.type1.getNumber().equals(gasOrder.getChannelType())) { try { // 代理商商户账户退款 - agentMerAccountService.refund(gasOrder.getAgentId(), gasOrder.getMerNo(), gasOrder.getGasRefuelPrice(), refund); + agentMerAccountService.refund(gasOrder.getAgentId(), gasOrder.getMerNo(), gasOrder.getGasAgentSettlePrice(), refund); } catch (BaseException e) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, e.getErrorMsg()); @@ -131,14 +131,14 @@ public class OrderRefundBusiness { BsMerchant merchant = merchantService.getMerchant(gasOrder.getMerNo()); if (MerchantChainBrandSettleTypeEnum.type1.getNumber().equals(merchant.getChainBrandSettleType())) { // 退回连锁额度 - merchantChainBrandAccountService.refund(gasOrder.getMerChainBrandId(), merchant.getMerNo(), gasOrder.getGasRefuelPrice(), refund); + merchantChainBrandAccountService.refund(gasOrder.getMerChainBrandId(), merchant.getMerNo(), gasOrder.getGasSettlePrice(), refund); } else { // 退回商户额度 - merchantAccountService.refund(gasOrder.getMerNo(), gasOrder.getGasRefuelPrice(), refund); + merchantAccountService.refund(gasOrder.getMerNo(), gasOrder.getGasSettlePrice(), refund); } } else { // 退回商户额度 - merchantAccountService.refund(gasOrder.getMerNo(), gasOrder.getGasRefuelPrice(), refund); + merchantAccountService.refund(gasOrder.getMerNo(), gasOrder.getGasSettlePrice(), refund); } } else if (gasOrder.getChannelType().equals(MerchantSourceTypeEnum.type2.getNumber())) { // 请求团油渠道退款