Commit e3c9eb86 by 吕明尚

优惠卷领取记录查询增加是否逻辑删除条件

parent 442446eb
......@@ -161,6 +161,7 @@ public class QPServiceImplAspect {
LambdaQueryWrapper<SConsumerCoupon> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SConsumerCoupon::getCouponCode, couponCode);
lambdaQueryWrapper.eq(SConsumerCoupon::getUseStatus, code);
lambdaQueryWrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex());
SConsumerCoupon one = sConsumerCouponService.getOne(lambdaQueryWrapper);
if (one == null) {
// 处理查询不到SConsumerCoupon的情况,例如抛出异常或记录日志
......
......@@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import share.common.enums.UserStatusEnum;
import share.common.enums.YesNoEnum;
import share.system.domain.SConsumerCoupon;
import share.system.service.ISConsumerCouponService;
import share.system.service.impl.QPServiceImpl;
......@@ -23,6 +24,7 @@ public class CouponRetryTask {
public void AuToRetryCoupon() {
LambdaQueryWrapper<SConsumerCoupon> consumerCouponWrapper = new LambdaQueryWrapper<>();
consumerCouponWrapper.eq(SConsumerCoupon::getUseStatus, UserStatusEnum.UNUSED.getCode());
consumerCouponWrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex());
List<SConsumerCoupon> sConsumerCoupons = sConsumerCouponService.list(consumerCouponWrapper);
List<SConsumerCoupon> expiredSConsumerCounpons = Optional.ofNullable(sConsumerCoupons).orElse(new ArrayList<>()).stream().filter(item -> {
if (item.getEndDate().compareTo(new Date()) < 0) {
......
......@@ -99,6 +99,7 @@ public class RedisTask {
//获取所有待使用的优惠卷
LambdaQueryWrapper<SConsumerCoupon> wrapper = Wrappers.lambdaQuery();
wrapper.eq(SConsumerCoupon::getUseStatus, CouponStatusEnum.NORMAL.getValue());
wrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex());
wrapper.isNotNull(SConsumerCoupon::getCouponCode);
List<SConsumerCoupon> coupons = isConsumerCouponService.list(wrapper);
List<SStore> stores = storeService.list();
......@@ -128,7 +129,7 @@ public class RedisTask {
// 获取所有待使用的优惠卷
List<SConsumerCoupon> availableCoupons = isConsumerCouponService.list(
new LambdaQueryWrapper<SConsumerCoupon>().eq(SConsumerCoupon::getUseStatus, CouponStatusEnum.NORMAL.getValue())
new LambdaQueryWrapper<SConsumerCoupon>().eq(SConsumerCoupon::getUseStatus, CouponStatusEnum.NORMAL.getValue()).eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex())
);
Set<Long> availableCouponIds = availableCoupons.stream().map(SConsumerCoupon::getId).collect(Collectors.toSet());
......
......@@ -107,6 +107,7 @@ public class QPServiceImpl implements QPService {
LambdaQueryWrapper<SConsumerCoupon> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(SConsumerCoupon::getCouponCode, code);
queryWrapper.eq(SConsumerCoupon::getUseStatus, UserStatusEnum.UNUSED.getCode());
queryWrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex());
SConsumerCoupon unUsedCoupon = isConsumerCouponService.getOne(queryWrapper);
if (ObjectUtils.isNotEmpty(unUsedCoupon)) {
throw new RuntimeException("该券已被领取");
......@@ -129,7 +130,7 @@ public class QPServiceImpl implements QPService {
List<TuangouDealQueryShopDealResponseEntity> groupActivities = queryshopdeal(openShopUuid);
groupActivities.forEach(o -> {
//套餐名称相同并且在售卖中
if (prepare.getDeal_title().equals(o.getTitle()) && saleStatusEnum.SELLING.getCode().equals(o.getSale_status())) {
if (prepare.getDealgroup_id().equals(o.getDealgroup_id()) && saleStatusEnum.SELLING.getCode().equals(o.getSale_status())) {
Date receiptEndDate = DateUtil.parse(o.getReceipt_end_date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN);
Date receiptBeginDate = DateUtil.parse(o.getReceipt_begin_date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN);
sConsumerCoupon.setStartDate(receiptBeginDate);
......
......@@ -90,6 +90,7 @@ public class SConsumerCouponServiceImpl extends ServiceImpl<SConsumerCouponMappe
LambdaQueryWrapper<SConsumerCoupon> queryWrapper = new LambdaQueryWrapper<SConsumerCoupon>();
queryWrapper.eq(SConsumerCoupon::getConsumerId,user.getId());
queryWrapper.eq(SConsumerCoupon::getUseStatus,useStatus);
queryWrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex());
if(UserStatusEnum.EXPIRED.getCode().compareTo(useStatus)==0){
//已过期查询3个月以内的
queryWrapper.gt(SConsumerCoupon::getEndDate,DateUtils.addMonths(new Date(),-3));
......
......@@ -19,6 +19,7 @@ import share.common.core.page.TableSupport;
import share.common.enums.CouponTypeEnum;
import share.common.enums.RoomType;
import share.common.enums.StoreType;
import share.common.enums.YesNoEnum;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -225,7 +226,7 @@ public class SCouponServiceImpl extends ServiceImpl<SCouponMapper, SCoupon> impl
List<SCouponVo> sCouponVoList = convertDoListToVoList(sCouponList);
//获取sCouponVoList的id集合
List<Long> ids = sCouponVoList.stream().map(SCoupon::getId).collect(Collectors.toList());
List<SConsumerCoupon> sConsumerCoupons = sConsumerCouponService.list(new LambdaQueryWrapper<>(SConsumerCoupon.class).in(SConsumerCoupon::getCouponId, ids));
List<SConsumerCoupon> sConsumerCoupons = sConsumerCouponService.list(new LambdaQueryWrapper<>(SConsumerCoupon.class).in(SConsumerCoupon::getCouponId, ids).eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex()));
//统计每个couponId的出现次数
Map<Long, Long> collect = sConsumerCoupons.stream().collect(Collectors.groupingBy(SConsumerCoupon::getCouponId, Collectors.counting()));
sCouponVoList.stream().forEach(item -> {
......
......@@ -316,7 +316,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SStore sStore = storeService.getById(request.getStoreId());
SRoom room = roomService.getById(request.getRoomId());
if (ObjectUtil.isNotEmpty(room) && room.getIsDirtyRoom().equals(YesNoEnum.yes.getIndex())) {
throw new BaseException("当前房间未保洁,请选择其他房间");
throw new BaseException("未保洁,不能预定!");
}
//生成订单
SOrder sOrder = generatSOrder(request, user);
......@@ -329,6 +329,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SConsumerCoupon byId = null;
if (Objects.nonNull(request.getCouponId()) && request.getCouponId() != 0) {
byId = consumerCouponService.getById(request.getCouponId());
consumerCouponService.getOne(new LambdaQueryWrapper<>());
if (Objects.nonNull(byId)) {
if (byId.getUseStatus().equals(UserStatusEnum.UNUSED.getCode())) {
if (StringUtils.isNotEmpty(byId.getCouponCode())) {
......
......@@ -85,7 +85,9 @@
<select id="selectSConsumerCouponList" parameterType="SConsumerCoupon" resultMap="SConsumerCouponResult">
<include refid="selectSConsumerCouponVo"/>
<where>
where
1=1
and is_delete = '0'
<if test="consumerId != null "> and consumer_id = #{consumerId}</if>
<if test="couponId != null "> and coupon_id = #{couponId}</if>
<if test="storeId !=null">and store_id = #{storeId}</if>
......@@ -109,19 +111,21 @@
<if test="useDate != null "> and use_date = #{useDate}</if>
<if test="useStatus != null and useStatus != '' or useStatus==0">and use_status = #{useStatus}</if>
<if test="weeks != null and weeks != ''">and weeks = #{weeks}</if>
<if test="isDelete != null "> and is_delete = #{isDelete}</if>
<if test="deleteBy != null and deleteBy != ''"> and delete_by = #{deleteBy}</if>
<if test="deleteTime != null "> and delete_time = #{deleteTime}</if>
</where>
ORDER BY create_time DESC
</select>
<select id="selectSConsumerCouponById" parameterType="Long" resultMap="SConsumerCouponResult">
<include refid="selectSConsumerCouponVo"/>
where id = #{id}
where id = #{id} and is_delete = '0'
</select>
<select id="selectSConsumerCouponConut" resultType="java.lang.Integer">
select count(1) from s_consumer_coupon where consumer_id = #{consumerId} and use_status = 0
select count(1)
from s_consumer_coupon
where consumer_id = #{consumerId}
and use_status = 0
and is_delete = '0'
</select>
<select id="querySConsumerCouponList" parameterType="SConsumerCoupon" resultMap="SConsumerCouponResult">
<include refid="selectSConsumerCouponVo"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment