|
@@ -9,11 +9,9 @@ import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
-import shop.alien.entity.store.LifeCoupon;
|
|
|
-import shop.alien.entity.store.LifeUserOrder;
|
|
|
-import shop.alien.entity.store.StoreDictionary;
|
|
|
-import shop.alien.entity.store.StoreIncomeDetailsRecord;
|
|
|
+import shop.alien.entity.store.*;
|
|
|
import shop.alien.entity.store.dto.LifeDiscountCouponStoreFriendDto;
|
|
|
+import shop.alien.entity.store.vo.LifeCouponStatusVo;
|
|
|
import shop.alien.mapper.LifeCouponMapper;
|
|
|
import shop.alien.mapper.LifeUserOrderMapper;
|
|
|
import shop.alien.mapper.StoreDictionaryMapper;
|
|
@@ -192,4 +190,36 @@ public class LifeCouponServiceImpl extends ServiceImpl<LifeCouponMapper, LifeCou
|
|
|
return resultMap;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * <p>
|
|
|
+ * 获取代金券状态
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author zhangchen
|
|
|
+ * @since 2025-07-14
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public LifeCouponStatusVo getCouponStatus(String couponId) {
|
|
|
+ if (couponId == null || couponId.isEmpty()) {
|
|
|
+ log.error("获取代金券状态失败:couponId为空");
|
|
|
+ throw new IllegalArgumentException("couponId不能为空");
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ LifeCoupon coupon = lifeCouponMapper.selectById(couponId);
|
|
|
+ LifeCouponStatusVo lifeCouponStatusVo = new LifeCouponStatusVo();
|
|
|
+ if (coupon != null) {
|
|
|
+ lifeCouponStatusVo.setCouponId(couponId);
|
|
|
+ lifeCouponStatusVo.setSingleQty(coupon.getSingleQty());
|
|
|
+ lifeCouponStatusVo.setBuyLimit(coupon.getBuyLimit());
|
|
|
+ } else {
|
|
|
+ // 可选:设置默认值或标记状态为无效
|
|
|
+ lifeCouponStatusVo.setSingleQty(0); // 或其他默认逻辑
|
|
|
+ }
|
|
|
+ return lifeCouponStatusVo;
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("获取代金券状态失败: {}", e);
|
|
|
+ throw new RuntimeException("获取代金券状态失败", e); // 或者根据项目规范处理
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|