优惠券bug

This commit is contained in:
齐天大圣 2024-04-28 12:04:22 +08:00
parent 28acf1ff82
commit 59065d2c00
2 changed files with 12 additions and 16 deletions

View File

@ -106,12 +106,7 @@
LEFT JOIN card_favorable_record cfr ON cf.id = cfr.card_favorable_id
WHERE
cfr.mt_user_id = #{cardFavorableDTOS.id}
<if test="cardFavorableDTOS.useStatus!=null and cardFavorableDTOS.useStatus != ''">
and cfr.status = #{cardFavorableDTOS.useStatus}
</if>
<if test="cardFavorableDTOS.useStatus == 0">
and cfr.status = #{cardFavorableDTOS.useStatus}
</if>
and cfr.store_id = #{cardFavorableDTOS.storeId}
and cf.type != 1 UNION ALL
SELECT
@ -123,11 +118,12 @@
LEFT JOIN card_exchange ce ON cer.card_exchange_id = ce.id
WHERE
cer.mt_user_id = #{cardFavorableDTOS.id}
<if test="cardFavorableDTOS.useStatus != null">
and cer.status = #{cardFavorableDTOS.useStatus}
</if>
and cer.store_id = #{cardFavorableDTOS.storeId}
and ce.type = 0 or cer.mt_user_id = #{cardFavorableDTOS.id} and ce.type = 1
<if test="cardFavorableDTOS.useStatus!=null and cardFavorableDTOS.useStatus != ''">
and cer.status = #{cardFavorableDTOS.useStatus}
</if>
<if test="cardFavorableDTOS.useStatus == 0">
<if test="cardFavorableDTOS.useStatus != null">
and cer.status = #{cardFavorableDTOS.useStatus}
</if>
and cer.store_id = #{cardFavorableDTOS.storeId} UNION ALL
@ -141,12 +137,7 @@
WHERE
cer.mt_user_id = #{cardFavorableDTOS.id}
and ce.type = 1
<if test="cardFavorableDTOS.useStatus!=null and cardFavorableDTOS.useStatus != ''">
and cer.status = #{cardFavorableDTOS.useStatus}
</if>
<if test="cardFavorableDTOS.useStatus == 0">
and cer.status = #{cardFavorableDTOS.useStatus}
</if>
and cer.status = #{cardFavorableDTOS.useStatus}
and cer.store_id = #{cardFavorableDTOS.storeId}
<if test="cardFavorableDTOS.useStatus!=null and cardFavorableDTOS.useStatus != ''">
and cer.status = #{cardFavorableDTOS.useStatus}

View File

@ -326,7 +326,7 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
if (record.getCouponType().equals("优惠券")){
record.setCouponContent(""+record.getSatisfiedAmount()+""+record.getCouponAmount()+"");
}else {
record.setCouponContent("可兑换:"+record.getCouponContent());
record.setCouponContent("可兑换:"+record.getSatisfiedAmount());
}
}
//有效期
@ -350,6 +350,11 @@ public class CardFavorableServiceImpl extends ServiceImpl<CardFavorableMapper, C
cardFavorableDTOS.setStoreId(nowAccountInfo.getStoreId());
IPage<CouponVO> couponVOS = cardFavorableRecordMapper.selectAllByCondition(page,cardFavorableDTOS);
List<CouponVO> records = couponVOS.getRecords();
for (CouponVO record : records) {
if (record.getCouponType().equals("兑换券")){
record.setCouponContent(record.getSatisfiedAmount());
}
}
//有效期
List<CouponVO> collect = records.stream().filter(s -> s.getEndTime().getTime() < System.currentTimeMillis()).collect(Collectors.toList());
if (ObjectUtils.isNotEmpty(collect)){