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