From 665603704ba4a9ebb7d88f09326825c71a371738 Mon Sep 17 00:00:00 2001 From: YoVinchen Date: Tue, 17 Mar 2026 00:19:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=81=E8=AE=B8=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=B8=AD=E7=9A=84=E6=8B=BC=E5=9B=A2/?= =?UTF-8?q?=E7=A7=92=E6=9D=80=E6=B4=BB=E5=8A=A8=E5=8F=8A=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=88=90=E5=9B=A2=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除拼团活动"进行中不能修改"限制 - 编辑拼团/秒杀时不再限制开始时间必须晚于当前 - 编辑时日期选择器不禁用过去日期 - 修复JPA缓存导致成团检测失效的问题(clearAutomatically) --- flash-sale-frontend/src/pages/admin/flashsales.vue | 8 +++++--- flash-sale-frontend/src/pages/admin/groupbuying.vue | 8 +++++--- .../repository/GroupBuyingGroupRepository.java | 4 ++-- .../org/flashsalesystem/service/GroupBuyingService.java | 4 ---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/flash-sale-frontend/src/pages/admin/flashsales.vue b/flash-sale-frontend/src/pages/admin/flashsales.vue index dc62d10..eda6dfe 100644 --- a/flash-sale-frontend/src/pages/admin/flashsales.vue +++ b/flash-sale-frontend/src/pages/admin/flashsales.vue @@ -275,10 +275,12 @@ const getStockRate = (item: FlashSale) => { return Math.round((item.remainingStock / item.flashStock) * 100) } -const disablePastDate = (date: Date) => dayjs(date).endOf('day').isBefore(dayjs()) +const disablePastDate = (date: Date) => { + if (formMode.value === 'edit') return false + return dayjs(date).endOf('day').isBefore(dayjs()) +} const validateTimeRange = () => { - const now = dayjs() const startTime = dayjs(form.startTime) const endTime = dayjs(form.endTime) @@ -287,7 +289,7 @@ const validateTimeRange = () => { return false } - if (!startTime.isAfter(now)) { + if (formMode.value === 'create' && !startTime.isAfter(dayjs())) { ElMessage.error('开始时间必须晚于当前时间') return false } diff --git a/flash-sale-frontend/src/pages/admin/groupbuying.vue b/flash-sale-frontend/src/pages/admin/groupbuying.vue index 8c89c43..4056918 100644 --- a/flash-sale-frontend/src/pages/admin/groupbuying.vue +++ b/flash-sale-frontend/src/pages/admin/groupbuying.vue @@ -235,10 +235,12 @@ const getStatusType = (status: string) => { } } -const disablePastDate = (date: Date) => dayjs(date).endOf('day').isBefore(dayjs()) +const disablePastDate = (date: Date) => { + if (editingId.value) return false + return dayjs(date).endOf('day').isBefore(dayjs()) +} const validateTimeRange = () => { - const now = dayjs() const startTime = dayjs(form.startTime) const endTime = dayjs(form.endTime) @@ -247,7 +249,7 @@ const validateTimeRange = () => { return false } - if (!startTime.isAfter(now)) { + if (!editingId.value && !startTime.isAfter(dayjs())) { ElMessage.error('开始时间必须晚于当前时间') return false } diff --git a/src/main/java/com/org/flashsalesystem/repository/GroupBuyingGroupRepository.java b/src/main/java/com/org/flashsalesystem/repository/GroupBuyingGroupRepository.java index 2da8398..5f07cc0 100644 --- a/src/main/java/com/org/flashsalesystem/repository/GroupBuyingGroupRepository.java +++ b/src/main/java/com/org/flashsalesystem/repository/GroupBuyingGroupRepository.java @@ -33,11 +33,11 @@ public interface GroupBuyingGroupRepository extends JpaRepository 0") int decrementCurrentMembers(@Param("id") Long id); diff --git a/src/main/java/com/org/flashsalesystem/service/GroupBuyingService.java b/src/main/java/com/org/flashsalesystem/service/GroupBuyingService.java index 73ce462..3b81a16 100644 --- a/src/main/java/com/org/flashsalesystem/service/GroupBuyingService.java +++ b/src/main/java/com/org/flashsalesystem/service/GroupBuyingService.java @@ -109,10 +109,6 @@ public class GroupBuyingService { GroupBuying gb = groupBuyingRepository.findById(id) .orElseThrow(() -> new RuntimeException("拼团活动不存在")); - if (gb.getStatus() == 2) { - throw new RuntimeException("进行中的活动不能修改"); - } - if (updateDTO.getProductId() != null) gb.setProductId(updateDTO.getProductId()); if (updateDTO.getGroupPrice() != null) gb.setGroupPrice(updateDTO.getGroupPrice()); if (updateDTO.getRequiredMembers() != null) gb.setRequiredMembers(updateDTO.getRequiredMembers());