Explorar o código

Merge remote-tracking branch 'origin/sit' into uat-20260202

dujian hai 17 horas
pai
achega
71b5475f7b
Modificáronse 16 ficheiros con 305 adicións e 163 borrados
  1. 15 6
      alien-dining/src/main/java/shop/alien/dining/controller/DiningCouponController.java
  2. 3 1
      alien-dining/src/main/java/shop/alien/dining/feign/AlienStoreFeign.java
  3. 6 3
      alien-dining/src/main/java/shop/alien/dining/service/DiningCouponService.java
  4. 130 83
      alien-dining/src/main/java/shop/alien/dining/service/impl/DiningCouponServiceImpl.java
  5. 3 3
      alien-dining/src/main/java/shop/alien/dining/service/impl/StoreOrderServiceImpl.java
  6. 15 0
      alien-entity/src/main/java/shop/alien/mapper/LifeDiscountCouponUserMapper.java
  7. 1 1
      alien-entity/src/main/java/shop/alien/mapper/second/SecondRecommendMapper.java
  8. 39 0
      alien-entity/src/main/resources/mapper/LifeDiscountCouponUserMapper.xml
  9. 14 0
      alien-entity/src/main/resources/mapper/second/SecondGoodsInfoMapper.xml
  10. 5 4
      alien-second/src/main/java/shop/alien/second/controller/SecondRecommendController.java
  11. 2 1
      alien-second/src/main/java/shop/alien/second/service/SecondRecommendService.java
  12. 24 6
      alien-second/src/main/java/shop/alien/second/service/impl/SecondRecommendServiceImpl.java
  13. 15 6
      alien-store/src/main/java/shop/alien/store/controller/LifeDiscountCouponController.java
  14. 2 1
      alien-store/src/main/java/shop/alien/store/service/LifeDiscountCouponService.java
  15. 30 47
      alien-store/src/main/java/shop/alien/store/service/impl/LifeDiscountCouponServiceImpl.java
  16. 1 1
      alien-store/src/main/java/shop/alien/store/service/impl/StoreClockInServiceImpl.java

+ 15 - 6
alien-dining/src/main/java/shop/alien/dining/controller/DiningCouponController.java

@@ -41,7 +41,7 @@ public class DiningCouponController {
     /**
      * 获取该用户所有的优惠券列表
      */
-    @ApiOperation("获取该用户所有的优惠券列表。couponType=1仅满减券,couponType=2仅折扣券,不传返回全部优惠券")
+    @ApiOperation("获取该用户所有的优惠券列表。couponType=1仅满减券,couponType=2仅折扣券,不传返回全部优惠券;storeKeyword 非空时仅返回门店名称包含关键字的优惠券")
     @ApiOperationSupport(order = 9)
     @GetMapping("/getUserCouponList")
     @ApiImplicitParams({
@@ -50,7 +50,8 @@ public class DiningCouponController {
             @ApiImplicitParam(name = "tabType", value = "分页类型(0:全部(未使用),1:即将过期,2:已使用,3:已过期)", dataType = "String", paramType = "query", required = true),
             @ApiImplicitParam(name = "type", value = "券类型(不传或1:优惠券;代金券 type=4 已下线)", dataType = "Integer", paramType = "query", required = false),
             @ApiImplicitParam(name = "couponType", value = "优惠券类型:1=仅满减券,2=仅折扣券,不传=全部优惠券(可选)", dataType = "Integer", paramType = "query", required = false),
-            @ApiImplicitParam(name = "storeId", value = "商铺ID,可为空,传则仅返回该商铺的优惠券", dataType = "String", paramType = "query", required = false)
+            @ApiImplicitParam(name = "storeId", value = "商铺ID,可为空,传则仅返回该商铺的优惠券", dataType = "String", paramType = "query", required = false),
+            @ApiImplicitParam(name = "storeKeyword", value = "店铺名称关键字,非空则只展示门店名称含关键字的优惠券(可选,最长100字符)", dataType = "String", paramType = "query", required = false)
     })
     public R<List<LifeDiscountCouponVo>> getUserCouponList(
             HttpServletRequest request,
@@ -59,10 +60,18 @@ public class DiningCouponController {
             @RequestParam("tabType") String tabType,
             @RequestParam(value = "type", required = false) Integer type,
             @RequestParam(value = "couponType", required = false) Integer couponType,
-            @RequestParam(value = "storeId", required = false) String storeId) {
-        log.info("DiningCouponController.getUserCouponList?page={}, size={}, tabType={}, type={}, couponType={}, storeId={}", page, size, tabType, type, couponType, storeId);
+            @RequestParam(value = "storeId", required = false) String storeId,
+            @RequestParam(value = "storeKeyword", required = false) String storeKeyword) {
+        String keywordParam = null;
+        if (storeKeyword != null) {
+            String t = storeKeyword.trim();
+            if (!t.isEmpty()) {
+                keywordParam = t.length() > 100 ? t.substring(0, 100) : t;
+            }
+        }
+        log.info("DiningCouponController.getUserCouponList?page={}, size={}, tabType={}, type={}, couponType={}, storeId={}, storeKeyword={}", page, size, tabType, type, couponType, storeId, keywordParam);
         String authorization = request.getHeader("Authorization");
-        return diningCouponService.getUserCouponList(authorization, page, size, tabType, type, couponType, storeId);
+        return diningCouponService.getUserCouponList(authorization, page, size, tabType, type, couponType, storeId, keywordParam);
     }
 
     /**
@@ -104,7 +113,7 @@ public class DiningCouponController {
     /**
      * 查询用户拥有的优惠券(按符合支付条件优先,其次优惠力度大的优先)
      */
-    @ApiOperation(value = "查询用户拥有的优惠券", notes = "需登录。查询用户拥有的优惠券,排序:符合支付条件的优先,其次优惠力度大的优先")
+    @ApiOperation(value = "查询用户拥有的优惠券", notes = "需登录。含商家逻辑删除模板(仍展示券属性);每张用户券一行。可选 storeId。金额 amount 仅影响排序不参与过滤(建议传订单应付金额);未传金额时按面值等规则排序。")
     @GetMapping("/userOwned")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "storeId", value = "门店ID(可选,如果提供则只查询该门店的优惠券)", dataType = "String", paramType = "query", required = false),

+ 3 - 1
alien-dining/src/main/java/shop/alien/dining/feign/AlienStoreFeign.java

@@ -55,6 +55,7 @@ public interface AlienStoreFeign {
      * @param type          券类型(不传:优惠券+代金券都返回,1:仅优惠券查 life_discount_coupon,4:仅代金券查 life_coupon)(可选)
      * @param couponType    优惠券类型:1=仅满减券,2=仅折扣券,不传=全部优惠券(可选,仅当type不为4时有效)
      * @param storeId       商铺ID,可为空,传则仅返回该商铺的优惠券
+     * @param storeKeyword  店铺名称关键字,可为空,非空时仅返回门店名称包含关键字的优惠券
      * @return R.data 为 List&lt;LifeDiscountCouponVo&gt;
      */
     @GetMapping("life-discount-coupon/getUserCouponList")
@@ -65,7 +66,8 @@ public interface AlienStoreFeign {
             @RequestParam(value = "size", defaultValue = "10") int size,
             @RequestParam(value = "type", required = false) Integer type,
             @RequestParam(value = "couponType", required = false) Integer couponType,
-            @RequestParam(value = "storeId", required = false) String storeId);
+            @RequestParam(value = "storeId", required = false) String storeId,
+            @RequestParam(value = "storeKeyword", required = false) String storeKeyword);
 
     /**
      * 根据优惠券 ID 获取优惠券详情(含规则、门槛等)

+ 6 - 3
alien-dining/src/main/java/shop/alien/dining/service/DiningCouponService.java

@@ -26,9 +26,11 @@ public interface DiningCouponService {
      * @param tabType       0:全部(未使用),1:即将过期,2:已使用,3:已过期
      * @param type          券类型(不传:优惠券+代金券都返回,1:仅优惠券查 life_discount_coupon,4:仅代金券查 life_coupon)(可选)
      * @param couponType    优惠券类型:1=仅满减券,2=仅折扣券,不传=全部优惠券(可选,仅当type不为4时有效)
+     * @param storeId       商铺ID(可选);传则 store 侧仅返回该商铺的优惠券
+     * @param storeKeyword   店铺名称关键字(可选);非空时仅门店名称包含关键字的券
      * @return R.data 为 List&lt;LifeDiscountCouponVo&gt;
      */
-    R<List<LifeDiscountCouponVo>> getUserCouponList(String authorization, int page, int size, String tabType, Integer type, Integer couponType, String storeId);
+    R<List<LifeDiscountCouponVo>> getUserCouponList(String authorization, int page, int size, String tabType, Integer type, Integer couponType, String storeId, String storeKeyword);
 
     /**
      * 根据优惠券 id 获取优惠券详情
@@ -52,10 +54,11 @@ public interface DiningCouponService {
     R<Map<String, Object>> getStoreUserUsableCouponList(String authorization, String storeId, BigDecimal amount, Integer couponType);
 
     /**
-     * 查询用户拥有的优惠券(按符合支付条件优先,其次优惠力度大的优先)
+     * 查询用户拥有的优惠券:每张用户券一条;未过期待使用;可选按门店过滤。
+     * 传入的 {@code amount} <strong>只影响排序</strong>(无门槛券需传入 {@code amount &gt; 0} 才参与「可满足」的比较;满足的优先,同等再比估算优惠)。
      *
      * @param storeId 门店ID(可选,如果提供则只查询该门店的优惠券)
-     * @param amount  当前消费金额(用于判断是否符合支付条件)
+     * @param amount  可选;当前订单/消费金额参考值,用于排序对比门槛与折算优惠金额,不改变返回条数
      * @return 优惠券列表
      */
     R<List<LifeDiscountCouponVo>> getUserOwnedCoupons(String storeId, BigDecimal amount);

+ 130 - 83
alien-dining/src/main/java/shop/alien/dining/service/impl/DiningCouponServiceImpl.java

@@ -19,8 +19,10 @@ import shop.alien.mapper.LifeDiscountCouponUserMapper;
 import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 /**
@@ -40,8 +42,8 @@ public class DiningCouponServiceImpl implements DiningCouponService {
     private final LifeDiscountCouponMapper lifeDiscountCouponMapper;
 
     @Override
-    public R<List<LifeDiscountCouponVo>> getUserCouponList(String authorization, int page, int size, String tabType, Integer type, Integer couponType, String storeId) {
-        log.info("DiningCouponService.getUserCouponList page={}, size={}, tabType={}, type={}, couponType={}, storeId={}", page, size, tabType, type, couponType, storeId);
+    public R<List<LifeDiscountCouponVo>> getUserCouponList(String authorization, int page, int size, String tabType, Integer type, Integer couponType, String storeId, String storeKeyword) {
+        log.info("DiningCouponService.getUserCouponList page={}, size={}, tabType={}, type={}, couponType={}, storeId={}, storeKeyword={}", page, size, tabType, type, couponType, storeId, storeKeyword);
         try {
             // 参数校验
             if (StringUtils.isEmpty(tabType)) {
@@ -55,7 +57,7 @@ public class DiningCouponServiceImpl implements DiningCouponService {
                 size = 10;
             }
             
-            R<List<LifeDiscountCouponVo>> result = alienStoreFeign.getUserCouponList(authorization, tabType, page, size, type, couponType, storeId);
+            R<List<LifeDiscountCouponVo>> result = alienStoreFeign.getUserCouponList(authorization, tabType, page, size, type, couponType, storeId, storeKeyword);
             if (result == null) {
                 log.error("Feign调用返回null");
                 return R.fail("获取优惠券列表失败:服务返回为空");
@@ -121,6 +123,8 @@ public class DiningCouponServiceImpl implements DiningCouponService {
             userWrapper.and(w -> w.isNull(LifeDiscountCouponUser::getExpirationTime)
                     .or()
                     .ge(LifeDiscountCouponUser::getExpirationTime, LocalDate.now()));
+            userWrapper.orderByDesc(LifeDiscountCouponUser::getReceiveTime);
+            userWrapper.orderByDesc(LifeDiscountCouponUser::getId);
             List<LifeDiscountCouponUser> userCoupons = lifeDiscountCouponUserMapper.selectList(userWrapper);
 
             if (userCoupons == null || userCoupons.isEmpty()) {
@@ -128,107 +132,53 @@ public class DiningCouponServiceImpl implements DiningCouponService {
                 return R.data(new ArrayList<>());
             }
 
-            // 获取优惠券ID列表
             List<Integer> couponIds = userCoupons.stream()
                     .map(LifeDiscountCouponUser::getCouponId)
+                    .filter(Objects::nonNull)
+                    .distinct()
                     .collect(Collectors.toList());
+            if (couponIds.isEmpty()) {
+                return R.data(new ArrayList<>());
+            }
 
-            // 查询优惠券详情
-            LambdaQueryWrapper<LifeDiscountCoupon> couponWrapper = new LambdaQueryWrapper<>();
-            couponWrapper.in(LifeDiscountCoupon::getId, couponIds);
-            couponWrapper.eq(LifeDiscountCoupon::getDeleteFlag, 0);
+            // 模板含逻辑删除:用户已领的券在商家删除模板后仍要能展示属性(与 store 端 includeDeleted 一致)
+            List<LifeDiscountCoupon> coupons = lifeDiscountCouponMapper.selectByIdsIncludeDeleted(couponIds);
+            if (coupons == null) {
+                coupons = Collections.emptyList();
+            }
             if (StringUtils.hasText(storeId)) {
-                couponWrapper.eq(LifeDiscountCoupon::getStoreId, storeId);
+                String sid = storeId.trim();
+                coupons = coupons.stream()
+                        .filter(c -> c != null && sid.equals(c.getStoreId()))
+                        .collect(Collectors.toList());
             }
-            List<LifeDiscountCoupon> coupons = lifeDiscountCouponMapper.selectList(couponWrapper);
 
-            if (coupons == null || coupons.isEmpty()) {
+            if (coupons.isEmpty()) {
                 log.info("未找到优惠券详情, userId={}, couponIds={}", userId, couponIds);
                 return R.data(new ArrayList<>());
             }
 
-            // 转换为VO并设置用户券ID,同时过滤掉已过期和未在使用时间内的优惠券
+            Map<Integer, LifeDiscountCoupon> templateById = coupons.stream()
+                    .collect(Collectors.toMap(LifeDiscountCoupon::getId, c -> c, (a, b) -> a));
+
             LocalDate now = LocalDate.now();
             List<LifeDiscountCouponVo> couponVos = new ArrayList<>();
-            for (LifeDiscountCoupon coupon : coupons) {
-                // 找到对应的用户券
-                LifeDiscountCouponUser userCoupon = userCoupons.stream()
-                        .filter(uc -> uc.getCouponId().equals(coupon.getId()))
-                        .findFirst()
-                        .orElse(null);
-
-                if (userCoupon == null) {
+            for (LifeDiscountCouponUser userCoupon : userCoupons) {
+                Integer cid = userCoupon.getCouponId();
+                if (cid == null) {
                     continue;
                 }
-
-                // 过滤1:检查用户券的过期时间(expirationTime)
-                if (userCoupon.getExpirationTime() != null && now.isAfter(userCoupon.getExpirationTime())) {
-                    log.debug("过滤已过期的用户券, couponId={}, expirationTime={}, now={}", 
-                            coupon.getId(), userCoupon.getExpirationTime(), now);
+                LifeDiscountCoupon coupon = templateById.get(cid);
+                if (coupon == null) {
                     continue;
                 }
-
-                // 过滤2:检查优惠券的使用时间范围(startDate 和 endDate)
-                // 如果优惠券有设置使用时间范围,则检查当前日期是否在范围内
-                if (coupon.getStartDate() != null || coupon.getEndDate() != null) {
-                    boolean inTimeRange = true;
-                    if (coupon.getStartDate() != null && now.isBefore(coupon.getStartDate())) {
-                        // 当前日期早于开始日期,未在使用时间内
-                        inTimeRange = false;
-                    }
-                    if (coupon.getEndDate() != null && now.isAfter(coupon.getEndDate())) {
-                        // 当前日期晚于结束日期,未在使用时间内
-                        inTimeRange = false;
-                    }
-                    if (!inTimeRange) {
-                        log.debug("过滤未在使用时间内的优惠券, couponId={}, startDate={}, endDate={}, now={}", 
-                                coupon.getId(), coupon.getStartDate(), coupon.getEndDate(), now);
-                        continue;
-                    }
-                }
-
-                // 过滤3:检查优惠券的有效期(validDate)
-                if (coupon.getValidDate() != null && now.isAfter(coupon.getValidDate())) {
-                    log.debug("过滤已过期的优惠券(validDate), couponId={}, validDate={}, now={}", 
-                            coupon.getId(), coupon.getValidDate(), now);
+                if (!passesOwnedCouponUsableFilters(coupon, userCoupon, now)) {
                     continue;
                 }
-
-                LifeDiscountCouponVo vo = convertToVo(coupon, userCoupon);
-                couponVos.add(vo);
+                couponVos.add(convertToVo(coupon, userCoupon));
             }
 
-            // 排序:符合支付条件的优先,其次优惠力度大的优先
-            if (amount != null) {
-                couponVos.sort((vo1, vo2) -> {
-                    // 判断是否符合支付条件(满足最低消费要求)
-                    boolean vo1CanUse = vo1.getMinimumSpendingAmount() == null
-                            || vo1.getMinimumSpendingAmount().compareTo(amount) <= 0;
-                    boolean vo2CanUse = vo2.getMinimumSpendingAmount() == null
-                            || vo2.getMinimumSpendingAmount().compareTo(amount) <= 0;
-
-                    // 第一优先级:符合支付条件的优先
-                    if (vo1CanUse && !vo2CanUse) {
-                        return -1; // vo1 排在前面
-                    }
-                    if (!vo1CanUse && vo2CanUse) {
-                        return 1; // vo2 排在前面
-                    }
-
-                    // 第二优先级:优惠力度大的优先(根据优惠券类型计算实际优惠金额)
-                    BigDecimal discountAmount1 = calculateDiscountAmountForVO(vo1, amount);
-                    BigDecimal discountAmount2 = calculateDiscountAmountForVO(vo2, amount);
-                    return discountAmount2.compareTo(discountAmount1); // 降序排列
-                });
-            } else {
-                // 如果没有提供金额,无法计算折扣券的实际优惠金额,只按面值排序(满减券)
-                // 注意:这种情况下折扣券无法准确排序,建议前端传入订单金额
-                couponVos.sort((vo1, vo2) -> {
-                    BigDecimal nominalValue1 = vo1.getNominalValue() != null ? vo1.getNominalValue() : BigDecimal.ZERO;
-                    BigDecimal nominalValue2 = vo2.getNominalValue() != null ? vo2.getNominalValue() : BigDecimal.ZERO;
-                    return nominalValue2.compareTo(nominalValue1); // 降序排列
-                });
-            }
+            sortOwnedCouponsForCheckout(couponVos, amount); // amount 仅参与排序,不参与过滤
 
             log.info("查询用户拥有的优惠券成功, userId={}, count={}", userId, couponVos.size());
             return R.data(couponVos);
@@ -401,6 +351,103 @@ public class DiningCouponServiceImpl implements DiningCouponService {
     }
 
     /**
+     * /userOwned:排除已过期(用户券有效期、模板可使用日期、模板 validDate)。
+     */
+    private boolean passesOwnedCouponUsableFilters(LifeDiscountCoupon coupon, LifeDiscountCouponUser userCoupon, LocalDate now) {
+        if (userCoupon.getExpirationTime() != null && now.isAfter(userCoupon.getExpirationTime())) {
+            log.debug("过滤已过期的用户券, userCouponId={}, couponId={}, expirationTime={}, now={}",
+                    userCoupon.getId(), coupon.getId(), userCoupon.getExpirationTime(), now);
+            return false;
+        }
+
+        if (coupon.getStartDate() != null || coupon.getEndDate() != null) {
+            if (coupon.getStartDate() != null && now.isBefore(coupon.getStartDate())) {
+                return false;
+            }
+            if (coupon.getEndDate() != null && now.isAfter(coupon.getEndDate())) {
+                return false;
+            }
+        }
+
+        if (coupon.getValidDate() != null && now.isAfter(coupon.getValidDate())) {
+            log.debug("过滤已过期的优惠券(validDate), couponId={}, validDate={}, now={}",
+                    coupon.getId(), coupon.getValidDate(), now);
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * /userOwned 排序:{@code amount} 仅用于比较「可否视为满足门槛」及估算优惠力度,不参与列表过滤。<br/>
+     * 规则:{@code amount} 必须 &gt; 0;无门槛(最低消费为空或 ≤ 0)即视为门槛已满足(需金额大于 0);有门槛时需 {@code amount ≥ 最低消费}。
+     */
+    private void sortOwnedCouponsForCheckout(List<LifeDiscountCouponVo> couponVos, BigDecimal amount) {
+        if (couponVos == null || couponVos.size() <= 1) {
+            return;
+        }
+        if (amount != null) {
+            couponVos.sort((vo1, vo2) -> {
+                boolean vo1CanUse = canUseCouponForCheckoutSort(vo1, amount);
+                boolean vo2CanUse = canUseCouponForCheckoutSort(vo2, amount);
+
+                if (vo1CanUse != vo2CanUse) {
+                    return vo1CanUse ? -1 : 1;
+                }
+
+                BigDecimal discountAmount1 = calculateDiscountAmountForVO(vo1, amount);
+                BigDecimal discountAmount2 = calculateDiscountAmountForVO(vo2, amount);
+                int cmp = discountAmount2.compareTo(discountAmount1);
+                if (cmp != 0) {
+                    return cmp;
+                }
+                return compareUserCouponIdDesc(vo1, vo2);
+            });
+            return;
+        }
+
+        couponVos.sort((vo1, vo2) -> {
+            BigDecimal nominalValue1 = vo1.getNominalValue() != null ? vo1.getNominalValue() : BigDecimal.ZERO;
+            BigDecimal nominalValue2 = vo2.getNominalValue() != null ? vo2.getNominalValue() : BigDecimal.ZERO;
+            int cmp = nominalValue2.compareTo(nominalValue1);
+            if (cmp != 0) {
+                return cmp;
+            }
+            return compareUserCouponIdDesc(vo1, vo2);
+        });
+    }
+
+    private static int compareUserCouponIdDesc(LifeDiscountCouponVo vo1, LifeDiscountCouponVo vo2) {
+        Integer id1 = vo1 != null ? vo1.getUserCouponId() : null;
+        Integer id2 = vo2 != null ? vo2.getUserCouponId() : null;
+        if (id1 == null && id2 == null) {
+            return 0;
+        }
+        if (id1 == null) {
+            return 1;
+        }
+        if (id2 == null) {
+            return -1;
+        }
+        return id2.compareTo(id1);
+    }
+
+    /**
+     * /userOwned 排序专用:不传金额或金额 ≤ 0 时一律视为不可用(排序靠后)。
+     * 无门槛券:{@code minimumSpendingAmount == null || ≤ 0},需当前 {@code amount &gt; 0};
+     * 有门槛券:需 {@code amount ≥ minimumSpendingAmount}。
+     */
+    private static boolean canUseCouponForCheckoutSort(LifeDiscountCouponVo vo, BigDecimal amount) {
+        if (vo == null || amount == null || amount.compareTo(BigDecimal.ZERO) <= 0) {
+            return false;
+        }
+        BigDecimal min = vo.getMinimumSpendingAmount();
+        if (min == null || min.compareTo(BigDecimal.ZERO) <= 0) {
+            return true;
+        }
+        return min.compareTo(amount) <= 0;
+    }
+
+    /**
      * 将优惠券实体转换为VO
      */
     private LifeDiscountCouponVo convertToVo(LifeDiscountCoupon coupon, LifeDiscountCouponUser userCoupon) {

+ 3 - 3
alien-dining/src/main/java/shop/alien/dining/service/impl/StoreOrderServiceImpl.java

@@ -825,9 +825,9 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
         }
 
         // 检查订单状态:只有已支付状态(1)的订单才能完成
-        if (order.getOrderStatus() != 1) {
-            throw new RuntimeException("订单状态不正确,只有已支付状态的订单才能完成");
-        }
+//        if (order.getOrderStatus() != 1) {
+//            throw new RuntimeException("订单状态不正确,只有已支付状态的订单才能完成");
+//        }
 
         // 检查支付状态:确保订单已支付
         if (order.getPayStatus() != 1) {

+ 15 - 0
alien-entity/src/main/java/shop/alien/mapper/LifeDiscountCouponUserMapper.java

@@ -9,6 +9,8 @@ import org.apache.ibatis.annotations.Select;
 import shop.alien.entity.store.LifeDiscountCouponUser;
 import shop.alien.entity.store.vo.LifeDiscountCouponUserWebVo;
 
+import java.time.LocalDate;
+
 /**
  * <p>
  * 优惠券用户表 Mapper 接口
@@ -29,4 +31,17 @@ public interface LifeDiscountCouponUserMapper extends BaseMapper<LifeDiscountCou
     @Select("select a.*, b.user_name, b.real_name, b.user_phone from life_discount_coupon_user a left join life_user b on a.user_id = b.id ${ew.customSqlSegment}")
     IPage<LifeDiscountCouponUserWebVo> selectPageList(IPage<LifeDiscountCouponUserWebVo> iPage, @Param(Constants.WRAPPER) QueryWrapper<LifeDiscountCouponUserWebVo> queryWrapper);
 
+    /**
+     * 用户券列表:先按模板(含逻辑删除模板)与用户 tab 筛选,再分页;与内存过滤后再分页语义一致。
+     */
+    IPage<LifeDiscountCouponUser> selectPageAfterTemplateFilter(IPage<LifeDiscountCouponUser> page,
+                                                                  @Param("userId") int userId,
+                                                                  @Param("tabType") String tabType,
+                                                                  @Param("today") LocalDate today,
+                                                                  @Param("sevenDaysLater") LocalDate sevenDaysLater,
+                                                                  @Param("sevenDaysAgo") LocalDate sevenDaysAgo,
+                                                                  @Param("couponType") Integer couponType,
+                                                                  @Param("filterStoreId") String filterStoreId,
+                                                                  @Param("storeKeyword") String storeKeyword);
+
 }

+ 1 - 1
alien-entity/src/main/java/shop/alien/mapper/second/SecondRecommendMapper.java

@@ -21,7 +21,7 @@ public interface SecondRecommendMapper extends BaseMapper<SecondGoodsRecommendVo
 
     IPage<SecondGoodsRecommendVo> querySecondConcernByPage(IPage<SecondGoodsRecommendVo> page, @Param("userId") Integer userId, @Param("phoneId") String phoneId, @Param("position") String position);
 
-    IPage<SecondGoodsRecommendVo> querySecondNewGoodsByPage(IPage<SecondGoodsRecommendVo> page,@Param("userId") String userId, @Param("phoneId") String phoneId, @Param("position") String position, @Param("radiusKm") String radiusKm);
+    IPage<SecondGoodsRecommendVo> querySecondNewGoodsByPage(IPage<SecondGoodsRecommendVo> page,@Param("userId") String userId, @Param("phoneId") String phoneId, @Param("position") String position, @Param("radiusKm") String radiusKm, @Param("timeRange") Integer timeRange);
 
     List<SecondCommentVo> querySecondCommentInfo(@Param("ids") List<Integer> ids);
 

+ 39 - 0
alien-entity/src/main/resources/mapper/LifeDiscountCouponUserMapper.xml

@@ -19,4 +19,43 @@
         id, user_id, coupon_id, delete_flag, created_time, updated_time, created_user_id, updated_user_id
     </sql>
 
+    <select id="selectPageAfterTemplateFilter" resultType="shop.alien.entity.store.LifeDiscountCouponUser">
+        SELECT u.*
+        FROM life_discount_coupon_user u
+        INNER JOIN life_discount_coupon c ON u.coupon_id = c.id
+        LEFT JOIN store_info si ON si.id = c.store_id AND si.delete_flag = 0
+        WHERE u.delete_flag = 0
+          AND u.user_id = #{userId}
+          AND u.coupon_id IS NOT NULL
+        <choose>
+            <when test='tabType != null &amp;&amp; tabType.equals("0")'>
+                AND ((u.expiration_time &gt;= #{today}) OR u.expiration_time IS NULL)
+                AND u.status = 0
+            </when>
+            <when test='tabType != null &amp;&amp; tabType.equals("1")'>
+                AND u.expiration_time &gt;= #{today}
+                AND u.expiration_time &lt;= #{sevenDaysLater}
+                AND u.status = 0
+            </when>
+            <when test='tabType != null &amp;&amp; tabType.equals("2")'>
+                AND u.status = 1
+            </when>
+            <when test='tabType != null &amp;&amp; tabType.equals("3")'>
+                AND u.expiration_time &gt; #{sevenDaysAgo}
+                AND u.expiration_time &lt; #{today}
+                AND u.status = 0
+            </when>
+        </choose>
+        <if test="couponType != null">
+            AND c.coupon_type = #{couponType}
+        </if>
+        <if test="filterStoreId != null and filterStoreId != ''">
+            AND c.store_id = #{filterStoreId}
+        </if>
+        <if test="storeKeyword != null and storeKeyword != ''">
+            AND si.store_name LIKE CONCAT('%', #{storeKeyword}, '%')
+        </if>
+        ORDER BY u.created_time DESC
+    </select>
+
 </mapper>

+ 14 - 0
alien-entity/src/main/resources/mapper/second/SecondGoodsInfoMapper.xml

@@ -218,6 +218,20 @@
                 and not exists (select 1 from second_shield s where s.user_id = #{userId} and s.shield_type = 1 and s.shield_id = g.id and s.delete_flag = 0)
                 and g.goods_status = 3
                 and g.position != '' and g.position is not null
+                <choose>
+                    <when test="timeRange == 1">
+                        and g.release_time &gt;= DATE_SUB(NOW(), INTERVAL 12 HOUR)
+                    </when>
+                    <when test="timeRange == 2">
+                        and g.release_time &gt;= DATE_SUB(NOW(), INTERVAL 24 HOUR)
+                    </when>
+                    <when test="timeRange == 3">
+                        and g.release_time &gt;= DATE_SUB(NOW(), INTERVAL 48 HOUR)
+                    </when>
+                    <when test="timeRange == 4">
+                        and g.release_time &gt;= DATE_SUB(NOW(), INTERVAL 72 HOUR)
+                    </when>
+                </choose>
             order by g.release_time desc
         ) a where a.dist &lt; #{radiusKm}
     </select>

+ 5 - 4
alien-second/src/main/java/shop/alien/second/controller/SecondRecommendController.java

@@ -58,10 +58,11 @@ public class SecondRecommendController {
             @RequestParam(value = "pageSize", required = false) Integer pageSize,
             @RequestParam(value = "longitude", required = false) String longitude,
             @RequestParam(value = "latitude", required = false) String latitude,
-            @RequestParam(value = "radiusKm", required = false) String radiusKm) throws Exception {
-        log.info("LifeCollectController.cancelCollect?pageNum={},pageSize={},longitude={},latitude={}", pageNum, pageSize, longitude, latitude);
+            @RequestParam(value = "radiusKm", required = false) String radiusKm,
+            @RequestParam(value = "timeRange", required = false) Integer timeRange) throws Exception {
+        log.info("LifeCollectController.cancelCollect?pageNum={},pageSize={},longitude={},latitude={},timeRange={}", pageNum, pageSize, longitude, latitude, timeRange);
         IPage<SecondGoodsRecommendVo> page = new Page<>(pageNum, pageSize);
-        IPage<SecondGoodsRecommendVo> result = service.querySecondNewGoodsByPage(page, longitude + "," + latitude, radiusKm);
+        IPage<SecondGoodsRecommendVo> result = service.querySecondNewGoodsByPage(page, longitude + "," + latitude, radiusKm, timeRange);
         return R.data(result, "查询成功");
     }
 
@@ -75,7 +76,7 @@ public class SecondRecommendController {
         return R.data(service.querySecondGoodsDetail(goodsId, longitude + "," + latitude), "查询成功");
     }
 
-    @ApiOperation("搜索商品详情")
+    @ApiOperation(value = "商品详情(匿名/带手机号)", notes = "需传当前用户 phoneId(可为裸手机号或 user_ 前缀),与 collect/addCollect 写入的 life_collect.user_id 一致;响应 collectStatus:0=未收藏,1=已收藏")
     @PostMapping("/querySecondGoodsDetailWithOutJWT")
     public R<SecondGoodsRecommendVo> querySecondGoodsDetailWithOutJWT(
             @RequestParam(value = "phoneId", required = false) String phoneId,

+ 2 - 1
alien-second/src/main/java/shop/alien/second/service/SecondRecommendService.java

@@ -32,9 +32,10 @@ public interface SecondRecommendService extends IService<SecondGoodsRecommendVo>
      * 查询新品信息
      * @param page 分页信息
      * @param position 经纬度
+     * @param timeRange 发布时间范围:1-12小时内,2-24小时内,3-48小时内,4-72小时内
      * @return 新品商品信息
      */
-    IPage<SecondGoodsRecommendVo> querySecondNewGoodsByPage(IPage<SecondGoodsRecommendVo> page, String position, String radiusKm) throws Exception;
+    IPage<SecondGoodsRecommendVo> querySecondNewGoodsByPage(IPage<SecondGoodsRecommendVo> page, String position, String radiusKm, Integer timeRange) throws Exception;
 
     /**
      * 查询商品详情信息

+ 24 - 6
alien-second/src/main/java/shop/alien/second/service/impl/SecondRecommendServiceImpl.java

@@ -135,7 +135,7 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
      * @return 关注列表
      */
     public IPage<SecondGoodsRecommendVo> querySecondNewGoodsByPage(
-            IPage<SecondGoodsRecommendVo> page, String position, String radiusKm) throws Exception {
+            IPage<SecondGoodsRecommendVo> page, String position, String radiusKm, Integer timeRange) throws Exception {
         try {
             JSONObject data = JwtUtil.getCurrentUserInfo();
             String phoneId = null;
@@ -147,7 +147,7 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
             if (StringUtil.isBlank(phoneId)) {
                 return null;
             }
-            IPage<SecondGoodsRecommendVo> list = mapper.querySecondNewGoodsByPage(page, userId,"user_" + phoneId, position, radiusKm);
+            IPage<SecondGoodsRecommendVo> list = mapper.querySecondNewGoodsByPage(page, userId,"user_" + phoneId, position, radiusKm, timeRange);
             List<Integer> idList = list.getRecords().stream() // 创建流
                     .map(obj -> obj.getId())   // 提取每个元素的 ID
                     .collect(Collectors.toList());
@@ -191,7 +191,8 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
             if (StringUtil.isBlank(phoneId)) {
                 return null;
             }
-            SecondGoodsRecommendVo item = mapper.querySecondGoodsDetail(goodsId, "user_" + phoneId, position);
+            String collectUserId = toLifeCollectUserId(phoneId);
+            SecondGoodsRecommendVo item = mapper.querySecondGoodsDetail(goodsId, collectUserId, position);
             applySecondGoodsDetailEnrichment(item, phoneId, goodsId);
             return item;
         } catch (Exception e) {
@@ -206,7 +207,8 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
             if (StringUtil.isBlank(phoneId)) {
                 return null;
             }
-            SecondGoodsRecommendVo item = mapper.querySecondGoodsDetail(goodsId, "user_" + phoneId, position);
+            String collectUserId = toLifeCollectUserId(phoneId);
+            SecondGoodsRecommendVo item = mapper.querySecondGoodsDetail(goodsId, collectUserId, position);
             applySecondGoodsDetailEnrichment(item, phoneId, goodsId);
             return item;
         } catch (Exception e) {
@@ -216,7 +218,20 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
     }
 
     /**
-     * 二手商品详情公共填充:图片列表(含视频排序)、关注状态、距离文案、价格展示
+     * 与 {@code alienStore/collect/addCollect}、表 {@code life_collect.user_id} 一致:普通用户收藏键为 {@code user_手机号}。
+     *
+     * @param phoneOrUserId 裸手机号或已带 {@code user_} 的前端入参
+     */
+    static String toLifeCollectUserId(String phoneOrUserId) {
+        if (StringUtil.isBlank(phoneOrUserId)) {
+            return "";
+        }
+        String t = phoneOrUserId.trim();
+        return t.startsWith("user_") ? t : "user_" + t;
+    }
+
+    /**
+     * 二手商品详情公共填充:图片列表(含视频排序)、关注状态、距离文案、价格展示;收藏状态由 SQL 已带出,此处补默认「未收藏」。
      */
     private void applySecondGoodsDetailEnrichment(SecondGoodsRecommendVo item, String phoneId, Integer goodsId) {
         if (item == null) {
@@ -246,7 +261,7 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
         query1.lambda()
                 .eq(LifeFans::getFollowedId, item.getUserPhone())
                 .eq(LifeFans::getDeleteFlag, 0)
-                .eq(LifeFans::getFansId, "user_" + phoneId);
+                .eq(LifeFans::getFansId, toLifeCollectUserId(phoneId));
         List<LifeFans> lifeFans = lifeFansMapper.selectList(query1);
         if (lifeFans.size() > 0) {
             item.setFansStatus(1);
@@ -256,6 +271,9 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
             item.setPosition("距离" + item.getDist() + "km");
         }
         item.setPrice(item.getAmount() != null ? item.getAmount().setScale(2, BigDecimal.ROUND_HALF_UP).toString() : null);
+        if (StringUtil.isBlank(item.getCollectStatus())) {
+            item.setCollectStatus("0");
+        }
     }
 
     public static void main(String[] args) {

+ 15 - 6
alien-store/src/main/java/shop/alien/store/controller/LifeDiscountCouponController.java

@@ -216,7 +216,7 @@ public class LifeDiscountCouponController {
     }
 
 
-    @ApiOperation("获取该用户所有的优惠券列表。couponType=1仅满减券,couponType=2仅折扣券,不传返回全部优惠券")
+    @ApiOperation("获取该用户所有的优惠券列表。couponType=1仅满减券,couponType=2仅折扣券,不传返回全部优惠券;storeKeyword 非空时仅返回门店名称包含关键字的优惠券")
     @ApiOperationSupport(order = 9)
     @GetMapping("/getUserCouponList")
     @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "分页页数", dataType = "Integer", paramType = "query", required = false),
@@ -224,7 +224,8 @@ public class LifeDiscountCouponController {
             @ApiImplicitParam(name = "tabType", value = "分页类型(0:全部(未使用),1:即将过期,2:已使用,3:已过期)", dataType = "String", paramType = "query", required = true),
             @ApiImplicitParam(name = "type", value = "券类型(不传或传1:仅优惠券;代金券 type=4 已下线)", dataType = "Integer", paramType = "query", required = false),
             @ApiImplicitParam(name = "couponType", value = "优惠券类型:1=仅满减券,2=仅折扣券,不传=全部优惠券(可选)", dataType = "Integer", paramType = "query", required = false),
-            @ApiImplicitParam(name = "storeId", value = "商铺ID,可为空,传则仅返回该商铺的优惠券", dataType = "String", paramType = "query", required = false)
+            @ApiImplicitParam(name = "storeId", value = "商铺ID,可为空,传则仅返回该商铺的优惠券", dataType = "String", paramType = "query", required = false),
+            @ApiImplicitParam(name = "storeKeyword", value = "店铺名称关键字,非空则只展示门店名称含关键字的优惠券(可选,最长100字符)", dataType = "String", paramType = "query", required = false)
     })
     public R<List<LifeDiscountCouponVo>> getUserCouponList(@ApiIgnore @TokenInfo UserLoginInfo userLoginInfo,
                                                            @RequestParam(value = "tabType") String tabType,
@@ -232,7 +233,8 @@ public class LifeDiscountCouponController {
                                                            @RequestParam(defaultValue = "10") int size,
                                                            @RequestParam(required = false) Integer type,
                                                            @RequestParam(value = "couponType", required = false) Integer couponType,
-                                                           @RequestParam(value = "storeId", required = false) String storeId) {
+                                                           @RequestParam(value = "storeId", required = false) String storeId,
+                                                           @RequestParam(value = "storeKeyword", required = false) String storeKeyword) {
         try {
             // 参数校验
             if (StringUtils.isEmpty(tabType)) {
@@ -250,12 +252,19 @@ public class LifeDiscountCouponController {
             if (couponType != null && couponType != 1 && couponType != 2) {
                 return R.fail("优惠券类型参数错误,必须为1(满减券)或2(折扣券)");
             }
+            String keywordParam = null;
+            if (storeKeyword != null) {
+                String t = storeKeyword.trim();
+                if (!t.isEmpty()) {
+                    keywordParam = t.length() > 100 ? t.substring(0, 100) : t;
+                }
+            }
             
-            log.info("LifeDiscountCouponController.getUserCouponList?userId={}, tabType={}, page={}, size={}, type={}, couponType={}, storeId={}", 
-                    userLoginInfo.getUserId(), tabType, page, size, type, couponType, storeId);
+            log.info("LifeDiscountCouponController.getUserCouponList?userId={}, tabType={}, page={}, size={}, type={}, couponType={}, storeId={}, storeKeyword={}",
+                    userLoginInfo.getUserId(), tabType, page, size, type, couponType, storeId, keywordParam);
             
             List<LifeDiscountCouponVo> storeCouponList = lifeDiscountCouponService.getUserCouponList(
-                    userLoginInfo, page, size, tabType, type, couponType, storeId);
+                    userLoginInfo, page, size, tabType, type, couponType, storeId, keywordParam);
             return R.data(storeCouponList);
         } catch (IllegalArgumentException e) {
             log.error("LifeDiscountCouponController.getUserCouponList 参数错误, userId={}, error={}", 

+ 2 - 1
alien-store/src/main/java/shop/alien/store/service/LifeDiscountCouponService.java

@@ -78,8 +78,9 @@ public interface LifeDiscountCouponService extends IService<LifeDiscountCoupon>
      * @param type 不传或1:仅用户优惠券(life_discount_coupon);4 已不再支持
      * @param couponType 优惠券类型:1=满减券,2=折扣券,null=全部
      * @param storeId 商铺ID,可为空,传则仅返回该商铺的优惠券
+     * @param storeKeyword 店铺名称关键字,非空时仅返回门店名称包含该关键字的券(与 storeId 可同时生效)
      */
-    List<LifeDiscountCouponVo> getUserCouponList(UserLoginInfo userLoginInfo, int page, int size, String tabType, Integer type, Integer couponType, String storeId);
+    List<LifeDiscountCouponVo> getUserCouponList(UserLoginInfo userLoginInfo, int page, int size, String tabType, Integer type, Integer couponType, String storeId, String storeKeyword);
 
     /**
      * 获取所有优惠券列表(分页)

+ 30 - 47
alien-store/src/main/java/shop/alien/store/service/impl/LifeDiscountCouponServiceImpl.java

@@ -796,23 +796,43 @@ public class LifeDiscountCouponServiceImpl extends ServiceImpl<LifeDiscountCoupo
      * @param type 券类型:保留兼容,仅 null 或 1(仅用户优惠券);4 已废弃
      * @param couponType 优惠券类型:1-满减券,2-折扣券,null-全部
      * @param storeId 商铺ID,可为空,传则仅返回该商铺的优惠券
+     * @param storeKeyword 店铺名称关键字,非空时仅门店名称匹配的券参与分页(与筛选后再分页一致)
      * @return 优惠券列表
      */
     @Override
-    public List<LifeDiscountCouponVo> getUserCouponList(UserLoginInfo userLoginInfo, int page, int size, String tabType, Integer type, Integer couponType, String storeId) {
+    public List<LifeDiscountCouponVo> getUserCouponList(UserLoginInfo userLoginInfo, int page, int size, String tabType, Integer type, Integer couponType, String storeId, String storeKeyword) {
         validateGetUserCouponListParams(userLoginInfo, tabType, type);
 
         ZoneId zone = ZoneId.systemDefault();
         LocalDate today = LocalDate.now(zone);
 
-        LambdaQueryWrapper<LifeDiscountCouponUser> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(LifeDiscountCouponUser::getUserId, userLoginInfo.getUserId());
-        applyUserCouponTabTypeFilter(queryWrapper, tabType, today, today.plusDays(7), today.minusDays(7));
-        // 仅 life_discount_coupon 用户券(有 coupon_id);模板可能已被商家逻辑删除,下层用 includeDeleted 再查属性
-        queryWrapper.isNotNull(LifeDiscountCouponUser::getCouponId);
-        queryWrapper.orderByDesc(LifeDiscountCouponUser::getCreatedTime);
+        String filterStoreId = null;
+        if (storeId != null) {
+            String trimmed = storeId.trim();
+            if (!trimmed.isEmpty()) {
+                filterStoreId = trimmed;
+            }
+        }
+        String keyword = null;
+        if (storeKeyword != null) {
+            String t = storeKeyword.trim();
+            if (!t.isEmpty()) {
+                keyword = t;
+            }
+        }
+
+        // 联表先按模板 + tab + couponType + storeId + 店铺名称关键字筛选再分页(含商家逻辑删除的模板)
+        IPage<LifeDiscountCouponUser> pageResult = lifeDiscountCouponUserMapper.selectPageAfterTemplateFilter(
+                new Page<>(page, size),
+                userLoginInfo.getUserId(),
+                tabType,
+                today,
+                today.plusDays(7),
+                today.minusDays(7),
+                couponType,
+                filterStoreId,
+                keyword);
 
-        IPage<LifeDiscountCouponUser> pageResult = lifeDiscountCouponUserMapper.selectPage(new Page<>(page, size), queryWrapper);
         List<LifeDiscountCouponUser> userRows = pageResult.getRecords();
         if (userRows.isEmpty()) {
             return new ArrayList<>();
@@ -825,11 +845,8 @@ public class LifeDiscountCouponServiceImpl extends ServiceImpl<LifeDiscountCoupo
 
         List<LifeDiscountCouponVo> result = new ArrayList<>();
         for (LifeDiscountCouponUser row : userRows) {
-            if (row.getCouponId() == null) {
-                continue;
-            }
-            LifeDiscountCoupon template = templateById.get(row.getCouponId());
-            if (template == null || !matchesUserCouponListFilters(template, couponType, storeId)) {
+            LifeDiscountCoupon template = row.getCouponId() == null ? null : templateById.get(row.getCouponId());
+            if (template == null) {
                 continue;
             }
             result.add(buildCouponVo(template, row, zone, today, storeByIdStr));
@@ -855,33 +872,6 @@ public class LifeDiscountCouponServiceImpl extends ServiceImpl<LifeDiscountCoupo
         }
     }
 
-    /** tabType:与用户券分页 tab 对齐的 SQL 条件(expiration/status) */
-    private void applyUserCouponTabTypeFilter(LambdaQueryWrapper<LifeDiscountCouponUser> queryWrapper, String tabType,
-                                              LocalDate today, LocalDate sevenDaysLater, LocalDate sevenDaysAgo) {
-        if (DiscountCouponEnum.ALL.getValue().equals(tabType)) {
-            // 未使用:过期日 >= 今天 或过期时间为 null;含「今天过期」仍可展示
-            queryWrapper.and(w -> w.ge(LifeDiscountCouponUser::getExpirationTime, today)
-                            .or().isNull(LifeDiscountCouponUser::getExpirationTime))
-                    .eq(LifeDiscountCouponUser::getStatus, DiscountCouponEnum.WAITING_USED.getValue());
-            return;
-        }
-        if (DiscountCouponEnum.BE_ABOUT_TO_EXPORE.getValue().equals(tabType)) {
-            queryWrapper.ge(LifeDiscountCouponUser::getExpirationTime, today)
-                    .le(LifeDiscountCouponUser::getExpirationTime, sevenDaysLater)
-                    .eq(LifeDiscountCouponUser::getStatus, DiscountCouponEnum.WAITING_USED.getValue());
-            return;
-        }
-        if (DiscountCouponEnum.HAVE_ALREADY_APPLIED.getValue().equals(tabType)) {
-            queryWrapper.eq(LifeDiscountCouponUser::getStatus, DiscountCouponEnum.HAVE_BEEN_USED.getValue());
-            return;
-        }
-        if (DiscountCouponEnum.HAVE_EXPIRED.getValue().equals(tabType)) {
-            queryWrapper.gt(LifeDiscountCouponUser::getExpirationTime, sevenDaysAgo)
-                    .lt(LifeDiscountCouponUser::getExpirationTime, today)
-                    .eq(LifeDiscountCouponUser::getStatus, DiscountCouponEnum.WAITING_USED.getValue());
-        }
-    }
-
     private List<LifeDiscountCoupon> loadCouponTemplatesIncludeDeleted(List<LifeDiscountCouponUser> userRows) {
         List<Integer> couponIds = userRows.stream()
                 .map(LifeDiscountCouponUser::getCouponId)
@@ -907,13 +897,6 @@ public class LifeDiscountCouponServiceImpl extends ServiceImpl<LifeDiscountCoupo
         return infos.stream().collect(Collectors.toMap(s -> s.getId().toString(), s -> s, (a, b) -> a));
     }
 
-    private boolean matchesUserCouponListFilters(LifeDiscountCoupon template, Integer couponType, String filterStoreId) {
-        if (couponType != null && !couponType.equals(template.getCouponType())) {
-            return false;
-        }
-        return StringUtils.isEmpty(filterStoreId) || filterStoreId.equals(template.getStoreId());
-    }
-
     /**
      * 构建优惠券VO
      */

+ 1 - 1
alien-store/src/main/java/shop/alien/store/service/impl/StoreClockInServiceImpl.java

@@ -143,7 +143,7 @@ public class StoreClockInServiceImpl extends ServiceImpl<StoreClockInMapper, Sto
         // 优化:提前查询所有需要的数据,避免在循环中查询
         // 查询我的点赞 - 使用Set提高查找效率
         LambdaQueryWrapper<LifeLikeRecord> likeWrapper = new LambdaQueryWrapper<>();
-        likeWrapper.eq(LifeLikeRecord::getDianzanId, phoneId);
+        likeWrapper.eq(LifeLikeRecord::getDianzanId, userId);
         likeWrapper.eq(LifeLikeRecord::getType, "5");
         List<LifeLikeRecord> lifeLikeList = lifeLikeRecordMapper.selectList(likeWrapper);
         Set<String> likeSet = lifeLikeList.stream()