| | |
| | | import com.ruoyi.other.api.vo.GetSeckillActivityInfo; |
| | | import com.ruoyi.other.mapper.SeckillActivityInfoMapper; |
| | | import com.ruoyi.other.service.GoodsSeckillService; |
| | | import com.ruoyi.other.service.GoodsService; |
| | | import com.ruoyi.other.service.SeckillActivityInfoService; |
| | | import com.ruoyi.other.vo.SeckillActivityDetailVO; |
| | | import com.ruoyi.other.vo.SeckillActivityVO; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneOffset; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private SeckillActivityInfoMapper seckillActivityInfoMapper; |
| | | |
| | | @Resource |
| | | private GoodsService goodsService; |
| | | |
| | | |
| | | |
| | |
| | | Goods goods) |
| | | { |
| | | IPage<SeckillActivityVO> IPage = seckillActivityInfoMapper.querySeckillActivity(Page.of(pageNum, pageSize), goods); |
| | | for (SeckillActivityVO record : IPage.getRecords()) { |
| | | LocalDateTime startTime = record.getStartTime(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime endTime = record.getEndTime(); |
| | | if (endTime.isBefore(now)){ |
| | | record.setStatus(3); //已结束 |
| | | }else if (startTime.isBefore(now)){ |
| | | record.setStatus(2); // 已开始 |
| | | }else { |
| | | record.setStatus(1); // 未开始 |
| | | } |
| | | } |
| | | return R.ok(IPage); |
| | | } |
| | | |
| | |
| | | List<GoodsSeckill> goodsSeckills = goodsSeckillService.list(new LambdaQueryWrapper<GoodsSeckill>() |
| | | .eq(GoodsSeckill::getSeckillActivityInfoId, id)); |
| | | seckillActivityInfo.setGoodsSeckills(goodsSeckills); |
| | | Integer goodId = seckillActivityInfo.getGoodId(); |
| | | Goods goods = goodsService.getById(goodId); |
| | | seckillActivityInfo.setGoods(goods); |
| | | return R.ok(seckillActivityInfo); |
| | | } |
| | | |