From 9dbd0022110e36dbe58dcb8726ba1208459c773f Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Sat, 27 Sep 2025 09:57:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E4=BD=BF=E7=94=A8=E6=84=BF?= =?UTF-8?q?=E6=84=8F=20=E4=BC=98=E6=83=A0=E5=88=B8=20=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/czg/controller/admin/ACouponController.java | 4 ++-- .../czg/controller/user/UShopCouponController.java | 5 +++-- .../main/java/com/czg/account/vo/UserCouponVo.java | 1 + .../market/service/MkShopCouponRecordService.java | 2 +- .../com/czg/market/service/ShopCouponService.java | 2 +- .../market/mapper/MkShopCouponRecordMapper.java | 2 +- .../service/impl/MkShopCouponRecordServiceImpl.java | 4 ++-- .../market/service/impl/ShopCouponServiceImpl.java | 8 ++++++-- .../resources/mapper/MkShopCouponRecordMapper.xml | 13 ++++++++++--- 9 files changed, 27 insertions(+), 14 deletions(-) diff --git a/cash-api/market-server/src/main/java/com/czg/controller/admin/ACouponController.java b/cash-api/market-server/src/main/java/com/czg/controller/admin/ACouponController.java index 191fad62..a7bb4643 100644 --- a/cash-api/market-server/src/main/java/com/czg/controller/admin/ACouponController.java +++ b/cash-api/market-server/src/main/java/com/czg/controller/admin/ACouponController.java @@ -186,7 +186,7 @@ public class ACouponController { * @param shopUserId 店铺用户Id */ @GetMapping("/findCoupon") - public CzgResult> findCoupon(@RequestParam Long shopUserId, @RequestParam(required = false) Integer type) { - return CzgResult.success(shopCouponService.findCoupon(StpKit.USER.getShopId(), shopUserId, type)); + public CzgResult> findCoupon(@RequestParam Long shopUserId, @RequestParam(required = false) Integer type, @RequestParam(required = false) Integer isFood) { + return CzgResult.success(shopCouponService.findCoupon(StpKit.USER.getShopId(), shopUserId, type, isFood)); } } diff --git a/cash-api/market-server/src/main/java/com/czg/controller/user/UShopCouponController.java b/cash-api/market-server/src/main/java/com/czg/controller/user/UShopCouponController.java index a3528295..bf88cb86 100644 --- a/cash-api/market-server/src/main/java/com/czg/controller/user/UShopCouponController.java +++ b/cash-api/market-server/src/main/java/com/czg/controller/user/UShopCouponController.java @@ -83,8 +83,9 @@ public class UShopCouponController { * @param shopUserId 店铺用户Id */ @GetMapping("/findCoupon") - public CzgResult> findCoupon(@RequestHeader String shopId, @RequestParam Long shopUserId, @RequestParam(required = false) Integer type) { + public CzgResult> findCoupon(@RequestHeader String shopId, @RequestParam Long shopUserId, + @RequestParam(required = false) Integer type, @RequestParam(required = false) Integer isFood) { AssertUtil.isBlank(shopId, "店铺Id不能为空"); - return CzgResult.success(couponService.findCoupon(Long.parseLong(shopId), shopUserId, type)); + return CzgResult.success(couponService.findCoupon(Long.parseLong(shopId), shopUserId, type, isFood)); } } diff --git a/cash-common/cash-common-service/src/main/java/com/czg/account/vo/UserCouponVo.java b/cash-common/cash-common-service/src/main/java/com/czg/account/vo/UserCouponVo.java index d96d4842..4b54a112 100644 --- a/cash-common/cash-common-service/src/main/java/com/czg/account/vo/UserCouponVo.java +++ b/cash-common/cash-common-service/src/main/java/com/czg/account/vo/UserCouponVo.java @@ -33,6 +33,7 @@ public class UserCouponVo { private String useRule; private String ruleDetails; private String useRestrictions; + private String noUseRestrictions; private boolean isUse = false; /** * 优惠券门槛商品列表 diff --git a/cash-common/cash-common-service/src/main/java/com/czg/market/service/MkShopCouponRecordService.java b/cash-common/cash-common-service/src/main/java/com/czg/market/service/MkShopCouponRecordService.java index 074ead27..f357551f 100644 --- a/cash-common/cash-common-service/src/main/java/com/czg/market/service/MkShopCouponRecordService.java +++ b/cash-common/cash-common-service/src/main/java/com/czg/market/service/MkShopCouponRecordService.java @@ -26,7 +26,7 @@ public interface MkShopCouponRecordService extends IService List findByUser(String name, List shopUserIds, Integer status); - List queryByVipIdAndShopId(Long shopId, Long shopUserId, Integer type); + List queryByVipIdAndShopId(Long shopId, Long shopUserId, Integer type, Integer isFood); /** * 优惠券列表/已领取详情 diff --git a/cash-common/cash-common-service/src/main/java/com/czg/market/service/ShopCouponService.java b/cash-common/cash-common-service/src/main/java/com/czg/market/service/ShopCouponService.java index a9ac5047..cc8ac74b 100644 --- a/cash-common/cash-common-service/src/main/java/com/czg/market/service/ShopCouponService.java +++ b/cash-common/cash-common-service/src/main/java/com/czg/market/service/ShopCouponService.java @@ -35,7 +35,7 @@ public interface ShopCouponService extends IService { Page find(Long userId, String name, Long shopId, Integer status); - List findCoupon(Long shopId, Long shopUserId, Integer type); + List findCoupon(Long shopId, Long shopUserId, Integer type, Integer isFood); Boolean use(List ids, Long shopUserId, Long orderId); diff --git a/cash-service/market-service/src/main/java/com/czg/service/market/mapper/MkShopCouponRecordMapper.java b/cash-service/market-service/src/main/java/com/czg/service/market/mapper/MkShopCouponRecordMapper.java index e6fbd577..46c7d32e 100644 --- a/cash-service/market-service/src/main/java/com/czg/service/market/mapper/MkShopCouponRecordMapper.java +++ b/cash-service/market-service/src/main/java/com/czg/service/market/mapper/MkShopCouponRecordMapper.java @@ -23,7 +23,7 @@ public interface MkShopCouponRecordMapper extends BaseMapper List findCouponVOByUser(String name, List shopUserIds, Integer status); - List queryByVipIdAndShopId(Long shopId, Long shopUserId, Integer type); + List queryByVipIdAndShopId(Long shopId, Long shopUserId, Integer type, Integer isFood); List getShopByCouponRecord(Long userId); } diff --git a/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/MkShopCouponRecordServiceImpl.java b/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/MkShopCouponRecordServiceImpl.java index f77a638c..6262a098 100644 --- a/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/MkShopCouponRecordServiceImpl.java +++ b/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/MkShopCouponRecordServiceImpl.java @@ -72,8 +72,8 @@ public class MkShopCouponRecordServiceImpl extends ServiceImpl queryByVipIdAndShopId(Long shopId, Long shopUserId, Integer type) { - return getMapper().queryByVipIdAndShopId(shopId, shopUserId, type); + public List queryByVipIdAndShopId(Long shopId, Long shopUserId, Integer type, Integer isFood) { + return getMapper().queryByVipIdAndShopId(shopId, shopUserId, type, isFood); } diff --git a/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/ShopCouponServiceImpl.java b/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/ShopCouponServiceImpl.java index e8af5234..bbb53dbf 100644 --- a/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/ShopCouponServiceImpl.java +++ b/cash-service/market-service/src/main/java/com/czg/service/market/service/impl/ShopCouponServiceImpl.java @@ -284,8 +284,8 @@ public class ShopCouponServiceImpl extends ServiceImpl findCoupon(Long shopId, Long shopUserId, Integer type) { - List tbUserCouponVos = recordService.queryByVipIdAndShopId(shopId, shopUserId, type); + public List findCoupon(Long shopId, Long shopUserId, Integer type, Integer isFood) { + List tbUserCouponVos = recordService.queryByVipIdAndShopId(shopId, shopUserId, type, isFood); if (CollectionUtil.isNotEmpty(tbUserCouponVos)) { String week = DateUtil.dayOfWeekEnum(new Date()).toChinese("周"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss"); @@ -418,6 +418,7 @@ public class ShopCouponServiceImpl extends ServiceImpl and inRecord.shop_id = #{shopId} - - and inRecord.type = #{type} - + + + and inRecord.type = #{type} + + + + and inRecord.type != 2 + + + and inRecord.status = 0 and inRecord.use_start_time < now() and inRecord.use_end_time > now()