From a498e38d75a23d8220273406fb056f78adc31295 Mon Sep 17 00:00:00 2001
From: rentaiming <806181062@qq.com>
Date: 星期一, 17 六月 2024 18:26:11 +0800
Subject: [PATCH] 用户端商品

---
 ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/MemberAuctionCollectionServiceImpl.java |   37 +++++++++++++++++++++++++++++++++----
 1 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/MemberAuctionCollectionServiceImpl.java b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/MemberAuctionCollectionServiceImpl.java
index 343e525..1df4496 100644
--- a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/MemberAuctionCollectionServiceImpl.java
+++ b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/MemberAuctionCollectionServiceImpl.java
@@ -4,7 +4,9 @@
 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.AuctionBidRecord;
 import com.ruoyi.auction.domain.MemberAuctionCollection;
+import com.ruoyi.auction.mapper.AuctionBidRecordMapper;
 import com.ruoyi.auction.mapper.AuctionGoodsMapper;
 import com.ruoyi.auction.mapper.MemberAuctionCollectionMapper;
 import com.ruoyi.auction.service.IMemberAuctionCollectionService;
@@ -41,13 +43,16 @@
     @Resource
     private AuctionGoodsMapper auctionGoodsMapper;
 
+    @Resource
+    private AuctionBidRecordMapper auctionBidRecordMapper;
+
 
     @Override
     public void saveAuctionCollection(AuctionCollectionDTO auctionCollectionDTO) {
-        if (auctionCollectionDTO.getMemberId()!=null) {
+        if (auctionCollectionDTO.getMemberId()==null) {
             throw new ServiceException("用户ID不能为空");
         }
-        if (auctionCollectionDTO.getState()!=null) {
+        if (auctionCollectionDTO.getState()==null) {
             throw new ServiceException("类型不能为空");
         }
 
@@ -90,12 +95,17 @@
         page.setSize(auctionCollectionDTO.getPageSize());
         page.setCurrent(auctionCollectionDTO.getPageCurr());
         LambdaQueryWrapper< MemberAuctionCollection> wrapper= Wrappers.lambdaQuery();
-        wrapper.in( MemberAuctionCollection::getTargetId, goodsSkuIdList);
+        wrapper.eq(MemberAuctionCollection::getMemberId,auctionCollectionDTO.getMemberId());
+        if (StringUtils.isNotEmpty(auctionCollectionDTO.getGoodsSkuName())){
+            if (goodsSkuIdList.size()>0){
+                wrapper.in(MemberAuctionCollection::getTargetId,goodsSkuIdList);
+            }
+        }
         List<MemberAuctionCollection> list = this.list(wrapper);
 
         List<AuctionGoodsListVO> auctionGoodsVOS=new ArrayList<>();
         for (MemberAuctionCollection auctionCollection:list){
-            AuctionGoods auctionGoods = auctionGoodsMapper.selectById(auctionCollection.getId());
+            AuctionGoods auctionGoods = auctionGoodsMapper.selectById(auctionCollection.getTargetId());
             AuctionGoodsListVO auctionGoodsVO=new AuctionGoodsListVO();
             auctionGoodsVO.setAuctionStock(auctionGoods.getAuctionStock());
             auctionGoodsVO.setGoodsSkuId(auctionGoods.getId());
@@ -106,9 +116,28 @@
             GoodsSku goodsSkuOne = goodsSkuClient.getGoodsSkuOne(auctionGoods.getGoodsSkuId(), SecurityConstants.INNER).getData();
             auctionGoodsVO.setUnit(goodsSkuOne.getUnit());
             auctionGoodsVO.setSpec(goodsSkuOne.getSpec());
+            auctionGoodsVO.setIsCollection(2);
             auctionGoodsVO.setSpecUnit(goodsSkuOne.getSpecUnit());
             auctionGoodsVO.setGoodsSkuName(goodsSkuOne.getSkuName());
             auctionGoodsVO.setCoverPic(goodsSkuOne.getCoverPic());
+
+
+            LambdaQueryWrapper<AuctionBidRecord> wrapper1=Wrappers.lambdaQuery();
+            wrapper1.eq(AuctionBidRecord::getMemberId,auctionCollectionDTO.getMemberId());
+            wrapper1.eq(AuctionBidRecord::getAuctionType,1);
+            wrapper1.eq(AuctionBidRecord::getTargetId,auctionGoods.getId());
+            wrapper1.eq(AuctionBidRecord::getDelFlag,0);
+            AuctionBidRecord list1 = auctionBidRecordMapper.selectOne(wrapper1);
+            if (list1!=null){
+                if (list1.getStatus().getCode()==2){
+                    auctionGoodsVO.setIsStatus(2);
+                }else{
+                    auctionGoodsVO.setIsStatus(1);
+                }
+            }else{
+                auctionGoodsVO.setIsStatus(1);
+            }
+
             auctionGoodsVOS.add(auctionGoodsVO);
 
         }

--
Gitblit v1.7.1