From 2c7b4c7bffd290bf2d35a30c68bc8567cc61ea4f Mon Sep 17 00:00:00 2001 From: hu177768073 <177768073@qq.com> Date: Fri, 3 Jan 2025 17:51:52 +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 --- .../bweb/controller/BsDiscountController.java | 2 + .../java/com/hfkj/dao/BsDiscountMapper.java | 41 +++++++------ .../com/hfkj/dao/BsDiscountSqlProvider.java | 14 +++++ .../com/hfkj/dao/BsDiscountUserMapper.java | 35 ++++++----- .../hfkj/dao/BsDiscountUserSqlProvider.java | 14 +++++ .../main/java/com/hfkj/entity/BsDiscount.java | 16 +++++ .../com/hfkj/entity/BsDiscountExample.java | 60 +++++++++++++++++++ .../java/com/hfkj/entity/BsDiscountUser.java | 16 +++++ .../hfkj/entity/BsDiscountUserExample.java | 60 +++++++++++++++++++ .../java/com/hfkj/model/GasPayPriceModel.java | 5 ++ .../service/gas/impl/BsGasServiceImpl.java | 13 ++-- 11 files changed, 238 insertions(+), 38 deletions(-) diff --git a/bweb/src/main/java/com/bweb/controller/BsDiscountController.java b/bweb/src/main/java/com/bweb/controller/BsDiscountController.java index bc79098..6754e30 100644 --- a/bweb/src/main/java/com/bweb/controller/BsDiscountController.java +++ b/bweb/src/main/java/com/bweb/controller/BsDiscountController.java @@ -48,6 +48,7 @@ public class BsDiscountController { if (StringUtils.isBlank(body.getString("discountName")) || body.getInteger("discountType") == null || body.getBigDecimal("discountPrice") == null + || body.getBoolean("overlayDiscount") == null || StringUtils.isBlank(body.getString("useScope")) || body.getInteger("receiveExpirationDate") == null || body.getLong("endTime") == null @@ -76,6 +77,7 @@ public class BsDiscountController { discount.setDiscountType(body.getInteger("discountType")); discount.setDiscountName(body.getString("discountName")); discount.setDiscountPrice(body.getBigDecimal("discountPrice")); + discount.setOverlayDiscount(body.getBoolean("overlayDiscount")); discount.setDiscountCondition(body.getBigDecimal("discountCondition")); discount.setUseScope(body.getString("useScope")); discount.setReceiveExpirationDate(body.getInteger("receiveExpirationDate")); diff --git a/service/src/main/java/com/hfkj/dao/BsDiscountMapper.java b/service/src/main/java/com/hfkj/dao/BsDiscountMapper.java index 68388af..07fdf41 100644 --- a/service/src/main/java/com/hfkj/dao/BsDiscountMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsDiscountMapper.java @@ -41,24 +41,24 @@ public interface BsDiscountMapper extends BsDiscountMapperExt { @Insert({ "insert into bs_discount (discount_no, discount_name, ", "discount_type, discount_condition, ", - "discount_price, use_scope, ", - "receive_expiration_date, start_time, ", - "end_time, reality_end_time, ", - "`status`, create_time, ", - "create_user_type, create_user_id, ", - "create_user_name, create_user_mer_no, ", - "update_time, ext_1, ", - "ext_2, ext_3)", + "discount_price, overlay_discount, ", + "use_scope, receive_expiration_date, ", + "start_time, end_time, ", + "reality_end_time, `status`, ", + "create_time, create_user_type, ", + "create_user_id, create_user_name, ", + "create_user_mer_no, update_time, ", + "ext_1, ext_2, ext_3)", "values (#{discountNo,jdbcType=VARCHAR}, #{discountName,jdbcType=VARCHAR}, ", "#{discountType,jdbcType=INTEGER}, #{discountCondition,jdbcType=DECIMAL}, ", - "#{discountPrice,jdbcType=DECIMAL}, #{useScope,jdbcType=VARCHAR}, ", - "#{receiveExpirationDate,jdbcType=INTEGER}, #{startTime,jdbcType=TIMESTAMP}, ", - "#{endTime,jdbcType=TIMESTAMP}, #{realityEndTime,jdbcType=TIMESTAMP}, ", - "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", - "#{createUserType,jdbcType=INTEGER}, #{createUserId,jdbcType=BIGINT}, ", - "#{createUserName,jdbcType=VARCHAR}, #{createUserMerNo,jdbcType=VARCHAR}, ", - "#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", - "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "#{discountPrice,jdbcType=DECIMAL}, #{overlayDiscount,jdbcType=BIT}, ", + "#{useScope,jdbcType=VARCHAR}, #{receiveExpirationDate,jdbcType=INTEGER}, ", + "#{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, ", + "#{realityEndTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ", + "#{createTime,jdbcType=TIMESTAMP}, #{createUserType,jdbcType=INTEGER}, ", + "#{createUserId,jdbcType=BIGINT}, #{createUserName,jdbcType=VARCHAR}, ", + "#{createUserMerNo,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, ", + "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(BsDiscount record); @@ -75,6 +75,7 @@ public interface BsDiscountMapper extends BsDiscountMapperExt { @Result(column="discount_type", property="discountType", jdbcType=JdbcType.INTEGER), @Result(column="discount_condition", property="discountCondition", jdbcType=JdbcType.DECIMAL), @Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="overlay_discount", property="overlayDiscount", jdbcType=JdbcType.BIT), @Result(column="use_scope", property="useScope", jdbcType=JdbcType.VARCHAR), @Result(column="receive_expiration_date", property="receiveExpirationDate", jdbcType=JdbcType.INTEGER), @Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP), @@ -96,9 +97,9 @@ public interface BsDiscountMapper extends BsDiscountMapperExt { @Select({ "select", "id, discount_no, discount_name, discount_type, discount_condition, discount_price, ", - "use_scope, receive_expiration_date, start_time, end_time, reality_end_time, ", - "`status`, create_time, create_user_type, create_user_id, create_user_name, create_user_mer_no, ", - "update_time, ext_1, ext_2, ext_3", + "overlay_discount, use_scope, receive_expiration_date, start_time, end_time, ", + "reality_end_time, `status`, create_time, create_user_type, create_user_id, create_user_name, ", + "create_user_mer_no, update_time, ext_1, ext_2, ext_3", "from bs_discount", "where id = #{id,jdbcType=BIGINT}" }) @@ -109,6 +110,7 @@ public interface BsDiscountMapper extends BsDiscountMapperExt { @Result(column="discount_type", property="discountType", jdbcType=JdbcType.INTEGER), @Result(column="discount_condition", property="discountCondition", jdbcType=JdbcType.DECIMAL), @Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="overlay_discount", property="overlayDiscount", jdbcType=JdbcType.BIT), @Result(column="use_scope", property="useScope", jdbcType=JdbcType.VARCHAR), @Result(column="receive_expiration_date", property="receiveExpirationDate", jdbcType=JdbcType.INTEGER), @Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP), @@ -143,6 +145,7 @@ public interface BsDiscountMapper extends BsDiscountMapperExt { "discount_type = #{discountType,jdbcType=INTEGER},", "discount_condition = #{discountCondition,jdbcType=DECIMAL},", "discount_price = #{discountPrice,jdbcType=DECIMAL},", + "overlay_discount = #{overlayDiscount,jdbcType=BIT},", "use_scope = #{useScope,jdbcType=VARCHAR},", "receive_expiration_date = #{receiveExpirationDate,jdbcType=INTEGER},", "start_time = #{startTime,jdbcType=TIMESTAMP},", diff --git a/service/src/main/java/com/hfkj/dao/BsDiscountSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsDiscountSqlProvider.java index 0efa6ee..11d3792 100644 --- a/service/src/main/java/com/hfkj/dao/BsDiscountSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsDiscountSqlProvider.java @@ -48,6 +48,10 @@ public class BsDiscountSqlProvider { sql.VALUES("discount_price", "#{discountPrice,jdbcType=DECIMAL}"); } + if (record.getOverlayDiscount() != null) { + sql.VALUES("overlay_discount", "#{overlayDiscount,jdbcType=BIT}"); + } + if (record.getUseScope() != null) { sql.VALUES("use_scope", "#{useScope,jdbcType=VARCHAR}"); } @@ -123,6 +127,7 @@ public class BsDiscountSqlProvider { sql.SELECT("discount_type"); sql.SELECT("discount_condition"); sql.SELECT("discount_price"); + sql.SELECT("overlay_discount"); sql.SELECT("use_scope"); sql.SELECT("receive_expiration_date"); sql.SELECT("start_time"); @@ -179,6 +184,10 @@ public class BsDiscountSqlProvider { sql.SET("discount_price = #{record.discountPrice,jdbcType=DECIMAL}"); } + if (record.getOverlayDiscount() != null) { + sql.SET("overlay_discount = #{record.overlayDiscount,jdbcType=BIT}"); + } + if (record.getUseScope() != null) { sql.SET("use_scope = #{record.useScope,jdbcType=VARCHAR}"); } @@ -253,6 +262,7 @@ public class BsDiscountSqlProvider { sql.SET("discount_type = #{record.discountType,jdbcType=INTEGER}"); sql.SET("discount_condition = #{record.discountCondition,jdbcType=DECIMAL}"); sql.SET("discount_price = #{record.discountPrice,jdbcType=DECIMAL}"); + sql.SET("overlay_discount = #{record.overlayDiscount,jdbcType=BIT}"); sql.SET("use_scope = #{record.useScope,jdbcType=VARCHAR}"); sql.SET("receive_expiration_date = #{record.receiveExpirationDate,jdbcType=INTEGER}"); sql.SET("start_time = #{record.startTime,jdbcType=TIMESTAMP}"); @@ -298,6 +308,10 @@ public class BsDiscountSqlProvider { sql.SET("discount_price = #{discountPrice,jdbcType=DECIMAL}"); } + if (record.getOverlayDiscount() != null) { + sql.SET("overlay_discount = #{overlayDiscount,jdbcType=BIT}"); + } + if (record.getUseScope() != null) { sql.SET("use_scope = #{useScope,jdbcType=VARCHAR}"); } diff --git a/service/src/main/java/com/hfkj/dao/BsDiscountUserMapper.java b/service/src/main/java/com/hfkj/dao/BsDiscountUserMapper.java index c67a328..6c59e1d 100644 --- a/service/src/main/java/com/hfkj/dao/BsDiscountUserMapper.java +++ b/service/src/main/java/com/hfkj/dao/BsDiscountUserMapper.java @@ -42,21 +42,23 @@ public interface BsDiscountUserMapper extends BsDiscountUserMapperExt { "insert into bs_discount_user (user_id, user_phone, ", "discount_id, discount_no, ", "discount_name, discount_type, ", - "discount_condition, discount_price, ", - "discount_stock_code, use_scope, ", - "use_date, expiration_date, ", - "agent_appid, `status`, ", - "create_time, update_time, ", - "ext_1, ext_2, ext_3)", + "overlay_discount, discount_condition, ", + "discount_price, discount_stock_code, ", + "use_scope, use_date, ", + "expiration_date, agent_appid, ", + "`status`, create_time, ", + "update_time, ext_1, ", + "ext_2, ext_3)", "values (#{userId,jdbcType=BIGINT}, #{userPhone,jdbcType=VARCHAR}, ", "#{discountId,jdbcType=BIGINT}, #{discountNo,jdbcType=VARCHAR}, ", "#{discountName,jdbcType=VARCHAR}, #{discountType,jdbcType=INTEGER}, ", - "#{discountCondition,jdbcType=DECIMAL}, #{discountPrice,jdbcType=DECIMAL}, ", - "#{discountStockCode,jdbcType=BIGINT}, #{useScope,jdbcType=VARCHAR}, ", - "#{useDate,jdbcType=TIMESTAMP}, #{expirationDate,jdbcType=TIMESTAMP}, ", - "#{agentAppid,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ", - "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "#{overlayDiscount,jdbcType=BIT}, #{discountCondition,jdbcType=DECIMAL}, ", + "#{discountPrice,jdbcType=DECIMAL}, #{discountStockCode,jdbcType=BIGINT}, ", + "#{useScope,jdbcType=VARCHAR}, #{useDate,jdbcType=TIMESTAMP}, ", + "#{expirationDate,jdbcType=TIMESTAMP}, #{agentAppid,jdbcType=VARCHAR}, ", + "#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", + "#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", + "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(BsDiscountUser record); @@ -74,6 +76,7 @@ public interface BsDiscountUserMapper extends BsDiscountUserMapperExt { @Result(column="discount_no", property="discountNo", jdbcType=JdbcType.VARCHAR), @Result(column="discount_name", property="discountName", jdbcType=JdbcType.VARCHAR), @Result(column="discount_type", property="discountType", jdbcType=JdbcType.INTEGER), + @Result(column="overlay_discount", property="overlayDiscount", jdbcType=JdbcType.BIT), @Result(column="discount_condition", property="discountCondition", jdbcType=JdbcType.DECIMAL), @Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL), @Result(column="discount_stock_code", property="discountStockCode", jdbcType=JdbcType.BIGINT), @@ -93,9 +96,9 @@ public interface BsDiscountUserMapper extends BsDiscountUserMapperExt { @Select({ "select", "id, user_id, user_phone, discount_id, discount_no, discount_name, discount_type, ", - "discount_condition, discount_price, discount_stock_code, use_scope, use_date, ", - "expiration_date, agent_appid, `status`, create_time, update_time, ext_1, ext_2, ", - "ext_3", + "overlay_discount, discount_condition, discount_price, discount_stock_code, use_scope, ", + "use_date, expiration_date, agent_appid, `status`, create_time, update_time, ", + "ext_1, ext_2, ext_3", "from bs_discount_user", "where id = #{id,jdbcType=BIGINT}" }) @@ -107,6 +110,7 @@ public interface BsDiscountUserMapper extends BsDiscountUserMapperExt { @Result(column="discount_no", property="discountNo", jdbcType=JdbcType.VARCHAR), @Result(column="discount_name", property="discountName", jdbcType=JdbcType.VARCHAR), @Result(column="discount_type", property="discountType", jdbcType=JdbcType.INTEGER), + @Result(column="overlay_discount", property="overlayDiscount", jdbcType=JdbcType.BIT), @Result(column="discount_condition", property="discountCondition", jdbcType=JdbcType.DECIMAL), @Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL), @Result(column="discount_stock_code", property="discountStockCode", jdbcType=JdbcType.BIGINT), @@ -140,6 +144,7 @@ public interface BsDiscountUserMapper extends BsDiscountUserMapperExt { "discount_no = #{discountNo,jdbcType=VARCHAR},", "discount_name = #{discountName,jdbcType=VARCHAR},", "discount_type = #{discountType,jdbcType=INTEGER},", + "overlay_discount = #{overlayDiscount,jdbcType=BIT},", "discount_condition = #{discountCondition,jdbcType=DECIMAL},", "discount_price = #{discountPrice,jdbcType=DECIMAL},", "discount_stock_code = #{discountStockCode,jdbcType=BIGINT},", diff --git a/service/src/main/java/com/hfkj/dao/BsDiscountUserSqlProvider.java b/service/src/main/java/com/hfkj/dao/BsDiscountUserSqlProvider.java index 6ea8aee..2fa99e9 100644 --- a/service/src/main/java/com/hfkj/dao/BsDiscountUserSqlProvider.java +++ b/service/src/main/java/com/hfkj/dao/BsDiscountUserSqlProvider.java @@ -52,6 +52,10 @@ public class BsDiscountUserSqlProvider { sql.VALUES("discount_type", "#{discountType,jdbcType=INTEGER}"); } + if (record.getOverlayDiscount() != null) { + sql.VALUES("overlay_discount", "#{overlayDiscount,jdbcType=BIT}"); + } + if (record.getDiscountCondition() != null) { sql.VALUES("discount_condition", "#{discountCondition,jdbcType=DECIMAL}"); } @@ -120,6 +124,7 @@ public class BsDiscountUserSqlProvider { sql.SELECT("discount_no"); sql.SELECT("discount_name"); sql.SELECT("discount_type"); + sql.SELECT("overlay_discount"); sql.SELECT("discount_condition"); sql.SELECT("discount_price"); sql.SELECT("discount_stock_code"); @@ -178,6 +183,10 @@ public class BsDiscountUserSqlProvider { sql.SET("discount_type = #{record.discountType,jdbcType=INTEGER}"); } + if (record.getOverlayDiscount() != null) { + sql.SET("overlay_discount = #{record.overlayDiscount,jdbcType=BIT}"); + } + if (record.getDiscountCondition() != null) { sql.SET("discount_condition = #{record.discountCondition,jdbcType=DECIMAL}"); } @@ -245,6 +254,7 @@ public class BsDiscountUserSqlProvider { sql.SET("discount_no = #{record.discountNo,jdbcType=VARCHAR}"); sql.SET("discount_name = #{record.discountName,jdbcType=VARCHAR}"); sql.SET("discount_type = #{record.discountType,jdbcType=INTEGER}"); + sql.SET("overlay_discount = #{record.overlayDiscount,jdbcType=BIT}"); sql.SET("discount_condition = #{record.discountCondition,jdbcType=DECIMAL}"); sql.SET("discount_price = #{record.discountPrice,jdbcType=DECIMAL}"); sql.SET("discount_stock_code = #{record.discountStockCode,jdbcType=BIGINT}"); @@ -292,6 +302,10 @@ public class BsDiscountUserSqlProvider { sql.SET("discount_type = #{discountType,jdbcType=INTEGER}"); } + if (record.getOverlayDiscount() != null) { + sql.SET("overlay_discount = #{overlayDiscount,jdbcType=BIT}"); + } + if (record.getDiscountCondition() != null) { sql.SET("discount_condition = #{discountCondition,jdbcType=DECIMAL}"); } diff --git a/service/src/main/java/com/hfkj/entity/BsDiscount.java b/service/src/main/java/com/hfkj/entity/BsDiscount.java index 7e1a965..4b13a80 100644 --- a/service/src/main/java/com/hfkj/entity/BsDiscount.java +++ b/service/src/main/java/com/hfkj/entity/BsDiscount.java @@ -44,6 +44,11 @@ public class BsDiscount implements Serializable { */ private BigDecimal discountPrice; + /** + * 叠加优惠 + */ + private Boolean overlayDiscount; + /** * 使用范围(支持多选) 1:加油 2:商城 */ @@ -160,6 +165,14 @@ public class BsDiscount implements Serializable { this.discountPrice = discountPrice; } + public Boolean getOverlayDiscount() { + return overlayDiscount; + } + + public void setOverlayDiscount(Boolean overlayDiscount) { + this.overlayDiscount = overlayDiscount; + } + public String getUseScope() { return useScope; } @@ -298,6 +311,7 @@ public class BsDiscount implements Serializable { && (this.getDiscountType() == null ? other.getDiscountType() == null : this.getDiscountType().equals(other.getDiscountType())) && (this.getDiscountCondition() == null ? other.getDiscountCondition() == null : this.getDiscountCondition().equals(other.getDiscountCondition())) && (this.getDiscountPrice() == null ? other.getDiscountPrice() == null : this.getDiscountPrice().equals(other.getDiscountPrice())) + && (this.getOverlayDiscount() == null ? other.getOverlayDiscount() == null : this.getOverlayDiscount().equals(other.getOverlayDiscount())) && (this.getUseScope() == null ? other.getUseScope() == null : this.getUseScope().equals(other.getUseScope())) && (this.getReceiveExpirationDate() == null ? other.getReceiveExpirationDate() == null : this.getReceiveExpirationDate().equals(other.getReceiveExpirationDate())) && (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime())) @@ -325,6 +339,7 @@ public class BsDiscount implements Serializable { result = prime * result + ((getDiscountType() == null) ? 0 : getDiscountType().hashCode()); result = prime * result + ((getDiscountCondition() == null) ? 0 : getDiscountCondition().hashCode()); result = prime * result + ((getDiscountPrice() == null) ? 0 : getDiscountPrice().hashCode()); + result = prime * result + ((getOverlayDiscount() == null) ? 0 : getOverlayDiscount().hashCode()); result = prime * result + ((getUseScope() == null) ? 0 : getUseScope().hashCode()); result = prime * result + ((getReceiveExpirationDate() == null) ? 0 : getReceiveExpirationDate().hashCode()); result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode()); @@ -355,6 +370,7 @@ public class BsDiscount implements Serializable { sb.append(", discountType=").append(discountType); sb.append(", discountCondition=").append(discountCondition); sb.append(", discountPrice=").append(discountPrice); + sb.append(", overlayDiscount=").append(overlayDiscount); sb.append(", useScope=").append(useScope); sb.append(", receiveExpirationDate=").append(receiveExpirationDate); sb.append(", startTime=").append(startTime); diff --git a/service/src/main/java/com/hfkj/entity/BsDiscountExample.java b/service/src/main/java/com/hfkj/entity/BsDiscountExample.java index 02f63a0..8fd45f4 100644 --- a/service/src/main/java/com/hfkj/entity/BsDiscountExample.java +++ b/service/src/main/java/com/hfkj/entity/BsDiscountExample.java @@ -506,6 +506,66 @@ public class BsDiscountExample { return (Criteria) this; } + public Criteria andOverlayDiscountIsNull() { + addCriterion("overlay_discount is null"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountIsNotNull() { + addCriterion("overlay_discount is not null"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountEqualTo(Boolean value) { + addCriterion("overlay_discount =", value, "overlayDiscount"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountNotEqualTo(Boolean value) { + addCriterion("overlay_discount <>", value, "overlayDiscount"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountGreaterThan(Boolean value) { + addCriterion("overlay_discount >", value, "overlayDiscount"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountGreaterThanOrEqualTo(Boolean value) { + addCriterion("overlay_discount >=", value, "overlayDiscount"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountLessThan(Boolean value) { + addCriterion("overlay_discount <", value, "overlayDiscount"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountLessThanOrEqualTo(Boolean value) { + addCriterion("overlay_discount <=", value, "overlayDiscount"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountIn(List values) { + addCriterion("overlay_discount in", values, "overlayDiscount"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountNotIn(List values) { + addCriterion("overlay_discount not in", values, "overlayDiscount"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountBetween(Boolean value1, Boolean value2) { + addCriterion("overlay_discount between", value1, value2, "overlayDiscount"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountNotBetween(Boolean value1, Boolean value2) { + addCriterion("overlay_discount not between", value1, value2, "overlayDiscount"); + return (Criteria) this; + } + public Criteria andUseScopeIsNull() { addCriterion("use_scope is null"); return (Criteria) this; diff --git a/service/src/main/java/com/hfkj/entity/BsDiscountUser.java b/service/src/main/java/com/hfkj/entity/BsDiscountUser.java index b0b4347..5f24ede 100644 --- a/service/src/main/java/com/hfkj/entity/BsDiscountUser.java +++ b/service/src/main/java/com/hfkj/entity/BsDiscountUser.java @@ -49,6 +49,11 @@ public class BsDiscountUser implements Serializable { */ private Integer discountType; + /** + * 叠加优惠 + */ + private Boolean overlayDiscount; + /** * 优惠券条件(满减价格) */ @@ -163,6 +168,14 @@ public class BsDiscountUser implements Serializable { this.discountType = discountType; } + public Boolean getOverlayDiscount() { + return overlayDiscount; + } + + public void setOverlayDiscount(Boolean overlayDiscount) { + this.overlayDiscount = overlayDiscount; + } + public BigDecimal getDiscountCondition() { return discountCondition; } @@ -286,6 +299,7 @@ public class BsDiscountUser implements Serializable { && (this.getDiscountNo() == null ? other.getDiscountNo() == null : this.getDiscountNo().equals(other.getDiscountNo())) && (this.getDiscountName() == null ? other.getDiscountName() == null : this.getDiscountName().equals(other.getDiscountName())) && (this.getDiscountType() == null ? other.getDiscountType() == null : this.getDiscountType().equals(other.getDiscountType())) + && (this.getOverlayDiscount() == null ? other.getOverlayDiscount() == null : this.getOverlayDiscount().equals(other.getOverlayDiscount())) && (this.getDiscountCondition() == null ? other.getDiscountCondition() == null : this.getDiscountCondition().equals(other.getDiscountCondition())) && (this.getDiscountPrice() == null ? other.getDiscountPrice() == null : this.getDiscountPrice().equals(other.getDiscountPrice())) && (this.getDiscountStockCode() == null ? other.getDiscountStockCode() == null : this.getDiscountStockCode().equals(other.getDiscountStockCode())) @@ -312,6 +326,7 @@ public class BsDiscountUser implements Serializable { result = prime * result + ((getDiscountNo() == null) ? 0 : getDiscountNo().hashCode()); result = prime * result + ((getDiscountName() == null) ? 0 : getDiscountName().hashCode()); result = prime * result + ((getDiscountType() == null) ? 0 : getDiscountType().hashCode()); + result = prime * result + ((getOverlayDiscount() == null) ? 0 : getOverlayDiscount().hashCode()); result = prime * result + ((getDiscountCondition() == null) ? 0 : getDiscountCondition().hashCode()); result = prime * result + ((getDiscountPrice() == null) ? 0 : getDiscountPrice().hashCode()); result = prime * result + ((getDiscountStockCode() == null) ? 0 : getDiscountStockCode().hashCode()); @@ -341,6 +356,7 @@ public class BsDiscountUser implements Serializable { sb.append(", discountNo=").append(discountNo); sb.append(", discountName=").append(discountName); sb.append(", discountType=").append(discountType); + sb.append(", overlayDiscount=").append(overlayDiscount); sb.append(", discountCondition=").append(discountCondition); sb.append(", discountPrice=").append(discountPrice); sb.append(", discountStockCode=").append(discountStockCode); diff --git a/service/src/main/java/com/hfkj/entity/BsDiscountUserExample.java b/service/src/main/java/com/hfkj/entity/BsDiscountUserExample.java index b1a0b5a..be6a123 100644 --- a/service/src/main/java/com/hfkj/entity/BsDiscountUserExample.java +++ b/service/src/main/java/com/hfkj/entity/BsDiscountUserExample.java @@ -576,6 +576,66 @@ public class BsDiscountUserExample { return (Criteria) this; } + public Criteria andOverlayDiscountIsNull() { + addCriterion("overlay_discount is null"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountIsNotNull() { + addCriterion("overlay_discount is not null"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountEqualTo(Boolean value) { + addCriterion("overlay_discount =", value, "overlayDiscount"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountNotEqualTo(Boolean value) { + addCriterion("overlay_discount <>", value, "overlayDiscount"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountGreaterThan(Boolean value) { + addCriterion("overlay_discount >", value, "overlayDiscount"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountGreaterThanOrEqualTo(Boolean value) { + addCriterion("overlay_discount >=", value, "overlayDiscount"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountLessThan(Boolean value) { + addCriterion("overlay_discount <", value, "overlayDiscount"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountLessThanOrEqualTo(Boolean value) { + addCriterion("overlay_discount <=", value, "overlayDiscount"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountIn(List values) { + addCriterion("overlay_discount in", values, "overlayDiscount"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountNotIn(List values) { + addCriterion("overlay_discount not in", values, "overlayDiscount"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountBetween(Boolean value1, Boolean value2) { + addCriterion("overlay_discount between", value1, value2, "overlayDiscount"); + return (Criteria) this; + } + + public Criteria andOverlayDiscountNotBetween(Boolean value1, Boolean value2) { + addCriterion("overlay_discount not between", value1, value2, "overlayDiscount"); + return (Criteria) this; + } + public Criteria andDiscountConditionIsNull() { addCriterion("discount_condition is null"); return (Criteria) this; diff --git a/service/src/main/java/com/hfkj/model/GasPayPriceModel.java b/service/src/main/java/com/hfkj/model/GasPayPriceModel.java index f1f825f..cba57e7 100644 --- a/service/src/main/java/com/hfkj/model/GasPayPriceModel.java +++ b/service/src/main/java/com/hfkj/model/GasPayPriceModel.java @@ -63,6 +63,11 @@ public class GasPayPriceModel { */ private BigDecimal discount; + /** + * 是否叠加优惠 + */ + private Boolean overlayDiscount; + /** * 每升优惠 */ 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 da2499b..fb3a8d3 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 @@ -70,7 +70,7 @@ public class BsGasServiceImpl implements BsGasService { if (merchant == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到油站"); } - + BsDiscountUser discountUser = null; GasPayPriceModel payPriceModel = new GasPayPriceModel(); payPriceModel.setDeductionCouponPrice(new BigDecimal("0")); @@ -97,7 +97,7 @@ public class BsGasServiceImpl implements BsGasService { } } else { // 查询用户优惠券 - BsDiscountUser discountUser = discountUserService.getDetail(userDiscountId); + discountUser = discountUserService.getDetail(userDiscountId); if (discountUser == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到用户优惠券"); } @@ -112,6 +112,7 @@ public class BsGasServiceImpl implements BsGasService { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未达到满减金额,无法使用此优惠券"); } payPriceModel.setDeductionCouponPrice(discountUser.getDiscountPrice()); + } else if (DiscountTypeEnum.type2.getCode().equals(discountUser.getDiscountType())) { payPriceModel.setDeductionCouponPrice(discountUser.getDiscountPrice()); @@ -121,7 +122,7 @@ public class BsGasServiceImpl implements BsGasService { refuelPrice.multiply(discountUser.getDiscountPrice().divide(new BigDecimal("100"))).setScale(2, BigDecimal.ROUND_HALF_DOWN) )); } else { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的油站"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的优惠券类型"); } } @@ -139,7 +140,11 @@ public class BsGasServiceImpl implements BsGasService { // 油站直降 BigDecimal gasStationDrop = gasOilPrice.getGasStationDrop(); // 油站优惠价 - BigDecimal priceVip = userDiscountId==null?gasOilPrice.getPriceVip():priceGun; + BigDecimal priceVip = gasOilPrice.getPriceVip(); + if (discountUser != null && !discountUser.getOverlayDiscount()) { + // 优惠券与油价不叠加 + priceVip = priceGun; + } // 嗨森逛平台价 油站优惠价 * 折扣 BigDecimal pricePlatform = priceVip.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP);