| | |
| | | @PostMapping("/save") |
| | | @ApiOperation(value = "订单优惠活动-添加活动", tags = {"管理后台-活动管理"}) |
| | | public R<Void> saveActivityConfig(@RequestBody OrderActivityInfo orderActivityInfo){ |
| | | orderActivityInfo.setIsShelf(0); |
| | | orderActivityInfoService.save(orderActivityInfo); |
| | | return R.ok(); |
| | | } |
| | |
| | | @PostMapping("/update") |
| | | @ApiOperation(value = "修改活动", tags = {"管理后台-活动管理-订单优惠活动"}) |
| | | public R<Void> updateActivityConfig(@RequestBody OrderActivityInfo orderActivityInfo){ |
| | | orderActivityInfo.setId(Long.valueOf(orderActivityInfo.getIdStr())); |
| | | orderActivityInfoService.updateById(orderActivityInfo); |
| | | return R.ok(); |
| | | } |
| | |
| | | .eq(orderActivityInfo.getIsShelf() != null, OrderActivityInfo::getIsShelf, orderActivityInfo.getIsShelf())); |
| | | page.getRecords().forEach(item -> { |
| | | LocalDateTime startTime = item.getStartTime(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime endTime = item.getEndTime(); |
| | | if (endTime.isBefore(now)){ |
| | | item.setStatus(2); //已结束 |
| | | }else if (startTime.isBefore(now)){ |
| | | item.setStatus(1); // 已开始 |
| | | }else { |
| | | item.setStatus(0); // 未开始 |
| | | } |
| | | }); |
| | | return R.ok(page); |
| | | } |
| | |
| | | */ |
| | | @GetMapping("/getDetailById") |
| | | @ApiOperation(value = "订单优惠活动-获取活动详情", tags = {"管理后台-活动管理"}) |
| | | public R<OrderActivityInfo> getDetailById(@RequestParam("id") Long id){ |
| | | return R.ok(orderActivityInfoService.getById(id)); |
| | | public R<OrderActivityInfo> getDetailById(@RequestParam("id") String id){ |
| | | return R.ok(orderActivityInfoService.getById(Long.parseLong(id))); |
| | | } |
| | | |
| | | |