| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.feignClient.UserCouponClient; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @Resource |
| | | private UserCouponClient userCouponClient; |
| | | |
| | | @PostMapping("/list") |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "优惠劵管理-列表", tags = {"管理后台-活动管理"}) |
| | | public R<IPage<CouponInfo>> list(@RequestParam("pageNum") Integer pageNum, |
| | | @RequestParam("pageSize") Integer pageSize, |
| | | CouponInfo couponInfo) { |
| | | return R.ok(couponInfoService.queryCouponInfoPage(Page.of(pageNum, pageSize), couponInfo)); |
| | | IPage<CouponInfo> couponInfoIPage = couponInfoService.queryCouponInfoPage(Page.of(pageNum, pageSize), couponInfo); |
| | | for (CouponInfo record : couponInfoIPage.getRecords()) { |
| | | R<Long> r = userCouponClient.getCouponCount(record.getId()); |
| | | record.setSendNumNow(r.getData()); |
| | | } |
| | | return R.ok(couponInfoIPage); |
| | | } |
| | | |
| | | |
| | | //查看详情 |
| | | @PostMapping("/detail") |
| | | @GetMapping("/detail") |
| | | @ApiOperation(value = "优惠劵管理-详情", tags = {"管理后台-活动管理"}) |
| | | public R<CouponInfo> detail(@RequestParam("id") Integer id) { |
| | | CouponInfo byId = couponInfoService.getById(id); |
| | |
| | | } |
| | | |
| | | // 删除优惠劵 |
| | | @PostMapping("/delete") |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation(value = "优惠劵管理-删除", tags = {"管理后台-活动管理"}) |
| | | public R<Void> delete(@RequestParam("id") Integer id) { |
| | | couponInfoService.removeById(id); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | // 添加优惠券 |
| | | @PostMapping("/add") |
| | | @ApiOperation(value = "优惠劵管理-添加", tags = {"管理后台-活动管理"}) |
| | | public R<Void> add(@RequestBody CouponInfo couponInfo) { |
| | | couponInfo.setShelfStatus(0); |
| | | couponInfoService.save(couponInfo); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |