From ca8b33cca81de0b367afd284d479ecf9f0a6960f Mon Sep 17 00:00:00 2001 From: phpcjl <phpcjl@gmail.com> Date: 星期一, 16 十二月 2024 14:39:40 +0800 Subject: [PATCH] 1 --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java index f3a4385..50a1633 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java @@ -59,7 +59,7 @@ @GetMapping("/mine/list") - @ApiOperation(value = "已领取列表", tags = {"小程序-个人中心-优惠劵"}) + @ApiOperation(value = "已领取列表", tags = {"小程序-个人中心-优惠劵","后台管理-活动管理-优惠券管理"}) public R<Page<UserCoupon>> minelist(@RequestParam Integer pageNum, @RequestParam Integer pageSize, @ApiParam("1未使用2已使用3已过期") Integer status) { Long userid = tokenService.getLoginUserApplet().getUserid(); Page<UserCoupon> page = userCouponService.lambdaQuery() @@ -99,6 +99,11 @@ }else { record.setStatus(2); } + + + AppUser appUser = appUserService.getById(record.getAppUserId()); + record.setUserName(appUser.getName()); + record.setPhone(appUser.getPhone()); } return R.ok(page); } @@ -116,7 +121,7 @@ if (data==null){ return R.fail("当前优惠券不存在,请刷新后重试"); } - if (data.getSendType()!=1&&byId.getLavePoint().compareTo(data.getNeedPoint().intValue())==-1){ + if (data.getSendType()!=1&& byId.getLavePoint().compareTo(data.getNeedPoint().intValue()) < 0){ return R.fail("当前积分不足,兑换失败"); } //检验发放时间 @@ -141,8 +146,8 @@ UserCoupon userCoupon = new UserCoupon(); userCoupon.setAppUserId(userid); if (data.getPeriodType()==1) { - userCoupon.setStartTime(data.getPeriodStartTime()); - userCoupon.setEndTime(data.getPeriodEndTime()); + userCoupon.setStartTime(data.getPeriodStartTime().atTime(0,0,0)); + userCoupon.setEndTime(data.getPeriodEndTime().atTime(0,0,0)); }else { userCoupon.setStartTime(now); userCoupon.setEndTime(now.plusDays(data.getPeriodDays())); @@ -183,5 +188,13 @@ BeanUtils.copyProperties(data, couponInfoVo); return R.ok(couponInfoVo); } + + /** + * 获取优惠券发放数量 + */ + @GetMapping("/getCouponCount") + public R<Long> getCouponCount(@RequestParam Integer couponId){ + return R.ok(userCouponService.lambdaQuery().eq(UserCoupon::getCouponId, couponId).count()); + } } -- Gitblit v1.7.1