luodangjia
2025-01-15 a9bd63ec999704d57bcde0a116e5942eddbed289
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.AppUser;
@@ -14,6 +15,7 @@
import com.ruoyi.other.mapper.GoodsShopMapper;
import com.ruoyi.other.mapper.SeckillActivityInfoMapper;
import com.ruoyi.other.mapper.ShopMapper;
import com.ruoyi.other.service.GoodsEvaluateService;
import com.ruoyi.other.service.GoodsSeckillService;
import com.ruoyi.other.service.GoodsService;
import com.ruoyi.other.service.SeckillActivityInfoService;
@@ -30,6 +32,8 @@
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import static com.ruoyi.common.core.utils.PageUtils.startPage;
/**
 * <p>
@@ -57,12 +61,15 @@
    private GoodsService goodsService;
    @Resource
    private OrderClient orderClient;
    @Resource
    private GoodsEvaluateService goodsEvaluateService;
    @Override
    public List<SeckillActivityVO> listSeckillActivity(Goods goods) {
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        AppUser appUser = appUserClient.getAppUserById(loginUserApplet.getUserid());
        goods.setVipId(appUser.getVipId());
        startPage();
        List<SeckillActivityVO> seckillActivityVOS = seckillActivityInfoMapper.listSeckillActivity(goods);
        for (SeckillActivityVO seckillActivityVO : seckillActivityVOS) {
            Integer data = orderClient.getGoodsSaleNum(seckillActivityVO.getGoodsId(), 2).getData();
@@ -131,6 +138,17 @@
        seckillActivityDetailVO.setShopList(shops);
        Integer integer = orderClient.getGoodsSaleNum(goods.getId(), 2).getData();
        seckillActivityDetailVO.setSaleNum(integer);
        GoodsEvaluate goodsEvaluate = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).isNotNull(GoodsEvaluate::getComment).ne(GoodsEvaluate::getComment, "")
                .orderByDesc(GoodsEvaluate::getGrade).eq(GoodsEvaluate::getStatus, 2).eq(GoodsEvaluate::getDelFlag, 0).last(" limit 0, 1").one();
        if (null != goodsEvaluate) {
            AppUser appUserById = appUserClient.getAppUserById(goodsEvaluate.getAppUserId());
            if(null != appUserById){
                goodsEvaluate.setUserName(appUserById.getName());
                goodsEvaluate.setAvatar(appUserById.getAvatar());
                goodsEvaluate.setIdStr(String.valueOf(goodsEvaluate.getId()));
            }
        }
        seckillActivityDetailVO.setGoodsEvaluate(goodsEvaluate);
        return seckillActivityDetailVO;
    }