From cd2781c1edd9b8b9fd3fd8b6365a65c07adcb109 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期四, 02 一月 2025 16:42:34 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/qijisheng
---
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java
index 26e2585..f2872c6 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java
@@ -25,6 +25,7 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
+import java.time.LocalDate;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@@ -74,11 +75,11 @@
@ApiOperation(value = "优惠劵管理-详情", tags = {"管理后台-活动管理"})
public R<CouponInfo> detail(@RequestParam("id") Integer id) {
CouponInfo byId = couponInfoService.getById(id);
- byId.setGoodsNameList(JSON.parseArray(byId.getGoodsNameJson(), String.class));
String forGoodIds = byId.getForGoodIds();
- if (StringUtils.isNotEmpty(forGoodIds)){
+ if (!"-1".equals(forGoodIds) && StringUtils.isNotEmpty(forGoodIds)){
List<Goods> goods = goodsService.listByIds(Arrays.asList(forGoodIds.split(",")));
byId.setGoods(goods);
+ byId.setGoodsNameList(goods.stream().map(Goods::getName).collect(Collectors.toList()));
}
String personIds = byId.getPersonIds();
if (StringUtils.isNotEmpty(personIds)){
@@ -104,6 +105,11 @@
public R<Void> edit(@RequestBody CouponInfo couponInfo) {
List<String> goodsNameList = couponInfo.getGoodsNameList();
couponInfo.setGoodsNameJson(JSON.toJSONString(goodsNameList));
+ if(couponInfo.getPeriodType() == 2){
+ Integer periodDays = couponInfo.getPeriodDays();
+ couponInfo.setPeriodStartTime(LocalDate.now());
+ couponInfo.setPeriodEndTime(LocalDate.now().plusDays(periodDays));
+ }
couponInfoService.updateById(couponInfo);
return R.ok();
}
@@ -127,6 +133,12 @@
couponInfo.setShelfStatus(0);
List<String> goodsNameList = couponInfo.getGoodsNameList();
couponInfo.setGoodsNameJson(JSON.toJSONString(goodsNameList));
+ couponInfo.setShelfStatus(1);
+ if(couponInfo.getPeriodType() == 2){
+ Integer periodDays = couponInfo.getPeriodDays();
+ couponInfo.setPeriodStartTime(LocalDate.now());
+ couponInfo.setPeriodEndTime(LocalDate.now().plusDays(periodDays));
+ }
couponInfoService.save(couponInfo);
return R.ok();
}
@@ -187,6 +199,7 @@
@GetMapping("/getReceiveRecord")
public R<IPage<UserCoupon>> getReceiveRecord(@ApiParam("页码") @RequestParam Integer pageNum, @ApiParam("大小") Integer pageSize,UserCoupon userCoupon) {
+ // TODO 待完善
return null;
}
--
Gitblit v1.7.1