| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.uuid.IdUtils; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.goods.api.domain.LotteryEvent; |
| | | import com.ruoyi.goods.api.domain.LotteryEventPrize; |
| | | import com.ruoyi.goods.api.domain.TLotteryEvent; |
| | | import com.ruoyi.goods.api.domain.TLotteryEventPrize; |
| | | import com.ruoyi.goods.domain.dto.DelShopLotteryDrawDto; |
| | | import com.ruoyi.goods.domain.dto.ShopLotteryDrawListDto; |
| | | import com.ruoyi.goods.domain.dto.ShopWinningRecordDto; |
| | |
| | | @RequestMapping(value = "/delShopLotteryDraw", method = RequestMethod.POST) |
| | | @ApiOperation(value = "门店删除抽奖活动【2.0】") |
| | | public R delShopLotteryDraw(@RequestBody DelShopLotteryDrawDto dto) { |
| | | LotteryEvent lotteryEvent = lotteryEventService.getById(dto.getId()); |
| | | TLotteryEvent lotteryEvent = lotteryEventService.getById(dto.getId()); |
| | | if (null == lotteryEvent) { |
| | | return R.fail("抽奖活动不存在"); |
| | | } |
| | |
| | | |
| | | @RequestMapping(value = "/getShopLotteryDrawInfo", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取门店抽奖详情【2.0】") |
| | | public R<LotteryEvent> getShopLotteryDrawInfo(@RequestBody DelShopLotteryDrawDto dto) { |
| | | LotteryEvent lotteryEvent = lotteryEventService.getById(dto.getId()); |
| | | public R<TLotteryEvent> getShopLotteryDrawInfo(@RequestBody DelShopLotteryDrawDto dto) { |
| | | TLotteryEvent lotteryEvent = lotteryEventService.getById(dto.getId()); |
| | | if (null == lotteryEvent) { |
| | | return R.fail("抽奖活动不存在"); |
| | | } |
| | | if (!lotteryEvent.getShopId().equals(dto.getShopId())) { |
| | | return R.fail("查询失败"); |
| | | } |
| | | List<LotteryEventPrize> list = lotteryEventPrizeService.list(new LambdaQueryWrapper<LotteryEventPrize>().eq(LotteryEventPrize::getLotteryEventId, dto.getId())); |
| | | List<TLotteryEventPrize> list = lotteryEventPrizeService.list(new LambdaQueryWrapper<TLotteryEventPrize>().eq(TLotteryEventPrize::getLotteryEventId, dto.getId())); |
| | | lotteryEvent.setPrizes(list); |
| | | return R.ok(lotteryEvent); |
| | | } |
| | |
| | | |
| | | @RequestMapping(value = "/editShopLotteryDraw", method = RequestMethod.POST) |
| | | @ApiOperation(value = "保存门店抽奖【2.0】") |
| | | public R editShopLotteryDraw(@RequestBody LotteryEvent lotteryEvent) { |
| | | public R editShopLotteryDraw(@RequestBody TLotteryEvent lotteryEvent) { |
| | | if (lotteryEvent.getId() == null) { |
| | | lotteryEvent.setId(IdUtils.simpleUUID()); |
| | | } |
| | |
| | | lotteryEvent.setUpdateUserId(SecurityUtils.getUserId()); |
| | | lotteryEventService.saveOrUpdate(lotteryEvent); |
| | | //先删除原有的奖品 |
| | | lotteryEventPrizeService.remove(new LambdaQueryWrapper<LotteryEventPrize>().eq(LotteryEventPrize::getLotteryEventId, lotteryEvent.getId())); |
| | | lotteryEventPrizeService.remove(new LambdaQueryWrapper<TLotteryEventPrize>().eq(TLotteryEventPrize::getLotteryEventId, lotteryEvent.getId())); |
| | | //添加新的奖品 |
| | | List<LotteryEventPrize> prizes = lotteryEvent.getPrizes(); |
| | | List<TLotteryEventPrize> prizes = lotteryEvent.getPrizes(); |
| | | prizes.forEach(s -> { |
| | | s.setId(IdUtils.simpleUUID()); |
| | | if (s.getPrizeType() == 2 && StringUtils.isEmpty(s.getObjectName())) { |
| | |
| | | @RequestMapping(value = "/getShopWinningRecord", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取中奖记录列表【2.0】") |
| | | public R<Page<ShopWinningRecordVo>> getShopWinningRecord(@RequestBody ShopWinningRecordDto dto) { |
| | | LotteryEvent lotteryEvent = lotteryEventService.getById(dto.getId()); |
| | | TLotteryEvent lotteryEvent = lotteryEventService.getById(dto.getId()); |
| | | if (null == lotteryEvent) { |
| | | return R.fail("抽奖活动不存在"); |
| | | } |