From 3bcba677462fdc3e4ff122eefdc270aa0417179b Mon Sep 17 00:00:00 2001 From: wst <2450473462@qq.com> Date: Fri, 13 Dec 2024 20:58:34 +0800 Subject: [PATCH 1/9] =?UTF-8?q?feat:=20=E5=8F=91=E6=94=BE=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E5=88=B8=E6=97=B6=EF=BC=8CstoreId=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=EF=BC=8C=E5=88=99=E7=BB=99shop=5Fcoupon=5Fstore=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=B8=80=E6=9D=A1=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/skyeye/coupon/service/impl/CouponServiceImpl.java | 7 +++++++ 1 file changed, 7 insertions(+) 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 c6ac8445..ffa8cfef 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 @@ -28,6 +28,7 @@ import com.skyeye.coupon.enums.PromotionDiscountType; import com.skyeye.coupon.enums.PromotionMaterialScope; import com.skyeye.coupon.service.CouponMaterialService; import com.skyeye.coupon.service.CouponService; +import com.skyeye.coupon.service.CouponStoreService; import com.skyeye.coupon.service.CouponUseService; import com.skyeye.eve.rest.quartz.SysQuartzMation; import com.skyeye.eve.service.IQuartzService; @@ -65,6 +66,9 @@ public class CouponServiceImpl extends SkyeyeBusinessServiceImpl Date: Fri, 13 Dec 2024 21:51:43 +0800 Subject: [PATCH 2/9] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0shop=5Fcoupon=5Fs?= =?UTF-8?q?tore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/skyeye/coupon/dao/CouponStoreDao.java | 7 ++++ .../java/com/skyeye/coupon/entity/Coupon.java | 6 ++- .../com/skyeye/coupon/entity/CouponStore.java | 28 +++++++++++++ .../coupon/service/CouponStoreService.java | 12 ++++++ .../service/impl/CouponServiceImpl.java | 7 ++-- .../service/impl/CouponStoreServiceImpl.java | 39 +++++++++++++++++++ 6 files changed, 95 insertions(+), 4 deletions(-) create mode 100644 skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/dao/CouponStoreDao.java create mode 100644 skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/entity/CouponStore.java create mode 100644 skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/CouponStoreService.java create mode 100644 skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/impl/CouponStoreServiceImpl.java diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/dao/CouponStoreDao.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/dao/CouponStoreDao.java new file mode 100644 index 00000000..3456510e --- /dev/null +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/dao/CouponStoreDao.java @@ -0,0 +1,7 @@ +package com.skyeye.coupon.dao; + +import com.skyeye.coupon.entity.CouponStore; +import com.skyeye.eve.dao.SkyeyeBaseMapper; + +public interface CouponStoreDao extends SkyeyeBaseMapper { +} diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/entity/Coupon.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/entity/Coupon.java index ec183e24..f3da2350 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/entity/Coupon.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/entity/Coupon.java @@ -35,8 +35,12 @@ import java.util.List; @ApiModel(value = "优惠券/模版信息管理实体类") public class Coupon extends BaseGeneralInfo { +// @TableField(value = "store_id_list") +// @ApiModelProperty(value = "发布门店id列表", required = "json") +// private List storeIdList; + @TableField(value = "store_id") - @ApiModelProperty(value = "发布门店id") + @ApiModelProperty(value = "发布门店id列表") private String storeId; @TableField(value = "template_id") diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/entity/CouponStore.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/entity/CouponStore.java new file mode 100644 index 00000000..b1f6c1e6 --- /dev/null +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/entity/CouponStore.java @@ -0,0 +1,28 @@ +package com.skyeye.coupon.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.skyeye.annotation.api.ApiModel; +import com.skyeye.annotation.api.ApiModelProperty; +import com.skyeye.common.entity.CommonInfo; +import com.skyeye.common.entity.features.BaseGeneralInfo; +import lombok.Data; + +@Data +@TableName(value = "shop_coupon_store") +@ApiModel(value = "门店与优惠券关联表实体类") +public class CouponStore extends CommonInfo { + + @TableId("id") + @ApiModelProperty("主键id。为空时新增,不为空时编辑") + private String id; + + @TableField(value = "store_id") + @ApiModelProperty(value = "门店id") + private String storeId; + + @TableField(value = "coupon_id") + @ApiModelProperty(value = "优惠券id") + private String couponId; +} diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/CouponStoreService.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/CouponStoreService.java new file mode 100644 index 00000000..83001ba1 --- /dev/null +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/CouponStoreService.java @@ -0,0 +1,12 @@ +package com.skyeye.coupon.service; + +import com.skyeye.base.business.service.SkyeyeBusinessService; +import com.skyeye.coupon.entity.CouponStore; + +import java.util.List; + +public interface CouponStoreService extends SkyeyeBusinessService { + void createEntity(String couponId, List storeIdList); + + List queryListByStoreId(String storeId); +} 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 ffa8cfef..edbe8eb9 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 @@ -23,6 +23,7 @@ import com.skyeye.common.util.mybatisplus.MybatisPlusUtil; import com.skyeye.coupon.dao.CouponDao; import com.skyeye.coupon.entity.Coupon; import com.skyeye.coupon.entity.CouponMaterial; +import com.skyeye.coupon.entity.CouponStore; import com.skyeye.coupon.enums.CouponValidityType; import com.skyeye.coupon.enums.PromotionDiscountType; import com.skyeye.coupon.enums.PromotionMaterialScope; @@ -125,9 +126,9 @@ public class CouponServiceImpl extends SkyeyeBusinessServiceImpl implements CouponStoreService { + + @Override + public void createEntity(String couponId, List storeIdList) { + List list = super.queryAllData(); + for (String s : storeIdList) { + CouponStore couponStore = new CouponStore(); + couponStore.setStoreId(s); + couponStore.setCouponId(couponId); + list.add(couponStore); + } + super.createEntity(list, StrUtil.EMPTY); + } + + @Override + public List queryListByStoreId(String storeId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq(MybatisPlusUtil.toColumns(CouponStore::getStoreId), storeId); + return CollectionUtil.isEmpty(list(queryWrapper)) ? new ArrayList<>() : list(queryWrapper); + } +} \ No newline at end of file From 4c5568daac20264034fa676a9b205e5ddcb17914 Mon Sep 17 00:00:00 2001 From: lqy <3431632001@qq,com> Date: Sat, 14 Dec 2024 09:11:28 +0800 Subject: [PATCH 3/9] =?UTF-8?q?feat:=E4=BF=AE=E6=94=B9updateOrderItemState?= =?UTF-8?q?=EF=BC=8CqueryMyCouponUseByState?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../skyeye/coupon/service/impl/CouponUseServiceImpl.java | 7 ++++++- .../skyeye/order/service/impl/OrderItemServiceImpl.java | 2 +- .../com/skyeye/order/service/impl/OrderServiceImpl.java | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) 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 8d716dce..e786376d 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 @@ -44,6 +44,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; +import java.util.stream.Stream; /** * @ClassName: CouponUseServiceImpl @@ -202,7 +203,11 @@ public class CouponUseServiceImpl extends SkyeyeBusinessServiceImpl list = list(queryWrapper); couponService.setDataMation(list, CouponUse::getCouponId); - return JSONUtil.toList(JSONUtil.toJsonStr(list), null); + List collect = list.stream().map(item -> { + item.setUsageCount(item.getUsedCount()); + return item; + }).collect(Collectors.toList()); + return JSONUtil.toList(JSONUtil.toJsonStr(collect), null); } @Override diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderItemServiceImpl.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderItemServiceImpl.java index cb2be349..ecd6eed7 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderItemServiceImpl.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderItemServiceImpl.java @@ -156,7 +156,7 @@ public class OrderItemServiceImpl extends SkyeyeBusinessServiceImpl updateWrapper = new UpdateWrapper<>(); diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderServiceImpl.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderServiceImpl.java index 5a0cf37c..a7f92b5d 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderServiceImpl.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderServiceImpl.java @@ -598,7 +598,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl boolean allTwo = orderItemList.stream().map(OrderItem::getOrderItemState) .allMatch(orderItemState -> orderItemState == ShopOrderItemState.FINISHED.getKey()); if (allTwo) { - updateOrderState(orderId, ShopOrderState.COMPLETED.getKey()); + updateOrderState(orderId, ShopOrderState.SIGN.getKey()); } else { updateOrderState(orderId, ShopOrderState.PARTIALLYDONE.getKey()); } From 926bab991d39ff165281457f78584e81c54f0afa Mon Sep 17 00:00:00 2001 From: wst <2450473462@qq.com> Date: Sat, 14 Dec 2024 09:13:45 +0800 Subject: [PATCH 4/9] =?UTF-8?q?feat:=20=E5=88=A0=E9=99=A4=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E5=88=B8=E8=BF=9E=E5=B8=A6=E5=88=A0=E9=99=A4=E5=85=B6?= =?UTF-8?q?=E9=80=82=E7=94=A8=E5=AF=B9=E8=B1=A1=E3=80=81=E5=85=B3=E8=81=94?= =?UTF-8?q?=E9=97=A8=E5=BA=97=E5=92=8C=E5=B7=B2=E9=A2=86=E5=8F=96=E4=BD=86?= =?UTF-8?q?=E6=98=AF=E6=9C=AA=E4=BD=BF=E7=94=A8=E7=9A=84=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/skyeye/coupon/service/CouponStoreService.java | 2 ++ .../java/com/skyeye/coupon/service/CouponUseService.java | 2 ++ .../com/skyeye/coupon/service/impl/CouponServiceImpl.java | 4 +++- .../coupon/service/impl/CouponStoreServiceImpl.java | 7 +++++++ .../skyeye/coupon/service/impl/CouponUseServiceImpl.java | 8 ++++++++ 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/CouponStoreService.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/CouponStoreService.java index 83001ba1..b9db4195 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/CouponStoreService.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/CouponStoreService.java @@ -9,4 +9,6 @@ public interface CouponStoreService extends SkyeyeBusinessService { void createEntity(String couponId, List storeIdList); List queryListByStoreId(String storeId); + + void deleteByCouponIds(List ids); } diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/CouponUseService.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/CouponUseService.java index 84d0bf40..48536c86 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/CouponUseService.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/CouponUseService.java @@ -29,4 +29,6 @@ public interface CouponUseService extends SkyeyeBusinessService { void updateState(String couponUseId); void UpdateUsedCount(String couponUseId); + + void deleteByCouponIds(List ids); } 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 edbe8eb9..3ea04adf 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 @@ -232,7 +232,9 @@ public class CouponServiceImpl extends SkyeyeBusinessServiceImpl ids) { - couponMaterialService.deleteByCouponId(ids); + couponMaterialService.deleteByCouponId(ids);// 删除优惠券的适用对象 + couponStoreService.deleteByCouponIds(ids);// 删除优惠券与门店关联的信息 + couponUseService.deleteByCouponIds(ids); // 删除已领取的但是未使用的优惠券 } @Override diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/impl/CouponStoreServiceImpl.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/impl/CouponStoreServiceImpl.java index 56f6f7dc..d08f64c3 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/impl/CouponStoreServiceImpl.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/service/impl/CouponStoreServiceImpl.java @@ -36,4 +36,11 @@ public class CouponStoreServiceImpl extends SkyeyeBusinessServiceImpl() : list(queryWrapper); } + + @Override + public void deleteByCouponIds(List ids) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.in(MybatisPlusUtil.toColumns(CouponStore::getCouponId), ids); + remove(queryWrapper); + } } \ No newline at end of file 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 8d716dce..5e149869 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 @@ -265,4 +265,12 @@ public class CouponUseServiceImpl extends SkyeyeBusinessServiceImpl ids) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.in(MybatisPlusUtil.toColumns(CouponUse::getCouponId), ids); + queryWrapper.eq(MybatisPlusUtil.toColumns(CouponUse::getState), CouponUseState.UNUSED.getKey()); + remove(queryWrapper); + } } \ No newline at end of file From e26d0c3e2d0675854511e30f755e627ef2627c1d Mon Sep 17 00:00:00 2001 From: wst <2450473462@qq.com> Date: Sat, 14 Dec 2024 09:50:13 +0800 Subject: [PATCH 5/9] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E5=88=B8=E6=97=B6=EF=BC=8C=E6=BB=A1=E5=87=8F=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E5=88=B8=E7=9A=84=E4=BD=BF=E7=94=A8=E9=87=91=E9=A2=9D?= =?UTF-8?q?=E5=A4=A7=E4=BA=8E=E7=AD=89=E4=BA=8E=E4=BC=98=E6=83=A0=E9=87=91?= =?UTF-8?q?=E9=A2=9D=E3=80=81=E6=8A=98=E6=89=A3=E4=B8=8A=E9=99=90=E5=A4=A7?= =?UTF-8?q?=E4=BA=8E=E4=BC=98=E6=83=A0=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../skyeye/coupon/service/impl/CouponServiceImpl.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 3ea04adf..44f7f59d 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 @@ -23,7 +23,6 @@ import com.skyeye.common.util.mybatisplus.MybatisPlusUtil; import com.skyeye.coupon.dao.CouponDao; import com.skyeye.coupon.entity.Coupon; import com.skyeye.coupon.entity.CouponMaterial; -import com.skyeye.coupon.entity.CouponStore; import com.skyeye.coupon.enums.CouponValidityType; import com.skyeye.coupon.enums.PromotionDiscountType; import com.skyeye.coupon.enums.PromotionMaterialScope; @@ -106,6 +105,12 @@ public class CouponServiceImpl extends SkyeyeBusinessServiceImpl Integer.parseInt(coupon.getDiscountLimitPrice())) { + throw new CustomException("价格折扣类型优惠券,折扣金额不能大于等于优惠上限金额"); + } + if (Integer.parseInt(coupon.getDiscountPrice()) > Integer.parseInt(coupon.getUsePrice())) { + throw new CustomException("价格折扣类型优惠券,折扣金额不能大于等于使用金额"); + } } else { if (coupon.getDiscountPercent() == null) { throw new CustomException("折扣率类型优惠券,折扣率不能为空"); @@ -114,7 +119,7 @@ public class CouponServiceImpl extends SkyeyeBusinessServiceImpl Date: Sat, 14 Dec 2024 15:48:17 +0800 Subject: [PATCH 6/9] =?UTF-8?q?feat:=20=E6=89=80=E6=9C=89=E6=9C=89?= =?UTF-8?q?=E5=85=B3=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E7=9A=84=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E9=83=BD=E5=8A=A0=E4=B8=8A=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../coupon/service/impl/CouponServiceImpl.java | 7 +++++++ .../service/impl/CouponUseServiceImpl.java | 13 +++++++++---- .../order/service/impl/OrderServiceImpl.java | 12 ++++++++++++ .../java/com/skyeye/xxljob/ShopXxlJob.java | 18 ++++++++++++++++++ 4 files changed, 46 insertions(+), 4 deletions(-) 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 44f7f59d..9adb4abb 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 @@ -34,6 +34,9 @@ import com.skyeye.eve.rest.quartz.SysQuartzMation; import com.skyeye.eve.service.IQuartzService; import com.skyeye.exception.CustomException; import com.skyeye.rest.shopmaterialnorms.sevice.IShopMaterialNormsService; +import com.skyeye.xxljob.ShopXxlJob; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -69,6 +72,8 @@ public class CouponServiceImpl extends SkyeyeBusinessServiceImpl @Autowired private ShopTradeCartService shopTradeCartService; + private static Logger log = LoggerFactory.getLogger(ShopXxlJob.class); + @Override public void createPrepose(Order order) { // 订单编号 @@ -256,7 +261,9 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl public void createPostpose(Order order, String userId) { orderItemService.setValueAndCreateEntity(order, userId); couponUseService.updateState(order.getCouponUseId());// 更新用户领取的优惠券状态 + log.info("订单id:"+order.getId()+"创建定时任务-- 开始"); startUpTaskQuartz(order.getId(), order.getOddNumber(), DateUtil.getTimeAndToString()); + log.info("订单id:"+order.getId()+"创建定时任务-- 结束"); shopTradeCartService.deleteMySelect(userId); } @@ -473,6 +480,9 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl updateWrapper.set(MybatisPlusUtil.toColumns(Order::getCancelType), params.get("cancelType")); updateWrapper.set(MybatisPlusUtil.toColumns(Order::getCancelTime), DateUtil.getTimeAndToString()); update(updateWrapper); + log.info("订单id" + one.getId() + "取消订单--取消定时任务-- 开始"); + iQuartzService.stopAndDeleteTaskQuartz(one.getId());// 删除任务 + log.info("订单id" + one.getId() + "取消订单--取消定时任务-- 结束"); refreshCache(params.get("id").toString()); } else { throw new CustomException("订单不可取消"); @@ -530,7 +540,9 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl updateWrapper.set(MybatisPlusUtil.toColumns(Order::getExtensionNo), payOrderRespDTO.get("no").toString()); update(updateWrapper); refreshCache(id); + log.info("订单id" + one.getId() + "支付成功--删除定时任务-- 开始"); iQuartzService.stopAndDeleteTaskQuartz(id);// 删除定时任务 + log.info("订单id" + one.getId() + "支付成功--删除定时任务-- 结束"); } @Override diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/xxljob/ShopXxlJob.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/xxljob/ShopXxlJob.java index 44448b04..39aac077 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/xxljob/ShopXxlJob.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/xxljob/ShopXxlJob.java @@ -11,6 +11,8 @@ import com.skyeye.eve.service.IQuartzService; import com.skyeye.order.service.OrderService; import com.xxl.job.core.context.XxlJobHelper; import com.xxl.job.core.handler.annotation.XxlJob; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -39,16 +41,24 @@ public class ShopXxlJob { @Autowired private IQuartzService iQuartzService; + private static Logger log = LoggerFactory.getLogger(ShopXxlJob.class); + @XxlJob("setShopCouponStateService") public void setShopCouponStateService() { String param = XxlJobHelper.getJobParam(); Map paramMap = JSONUtil.toBean(param, null); String couponId = paramMap.get("objectId");// 优惠券id try { + log.info("优惠券id(couponId)" + couponId + "---修改优惠券的状态---开始"); couponService.setStateByCoupon(couponId);// 修改优惠券的状态 + log.info("优惠券id(couponId)" + couponId + "---修改优惠券的状态---结束"); + log.info("优惠券id(couponId)" + couponId + "---修改领取的优惠券的状态---开始"); couponUseService.setCouponUseStateByDate(couponId);// 修改领取的优惠券的状态 + log.info("优惠券id(couponId)" + couponId + "---修改领取的优惠券的状态---结束"); } finally { + log.info("优惠券id(couponId)" + couponId + "---删除任务---开始"); iQuartzService.stopAndDeleteTaskQuartz(couponId);// 删除任务 + log.info("优惠券id(couponId)" + couponId + "---删除任务---结束"); } } @@ -59,9 +69,13 @@ public class ShopXxlJob { String userId = paramMap.get("userId"); String couponUseId = paramMap.get("objectId");// 领取的优惠券id try { + log.info("领取优惠券的id(couponUseId)" + couponUseId + "---修改领取的优惠券的状态---开始"); couponUseService.setCouponUseStateByTerm(userId, couponUseId);// 修改领取的优惠券的状态} + log.info("领取优惠券的id(couponUseId)" + couponUseId + "---修改领取的优惠券的状态---结束"); } finally { + log.info("领取优惠券的id(couponUseId)" + couponUseId + "---删除任务---开始"); iQuartzService.stopAndDeleteTaskQuartz(couponUseId);// 删除任务 + log.info("领取优惠券的id(couponUseId)" + couponUseId + "---删除任务---结束"); } } @@ -71,9 +85,13 @@ public class ShopXxlJob { Map paramMap = JSONUtil.toBean(param, null); String orderId = paramMap.get("objectId");// 订单的主键id try { + log.info("订单的主键id(orderId)" + orderId + "---修改订单的状态为取消---开始"); orderService.setOrderCancle(orderId);// 修改订单的状态为取消 + log.info("订单的主键id(orderId)" + orderId + "---修改订单的状态为取消---结束"); } finally { + log.info("订单的主键id(orderId)" + orderId + "---删除任务---开始"); iQuartzService.stopAndDeleteTaskQuartz(orderId);// 删除任务 + log.info("订单的主键id(orderId)" + orderId + "---删除任务---结束"); } } } From c4abb9cebebb673e14e4141d7a429ac267e94ee7 Mon Sep 17 00:00:00 2001 From: weizhiqiang <598748873@qq.com> Date: Sat, 14 Dec 2024 19:56:52 +0800 Subject: [PATCH 7/9] =?UTF-8?q?feat:=20=E8=A7=A3=E5=86=B3=E6=9C=AA?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E7=94=A8=E6=88=B7=E8=8E=B7=E5=8F=96=E5=95=86?= =?UTF-8?q?=E5=93=81=E4=BC=98=E6=83=A0=E5=88=B8=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../skyeye/coupon/service/impl/CouponUseServiceImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 59d090bb..2da0f556 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 @@ -14,6 +14,7 @@ import com.skyeye.annotation.service.SkyeyeService; import com.skyeye.base.business.service.impl.SkyeyeBusinessServiceImpl; import com.skyeye.common.constans.CommonConstants; import com.skyeye.common.constans.QuartzConstants; +import com.skyeye.common.constans.SysUserAuthConstants; import com.skyeye.common.enumeration.WhetherEnum; import com.skyeye.common.object.GetUserToken; import com.skyeye.common.object.InputObject; @@ -148,7 +149,7 @@ public class CouponUseServiceImpl extends SkyeyeBusinessServiceImpl(); } + String userTokenUserId = GetUserToken.getUserTokenUserId(InputObject.getRequest()); + Boolean aBoolean = SysUserAuthConstants.exitUserLoginRedisCache(userTokenUserId); + if (!aBoolean) { + return new HashMap<>(); + } String userId = InputObject.getLogParamsStatic().get("id").toString(); QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.select(MybatisPlusUtil.toColumns(CouponUse::getCouponId), "count(id) as total"); From 3564a0f318c7ffa4ab8f4e0b833b1a8719e9a1df Mon Sep 17 00:00:00 2001 From: lqy <3431632001@qq,com> Date: Sat, 14 Dec 2024 20:18:15 +0800 Subject: [PATCH 8/9] =?UTF-8?q?feat:=E4=BF=AE=E6=94=B9=EF=BC=8CqueryMyCoup?= =?UTF-8?q?onUseByState?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/skyeye/coupon/service/impl/CouponUseServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e786376d..4841be99 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 @@ -204,7 +204,7 @@ public class CouponUseServiceImpl extends SkyeyeBusinessServiceImpl list = list(queryWrapper); couponService.setDataMation(list, CouponUse::getCouponId); List collect = list.stream().map(item -> { - item.setUsageCount(item.getUsedCount()); + item.setUsageCount(item.getCouponMation().getUseCount()); return item; }).collect(Collectors.toList()); return JSONUtil.toList(JSONUtil.toJsonStr(collect), null); From 0a871abf650b65de749269541df65f437ccbb0eb Mon Sep 17 00:00:00 2001 From: wst <2450473462@qq.com> Date: Sat, 14 Dec 2024 20:21:03 +0800 Subject: [PATCH 9/9] =?UTF-8?q?feat:=20=E8=8E=B7=E5=8F=96=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E5=85=B3=E8=81=94=E7=9A=84=E4=BC=98=E6=83=A0=E5=88=B8?= =?UTF-8?q?=E6=97=A0=E9=9C=80=E7=99=BB=E5=BD=95=E4=B9=9F=E5=8F=AF=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/skyeye/coupon/entity/Coupon.java | 10 +++------- .../coupon/service/impl/CouponServiceImpl.java | 14 +++++++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/entity/Coupon.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/entity/Coupon.java index f3da2350..cf603ae3 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/entity/Coupon.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/coupon/entity/Coupon.java @@ -35,13 +35,9 @@ import java.util.List; @ApiModel(value = "优惠券/模版信息管理实体类") public class Coupon extends BaseGeneralInfo { -// @TableField(value = "store_id_list") -// @ApiModelProperty(value = "发布门店id列表", required = "json") -// private List storeIdList; - - @TableField(value = "store_id") - @ApiModelProperty(value = "发布门店id列表") - private String storeId; + @TableField(value = "store_id_list") + @ApiModelProperty(value = "发布门店id列表", required = "json") + private List storeIdList; @TableField(value = "template_id") @ApiModelProperty(value = "模板id") 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 9adb4abb..d3d08bb3 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 @@ -23,6 +23,7 @@ import com.skyeye.common.util.mybatisplus.MybatisPlusUtil; import com.skyeye.coupon.dao.CouponDao; import com.skyeye.coupon.entity.Coupon; import com.skyeye.coupon.entity.CouponMaterial; +import com.skyeye.coupon.entity.CouponStore; import com.skyeye.coupon.enums.CouponValidityType; import com.skyeye.coupon.enums.PromotionDiscountType; import com.skyeye.coupon.enums.PromotionMaterialScope; @@ -136,9 +137,9 @@ public class CouponServiceImpl extends SkyeyeBusinessServiceImpl queryWrapper = new QueryWrapper<>(); String storeId = params.get("storeId").toString(); String type = params.get("type").toString(); - if (StrUtil.isNotEmpty(storeId)) { - queryWrapper.eq(MybatisPlusUtil.toColumns(Coupon::getStoreId), storeId); + List couponStoreList = couponStoreService.queryListByStoreId(storeId); + List couponIdList = couponStoreList.stream().map(CouponStore::getCouponId).distinct().collect(Collectors.toList()); + if(CollectionUtil.isEmpty(couponIdList)){ + return; } + queryWrapper.in(CommonConstants.ID, couponIdList); String typeKey = MybatisPlusUtil.toColumns(Coupon::getTemplateId); if (StrUtil.equals(type, CommonNumConstants.NUM_ZERO.toString())) { queryWrapper.and(wrapper -> {