| | |
| | | package com.ruoyi.goods.service.impl; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | |
| | | import com.ruoyi.system.api.domain.GoodsSeckill; |
| | | import com.ruoyi.system.api.domain.GoodsSku; |
| | | import com.ruoyi.system.api.domain.dto.GoodsStockUpdDTO; |
| | | import com.ruoyi.system.api.domain.dto.HomeGoodsSkuDTO; |
| | | import com.ruoyi.system.api.domain.dto.ListStatusDTO; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.ruoyi.system.api.domain.vo.AuctionGoodsListVO; |
| | | import com.ruoyi.system.api.domain.vo.HomeGoodsSkuListVO; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.redisson.api.RLock; |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public PageDTO<HomeGoodsSkuListVO> getHomeGoodsSkuVOList(HomeGoodsSkuDTO homeGoodsSkuDTO) { |
| | | Page<GoodsSku> page = new Page<>(); |
| | | page.setSize(homeGoodsSkuDTO.getPageSize()); |
| | | page.setCurrent(homeGoodsSkuDTO.getPageCurr()); |
| | | |
| | | LambdaQueryWrapper<GoodsSku> wrapper3= Wrappers.lambdaQuery(); |
| | | wrapper3.eq(GoodsSku::getDelFlag,0); |
| | | wrapper3.like(GoodsSku::getSkuName,homeGoodsSkuDTO.getSkuName()); |
| | | wrapper3.eq(GoodsSku::getSkuName,homeGoodsSkuDTO.getSkuName()); |
| | | wrapper3.eq(GoodsSku::getBrandId,homeGoodsSkuDTO.getBrandId()); |
| | | wrapper3.eq(GoodsSku::getCategoryId,homeGoodsSkuDTO.getCategoryId()); |
| | | wrapper3.eq(GoodsSku::getSeriesId,homeGoodsSkuDTO.getSeriesId()); |
| | | wrapper3.eq(GoodsSku::getFlavorTypeId,homeGoodsSkuDTO.getFlavorTypeId()); |
| | | if (homeGoodsSkuDTO.getSort()==2){ |
| | | wrapper3.orderByAsc(GoodsSku::getPrice); |
| | | } |
| | | if (homeGoodsSkuDTO.getSort()==3){ |
| | | wrapper3.orderByDesc(GoodsSku::getPrice); |
| | | } |
| | | if (homeGoodsSkuDTO.getSort()==4){ |
| | | wrapper3.orderByAsc(GoodsSku::getSoldQuantity); |
| | | } |
| | | if (homeGoodsSkuDTO.getSort()==5){ |
| | | wrapper3.orderByDesc(GoodsSku::getSoldQuantity); |
| | | } |
| | | Page<GoodsSku> page1 = this.page(page, wrapper3); |
| | | PageDTO<HomeGoodsSkuListVO> articleCommentsVOPageDTO = PageDTO.of(page1, HomeGoodsSkuListVO.class); |
| | | return articleCommentsVOPageDTO; |
| | | |
| | | } |
| | | |
| | | private boolean updateGoodsStock(GoodsSku skus, Integer auctionStock) { |
| | | return this.lambdaUpdate() |
| | | .set(skus.getStock() + auctionStock > 0, GoodsSku::getStock, |