|
@@ -897,7 +897,7 @@ public class LifeDiscountCouponStoreFriendServiceImpl extends ServiceImpl<LifeDi
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 仅优惠券模板(coupon_id):拼条件 → 查列表 → 含逻辑删模板补全 → 对方头像 → 按有效期排序。
|
|
|
|
|
|
|
+ * 仅优惠券模板(coupon_id):拼条件 → 查列表 → 含逻辑删模板补全 → 对方头像 → 按 ldcsf.created_time 倒序(新的在前)。
|
|
|
*/
|
|
*/
|
|
|
private List<LifeDiscountCouponFriendRuleVo> queryCouponList(boolean isReceivedByMe, String storeUserId, String storeName, Integer couponType) {
|
|
private List<LifeDiscountCouponFriendRuleVo> queryCouponList(boolean isReceivedByMe, String storeUserId, String storeName, Integer couponType) {
|
|
|
QueryWrapper<LifeDiscountCouponFriendRuleVo> couponQuery = buildBaseQueryWrapper(isReceivedByMe, storeUserId, storeName);
|
|
QueryWrapper<LifeDiscountCouponFriendRuleVo> couponQuery = buildBaseQueryWrapper(isReceivedByMe, storeUserId, storeName);
|
|
@@ -907,13 +907,14 @@ public class LifeDiscountCouponStoreFriendServiceImpl extends ServiceImpl<LifeDi
|
|
|
couponQuery.and(w -> w.eq("ldc.coupon_type", couponType)
|
|
couponQuery.and(w -> w.eq("ldc.coupon_type", couponType)
|
|
|
.or(sub -> sub.isNull("ldc.id").isNotNull("ldcsf.coupon_id")));
|
|
.or(sub -> sub.isNull("ldc.id").isNotNull("ldcsf.coupon_id")));
|
|
|
}
|
|
}
|
|
|
|
|
+ couponQuery.orderByDesc("ldcsf.created_time");
|
|
|
List<LifeDiscountCouponFriendRuleVo> couponList = isReceivedByMe
|
|
List<LifeDiscountCouponFriendRuleVo> couponList = isReceivedByMe
|
|
|
? lifeDiscountCouponStoreFriendMapper.getReceivedSendFriendCouponList(couponQuery)
|
|
? lifeDiscountCouponStoreFriendMapper.getReceivedSendFriendCouponList(couponQuery)
|
|
|
: lifeDiscountCouponStoreFriendMapper.getReceivedSendFriendCouponListwzhy(couponQuery);
|
|
: lifeDiscountCouponStoreFriendMapper.getReceivedSendFriendCouponListwzhy(couponQuery);
|
|
|
|
|
|
|
|
mergeCouponTemplatesIncludeDeleted(couponList, couponType);
|
|
mergeCouponTemplatesIncludeDeleted(couponList, couponType);
|
|
|
fillStoreAvatar(couponList);
|
|
fillStoreAvatar(couponList);
|
|
|
- return sortByEndDate(couponList);
|
|
|
|
|
|
|
+ return couponList;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1108,50 +1109,6 @@ public class LifeDiscountCouponStoreFriendServiceImpl extends ServiceImpl<LifeDi
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 按有效期降序排序(null 值排在最后),如果有效期为 null 则按创建时间降序排序
|
|
|
|
|
- *
|
|
|
|
|
- * @param list 待排序列表
|
|
|
|
|
- * @return 排序后的列表
|
|
|
|
|
- */
|
|
|
|
|
- private List<LifeDiscountCouponFriendRuleVo> sortByEndDate(List<LifeDiscountCouponFriendRuleVo> list) {
|
|
|
|
|
- if (CollectionUtils.isEmpty(list)) {
|
|
|
|
|
- return list;
|
|
|
|
|
- }
|
|
|
|
|
- list.sort((a, b) -> {
|
|
|
|
|
- // 优先按有效期(validDate)排序,如果为 null 则按创建时间(endDate)排序
|
|
|
|
|
- Date validDateA = a.getValidDate();
|
|
|
|
|
- Date validDateB = b.getValidDate();
|
|
|
|
|
- Date endDateA = a.getEndDate();
|
|
|
|
|
- Date endDateB = b.getEndDate();
|
|
|
|
|
-
|
|
|
|
|
- // 如果两个都有有效期,按有效期排序
|
|
|
|
|
- if (validDateA != null && validDateB != null) {
|
|
|
|
|
- return validDateB.compareTo(validDateA); // 降序:有效期晚的在前
|
|
|
|
|
- }
|
|
|
|
|
- // 如果只有一个有有效期,有有效期的排在前面
|
|
|
|
|
- if (validDateA != null) {
|
|
|
|
|
- return -1;
|
|
|
|
|
- }
|
|
|
|
|
- if (validDateB != null) {
|
|
|
|
|
- return 1;
|
|
|
|
|
- }
|
|
|
|
|
- // 如果都没有有效期,按创建时间排序
|
|
|
|
|
- if (endDateA == null && endDateB == null) {
|
|
|
|
|
- return 0;
|
|
|
|
|
- }
|
|
|
|
|
- if (endDateA == null) {
|
|
|
|
|
- return 1;
|
|
|
|
|
- }
|
|
|
|
|
- if (endDateB == null) {
|
|
|
|
|
- return -1;
|
|
|
|
|
- }
|
|
|
|
|
- // 降序排序(最新的在前)
|
|
|
|
|
- return endDateB.compareTo(endDateA);
|
|
|
|
|
- });
|
|
|
|
|
- return list;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
* 好评送券:用户好评且AI审核通过后,按运营活动配置的优惠券发放到用户券包。
|
|
* 好评送券:用户好评且AI审核通过后,按运营活动配置的优惠券发放到用户券包。
|
|
|
*
|
|
*
|
|
|
* @param userId 评价用户ID(life用户)
|
|
* @param userId 评价用户ID(life用户)
|
|
@@ -1222,9 +1179,6 @@ public class LifeDiscountCouponStoreFriendServiceImpl extends ServiceImpl<LifeDi
|
|
|
}
|
|
}
|
|
|
int commenterUserId = userId.intValue();
|
|
int commenterUserId = userId.intValue();
|
|
|
int copiesWanted = resolveGoodRatingCouponCopies(couponQuantity);
|
|
int copiesWanted = resolveGoodRatingCouponCopies(couponQuantity);
|
|
|
- if (copiesWanted < 1) {
|
|
|
|
|
- return 0;
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
StoreInfo storeInfo = storeInfoMapper.selectById(storeId);
|
|
StoreInfo storeInfo = storeInfoMapper.selectById(storeId);
|
|
|
LifeUser lifeUser = lifeUserMapper.selectById(commenterUserId);
|
|
LifeUser lifeUser = lifeUserMapper.selectById(commenterUserId);
|