| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.auction.controller.forepart.dto.AuctionSalesroomGoodsDTO; |
| | | import com.ruoyi.auction.controller.forepart.dto.ForepartAuctionBidRecordDTO; |
| | | import com.ruoyi.common.core.enums.AuctionOrderTypeEnum; |
| | | import com.ruoyi.common.core.enums.BidStatusEnum; |
| | | import com.ruoyi.system.api.domain.*; |
| | | import com.ruoyi.system.api.domain.dto.BidVO; |
| | | import com.ruoyi.system.api.domain.dto.MemberAuctionSalesroomBondDTO; |
| | | import com.ruoyi.system.api.domain.dto.MemberAuctionSalesroomDTO; |
| | | import com.ruoyi.auction.controller.forepart.vo.ForepartAuctionSalesroomGoodsVO; |
| | |
| | | import com.ruoyi.system.api.domain.dto.AppMiniLoginDTO; |
| | | import com.ruoyi.system.api.domain.vo.PayInfoVO; |
| | | import com.ruoyi.system.api.feignClient.GoodsSkuClient; |
| | | import com.ruoyi.system.api.feignClient.MemberClient; |
| | | import com.ruoyi.system.api.feignClient.OrderClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import javax.annotation.Resource; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | private AuctionSalesroomGoodsMapper auctionSalesroomGoodsMapper; |
| | | |
| | | @Resource |
| | | private IAuctionSalesroomGoodsService auctionSalesroomGoodsService; |
| | | |
| | | @Resource |
| | | private IAuctionGoodsService auctionGoodsService; |
| | | |
| | | @Resource |
| | | private GoodsSkuClient goodsSkuClient; |
| | | |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | @Resource |
| | | private MemberClient memberClient; |
| | | |
| | | |
| | | //微信 |
| | |
| | | return orderClient.SaveOrderAuctionBond(memberAuctionSalesroomBondDTO,SecurityConstants.INNER).getData(); |
| | | } |
| | | |
| | | @Override |
| | | public void SaveBid(BidVO bidVO) { |
| | | Member membeOne = memberClient.getMembeOne(bidVO.getMemberId(), SecurityConstants.INNER).getData(); |
| | | if (bidVO.getAuctionType()==2){ |
| | | AuctionSalesroomGoods byId = auctionSalesroomGoodsService.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::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("出价不能比上次出价加每次最少加价低"); |
| | | } |
| | | 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.setAuctionType(AuctionOrderTypeEnum.AUCTION_ITEMS); |
| | | one.setStatus(BidStatusEnum.ELIMINATE); |
| | | one.setBidCount(1); |
| | | one.setLastBidAmount(bidVO.getLastBidAmount()); |
| | | auctionBidRecordService.save(one); |
| | | } |
| | | |
| | | |
| | | }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("出价不能比上次出价加每次最少加价低"); |
| | | } |
| | | 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.setAuctionType(AuctionOrderTypeEnum.REGULAR_ITEMS); |
| | | one.setStatus(BidStatusEnum.ELIMINATE); |
| | | one.setBidCount(1); |
| | | one.setLastBidAmount(bidVO.getLastBidAmount()); |
| | | auctionBidRecordService.save(one); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | public static String getAccessTokenByWX() throws Exception { |
| | | String host = ACCESS_TOKEN_HOST + "?appid=" + WX_APPID + "&secret=" + WX_SECRET + "&grant_type=client_credential"; |