From 392b42c4891cf2e6beda57ab32c51598f290f4b7 Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期五, 14 三月 2025 20:56:27 +0800 Subject: [PATCH] bug修改 --- ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionBrowseRecordServiceImpl.java | 197 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 194 insertions(+), 3 deletions(-) diff --git a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionBrowseRecordServiceImpl.java b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionBrowseRecordServiceImpl.java index f93ca98..3fb92f0 100644 --- a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionBrowseRecordServiceImpl.java +++ b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionBrowseRecordServiceImpl.java @@ -1,9 +1,32 @@ package com.ruoyi.auction.service.impl; -import com.ruoyi.auction.domain.AuctionBrowseRecord; -import com.ruoyi.auction.mapper.AuctionBrowseRecordMapper; -import com.ruoyi.auction.service.IAuctionBrowseRecordService; +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.ruoyi.auction.domain.AuctionBrowseRecord; +import com.ruoyi.auction.mapper.AuctionBondJlMapper; +import com.ruoyi.auction.mapper.AuctionBrowseRecordMapper; +import com.ruoyi.auction.mapper.AuctionGoodsMapper; +import com.ruoyi.auction.mapper.AuctionSalesroomMapper; +import com.ruoyi.auction.service.IAuctionBrowseRecordService; +import com.ruoyi.common.core.constant.SecurityConstants; +import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.common.core.utils.page.PageDTO; +import com.ruoyi.system.api.domain.AuctionBondJl; +import com.ruoyi.system.api.domain.AuctionGoods; +import com.ruoyi.system.api.domain.AuctionSalesroom; +import com.ruoyi.system.api.domain.GoodsSku; +import com.ruoyi.system.api.domain.dto.AuctionGoodsListDTO; +import com.ruoyi.system.api.domain.dto.MemberAuctionSalesroomDTO; +import com.ruoyi.system.api.domain.vo.AuctionGoodsListVO; +import com.ruoyi.system.api.domain.vo.WdMemberAuctionSalesroomVO; +import com.ruoyi.system.api.feignClient.GoodsSkuClient; +import com.ruoyi.system.api.feignClient.OrderClient; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.Resource; import org.springframework.stereotype.Service; /** @@ -17,4 +40,172 @@ @Service public class AuctionBrowseRecordServiceImpl extends ServiceImpl<AuctionBrowseRecordMapper, AuctionBrowseRecord> implements IAuctionBrowseRecordService { + + + @Resource + private AuctionSalesroomMapper auctionSalesroomMapper; + + @Resource + private OrderClient orderClient; + + @Resource + private GoodsSkuClient goodsSkuClient; + + @Resource + private AuctionGoodsMapper auctionGoodsMapper; + + @Resource + private AuctionBondJlMapper auctionBondJlMapper; + + + @Override + public PageDTO<AuctionGoodsListVO> getWdAuctionBrowseRecordList(AuctionGoodsListDTO auctionGoodsListDTO) { + + Page<AuctionBrowseRecord> page = new Page<>(); + page.setSize(auctionGoodsListDTO.getPageSize()); + page.setCurrent(auctionGoodsListDTO.getPageCurr()); + + LocalDateTime now = LocalDateTime.now(); + LocalDateTime newTime7 = now.minusDays(7); + LambdaQueryWrapper<AuctionBrowseRecord> wrapper3= Wrappers.lambdaQuery(); + wrapper3.eq(AuctionBrowseRecord::getDelFlag,0); + wrapper3.eq(AuctionBrowseRecord::getBrowseType,1); + wrapper3.eq(AuctionBrowseRecord::getMemberId,auctionGoodsListDTO.getMemberId()); + wrapper3.ge(AuctionBrowseRecord::getCreateTime, newTime7) + .le(AuctionBrowseRecord::getCreateTime, now); + if (StringUtils.isNotEmpty(auctionGoodsListDTO.getGoodsSkuName())) { + wrapper3.like(AuctionBrowseRecord::getSkuName,auctionGoodsListDTO.getGoodsSkuName()); + } + + /* Set<Long> goodsSkuIdList = null; + if (auctionGoodsListDTO.getStartStatus()!=null&&auctionGoodsListDTO.getStartStatus()!=4){ + LambdaQueryWrapper<AuctionGoods> wrapper=Wrappers.lambdaQuery(); + wrapper.eq(AuctionGoods::getStartStatus,auctionGoodsListDTO.getStartStatus()); + wrapper.eq(AuctionGoods::getDelFlag,0); + List<AuctionGoods> auctionSalesrooms = auctionGoodsMapper.selectList(wrapper); + goodsSkuIdList = auctionSalesrooms.stream().map(AuctionGoods::getId) + .collect(Collectors.toSet()); + } + + + if (auctionGoodsListDTO.getStartStatus()!=4) { + if (goodsSkuIdList != null) { + wrapper3.in(AuctionBrowseRecord::getTargetId,goodsSkuIdList); + } else { + goodsSkuIdList = new HashSet<>(); + goodsSkuIdList.add(0L); + wrapper3.in(AuctionBrowseRecord::getTargetId,goodsSkuIdList); + } + }*/ + + wrapper3.orderByDesc(AuctionBrowseRecord::getCreateTime); + Page<AuctionBrowseRecord> page1 = this.page(page, wrapper3); + PageDTO<AuctionGoodsListVO> articleCommentsVOPageDTO = PageDTO.of(page1, AuctionGoodsListVO.class); + List<AuctionGoodsListVO> auctionGoodsPgeList = articleCommentsVOPageDTO.getList(); + List<AuctionGoodsListVO> auctionGoodsVOS=new ArrayList<>(); + for (AuctionGoodsListVO auctionGoodsVO:auctionGoodsPgeList){ + AuctionGoods auctionGoods =auctionGoodsMapper.selectById(auctionGoodsVO.getTargetId()); + auctionGoodsVO.setAuctionStock(auctionGoods.getAuctionStock()); + auctionGoodsVO.setGoodsSkuId(auctionGoods.getId()); + auctionGoodsVO.setEndTime(auctionGoods.getEndTime()); + auctionGoodsVO.setStartTime(auctionGoods.getStartTime()); + auctionGoodsVO.setStartingPrice(auctionGoods.getStartingPrice()); + auctionGoodsVO.setStartStatus(auctionGoods.getStartStatus()); + GoodsSku goodsSkuOne = goodsSkuClient.getGoodsSkuOne(auctionGoods.getGoodsSkuId(), SecurityConstants.INNER).getData(); + auctionGoodsVO.setUnit(goodsSkuOne.getUnit()); + auctionGoodsVO.setSpec(goodsSkuOne.getSpec()); + auctionGoodsVO.setSpecUnit(goodsSkuOne.getSpecUnit()); + auctionGoodsVO.setGoodsSkuName(goodsSkuOne.getSkuName()); + auctionGoodsVO.setCoverPic(goodsSkuOne.getCoverPic()); + auctionGoodsVO.setYears(String.valueOf(goodsSkuOne.getYears().getYear())); + auctionGoodsVO.setDescription(goodsSkuOne.getDescription()); + auctionGoodsVO.setDetail(goodsSkuOne.getDetail()); + auctionGoodsVOS.add(auctionGoodsVO); + } + return articleCommentsVOPageDTO; + } + + @Override + public PageDTO<WdMemberAuctionSalesroomVO> getWdAuctionSalesroomBrowseRecordList(MemberAuctionSalesroomDTO MemberAuctionSalesroomDTO) { + + /* Set<Long> goodsSkuIdList = null; + if (MemberAuctionSalesroomDTO.getStatus()!=4){ + LambdaQueryWrapper<AuctionSalesroom> wrapper=Wrappers.lambdaQuery(); + wrapper.eq(AuctionSalesroom::getStatus,MemberAuctionSalesroomDTO.getStatus()); + wrapper.eq(AuctionSalesroom::getDelFlag,0); + List<AuctionSalesroom> auctionSalesrooms = auctionSalesroomMapper.selectList(wrapper); + goodsSkuIdList = auctionSalesrooms.stream().map(AuctionSalesroom::getId) + .collect(Collectors.toSet()); + }*/ + + + + LocalDateTime now = LocalDateTime.now(); + LocalDateTime newTime7 = now.minusDays(7); + Page<AuctionBrowseRecord> page = new Page<>(); + page.setSize(MemberAuctionSalesroomDTO.getPageSize()); + page.setCurrent(MemberAuctionSalesroomDTO.getPageCurr()); + LambdaQueryWrapper<AuctionBrowseRecord> wrapper3= Wrappers.lambdaQuery(); + wrapper3.eq(AuctionBrowseRecord::getDelFlag,0); + wrapper3.eq(AuctionBrowseRecord::getMemberId,MemberAuctionSalesroomDTO.getMemberId()); + wrapper3.eq(AuctionBrowseRecord::getBrowseType,2); + wrapper3.ge(AuctionBrowseRecord::getCreateTime, newTime7) + .le(AuctionBrowseRecord::getCreateTime, now); + + /* if (MemberAuctionSalesroomDTO.getStatus()!=4) { + if (goodsSkuIdList != null) { + wrapper3.in(AuctionBrowseRecord::getTargetId,goodsSkuIdList); + } else { + goodsSkuIdList = new HashSet<>(); + goodsSkuIdList.add(0L); + wrapper3.in(AuctionBrowseRecord::getTargetId,goodsSkuIdList); + } + }*/ + + + wrapper3.orderByDesc(AuctionBrowseRecord::getCreateTime); + if (MemberAuctionSalesroomDTO.getSalesroomName()!=null){ + wrapper3.like(AuctionBrowseRecord::getSkuName,MemberAuctionSalesroomDTO.getSalesroomName()); + } + + Page<AuctionBrowseRecord> page1 = this.page(page, wrapper3); + PageDTO<WdMemberAuctionSalesroomVO> articleCommentsVOPageDTO = PageDTO.of(page1, WdMemberAuctionSalesroomVO.class); + List<WdMemberAuctionSalesroomVO> list1 = articleCommentsVOPageDTO.getList(); + + for (WdMemberAuctionSalesroomVO auctionSalesroom1:list1){ + AuctionSalesroom auctionSalesroom = auctionSalesroomMapper.selectById(auctionSalesroom1.getTargetId()); + auctionSalesroom1.setSalesroomName(auctionSalesroom.getSalesroomName()); + auctionSalesroom1.setDescription(auctionSalesroom.getDescription()); + auctionSalesroom1.setStatus(auctionSalesroom.getStatus().getCode()); + auctionSalesroom1.setSalesroomId(auctionSalesroom.getId()); + auctionSalesroom1.setId(auctionSalesroom.getId()); + auctionSalesroom1.setCoverPic(auctionSalesroom.getCoverPic()); + MemberAuctionSalesroomDTO memberAuctionSalesroomDTO1=new MemberAuctionSalesroomDTO(); + memberAuctionSalesroomDTO1.setAuctionSalesroomId(auctionSalesroom.getId()); + memberAuctionSalesroomDTO1.setMemberId(MemberAuctionSalesroomDTO.getMemberId()); + LambdaQueryWrapper<AuctionBondJl> wrapper=Wrappers.lambdaQuery(); + wrapper.eq(AuctionBondJl::getAuctionSalesroomId,auctionSalesroom.getId()); + wrapper.eq(AuctionBondJl::getMemberId,MemberAuctionSalesroomDTO.getMemberId()); + wrapper.eq(AuctionBondJl::getIsState,0); + AuctionBondJl auctionBondJl = auctionBondJlMapper.selectOne(wrapper); + if (auctionBondJl!=null){ + auctionSalesroom1.setIsBond(2); + }else{ + auctionSalesroom1.setIsBond(1); + } + + MemberAuctionSalesroomDTO memberAuctionSalesroomDTO2=new MemberAuctionSalesroomDTO(); + memberAuctionSalesroomDTO2.setAuctionSalesroomId(auctionSalesroom.getId()); + + LambdaQueryWrapper<AuctionBondJl> wrapper1=Wrappers.lambdaQuery(); + wrapper1.eq(AuctionBondJl::getAuctionSalesroomId,auctionSalesroom.getId()); + wrapper1.eq(AuctionBondJl::getBondType,2); + wrapper1.eq(AuctionBondJl::getIsState,0); + java.util.List<AuctionBondJl> auctionBondJls = auctionBondJlMapper.selectList(wrapper1); + + auctionSalesroom1.setBondNum(auctionBondJls.size()); + auctionSalesroom1.setBond(auctionSalesroom.getBond()); + } + return articleCommentsVOPageDTO; + } } -- Gitblit v1.7.1