From 8c4ce3d92cb71ae4996a27038699ba9f459a491b Mon Sep 17 00:00:00 2001 From: 199901012 Date: Sat, 27 Mar 2021 01:29:09 +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 --- .../com/hai/dao/HighCouponCodeMapper.java | 41 ++++--- .../hai/dao/HighCouponCodeSqlProvider.java | 30 +++-- .../java/com/hai/entity/HighCouponCode.java | 34 ++++-- .../com/hai/entity/HighCouponCodeExample.java | 108 ++++++++++++++---- .../hai/service/HighCouponCodeService.java | 21 ++++ .../impl/HighCouponCodeServiceImpl.java | 26 +++++ .../service/impl/HighOrderServiceImpl.java | 25 +++- .../pay/impl/GoodsOrderServiceImpl.java | 10 ++ 8 files changed, 232 insertions(+), 63 deletions(-) diff --git a/hai-service/src/main/java/com/hai/dao/HighCouponCodeMapper.java b/hai-service/src/main/java/com/hai/dao/HighCouponCodeMapper.java index e47e0c76..1cce2606 100644 --- a/hai-service/src/main/java/com/hai/dao/HighCouponCodeMapper.java +++ b/hai-service/src/main/java/com/hai/dao/HighCouponCodeMapper.java @@ -40,19 +40,21 @@ public interface HighCouponCodeMapper extends HighCouponCodeMapperExt { @Insert({ "insert into high_coupon_code (coupon_id, merchant_id, ", - "order_id, sales_code, ", - "sales_end_time, use_end_time, ", - "create_time, receive_time, ", - "consume_time, `status`, ", - "operator_id, operator_name, ", - "ext_1, ext_2, ext_3)", + "store_id, child_order_id, ", + "sales_code, sales_end_time, ", + "use_end_time, create_time, ", + "receive_time, consume_time, ", + "`status`, operator_id, ", + "operator_name, ext_1, ", + "ext_2, ext_3)", "values (#{couponId,jdbcType=BIGINT}, #{merchantId,jdbcType=BIGINT}, ", - "#{orderId,jdbcType=BIGINT}, #{salesCode,jdbcType=VARCHAR}, ", - "#{salesEndTime,jdbcType=TIMESTAMP}, #{useEndTime,jdbcType=TIMESTAMP}, ", - "#{createTime,jdbcType=TIMESTAMP}, #{receiveTime,jdbcType=TIMESTAMP}, ", - "#{consumeTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ", - "#{operatorId,jdbcType=BIGINT}, #{operatorName,jdbcType=VARCHAR}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" + "#{storeId,jdbcType=BIGINT}, #{childOrderId,jdbcType=BIGINT}, ", + "#{salesCode,jdbcType=VARCHAR}, #{salesEndTime,jdbcType=TIMESTAMP}, ", + "#{useEndTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, ", + "#{receiveTime,jdbcType=TIMESTAMP}, #{consumeTime,jdbcType=TIMESTAMP}, ", + "#{status,jdbcType=INTEGER}, #{operatorId,jdbcType=BIGINT}, ", + "#{operatorName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ", + "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(HighCouponCode record); @@ -66,7 +68,8 @@ public interface HighCouponCodeMapper extends HighCouponCodeMapperExt { @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT), @Result(column="merchant_id", property="merchantId", jdbcType=JdbcType.BIGINT), - @Result(column="order_id", property="orderId", jdbcType=JdbcType.BIGINT), + @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT), + @Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.BIGINT), @Result(column="sales_code", property="salesCode", jdbcType=JdbcType.VARCHAR), @Result(column="sales_end_time", property="salesEndTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="use_end_time", property="useEndTime", jdbcType=JdbcType.TIMESTAMP), @@ -84,9 +87,9 @@ public interface HighCouponCodeMapper extends HighCouponCodeMapperExt { @Select({ "select", - "id, coupon_id, merchant_id, order_id, sales_code, sales_end_time, use_end_time, ", - "create_time, receive_time, consume_time, `status`, operator_id, operator_name, ", - "ext_1, ext_2, ext_3", + "id, coupon_id, merchant_id, store_id, child_order_id, sales_code, sales_end_time, ", + "use_end_time, create_time, receive_time, consume_time, `status`, operator_id, ", + "operator_name, ext_1, ext_2, ext_3", "from high_coupon_code", "where id = #{id,jdbcType=BIGINT}" }) @@ -94,7 +97,8 @@ public interface HighCouponCodeMapper extends HighCouponCodeMapperExt { @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT), @Result(column="merchant_id", property="merchantId", jdbcType=JdbcType.BIGINT), - @Result(column="order_id", property="orderId", jdbcType=JdbcType.BIGINT), + @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT), + @Result(column="child_order_id", property="childOrderId", jdbcType=JdbcType.BIGINT), @Result(column="sales_code", property="salesCode", jdbcType=JdbcType.VARCHAR), @Result(column="sales_end_time", property="salesEndTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="use_end_time", property="useEndTime", jdbcType=JdbcType.TIMESTAMP), @@ -123,7 +127,8 @@ public interface HighCouponCodeMapper extends HighCouponCodeMapperExt { "update high_coupon_code", "set coupon_id = #{couponId,jdbcType=BIGINT},", "merchant_id = #{merchantId,jdbcType=BIGINT},", - "order_id = #{orderId,jdbcType=BIGINT},", + "store_id = #{storeId,jdbcType=BIGINT},", + "child_order_id = #{childOrderId,jdbcType=BIGINT},", "sales_code = #{salesCode,jdbcType=VARCHAR},", "sales_end_time = #{salesEndTime,jdbcType=TIMESTAMP},", "use_end_time = #{useEndTime,jdbcType=TIMESTAMP},", diff --git a/hai-service/src/main/java/com/hai/dao/HighCouponCodeSqlProvider.java b/hai-service/src/main/java/com/hai/dao/HighCouponCodeSqlProvider.java index db4cca1b..a75ff598 100644 --- a/hai-service/src/main/java/com/hai/dao/HighCouponCodeSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/HighCouponCodeSqlProvider.java @@ -36,8 +36,12 @@ public class HighCouponCodeSqlProvider { sql.VALUES("merchant_id", "#{merchantId,jdbcType=BIGINT}"); } - if (record.getOrderId() != null) { - sql.VALUES("order_id", "#{orderId,jdbcType=BIGINT}"); + if (record.getStoreId() != null) { + sql.VALUES("store_id", "#{storeId,jdbcType=BIGINT}"); + } + + if (record.getChildOrderId() != null) { + sql.VALUES("child_order_id", "#{childOrderId,jdbcType=BIGINT}"); } if (record.getSalesCode() != null) { @@ -100,7 +104,8 @@ public class HighCouponCodeSqlProvider { } sql.SELECT("coupon_id"); sql.SELECT("merchant_id"); - sql.SELECT("order_id"); + sql.SELECT("store_id"); + sql.SELECT("child_order_id"); sql.SELECT("sales_code"); sql.SELECT("sales_end_time"); sql.SELECT("use_end_time"); @@ -142,8 +147,12 @@ public class HighCouponCodeSqlProvider { sql.SET("merchant_id = #{record.merchantId,jdbcType=BIGINT}"); } - if (record.getOrderId() != null) { - sql.SET("order_id = #{record.orderId,jdbcType=BIGINT}"); + if (record.getStoreId() != null) { + sql.SET("store_id = #{record.storeId,jdbcType=BIGINT}"); + } + + if (record.getChildOrderId() != null) { + sql.SET("child_order_id = #{record.childOrderId,jdbcType=BIGINT}"); } if (record.getSalesCode() != null) { @@ -205,7 +214,8 @@ public class HighCouponCodeSqlProvider { sql.SET("id = #{record.id,jdbcType=BIGINT}"); sql.SET("coupon_id = #{record.couponId,jdbcType=BIGINT}"); sql.SET("merchant_id = #{record.merchantId,jdbcType=BIGINT}"); - sql.SET("order_id = #{record.orderId,jdbcType=BIGINT}"); + sql.SET("store_id = #{record.storeId,jdbcType=BIGINT}"); + sql.SET("child_order_id = #{record.childOrderId,jdbcType=BIGINT}"); sql.SET("sales_code = #{record.salesCode,jdbcType=VARCHAR}"); sql.SET("sales_end_time = #{record.salesEndTime,jdbcType=TIMESTAMP}"); sql.SET("use_end_time = #{record.useEndTime,jdbcType=TIMESTAMP}"); @@ -236,8 +246,12 @@ public class HighCouponCodeSqlProvider { sql.SET("merchant_id = #{merchantId,jdbcType=BIGINT}"); } - if (record.getOrderId() != null) { - sql.SET("order_id = #{orderId,jdbcType=BIGINT}"); + if (record.getStoreId() != null) { + sql.SET("store_id = #{storeId,jdbcType=BIGINT}"); + } + + if (record.getChildOrderId() != null) { + sql.SET("child_order_id = #{childOrderId,jdbcType=BIGINT}"); } if (record.getSalesCode() != null) { diff --git a/hai-service/src/main/java/com/hai/entity/HighCouponCode.java b/hai-service/src/main/java/com/hai/entity/HighCouponCode.java index af285c5f..5f6c8b3d 100644 --- a/hai-service/src/main/java/com/hai/entity/HighCouponCode.java +++ b/hai-service/src/main/java/com/hai/entity/HighCouponCode.java @@ -28,10 +28,15 @@ public class HighCouponCode implements Serializable { */ private Long merchantId; + /** + * (消核门店) 门店id + */ + private Long storeId; + /** * 订单id */ - private Long orderId; + private Long childOrderId; /** * 销售码 @@ -64,7 +69,7 @@ public class HighCouponCode implements Serializable { private Date consumeTime; /** - * 状态:1.待销售 2.未使用 3.已使用 + * 状态:1.待销售 2.未使用 3.已使用 99.预支付 */ private Integer status; @@ -110,12 +115,20 @@ public class HighCouponCode implements Serializable { this.merchantId = merchantId; } - public Long getOrderId() { - return orderId; + public Long getStoreId() { + return storeId; + } + + public void setStoreId(Long storeId) { + this.storeId = storeId; + } + + public Long getChildOrderId() { + return childOrderId; } - public void setOrderId(Long orderId) { - this.orderId = orderId; + public void setChildOrderId(Long childOrderId) { + this.childOrderId = childOrderId; } public String getSalesCode() { @@ -229,7 +242,8 @@ public class HighCouponCode implements Serializable { return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) && (this.getCouponId() == null ? other.getCouponId() == null : this.getCouponId().equals(other.getCouponId())) && (this.getMerchantId() == null ? other.getMerchantId() == null : this.getMerchantId().equals(other.getMerchantId())) - && (this.getOrderId() == null ? other.getOrderId() == null : this.getOrderId().equals(other.getOrderId())) + && (this.getStoreId() == null ? other.getStoreId() == null : this.getStoreId().equals(other.getStoreId())) + && (this.getChildOrderId() == null ? other.getChildOrderId() == null : this.getChildOrderId().equals(other.getChildOrderId())) && (this.getSalesCode() == null ? other.getSalesCode() == null : this.getSalesCode().equals(other.getSalesCode())) && (this.getSalesEndTime() == null ? other.getSalesEndTime() == null : this.getSalesEndTime().equals(other.getSalesEndTime())) && (this.getUseEndTime() == null ? other.getUseEndTime() == null : this.getUseEndTime().equals(other.getUseEndTime())) @@ -251,7 +265,8 @@ public class HighCouponCode implements Serializable { result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getCouponId() == null) ? 0 : getCouponId().hashCode()); result = prime * result + ((getMerchantId() == null) ? 0 : getMerchantId().hashCode()); - result = prime * result + ((getOrderId() == null) ? 0 : getOrderId().hashCode()); + result = prime * result + ((getStoreId() == null) ? 0 : getStoreId().hashCode()); + result = prime * result + ((getChildOrderId() == null) ? 0 : getChildOrderId().hashCode()); result = prime * result + ((getSalesCode() == null) ? 0 : getSalesCode().hashCode()); result = prime * result + ((getSalesEndTime() == null) ? 0 : getSalesEndTime().hashCode()); result = prime * result + ((getUseEndTime() == null) ? 0 : getUseEndTime().hashCode()); @@ -276,7 +291,8 @@ public class HighCouponCode implements Serializable { sb.append(", id=").append(id); sb.append(", couponId=").append(couponId); sb.append(", merchantId=").append(merchantId); - sb.append(", orderId=").append(orderId); + sb.append(", storeId=").append(storeId); + sb.append(", childOrderId=").append(childOrderId); sb.append(", salesCode=").append(salesCode); sb.append(", salesEndTime=").append(salesEndTime); sb.append(", useEndTime=").append(useEndTime); diff --git a/hai-service/src/main/java/com/hai/entity/HighCouponCodeExample.java b/hai-service/src/main/java/com/hai/entity/HighCouponCodeExample.java index 5bee0942..1f8b6c59 100644 --- a/hai-service/src/main/java/com/hai/entity/HighCouponCodeExample.java +++ b/hai-service/src/main/java/com/hai/entity/HighCouponCodeExample.java @@ -305,63 +305,123 @@ public class HighCouponCodeExample { return (Criteria) this; } - public Criteria andOrderIdIsNull() { - addCriterion("order_id is null"); + public Criteria andStoreIdIsNull() { + addCriterion("store_id is null"); return (Criteria) this; } - public Criteria andOrderIdIsNotNull() { - addCriterion("order_id is not null"); + public Criteria andStoreIdIsNotNull() { + addCriterion("store_id is not null"); return (Criteria) this; } - public Criteria andOrderIdEqualTo(Long value) { - addCriterion("order_id =", value, "orderId"); + public Criteria andStoreIdEqualTo(Long value) { + addCriterion("store_id =", value, "storeId"); return (Criteria) this; } - public Criteria andOrderIdNotEqualTo(Long value) { - addCriterion("order_id <>", value, "orderId"); + public Criteria andStoreIdNotEqualTo(Long value) { + addCriterion("store_id <>", value, "storeId"); return (Criteria) this; } - public Criteria andOrderIdGreaterThan(Long value) { - addCriterion("order_id >", value, "orderId"); + public Criteria andStoreIdGreaterThan(Long value) { + addCriterion("store_id >", value, "storeId"); return (Criteria) this; } - public Criteria andOrderIdGreaterThanOrEqualTo(Long value) { - addCriterion("order_id >=", value, "orderId"); + public Criteria andStoreIdGreaterThanOrEqualTo(Long value) { + addCriterion("store_id >=", value, "storeId"); return (Criteria) this; } - public Criteria andOrderIdLessThan(Long value) { - addCriterion("order_id <", value, "orderId"); + public Criteria andStoreIdLessThan(Long value) { + addCriterion("store_id <", value, "storeId"); return (Criteria) this; } - public Criteria andOrderIdLessThanOrEqualTo(Long value) { - addCriterion("order_id <=", value, "orderId"); + public Criteria andStoreIdLessThanOrEqualTo(Long value) { + addCriterion("store_id <=", value, "storeId"); return (Criteria) this; } - public Criteria andOrderIdIn(List values) { - addCriterion("order_id in", values, "orderId"); + public Criteria andStoreIdIn(List values) { + addCriterion("store_id in", values, "storeId"); return (Criteria) this; } - public Criteria andOrderIdNotIn(List values) { - addCriterion("order_id not in", values, "orderId"); + public Criteria andStoreIdNotIn(List values) { + addCriterion("store_id not in", values, "storeId"); return (Criteria) this; } - public Criteria andOrderIdBetween(Long value1, Long value2) { - addCriterion("order_id between", value1, value2, "orderId"); + public Criteria andStoreIdBetween(Long value1, Long value2) { + addCriterion("store_id between", value1, value2, "storeId"); return (Criteria) this; } - public Criteria andOrderIdNotBetween(Long value1, Long value2) { - addCriterion("order_id not between", value1, value2, "orderId"); + public Criteria andStoreIdNotBetween(Long value1, Long value2) { + addCriterion("store_id not between", value1, value2, "storeId"); + return (Criteria) this; + } + + public Criteria andChildOrderIdIsNull() { + addCriterion("child_order_id is null"); + return (Criteria) this; + } + + public Criteria andChildOrderIdIsNotNull() { + addCriterion("child_order_id is not null"); + return (Criteria) this; + } + + public Criteria andChildOrderIdEqualTo(Long value) { + addCriterion("child_order_id =", value, "childOrderId"); + return (Criteria) this; + } + + public Criteria andChildOrderIdNotEqualTo(Long value) { + addCriterion("child_order_id <>", value, "childOrderId"); + return (Criteria) this; + } + + public Criteria andChildOrderIdGreaterThan(Long value) { + addCriterion("child_order_id >", value, "childOrderId"); + return (Criteria) this; + } + + public Criteria andChildOrderIdGreaterThanOrEqualTo(Long value) { + addCriterion("child_order_id >=", value, "childOrderId"); + return (Criteria) this; + } + + public Criteria andChildOrderIdLessThan(Long value) { + addCriterion("child_order_id <", value, "childOrderId"); + return (Criteria) this; + } + + public Criteria andChildOrderIdLessThanOrEqualTo(Long value) { + addCriterion("child_order_id <=", value, "childOrderId"); + return (Criteria) this; + } + + public Criteria andChildOrderIdIn(List values) { + addCriterion("child_order_id in", values, "childOrderId"); + return (Criteria) this; + } + + public Criteria andChildOrderIdNotIn(List values) { + addCriterion("child_order_id not in", values, "childOrderId"); + return (Criteria) this; + } + + public Criteria andChildOrderIdBetween(Long value1, Long value2) { + addCriterion("child_order_id between", value1, value2, "childOrderId"); + return (Criteria) this; + } + + public Criteria andChildOrderIdNotBetween(Long value1, Long value2) { + addCriterion("child_order_id not between", value1, value2, "childOrderId"); return (Criteria) this; } diff --git a/hai-service/src/main/java/com/hai/service/HighCouponCodeService.java b/hai-service/src/main/java/com/hai/service/HighCouponCodeService.java index b0badeee..26ba1180 100644 --- a/hai-service/src/main/java/com/hai/service/HighCouponCodeService.java +++ b/hai-service/src/main/java/com/hai/service/HighCouponCodeService.java @@ -28,6 +28,20 @@ public interface HighCouponCodeService { **/ void insertList(List list); + /** + * @Author 胡锐 + * @Description xiug + * @Date 2021/3/27 1:20 + **/ + void updateCouponCode(HighCouponCode highCouponCode); + + /** + * @Author 胡锐 + * @Description 根据订单id查询 + * @Date 2021/3/27 1:25 + **/ + HighCouponCode getCouponCodeByOrderId(Long childOrderId); + /** * * @Title: getStockCountByCoupon @@ -39,6 +53,13 @@ public interface HighCouponCodeService { **/ Integer getStockCountByCoupon(Long couponId); + /** + * @Author 胡锐 + * @Description 查询未销售的卡卷码 + * @Date 2021/3/27 1:16 + **/ + List getNoSaleCode(Long couponId); + /** * @Author 胡锐 * @Description 查询销售码 diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java index d4cc97ed..27fa90f6 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java @@ -11,6 +11,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Date; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -38,6 +39,23 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService { highCouponCodeMapperExt.insertList(list); } + @Override + public void updateCouponCode(HighCouponCode highCouponCode) { + highCouponCodeMapper.updateByPrimaryKey(highCouponCode); + } + + @Override + public HighCouponCode getCouponCodeByOrderId(Long childOrderId) { + HighCouponCodeExample example = new HighCouponCodeExample(); + example.createCriteria().andChildOrderIdEqualTo(childOrderId); + + List codes = highCouponCodeMapper.selectByExample(example); + if (codes != null && codes.size() > 0) { + return codes.get(0); + } + return null; + } + @Override public Integer getStockCountByCoupon(Long couponId) { HighCouponCodeExample example = new HighCouponCodeExample(); @@ -45,6 +63,14 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService { return highCouponCodeMapper.selectByExample(example).size(); } + @Override + public List getNoSaleCode(Long couponId) { + Map map = new HashMap<>(); + map.put("couponId", couponId); + map.put("status", 1); + return getCouponCodeList(map); + } + @Override public List getCouponCodeList(Map map) { HighCouponCodeExample example = new HighCouponCodeExample(); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index fb2b9ed6..14ff3b89 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -1,11 +1,12 @@ package com.hai.service.impl; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; import com.hai.dao.HighChildOrderMapper; import com.hai.dao.HighOrderMapper; -import com.hai.entity.HighChildOrder; -import com.hai.entity.HighChildOrderExample; -import com.hai.entity.HighOrder; -import com.hai.entity.HighOrderExample; +import com.hai.entity.*; +import com.hai.service.HighCouponCodeService; import com.hai.service.HighOrderService; import org.apache.commons.collections4.MapUtils; import org.springframework.stereotype.Service; @@ -13,6 +14,7 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -30,6 +32,9 @@ public class HighOrderServiceImpl implements HighOrderService { @Resource private HighChildOrderMapper highChildOrderMapper; + @Resource + private HighCouponCodeService highCouponCodeService; + @Override @Transactional(propagation= Propagation.REQUIRES_NEW) public void insertOrder(HighOrder highOrder) { @@ -38,6 +43,18 @@ public class HighOrderServiceImpl implements HighOrderService { for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { childOrder.setOrderId(highOrder.getId()); highChildOrderMapper.insert(childOrder); + + // 商品类型 1:卡卷 + if (childOrder.getGoodsType() == 1) { + // 查询待销售 + List list = highCouponCodeService.getNoSaleCode(childOrder.getGoodsId()); + if (list == null || list.size() == 0) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COUPON_STOCK_INSUFFICIENT, ""); + } + list.get(0).setChildOrderId(childOrder.getId()); + list.get(0).setStatus(99); // 状态:1.待销售 2.未使用 3.已使用 99.预支付 + highCouponCodeService.updateCouponCode(list.get(0)); + } } } diff --git a/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java index 76116496..4e690c69 100644 --- a/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java @@ -5,7 +5,9 @@ import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.entity.HighChildOrder; +import com.hai.entity.HighCouponCode; import com.hai.entity.HighOrder; +import com.hai.service.HighCouponCodeService; import com.hai.service.HighOrderService; import com.hai.service.pay.PayService; import org.apache.commons.lang3.StringUtils; @@ -28,6 +30,9 @@ public class GoodsOrderServiceImpl implements PayService { @Resource private HighOrderService highOrderService; + @Resource + private HighCouponCodeService highCouponCodeService; + @Override public void paySuccess(Map map, String payType) throws Exception { if (payType.equals("Alipay")) { @@ -49,6 +54,11 @@ public class GoodsOrderServiceImpl implements PayService { for (HighChildOrder highChildOrder : order.getHighChildOrderList()) { highChildOrder.setChildOrdeStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 + + // 商品类型 1:卡卷 + if (highChildOrder.getGoodsType() == 1) { + // highCouponCodeService.getCouponCodeById(highChildOrder.get) + } } highOrderService.updateOrder(order);