'提交代码'

dev-discount
199901012 4 years ago
parent dfe1c8a124
commit 8c4ce3d92c
  1. 41
      hai-service/src/main/java/com/hai/dao/HighCouponCodeMapper.java
  2. 30
      hai-service/src/main/java/com/hai/dao/HighCouponCodeSqlProvider.java
  3. 34
      hai-service/src/main/java/com/hai/entity/HighCouponCode.java
  4. 108
      hai-service/src/main/java/com/hai/entity/HighCouponCodeExample.java
  5. 21
      hai-service/src/main/java/com/hai/service/HighCouponCodeService.java
  6. 26
      hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java
  7. 25
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  8. 10
      hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java

@ -40,19 +40,21 @@ public interface HighCouponCodeMapper extends HighCouponCodeMapperExt {
@Insert({ @Insert({
"insert into high_coupon_code (coupon_id, merchant_id, ", "insert into high_coupon_code (coupon_id, merchant_id, ",
"order_id, sales_code, ", "store_id, child_order_id, ",
"sales_end_time, use_end_time, ", "sales_code, sales_end_time, ",
"create_time, receive_time, ", "use_end_time, create_time, ",
"consume_time, `status`, ", "receive_time, consume_time, ",
"operator_id, operator_name, ", "`status`, operator_id, ",
"ext_1, ext_2, ext_3)", "operator_name, ext_1, ",
"ext_2, ext_3)",
"values (#{couponId,jdbcType=BIGINT}, #{merchantId,jdbcType=BIGINT}, ", "values (#{couponId,jdbcType=BIGINT}, #{merchantId,jdbcType=BIGINT}, ",
"#{orderId,jdbcType=BIGINT}, #{salesCode,jdbcType=VARCHAR}, ", "#{storeId,jdbcType=BIGINT}, #{childOrderId,jdbcType=BIGINT}, ",
"#{salesEndTime,jdbcType=TIMESTAMP}, #{useEndTime,jdbcType=TIMESTAMP}, ", "#{salesCode,jdbcType=VARCHAR}, #{salesEndTime,jdbcType=TIMESTAMP}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{receiveTime,jdbcType=TIMESTAMP}, ", "#{useEndTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{consumeTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ", "#{receiveTime,jdbcType=TIMESTAMP}, #{consumeTime,jdbcType=TIMESTAMP}, ",
"#{operatorId,jdbcType=BIGINT}, #{operatorName,jdbcType=VARCHAR}, ", "#{status,jdbcType=INTEGER}, #{operatorId,jdbcType=BIGINT}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" "#{operatorName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
}) })
@Options(useGeneratedKeys=true,keyProperty="id") @Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighCouponCode record); 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="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT),
@Result(column="merchant_id", property="merchantId", 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_code", property="salesCode", jdbcType=JdbcType.VARCHAR),
@Result(column="sales_end_time", property="salesEndTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="sales_end_time", property="salesEndTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="use_end_time", property="useEndTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="use_end_time", property="useEndTime", jdbcType=JdbcType.TIMESTAMP),
@ -84,9 +87,9 @@ public interface HighCouponCodeMapper extends HighCouponCodeMapperExt {
@Select({ @Select({
"select", "select",
"id, coupon_id, merchant_id, order_id, sales_code, sales_end_time, use_end_time, ", "id, coupon_id, merchant_id, store_id, child_order_id, sales_code, sales_end_time, ",
"create_time, receive_time, consume_time, `status`, operator_id, operator_name, ", "use_end_time, create_time, receive_time, consume_time, `status`, operator_id, ",
"ext_1, ext_2, ext_3", "operator_name, ext_1, ext_2, ext_3",
"from high_coupon_code", "from high_coupon_code",
"where id = #{id,jdbcType=BIGINT}" "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="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT), @Result(column="coupon_id", property="couponId", jdbcType=JdbcType.BIGINT),
@Result(column="merchant_id", property="merchantId", 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_code", property="salesCode", jdbcType=JdbcType.VARCHAR),
@Result(column="sales_end_time", property="salesEndTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="sales_end_time", property="salesEndTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="use_end_time", property="useEndTime", 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", "update high_coupon_code",
"set coupon_id = #{couponId,jdbcType=BIGINT},", "set coupon_id = #{couponId,jdbcType=BIGINT},",
"merchant_id = #{merchantId,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_code = #{salesCode,jdbcType=VARCHAR},",
"sales_end_time = #{salesEndTime,jdbcType=TIMESTAMP},", "sales_end_time = #{salesEndTime,jdbcType=TIMESTAMP},",
"use_end_time = #{useEndTime,jdbcType=TIMESTAMP},", "use_end_time = #{useEndTime,jdbcType=TIMESTAMP},",

@ -36,8 +36,12 @@ public class HighCouponCodeSqlProvider {
sql.VALUES("merchant_id", "#{merchantId,jdbcType=BIGINT}"); sql.VALUES("merchant_id", "#{merchantId,jdbcType=BIGINT}");
} }
if (record.getOrderId() != null) { if (record.getStoreId() != null) {
sql.VALUES("order_id", "#{orderId,jdbcType=BIGINT}"); sql.VALUES("store_id", "#{storeId,jdbcType=BIGINT}");
}
if (record.getChildOrderId() != null) {
sql.VALUES("child_order_id", "#{childOrderId,jdbcType=BIGINT}");
} }
if (record.getSalesCode() != null) { if (record.getSalesCode() != null) {
@ -100,7 +104,8 @@ public class HighCouponCodeSqlProvider {
} }
sql.SELECT("coupon_id"); sql.SELECT("coupon_id");
sql.SELECT("merchant_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_code");
sql.SELECT("sales_end_time"); sql.SELECT("sales_end_time");
sql.SELECT("use_end_time"); sql.SELECT("use_end_time");
@ -142,8 +147,12 @@ public class HighCouponCodeSqlProvider {
sql.SET("merchant_id = #{record.merchantId,jdbcType=BIGINT}"); sql.SET("merchant_id = #{record.merchantId,jdbcType=BIGINT}");
} }
if (record.getOrderId() != null) { if (record.getStoreId() != null) {
sql.SET("order_id = #{record.orderId,jdbcType=BIGINT}"); 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) { if (record.getSalesCode() != null) {
@ -205,7 +214,8 @@ public class HighCouponCodeSqlProvider {
sql.SET("id = #{record.id,jdbcType=BIGINT}"); sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("coupon_id = #{record.couponId,jdbcType=BIGINT}"); sql.SET("coupon_id = #{record.couponId,jdbcType=BIGINT}");
sql.SET("merchant_id = #{record.merchantId,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_code = #{record.salesCode,jdbcType=VARCHAR}");
sql.SET("sales_end_time = #{record.salesEndTime,jdbcType=TIMESTAMP}"); sql.SET("sales_end_time = #{record.salesEndTime,jdbcType=TIMESTAMP}");
sql.SET("use_end_time = #{record.useEndTime,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}"); sql.SET("merchant_id = #{merchantId,jdbcType=BIGINT}");
} }
if (record.getOrderId() != null) { if (record.getStoreId() != null) {
sql.SET("order_id = #{orderId,jdbcType=BIGINT}"); sql.SET("store_id = #{storeId,jdbcType=BIGINT}");
}
if (record.getChildOrderId() != null) {
sql.SET("child_order_id = #{childOrderId,jdbcType=BIGINT}");
} }
if (record.getSalesCode() != null) { if (record.getSalesCode() != null) {

@ -28,10 +28,15 @@ public class HighCouponCode implements Serializable {
*/ */
private Long merchantId; private Long merchantId;
/**
* (消核门店) 门店id
*/
private Long storeId;
/** /**
* 订单id * 订单id
*/ */
private Long orderId; private Long childOrderId;
/** /**
* 销售码 * 销售码
@ -64,7 +69,7 @@ public class HighCouponCode implements Serializable {
private Date consumeTime; private Date consumeTime;
/** /**
* 状态1.待销售 2.未使用 3.已使用 * 状态1.待销售 2.未使用 3.已使用 99.预支付
*/ */
private Integer status; private Integer status;
@ -110,12 +115,20 @@ public class HighCouponCode implements Serializable {
this.merchantId = merchantId; this.merchantId = merchantId;
} }
public Long getOrderId() { public Long getStoreId() {
return orderId; return storeId;
}
public void setStoreId(Long storeId) {
this.storeId = storeId;
}
public Long getChildOrderId() {
return childOrderId;
} }
public void setOrderId(Long orderId) { public void setChildOrderId(Long childOrderId) {
this.orderId = orderId; this.childOrderId = childOrderId;
} }
public String getSalesCode() { public String getSalesCode() {
@ -229,7 +242,8 @@ public class HighCouponCode implements Serializable {
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getCouponId() == null ? other.getCouponId() == null : this.getCouponId().equals(other.getCouponId())) && (this.getCouponId() == null ? other.getCouponId() == null : this.getCouponId().equals(other.getCouponId()))
&& (this.getMerchantId() == null ? other.getMerchantId() == null : this.getMerchantId().equals(other.getMerchantId())) && (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.getSalesCode() == null ? other.getSalesCode() == null : this.getSalesCode().equals(other.getSalesCode()))
&& (this.getSalesEndTime() == null ? other.getSalesEndTime() == null : this.getSalesEndTime().equals(other.getSalesEndTime())) && (this.getSalesEndTime() == null ? other.getSalesEndTime() == null : this.getSalesEndTime().equals(other.getSalesEndTime()))
&& (this.getUseEndTime() == null ? other.getUseEndTime() == null : this.getUseEndTime().equals(other.getUseEndTime())) && (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 + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getCouponId() == null) ? 0 : getCouponId().hashCode()); result = prime * result + ((getCouponId() == null) ? 0 : getCouponId().hashCode());
result = prime * result + ((getMerchantId() == null) ? 0 : getMerchantId().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 + ((getSalesCode() == null) ? 0 : getSalesCode().hashCode());
result = prime * result + ((getSalesEndTime() == null) ? 0 : getSalesEndTime().hashCode()); result = prime * result + ((getSalesEndTime() == null) ? 0 : getSalesEndTime().hashCode());
result = prime * result + ((getUseEndTime() == null) ? 0 : getUseEndTime().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(", id=").append(id);
sb.append(", couponId=").append(couponId); sb.append(", couponId=").append(couponId);
sb.append(", merchantId=").append(merchantId); 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(", salesCode=").append(salesCode);
sb.append(", salesEndTime=").append(salesEndTime); sb.append(", salesEndTime=").append(salesEndTime);
sb.append(", useEndTime=").append(useEndTime); sb.append(", useEndTime=").append(useEndTime);

@ -305,63 +305,123 @@ public class HighCouponCodeExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andOrderIdIsNull() { public Criteria andStoreIdIsNull() {
addCriterion("order_id is null"); addCriterion("store_id is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andOrderIdIsNotNull() { public Criteria andStoreIdIsNotNull() {
addCriterion("order_id is not null"); addCriterion("store_id is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andOrderIdEqualTo(Long value) { public Criteria andStoreIdEqualTo(Long value) {
addCriterion("order_id =", value, "orderId"); addCriterion("store_id =", value, "storeId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andOrderIdNotEqualTo(Long value) { public Criteria andStoreIdNotEqualTo(Long value) {
addCriterion("order_id <>", value, "orderId"); addCriterion("store_id <>", value, "storeId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andOrderIdGreaterThan(Long value) { public Criteria andStoreIdGreaterThan(Long value) {
addCriterion("order_id >", value, "orderId"); addCriterion("store_id >", value, "storeId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andOrderIdGreaterThanOrEqualTo(Long value) { public Criteria andStoreIdGreaterThanOrEqualTo(Long value) {
addCriterion("order_id >=", value, "orderId"); addCriterion("store_id >=", value, "storeId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andOrderIdLessThan(Long value) { public Criteria andStoreIdLessThan(Long value) {
addCriterion("order_id <", value, "orderId"); addCriterion("store_id <", value, "storeId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andOrderIdLessThanOrEqualTo(Long value) { public Criteria andStoreIdLessThanOrEqualTo(Long value) {
addCriterion("order_id <=", value, "orderId"); addCriterion("store_id <=", value, "storeId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andOrderIdIn(List<Long> values) { public Criteria andStoreIdIn(List<Long> values) {
addCriterion("order_id in", values, "orderId"); addCriterion("store_id in", values, "storeId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andOrderIdNotIn(List<Long> values) { public Criteria andStoreIdNotIn(List<Long> values) {
addCriterion("order_id not in", values, "orderId"); addCriterion("store_id not in", values, "storeId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andOrderIdBetween(Long value1, Long value2) { public Criteria andStoreIdBetween(Long value1, Long value2) {
addCriterion("order_id between", value1, value2, "orderId"); addCriterion("store_id between", value1, value2, "storeId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andOrderIdNotBetween(Long value1, Long value2) { public Criteria andStoreIdNotBetween(Long value1, Long value2) {
addCriterion("order_id not between", value1, value2, "orderId"); 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<Long> values) {
addCriterion("child_order_id in", values, "childOrderId");
return (Criteria) this;
}
public Criteria andChildOrderIdNotIn(List<Long> 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; return (Criteria) this;
} }

@ -28,6 +28,20 @@ public interface HighCouponCodeService {
**/ **/
void insertList(List<HighCouponCode> list); void insertList(List<HighCouponCode> 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 * @Title: getStockCountByCoupon
@ -39,6 +53,13 @@ public interface HighCouponCodeService {
**/ **/
Integer getStockCountByCoupon(Long couponId); Integer getStockCountByCoupon(Long couponId);
/**
* @Author 胡锐
* @Description 查询未销售的卡卷码
* @Date 2021/3/27 1:16
**/
List<HighCouponCode> getNoSaleCode(Long couponId);
/** /**
* @Author 胡锐 * @Author 胡锐
* @Description 查询销售码 * @Description 查询销售码

@ -11,6 +11,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -38,6 +39,23 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService {
highCouponCodeMapperExt.insertList(list); 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<HighCouponCode> codes = highCouponCodeMapper.selectByExample(example);
if (codes != null && codes.size() > 0) {
return codes.get(0);
}
return null;
}
@Override @Override
public Integer getStockCountByCoupon(Long couponId) { public Integer getStockCountByCoupon(Long couponId) {
HighCouponCodeExample example = new HighCouponCodeExample(); HighCouponCodeExample example = new HighCouponCodeExample();
@ -45,6 +63,14 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService {
return highCouponCodeMapper.selectByExample(example).size(); return highCouponCodeMapper.selectByExample(example).size();
} }
@Override
public List<HighCouponCode> getNoSaleCode(Long couponId) {
Map<String, Object> map = new HashMap<>();
map.put("couponId", couponId);
map.put("status", 1);
return getCouponCodeList(map);
}
@Override @Override
public List<HighCouponCode> getCouponCodeList(Map<String, Object> map) { public List<HighCouponCode> getCouponCodeList(Map<String, Object> map) {
HighCouponCodeExample example = new HighCouponCodeExample(); HighCouponCodeExample example = new HighCouponCodeExample();

@ -1,11 +1,12 @@
package com.hai.service.impl; 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.HighChildOrderMapper;
import com.hai.dao.HighOrderMapper; import com.hai.dao.HighOrderMapper;
import com.hai.entity.HighChildOrder; import com.hai.entity.*;
import com.hai.entity.HighChildOrderExample; import com.hai.service.HighCouponCodeService;
import com.hai.entity.HighOrder;
import com.hai.entity.HighOrderExample;
import com.hai.service.HighOrderService; import com.hai.service.HighOrderService;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -13,6 +14,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -30,6 +32,9 @@ public class HighOrderServiceImpl implements HighOrderService {
@Resource @Resource
private HighChildOrderMapper highChildOrderMapper; private HighChildOrderMapper highChildOrderMapper;
@Resource
private HighCouponCodeService highCouponCodeService;
@Override @Override
@Transactional(propagation= Propagation.REQUIRES_NEW) @Transactional(propagation= Propagation.REQUIRES_NEW)
public void insertOrder(HighOrder highOrder) { public void insertOrder(HighOrder highOrder) {
@ -38,6 +43,18 @@ public class HighOrderServiceImpl implements HighOrderService {
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
childOrder.setOrderId(highOrder.getId()); childOrder.setOrderId(highOrder.getId());
highChildOrderMapper.insert(childOrder); highChildOrderMapper.insert(childOrder);
// 商品类型 1:卡卷
if (childOrder.getGoodsType() == 1) {
// 查询待销售
List<HighCouponCode> 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));
}
} }
} }

@ -5,7 +5,9 @@ import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
import com.hai.entity.HighChildOrder; import com.hai.entity.HighChildOrder;
import com.hai.entity.HighCouponCode;
import com.hai.entity.HighOrder; import com.hai.entity.HighOrder;
import com.hai.service.HighCouponCodeService;
import com.hai.service.HighOrderService; import com.hai.service.HighOrderService;
import com.hai.service.pay.PayService; import com.hai.service.pay.PayService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -28,6 +30,9 @@ public class GoodsOrderServiceImpl implements PayService {
@Resource @Resource
private HighOrderService highOrderService; private HighOrderService highOrderService;
@Resource
private HighCouponCodeService highCouponCodeService;
@Override @Override
public void paySuccess(Map<String, String> map, String payType) throws Exception { public void paySuccess(Map<String, String> map, String payType) throws Exception {
if (payType.equals("Alipay")) { if (payType.equals("Alipay")) {
@ -49,6 +54,11 @@ public class GoodsOrderServiceImpl implements PayService {
for (HighChildOrder highChildOrder : order.getHighChildOrderList()) { for (HighChildOrder highChildOrder : order.getHighChildOrderList()) {
highChildOrder.setChildOrdeStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消 highChildOrder.setChildOrdeStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
// 商品类型 1:卡卷
if (highChildOrder.getGoodsType() == 1) {
// highCouponCodeService.getCouponCodeById(highChildOrder.get)
}
} }
highOrderService.updateOrder(order); highOrderService.updateOrder(order);

Loading…
Cancel
Save