| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.order.feignClient.OrderClient; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.api.domain.GoodsSeckill; |
| | | import com.ruoyi.other.api.domain.SeckillActivityInfo; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneOffset; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | @Resource |
| | | private GoodsService goodsService; |
| | | |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | |
| | | |
| | | |
| | |
| | | * 秒杀活动列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "秒杀活动列表",tags = {"小程序-商城-首页","后台管理-活动管理-秒杀活动"}) |
| | | @ApiOperation(value = "秒杀活动列表",tags = {"小程序-商城-首页"}) |
| | | public R<TableDataInfo> list(Goods goods) |
| | | { |
| | | return R.ok(getDataTable(seckillActivityInfoService.listSeckillActivity(goods))); |
| | | return R.ok(seckillActivityInfoService.listSeckillActivity(goods)); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | GoodsSeckill goodsSeckill = goodsSeckillService.getOne(new LambdaQueryWrapper<GoodsSeckill>().eq(GoodsSeckill::getSeckillActivityInfoId, one.getId()).eq(GoodsSeckill::getVip, info.getVip())); |
| | | if(null != goodsSeckill){ |
| | | goodsSeckill.setEndTime(one.getEndTime().toEpochSecond(ZoneOffset.UTC) * 1000); |
| | | LocalDateTime endTime = one.getEndTime(); |
| | | // 转时间戳 |
| | | long timeStamp = endTime.toInstant(ZoneOffset.of("+8")).toEpochMilli(); |
| | | goodsSeckill.setEndTime(timeStamp); |
| | | } |
| | | return R.ok(goodsSeckill); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | * 秒杀活动列表 |
| | | */ |
| | | @GetMapping("/manageList") |
| | | @ApiOperation(value = "秒杀活动列表",tags = {"小程序-商城-首页","后台管理-活动管理-秒杀活动"}) |
| | | @ApiOperation(value = "秒杀活动列表",tags = {"后台管理-活动管理-秒杀活动"}) |
| | | public R<IPage<SeckillActivityVO>> manageList(@ApiParam("页码") @RequestParam Integer pageNum, |
| | | @ApiParam("每一页数据大小") Integer pageSize, |
| | | Goods goods) |
| | |
| | | }else { |
| | | record.setStatus(1); // 未开始 |
| | | } |
| | | Integer saleNum = orderClient.getGoodsSaleNum(record.getGoodsId(), 2).getData(); |
| | | record.setSaleNum(saleNum); |
| | | } |
| | | return R.ok(IPage); |
| | | } |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @GetMapping("/getSeckillActivityInfoByGoodsId") |
| | | public R<SeckillActivityInfo> getSeckillActivityInfoByGoodsId(@RequestParam("goodsId") Integer goodsId){ |
| | | SeckillActivityInfo seckillActivityInfo = seckillActivityInfoService.getOne(new LambdaQueryWrapper<SeckillActivityInfo>() |
| | | .eq(SeckillActivityInfo::getGoodId, goodsId) |
| | | .eq(SeckillActivityInfo::getDelFlag, 0) |
| | | .eq(SeckillActivityInfo::getIsShelves, 1) |
| | | .last(" and now() between start_time and end_time")); |
| | | return R.ok(seckillActivityInfo); |
| | | } |
| | | |
| | | /** |
| | | * 修改秒杀活动 |
| | | */ |