From dba9034024de73ebf8d1184b53ec9a559c1c12c6 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期四, 13 三月 2025 18:08:33 +0800
Subject: [PATCH] bug修改

---
 ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/controller/forepart/ForepartAuctionSalesroomController.java |  131 +++++++++++++++++++++++++++++++------------
 1 files changed, 94 insertions(+), 37 deletions(-)

diff --git a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/controller/forepart/ForepartAuctionSalesroomController.java b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/controller/forepart/ForepartAuctionSalesroomController.java
index 72492c2..649b2eb 100644
--- a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/controller/forepart/ForepartAuctionSalesroomController.java
+++ b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/controller/forepart/ForepartAuctionSalesroomController.java
@@ -1,40 +1,48 @@
 package com.ruoyi.auction.controller.forepart;
 
 
+import cn.hutool.core.date.DatePattern;
+import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.ruoyi.auction.domain.AuctionBidRecord;
-import com.ruoyi.auction.domain.AuctionBondJl;
+import com.google.common.collect.Lists;
 import com.ruoyi.auction.mapper.AuctionBondJlMapper;
 import com.ruoyi.auction.mapper.AuctionGoodsMapper;
-import com.ruoyi.auction.service.IAuctionGoodsService;
-import com.ruoyi.common.core.constant.SecurityConstants;
-import com.ruoyi.common.core.enums.BidStatusEnum;
-import com.ruoyi.common.core.enums.BondStatusEnum;
-import com.ruoyi.common.core.exception.ServiceException;
-import com.ruoyi.system.api.domain.AuctionGoods;
-import com.ruoyi.system.api.domain.OrderAuctionBond;
-import com.ruoyi.system.api.domain.dto.*;
 import com.ruoyi.auction.service.IAuctionSalesroomGoodsService;
+import com.ruoyi.auction.service.IAuctionSalesroomService;
+import com.ruoyi.common.core.constant.SecurityConstants;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.common.core.exception.ServiceException;
+import com.ruoyi.common.core.utils.page.PageDTO;
+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.Member;
+import com.ruoyi.system.api.domain.dto.AppMiniLoginDTO;
+import com.ruoyi.system.api.domain.dto.AuctionSalesroomDTO;
+import com.ruoyi.system.api.domain.dto.ForepartAuctionBidRecordDTO;
+import com.ruoyi.system.api.domain.dto.MemberAuctionSalesroomBondDTO;
+import com.ruoyi.system.api.domain.dto.MemberAuctionSalesroomDTO;
+import com.ruoyi.system.api.domain.dto.SmsSendDTO;
 import com.ruoyi.system.api.domain.vo.ForepartAuctionSalesroomVO;
 import com.ruoyi.system.api.domain.vo.MemberAuctionSalesroomInfoVO;
 import com.ruoyi.system.api.domain.vo.MemberAuctionSalesroomVO;
-import com.ruoyi.system.api.domain.AuctionSalesroom;
-import com.ruoyi.auction.service.IAuctionSalesroomService;
-import com.ruoyi.common.core.domain.R;
-import com.ruoyi.common.core.utils.page.PageDTO;
-import com.ruoyi.system.api.domain.AppMiniLoginVO;
 import com.ruoyi.system.api.domain.vo.PayInfoVO;
 import com.ruoyi.system.api.domain.vo.WdMemberAuctionSalesroomVO;
+import com.ruoyi.system.api.feignClient.AuthClient;
+import com.ruoyi.system.api.feignClient.MemberClient;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import javax.annotation.Resource;
-
-import org.springframework.web.bind.annotation.*;
-
-import java.time.LocalDateTime;
-import java.util.ArrayList;
+import java.math.BigDecimal;
 import java.util.List;
+import java.util.Objects;
+import javax.annotation.Resource;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 /**
  * <p>
@@ -44,6 +52,7 @@
  * @author mitao
  * @since 2024-05-16
  */
+@Slf4j
 @RestController
 @RequestMapping("/forepart/auction-salesroom")
 @Api(value = "拍卖场相关接口", tags = "拍卖场相关接口", description = "拍卖场相关接口")
@@ -61,6 +70,10 @@
 
     @Resource
     private AuctionBondJlMapper  auctionBondJlMapper;
+    @Resource
+    private AuthClient authClient;
+    @Resource
+    private MemberClient memberClient;
 
     /**
      * 拍卖大屏获取拍卖信息
@@ -123,32 +136,76 @@
    @PostMapping("/SaveSignUpNow")
     @ApiOperation(value = "用户端-拍卖立即报名")
     public R<PayInfoVO> SaveSignUpNow(@RequestBody MemberAuctionSalesroomBondDTO memberAuctionSalesroomBondDTO) {
-      if (memberAuctionSalesroomBondDTO.getBondType()==1){
+       log.info("=================================开始拍卖报名=================================");
+       String startTime = "";
+       if (memberAuctionSalesroomBondDTO.getBondType() == 1) {
           AuctionGoods auctionGoods = AuctionGoodsMapper.selectById(memberAuctionSalesroomBondDTO.getAuctionGoodsId());
           if (auctionGoods.getListingStatus().getCode()==1){
               throw new ServiceException("商品拍卖下线");
           }
+           startTime = DateUtil.format(auctionGoods.getStartTime(),
+                   DatePattern.NORM_DATETIME_PATTERN);
+           LambdaQueryWrapper<AuctionBondJl> wrapper = Wrappers.lambdaQuery();
+           wrapper.eq(AuctionBondJl::getAuctionGoodsId,
+                   memberAuctionSalesroomBondDTO.getAuctionGoodsId());
+           wrapper.eq(AuctionBondJl::getMemberId, memberAuctionSalesroomBondDTO.getMemberId());
+           wrapper.eq(AuctionBondJl::getIsState, 0);
+           AuctionBondJl auctionBondJl = auctionBondJlMapper.selectOne(wrapper);
+           if (Objects.nonNull(auctionBondJl)) {
+               throw new ServiceException("你已报名");
+           }
+           log.info("auctionGoods:{}", auctionGoods);
+           if (auctionGoods.getBond() == null
+                   || auctionGoods.getBond().compareTo(BigDecimal.ZERO) == 0) {
+               auctionBondJl = new AuctionBondJl();
+               auctionBondJl.setAuctionGoodsId(memberAuctionSalesroomBondDTO.getAuctionGoodsId());
+               auctionBondJl.setIsState(0);
+               auctionBondJl.setBondType(memberAuctionSalesroomBondDTO.getBondType());
+               auctionBondJl.setMemberId(memberAuctionSalesroomBondDTO.getMemberId());
+               auctionBondJlMapper.insert(auctionBondJl);
+           }
       }else{
           AuctionSalesroom byId = iAuctionSalesroomService.getById(memberAuctionSalesroomBondDTO.getAuctionSalesroomId());
           if(byId==null){
-              LambdaQueryWrapper<AuctionSalesroom> wrapper= Wrappers.lambdaQuery();
-              wrapper.eq(AuctionSalesroom::getAuctionSalesroomNo,memberAuctionSalesroomBondDTO.getAuctionSalesroomId());
-              wrapper.eq(AuctionSalesroom::getDelFlag,0);
-              byId =iAuctionSalesroomService.getOne(wrapper);
-              memberAuctionSalesroomBondDTO.setAuctionSalesroomId(byId.getId());
+              LambdaQueryWrapper<AuctionSalesroom> auctionSalesroomWrapper = Wrappers.lambdaQuery();
+              auctionSalesroomWrapper.eq(AuctionSalesroom::getAuctionSalesroomNo,
+                      memberAuctionSalesroomBondDTO.getAuctionSalesroomId());
+              auctionSalesroomWrapper.eq(AuctionSalesroom::getDelFlag, 0);
+              byId = iAuctionSalesroomService.getOne(auctionSalesroomWrapper);
           }
+           startTime = DateUtil.format(byId.getStartTime(),
+                   DatePattern.NORM_DATETIME_PATTERN);
+           memberAuctionSalesroomBondDTO.setAuctionSalesroomId(byId.getId());
+           LambdaQueryWrapper<AuctionBondJl> wrapper = Wrappers.lambdaQuery();
+           wrapper.eq(AuctionBondJl::getAuctionSalesroomId,
+                   memberAuctionSalesroomBondDTO.getAuctionSalesroomId());
+           wrapper.eq(AuctionBondJl::getMemberId, memberAuctionSalesroomBondDTO.getMemberId());
+           wrapper.eq(AuctionBondJl::getIsState, 0);
+           AuctionBondJl auctionBondJl = auctionBondJlMapper.selectOne(wrapper);
+           if (Objects.nonNull(auctionBondJl)) {
+               throw new ServiceException("你已报名");
+           }
+           log.info("AuctionSalesroom:{}", byId);
+           if (byId.getBond() == null || byId.getBond().compareTo(BigDecimal.ZERO) == 0) {
+               auctionBondJl = new AuctionBondJl();
+               auctionBondJl.setAuctionSalesroomId(
+                       memberAuctionSalesroomBondDTO.getAuctionSalesroomId());
+               auctionBondJl.setIsState(0);
+               auctionBondJl.setBondType(memberAuctionSalesroomBondDTO.getBondType());
+               auctionBondJl.setMemberId(memberAuctionSalesroomBondDTO.getMemberId());
+               auctionBondJlMapper.insert(auctionBondJl);
+           }
       }
 
-       AuctionBondJl auctionBondJl=new AuctionBondJl();
-       auctionBondJl.setAuctionGoodsId(memberAuctionSalesroomBondDTO.getAuctionGoodsId());
-       auctionBondJl.setAuctionSalesroomId(memberAuctionSalesroomBondDTO.getAuctionSalesroomId());
-       auctionBondJl.setIsState(0);
-       auctionBondJl.setBondType(memberAuctionSalesroomBondDTO.getBondType());
-       auctionBondJl.setMemberId(memberAuctionSalesroomBondDTO.getMemberId());
-       auctionBondJlMapper.insert(auctionBondJl);
-
-
        PayInfoVO payInfoVO = iAuctionSalesroomService.SaveSignUpNow(memberAuctionSalesroomBondDTO);
+       R<Member> membeOne = memberClient.getMembeOne(memberAuctionSalesroomBondDTO.getMemberId(),
+               SecurityConstants.INNER);
+       authClient.sendSms(
+               SmsSendDTO.builder().mobileList(Lists.newArrayList(membeOne.getData().getPhone()))
+                       .content(String.format("【酒鼎老酒】报名成功,拍卖将于%s开始,请注意时间!",
+                               startTime))
+                       .build(),
+               SecurityConstants.INNER);
 
        return R.ok(payInfoVO);
     }
@@ -188,7 +245,7 @@
            auctionSalesroom.setIsState(1);
            auctionBondJlMapper.updateById(auctionSalesroom);
        }
-        return R.ok( );
+       return R.ok();
     }
 
     /**

--
Gitblit v1.7.1