From 4862fd4367447879732b635a20c05405c6fb60fb Mon Sep 17 00:00:00 2001 From: luluyuyu <3305167204@qq.com> Date: Sat, 14 Dec 2024 21:48:09 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E4=BF=AE=E6=94=B9=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E5=88=B8=E5=8A=A0=E4=B8=8D=E8=BF=9B=E5=8E=BB=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../skyeye/coupon/service/CouponService.java | 1 - .../service/impl/CouponServiceImpl.java | 26 ++++++------------- .../service/impl/CouponUseServiceImpl.java | 4 +-- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/CouponService.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/CouponService.java index f7163734..f8ea8b5b 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/CouponService.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/CouponService.java @@ -26,5 +26,4 @@ public interface CouponService extends SkyeyeBusinessService { void queryCouponListByMaterialId(InputObject inputObject, OutputObject outputObject); - Integer getUseCount(String couponId); } diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/impl/CouponServiceImpl.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/impl/CouponServiceImpl.java index d3d08bb3..7e6d3c15 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/impl/CouponServiceImpl.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/impl/CouponServiceImpl.java @@ -5,7 +5,6 @@ package com.skyeye.coupon.service.impl; import cn.hutool.core.collection.CollectionUtil; -import cn.hutool.core.util.ObjUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; @@ -79,8 +78,8 @@ public class CouponServiceImpl extends SkyeyeBusinessServiceImpl couponStoreList = couponStoreService.queryListByStoreId(storeId); List couponIdList = couponStoreList.stream().map(CouponStore::getCouponId).distinct().collect(Collectors.toList()); - if(CollectionUtil.isEmpty(couponIdList)){ + if (CollectionUtil.isEmpty(couponIdList)) { return; } queryWrapper.in(CommonConstants.ID, couponIdList); @@ -266,25 +265,16 @@ public class CouponServiceImpl extends SkyeyeBusinessServiceImpl wrapper = new MPJLambdaWrapper() - .innerJoin(CouponMaterial.class, CouponMaterial::getCouponId, Coupon::getId) - .eq(CouponMaterial::getMaterialId, materialId) - .eq(MybatisPlusUtil.toColumns(Coupon::getEnabled), EnableEnum.ENABLE_USING.getKey()) - .isNotNull(typeKey).ne(typeKey, StrUtil.EMPTY); + .innerJoin(CouponMaterial.class, CouponMaterial::getCouponId, Coupon::getId) + .eq(CouponMaterial::getMaterialId, materialId) + .eq(MybatisPlusUtil.toColumns(Coupon::getEnabled), EnableEnum.ENABLE_USING.getKey()) + .isNotNull(typeKey).ne(typeKey, StrUtil.EMPTY); List list = skyeyeBaseMapper.selectJoinList(Coupon.class, wrapper); setDrawState(list);// 设置是否可以领取状态 outputObject.setBean(list); outputObject.settotal(list.size()); } - @Override - public Integer getUseCount(String couponId) { - Coupon coupon = selectById(couponId); - if (ObjUtil.isEmpty(coupon)) { - throw new CustomException("优惠券不存在"); - } - return coupon.getUseCount(); - } - private void setDrawState(List list) { if (CollectionUtil.isEmpty(list)) return; List couponIdList = list.stream().map(Coupon::getId).collect(Collectors.toList()); diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/impl/CouponUseServiceImpl.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/impl/CouponUseServiceImpl.java index d18afc4e..2caf2fec 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/impl/CouponUseServiceImpl.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/impl/CouponUseServiceImpl.java @@ -142,10 +142,10 @@ public class CouponUseServiceImpl extends SkyeyeBusinessServiceImpl