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 |   66 +++++++++++++++++++++++----------
 1 files changed, 46 insertions(+), 20 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 450c310..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
@@ -3,11 +3,13 @@
 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.ruoyi.auction.domain.MemberAuctionCollection;
-import com.ruoyi.auction.mapper.MemberAuctionCollectionMapper;
-import com.ruoyi.auction.service.IAuctionGoodsService;
-import com.ruoyi.auction.service.IMemberAuctionCollectionService;
 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;
 import com.ruoyi.common.core.constant.SecurityConstants;
 import com.ruoyi.common.core.exception.ServiceException;
 import com.ruoyi.common.core.utils.StringUtils;
@@ -18,13 +20,12 @@
 import com.ruoyi.system.api.domain.dto.AuctionGoodsListPageDTO;
 import com.ruoyi.system.api.domain.vo.AuctionGoodsListVO;
 import com.ruoyi.system.api.feignClient.GoodsSkuClient;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
 import java.util.stream.Collectors;
+import javax.annotation.Resource;
+import org.springframework.stereotype.Service;
 
 /**
  * <p>
@@ -38,19 +39,20 @@
 public class MemberAuctionCollectionServiceImpl extends ServiceImpl<MemberAuctionCollectionMapper, MemberAuctionCollection> implements IMemberAuctionCollectionService {
 
     @Resource
-    private  IMemberAuctionCollectionService memberAuctionCollectionService;
-
-    @Resource
     private GoodsSkuClient goodsSkuClient;
     @Resource
-    private  IAuctionGoodsService auctionGoodsService;
+    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("类型不能为空");
         }
 
@@ -58,18 +60,18 @@
         wrapper.eq(MemberAuctionCollection::getMemberId,auctionCollectionDTO.getMemberId());
         wrapper.eq(MemberAuctionCollection::getTargetId,auctionCollectionDTO.getGoodsSkuId());
         if (auctionCollectionDTO.getState()==1){
-            List<MemberAuctionCollection> list = memberAuctionCollectionService.list(wrapper);
+            List<MemberAuctionCollection> list = this.list(wrapper);
             if (list.size()==0){
                 MemberAuctionCollection m =new MemberAuctionCollection();
                 m.setMemberId(auctionCollectionDTO.getMemberId());
                 m.setTargetId(auctionCollectionDTO.getGoodsSkuId());
-                memberAuctionCollectionService.save(m);
+                this.save(m);
             }
         }else{
-            List<MemberAuctionCollection> list = memberAuctionCollectionService.list(wrapper);
+            List<MemberAuctionCollection> list = this.list(wrapper);
             if (list.size()>0){
                 for (MemberAuctionCollection memberArticleCollection:list){
-                    memberAuctionCollectionService.removeById(memberArticleCollection);
+                    this.removeById(memberArticleCollection);
                 }
             }
 
@@ -93,12 +95,17 @@
         page.setSize(auctionCollectionDTO.getPageSize());
         page.setCurrent(auctionCollectionDTO.getPageCurr());
         LambdaQueryWrapper< MemberAuctionCollection> wrapper= Wrappers.lambdaQuery();
-        wrapper.in( MemberAuctionCollection::getTargetId, goodsSkuIdList);
-        List<MemberAuctionCollection> list = memberAuctionCollectionService.list(wrapper);
+        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= auctionGoodsService.getById(auctionCollection.getId());
+            AuctionGoods auctionGoods = auctionGoodsMapper.selectById(auctionCollection.getTargetId());
             AuctionGoodsListVO auctionGoodsVO=new AuctionGoodsListVO();
             auctionGoodsVO.setAuctionStock(auctionGoods.getAuctionStock());
             auctionGoodsVO.setGoodsSkuId(auctionGoods.getId());
@@ -109,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