mitao
2024-09-21 f44e4d609e7efaed9eac545137970b1e334f8106
ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsSeckillServiceImpl.java
@@ -16,6 +16,7 @@
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.page.BeanUtils;
import com.ruoyi.common.core.utils.page.CollUtils;
import com.ruoyi.common.core.utils.page.PageDTO;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.goods.controller.management.dto.GoodsSeckillDTO;
@@ -409,7 +410,9 @@
        Set<Long> goodsSkuIdList = null;
        goodsSkuIdList = page1.stream().map(GoodsSku::getId)
                .collect(Collectors.toSet());
        if (CollUtils.isEmpty(goodsSkuIdList)) {
            return PageDTO.empty(0L, 0L);
        }
        Page<GoodsSeckill> page = new Page<>();
        page.setSize(homeGoodsSkuDTO.getPageSize());
        page.setCurrent(homeGoodsSkuDTO.getPageCurr());
@@ -473,6 +476,16 @@
        homeGoodsSeckillInfoVO.setCoverPic(data6.getCoverPic());
        homeGoodsSeckillInfoVO.setAlbum(data6.getAlbum());
        homeGoodsSeckillInfoVO.setShareTitle(byId.getShareTitle());
        if (StringUtils.isNotBlank(byId.getShareTitle())) {
            homeGoodsSeckillInfoVO.setShareTitle(byId.getShareTitle());
        } else {
            homeGoodsSeckillInfoVO.setShareTitle(data6.getSkuName());
        }
        if (StringUtils.isNotBlank(byId.getSharePic())) {
            homeGoodsSeckillInfoVO.setSharePic(byId.getSharePic());
        } else {
            homeGoodsSeckillInfoVO.setSharePic(data6.getCoverPic());
        }
        homeGoodsSeckillInfoVO.setSeckillPrice(byId.getSeckillPrice());
        homeGoodsSeckillInfoVO.setDescription(data6.getDescription());
        homeGoodsSeckillInfoVO.setDetail(data6.getDetail());
@@ -509,4 +522,26 @@
        return homeGoodsSeckillInfoVO;
    }
    /**
     * 结束异常的秒杀
     */
    @Override
    public void updSeckillStatus() {
        baseMapper.updSeckillStatus();
    }
    /**
     * 根据秒杀id集合查询商品sku信息
     *
     * @param seckillIdSet
     * @return
     */
    @Override
    public List<GoodsSku> getGoodsSkuBySeckillIdSet(Set<Long> seckillIdSet) {
        List<GoodsSeckill> goodsSeckills = this.listByIds(seckillIdSet);
        List<Long> goodsSkuIdList = goodsSeckills.stream().map(GoodsSeckill::getGoodsSkuId)
                .collect(Collectors.toList());
        return goodsSkuService.listByIds(goodsSkuIdList);
    }
}