From f44e4d609e7efaed9eac545137970b1e334f8106 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期六, 21 九月 2024 09:01:36 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomServiceImpl.java |  876 +++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 615 insertions(+), 261 deletions(-)

diff --git a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomServiceImpl.java b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomServiceImpl.java
index 08f2342..f1b24c6 100644
--- a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomServiceImpl.java
+++ b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomServiceImpl.java
@@ -19,15 +19,16 @@
 import com.ruoyi.auction.controller.management.dto.MgtScreenBidPage;
 import com.ruoyi.auction.controller.management.dto.MgtScreenSalesroomGoodsDTO;
 import com.ruoyi.auction.controller.management.dto.MgtScreenVideoDTO;
+import com.ruoyi.auction.controller.management.vo.AuctionSalesroomQrCodeVO;
 import com.ruoyi.auction.controller.management.vo.MgtAuctionBidRecordVO;
 import com.ruoyi.auction.controller.management.vo.MgtAuctionSalesroomGoodsVO;
 import com.ruoyi.auction.controller.management.vo.MgtAuctionSalesroomScreenVO;
 import com.ruoyi.auction.controller.management.vo.MgtAuctionSalesroomVO;
 import com.ruoyi.auction.domain.AuctionBidRecord;
 import com.ruoyi.auction.domain.AuctionBrowseRecord;
-import com.ruoyi.auction.domain.AuctionSalesroomGoods;
 import com.ruoyi.auction.domain.AuctionVideo;
 import com.ruoyi.auction.mapper.AuctionBidRecordMapper;
+import com.ruoyi.auction.mapper.AuctionBondJlMapper;
 import com.ruoyi.auction.mapper.AuctionSalesroomGoodsMapper;
 import com.ruoyi.auction.mapper.AuctionSalesroomMapper;
 import com.ruoyi.auction.service.IAuctionBidRecordService;
@@ -46,6 +47,7 @@
 import com.ruoyi.common.core.enums.BidStatusEnum;
 import com.ruoyi.common.core.enums.BondStatusEnum;
 import com.ruoyi.common.core.enums.ClientTypeEnum;
+import com.ruoyi.common.core.enums.OrderFromEnum;
 import com.ruoyi.common.core.exception.ServiceException;
 import com.ruoyi.common.core.utils.IDhelper;
 import com.ruoyi.common.core.utils.StringUtils;
@@ -53,13 +55,19 @@
 import com.ruoyi.common.core.utils.page.Checker;
 import com.ruoyi.common.core.utils.page.CollUtils;
 import com.ruoyi.common.core.utils.page.PageDTO;
+import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.system.api.RemoteFileService;
+import com.ruoyi.system.api.constants.ConfigEnum;
 import com.ruoyi.system.api.constants.NotificationTypeConstant;
 import com.ruoyi.system.api.domain.AppMiniLoginVO;
+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.AuctionSalesroomGoods;
+import com.ruoyi.system.api.domain.CustomConfig;
 import com.ruoyi.system.api.domain.GoodsSku;
 import com.ruoyi.system.api.domain.Member;
+import com.ruoyi.system.api.domain.MemberAddress;
 import com.ruoyi.system.api.domain.OrderAuctionBond;
 import com.ruoyi.system.api.domain.PromotionVideo;
 import com.ruoyi.system.api.domain.SysUser;
@@ -71,8 +79,8 @@
 import com.ruoyi.system.api.domain.dto.GoodsStockUpdDTO;
 import com.ruoyi.system.api.domain.dto.MemberAuctionSalesroomBondDTO;
 import com.ruoyi.system.api.domain.dto.MemberAuctionSalesroomDTO;
-import com.ruoyi.system.api.domain.dto.MemberAuctionSalesroomWdDTO;
 import com.ruoyi.system.api.domain.dto.OrderAuctionBondDTO;
+import com.ruoyi.system.api.domain.dto.OrderDTO;
 import com.ruoyi.system.api.domain.dto.RefundDTO;
 import com.ruoyi.system.api.domain.vo.ForepartAuctionSalesroomGoodsVO;
 import com.ruoyi.system.api.domain.vo.ForepartAuctionSalesroomVO;
@@ -88,6 +96,7 @@
 import io.seata.spring.annotation.GlobalTransactional;
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -96,15 +105,20 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 import javax.annotation.Resource;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.config.RequestConfig;
 import org.apache.http.util.EntityUtils;
+import org.redisson.api.RLock;
+import org.redisson.api.RedissonClient;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -116,6 +130,7 @@
  * @author mitao
  * @since 2024-05-16
  */
+@Slf4j
 @Service
 public class AuctionSalesroomServiceImpl extends ServiceImpl<AuctionSalesroomMapper, AuctionSalesroom> implements IAuctionSalesroomService {
 
@@ -160,7 +175,13 @@
     private AuctionBidRecordMapper auctionBidRecordMapper;
 
     @Resource
+    private AuctionBondJlMapper auctionBondJlMapper;
+
+    @Resource
     private RemoteFileService remoteFileService;
+
+    @Resource
+    private RedissonClient redissonClient;
     public static RequestConfig config = RequestConfig.custom().setConnectTimeout(5000).setSocketTimeout(5000).build();
     // 配置您申请的KEY,在个人中心->我的数据,接口名称上方查看
     public static final String APPKEY = "";
@@ -235,19 +256,29 @@
 
     @Override
     public AuctionSalesroom getAuctionBidRecordOne(ForepartAuctionBidRecordDTO arepartAuctionBidRecordDTO) {
-        R<SysUser> r=sysUserClient.queryUserByPhone(arepartAuctionBidRecordDTO.getPhone());
+        R<SysUser> r=sysUserClient.queryUserByPhone1(arepartAuctionBidRecordDTO.getPhone());
         SysUser sysUser=r.getData();
         if (sysUser==null){
             throw new ServiceException("手机号未注册");
         }
-    /*   if (!SecurityUtils.matchesPassword(arepartAuctionBidRecordDTO.getPassword(), sysUser.getPassword())){
+        if (sysUser.getStatus().equals("1")){
+            throw new ServiceException("该拍卖师账号停用");
+        }
+
+      if (!SecurityUtils.matchesPassword(arepartAuctionBidRecordDTO.getPassword(), sysUser.getPassword())){
             throw new ServiceException("密码输入错误");
-        }*/
+        }
 
         LambdaQueryWrapper<AuctionSalesroom> wrapper=Wrappers.lambdaQuery();
         wrapper.eq(AuctionSalesroom::getAuctionSalesroomNo,arepartAuctionBidRecordDTO.getAuctionSalesroomQrcode());
         wrapper.eq(AuctionSalesroom::getDelFlag,0);
         AuctionSalesroom auctionBidRecord = this.getOne(wrapper);
+        if (auctionBidRecord!=null){
+            if(auctionBidRecord.getType().getCode()==0){
+                throw new ServiceException("当前扫码是线下拍卖会");
+            }
+        }
+
         return auctionBidRecord;
     }
 
@@ -379,27 +410,35 @@
             memberAuctionSalesroomVO.setSalesroomId(auctionSalesroom.getId());
             memberAuctionSalesroomVO.setStartTime(auctionSalesroom.getStartTime());
             memberAuctionSalesroomVO.setEndTime(auctionSalesroom.getEndTime());
-            memberAuctionSalesroomVO.setCoverPic(auctionSalesroom.getCoverPic());
+            memberAuctionSalesroomVO.setCoverPic(auctionSalesroom.getClientCoverPic());
             memberAuctionSalesroomVO.setBond(auctionSalesroom.getBond());
             memberAuctionSalesroomVO.setAuthentication(auctionSalesroom.getAuthentication());
             memberAuctionSalesroomDTO.setAuctionSalesroomId(auctionSalesroom.getId());
-            List<OrderAuctionBond> data = orderClient.getOrderAuctionBondList1(memberAuctionSalesroomDTO, SecurityConstants.INNER).getData();
-            if (data!=null&&data.size()>0){
+
+            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){
                memberAuctionSalesroomVO.setIsApply(2);
            }else{
                memberAuctionSalesroomVO.setIsApply(1);
            }
-            MemberAuctionSalesroomDTO memberAuctionSalesroomDTO1=new MemberAuctionSalesroomDTO();
-            memberAuctionSalesroomDTO1.setAuctionSalesroomId(auctionSalesroom.getId());
-            List<OrderAuctionBond> data1 = orderClient.getOrderAuctionBondList1(memberAuctionSalesroomDTO1, SecurityConstants.INNER).getData();
-            if(data1!=null){
-                memberAuctionSalesroomVO.setApplyNum(data1.size());
-                List.add(memberAuctionSalesroomVO);
+            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);
+            if(auctionBondJls!=null){
+                memberAuctionSalesroomVO.setApplyNum(auctionBondJls.size());
+
             }else{
                 memberAuctionSalesroomVO.setApplyNum(0);
             }
 
-
+            List.add(memberAuctionSalesroomVO);
         }
         page.setRecords(List);
         return PageDTO.of(page);
@@ -408,27 +447,56 @@
     @Override
     public MemberAuctionSalesroomInfoVO getMemberAuctionSalesroomInfo(MemberAuctionSalesroomDTO memberAuctionSalesroomDTO) {
         AuctionSalesroom byId = this.getById(memberAuctionSalesroomDTO.getAuctionSalesroomId());
+        if(byId==null){
+            LambdaQueryWrapper<AuctionSalesroom> wrapper=Wrappers.lambdaQuery();
+            wrapper.eq(AuctionSalesroom::getAuctionSalesroomNo,memberAuctionSalesroomDTO.getAuctionSalesroomId());
+            wrapper.eq(AuctionSalesroom::getDelFlag,0);
+            byId =this.getOne(wrapper);
+            memberAuctionSalesroomDTO.setAuctionSalesroomId(byId.getId());
+        }
+
+        if (byId.getType().getCode()==0){
+            throw new ServiceException("该拍卖会是线下拍卖会");
+        }
         MemberAuctionSalesroomInfoVO memberAuctionSalesroomInfoVO=new MemberAuctionSalesroomInfoVO();
         memberAuctionSalesroomInfoVO.setId(byId.getId());
         memberAuctionSalesroomInfoVO.setBound(byId.getBond());
         memberAuctionSalesroomInfoVO.setAuthentication(byId.getAuthentication());
         memberAuctionSalesroomInfoVO.setEndTime(byId.getEndTime());
         memberAuctionSalesroomInfoVO.setSalesroomName(byId.getSalesroomName());
+        memberAuctionSalesroomInfoVO.setEndTime(byId.getEndTime());
         memberAuctionSalesroomInfoVO.setType(byId.getType());
         memberAuctionSalesroomInfoVO.setDescription(byId.getDescription());
-        memberAuctionSalesroomInfoVO.setSharePic(byId.getSharePic());
         memberAuctionSalesroomInfoVO.setShareTitle(byId.getShareTitle());
+        if (StringUtils.isNotBlank(byId.getShareTitle())) {
+            memberAuctionSalesroomInfoVO.setShareTitle(byId.getShareTitle());
+        } else {
+            memberAuctionSalesroomInfoVO.setShareTitle(byId.getSalesroomName());
+        }
+        if (StringUtils.isNotBlank(byId.getSharePic())) {
+            memberAuctionSalesroomInfoVO.setSharePic(byId.getSharePic());
+        } else {
+            memberAuctionSalesroomInfoVO.setSharePic(byId.getCoverPic());
+        }
         memberAuctionSalesroomInfoVO.setStartTime(byId.getStartTime());
         memberAuctionSalesroomInfoVO.setStatus(byId.getStatus());
         memberAuctionSalesroomInfoVO.setCoverPic(byId.getCoverPic());
-        List<OrderAuctionBond> data = orderClient.getOrderAuctionBondList1(memberAuctionSalesroomDTO, SecurityConstants.INNER).getData();
-        if (data.size()>0){
+
+        LambdaQueryWrapper<AuctionBondJl> wrapper=Wrappers.lambdaQuery();
+        wrapper.eq(AuctionBondJl::getAuctionSalesroomId,byId.getId());
+        wrapper.eq(AuctionBondJl::getMemberId,memberAuctionSalesroomDTO.getMemberId());
+        wrapper.eq(AuctionBondJl::getIsState,0);
+        AuctionBondJl auctionBondJl = auctionBondJlMapper.selectOne(wrapper);
+        if (auctionBondJl!=null){
             memberAuctionSalesroomInfoVO.setIsApply(2);
         }else{
             memberAuctionSalesroomInfoVO.setIsApply(1);
         }
         List<ForepartAuctionSalesroomGoodsVO> forepartAuctionSalesroomGoodsVOS=new ArrayList<>();
-        List<AuctionSalesroomGoods> auctionSalesroomGoods = auctionSalesroomGoodsMapper.getAuctionSalesroomGoods(memberAuctionSalesroomDTO);
+        MemberAuctionSalesroomDTO memberAuctionSalesroomDTO1 =new MemberAuctionSalesroomDTO();
+        memberAuctionSalesroomDTO1.setAuctionSalesroomId(byId.getId());
+        memberAuctionSalesroomDTO1.setBackupStatus(false);
+        List<AuctionSalesroomGoods> auctionSalesroomGoods = auctionSalesroomGoodsMapper.getAuctionSalesroomGoods(memberAuctionSalesroomDTO1);
         for (AuctionSalesroomGoods salesroomGoods:auctionSalesroomGoods){
             ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO=new ForepartAuctionSalesroomGoodsVO();
             forepartAuctionSalesroomGoodsVO.setSalesroomId(byId.getId());
@@ -440,8 +508,13 @@
             forepartAuctionSalesroomGoodsVO.setCoverPic(goodsSku.getCoverPic());
             forepartAuctionSalesroomGoodsVO.setStartingPrice(salesroomGoods.getStartingPrice());
             forepartAuctionSalesroomGoodsVO.setSalesroomStock(salesroomGoods.getSalesroomStock());
-            forepartAuctionSalesroomGoodsVO.setGoodsSkustatus(salesroomGoods.getStatus());
+            forepartAuctionSalesroomGoodsVO.setGoodsSkustatus(salesroomGoods.getStatus().getCode());
+            forepartAuctionSalesroomGoodsVO.setMinimumMarkupAmount(salesroomGoods.getMinimumMarkupAmount());
+            forepartAuctionSalesroomGoodsVO.setStartTime(salesroomGoods.getStartTime());
             forepartAuctionSalesroomGoodsVO.setYears(String.valueOf(goodsSku.getYears()));
+            forepartAuctionSalesroomGoodsVO.setListingDuration(salesroomGoods.getListingDuration());
+            forepartAuctionSalesroomGoodsVO.setSpec(goodsSku.getSpec());
+            forepartAuctionSalesroomGoodsVO.setSpecUnit(goodsSku.getSpecUnit());
             LambdaQueryWrapper<AuctionBidRecord> wrapper1=Wrappers.lambdaQuery();
             wrapper1.eq(AuctionBidRecord::getMemberId,memberAuctionSalesroomDTO.getMemberId());
             wrapper1.eq(AuctionBidRecord::getAuctionSalesroomId,byId.getId());
@@ -459,6 +532,28 @@
                 forepartAuctionSalesroomGoodsVO.setIsBond(1);
                 forepartAuctionSalesroomGoodsVO.setIsStatus(1);
             }
+
+            LambdaQueryWrapper<AuctionBidRecord> wrapper2=Wrappers.lambdaQuery();
+            wrapper2.eq(AuctionBidRecord::getAuctionSalesroomId,byId.getId());
+            wrapper2.eq(AuctionBidRecord::getAuctionType,2);
+            wrapper2.eq(AuctionBidRecord::getTargetId,salesroomGoods.getId());
+            wrapper2.eq(AuctionBidRecord::getDelFlag,0);
+            AuctionBidRecord list2 = auctionBidRecordMapper.selectOne(wrapper1);
+            if (list2!=null){
+                forepartAuctionSalesroomGoodsVO.setZgBid(list2.getLastBidAmount());
+            }
+
+            LambdaQueryWrapper<AuctionBidRecord> wrapper5=Wrappers.lambdaQuery();
+            wrapper5.eq(AuctionBidRecord::getAuctionSalesroomId,byId.getId());
+            wrapper5.eq(AuctionBidRecord::getAuctionType,2);
+            wrapper5.eq(AuctionBidRecord::getTargetId,salesroomGoods.getId());
+            wrapper5.eq(AuctionBidRecord::getMemberId,memberAuctionSalesroomDTO.getMemberId());
+            wrapper5.eq(AuctionBidRecord::getDelFlag,0);
+            AuctionBidRecord list5 = auctionBidRecordMapper.selectOne(wrapper1);
+            if (list5!=null){
+                forepartAuctionSalesroomGoodsVO.setPresentBid(list5.getLastBidAmount());
+            }
+
             forepartAuctionSalesroomGoodsVOS.add(forepartAuctionSalesroomGoodsVO);
         }
         memberAuctionSalesroomInfoVO.setForepartAuctionSalesroomGoodsVO(forepartAuctionSalesroomGoodsVOS);
@@ -472,14 +567,15 @@
         wrapper3.eq(AuctionBrowseRecord::getTargetId,memberAuctionSalesroomDTO.getAuctionSalesroomId());
         wrapper3.eq(AuctionBrowseRecord::getBrowseType,AuctionOrderTypeEnum.AUCTION_ITEMS);
         wrapper3.eq(AuctionBrowseRecord::getMemberId,memberAuctionSalesroomDTO.getMemberId());
-        wrapper3.ge(AuctionBrowseRecord::getCreateTime, now)
-                .le(AuctionBrowseRecord::getCreateTime, newTime7);
+        wrapper3.ge(AuctionBrowseRecord::getCreateTime, newTime7)
+                .le(AuctionBrowseRecord::getCreateTime, now);
         List<AuctionBrowseRecord> list = iAuctionBrowseRecordService.list(wrapper3);
         if (list.size()==0){
             AuctionBrowseRecord auctionBrowseRecord=new AuctionBrowseRecord();
             auctionBrowseRecord.setBrowseType(AuctionOrderTypeEnum.AUCTION_ITEMS);
             auctionBrowseRecord.setMemberId(memberAuctionSalesroomDTO.getMemberId());
             auctionBrowseRecord.setTargetId(memberAuctionSalesroomDTO.getAuctionSalesroomId());
+            auctionBrowseRecord.setSkuName(byId.getSalesroomName());
             iAuctionBrowseRecordService.save(auctionBrowseRecord);
         }
 
@@ -493,6 +589,9 @@
         wrapper.eq(AuctionSalesroom::getAuctionSalesroomNo,MemberAuctionSalesroomDTO.getSalesroomNO());
         wrapper.eq(AuctionSalesroom::getDelFlag,0);
         AuctionSalesroom auctionSalesroom = this.getOne(wrapper);
+        if (auctionSalesroom.getType().getCode()==0){
+            throw new ServiceException("该拍卖会是线下拍卖会");
+        }
         MemberAuctionSalesroomVO memberAuctionSalesroomVO=new MemberAuctionSalesroomVO();
         memberAuctionSalesroomVO.setSalesroomName(auctionSalesroom.getSalesroomName());
         memberAuctionSalesroomVO.setStatus(auctionSalesroom.getStatus().getCode());
@@ -509,6 +608,15 @@
     @Override
     public void CancelSignUpNow(MemberAuctionSalesroomBondDTO memberAuctionSalesroomBondDTO) {
         if (memberAuctionSalesroomBondDTO.getBondType()==2){
+            AuctionSalesroom byId = this.getById(memberAuctionSalesroomBondDTO.getAuctionSalesroomId());
+            if(byId==null){
+                LambdaQueryWrapper<AuctionSalesroom> wrapper= Wrappers.lambdaQuery();
+                wrapper.eq(AuctionSalesroom::getAuctionSalesroomNo,memberAuctionSalesroomBondDTO.getAuctionSalesroomId());
+                wrapper.eq(AuctionSalesroom::getDelFlag,0);
+                byId =this.getOne(wrapper);
+                memberAuctionSalesroomBondDTO.setAuctionSalesroomId(byId.getId());
+            }
+
             OrderAuctionBond orderAuctionBond = orderClient.getOrderAuctionBondone(memberAuctionSalesroomBondDTO, SecurityConstants.INNER).getData();
 
             List<RefundDTO> refundDTOList = new ArrayList<>();
@@ -526,22 +634,15 @@
                 throw new ServiceException("当前拍卖场中标拍品订单未完成,请完成后再试。");
             }
             // 远程调用订单服务进行退款
-                Map<String, Object> data = orderClient.refund(refundDTOList,
-                        SecurityConstants.INNER).getData();
+                orderClient.refund1(refundDTO, SecurityConstants.INNER).getData();
                 // 处理退款返回结果
                 List<String> successfulOrders = new ArrayList<>();
                 List<String> failedOrders = new ArrayList<>();
 
-                data.forEach((key, value) -> {
-                    if ((boolean) value) {
-                        successfulOrders.add(key);
-                    } else {
-                        failedOrders.add(key);
-                    }
-                });
-                // 退款成功的订单修改状态
-                List<Long> ids = new ArrayList<>();
+
+                List<Long> ids=new ArrayList<>();
                 ids.add(orderAuctionBond.getId());
+
                 // 远程调用订单服务修改订单状态
                 orderClient.updateOrderAuctionBondStatus(ids, BondStatusEnum.REFUNDED,SecurityConstants.INNER);
 
@@ -551,6 +652,7 @@
             RefundDTO refundDTO = new RefundDTO();
             refundDTO.setOrderNo(orderAuctionBond.getOrderNo());
             refundDTO.setAmount(orderAuctionBond.getBond());
+            refundDTOList.add(refundDTO);
 
             LambdaQueryWrapper<AuctionBidRecord> wrapper = Wrappers.lambdaQuery();
             wrapper.eq(AuctionBidRecord::getTargetId, memberAuctionSalesroomBondDTO.getAuctionGoodsId());
@@ -563,21 +665,11 @@
             }
 
             // 远程调用订单服务进行退款
-            Map<String, Object> data = orderClient.refund(refundDTOList,
+             orderClient.refund1(refundDTO,
                     SecurityConstants.INNER).getData();
-            // 处理退款返回结果
-            List<String> successfulOrders = new ArrayList<>();
-            List<String> failedOrders = new ArrayList<>();
 
-            data.forEach((key, value) -> {
-                if ((boolean) value) {
-                    successfulOrders.add(key);
-                } else {
-                    failedOrders.add(key);
-                }
-            });
-            // 退款成功的订单修改状态
-            List<Long> ids = new ArrayList<>();
+
+            List<Long> ids=new ArrayList<>();
             ids.add(orderAuctionBond.getId());
             // 远程调用订单服务修改订单状态
             orderClient.updateOrderAuctionBondStatus(ids,BondStatusEnum.REFUNDED,SecurityConstants.INNER);
@@ -588,135 +680,188 @@
 
     @Override
     public void SaveBid(BidDTO bidVO) {
-        Member membeOne = memberClient.getMembeOne(bidVO.getMemberId(), SecurityConstants.INNER).getData();
-        if (bidVO.getAuctionType()==2){
-            AuctionSalesroomGoods byId = auctionSalesroomGoodsMapper.selectById(bidVO.getTargetId());
-            if (byId.getStartingPrice().doubleValue()>bidVO.getLastBidAmount().doubleValue()){
-                throw new ServiceException("出价不能比起拍价低");
-            }
-            BigDecimal bigDecimal=byId.getStartingPrice().add(byId.getMinimumMarkupAmount());
-            if (bigDecimal.doubleValue()>bidVO.getLastBidAmount().doubleValue()){
-                throw new ServiceException("出价不能比每次最少加价低");
-            }
-
-            LambdaQueryWrapper<AuctionBidRecord> wrapper1=Wrappers.lambdaQuery();
-            wrapper1.eq(AuctionBidRecord::getMemberId,bidVO.getMemberId());
-            wrapper1.eq(AuctionBidRecord::getAuctionSalesroomId,bidVO.getAuctionSalesroomId());
-            wrapper1.eq(AuctionBidRecord::getTargetId,bidVO.getTargetId());
-            wrapper1.eq(AuctionBidRecord::getDelFlag,0);
-            AuctionBidRecord one = auctionBidRecordService.getOne(wrapper1);
-            if (one!=null){
-                BigDecimal bigDecimal1=one.getLastBidAmount().add(byId.getMinimumMarkupAmount());
-                if (bigDecimal1.doubleValue()>bidVO.getLastBidAmount().doubleValue()){
-                    throw new ServiceException("出价不能比上次出价加每次最少加价低");
+        RLock lock = redissonClient.getLock(
+                "bid-" + bidVO.getAuctionType() + "-" + bidVO.getTargetId());
+        lock.lock(10, TimeUnit.SECONDS);
+        try {
+            Member membeOne = memberClient.getMembeOne(bidVO.getMemberId(), SecurityConstants.INNER)
+                    .getData();
+            if (bidVO.getAuctionType() == 2) {
+                AuctionSalesroomGoods byId = auctionSalesroomGoodsMapper.selectById(
+                        bidVO.getTargetId());
+                if (byId.getStartingPrice().doubleValue() > bidVO.getLastBidAmount()
+                        .doubleValue()) {
+                    throw new ServiceException("出价不能比起拍价低");
                 }
-                one.setLastBidAmount(bidVO.getLastBidAmount());
-                one.setLastBidTime(LocalDateTime.now());
-                one.setBidCount(one.getBidCount()+1);
-                auctionBidRecordService.updateById(one);
-            }else{
-                one=new AuctionBidRecord();
-                one.setAuctionSalesroomId(bidVO.getAuctionSalesroomId());
-                one.setTargetId(bidVO.getTargetId());
-                one.setMemberId(bidVO.getMemberId());
-                one.setLastBidTime(LocalDateTime.now());
-                one.setNickname(membeOne.getNickname());
-                one.setPhone(membeOne.getPhone());
-                one.setAuctionType(AuctionOrderTypeEnum.AUCTION_ITEMS);
-                one.setStatus(BidStatusEnum.ELIMINATE);
-                one.setBidCount(1);
-                one.setLastBidAmount(bidVO.getLastBidAmount());
-                auctionBidRecordService.save(one);
-            }
-
-
-            LambdaQueryWrapper<AuctionBidRecord> wrapper2=Wrappers.lambdaQuery();
-            wrapper2.eq(AuctionBidRecord::getAuctionSalesroomId,bidVO.getAuctionSalesroomId());
-            wrapper2.eq(AuctionBidRecord::getTargetId,bidVO.getTargetId());
-            wrapper2.eq(AuctionBidRecord::getDelFlag,0);
-            wrapper2.orderByDesc(AuctionBidRecord::getLastBidAmount);
-            AuctionBidRecord one2 = auctionBidRecordService.getOne(wrapper1);
-
-            Map<String, Object> map = new ConcurrentHashMap<>();
-            map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM);
-            map.put("auctionSalesroomId", bidVO.getAuctionSalesroomId());
-            map.put("byId", byId.getStatus());
-            map.put("lastBidAmount",one2.getLastBidAmount());
-            map.put("message_type", "BidRecor");
-            map.put("type",3);
-            String msg = null;
-            try {
-                msg = objectMapper.writeValueAsString(map);
-            } catch (JsonProcessingException e) {
-            }
-            String finalMsg = msg;
-                    sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(finalMsg)
-                            .clientType(ClientTypeEnum.MEMBER).build(), SecurityConstants.INNER);
-
-
-
-
-        }else {
-            AuctionGoods byId = auctionGoodsService.getById(bidVO.getTargetId());
-            if (byId.getStartingPrice().doubleValue()>bidVO.getLastBidAmount().doubleValue()){
-                throw new ServiceException("出价不能比起拍价低");
-            }
-            BigDecimal bigDecimal=byId.getStartingPrice().add(byId.getMinimumMarkupAmount());
-            if (bigDecimal.doubleValue()>bidVO.getLastBidAmount().doubleValue()){
-                throw new ServiceException("出价不能比每次最少加价低");
-            }
-            LambdaQueryWrapper<AuctionBidRecord> wrapper1=Wrappers.lambdaQuery();
-            wrapper1.eq(AuctionBidRecord::getMemberId,bidVO.getMemberId());
-            wrapper1.eq(AuctionBidRecord::getTargetId,bidVO.getTargetId());
-            wrapper1.eq(AuctionBidRecord::getDelFlag,0);
-            AuctionBidRecord one = auctionBidRecordService.getOne(wrapper1);
-            if (one!=null){
-                BigDecimal bigDecimal1=one.getLastBidAmount().add(byId.getMinimumMarkupAmount());
-                if (bigDecimal1.doubleValue()<bidVO.getLastBidAmount().doubleValue()){
-                    throw new ServiceException("出价不能比上次出价加每次最少加价低");
+                AuctionSalesroom byId1 = this.getById(bidVO.getAuctionSalesroomId());
+                if (byId1 == null) {
+                    LambdaQueryWrapper<AuctionSalesroom> wrapper = Wrappers.lambdaQuery();
+                    wrapper.eq(AuctionSalesroom::getAuctionSalesroomNo,
+                            bidVO.getAuctionSalesroomId());
+                    wrapper.eq(AuctionSalesroom::getDelFlag, 0);
+                    AuctionSalesroom one = this.getOne(wrapper);
+                    bidVO.setAuctionSalesroomId(one.getId());
                 }
-                one.setLastBidAmount(bidVO.getLastBidAmount());
-                one.setLastBidTime(LocalDateTime.now());
-                one.setBidCount(one.getBidCount()+1);
-                auctionBidRecordService.updateById(one);
 
+                LambdaQueryWrapper<AuctionBidRecord> wrapper3 = Wrappers.lambdaQuery();
+                wrapper3.eq(AuctionBidRecord::getAuctionSalesroomId, bidVO.getAuctionSalesroomId());
+                wrapper3.eq(AuctionBidRecord::getTargetId, bidVO.getTargetId());
+                wrapper3.eq(AuctionBidRecord::getDelFlag, 0);
+                wrapper3.orderByDesc(AuctionBidRecord::getLastBidAmount);
+                wrapper3.last("limit 1");
+                AuctionBidRecord one3 = auctionBidRecordService.getOne(wrapper3);
+                if (byId.getSalesroomStock() == 1) {
+                    if (one3 != null) {
+                        if (bidVO.getLastBidAmount().doubleValue() < one3.getLastBidAmount()
+                                .doubleValue()) {
+                            throw new ServiceException("出价不能比当前最高价低");
+                        }
+                    }
+                    if (one3 != null) {
+                        if (bidVO.getLastBidAmount().doubleValue() < one3.getLastBidAmount()
+                                .add(byId.getMinimumMarkupAmount()).doubleValue()) {
+                            throw new ServiceException("出价不能比当前最高价低加每次加价低");
+                        }
+                    }
+                }
 
-            }else{
-                one=new AuctionBidRecord();
-                one.setAuctionSalesroomId(bidVO.getAuctionSalesroomId());
-                one.setTargetId(bidVO.getTargetId());
-                one.setMemberId(bidVO.getMemberId());
-                one.setLastBidTime(LocalDateTime.now());
-                one.setAuctionType(AuctionOrderTypeEnum.REGULAR_ITEMS);
-                one.setStatus(BidStatusEnum.ELIMINATE);
-                one.setBidCount(1);
-                one.setLastBidAmount(bidVO.getLastBidAmount());
-                auctionBidRecordService.save(one);
+                BigDecimal bigDecimal = byId.getStartingPrice().add(byId.getMinimumMarkupAmount());
+                if (bigDecimal.doubleValue() > bidVO.getLastBidAmount().doubleValue()) {
+                    throw new ServiceException("出价不能比每次最少加价低");
+                }
+
+                LambdaQueryWrapper<AuctionBidRecord> wrapper1 = Wrappers.lambdaQuery();
+                wrapper1.eq(AuctionBidRecord::getMemberId, bidVO.getMemberId());
+                wrapper1.eq(AuctionBidRecord::getAuctionSalesroomId, bidVO.getAuctionSalesroomId());
+                wrapper1.eq(AuctionBidRecord::getTargetId, bidVO.getTargetId());
+                wrapper1.eq(AuctionBidRecord::getDelFlag, 0);
+
+                AuctionBidRecord one = auctionBidRecordService.getOne(wrapper1);
+                if (one != null) {
+                    one.setLastBidAmount(bidVO.getLastBidAmount());
+                    one.setLastBidTime(LocalDateTime.now());
+                    one.setBidCount(one.getBidCount() + 1);
+                    auctionBidRecordService.updateById(one);
+                } else {
+                    one = new AuctionBidRecord();
+                    one.setAuctionSalesroomId(bidVO.getAuctionSalesroomId());
+                    one.setTargetId(bidVO.getTargetId());
+                    one.setMemberId(bidVO.getMemberId());
+                    one.setLastBidTime(LocalDateTime.now());
+                    if (membeOne.getRealName() != null && membeOne.getRealName() != "") {
+                        one.setNickname(membeOne.getRealName());
+                    } else {
+                        one.setNickname(membeOne.getNickname());
+                    }
+
+                    one.setPhone(membeOne.getPhone());
+                    one.setAuctionType(AuctionOrderTypeEnum.AUCTION_ITEMS);
+                    one.setStatus(BidStatusEnum.ELIMINATE);
+                    one.setBidCount(1);
+                    one.setLastBidAmount(bidVO.getLastBidAmount());
+                    auctionBidRecordService.save(one);
+                }
+
+                LambdaQueryWrapper<AuctionBidRecord> wrapper2 = Wrappers.lambdaQuery();
+                wrapper2.eq(AuctionBidRecord::getAuctionSalesroomId, bidVO.getAuctionSalesroomId());
+                wrapper2.eq(AuctionBidRecord::getTargetId, bidVO.getTargetId());
+                wrapper2.eq(AuctionBidRecord::getDelFlag, 0);
+                wrapper2.orderByDesc(AuctionBidRecord::getLastBidAmount);
+                AuctionBidRecord one2 = auctionBidRecordService.getOne(wrapper1);
+
+                Map<String, Object> map = new ConcurrentHashMap<>();
+                map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM);
+                map.put("auctionSalesroomId", bidVO.getAuctionSalesroomId());
+                map.put("byId", byId.getStatus());
+                map.put("lastBidAmount", one2.getLastBidAmount());
+                map.put("message_type", "BidRecor");
+                map.put("type", 3);
+                String msg = null;
+                try {
+                    msg = objectMapper.writeValueAsString(map);
+                } catch (JsonProcessingException e) {
+                }
+                String finalMsg = msg;
+                sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(finalMsg)
+                        .clientType(ClientTypeEnum.MEMBER).build(), SecurityConstants.INNER);
+            } else {
+                AuctionGoods byId = auctionGoodsService.getById(bidVO.getTargetId());
+                if (byId.getStartingPrice().doubleValue() > bidVO.getLastBidAmount()
+                        .doubleValue()) {
+                    throw new ServiceException("出价不能比起拍价低");
+                }
+                BigDecimal bigDecimal = byId.getStartingPrice().add(byId.getMinimumMarkupAmount());
+                if (bigDecimal.doubleValue() > bidVO.getLastBidAmount().doubleValue()) {
+                    throw new ServiceException("出价不能比每次最少加价低");
+                }
+                LambdaQueryWrapper<AuctionBidRecord> wrapper1 = Wrappers.lambdaQuery();
+                wrapper1.eq(AuctionBidRecord::getTargetId, bidVO.getTargetId());
+                wrapper1.eq(AuctionBidRecord::getDelFlag, 0);
+                wrapper1.orderByDesc(AuctionBidRecord::getLastBidAmount);
+                wrapper1.last("limit 1");
+                AuctionBidRecord one = auctionBidRecordService.getOne(wrapper1);
+                if (byId.getAuctionStock() == 1) {
+                    if (one != null) {
+                        BigDecimal bigDecimal1 = one.getLastBidAmount()
+                                .add(byId.getMinimumMarkupAmount());
+                        if (bigDecimal1.doubleValue() > bidVO.getLastBidAmount().doubleValue()) {
+                            throw new ServiceException("出价不能比上次出价加每次最少加价低");
+                        }
+
+                    }
+                }
+                LambdaQueryWrapper<AuctionBidRecord> wrapper3 = Wrappers.lambdaQuery();
+                wrapper3.eq(AuctionBidRecord::getTargetId, bidVO.getTargetId());
+                wrapper3.eq(AuctionBidRecord::getDelFlag, 0);
+                wrapper3.eq(AuctionBidRecord::getMemberId, bidVO.getMemberId());
+                wrapper3.orderByDesc(AuctionBidRecord::getLastBidAmount);
+                wrapper3.last("limit 1");
+                AuctionBidRecord one3 = auctionBidRecordService.getOne(wrapper3);
+                if (one3 != null) {
+                    one3.setLastBidAmount(bidVO.getLastBidAmount());
+                    one3.setLastBidTime(LocalDateTime.now());
+                    one3.setBidCount(one.getBidCount() + 1);
+                    auctionBidRecordService.updateById(one3);
+                } else {
+                    one3 = new AuctionBidRecord();
+                    one3.setAuctionSalesroomId(bidVO.getAuctionSalesroomId());
+                    one3.setTargetId(bidVO.getTargetId());
+                    one3.setMemberId(bidVO.getMemberId());
+                    if (membeOne.getRealName() != null && membeOne.getRealName() != "") {
+                        one3.setNickname(membeOne.getRealName());
+                    } else {
+                        one3.setNickname(membeOne.getNickname());
+                    }
+                    one3.setPhone(membeOne.getPhone());
+                    one3.setLastBidTime(LocalDateTime.now());
+                    one3.setAuctionType(AuctionOrderTypeEnum.REGULAR_ITEMS);
+                    one3.setStatus(BidStatusEnum.ELIMINATE);
+                    one3.setBidCount(1);
+                    one3.setLastBidAmount(bidVO.getLastBidAmount());
+                    auctionBidRecordService.save(one3);
+                }
+
+                Map<String, Object> map = new ConcurrentHashMap<>();
+                map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM);
+                map.put("auctionSalesroomId", byId.getId());
+                map.put("byId", byId.getStartStatus());
+                map.put("lastBidAmount", one3.getLastBidAmount());
+                map.put("message_type", "BidRecor");
+                map.put("type", 4);
+                String msg = null;
+                try {
+                    msg = objectMapper.writeValueAsString(map);
+                } catch (JsonProcessingException e) {
+                }
+                String finalMsg = msg;
+                sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(finalMsg)
+                        .clientType(ClientTypeEnum.MEMBER).build(), SecurityConstants.INNER);
+
             }
-
-            LambdaQueryWrapper<AuctionBidRecord> wrapper2=Wrappers.lambdaQuery();
-            wrapper2.eq(AuctionBidRecord::getAuctionSalesroomId,bidVO.getAuctionSalesroomId());
-            wrapper2.eq(AuctionBidRecord::getTargetId,bidVO.getTargetId());
-            wrapper2.eq(AuctionBidRecord::getDelFlag,0);
-            wrapper2.orderByDesc(AuctionBidRecord::getLastBidAmount);
-            AuctionBidRecord one2 = auctionBidRecordService.getOne(wrapper1);
-
-            Map<String, Object> map = new ConcurrentHashMap<>();
-            map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM);
-            map.put("auctionSalesroomId", bidVO.getAuctionSalesroomId());
-            map.put("byId", byId.getStartStatus());
-            map.put("lastBidAmount",one2.getLastBidAmount());
-            map.put("message_type", "BidRecor");
-            map.put("type",4);
-            String msg = null;
-            try {
-                msg = objectMapper.writeValueAsString(map);
-            } catch (JsonProcessingException e) {
+        } finally {
+            if (lock.isLocked()) {
+                lock.unlock();
             }
-            String finalMsg = msg;
-            sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(finalMsg)
-                            .clientType(ClientTypeEnum.MEMBER).build(), SecurityConstants.INNER);
-
         }
     }
 
@@ -755,7 +900,8 @@
                 .select(AuctionSalesroom::getId, AuctionSalesroom::getSalesroomName,
                         AuctionSalesroom::getCreateTime, AuctionSalesroom::getStartTime,
                         AuctionSalesroom::getEndTime, AuctionSalesroom::getType,
-                        AuctionSalesroom::getAuthentication, AuctionSalesroom::getStatus)
+                        AuctionSalesroom::getAuthentication, AuctionSalesroom::getStatus,
+                        AuctionSalesroom::getQrCode)
                 .like(StringUtils.isNotEmpty(query.getSalesroomName()),
                         AuctionSalesroom::getSalesroomName, query.getSalesroomName())
                 .eq(StringUtils.isNotNull(query.getAuthentication()),
@@ -778,18 +924,21 @@
         List<MgtAuctionSalesroomVO> list = auctionSalesroomVOPageDTO.getList();
         List<Long> auctionSalesroomIdList = list.stream().map(MgtAuctionSalesroomVO::getId)
                 .collect(Collectors.toList());
-        // 所有拍卖场的拍卖商品
-        List<AuctionSalesroomGoods> auctionSalesroomGoods = auctionSalesroomGoodsMapper.selectList(
-                Wrappers.<AuctionSalesroomGoods>lambdaQuery()
-                        .in(AuctionSalesroomGoods::getAuctionSalesroomId, auctionSalesroomIdList));
-        // 计算每个拍卖场所有拍品数量
-        Map<Long, Integer> map = auctionSalesroomGoods.stream()
-                .collect(Collectors.groupingBy(AuctionSalesroomGoods::getAuctionSalesroomId,
-                        Collectors.summingInt(AuctionSalesroomGoods::getSalesroomStock)));
-        for (MgtAuctionSalesroomVO mgtAuctionSalesroomVO : list) {
-            Integer i = map.get(mgtAuctionSalesroomVO.getId());
-            if (StringUtils.isNotNull(i)) {
-                mgtAuctionSalesroomVO.setAuctionGoodsNum(i);
+        if (StringUtils.isNotEmpty(auctionSalesroomIdList)) {
+            // 所有拍卖场的拍卖商品
+            List<AuctionSalesroomGoods> auctionSalesroomGoods = auctionSalesroomGoodsMapper.selectList(
+                    Wrappers.<AuctionSalesroomGoods>lambdaQuery()
+                            .in(AuctionSalesroomGoods::getAuctionSalesroomId,
+                                    auctionSalesroomIdList));
+            // 计算每个拍卖场所有拍品数量
+            Map<Long, Integer> map = auctionSalesroomGoods.stream()
+                    .collect(Collectors.groupingBy(AuctionSalesroomGoods::getAuctionSalesroomId,
+                            Collectors.summingInt(AuctionSalesroomGoods::getSalesroomStock)));
+            for (MgtAuctionSalesroomVO mgtAuctionSalesroomVO : list) {
+                Integer i = map.get(mgtAuctionSalesroomVO.getId());
+                if (StringUtils.isNotNull(i)) {
+                    mgtAuctionSalesroomVO.setAuctionGoodsNum(i);
+                }
             }
         }
         return auctionSalesroomVOPageDTO;
@@ -804,8 +953,16 @@
     @Override
     public String getQrCode(Long id) throws Exception {
         AuctionSalesroom auctionSalesroom = this.getById(id);
-        String auctionSalesroomNo = auctionSalesroom.getAuctionSalesroomNo();
-        return CreateQrCode.createQRCode(auctionSalesroomNo);
+        if (StringUtils.isBlank(auctionSalesroom.getQrCode())) {
+            AuctionSalesroomQrCodeVO vo = new AuctionSalesroomQrCodeVO();
+            vo.setAuctionSalesroomNo(auctionSalesroom.getAuctionSalesroomNo());
+            vo.setType(auctionSalesroom.getType().getCode());
+            String url = remoteFileService.obsUpload(
+                    CreateQrCode.createQRCodeStream(objectMapper.writeValueAsString(vo))).getData();
+            auctionSalesroom.setQrCode(url);
+            this.updateById(auctionSalesroom);
+        }
+        return auctionSalesroom.getQrCode();
     }
 
     @Override
@@ -840,8 +997,11 @@
             // 生成唯一编号
             Long nextId = IDhelper.getNextId();
             auctionSalesroom.setAuctionSalesroomNo(nextId.toString());
+            AuctionSalesroomQrCodeVO vo = new AuctionSalesroomQrCodeVO();
+            vo.setAuctionSalesroomNo(nextId.toString());
+            vo.setType(auctionSalesroom.getType().getCode());
             String url = remoteFileService.obsUpload(
-                    CreateQrCode.createQRCodeStream(nextId.toString())).getData();
+                    CreateQrCode.createQRCodeStream(objectMapper.writeValueAsString(vo))).getData();
             auctionSalesroom.setQrCode(url);
             // 添加
             this.save(auctionSalesroom);
@@ -865,6 +1025,15 @@
                 throw new ServiceException("该拍卖场已结束,不能编辑");
             }
             auctionSalesroom.setId(auctionSalesroomOrg.getId());
+            if (!auctionSalesroomOrg.getType().equals(auctionSalesroom.getType())) {
+                AuctionSalesroomQrCodeVO vo = new AuctionSalesroomQrCodeVO();
+                vo.setAuctionSalesroomNo(auctionSalesroomOrg.getAuctionSalesroomNo());
+                vo.setType(auctionSalesroom.getType().getCode());
+                String url = remoteFileService.obsUpload(
+                                CreateQrCode.createQRCodeStream(objectMapper.writeValueAsString(vo)))
+                        .getData();
+                auctionSalesroom.setQrCode(url);
+            }
             this.updateById(auctionSalesroom);
             List<AuctionSalesroomGoods> list = auctionSalesroomGoodsMapper.selectList(
                     Wrappers.<AuctionSalesroomGoods>lambdaQuery()
@@ -898,54 +1067,52 @@
     }
 
     @Override
-    public PageDTO<WdMemberAuctionSalesroomVO> getWdAuctionSalesroomList(MemberAuctionSalesroomDTO MemberAuctionSalesroomDTO) {
-        MemberAuctionSalesroomDTO memberAuctionSalesroomDTO =new MemberAuctionSalesroomDTO();
-        memberAuctionSalesroomDTO.setMemberId(MemberAuctionSalesroomDTO.getMemberId());
+    public PageDTO<WdMemberAuctionSalesroomVO> getWdAuctionSalesroomList(
+            MemberAuctionSalesroomDTO memberAuctionSalesroomDTO) {
         List<OrderAuctionBond> data = orderClient.getOrderAuctionBondList1(memberAuctionSalesroomDTO, SecurityConstants.INNER).getData();
+        if (CollUtils.isEmpty(data)) {
+            return PageDTO.empty(0L, 0L);
+        }
         Set<Long> goodsSkuIdList = null;
         goodsSkuIdList = data.stream().map(OrderAuctionBond::getAuctionSalesroomId)
-                    .collect(Collectors.toSet());
-        Page<WdMemberAuctionSalesroomVO> page = new Page<>();
-        page.setSize(memberAuctionSalesroomDTO.getPageSize());
-        page.setCurrent(memberAuctionSalesroomDTO.getPageCurr());
-        MemberAuctionSalesroomWdDTO memberAuctionSalesroomWdDTO=new MemberAuctionSalesroomWdDTO();
+                .collect(Collectors.toSet());
+        Page<AuctionSalesroom> page = new Page<>(memberAuctionSalesroomDTO.getPageCurr(),
+                memberAuctionSalesroomDTO.getPageSize());
+        LambdaQueryWrapper<AuctionSalesroom> wrapper1=Wrappers.lambdaQuery();
         if (goodsSkuIdList.size()>0){
-            memberAuctionSalesroomWdDTO.setGoodsSkuIdList(goodsSkuIdList);
+            wrapper1.in(AuctionSalesroom::getId,goodsSkuIdList);
         }else{
             Set<Long> goodsSkuIdList1 = new HashSet<>();
             goodsSkuIdList1.add(0L);
-            memberAuctionSalesroomWdDTO.setGoodsSkuIdList(goodsSkuIdList1);
+            wrapper1.in(AuctionSalesroom::getId,goodsSkuIdList);
         }
-
-        if(MemberAuctionSalesroomDTO.getStatus()!=4){
-            if (MemberAuctionSalesroomDTO.getStatus()==0){
-                memberAuctionSalesroomWdDTO.setStatus(5);
-            }else{
-                memberAuctionSalesroomWdDTO.setStatus(MemberAuctionSalesroomDTO.getStatus());
-            }
-
+        if (memberAuctionSalesroomDTO.getSalesroomName() != null) {
+            wrapper1.like(AuctionSalesroom::getSalesroomName,
+                    memberAuctionSalesroomDTO.getSalesroomName());
         }
-        List<AuctionSalesroom> auctionSalesroomList=auctionSalesroomMapper.pageMemberAuctionSalesroomWdList(page,memberAuctionSalesroomWdDTO);
-        List<WdMemberAuctionSalesroomVO> List=new ArrayList<>();
-        for (AuctionSalesroom auctionSalesroom:auctionSalesroomList){
-            WdMemberAuctionSalesroomVO  memberAuctionSalesroomVO=new WdMemberAuctionSalesroomVO();
-            memberAuctionSalesroomVO.setSalesroomName(auctionSalesroom.getSalesroomName());
-            memberAuctionSalesroomVO.setDescription(auctionSalesroom.getDescription());
-            memberAuctionSalesroomVO.setStatus(auctionSalesroom.getStatus().getCode());
-            memberAuctionSalesroomVO.setSalesroomId(auctionSalesroom.getId());
-            memberAuctionSalesroomVO.setCoverPic(auctionSalesroom.getCoverPic());
+        wrapper1.eq(AuctionSalesroom::getDelFlag,0);
+        if (memberAuctionSalesroomDTO.getStatus() != 4) {
+            wrapper1.eq(AuctionSalesroom::getStatus, memberAuctionSalesroomDTO.getStatus());
+        }
+        wrapper1.last(memberAuctionSalesroomDTO.getStatus() == 4, "ORDER BY\n"
+                + "    FIELD(status, 1, 0, 2),\n"
+                + "    start_time DESC");
+        wrapper1.last(memberAuctionSalesroomDTO.getStatus() != 4, "ORDER BY start_time DESC");
+        Page<AuctionSalesroom> auctionSalesroomList=this.page(page,wrapper1);
+        PageDTO<WdMemberAuctionSalesroomVO> wdMemberAuctionSalesroomVOPageDTO = PageDTO.of(auctionSalesroomList, WdMemberAuctionSalesroomVO.class);
+        List<WdMemberAuctionSalesroomVO> list = wdMemberAuctionSalesroomVOPageDTO.getList();
+        for (WdMemberAuctionSalesroomVO auctionSalesroom:list){
+            auctionSalesroom.setSalesroomId(auctionSalesroom.getId());
             MemberAuctionSalesroomDTO memberAuctionSalesroomDTO1=new MemberAuctionSalesroomDTO();
             memberAuctionSalesroomDTO1.setAuctionSalesroomId(auctionSalesroom.getId());
-            memberAuctionSalesroomDTO1.setMemberId(MemberAuctionSalesroomDTO.getMemberId());
+            memberAuctionSalesroomDTO1.setMemberId(memberAuctionSalesroomDTO.getMemberId());
+            auctionSalesroom.setIsBond(2);
             List<OrderAuctionBond> data1 = orderClient.getOrderAuctionBondList1(memberAuctionSalesroomDTO1, SecurityConstants.INNER).getData();
             if (data1.size()>0){
-                memberAuctionSalesroomVO.setBondTime(data1.get(0).getCreateTime());
+                auctionSalesroom.setBondTime(data1.get(0).getCreateTime());
             }
-
-            List.add(memberAuctionSalesroomVO);
         }
-        page.setRecords(List);
-        return PageDTO.of(page);
+        return wdMemberAuctionSalesroomVOPageDTO;
 
     }
 
@@ -1017,28 +1184,28 @@
                 .orderByDesc(query.getSortType() == 1, AuctionBidRecord::getLastBidAmount)
                 .orderByDesc(query.getSortType() == 2, AuctionBidRecord::getBidCount)
                 .page(new Page<>(query.getPageCurr(), query.getPageSize()));
-        if (StringUtils.isNull(page.getRecords())) {
+        if (StringUtils.isEmpty(page.getRecords())) {
             return PageDTO.empty(page);
         }
         PageDTO<MgtAuctionBidRecordVO> mgtAuctionBidRecordVOPageDTO = PageDTO.of(page,
                 MgtAuctionBidRecordVO.class);
         List<MgtAuctionBidRecordVO> list = mgtAuctionBidRecordVOPageDTO.getList();
-        Set<Long> goodsIdList = list.stream().map(MgtAuctionBidRecordVO::getGoodsSkuId)
-                .collect(Collectors.toSet());
+
+        AuctionSalesroomGoods auctionSalesroomGoods = auctionSalesroomGoodsMapper.selectById(
+                query.getId());
+
         Set<Long> memberIdList = list.stream().map(MgtAuctionBidRecordVO::getMemberId)
                 .collect(Collectors.toSet());
-        List<GoodsSku> goodsSkuList = goodsSkuClient.getGoodsListByIds(goodsIdList,
+        GoodsSku goodsSku = goodsSkuClient.getGoodsSkuOne(
+                        auctionSalesroomGoods.getGoodsSkuId(),
                         SecurityConstants.INNER)
                 .getData();
         List<Member> memberList = memberClient.getMemberListByIds(memberIdList,
                         SecurityConstants.INNER)
                 .getData();
-        Map<Long, GoodsSku> goodsSkuMap = goodsSkuList.stream()
-                .collect(Collectors.toMap(GoodsSku::getId, Function.identity()));
         Map<Long, Member> memberMap = memberList.stream()
                 .collect(Collectors.toMap(Member::getId, Function.identity()));
         for (MgtAuctionBidRecordVO vo : list) {
-            GoodsSku goodsSku = goodsSkuMap.get(vo.getGoodsSkuId());
             Member member = memberMap.get(vo.getMemberId());
             if (StringUtils.isNotNull(goodsSku)) {
                 vo.setGoodsSkuName(goodsSku.getSkuName());
@@ -1068,11 +1235,10 @@
                         AuctionSalesroom::getSalesroomName, query.getSalesroomName())
                 .eq(StringUtils.isNotNull(query.getStatus()), AuctionSalesroom::getStatus,
                         query.getStatus())
-                .ne(AuctionSalesroom::getStatus, AuctionStartStatusEnum.ENDED)
                 .between(StringUtils.isNotNull(query.getStartTime()) && StringUtils.isNotNull(
                                 query.getEndTime()), AuctionSalesroom::getStartTime, query.getStartTime(),
                         query.getEndTime())
-                .orderByAsc(AuctionSalesroom::getStartTime)
+                .orderByDesc(AuctionSalesroom::getCreateTime)
                 .page(new Page<>(query.getPageCurr(), query.getPageSize()));
         List<AuctionSalesroom> records = page.getRecords();
         if (StringUtils.isNull(records)) {
@@ -1118,7 +1284,9 @@
                 vo.setAuctionSalesroomGoodsVOS(collect);
                 if (StringUtils.isNotNull(vo.getCurrentAuctionSalesroomGoods())) {
                     int index = collect.indexOf(vo.getCurrentAuctionSalesroomGoods());
-                    vo.setNextAuctionSalesroomGoods(collect.get(index + 1));
+                    if (collect.size() > 1 && index < collect.size() - 1) {
+                        vo.setNextAuctionSalesroomGoods(collect.get(index + 1));
+                    }
                     // 分页查询当前拍品出价信息
                     List<AuctionBidRecord> list = auctionBidRecordService.lambdaQuery()
                             .eq(AuctionBidRecord::getTargetId,
@@ -1132,7 +1300,10 @@
                     vo.setMgtAuctionBidRecordVOList(
                             BeanUtils.copyList(list, MgtAuctionBidRecordVO.class));
                 } else {
-                    vo.setNextAuctionSalesroomGoods(collect.get(0));
+                    Optional<MgtAuctionSalesroomGoodsVO> first = collect.stream()
+                            .filter(c -> c.getStatus().equals(AuctionGoodsStatusEnum.WAITING))
+                            .findFirst();
+                    vo.setNextAuctionSalesroomGoods(first.orElse(null));
                 }
             }
         }
@@ -1167,10 +1338,26 @@
                 .eq(AuctionBidRecord::getAuctionType,
                         AuctionOrderTypeEnum.AUCTION_ITEMS)
                 .page(new Page<>(mgtScreenBidPage.getPageCurr(), mgtScreenBidPage.getPageSize()));
-        if (StringUtils.isNotEmpty(page.getRecords())) {
+        if (StringUtils.isEmpty(page.getRecords())) {
             return PageDTO.empty(page);
         }
-        return PageDTO.of(page, MgtAuctionBidRecordVO.class);
+        PageDTO<MgtAuctionBidRecordVO> vo = PageDTO.of(page,
+                MgtAuctionBidRecordVO.class);
+        List<Long> id = vo.getList().stream().map(MgtAuctionBidRecordVO::getMemberId)
+                .collect(Collectors.toList());
+        List<Member> data = memberClient.getMemberListByIds(id, SecurityConstants.INNER).getData();
+        if (CollUtils.isNotEmpty(data)) {
+            Map<Long, Member> memberMap = data.stream()
+                    .collect(Collectors.toMap(Member::getId, e -> e));
+            vo.getList().forEach(item -> {
+                Member member = memberMap.get(item.getMemberId());
+                if (StringUtils.isNotNull(member)) {
+                    item.setMemberName(member.getNickname());
+                    item.setPhone(member.getPhone());
+                }
+            });
+        }
+        return vo;
     }
 
     /**
@@ -1212,8 +1399,8 @@
     public PageDTO<MgtAuctionSalesroomGoodsVO> backupGoods(MgtAuctionSalesroomGoodsQuery query) {
         Page<AuctionSalesroomGoods> page = new Page<>(query.getPageCurr(), query.getPageSize());
         Set<Long> goodsSkuIdSet = null;
-        if (StringUtils.isNotBlank(query.getGoodsName())) {
-            List<GoodsSku> data = goodsSkuClient.getGoodsByName(query.getGoodsName(),
+        if (StringUtils.isNotBlank(query.getGoodsSkuName())) {
+            List<GoodsSku> data = goodsSkuClient.getGoodsByName(query.getGoodsSkuName(),
                     SecurityConstants.INNER).getData();
             if (StringUtils.isNotEmpty(data)) {
                 goodsSkuIdSet = data.stream().map(GoodsSku::getId)
@@ -1276,23 +1463,138 @@
      */
     @Override
     public void stopCurrentGoods(Long id) throws JsonProcessingException {
-        AuctionSalesroomGoods auctionSalesroomGoods = auctionSalesroomGoodsMapper.selectById(id);
-        if (StringUtils.isNull(auctionSalesroomGoods)) {
-            throw new ServiceException("拍卖商品不存在");
+        RLock lock = redissonClient.getLock("stopCurrentGoods" + id);
+        lock.lock(10, TimeUnit.SECONDS);
+        try {
+            AuctionSalesroomGoods auctionSalesroomGoods = auctionSalesroomGoodsMapper.selectById(
+                    id);
+            if (StringUtils.isNull(auctionSalesroomGoods)) {
+                throw new ServiceException("拍卖商品不存在");
+            }
+            if (auctionSalesroomGoods.getStatus().equals(AuctionGoodsStatusEnum.IN_PROGRESS)) {
+                AuctionSalesroom auctionSalesroom = this.getById(
+                        auctionSalesroomGoods.getAuctionSalesroomId());
+                auctionSalesroomGoods.setStatus(AuctionGoodsStatusEnum.ENDED);
+                auctionSalesroomGoodsMapper.updateById(auctionSalesroomGoods);
+                List<AuctionBidRecord> auctionBidRecordList = auctionBidRecordMapper.selectList(
+                        Wrappers.lambdaQuery(AuctionBidRecord.class)
+                                .eq(AuctionBidRecord::getAuctionSalesroomId,
+                                        auctionSalesroomGoods.getAuctionSalesroomId())
+                                .eq(AuctionBidRecord::getTargetId, auctionSalesroomGoods.getId())
+                                .eq(AuctionBidRecord::getAuctionType,
+                                        AuctionOrderTypeEnum.AUCTION_ITEMS)
+                                .orderByDesc(AuctionBidRecord::getLastBidAmount)
+                                .orderByAsc(AuctionBidRecord::getLastBidTime));
+                if (CollUtils.isNotEmpty(auctionBidRecordList)) {
+                    List<AuctionBidRecord> auctionBidRecords = new ArrayList<>();
+                    if (auctionBidRecordList.size() >= auctionSalesroomGoods.getSalesroomStock()) {
+                        for (int i = 0; i < auctionSalesroomGoods.getSalesroomStock(); i++) {
+                            AuctionBidRecord auctionBidRecord = auctionBidRecordList.get(i);
+                            auctionBidRecord.setStatus(BidStatusEnum.SUCCESSFUL);
+                            auctionBidRecordMapper.updateById(auctionBidRecord);
+                            auctionBidRecords.add(auctionBidRecord);
+                        }
+                    } else {
+                        for (int i = 0; i < auctionBidRecordList.size(); i++) {
+                            AuctionBidRecord auctionBidRecord = auctionBidRecordList.get(i);
+                            auctionBidRecord.setStatus(BidStatusEnum.SUCCESSFUL);
+                            auctionBidRecordMapper.updateById(auctionBidRecord);
+                            auctionBidRecords.add(auctionBidRecord);
+                        }
+                        // 没有出价记录,回退库存
+                        GoodsStockUpdDTO goodsStockUpdDTO = new GoodsStockUpdDTO();
+                        goodsStockUpdDTO.setGoodsSkuId(auctionSalesroomGoods.getGoodsSkuId());
+                        goodsStockUpdDTO.setAuctionStock(
+                                auctionSalesroomGoods.getSalesroomStock()
+                                        - auctionBidRecordList.size());
+                        goodsSkuClient.updGoodsStock(Lists.newArrayList(goodsStockUpdDTO),
+                                SecurityConstants.INNER);
+                    }
+                    for (AuctionBidRecord auctionBidRecord : auctionBidRecords) {
+                        addOrder(auctionBidRecord.getTargetId(), auctionBidRecord.getMemberId(),
+                                auctionBidRecord.getLastBidAmount(),
+                                auctionSalesroom.getBond());
+                    }
+                } else {
+                    // 没有出价记录,回退库存
+                    GoodsStockUpdDTO goodsStockUpdDTO = new GoodsStockUpdDTO();
+                    goodsStockUpdDTO.setGoodsSkuId(auctionSalesroomGoods.getGoodsSkuId());
+                    goodsStockUpdDTO.setAuctionStock(
+                            auctionSalesroomGoods.getSalesroomStock());
+                    goodsSkuClient.updGoodsStock(Lists.newArrayList(goodsStockUpdDTO),
+                            SecurityConstants.INNER);
+                }
+                Map<String, Object> map = new ConcurrentHashMap<>();
+                map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM_GOODS);
+                map.put("auctionSalesroomId",
+                        auctionSalesroomGoods.getAuctionSalesroomId().toString());
+                map.put("auctionSalesroomGoodsId", auctionSalesroomGoods.getId().toString());
+                map.put("AuctionTypeEnum", auctionSalesroomGoods.getStatus());
+                map.put("message_type", "stop");
+                map.put("type", "2");
+                String msg = objectMapper.writeValueAsString(map);
+                sysUserClient.pushAll(msg, SecurityConstants.INNER);
+            }
+        } finally {
+            if (lock.isLocked()) {
+                lock.unlock();
+            }
         }
-        auctionSalesroomGoods.setStatus(AuctionGoodsStatusEnum.ENDED);
-        auctionSalesroomGoodsMapper.updateById(auctionSalesroomGoods);
-        Map<String, Object> map = new ConcurrentHashMap<>();
-        map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM_GOODS);
-        map.put("auctionSalesroomId", auctionSalesroomGoods.getAuctionSalesroomId().toString());
-        map.put("auctionSalesroomGoodsId", auctionSalesroomGoods.getId().toString());
-        map.put("AuctionTypeEnum", auctionSalesroomGoods.getStatus());
-        map.put("message_type", "stop");
-        map.put("type", "2");
-        String msg = objectMapper.writeValueAsString(map);
-        sysUserClient.pushAll(msg, SecurityConstants.INNER);
     }
 
+    public void addOrder(Long goodsSkuId, Long memberId, BigDecimal lastBidAmount,
+            BigDecimal bound) {
+        OrderDTO order = new OrderDTO();
+        order.setGoodsSkuId(goodsSkuId);
+        order.setOrderTime(LocalDateTime.now());
+        order.setOrderFrom(OrderFromEnum.AUCTION_ORDERS);
+        order.setMemberId(memberId);
+        AuctionSalesroomGoods auctionSalesroomGoods = auctionSalesroomGoodsMapper.selectById(
+                goodsSkuId);
+
+        order.setGoodsQuantity(1);
+        order.setTotalAmount(lastBidAmount);
+        order.setAuctionSalesroomId(auctionSalesroomGoods.getAuctionSalesroomId());
+
+        R<MemberAddress> memberAddressR = memberClient.getMemberAddressOne(memberId,
+                SecurityConstants.INNER);
+        MemberAddress memberAddress = memberAddressR.getData();
+
+        CustomConfig memberPointsMoney = sysUserClient.getconfig(
+                ConfigEnum.MEMBER_POINTS_MONEY.getKey()).getData();
+        CustomConfig memberPointsPoints = sysUserClient.getconfig(
+                        ConfigEnum.MEMBER_POINTS_POINTS.getKey())
+                .getData();
+
+        if (lastBidAmount.compareTo(BigDecimal.ZERO) > 0) {
+            BigDecimal divide = lastBidAmount.divide(
+                    new BigDecimal(memberPointsMoney.getConfigValue()), 0,
+                    RoundingMode.DOWN);
+            int points = divide.multiply(
+                    new BigDecimal(memberPointsPoints.getConfigValue())).intValue();
+            order.setPoints(points);
+        } else {
+            order.setPoints(0);
+        }
+
+        if (memberAddress != null) {
+            order.setReceiverCity(memberAddress.getCity());
+            order.setReceiverDetailAddress(memberAddress.getDetailedAddress());
+            order.setReceiverphone(memberAddress.getRecipientPhone());
+            order.setReceiverName(memberAddress.getRecipientName());
+        }
+
+        order.setBound(bound);
+        order.setAuctionType(AuctionOrderTypeEnum.AUCTION_ITEMS);
+        GoodsSku goodsSku = goodsSkuClient.getGoodsSkuOne(auctionSalesroomGoods.getGoodsSkuId(),
+                        SecurityConstants.INNER)
+                .getData();
+        order.setSkuName(goodsSku.getSkuName());
+        order.setCoverPic(goodsSku.getCoverPic());
+        order.setPrice(lastBidAmount);
+        order.setGoodsId(auctionSalesroomGoods.getGoodsSkuId());
+        orderClient.saveOrderOne(order, SecurityConstants.INNER);
+    }
     /**
      * 开始下一拍卖商品
      *
@@ -1305,6 +1607,7 @@
             throw new ServiceException("拍卖商品不存在");
         }
         auctionSalesroomGoods.setStatus(AuctionGoodsStatusEnum.IN_PROGRESS);
+        auctionSalesroomGoods.setStartTime(LocalDateTime.now());
         auctionSalesroomGoodsMapper.updateById(auctionSalesroomGoods);
         Map<String, Object> map = new ConcurrentHashMap<>();
         map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM_GOODS);
@@ -1381,8 +1684,7 @@
         map.put("message_type", "start");
         map.put("type", "1");
         String msg = objectMapper.writeValueAsString(map);
-        sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(msg)
-                .clientType(ClientTypeEnum.AUCTIONEER).build(), SecurityConstants.INNER);
+        sysUserClient.pushAll(msg, SecurityConstants.INNER);
     }
 
     @Override
@@ -1391,7 +1693,6 @@
     public void stopCurrentAuctionSalesroom(Long auctionSalesroomId)
             throws JsonProcessingException {
         LambdaQueryWrapper<AuctionSalesroomGoods> wrapper = Wrappers.lambdaQuery();
-        wrapper.eq(AuctionSalesroomGoods::getStatus, AuctionGoodsStatusEnum.WAITING);
         wrapper.eq(AuctionSalesroomGoods::getAuctionSalesroomId, auctionSalesroomId);
         wrapper.orderByDesc(AuctionSalesroomGoods::getSortNum);
         List<AuctionSalesroomGoods> auctionSalesroomGoods = auctionSalesroomGoodsMapper.selectList(
@@ -1407,11 +1708,14 @@
         auctionSalesroom.setStatus(AuctionStartStatusEnum.ENDED);
         auctionSalesroom.setEndTime(LocalDateTime.now());
         auctionSalesroomMapper.updateById(auctionSalesroom);
-
+        auctionSalesroomGoods = auctionSalesroomGoods.stream()
+                .filter(goods -> goods.getStatus().equals(AuctionGoodsStatusEnum.WAITING)).collect(
+                        Collectors.toList());
         if (StringUtils.isNotEmpty(auctionSalesroomGoods)) {
             List<GoodsStockUpdDTO> dtoList = new ArrayList<>();
             for (AuctionSalesroomGoods salesroomGoods : auctionSalesroomGoods) {
                 salesroomGoods.setStatus(AuctionGoodsStatusEnum.ENDED);
+                // 等待中的商品退库存
                 GoodsStockUpdDTO goodsStockUpdDTO = new GoodsStockUpdDTO();
                 goodsStockUpdDTO.setGoodsSkuId(salesroomGoods.getGoodsSkuId());
                 goodsStockUpdDTO.setAuctionStock(salesroomGoods.getSalesroomStock());
@@ -1425,15 +1729,17 @@
         List<AuctionBidRecord> auctionBidRecordList = auctionBidRecordMapper.selectList(
                 Wrappers.<AuctionBidRecord>lambdaQuery()
                         .eq(AuctionBidRecord::getAuctionSalesroomId, auctionSalesroomId)
-                        .eq(AuctionBidRecord::getStatus, BidStatusEnum.ELIMINATE));
-        List<Long> memberIdlist = auctionBidRecordList.stream().map(AuctionBidRecord::getMemberId)
-                .collect(Collectors.toList());
-        if (StringUtils.isNotEmpty(memberIdlist)) {
-            OrderAuctionBondDTO orderAuctionBondDTO = new OrderAuctionBondDTO();
-            orderAuctionBondDTO.setAuctionSalesroomId(auctionSalesroom.getId());
-            orderAuctionBondDTO.setUserList(memberIdlist);
-            orderClient.getOrderAuctionBond(orderAuctionBondDTO, SecurityConstants.INNER);
+                        .eq(AuctionBidRecord::getStatus, BidStatusEnum.SUCCESSFUL));
+        log.info("拍卖场{},已中标的用户:{}", auctionSalesroomId, auctionBidRecordList);
+        Set<Long> memberIdList = new HashSet<>();
+        if (CollUtils.isNotEmpty(auctionBidRecordList)) {
+            memberIdList = auctionBidRecordList.stream().map(AuctionBidRecord::getMemberId)
+                    .collect(Collectors.toSet());
         }
+        OrderAuctionBondDTO orderAuctionBondDTO = new OrderAuctionBondDTO();
+        orderAuctionBondDTO.setAuctionSalesroomId(auctionSalesroom.getId());
+        orderAuctionBondDTO.setUserList(memberIdList);
+        orderClient.getOrderAuctionBond(orderAuctionBondDTO, SecurityConstants.INNER);
         Map<String, Object> map = new ConcurrentHashMap<>();
         map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM);
         map.put("auctionSalesroomId", auctionSalesroom.getId().toString());
@@ -1441,8 +1747,7 @@
         map.put("message_type", "end");
         map.put("type", "1");
         String msg = objectMapper.writeValueAsString(map);
-        sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(msg)
-                .clientType(ClientTypeEnum.AUCTIONEER).build(), SecurityConstants.INNER);
+        sysUserClient.pushAll(msg, SecurityConstants.INNER);
     }
 
     @Override
@@ -1456,4 +1761,53 @@
                         Collectors.toSet());
         return this.listByIds(auctionSalesroomIdSet);
     }
+
+    /**
+     * 根据商品id获取正在进行的拍卖会
+     *
+     * @param id 商品id
+     * @return
+     */
+    @Override
+    public List<AuctionSalesroom> getAuctionSalesroomBySkuId(Long id) {
+        List<AuctionSalesroomGoods> auctionSalesroomGoods = auctionSalesroomGoodsMapper.selectList(
+                new LambdaQueryWrapper<AuctionSalesroomGoods>().eq(
+                                AuctionSalesroomGoods::getGoodsSkuId, id)
+                        .groupBy(AuctionSalesroomGoods::getAuctionSalesroomId));
+        if (CollUtils.isNotEmpty(auctionSalesroomGoods)) {
+            Set<Long> auctionSalesroomIdSet = auctionSalesroomGoods.stream()
+                    .map(AuctionSalesroomGoods::getAuctionSalesroomId).collect(
+                            Collectors.toSet());
+            return this.lambdaQuery()
+                    .eq(AuctionSalesroom::getStatus, AuctionStartStatusEnum.IN_AUCTION).in(
+                            AuctionSalesroom::getId, auctionSalesroomGoods).list();
+        }
+        return CollUtils.emptyList();
+    }
+
+    @Override
+    public AuctionSalesroomGoods getAuctionSalesroomGoodsById(Long goodsSkuId) {
+        return auctionSalesroomGoodsMapper.selectById(goodsSkuId);
+    }
+
+    @Override
+    public AuctionBondJl getAuctionBondJLBySalesroomId(Long targetId, Long memberId,
+            Integer bondType) {
+        return auctionBondJlMapper.selectOne(
+                Wrappers.lambdaQuery(AuctionBondJl.class).eq(AuctionBondJl::getMemberId, memberId)
+                        .eq(AuctionBondJl::getAuctionSalesroomId, targetId)
+                        .eq(AuctionBondJl::getBondType, bondType)
+                        .last("limit 1"));
+    }
+
+    @Override
+    public List<GoodsSku> getGoodsSkuByAuctionSalesroomGoodsSet(
+            Set<Long> auctionSalesroomGoodsSet) {
+        List<AuctionSalesroomGoods> auctionSalesroomGoodsList = auctionSalesroomGoodsMapper.selectBatchIds(
+                auctionSalesroomGoodsSet);
+        Set<Long> goodsSkuIdSet = auctionSalesroomGoodsList.stream()
+                .map(AuctionSalesroomGoods::getGoodsSkuId).collect(
+                        Collectors.toSet());
+        return goodsSkuClient.getGoodsListByIds(goodsSkuIdSet, SecurityConstants.INNER).getData();
+    }
 }

--
Gitblit v1.7.1