From 99a62c66f518fec796844d072d4abb2d9eeba5f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=85=95=E4=B8=8B?= <484014559@qq.com> Date: Thu, 19 Sep 2024 17:50:41 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=8D=E8=8D=89=E7=A4=BE=E5=8C=BA=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=BC=98=E5=8C=96=EF=BC=8C=E8=90=A5=E9=94=80=E5=95=86?= =?UTF-8?q?=E5=93=81bug=E4=BF=AE=E5=A4=8D=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E8=90=A5=E9=94=80=E6=B4=BB=E5=8A=A8=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=96=B9=E6=B3=95=EF=BC=8C=E5=85=B3=E9=97=AD=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E6=96=87=E6=A1=A3=E5=9C=B0=E5=9D=80=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-admin-vue3/.env | 2 +- .../app/circle/AppCircleController.java | 20 ++++++++++++++++++- .../reward/RewardActivityServiceImpl.java | 3 ++- .../module/promotion/util/PromotionUtils.java | 15 ++++++++++++++ 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/yudao-admin-vue3/.env b/yudao-admin-vue3/.env index c18e52e..5109f33 100644 --- a/yudao-admin-vue3/.env +++ b/yudao-admin-vue3/.env @@ -14,7 +14,7 @@ VITE_APP_TENANT_ENABLE=true VITE_APP_CAPTCHA_ENABLE=true # 文档地址的开关 -VITE_APP_DOCALERT_ENABLE=true +VITE_APP_DOCALERT_ENABLE=false # 百度统计 VITE_APP_BAIDU_CODE = a1ff8825baa73c3a78eb96aa40325abc diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/circle/AppCircleController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/circle/AppCircleController.java index 5117514..1faf0a5 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/circle/AppCircleController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/circle/AppCircleController.java @@ -23,6 +23,7 @@ import javax.validation.Valid; import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.getLoginUserId; @Tag(name = "用户 APP - 商城动态") // 用于提供跨多个活动的 HTTP 接口 @RestController @@ -77,12 +78,29 @@ public class AppCircleController { return success(true); } - @GetMapping("/doReview") + @PostMapping("/doReview") @Operation(summary = "评论/回复") @PreAuthenticated public CommonResult doReview(@RequestBody CircleReviewSaveReqVO createReqVO){ + createReqVO.setUserId(getLoginUserId()); circleReviewService.createCircleReview(createReqVO); return success(true); } + @GetMapping("/doReviewDelete") + @Operation(summary = "删除评论") + @PreAuthenticated + public CommonResult doReviewDelete(@RequestParam("id") Long lookId){ + circleReviewService.deleteCircleReview(lookId); + return success(true); + } + + @GetMapping("/doCircleDelete") + @Operation(summary = "删除动态") + @PreAuthenticated + public CommonResult doCircleDelete(@RequestParam("id") Long lookId){ + circleService.deleteCircle(lookId); + return success(true); + } + } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/reward/RewardActivityServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/reward/RewardActivityServiceImpl.java index b7884c7..2305ccd 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/reward/RewardActivityServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/reward/RewardActivityServiceImpl.java @@ -44,7 +44,8 @@ public class RewardActivityServiceImpl implements RewardActivityService { // 插入 RewardActivityDO rewardActivity = RewardActivityConvert.INSTANCE.convert(createReqVO) - .setStatus(PromotionUtils.calculateActivityStatus(createReqVO.getEndTime())); + .setStatus(PromotionUtils.calculateRewardActivityStatus(createReqVO.getStartTime(), + createReqVO.getEndTime())); rewardActivityMapper.insert(rewardActivity); // 返回 return rewardActivity.getId(); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/util/PromotionUtils.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/util/PromotionUtils.java index 2ad362f..84903cb 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/util/PromotionUtils.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/util/PromotionUtils.java @@ -2,8 +2,10 @@ package cn.iocoder.yudao.module.promotion.util; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; +import cn.iocoder.yudao.module.promotion.enums.common.PromotionActivityStatusEnum; import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; /** * 活动工具类 @@ -22,4 +24,17 @@ public class PromotionUtils { return LocalDateTimeUtils.beforeNow(endTime) ? CommonStatusEnum.DISABLE.getStatus() : CommonStatusEnum.ENABLE.getStatus(); } + public static Integer calculateRewardActivityStatus(LocalDateTime starTime, LocalDateTime endTime) { + if (LocalDateTimeUtils.afterNow(starTime)){ + return PromotionActivityStatusEnum.WAIT.getStatus(); + } + if (LocalDateTimeUtils.beforeNow(starTime) && LocalDateTimeUtils.afterNow(endTime)){ + return PromotionActivityStatusEnum.RUN.getStatus(); + } + if (LocalDateTimeUtils.beforeNow(endTime)){ + return PromotionActivityStatusEnum.END.getStatus(); + } + return PromotionActivityStatusEnum.CLOSE.getStatus(); + } + }