|
@@ -131,22 +131,28 @@ public class TireCouponServiceImpl extends ServiceImpl<TireCouponMapper, TireCou
|
|
|
if (Objects.isNull(nowShopUser)) {
|
|
if (Objects.isNull(nowShopUser)) {
|
|
|
return R.fail("未查找到您的门店信息");
|
|
return R.fail("未查找到您的门店信息");
|
|
|
}
|
|
}
|
|
|
- List<TireUserCoupon> userCouponList = tireUserCouponMapper.selectList(new LambdaQueryWrapper<TireUserCoupon>()
|
|
|
|
|
|
|
+ List<TireCoupon> couponList = baseMapper.selectList(new LambdaQueryWrapper<TireCoupon>().eq(TireCoupon::getStatus, 1)
|
|
|
|
|
+ .eq(TireCoupon::getIsDeleted, 0).eq(TireCoupon::getTenantId, "000000"));
|
|
|
|
|
+ if (CollectionUtil.isEmpty(couponList)) {
|
|
|
|
|
+ return R.data(Collections.emptyList());
|
|
|
|
|
+ }
|
|
|
|
|
+ List<Long> couponIdList = couponList.stream().map(TireCoupon::getId).collect(Collectors.toList());
|
|
|
|
|
+ List<TireUserCoupon> userCouponList = tireUserCouponMapper.selectList(new LambdaQueryWrapper<TireUserCoupon>().in(TireUserCoupon::getCouponId, couponIdList)
|
|
|
.eq(TireUserCoupon::getCorpsId, nowShopUser.getPid()).eq(TireUserCoupon::getTenantId, searchUser.getTenantId()).eq(TireUserCoupon::getIsDeleted, 0));
|
|
.eq(TireUserCoupon::getCorpsId, nowShopUser.getPid()).eq(TireUserCoupon::getTenantId, searchUser.getTenantId()).eq(TireUserCoupon::getIsDeleted, 0));
|
|
|
if (CollectionUtil.isEmpty(userCouponList)) {
|
|
if (CollectionUtil.isEmpty(userCouponList)) {
|
|
|
- return R.data(new ArrayList<>(1));
|
|
|
|
|
|
|
+ return R.data(Collections.emptyList());
|
|
|
}
|
|
}
|
|
|
- List<Long> couponIdList = userCouponList.stream().map(TireUserCoupon::getCouponId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
+/* List<Long> couponIdList = userCouponList.stream().map(TireUserCoupon::getCouponId).distinct().collect(Collectors.toList());
|
|
|
List<TireCoupon> couponList = baseMapper.selectBatchIds(couponIdList);
|
|
List<TireCoupon> couponList = baseMapper.selectBatchIds(couponIdList);
|
|
|
if (CollectionUtil.isEmpty(couponList)) {
|
|
if (CollectionUtil.isEmpty(couponList)) {
|
|
|
- return R.data(new ArrayList<>(1));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return R.data(Collections.emptyList());
|
|
|
|
|
+ }*/
|
|
|
List<TireUserCouponDto> tireUserCouponDtoList = new ArrayList<>();
|
|
List<TireUserCouponDto> tireUserCouponDtoList = new ArrayList<>();
|
|
|
long now = System.currentTimeMillis();
|
|
long now = System.currentTimeMillis();
|
|
|
List<Long> expiredIdList = new ArrayList<>();
|
|
List<Long> expiredIdList = new ArrayList<>();
|
|
|
for (TireUserCoupon userCoupon : userCouponList) {
|
|
for (TireUserCoupon userCoupon : userCouponList) {
|
|
|
long end = userCoupon.getEffectiveEnd().getTime();
|
|
long end = userCoupon.getEffectiveEnd().getTime();
|
|
|
- if (now > end) {
|
|
|
|
|
|
|
+ if (now > end && userCoupon.getStatus() == 0) {
|
|
|
// 过期的
|
|
// 过期的
|
|
|
expiredIdList.add(userCoupon.getId());
|
|
expiredIdList.add(userCoupon.getId());
|
|
|
userCoupon.setStatus(2);
|
|
userCoupon.setStatus(2);
|
|
@@ -187,16 +193,17 @@ public class TireCouponServiceImpl extends ServiceImpl<TireCouponMapper, TireCou
|
|
|
if (Objects.isNull(nowShopUser)) {
|
|
if (Objects.isNull(nowShopUser)) {
|
|
|
return R.fail("未查找到您的门店信息");
|
|
return R.fail("未查找到您的门店信息");
|
|
|
}
|
|
}
|
|
|
|
|
+ List<TireCoupon> couponList = baseMapper.selectList(new LambdaQueryWrapper<TireCoupon>().eq(TireCoupon::getStatus, 1)
|
|
|
|
|
+ .eq(TireCoupon::getIsDeleted, 0).eq(TireCoupon::getTenantId, "000000"));
|
|
|
|
|
+ if (CollectionUtil.isEmpty(couponList)) {
|
|
|
|
|
+ return R.data(Collections.emptyList());
|
|
|
|
|
+ }
|
|
|
|
|
+ List<Long> couponIdList = couponList.stream().map(TireCoupon::getId).collect(Collectors.toList());
|
|
|
List<TireUserCoupon> userCouponList = tireUserCouponMapper.selectList(new LambdaQueryWrapper<TireUserCoupon>()
|
|
List<TireUserCoupon> userCouponList = tireUserCouponMapper.selectList(new LambdaQueryWrapper<TireUserCoupon>()
|
|
|
- .eq(TireUserCoupon::getCorpsId, nowShopUser.getPid()).eq(TireUserCoupon::getTenantId, searchUser.getTenantId())
|
|
|
|
|
|
|
+ .eq(TireUserCoupon::getCorpsId, nowShopUser.getPid()).eq(TireUserCoupon::getTenantId, searchUser.getTenantId()).in(TireUserCoupon::getCouponId, couponIdList)
|
|
|
.le(TireUserCoupon::getEffectiveStart, today).ge(TireUserCoupon::getEffectiveEnd, today).eq(TireUserCoupon::getStatus, 0).eq(TireUserCoupon::getIsDeleted, 0));
|
|
.le(TireUserCoupon::getEffectiveStart, today).ge(TireUserCoupon::getEffectiveEnd, today).eq(TireUserCoupon::getStatus, 0).eq(TireUserCoupon::getIsDeleted, 0));
|
|
|
if (CollectionUtil.isEmpty(userCouponList)) {
|
|
if (CollectionUtil.isEmpty(userCouponList)) {
|
|
|
- return R.data(null);
|
|
|
|
|
- }
|
|
|
|
|
- List<Long> couponIdList = userCouponList.stream().map(TireUserCoupon::getCouponId).distinct().collect(Collectors.toList());
|
|
|
|
|
- List<TireCoupon> couponList = baseMapper.selectBatchIds(couponIdList);
|
|
|
|
|
- if (CollectionUtil.isEmpty(couponList)) {
|
|
|
|
|
- return R.data(null);
|
|
|
|
|
|
|
+ return R.data(Collections.emptyList());
|
|
|
}
|
|
}
|
|
|
List<Long> couponIds = couponList.stream().map(TireCoupon::getId).collect(Collectors.toList());
|
|
List<Long> couponIds = couponList.stream().map(TireCoupon::getId).collect(Collectors.toList());
|
|
|
List<TireCouponRule> couponRuleList = tireCouponRuleMapper.selectList(new LambdaQueryWrapper<TireCouponRule>().in(TireCouponRule::getCouponId, couponIds));
|
|
List<TireCouponRule> couponRuleList = tireCouponRuleMapper.selectList(new LambdaQueryWrapper<TireCouponRule>().in(TireCouponRule::getCouponId, couponIds));
|