| | |
| | | package com.ruoyi.auction.service.impl; |
| | | |
| | | import com.ruoyi.auction.domain.pojo.AuctionSalesroomGoods; |
| | | import com.ruoyi.auction.mapper.AuctionSalesroomGoodsMapper; |
| | | import com.ruoyi.auction.service.IAuctionSalesroomGoodsService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | 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.ruoyi.auction.service.IAuctionSalesroomService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.enums.AuctionOrderTypeEnum; |
| | | import com.ruoyi.common.core.enums.AuctionStartStatusEnum; |
| | | import com.ruoyi.common.core.enums.BidStatusEnum; |
| | | import com.ruoyi.common.core.enums.OrderFromEnum; |
| | | import com.ruoyi.system.api.domain.GoodsSku; |
| | | import com.ruoyi.system.api.domain.MemberAddress; |
| | | import com.ruoyi.system.api.domain.dto.OrderAuctionBondDTO; |
| | | import com.ruoyi.system.api.feignClient.GoodsSkuClient; |
| | | import com.ruoyi.system.api.feignClient.MemberClient; |
| | | import com.ruoyi.system.api.feignClient.OrderClient; |
| | | 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; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Service |
| | | public class AuctionSalesroomGoodsServiceImpl extends ServiceImpl<AuctionSalesroomGoodsMapper, AuctionSalesroomGoods> implements IAuctionSalesroomGoodsService { |
| | | @Resource |
| | | private GoodsSkuClient goodsSkuClient; |
| | | |
| | | @Resource |
| | | private IAuctionSalesroomService iAuctionSalesroomService; |
| | | |
| | | @Resource |
| | | private IAuctionSalesroomGoodsService iAuctionSalesroomGoodsService; |
| | | |
| | | @Resource |
| | | private IAuctionBidRecordService iAuctionBidRecordService; |
| | | |
| | | @Resource |
| | | private MemberClient emberClient; |
| | | |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | |
| | | |
| | | /** |
| | | * 拍卖大屏的商品介绍 |
| | | * |
| | | */ |
| | | @Override |
| | | public ForepartAuctionSalesroomGoodsVO getAuctionSalesroomGoods(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) { |
| | | ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO =new ForepartAuctionSalesroomGoodsVO(); |
| | | 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,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,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper1.orderByAsc(AuctionSalesroomGoods::getSortNum); |
| | | wrapper1.last("limit 1"); |
| | | auctionSalesroomGoods=iAuctionSalesroomGoodsService.getOne(wrapper1); |
| | | if (auctionSalesroomGoods==null){ |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery(); |
| | | wrapper2.eq(AuctionSalesroomGoods::getStatus,0); |
| | | wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper2.orderByAsc(AuctionSalesroomGoods::getSortNum); |
| | | wrapper2.last("limit 1"); |
| | | auctionSalesroomGoods=iAuctionSalesroomGoodsService.getOne(wrapper2); |
| | | } |
| | | } |
| | | |
| | | forepartAuctionSalesroomGoodsVO.setGoodsSkuId(auctionSalesroomGoods.getGoodsSkuId()); |
| | | forepartAuctionSalesroomGoodsVO.setGoodsSkuName(auctionSalesroomGoods.getGoodsSkuName()); |
| | | forepartAuctionSalesroomGoodsVO.setGoodsSkustatus(auctionSalesroomGoods.getStatus().getCode()); |
| | | forepartAuctionSalesroomGoodsVO.setStartingPrice(auctionSalesroomGoods.getStartingPrice()); |
| | | forepartAuctionSalesroomGoodsVO.setItemQuantity(auctionSalesroomGoods.getItemQuantity()); |
| | | forepartAuctionSalesroomGoodsVO.setListingDuration(auctionSalesroomGoods.getListingDuration()); |
| | | forepartAuctionSalesroomGoodsVO.setStartTime(auctionSalesroomGoods.getStartTime()); |
| | | R<GoodsSku> goodsSkuOne = goodsSkuClient.getGoodsSkuOne(auctionSalesroomGoods.getGoodsSkuId()); |
| | | GoodsSku goodsSku=goodsSkuOne.getData(); |
| | | forepartAuctionSalesroomGoodsVO.setCoverPic(goodsSku.getCoverPic()); |
| | | forepartAuctionSalesroomGoodsVO.setDescription(goodsSku.getDescription()); |
| | | forepartAuctionSalesroomGoodsVO.setUnit(goodsSku.getUnit()); |
| | | if (auctionSalesroomGoods.getStatus().getCode()==0 || auctionSalesroomGoods.getStatus().getCode()==2){ |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper1=Wrappers.lambdaQuery(); |
| | | wrapper1.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper1.eq(AuctionSalesroomGoods::getSortNum,auctionSalesroomGoods.getSortNum()+1); |
| | | wrapper1.last("limit 1"); |
| | | AuctionSalesroomGoods auctionSalesroomGoods1=iAuctionSalesroomGoodsService.getOne(wrapper1); |
| | | if (auctionSalesroomGoods1!=null){ |
| | | forepartAuctionSalesroomGoodsVO.setNextGoodsSkuName(auctionSalesroomGoods1.getGoodsSkuName()); |
| | | } |
| | | } |
| | | return forepartAuctionSalesroomGoodsVO; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 拍卖师端拍卖场信息 |
| | | * |
| | | */ |
| | | @Override |
| | | public AuctionSalesroomVO getAuctionSalesroominfo(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) { |
| | | ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO =new ForepartAuctionSalesroomGoodsVO(); |
| | | AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | AuctionSalesroomVO auctionSalesroomVO=new AuctionSalesroomVO(); |
| | | auctionSalesroomVO.setCoverPic(auctionSalesroom.getCoverPic()); |
| | | auctionSalesroomVO.setDescription(auctionSalesroom.getDescription()); |
| | | auctionSalesroomVO.setSalesroomName(auctionSalesroom.getSalesroomName()); |
| | | auctionSalesroomVO.setSalesroomId(auctionSalesroom.getId()); |
| | | auctionSalesroomVO.setStartTime(auctionSalesroom.getStartTime()); |
| | | auctionSalesroomVO.setEndTime(auctionSalesroom.getEndTime()); |
| | | auctionSalesroomVO.setStatus(auctionSalesroom.getStatus().getCode()); |
| | | List<ForepartAuctionSalesroomGoodsVO> auctionSalesroomGoodsVOS=new ArrayList<>(); |
| | | if (auctionSalesroom.getStatus().getCode()==0){ |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper=Wrappers.lambdaQuery(); |
| | | wrapper.eq(AuctionSalesroomGoods::getStatus,0); |
| | | wrapper.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper.orderByAsc(AuctionSalesroomGoods::getSortNum); |
| | | List<AuctionSalesroomGoods> auctionSalesroomGoods=iAuctionSalesroomGoodsService.list(wrapper); |
| | | for (AuctionSalesroomGoods salesroomGoods:auctionSalesroomGoods){ |
| | | ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO1=new ForepartAuctionSalesroomGoodsVO(); |
| | | R<GoodsSku> goodsSkuOne = goodsSkuClient.getGoodsSkuOne(salesroomGoods.getGoodsSkuId()); |
| | | GoodsSku goodsSku=goodsSkuOne.getData(); |
| | | forepartAuctionSalesroomGoodsVO1.setGoodsSkuName(salesroomGoods.getGoodsSkuName()); |
| | | forepartAuctionSalesroomGoodsVO1.setCoverPic(goodsSku.getCoverPic()); |
| | | auctionSalesroomGoodsVOS.add(forepartAuctionSalesroomGoodsVO1); |
| | | } |
| | | }if (auctionSalesroom.getStatus().getCode()==2){ |
| | | List list =new ArrayList(); |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper=Wrappers.lambdaQuery(); |
| | | wrapper.eq(AuctionSalesroomGoods::getStatus,1); |
| | | wrapper.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper.last("limit 1"); |
| | | AuctionSalesroomGoods auctionSalesroomGoods= iAuctionSalesroomGoodsService.getOne(wrapper); |
| | | ForepartAuctionSalesroomGoodsVO currentAuctionSalesroomGoods= new ForepartAuctionSalesroomGoodsVO(); |
| | | currentAuctionSalesroomGoods.setGoodsSkuName(auctionSalesroomGoods.getGoodsSkuName()); |
| | | R<GoodsSku> goodsSkuOne = goodsSkuClient.getGoodsSkuOne(auctionSalesroomGoods.getGoodsSkuId()); |
| | | GoodsSku goodsSku=goodsSkuOne.getData(); |
| | | currentAuctionSalesroomGoods.setCoverPic(goodsSku.getCoverPic()); |
| | | auctionSalesroomVO.setCurrentAuctionSalesroomGoods(currentAuctionSalesroomGoods); |
| | | |
| | | list.add(auctionSalesroomGoods.getSortNum()); |
| | | |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper1=Wrappers.lambdaQuery(); |
| | | wrapper1.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper1.eq(AuctionSalesroomGoods::getSortNum,auctionSalesroomGoods.getSortNum()+1); |
| | | wrapper1.last("limit 1"); |
| | | AuctionSalesroomGoods auctionSalesroomGoods1=iAuctionSalesroomGoodsService.getOne(wrapper1); |
| | | ForepartAuctionSalesroomGoodsVO nextAuctionSalesroomGoods= new ForepartAuctionSalesroomGoodsVO(); |
| | | if (auctionSalesroomGoods1!=null){ |
| | | list.add(auctionSalesroomGoods.getSortNum()+1); |
| | | nextAuctionSalesroomGoods.setNextGoodsSkuName(auctionSalesroomGoods1.getGoodsSkuName()); |
| | | R<GoodsSku> goodsSkuOne1 = goodsSkuClient.getGoodsSkuOne(auctionSalesroomGoods.getGoodsSkuId()); |
| | | GoodsSku goodsSku1=goodsSkuOne1.getData(); |
| | | nextAuctionSalesroomGoods.setCoverPic(goodsSku1.getCoverPic()); |
| | | auctionSalesroomVO.setNextAuctionSalesroomGoods(nextAuctionSalesroomGoods); |
| | | } |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery(); |
| | | wrapper2.notIn(AuctionSalesroomGoods::getSortNum,list); |
| | | wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper2.orderByAsc(AuctionSalesroomGoods::getSortNum); |
| | | wrapper2.orderByAsc(AuctionSalesroomGoods::getStatus); |
| | | List<AuctionSalesroomGoods> auctionSalesroomGoods2=iAuctionSalesroomGoodsService.list(wrapper2); |
| | | for (AuctionSalesroomGoods salesroomGoods:auctionSalesroomGoods2){ |
| | | ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO1=new ForepartAuctionSalesroomGoodsVO(); |
| | | R<GoodsSku> goodsSkuOne2 = goodsSkuClient.getGoodsSkuOne(salesroomGoods.getGoodsSkuId()); |
| | | GoodsSku goodsSku2=goodsSkuOne2.getData(); |
| | | forepartAuctionSalesroomGoodsVO1.setGoodsSkuName(salesroomGoods.getGoodsSkuName()); |
| | | forepartAuctionSalesroomGoodsVO1.setCoverPic(goodsSku2.getCoverPic()); |
| | | auctionSalesroomGoodsVOS.add(forepartAuctionSalesroomGoodsVO1); |
| | | } |
| | | |
| | | |
| | | } |
| | | auctionSalesroomVO.setElseAuctionSalesroomGoods(auctionSalesroomGoodsVOS); |
| | | return auctionSalesroomVO; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 拍卖师端拍卖场立即开始 |
| | | * |
| | | */ |
| | | @Override |
| | | public void auctionSalesroomStart(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) { |
| | | ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO =new ForepartAuctionSalesroomGoodsVO(); |
| | | AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | auctionSalesroom.setStatus(AuctionStartStatusEnum.IN_AUCTION); |
| | | auctionSalesroom.setStartTime(LocalDateTime.now()); |
| | | iAuctionSalesroomService.updateById(auctionSalesroom); |
| | | |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery(); |
| | | wrapper2.eq(AuctionSalesroomGoods::getStatus,0); |
| | | wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper2.orderByAsc(AuctionSalesroomGoods::getSortNum); |
| | | wrapper2.last("limit 1"); |
| | | AuctionSalesroomGoods auctionSalesroomGoods=iAuctionSalesroomGoodsService.getOne(wrapper2); |
| | | auctionSalesroomGoods.setStatus(AuctionStartStatusEnum.IN_AUCTION); |
| | | iAuctionSalesroomGoodsService.updateById(auctionSalesroomGoods); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 拍卖师端拍卖场立即开始 |
| | | * |
| | | */ |
| | | @Override |
| | | public void auctionSalesroomEnd(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) { |
| | | ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO =new ForepartAuctionSalesroomGoodsVO(); |
| | | AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | auctionSalesroom.setStatus(AuctionStartStatusEnum.ENDED); |
| | | auctionSalesroom.setEndTime(LocalDateTime.now()); |
| | | iAuctionSalesroomService.updateById(auctionSalesroom); |
| | | |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery(); |
| | | wrapper2.eq(AuctionSalesroomGoods::getStatus,0); |
| | | wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 拍卖师端拍卖场立即开始 |
| | | * |
| | | */ |
| | | @Override |
| | | 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,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | List<AuctionSalesroomGoods> auctionSalesroomGoods=iAuctionSalesroomGoodsService.list(wrapper2); |
| | | return auctionSalesroomGoods; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 拍卖师端拍卖场下一个立即开始 |
| | | * |
| | | */ |
| | | @Override |
| | | public void auctionSalesroomGoodsStart(AuctionSalesroomGoodsDTO auctionSalesroomGoodsDTO) { |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery(); |
| | | wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,auctionSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper2.eq(AuctionSalesroomGoods::getGoodsSkuId,auctionSalesroomGoodsDTO.getGoodsSkuId()); |
| | | AuctionSalesroomGoods auctionSalesroomGoods=iAuctionSalesroomGoodsService.getOne(wrapper2); |
| | | auctionSalesroomGoods.setStatus(AuctionStartStatusEnum.IN_AUCTION); |
| | | iAuctionSalesroomGoodsService.updateById(auctionSalesroomGoods); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 拍卖师端拍卖场下一个立即结束 |
| | | * |
| | | */ |
| | | @Override |
| | | public void auctionSalesroomGoodsEnd(AuctionSalesroomGoodsDTO auctionSalesroomGoodsDTO) { |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery(); |
| | | wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,auctionSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper2.eq(AuctionSalesroomGoods::getGoodsSkuId,auctionSalesroomGoodsDTO.getGoodsSkuId()); |
| | | AuctionSalesroomGoods auctionSalesroomGood=iAuctionSalesroomGoodsService.getOne(wrapper2); |
| | | |
| | | |
| | | AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(auctionSalesroomGood.getAuctionSalesroomId()); |
| | | |
| | | AuctionSalesroomGoods auctionSalesroomGoods=iAuctionSalesroomGoodsService.getById(auctionSalesroomGoodsDTO.getGoodsSkuId()); |
| | | List<AuctionBidRecord> auctionBidRecordList=new ArrayList<>(); |
| | | |
| | | if (auctionSalesroomGoods.getStatus().getCode()==1) { |
| | | LambdaQueryWrapper<AuctionBidRecord> wrapper = Wrappers.lambdaQuery(); |
| | | wrapper.eq(AuctionBidRecord::getGoodsSkuId, auctionSalesroomGoodsDTO.getGoodsSkuId()); |
| | | wrapper.eq(AuctionBidRecord::getDelFlag, 0); |
| | | wrapper.orderByDesc(AuctionBidRecord::getLastBidAmount); |
| | | auctionBidRecordList = iAuctionBidRecordService.list(wrapper); |
| | | //判断 |
| | | if (auctionBidRecordList.size() >= auctionSalesroomGoods.getItemQuantity()) { |
| | | for (int i = 0; i <= auctionSalesroomGoods.getItemQuantity(); i++) { |
| | | AuctionBidRecord auctionBidRecord = auctionBidRecordList.get(i); |
| | | auctionBidRecord.setStatus(BidStatusEnum.SUCCESSFUL); |
| | | AddOrder(auctionBidRecord.getGoodsSkuId(),auctionBidRecord.getMemberId(),auctionBidRecord.getLastBidAmount(),auctionSalesroom.getBound()); |
| | | } |
| | | } 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()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | auctionSalesroomGood.setStatus(AuctionStartStatusEnum.ENDED); |
| | | iAuctionSalesroomGoodsService.updateById(auctionSalesroomGood); |
| | | |
| | | } |
| | | |
| | | |
| | | 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=iAuctionSalesroomGoodsService.getById(goodsSkuId); |
| | | order.setGoodsQuantity(1); |
| | | order.setTotalAmount(lastBidAmount); |
| | | |
| | | R<MemberAddress> memberAddressR=emberClient.getMemberAddressOne(memberId); |
| | | MemberAddress memberAddress=memberAddressR.getData(); |
| | | order.setReceiverCity(memberAddress.getCity()); |
| | | order.setReceiverDetailAddress(memberAddress.getDetailedAddress()); |
| | | order.setReceiverphone(memberAddress.getRecipientPhone()); |
| | | order.setReceiverName(memberAddress.getRecipientName()); |
| | | order.setBound(bound); |
| | | order.setAuctionType(AuctionOrderTypeEnum.AUCTION_ITEMS); |
| | | |
| | | } |
| | | |
| | | |
| | | } |