修复促销优惠券获取时,活动优惠券查询问题
This commit is contained in:
parent
27e82423f0
commit
d5fdc47936
@ -43,6 +43,19 @@ public class BasePromotionsSearchParams {
|
|||||||
private String storeId;
|
private String storeId;
|
||||||
|
|
||||||
public <T> QueryWrapper<T> queryWrapper() {
|
public <T> QueryWrapper<T> queryWrapper() {
|
||||||
|
QueryWrapper<T> queryWrapper = this.baseQueryWrapper();
|
||||||
|
|
||||||
|
if (CharSequenceUtil.isNotEmpty(promotionStatus)) {
|
||||||
|
queryWrapper.and(i -> {
|
||||||
|
for (String status : promotionStatus.split(",")) {
|
||||||
|
i.or(PromotionTools.queryPromotionStatus(PromotionsStatusEnum.valueOf(status)));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return queryWrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> QueryWrapper<T> baseQueryWrapper() {
|
||||||
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
if (CharSequenceUtil.isNotEmpty(id)) {
|
if (CharSequenceUtil.isNotEmpty(id)) {
|
||||||
@ -54,13 +67,6 @@ public class BasePromotionsSearchParams {
|
|||||||
if (endTime != null) {
|
if (endTime != null) {
|
||||||
queryWrapper.le("end_time", new Date(endTime));
|
queryWrapper.le("end_time", new Date(endTime));
|
||||||
}
|
}
|
||||||
if (CharSequenceUtil.isNotEmpty(promotionStatus)) {
|
|
||||||
queryWrapper.and(i -> {
|
|
||||||
for (String status : promotionStatus.split(",")) {
|
|
||||||
i.or(PromotionTools.queryPromotionStatus(PromotionsStatusEnum.valueOf(status)));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (CharSequenceUtil.isNotEmpty(scopeType)) {
|
if (CharSequenceUtil.isNotEmpty(scopeType)) {
|
||||||
queryWrapper.eq("scope_type", scopeType);
|
queryWrapper.eq("scope_type", scopeType);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ public class CouponSearchParams extends BasePromotionsSearchParams implements Se
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> QueryWrapper<T> queryWrapper() {
|
public <T> QueryWrapper<T> queryWrapper() {
|
||||||
QueryWrapper<T> queryWrapper = super.queryWrapper();
|
QueryWrapper<T> queryWrapper = super.baseQueryWrapper();
|
||||||
if (CharSequenceUtil.isNotEmpty(couponName)) {
|
if (CharSequenceUtil.isNotEmpty(couponName)) {
|
||||||
queryWrapper.like("coupon_name", couponName);
|
queryWrapper.like("coupon_name", couponName);
|
||||||
}
|
}
|
||||||
@ -80,24 +80,27 @@ public class CouponSearchParams extends BasePromotionsSearchParams implements Se
|
|||||||
queryWrapper.eq("get_type", CouponGetEnum.valueOf(getType).name());
|
queryWrapper.eq("get_type", CouponGetEnum.valueOf(getType).name());
|
||||||
}
|
}
|
||||||
if (CharSequenceUtil.isNotEmpty(this.getPromotionStatus())) {
|
if (CharSequenceUtil.isNotEmpty(this.getPromotionStatus())) {
|
||||||
|
queryWrapper.and(p -> {
|
||||||
switch (PromotionsStatusEnum.valueOf(this.getPromotionStatus())) {
|
switch (PromotionsStatusEnum.valueOf(this.getPromotionStatus())) {
|
||||||
case NEW:
|
case NEW:
|
||||||
queryWrapper.nested(i -> i.gt(PromotionTools.START_TIME_COLUMN, new Date()).gt(PromotionTools.END_TIME_COLUMN, new Date()));
|
p.nested(i -> i.gt(PromotionTools.START_TIME_COLUMN, new Date()).gt(PromotionTools.END_TIME_COLUMN, new Date()));
|
||||||
break;
|
break;
|
||||||
case START:
|
case START:
|
||||||
queryWrapper.nested(i -> i.le(PromotionTools.START_TIME_COLUMN, new Date()).ge(PromotionTools.END_TIME_COLUMN, new Date()))
|
p.nested(i -> i.le(PromotionTools.START_TIME_COLUMN, new Date()).ge(PromotionTools.END_TIME_COLUMN, new Date()))
|
||||||
.or(i -> i.gt("effective_days", 0).eq(RANGE_DAY_TYPE_COLUMN, CouponRangeDayEnum.DYNAMICTIME.name()));
|
.or(i -> i.gt("effective_days", 0).eq(RANGE_DAY_TYPE_COLUMN, CouponRangeDayEnum.DYNAMICTIME.name()));
|
||||||
break;
|
break;
|
||||||
case END:
|
case END:
|
||||||
queryWrapper.nested(i -> i.lt(PromotionTools.START_TIME_COLUMN, new Date()).lt(PromotionTools.END_TIME_COLUMN, new Date()));
|
p.nested(i -> i.lt(PromotionTools.START_TIME_COLUMN, new Date()).lt(PromotionTools.END_TIME_COLUMN, new Date()));
|
||||||
break;
|
break;
|
||||||
case CLOSE:
|
case CLOSE:
|
||||||
queryWrapper.nested(n -> n.nested(i -> i.isNull(PromotionTools.START_TIME_COLUMN).isNull(PromotionTools.END_TIME_COLUMN)
|
p.nested(n -> n.nested(i -> i.isNull(PromotionTools.START_TIME_COLUMN).isNull(PromotionTools.END_TIME_COLUMN)
|
||||||
.eq(RANGE_DAY_TYPE_COLUMN, CouponRangeDayEnum.FIXEDTIME.name())).
|
.eq(RANGE_DAY_TYPE_COLUMN, CouponRangeDayEnum.FIXEDTIME.name())).
|
||||||
or(i -> i.le("effective_days", 0).eq(RANGE_DAY_TYPE_COLUMN, CouponRangeDayEnum.DYNAMICTIME.name())));
|
or(i -> i.le("effective_days", 0).eq(RANGE_DAY_TYPE_COLUMN, CouponRangeDayEnum.DYNAMICTIME.name())));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
if (this.getStartTime() != null) {
|
if (this.getStartTime() != null) {
|
||||||
queryWrapper.ge("start_time", new Date(this.getEndTime()));
|
queryWrapper.ge("start_time", new Date(this.getEndTime()));
|
||||||
@ -105,7 +108,6 @@ public class CouponSearchParams extends BasePromotionsSearchParams implements Se
|
|||||||
if (this.getEndTime() != null) {
|
if (this.getEndTime() != null) {
|
||||||
queryWrapper.le("end_time", new Date(this.getEndTime()));
|
queryWrapper.le("end_time", new Date(this.getEndTime()));
|
||||||
}
|
}
|
||||||
queryWrapper.eq("delete_flag", false);
|
|
||||||
this.betweenWrapper(queryWrapper);
|
this.betweenWrapper(queryWrapper);
|
||||||
queryWrapper.orderByDesc("create_time");
|
queryWrapper.orderByDesc("create_time");
|
||||||
return queryWrapper;
|
return queryWrapper;
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package cn.lili.modules.promotion.entity.dto.search;
|
package cn.lili.modules.promotion.entity.dto.search;
|
||||||
|
|
||||||
import cn.hutool.core.text.CharSequenceUtil;
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
import cn.lili.modules.promotion.entity.enums.*;
|
import cn.lili.modules.promotion.entity.enums.CouponGetEnum;
|
||||||
import cn.lili.modules.promotion.tools.PromotionTools;
|
import cn.lili.modules.promotion.entity.enums.CouponTypeEnum;
|
||||||
|
import cn.lili.modules.promotion.entity.enums.MemberCouponStatusEnum;
|
||||||
|
import cn.lili.modules.promotion.entity.enums.PromotionsScopeTypeEnum;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -78,9 +80,6 @@ public class MemberCouponSearchParams extends BasePromotionsSearchParams impleme
|
|||||||
if (CharSequenceUtil.isNotEmpty(memberCouponStatus)) {
|
if (CharSequenceUtil.isNotEmpty(memberCouponStatus)) {
|
||||||
queryWrapper.eq("member_coupon_status", MemberCouponStatusEnum.valueOf(memberCouponStatus).name());
|
queryWrapper.eq("member_coupon_status", MemberCouponStatusEnum.valueOf(memberCouponStatus).name());
|
||||||
}
|
}
|
||||||
if (CharSequenceUtil.isNotEmpty(this.getPromotionStatus())) {
|
|
||||||
queryWrapper.and(PromotionTools.queryPromotionStatus(PromotionsStatusEnum.valueOf(getPromotionStatus())));
|
|
||||||
}
|
|
||||||
if (CharSequenceUtil.isNotEmpty(price)) {
|
if (CharSequenceUtil.isNotEmpty(price)) {
|
||||||
String[] s = price.split("_");
|
String[] s = price.split("_");
|
||||||
if (s.length > 1) {
|
if (s.length > 1) {
|
||||||
|
@ -23,8 +23,7 @@ public class ManagerApiApplication {
|
|||||||
@Primary
|
@Primary
|
||||||
@Bean
|
@Bean
|
||||||
public TaskExecutor primaryTask() {
|
public TaskExecutor primaryTask() {
|
||||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
return new ThreadPoolTaskExecutor();
|
||||||
return executor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user