From fc8b51f40e71aa09bb49f407c1e9f68ac94ceb58 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期一, 29 七月 2024 18:51:32 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/MemberGoodsCollectionServiceImpl.java |   47 +++++++++++++++++++++++++++++++----------------
 1 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/MemberGoodsCollectionServiceImpl.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/MemberGoodsCollectionServiceImpl.java
index d9ebce2..1aa37c2 100644
--- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/MemberGoodsCollectionServiceImpl.java
+++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/MemberGoodsCollectionServiceImpl.java
@@ -25,6 +25,7 @@
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import java.util.stream.Collectors;
@@ -63,12 +64,16 @@
         LambdaQueryWrapper< MemberGoodsCollection> wrapper= Wrappers.lambdaQuery();
         wrapper.eq(MemberGoodsCollection::getMemberId,auctionCollectionDTO.getMemberId());
         wrapper.eq(MemberGoodsCollection::getTargetId,auctionCollectionDTO.getGoodsSkuId());
+        if (auctionCollectionDTO.getType()!=null){
+            wrapper.eq(MemberGoodsCollection::getType,auctionCollectionDTO.getType());
+        }
         if (auctionCollectionDTO.getState()==1){
             List<MemberGoodsCollection> list = this.list(wrapper);
             if (list.size()==0){
                 MemberGoodsCollection m =new MemberGoodsCollection();
                 m.setMemberId(auctionCollectionDTO.getMemberId());
                 m.setTargetId(auctionCollectionDTO.getGoodsSkuId());
+                m.setType(auctionCollectionDTO.getType());
                 this.save(m);
             }
         }else{
@@ -104,6 +109,10 @@
         if (StringUtils.isNotEmpty(auctionCollectionDTO.getGoodsSkuName())){
             if (goodsSkuIdList.size()>0){
                 wrapper.in(MemberGoodsCollection::getTargetId,goodsSkuIdList);
+            }else{
+                goodsSkuIdList=new HashSet<>();
+                goodsSkuIdList.add(0L);
+                wrapper.in(MemberGoodsCollection::getTargetId,goodsSkuIdList);
             }
         }
         List<MemberGoodsCollection> list = this.list(wrapper);
@@ -119,13 +128,14 @@
                 auctionGoodsVO.setSkuName(goodsSku.getSkuName());
                 auctionGoodsVO.setSoldQuantity(goodsSku.getSoldQuantity());
                 auctionGoodsVO.setIsCollection(2);
+                auctionGoodsVO.setType(auctionCollection.getType());
                 auctionGoodsVOS.add(auctionGoodsVO);
-            }   if(auctionCollection.getType()==2){
+            }   if(auctionCollection.getType()==3){
                 HomeGoodsSkuListVO auctionGoodsVO=new HomeGoodsSkuListVO();
                 GoodsSeckill goodsSeckill = goodsSeckillMapper.selectById(auctionCollection.getTargetId());
                 GoodsSku goodsSku = goodsSkuMapper.selectById(goodsSeckill.getGoodsSkuId());
                 auctionGoodsVO.setId(auctionCollection.getTargetId());
-                auctionGoodsVO.setPrice(goodsSku.getPrice());
+                auctionGoodsVO.setPrice( goodsSeckill.getSeckillPrice());
                 auctionGoodsVO.setCoverPic(goodsSku.getCoverPic());
                 auctionGoodsVO.setSkuName(goodsSku.getSkuName());
                 auctionGoodsVO.setSoldQuantity(goodsSku.getSoldQuantity());
@@ -133,23 +143,28 @@
                 auctionGoodsVO.setStartStatus(goodsSeckill.getStartStatus());
                 auctionGoodsVO.setStartTime(goodsSeckill.getStartTime());
                 auctionGoodsVO.setEndTime(goodsSeckill.getEndTime());
-                auctionGoodsVO.setXiaosPrice(goodsSeckill.getSeckillPrice());
+                auctionGoodsVO.setXiaosPrice(goodsSku.getPrice());
+                auctionGoodsVO.setType(auctionCollection.getType());
                 auctionGoodsVOS.add(auctionGoodsVO);
-            }   if(auctionCollection.getType()==1){
+            }   if(auctionCollection.getType()==2){
                 GoodsGroupPurchase goodsGroupPurchase = goodsGroupPurchaseMapper.selectById(auctionCollection.getTargetId());
                 HomeGoodsSkuListVO auctionGoodsVO=new HomeGoodsSkuListVO();
-                GoodsSku goodsSku = goodsSkuMapper.selectById(goodsGroupPurchase.getGoodsSkuId());
-                auctionGoodsVO.setId(auctionCollection.getTargetId());
-                auctionGoodsVO.setPrice(goodsSku.getPrice());
-                auctionGoodsVO.setCoverPic(goodsSku.getCoverPic());
-                auctionGoodsVO.setSkuName(goodsSku.getSkuName());
-                auctionGoodsVO.setSoldQuantity(goodsSku.getSoldQuantity());
-                auctionGoodsVO.setIsCollection(2);
-                auctionGoodsVO.setXiaosPrice(goodsGroupPurchase.getGroupPurchasePrice());
-                auctionGoodsVO.setStartTime(goodsGroupPurchase.getStartTime());
-                auctionGoodsVO.setEndTime(goodsGroupPurchase.getEndTime());
-                auctionGoodsVO.setXiaosPrice(goodsGroupPurchase.getGroupPurchasePrice());
-                auctionGoodsVOS.add(auctionGoodsVO);
+                if(goodsGroupPurchase!=null){
+                    GoodsSku goodsSku = goodsSkuMapper.selectById(goodsGroupPurchase.getGoodsSkuId());
+                    auctionGoodsVO.setId(auctionCollection.getTargetId());
+                    auctionGoodsVO.setPrice(goodsGroupPurchase.getGroupPurchasePrice());
+                    auctionGoodsVO.setCoverPic(goodsSku.getCoverPic());
+                    auctionGoodsVO.setSkuName(goodsSku.getSkuName());
+                    auctionGoodsVO.setSoldQuantity(goodsSku.getSoldQuantity());
+                    auctionGoodsVO.setIsCollection(2);
+                    auctionGoodsVO.setXiaosPrice(goodsSku.getPrice());
+                    auctionGoodsVO.setStartTime(goodsGroupPurchase.getStartTime());
+                    auctionGoodsVO.setEndTime(goodsGroupPurchase.getEndTime());
+                    auctionGoodsVO.setXiaosPrice(goodsGroupPurchase.getGroupPurchasePrice());
+                    auctionGoodsVO.setType(auctionCollection.getType());
+                    auctionGoodsVOS.add(auctionGoodsVO);
+                }
+
             }
 
         }

--
Gitblit v1.7.1