'提交代码'

dev-discount
199901012 4 years ago
parent cd14e48ad8
commit f583c3b3bd
  1. 34
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  2. 29
      hai-service/src/main/java/com/hai/dao/HighOrderMapper.java
  3. 14
      hai-service/src/main/java/com/hai/dao/HighOrderSqlProvider.java
  4. 34
      hai-service/src/main/java/com/hai/entity/HighOrder.java
  5. 60
      hai-service/src/main/java/com/hai/entity/HighOrderExample.java

@ -163,12 +163,13 @@ public class HighOrderController {
// 累计订单价格
totalPrice = totalPrice.add(childOrder.getTotalPrice());
}
highOrder.setTotalPrice(totalPrice);
highOrder.setPayPrice(highOrder.getTotalPrice());
// 是否使用了优惠券
if (highOrder.getMemDiscountId() != null) {
if (highDiscountUserRel != null) {
highOrder.setMemDiscountName(highDiscountUserRel.getHighDiscount().getDiscountName());
// 卡卷类型 1:满减 2:抵扣 3:折扣
if (highDiscountUserRel.getHighDiscount().getDiscountType() == 1) {
// 如果订单总额 小于 满减价格
@ -177,24 +178,28 @@ public class HighOrderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "订单未达到"+highDiscountUserRel.getHighDiscount().getDiscountCondition()+"元,无法使用此优惠券");
}
// 订单总额 - 满减额度
BigDecimal total = highOrder.getTotalPrice().subtract(highDiscountUserRel.getHighDiscount().getDiscountPrice());
BigDecimal payPrice = highOrder.getTotalPrice().subtract(highDiscountUserRel.getHighDiscount().getDiscountPrice());
highOrder.setDeductionPrice(highDiscountUserRel.getHighDiscount().getDiscountPrice());
// 如果总额小于0
if (total.compareTo(new BigDecimal("0")) == -1) {
highOrder.setTotalPrice(new BigDecimal("0"));
if (payPrice.compareTo(new BigDecimal("0")) == -1) {
highOrder.setPayPrice(new BigDecimal("0"));
} else {
highOrder.setTotalPrice(total);
highOrder.setPayPrice(payPrice);
}
}
// 卡卷类型 1:满减 2:抵扣 3:折扣
if (highDiscountUserRel.getHighDiscount().getDiscountType() == 2) {
// 订单总额 - 满减额度
BigDecimal total = highOrder.getTotalPrice().subtract(highDiscountUserRel.getHighDiscount().getDiscountPrice());
BigDecimal payPrice = highOrder.getTotalPrice().subtract(highDiscountUserRel.getHighDiscount().getDiscountPrice());
highOrder.setDeductionPrice(highDiscountUserRel.getHighDiscount().getDiscountPrice());
// 如果总额小于0
if (total.compareTo(new BigDecimal("0")) == -1) {
highOrder.setTotalPrice(new BigDecimal("0"));
if (payPrice.compareTo(new BigDecimal("0")) == -1) {
highOrder.setPayPrice(new BigDecimal("0"));
} else {
highOrder.setTotalPrice(total);
highOrder.setPayPrice(payPrice);
}
}
@ -203,8 +208,9 @@ public class HighOrderController {
// 折扣除100
BigDecimal discountPrice = highDiscountUserRel.getHighDiscount().getDiscountPrice().divide(new BigDecimal("10"));
// 订单总额 * 折扣
BigDecimal total = highOrder.getTotalPrice().multiply(discountPrice);
highOrder.setTotalPrice(total);
BigDecimal payPrice = highOrder.getTotalPrice().multiply(discountPrice);
highOrder.setDeductionPrice(highDiscountUserRel.getHighDiscount().getDiscountPrice());
highOrder.setPayPrice(payPrice);
}
}
@ -212,7 +218,7 @@ public class HighOrderController {
highOrder.setMemId(userInfoModel.getHighUser().getId());
highOrder.setMemName(userInfoModel.getHighUser().getName());
highOrder.setMemPhone(userInfoModel.getHighUser().getPhone());
highOrder.setPayPrice(highOrder.getTotalPrice());
highOrder.setTotalPrice(totalPrice);
highOrder.setCreateTime(new Date());
highOrder.setOrderStatus(1);

@ -45,22 +45,22 @@ public interface HighOrderMapper extends HighOrderMapperExt {
"pay_model, pay_type, ",
"pay_gold, pay_price, ",
"pay_real_price, pay_serial_no, ",
"order_status, total_price, ",
"create_time, pay_time, ",
"cancel_time, finish_time, ",
"remarks, ext_1, ext_2, ",
"ext_3)",
"deduction_price, order_status, ",
"total_price, create_time, ",
"pay_time, cancel_time, ",
"finish_time, remarks, ",
"ext_1, ext_2, ext_3)",
"values (#{orderNo,jdbcType=VARCHAR}, #{memDiscountId,jdbcType=BIGINT}, ",
"#{memDiscountName,jdbcType=VARCHAR}, #{memId,jdbcType=BIGINT}, ",
"#{memName,jdbcType=VARCHAR}, #{memPhone,jdbcType=VARCHAR}, ",
"#{payModel,jdbcType=INTEGER}, #{payType,jdbcType=INTEGER}, ",
"#{payGold,jdbcType=INTEGER}, #{payPrice,jdbcType=DECIMAL}, ",
"#{payRealPrice,jdbcType=DECIMAL}, #{paySerialNo,jdbcType=VARCHAR}, ",
"#{orderStatus,jdbcType=INTEGER}, #{totalPrice,jdbcType=DECIMAL}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, ",
"#{cancelTime,jdbcType=TIMESTAMP}, #{finishTime,jdbcType=TIMESTAMP}, ",
"#{remarks,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ",
"#{ext3,jdbcType=VARCHAR})"
"#{deductionPrice,jdbcType=DECIMAL}, #{orderStatus,jdbcType=INTEGER}, ",
"#{totalPrice,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{payTime,jdbcType=TIMESTAMP}, #{cancelTime,jdbcType=TIMESTAMP}, ",
"#{finishTime,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighOrder record);
@ -84,6 +84,7 @@ public interface HighOrderMapper extends HighOrderMapperExt {
@Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="pay_real_price", property="payRealPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="deduction_price", property="deductionPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="order_status", property="orderStatus", jdbcType=JdbcType.INTEGER),
@Result(column="total_price", property="totalPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@ -100,9 +101,9 @@ public interface HighOrderMapper extends HighOrderMapperExt {
@Select({
"select",
"id, order_no, mem_discount_id, mem_discount_name, mem_id, mem_name, mem_phone, ",
"pay_model, pay_type, pay_gold, pay_price, pay_real_price, pay_serial_no, order_status, ",
"total_price, create_time, pay_time, cancel_time, finish_time, remarks, ext_1, ",
"ext_2, ext_3",
"pay_model, pay_type, pay_gold, pay_price, pay_real_price, pay_serial_no, deduction_price, ",
"order_status, total_price, create_time, pay_time, cancel_time, finish_time, ",
"remarks, ext_1, ext_2, ext_3",
"from high_order",
"where id = #{id,jdbcType=BIGINT}"
})
@ -120,6 +121,7 @@ public interface HighOrderMapper extends HighOrderMapperExt {
@Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="pay_real_price", property="payRealPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="deduction_price", property="deductionPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="order_status", property="orderStatus", jdbcType=JdbcType.INTEGER),
@Result(column="total_price", property="totalPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@ -156,6 +158,7 @@ public interface HighOrderMapper extends HighOrderMapperExt {
"pay_price = #{payPrice,jdbcType=DECIMAL},",
"pay_real_price = #{payRealPrice,jdbcType=DECIMAL},",
"pay_serial_no = #{paySerialNo,jdbcType=VARCHAR},",
"deduction_price = #{deductionPrice,jdbcType=DECIMAL},",
"order_status = #{orderStatus,jdbcType=INTEGER},",
"total_price = #{totalPrice,jdbcType=DECIMAL},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",

@ -76,6 +76,10 @@ public class HighOrderSqlProvider {
sql.VALUES("pay_serial_no", "#{paySerialNo,jdbcType=VARCHAR}");
}
if (record.getDeductionPrice() != null) {
sql.VALUES("deduction_price", "#{deductionPrice,jdbcType=DECIMAL}");
}
if (record.getOrderStatus() != null) {
sql.VALUES("order_status", "#{orderStatus,jdbcType=INTEGER}");
}
@ -138,6 +142,7 @@ public class HighOrderSqlProvider {
sql.SELECT("pay_price");
sql.SELECT("pay_real_price");
sql.SELECT("pay_serial_no");
sql.SELECT("deduction_price");
sql.SELECT("order_status");
sql.SELECT("total_price");
sql.SELECT("create_time");
@ -217,6 +222,10 @@ public class HighOrderSqlProvider {
sql.SET("pay_serial_no = #{record.paySerialNo,jdbcType=VARCHAR}");
}
if (record.getDeductionPrice() != null) {
sql.SET("deduction_price = #{record.deductionPrice,jdbcType=DECIMAL}");
}
if (record.getOrderStatus() != null) {
sql.SET("order_status = #{record.orderStatus,jdbcType=INTEGER}");
}
@ -278,6 +287,7 @@ public class HighOrderSqlProvider {
sql.SET("pay_price = #{record.payPrice,jdbcType=DECIMAL}");
sql.SET("pay_real_price = #{record.payRealPrice,jdbcType=DECIMAL}");
sql.SET("pay_serial_no = #{record.paySerialNo,jdbcType=VARCHAR}");
sql.SET("deduction_price = #{record.deductionPrice,jdbcType=DECIMAL}");
sql.SET("order_status = #{record.orderStatus,jdbcType=INTEGER}");
sql.SET("total_price = #{record.totalPrice,jdbcType=DECIMAL}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
@ -346,6 +356,10 @@ public class HighOrderSqlProvider {
sql.SET("pay_serial_no = #{paySerialNo,jdbcType=VARCHAR}");
}
if (record.getDeductionPrice() != null) {
sql.SET("deduction_price = #{deductionPrice,jdbcType=DECIMAL}");
}
if (record.getOrderStatus() != null) {
sql.SET("order_status = #{orderStatus,jdbcType=INTEGER}");
}

@ -80,6 +80,11 @@ public class HighOrder implements Serializable {
*/
private String paySerialNo;
/**
* 抵扣金额
*/
private BigDecimal deductionPrice;
/**
* 订单状态1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
*/
@ -121,12 +126,18 @@ public class HighOrder implements Serializable {
private String ext3;
private static final long serialVersionUID = 1L;
private List<HighChildOrder> highChildOrderList;
private HighDiscount highDiscount;
public List<HighChildOrder> getHighChildOrderList() {
return highChildOrderList;
}
public void setHighChildOrderList(List<HighChildOrder> highChildOrderList) {
this.highChildOrderList = highChildOrderList;
}
public HighDiscount getHighDiscount() {
return highDiscount;
}
@ -135,13 +146,7 @@ public class HighOrder implements Serializable {
this.highDiscount = highDiscount;
}
public List<HighChildOrder> getHighChildOrderList() {
return highChildOrderList;
}
public void setHighChildOrderList(List<HighChildOrder> highChildOrderList) {
this.highChildOrderList = highChildOrderList;
}
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
@ -247,6 +252,14 @@ public class HighOrder implements Serializable {
this.paySerialNo = paySerialNo;
}
public BigDecimal getDeductionPrice() {
return deductionPrice;
}
public void setDeductionPrice(BigDecimal deductionPrice) {
this.deductionPrice = deductionPrice;
}
public Integer getOrderStatus() {
return orderStatus;
}
@ -352,6 +365,7 @@ public class HighOrder implements Serializable {
&& (this.getPayPrice() == null ? other.getPayPrice() == null : this.getPayPrice().equals(other.getPayPrice()))
&& (this.getPayRealPrice() == null ? other.getPayRealPrice() == null : this.getPayRealPrice().equals(other.getPayRealPrice()))
&& (this.getPaySerialNo() == null ? other.getPaySerialNo() == null : this.getPaySerialNo().equals(other.getPaySerialNo()))
&& (this.getDeductionPrice() == null ? other.getDeductionPrice() == null : this.getDeductionPrice().equals(other.getDeductionPrice()))
&& (this.getOrderStatus() == null ? other.getOrderStatus() == null : this.getOrderStatus().equals(other.getOrderStatus()))
&& (this.getTotalPrice() == null ? other.getTotalPrice() == null : this.getTotalPrice().equals(other.getTotalPrice()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
@ -381,6 +395,7 @@ public class HighOrder implements Serializable {
result = prime * result + ((getPayPrice() == null) ? 0 : getPayPrice().hashCode());
result = prime * result + ((getPayRealPrice() == null) ? 0 : getPayRealPrice().hashCode());
result = prime * result + ((getPaySerialNo() == null) ? 0 : getPaySerialNo().hashCode());
result = prime * result + ((getDeductionPrice() == null) ? 0 : getDeductionPrice().hashCode());
result = prime * result + ((getOrderStatus() == null) ? 0 : getOrderStatus().hashCode());
result = prime * result + ((getTotalPrice() == null) ? 0 : getTotalPrice().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
@ -413,6 +428,7 @@ public class HighOrder implements Serializable {
sb.append(", payPrice=").append(payPrice);
sb.append(", payRealPrice=").append(payRealPrice);
sb.append(", paySerialNo=").append(paySerialNo);
sb.append(", deductionPrice=").append(deductionPrice);
sb.append(", orderStatus=").append(orderStatus);
sb.append(", totalPrice=").append(totalPrice);
sb.append(", createTime=").append(createTime);

@ -956,6 +956,66 @@ public class HighOrderExample {
return (Criteria) this;
}
public Criteria andDeductionPriceIsNull() {
addCriterion("deduction_price is null");
return (Criteria) this;
}
public Criteria andDeductionPriceIsNotNull() {
addCriterion("deduction_price is not null");
return (Criteria) this;
}
public Criteria andDeductionPriceEqualTo(BigDecimal value) {
addCriterion("deduction_price =", value, "deductionPrice");
return (Criteria) this;
}
public Criteria andDeductionPriceNotEqualTo(BigDecimal value) {
addCriterion("deduction_price <>", value, "deductionPrice");
return (Criteria) this;
}
public Criteria andDeductionPriceGreaterThan(BigDecimal value) {
addCriterion("deduction_price >", value, "deductionPrice");
return (Criteria) this;
}
public Criteria andDeductionPriceGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("deduction_price >=", value, "deductionPrice");
return (Criteria) this;
}
public Criteria andDeductionPriceLessThan(BigDecimal value) {
addCriterion("deduction_price <", value, "deductionPrice");
return (Criteria) this;
}
public Criteria andDeductionPriceLessThanOrEqualTo(BigDecimal value) {
addCriterion("deduction_price <=", value, "deductionPrice");
return (Criteria) this;
}
public Criteria andDeductionPriceIn(List<BigDecimal> values) {
addCriterion("deduction_price in", values, "deductionPrice");
return (Criteria) this;
}
public Criteria andDeductionPriceNotIn(List<BigDecimal> values) {
addCriterion("deduction_price not in", values, "deductionPrice");
return (Criteria) this;
}
public Criteria andDeductionPriceBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("deduction_price between", value1, value2, "deductionPrice");
return (Criteria) this;
}
public Criteria andDeductionPriceNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("deduction_price not between", value1, value2, "deductionPrice");
return (Criteria) this;
}
public Criteria andOrderStatusIsNull() {
addCriterion("order_status is null");
return (Criteria) this;

Loading…
Cancel
Save