winter 1 год назад
Родитель
Сommit
3e647c361f
8 измененных файлов: 79 добавлений и 10 удалений
  1. +4
    -3
      mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java
  2. +2
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCouponOrder.java
  3. +3
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxOrder.java
  4. +35
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumCouponUseLimitFrequency.java
  5. +11
    -2
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java
  6. +17
    -5
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml
  7. +3
    -0
      mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml
  8. +4
    -0
      mallinkService/src/main/resources/mapper/WxOrderMapper.xml

+ 4
- 3
mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java Просмотреть файл

@@ -111,8 +111,9 @@ public class WxCoupon extends TenantEntity {
private Integer usePrice;
@io.swagger.annotations.ApiModelProperty(value="运费",name="freightPrice")
private Integer freightPrice;
//EnumCouponUseLimitRule
@io.swagger.annotations.ApiModelProperty(value="限领规则",name="useLimitRule")
@io.swagger.annotations.ApiModelProperty(value="限领频次EnumCouponUseLimitFrequency",name="useLimitFrequency")
private Integer useLimitFrequency;
@io.swagger.annotations.ApiModelProperty(value="限领规则EnumCouponUseLimitRule",name="useLimitRule")
private Integer useLimitRule;
@io.swagger.annotations.ApiModelProperty(value="限领张数",name="useLimitQuantity")
private Integer useLimitQuantity;
@@ -546,5 +547,5 @@ public class WxCoupon extends TenantEntity {

@io.swagger.annotations.ApiModelProperty(value = "场景投放发劵显示筛选")
private Boolean specifyShowFlag;
}

+ 2
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCouponOrder.java Просмотреть файл

@@ -213,5 +213,7 @@ public class WxCouponOrder extends TenantEntity {
private Long startCreateDateTimes;
@TableField(exist = false)
private Long endCreateDateTimes;
@TableField(exist = false)
private Date createDateLike;

}

+ 3
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxOrder.java Просмотреть файл

@@ -208,4 +208,7 @@ public class WxOrder extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value="配送类型 0:默认(无) 1:自提 2:配送",name="shippingType")
private Integer shippingType;
@TableField(exist = false)
private Date createDateLike;
}

+ 35
- 0
mallinkService/src/main/java/com/iformall/enums/EnumCouponUseLimitFrequency.java Просмотреть файл

@@ -0,0 +1,35 @@
package com.iformall.enums;

/**
* 商品限购频次
*/
public enum EnumCouponUseLimitFrequency {

TOTAL(1, "累计"),
PERDAY(2, "每日");

public static EnumCouponUseLimitFrequency getEnum(Integer code) {
for (EnumCouponUseLimitFrequency value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}

private Integer code;
private String message;

EnumCouponUseLimitFrequency(Integer code, String message) {
this.code = code;
this.message = message;
}

public Integer getCode() {
return code;
}

public String getMessage() {
return message;
}
}

+ 11
- 2
mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java Просмотреть файл

@@ -686,6 +686,9 @@ public class WxOrderServiceImpl implements WxOrderService {
statusS.add(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode());
statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode());
orderQ.setStatusS(statusS);
if (counpon.getUseLimitFrequency().intValue() == EnumCouponUseLimitFrequency.PERDAY.getCode().intValue()) {
orderQ.setCreateDateLike(new Date());
}
return wxOrderMapper.countListProduct(orderQ);
} catch (Exception e) {
logger.error("购买是否超限-DB, couponId: " + counpon.getId() + ", e:" + e.getMessage(),e);
@@ -801,6 +804,10 @@ public class WxOrderServiceImpl implements WxOrderService {
// }
// couponOrderQ.setCouponId(counpon.getId());
}
//限购频次
if (counpon.getUseLimitFrequency().intValue() == EnumCouponUseLimitFrequency.PERDAY.getCode().intValue()) {
couponOrderQ.setCreateDateLike(new Date());
}
return wxCouponOrderMapper.findProductCount(couponOrderQ)+couponNumber;
} catch(MallinkException e1) {
throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(),e1.getMessage());
@@ -1108,8 +1115,10 @@ public class WxOrderServiceImpl implements WxOrderService {
throw new MallinkException(ErrorCode.ORDER_IS_LIMITED.getCode(),"此券购买数量已超限["+coupon.getTitle()+"], couponId: " + coupon.getId() + ", count: " + paidCount);
}
//如果允许未支付的,则未支付的+已支付的不能超过限购
if ((unPaidcount+paidCount) > coupon.getUseLimitQuantity()) {
throw new MallinkException(ErrorCode.ORDER_IS_LIMITED.getCode(),"此券[未支付+已支付]购买数量已超限["+coupon.getTitle()+"], couponId: " + coupon.getId()+ ", count: " + paidCount);
if (allowUnPayOrder) {
if ((unPaidcount+paidCount) > coupon.getUseLimitQuantity()) {
throw new MallinkException(ErrorCode.ORDER_IS_LIMITED.getCode(),"此券[未支付+已支付]购买数量已超限["+coupon.getTitle()+"], couponId: " + coupon.getId()+ ", count: " + paidCount);
}
}
boolean isReduceStock = true;


+ 17
- 5
mallinkService/src/main/resources/mapper/WxCouponMapper.xml Просмотреть файл

@@ -19,6 +19,7 @@
<result column="sale_price" jdbcType="INTEGER" property="salePrice"/>
<result column="freight_price" jdbcType="INTEGER" property="freightPrice"/>
<result column="use_price" jdbcType="INTEGER" property="usePrice"/>
<result column="use_limit_frequency" jdbcType="INTEGER" property="useLimitFrequency"/>
<result column="use_limit_rule" jdbcType="INTEGER" property="useLimitRule"/>
<result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/>
<result column="send_type" jdbcType="INTEGER" property="sendType"/>
@@ -97,6 +98,7 @@
<result column="sale_price" jdbcType="INTEGER" property="salePrice"/>
<result column="freight_price" jdbcType="INTEGER" property="freightPrice"/>
<result column="use_price" jdbcType="INTEGER" property="usePrice"/>
<result column="use_limit_frequency" jdbcType="INTEGER" property="useLimitFrequency"/>
<result column="use_limit_rule" jdbcType="INTEGER" property="useLimitRule"/>
<result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/>
<result column="send_type" jdbcType="INTEGER" property="sendType"/>
@@ -140,7 +142,7 @@

<sql id="allColumns">
c.`id`,c.`coupon_id`,c.`version`,c.`tenant_id`,c.`parent_tenant_id`,c.`make_merchant_id`,c.`brand`,c.`type`,c.`cover_img`,c.`cover_picture`,c.`detail_picture`,
c.`title`,c.`sub_title`,c.`item_group`,c.`sale_price`,c.`freight_price`,c.`use_price`,c.`use_limit_rule`,c.`use_limit_quantity`,c.`send_type`,c.`create_coupon_password_finished`,
c.`title`,c.`sub_title`,c.`item_group`,c.`sale_price`,c.`freight_price`,c.`use_price`,c.`use_limit_frequency`,c.`use_limit_rule`,c.`use_limit_quantity`,c.`send_type`,c.`create_coupon_password_finished`,
c.`sold_start_time`,c.`sold_end_time`,c.`valid_type`,c.`valid_start_date`,c.`valid_end_date`,c.`valid_days`,c.`detail`,c.`price`,c.tail_price,c.orig_price,c.`unit`,c.`remain_inventory`,c.`inventory`,
c.`remark`,c.`status`,c.`create_date`,c.`update_date`,c.`business`,c.`sub_business`,c.`support_transfer`,c.`subsidy_num`,c.`subsidy_type`,c.`is_after_set_price`,c.`card_score_rule`,
c.`press_limit_num`, c.`press_limit_hours`,c.`press_pay_reduce_stock`,c.`press_support_is_new`, c.`auto_refund`,c.`credit_price`,c.`credit_refund`,c.`put_apply_status`,c.`stock_apply_status`,c.`cancle_apply_status`,
@@ -197,6 +199,10 @@
and `use_price` = #{usePrice}
</if>

<if test=" null != useLimitFrequency ">
and `use_limit_frequency` = #{useLimitFrequency}
</if>
<if test=" null != useLimitRule ">
and `use_limit_rule` = #{useLimitRule}
</if>
@@ -449,7 +455,7 @@
<select id="findCouponCVoDetail" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select c.id,c.coupon_id,c.version,c.type,c.cover_img,c.cover_picture,c.detail_picture,c.title,c.sub_title,c.item_group,c.sale_price,c.use_price,
c.use_limit_rule,c.use_limit_quantity,c.send_type,c.sold_start_time,c.sold_end_time,c.valid_type,c.valid_start_date,c.valid_end_date,
c.use_limit_frequency,c.use_limit_rule,c.use_limit_quantity,c.send_type,c.sold_start_time,c.sold_end_time,c.valid_type,c.valid_start_date,c.valid_end_date,
c.valid_days,c.detail,c.price,c.tail_price,c.orig_price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.is_after_set_price,c.card_score_rule,
c.create_date,c.update_date,c.business,c.sub_business,c.support_transfer,c.press_limit_num, c.auto_refund,c.credit_price,c.conditions,c.content_type
from wx_coupon c where c.`version` = 0 and c.id = #{id} and c.`tenant_id` = #{tenantId}
@@ -502,7 +508,7 @@
<select id="findSendCouponList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select
c.id,c.coupon_id,c.version,c.remain_inventory, c.use_limit_rule,c.use_limit_quantity, c.inventory, c.valid_start_date, c.valid_end_date,c.valid_type,c.valid_days
c.id,c.coupon_id,c.version,c.remain_inventory, c.use_limit_frequency,c.use_limit_rule,c.use_limit_quantity, c.inventory, c.valid_start_date, c.valid_end_date,c.valid_type,c.valid_days
from wx_coupon c
where c.`version` = 0 and c.`tenant_id` = #{tenantId}
<if test=" null != ids ">
@@ -580,6 +586,10 @@
<if test=" null != usePrice ">
and c.`use_price` = #{usePrice}
</if>
<if test=" null != useLimitFrequency ">
and c.`use_limit_frequency` = #{useLimitFrequency}
</if>

<if test=" null != useLimitRule ">
and c.`use_limit_rule` = #{useLimitRule}
@@ -847,6 +857,7 @@
<result column="support_transfer" jdbcType="INTEGER" property="supportTransfer"/>
<result column="subsidy_type" jdbcType="INTEGER" property="subsidyType"/>
<result column="subsidy_num" jdbcType="INTEGER" property="subsidyNum"/>
<result column="use_limit_frequency" jdbcType="INTEGER" property="useLimitFrequency"/>
<result column="press_limit_num" jdbcType="INTEGER" property="pressLimitNum"/>
<result column="press_limit_hours" jdbcType="INTEGER" property="pressLimitHours"/>
<result column="press_pay_reduce_stock" jdbcType="INTEGER" property="pressPayReduceStock"/>
@@ -879,6 +890,7 @@
<result column="sale_price" jdbcType="INTEGER" property="salePrice"/>
<result column="freight_price" jdbcType="INTEGER" property="freightPrice"/>
<result column="use_price" jdbcType="INTEGER" property="usePrice"/>
<result column="use_limit_frequency" jdbcType="INTEGER" property="useLimitFrequency"/>
<result column="use_limit_rule" jdbcType="INTEGER" property="useLimitRule"/>
<result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity"/>
<result column="send_type" jdbcType="INTEGER" property="sendType"/>
@@ -1412,7 +1424,7 @@
wc.tenant_id,wc.parent_tenant_id,wc.`type`,wc.`cover_img`,wc.`cover_picture`,wc.`detail_picture`,wc.`title`,wc.`sub_title`,wc.`item_group`,wc.`sale_price`,wc.`freight_price`,wc.`use_price`,wc.`use_limit_rule`,wc.`use_limit_quantity`,wc.`send_type`,
wc.sold_start_time,wc.sold_end_time,wc.`valid_type`,wc.`valid_start_date`,wc.`valid_end_date`,wc.`valid_days`,wc.`detail`,wc.`price`,wc.tail_price,wc.orig_price,wc.`unit`,wc.`remain_inventory`,wc.`inventory`,
wc.`remark`,wc.`status`,wc.`create_date`,wc.`update_date`,wc.`business`,wc.`sub_business`,wc.`support_transfer`,wc.`subsidy_num`,wc.`subsidy_type`,
wc.`press_limit_num`, wc.`press_limit_hours`,wc.`press_pay_reduce_stock`,wc.`press_support_is_new`, wc.`auto_refund`,wc.`credit_price`,wc.`credit_refund`,wc.`conditions`,
wc.`use_limit_frequency`,wc.`press_limit_num`, wc.`press_limit_hours`,wc.`press_pay_reduce_stock`,wc.`press_support_is_new`, wc.`auto_refund`,wc.`credit_price`,wc.`credit_refund`,wc.`conditions`,
wc.title as couponName,wc.`cover_img` as couponPic,wc.`cover_picture` as couponPicture,wc.`detail_picture` as detailPicture
from wx_coupon_channel ct
left join wx_coupon wc on wc.id = ct.coupon_id
@@ -1441,7 +1453,7 @@

<select id="newfindCList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select id,coupon_id,version,remain_inventory,inventory,cover_img,cover_picture,detail_picture,title,sub_title,item_group,sale_price,use_price,price,tail_price,
orig_price,unit,use_limit_rule,use_limit_quantity,send_type,support_transfer,press_limit_num,auto_refund,
orig_price,unit,use_limit_frequency,use_limit_rule,use_limit_quantity,send_type,support_transfer,press_limit_num,auto_refund,
conditions,valid_type,sold_start_time,sold_end_time,valid_start_date,valid_end_date,valid_days,credit_price,
remark,content_type,source_type,merchant_type
from wx_coupon


+ 3
- 0
mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml Просмотреть файл

@@ -617,6 +617,9 @@
<if test=" null != couponType ">
and co.coupon_type = #{couponType}
</if>
<if test=" null != createDateLike ">
and co.create_date like concat('', #{createDateLike},'%')
</if>
<if test=" null != couponIds">
and co.coupon_id in
<foreach collection="couponIds" index="index" item="couponIdItem" open="(" separator="," close=")">


+ 4
- 0
mallinkService/src/main/resources/mapper/WxOrderMapper.xml Просмотреть файл

@@ -110,6 +110,10 @@
<if test=" null != createDate ">
and `create_date` = #{createDate}
</if>
<if test=" null != createDateLike ">
and `create_date` like concat('', #{createDateLike},'%')
</if>

<if test=" null != updateDate ">
and `update_date` = #{updateDate}


Загрузка…
Отмена
Сохранить