From c26092c422c4b72fa5d51a38f6de1b48ab1ccd87 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期一, 27 五月 2024 15:53:36 +0800
Subject: [PATCH] 提交普通拍品、资讯文章、商城商品收藏基础代码

---
 ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomGoodsServiceImpl.java |   88 ++++++++++++++++++++++++-------------------
 1 files changed, 49 insertions(+), 39 deletions(-)

diff --git a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomGoodsServiceImpl.java b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomGoodsServiceImpl.java
index b25cf07..98daca9 100644
--- a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomGoodsServiceImpl.java
+++ b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomGoodsServiceImpl.java
@@ -2,17 +2,17 @@
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.ruoyi.auction.controller.forepart.DTO.AuctionSalesroomGoodsDTO;
-import com.ruoyi.auction.controller.forepart.DTO.OrderDTO;
-import com.ruoyi.auction.controller.forepart.VO.AuctionSalesroomVO;
-import com.ruoyi.auction.controller.forepart.VO.ForepartAuctionSalesroomGoodsVO;
-import com.ruoyi.auction.domain.pojo.AuctionBidRecord;
-import com.ruoyi.auction.domain.pojo.AuctionSalesroom;
-import com.ruoyi.auction.domain.pojo.AuctionSalesroomGoods;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.auction.controller.forepart.dto.AuctionSalesroomGoodsDTO;
+import com.ruoyi.auction.controller.forepart.dto.OrderDTO;
+import com.ruoyi.auction.controller.forepart.vo.AuctionSalesroomVO;
+import com.ruoyi.auction.controller.forepart.vo.ForepartAuctionSalesroomGoodsVO;
+import com.ruoyi.auction.domain.AuctionBidRecord;
+import com.ruoyi.auction.domain.AuctionSalesroom;
+import com.ruoyi.auction.domain.AuctionSalesroomGoods;
 import com.ruoyi.auction.mapper.AuctionSalesroomGoodsMapper;
 import com.ruoyi.auction.service.IAuctionBidRecordService;
 import com.ruoyi.auction.service.IAuctionSalesroomGoodsService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.auction.service.IAuctionSalesroomService;
 import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.enums.AuctionOrderTypeEnum;
@@ -25,13 +25,12 @@
 import com.ruoyi.system.api.feignClient.GoodsSkuClient;
 import com.ruoyi.system.api.feignClient.MemberClient;
 import com.ruoyi.system.api.feignClient.OrderClient;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.List;
+import javax.annotation.Resource;
+import org.springframework.stereotype.Service;
 
 /**
  * <p>
@@ -67,22 +66,22 @@
      *
      */
     @Override
-    public ForepartAuctionSalesroomGoodsVO getAuctionSalesroomGoods(Integer SalesroomId) {
+    public ForepartAuctionSalesroomGoodsVO getAuctionSalesroomGoods(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) {
         ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO =new ForepartAuctionSalesroomGoodsVO();
-        AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(SalesroomId);
+        AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(ationSalesroomGoodsDTO.getAuctionSalesroomId());
         forepartAuctionSalesroomGoodsVO.setSalesroomId(auctionSalesroom.getId());
         forepartAuctionSalesroomGoodsVO.setSalesroomName(auctionSalesroom.getSalesroomName());
         forepartAuctionSalesroomGoodsVO.setSalesroomType(auctionSalesroom.getType().getCode());
         LambdaQueryWrapper<AuctionSalesroomGoods> wrapper=Wrappers.lambdaQuery();
         wrapper.eq(AuctionSalesroomGoods::getStatus,1);
-        wrapper.eq(AuctionSalesroomGoods::getAuctionSalesroomId,SalesroomId);
+        wrapper.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId());
         wrapper.eq(AuctionSalesroomGoods::getDelFlag,0);
         AuctionSalesroomGoods auctionSalesroomGoods=iAuctionSalesroomGoodsService.getOne(wrapper);
         if (auctionSalesroomGoods==null){
             LambdaQueryWrapper<AuctionSalesroomGoods> wrapper1=Wrappers.lambdaQuery();
             wrapper1.eq(AuctionSalesroomGoods::getStatus,2);
             wrapper1.eq(AuctionSalesroomGoods::getDelFlag,0);
-            wrapper1.eq(AuctionSalesroomGoods::getAuctionSalesroomId,SalesroomId);
+            wrapper1.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId());
             wrapper1.orderByAsc(AuctionSalesroomGoods::getSortNum);
             wrapper1.last("limit 1");
             auctionSalesroomGoods=iAuctionSalesroomGoodsService.getOne(wrapper1);
@@ -90,7 +89,7 @@
                 LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery();
                 wrapper2.eq(AuctionSalesroomGoods::getStatus,0);
                 wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0);
-                wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,SalesroomId);
+                wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId());
                 wrapper2.orderByAsc(AuctionSalesroomGoods::getSortNum);
                 wrapper2.last("limit 1");
                 auctionSalesroomGoods=iAuctionSalesroomGoodsService.getOne(wrapper2);
@@ -130,9 +129,9 @@
      *
      */
     @Override
-    public AuctionSalesroomVO getAuctionSalesroominfo(Integer SalesroomId) {
+    public AuctionSalesroomVO getAuctionSalesroominfo(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) {
         ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO =new ForepartAuctionSalesroomGoodsVO();
-        AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(SalesroomId);
+        AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(ationSalesroomGoodsDTO.getAuctionSalesroomId());
         AuctionSalesroomVO auctionSalesroomVO=new AuctionSalesroomVO();
         auctionSalesroomVO.setCoverPic(auctionSalesroom.getCoverPic());
         auctionSalesroomVO.setDescription(auctionSalesroom.getDescription());
@@ -146,7 +145,7 @@
             LambdaQueryWrapper<AuctionSalesroomGoods> wrapper=Wrappers.lambdaQuery();
             wrapper.eq(AuctionSalesroomGoods::getStatus,0);
             wrapper.eq(AuctionSalesroomGoods::getDelFlag,0);
-            wrapper.eq(AuctionSalesroomGoods::getAuctionSalesroomId,SalesroomId);
+            wrapper.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId());
             wrapper.orderByAsc(AuctionSalesroomGoods::getSortNum);
             List<AuctionSalesroomGoods> auctionSalesroomGoods=iAuctionSalesroomGoodsService.list(wrapper);
             for (AuctionSalesroomGoods salesroomGoods:auctionSalesroomGoods){
@@ -162,7 +161,7 @@
             LambdaQueryWrapper<AuctionSalesroomGoods> wrapper=Wrappers.lambdaQuery();
             wrapper.eq(AuctionSalesroomGoods::getStatus,1);
             wrapper.eq(AuctionSalesroomGoods::getDelFlag,0);
-            wrapper.eq(AuctionSalesroomGoods::getAuctionSalesroomId,SalesroomId);
+            wrapper.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId());
             wrapper.last("limit 1");
             AuctionSalesroomGoods auctionSalesroomGoods= iAuctionSalesroomGoodsService.getOne(wrapper);
             ForepartAuctionSalesroomGoodsVO currentAuctionSalesroomGoods=  new ForepartAuctionSalesroomGoodsVO();
@@ -191,7 +190,7 @@
             LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery();
             wrapper2.notIn(AuctionSalesroomGoods::getSortNum,list);
             wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0);
-            wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,SalesroomId);
+            wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId());
             wrapper2.orderByAsc(AuctionSalesroomGoods::getSortNum);
             wrapper2.orderByAsc(AuctionSalesroomGoods::getStatus);
             List<AuctionSalesroomGoods> auctionSalesroomGoods2=iAuctionSalesroomGoodsService.list(wrapper2);
@@ -220,9 +219,9 @@
      *
      */
     @Override
-    public void auctionSalesroomStart(Integer SalesroomId) {
+    public void auctionSalesroomStart(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) {
         ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO =new ForepartAuctionSalesroomGoodsVO();
-        AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(SalesroomId);
+        AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(ationSalesroomGoodsDTO.getAuctionSalesroomId());
         auctionSalesroom.setStatus(AuctionStartStatusEnum.IN_AUCTION);
         auctionSalesroom.setStartTime(LocalDateTime.now());
         iAuctionSalesroomService.updateById(auctionSalesroom);
@@ -230,7 +229,7 @@
         LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery();
         wrapper2.eq(AuctionSalesroomGoods::getStatus,0);
         wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0);
-        wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,SalesroomId);
+        wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId());
         wrapper2.orderByAsc(AuctionSalesroomGoods::getSortNum);
         wrapper2.last("limit 1");
         AuctionSalesroomGoods auctionSalesroomGoods=iAuctionSalesroomGoodsService.getOne(wrapper2);
@@ -245,9 +244,9 @@
      *
      */
     @Override
-    public void auctionSalesroomEnd(Integer SalesroomId) {
+    public void auctionSalesroomEnd(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) {
         ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO =new ForepartAuctionSalesroomGoodsVO();
-        AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(SalesroomId);
+        AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(ationSalesroomGoodsDTO.getAuctionSalesroomId());
         auctionSalesroom.setStatus(AuctionStartStatusEnum.ENDED);
         auctionSalesroom.setEndTime(LocalDateTime.now());
         iAuctionSalesroomService.updateById(auctionSalesroom);
@@ -255,11 +254,28 @@
         LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery();
         wrapper2.eq(AuctionSalesroomGoods::getStatus,0);
         wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0);
-        wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,SalesroomId);
+        wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId());
         List<AuctionSalesroomGoods> auctionSalesroomGoods=iAuctionSalesroomGoodsService.list(wrapper2);
         for (AuctionSalesroomGoods salesroomGoods:auctionSalesroomGoods){
             salesroomGoods.setStatus(AuctionStartStatusEnum.ENDED);
             iAuctionSalesroomGoodsService.updateById(salesroomGoods);
+        }
+        List<Long> list=new ArrayList<>();
+
+
+        LambdaQueryWrapper<AuctionBidRecord> wrapper = Wrappers.lambdaQuery();
+        wrapper.eq(AuctionBidRecord::getAuctionSalesroomId, ationSalesroomGoodsDTO.getAuctionSalesroomId());
+        wrapper.eq(AuctionBidRecord::getDelFlag, 0);
+        wrapper.eq(AuctionBidRecord::getStatus,0);
+        List<AuctionBidRecord>auctionBidRecordList = iAuctionBidRecordService.list(wrapper);
+        for (AuctionBidRecord auctionBidRecord:auctionBidRecordList){
+            list.add(auctionBidRecord.getMemberId());
+        }
+        if (list.size()>0){
+            OrderAuctionBondDTO orderAuctionBondDTO=new OrderAuctionBondDTO();
+            orderAuctionBondDTO.setAuctionSalesroomId(auctionSalesroom.getId());
+            orderAuctionBondDTO.setUserList(list);
+            orderClient.getOrderAuctionBond(orderAuctionBondDTO);
         }
     }
 
@@ -269,11 +285,11 @@
      *
      */
     @Override
-    public List<AuctionSalesroomGoods> isAuctionSalesroom(Integer SalesroomId) {
+    public List<AuctionSalesroomGoods> isAuctionSalesroom(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) {
         LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery();
         wrapper2.eq(AuctionSalesroomGoods::getStatus,0);
         wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0);
-        wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,SalesroomId);
+        wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId());
         List<AuctionSalesroomGoods> auctionSalesroomGoods=iAuctionSalesroomGoodsService.list(wrapper2);
         return auctionSalesroomGoods;
     }
@@ -307,14 +323,13 @@
         wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0);
         wrapper2.eq(AuctionSalesroomGoods::getGoodsSkuId,auctionSalesroomGoodsDTO.getGoodsSkuId());
         AuctionSalesroomGoods auctionSalesroomGood=iAuctionSalesroomGoodsService.getOne(wrapper2);
-        auctionSalesroomGood.setStatus(AuctionStartStatusEnum.ENDED);
-        iAuctionSalesroomGoodsService.updateById(auctionSalesroomGood);
+
 
         AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(auctionSalesroomGood.getAuctionSalesroomId());
 
         AuctionSalesroomGoods auctionSalesroomGoods=iAuctionSalesroomGoodsService.getById(auctionSalesroomGoodsDTO.getGoodsSkuId());
         List<AuctionBidRecord> auctionBidRecordList=new ArrayList<>();
-        List<Long> list=new ArrayList<>();
+
         if (auctionSalesroomGoods.getStatus().getCode()==1) {
             LambdaQueryWrapper<AuctionBidRecord> wrapper = Wrappers.lambdaQuery();
             wrapper.eq(AuctionBidRecord::getGoodsSkuId, auctionSalesroomGoodsDTO.getGoodsSkuId());
@@ -327,23 +342,18 @@
                     AuctionBidRecord auctionBidRecord = auctionBidRecordList.get(i);
                     auctionBidRecord.setStatus(BidStatusEnum.SUCCESSFUL);
                     AddOrder(auctionBidRecord.getGoodsSkuId(),auctionBidRecord.getMemberId(),auctionBidRecord.getLastBidAmount(),auctionSalesroom.getBound());
-
-                    list.add(auctionBidRecord.getMemberId());
                 }
             } else {
                 for (int i = 0; i <= auctionBidRecordList.size(); i++) {
                     AuctionBidRecord auctionBidRecord = auctionBidRecordList.get(i);
                     auctionBidRecord.setStatus(BidStatusEnum.SUCCESSFUL);
                     AddOrder(auctionBidRecord.getGoodsSkuId(),auctionBidRecord.getMemberId(),auctionBidRecord.getLastBidAmount(),auctionSalesroom.getBound());
-                    list.add(auctionBidRecord.getMemberId());
                 }
             }
         }
 
-        OrderAuctionBondDTO orderAuctionBondDTO=new OrderAuctionBondDTO();
-        orderAuctionBondDTO.setAuctionSalesroomId(auctionSalesroom.getId());
-        orderAuctionBondDTO.setUserList(list);
-        orderClient.getOrderAuctionBond(orderAuctionBondDTO);
+        auctionSalesroomGood.setStatus(AuctionStartStatusEnum.ENDED);
+        iAuctionSalesroomGoodsService.updateById(auctionSalesroomGood);
 
     }
 

--
Gitblit v1.7.1