| | |
| | | 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.AuctionSalesroomGoodsInfoDTO; |
| | | import com.ruoyi.auction.controller.forepart.dto.OrderDTO; |
| | | import com.ruoyi.auction.controller.forepart.vo.*; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.google.common.collect.Lists; |
| | | import com.ruoyi.auction.domain.AuctionBidRecord; |
| | | import com.ruoyi.auction.domain.AuctionSalesroom; |
| | | import com.ruoyi.auction.domain.AuctionSalesroomGoods; |
| | | import com.ruoyi.auction.mapper.AuctionBidRecordMapper; |
| | | import com.ruoyi.auction.mapper.AuctionSalesroomGoodsMapper; |
| | | import com.ruoyi.auction.service.IAuctionBidRecordService; |
| | | import com.ruoyi.auction.mapper.AuctionSalesroomMapper; |
| | | import com.ruoyi.auction.service.IAuctionBrowseRecordService; |
| | | 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.enums.AuctionGoodsStatusEnum; |
| | | 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.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.system.api.constants.NotificationTypeConstant; |
| | | import com.ruoyi.system.api.domain.*; |
| | | import com.ruoyi.system.api.domain.dto.AuctionSalesroomDTO; |
| | | import com.ruoyi.system.api.domain.dto.AuctionSalesroomGoodsInfoDTO; |
| | | import com.ruoyi.system.api.domain.dto.GoodsStockUpdDTO; |
| | | import com.ruoyi.system.api.domain.dto.OrderAuctionBondDTO; |
| | | import com.ruoyi.system.api.domain.dto.OrderDTO; |
| | | import com.ruoyi.system.api.domain.vo.*; |
| | | 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 java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private GoodsSkuClient goodsSkuClient; |
| | | |
| | | @Resource |
| | | private IAuctionSalesroomService iAuctionSalesroomService; |
| | | private AuctionSalesroomMapper auctionSalesroomMapper; |
| | | |
| | | @Resource |
| | | private IAuctionSalesroomGoodsService iAuctionSalesroomGoodsService; |
| | | |
| | | @Resource |
| | | private IAuctionBidRecordService iAuctionBidRecordService; |
| | | private AuctionBidRecordMapper auctionBidRecordMapper; |
| | | |
| | | @Resource |
| | | private MemberClient emberClient; |
| | |
| | | private OrderClient orderClient; |
| | | |
| | | @Resource |
| | | private IAuctionBidRecordService auctionBidRecordService; |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | |
| | | private IAuctionBrowseRecordService iAuctionBrowseRecordService; |
| | | |
| | | @Resource |
| | | private IAuctionSalesroomService iAuctionSalesroomService; |
| | | |
| | | private static final ObjectMapper objectMapper = new ObjectMapper(); |
| | | |
| | | |
| | | |
| | | |
| | |
| | | * |
| | | */ |
| | | @Override |
| | | public ForepartAuctionSalesroomGoodsVO getAuctionSalesroomGoods(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) { |
| | | public ForepartAuctionSalesroomGoodsVO getAuctionSalesroomGoods(AuctionSalesroomDTO ationSalesroomGoodsDTO) { |
| | | ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO =new ForepartAuctionSalesroomGoodsVO(); |
| | | AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | AuctionSalesroom auctionSalesroom = auctionSalesroomMapper.selectById( |
| | | ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | forepartAuctionSalesroomGoodsVO.setSalesroomId(auctionSalesroom.getId()); |
| | | forepartAuctionSalesroomGoodsVO.setSalesroomName(auctionSalesroom.getSalesroomName()); |
| | | forepartAuctionSalesroomGoodsVO.setSalesroomType(auctionSalesroom.getType().getCode()); |
| | |
| | | wrapper.eq(AuctionSalesroomGoods::getStatus,1); |
| | | wrapper.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | AuctionSalesroomGoods auctionSalesroomGoods=iAuctionSalesroomGoodsService.getOne(wrapper); |
| | | AuctionSalesroomGoods auctionSalesroomGoods = this.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.orderByDesc(AuctionSalesroomGoods::getEndTime); |
| | | wrapper1.last("limit 1"); |
| | | auctionSalesroomGoods=iAuctionSalesroomGoodsService.getOne(wrapper1); |
| | | auctionSalesroomGoods = this.getOne(wrapper1); |
| | | if (auctionSalesroomGoods==null){ |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery(); |
| | | wrapper2.eq(AuctionSalesroomGoods::getStatus,0); |
| | |
| | | wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper2.orderByAsc(AuctionSalesroomGoods::getSortNum); |
| | | wrapper2.last("limit 1"); |
| | | auctionSalesroomGoods=iAuctionSalesroomGoodsService.getOne(wrapper2); |
| | | auctionSalesroomGoods = this.getOne(wrapper2); |
| | | } |
| | | } |
| | | GoodsSku goodsSku = goodsSkuClient.getGoodsSkuOne(auctionSalesroomGoods.getGoodsSkuId(), SecurityConstants.INNER) |
| | |
| | | forepartAuctionSalesroomGoodsVO.setStartTime(auctionSalesroomGoods.getStartTime()); |
| | | forepartAuctionSalesroomGoodsVO.setCoverPic(goodsSku.getCoverPic()); |
| | | forepartAuctionSalesroomGoodsVO.setDescription(goodsSku.getDescription()); |
| | | forepartAuctionSalesroomGoodsVO.setDetail(goodsSku.getDetail()); |
| | | forepartAuctionSalesroomGoodsVO.setYears(String.valueOf(goodsSku.getYears().getYear())); |
| | | forepartAuctionSalesroomGoodsVO.setUnit(goodsSku.getUnit()); |
| | | forepartAuctionSalesroomGoodsVO.setSpec(goodsSku.getSpec()); |
| | | forepartAuctionSalesroomGoodsVO.setSpecUnit(goodsSku.getSpecUnit()); |
| | | 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); |
| | | AuctionSalesroomGoods auctionSalesroomGoods1 = this.getOne(wrapper1); |
| | | if (auctionSalesroomGoods1!=null){ |
| | | GoodsSku goodsSku1 = goodsSkuClient.getGoodsSkuOne(auctionSalesroomGoods1.getGoodsSkuId(), SecurityConstants.INNER) |
| | | .getData(); |
| | |
| | | * |
| | | */ |
| | | @Override |
| | | public AuctionSalesroomVO getAuctionSalesroominfo(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) { |
| | | public AuctionSalesroomVO getAuctionSalesroominfo(AuctionSalesroomDTO ationSalesroomGoodsDTO) { |
| | | ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO =new ForepartAuctionSalesroomGoodsVO(); |
| | | AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | AuctionSalesroom auctionSalesroom = auctionSalesroomMapper.selectById( |
| | | ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | AuctionSalesroomVO auctionSalesroomVO=new AuctionSalesroomVO(); |
| | | auctionSalesroomVO.setCoverPic(auctionSalesroom.getCoverPic()); |
| | | auctionSalesroomVO.setDescription(auctionSalesroom.getDescription()); |
| | |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper=Wrappers.lambdaQuery(); |
| | | wrapper.eq(AuctionSalesroomGoods::getStatus,0); |
| | | wrapper.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper.eq(AuctionSalesroomGoods::getBackupStatus,false); |
| | | wrapper.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper.orderByAsc(AuctionSalesroomGoods::getSortNum); |
| | | List<AuctionSalesroomGoods> auctionSalesroomGoods=iAuctionSalesroomGoodsService.list(wrapper); |
| | | List<AuctionSalesroomGoods> auctionSalesroomGoods = this.list(wrapper); |
| | | for (AuctionSalesroomGoods salesroomGoods:auctionSalesroomGoods){ |
| | | ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO1=new ForepartAuctionSalesroomGoodsVO(); |
| | | R<GoodsSku> goodsSkuOne = goodsSkuClient.getGoodsSkuOne( |
| | |
| | | forepartAuctionSalesroomGoodsVO1.setCoverPic(goodsSku.getCoverPic()); |
| | | auctionSalesroomGoodsVOS.add(forepartAuctionSalesroomGoodsVO1); |
| | | } |
| | | }if (auctionSalesroom.getStatus().getCode()==2){ |
| | | }if (auctionSalesroom.getStatus().getCode()==1){ |
| | | List list =new ArrayList(); |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper=Wrappers.lambdaQuery(); |
| | | wrapper.eq(AuctionSalesroomGoods::getStatus,1); |
| | | wrapper.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper.eq(AuctionSalesroomGoods::getBackupStatus,false); |
| | | wrapper.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper.last("limit 1"); |
| | | AuctionSalesroomGoods auctionSalesroomGoods= iAuctionSalesroomGoodsService.getOne(wrapper); |
| | | AuctionSalesroomGoods auctionSalesroomGoods = this.getOne(wrapper); |
| | | ForepartAuctionSalesroomGoodsVO currentAuctionSalesroomGoods= new ForepartAuctionSalesroomGoodsVO(); |
| | | R<GoodsSku> goodsSkuOne = goodsSkuClient.getGoodsSkuOne( |
| | | auctionSalesroomGoods.getGoodsSkuId(), SecurityConstants.INNER); |
| | | GoodsSku goodsSku=goodsSkuOne.getData(); |
| | | currentAuctionSalesroomGoods.setGoodsSkuName(goodsSku.getSkuName()); |
| | | currentAuctionSalesroomGoods.setCoverPic(goodsSku.getCoverPic()); |
| | | auctionSalesroomVO.setCurrentAuctionSalesroomGoods(currentAuctionSalesroomGoods); |
| | | |
| | | list.add(auctionSalesroomGoods.getSortNum()); |
| | | |
| | | if (auctionSalesroomGoods!=null){ |
| | | R<GoodsSku> goodsSkuOne = goodsSkuClient.getGoodsSkuOne( |
| | | auctionSalesroomGoods.getGoodsSkuId(), SecurityConstants.INNER); |
| | | GoodsSku goodsSku=goodsSkuOne.getData(); |
| | | currentAuctionSalesroomGoods.setGoodsSkuName(goodsSku.getSkuName()); |
| | | currentAuctionSalesroomGoods.setGoodsSkuId(auctionSalesroomGoods.getId()); |
| | | currentAuctionSalesroomGoods.setCoverPic(goodsSku.getCoverPic()); |
| | | currentAuctionSalesroomGoods.setStartTime(auctionSalesroomGoods.getStartTime()); |
| | | currentAuctionSalesroomGoods.setGoodsSkustatus(auctionSalesroomGoods.getStatus().getCode()); |
| | | currentAuctionSalesroomGoods.setListingDuration(auctionSalesroomGoods.getListingDuration()); |
| | | auctionSalesroomVO.setCurrentAuctionSalesroomGoods(currentAuctionSalesroomGoods); |
| | | list.add(auctionSalesroomGoods.getId()); |
| | | } |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper1=Wrappers.lambdaQuery(); |
| | | wrapper1.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper1.eq(AuctionSalesroomGoods::getSortNum,auctionSalesroomGoods.getSortNum()+1); |
| | | wrapper1.eq(AuctionSalesroomGoods::getStatus,0); |
| | | wrapper1.eq(AuctionSalesroomGoods::getBackupStatus,false); |
| | | wrapper1.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | if (auctionSalesroomGoods!=null) { |
| | | wrapper1.eq(AuctionSalesroomGoods::getSortNum, auctionSalesroomGoods.getSortNum() + 1); |
| | | |
| | | }else{ |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrappers=Wrappers.lambdaQuery(); |
| | | wrappers.eq(AuctionSalesroomGoods::getStatus,0); |
| | | wrappers.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrappers.eq(AuctionSalesroomGoods::getBackupStatus,false); |
| | | wrappers.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrappers.orderByAsc(AuctionSalesroomGoods::getSortNum); |
| | | wrappers.last("limit 1"); |
| | | AuctionSalesroomGoods auctionSalesroomGoodss = this.getOne(wrappers); |
| | | if (auctionSalesroomGoodss!=null){ |
| | | R<GoodsSku> goodsSkuOne = goodsSkuClient.getGoodsSkuOne( |
| | | auctionSalesroomGoodss.getGoodsSkuId(), SecurityConstants.INNER); |
| | | GoodsSku goodsSku=goodsSkuOne.getData(); |
| | | currentAuctionSalesroomGoods.setGoodsSkuName(goodsSku.getSkuName()); |
| | | currentAuctionSalesroomGoods.setGoodsSkuId(auctionSalesroomGoodss.getId()); |
| | | currentAuctionSalesroomGoods.setCoverPic(goodsSku.getCoverPic()); |
| | | currentAuctionSalesroomGoods.setStartTime(auctionSalesroomGoodss.getStartTime()); |
| | | currentAuctionSalesroomGoods.setGoodsSkustatus(auctionSalesroomGoodss.getStatus().getCode()); |
| | | currentAuctionSalesroomGoods.setListingDuration(auctionSalesroomGoodss.getListingDuration()); |
| | | auctionSalesroomVO.setCurrentAuctionSalesroomGoods(currentAuctionSalesroomGoods); |
| | | wrappers.eq(AuctionSalesroomGoods::getSortNum, auctionSalesroomGoodss.getSortNum()); |
| | | list.add(auctionSalesroomGoodss.getId()); |
| | | } |
| | | |
| | | |
| | | } |
| | | wrapper1.last("limit 1"); |
| | | AuctionSalesroomGoods auctionSalesroomGoods1=iAuctionSalesroomGoodsService.getOne(wrapper1); |
| | | AuctionSalesroomGoods auctionSalesroomGoods1 = this.getOne(wrapper1); |
| | | ForepartAuctionSalesroomGoodsVO nextAuctionSalesroomGoods= new ForepartAuctionSalesroomGoodsVO(); |
| | | if (auctionSalesroomGoods1!=null){ |
| | | list.add(auctionSalesroomGoods.getSortNum()+1); |
| | | |
| | | R<GoodsSku> goodsSkuOne1 = goodsSkuClient.getGoodsSkuOne( |
| | | auctionSalesroomGoods.getGoodsSkuId(), SecurityConstants.INNER); |
| | | auctionSalesroomGoods1.getGoodsSkuId(), SecurityConstants.INNER); |
| | | GoodsSku goodsSku1=goodsSkuOne1.getData(); |
| | | nextAuctionSalesroomGoods.setNextGoodsSkuName(goodsSku1.getSkuName()); |
| | | nextAuctionSalesroomGoods.setCoverPic(goodsSku1.getCoverPic()); |
| | | nextAuctionSalesroomGoods.setGoodsSkustatus(auctionSalesroomGoods1.getStatus().getCode()); |
| | | nextAuctionSalesroomGoods.setGoodsSkuId(auctionSalesroomGoods1.getId()); |
| | | auctionSalesroomVO.setNextAuctionSalesroomGoods(nextAuctionSalesroomGoods); |
| | | list.add(auctionSalesroomGoods1.getId()); |
| | | } |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery(); |
| | | wrapper2.notIn(AuctionSalesroomGoods::getSortNum,list); |
| | | wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | if(list.size()>0){ |
| | | wrapper2.notIn(AuctionSalesroomGoods::getId,list); |
| | | } |
| | | wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper2.orderByAsc(AuctionSalesroomGoods::getSortNum); |
| | | wrapper2.orderByAsc(AuctionSalesroomGoods::getStatus); |
| | | List<AuctionSalesroomGoods> auctionSalesroomGoods2=iAuctionSalesroomGoodsService.list(wrapper2); |
| | | wrapper2.orderByAsc(AuctionSalesroomGoods::getSortNum); |
| | | wrapper2.eq(AuctionSalesroomGoods::getBackupStatus,false); |
| | | List<AuctionSalesroomGoods> auctionSalesroomGoods2 = this.list(wrapper2); |
| | | for (AuctionSalesroomGoods salesroomGoods:auctionSalesroomGoods2){ |
| | | ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO1=new ForepartAuctionSalesroomGoodsVO(); |
| | | R<GoodsSku> goodsSkuOne2 = goodsSkuClient.getGoodsSkuOne( |
| | |
| | | GoodsSku goodsSku2=goodsSkuOne2.getData(); |
| | | forepartAuctionSalesroomGoodsVO1.setGoodsSkuName(goodsSku2.getSkuName()); |
| | | forepartAuctionSalesroomGoodsVO1.setCoverPic(goodsSku2.getCoverPic()); |
| | | forepartAuctionSalesroomGoodsVO1.setGoodsSkuId(salesroomGoods.getId()); |
| | | forepartAuctionSalesroomGoodsVO1.setGoodsSkustatus(salesroomGoods.getStatus().getCode()); |
| | | auctionSalesroomGoodsVOS.add(forepartAuctionSalesroomGoodsVO1); |
| | | } |
| | | |
| | | |
| | | } |
| | | auctionSalesroomVO.setElseAuctionSalesroomGoods(auctionSalesroomGoodsVOS); |
| | | |
| | | |
| | | |
| | | |
| | | return auctionSalesroomVO; |
| | | } |
| | | |
| | |
| | | * |
| | | */ |
| | | @Override |
| | | public void auctionSalesroomStart(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) { |
| | | ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO =new ForepartAuctionSalesroomGoodsVO(); |
| | | AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | public void auctionSalesroomStart(AuctionSalesroomDTO ationSalesroomGoodsDTO) { |
| | | AuctionSalesroom auctionSalesroom = auctionSalesroomMapper.selectById( |
| | | ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | |
| | | if (auctionSalesroom.getStatus().getCode()==1){ |
| | | throw new ServiceException("拍卖会已开始,请勿点击"); |
| | | } |
| | | |
| | | auctionSalesroom.setStatus(AuctionStartStatusEnum.IN_AUCTION); |
| | | auctionSalesroom.setStartTime(LocalDateTime.now()); |
| | | iAuctionSalesroomService.updateById(auctionSalesroom); |
| | | auctionSalesroomMapper.updateById(auctionSalesroom); |
| | | |
| | | |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery(); |
| | | wrapper2.eq(AuctionSalesroomGoods::getStatus,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); |
| | | AuctionSalesroomGoods auctionSalesroomGoods = this.getOne(wrapper2); |
| | | |
| | | if (auctionSalesroomGoods==null){ |
| | | throw new ServiceException("以没有待拍卖商品"); |
| | | } |
| | | |
| | | if(auctionSalesroomGoods!=null){ |
| | | auctionSalesroomGoods.setStatus(AuctionGoodsStatusEnum.IN_PROGRESS); |
| | | auctionSalesroomGoods.setStartTime(LocalDateTime.now()); |
| | | this.updateById(auctionSalesroomGoods); |
| | | } |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM); |
| | | map.put("auctionSalesroomId", auctionSalesroom.getId()); |
| | | map.put("AuctionTypeEnum",auctionSalesroom.getStatus()); |
| | | map.put("message_type", "start"); |
| | | map.put("type", "1"); |
| | | String msg = null; |
| | | try { |
| | | msg = objectMapper.writeValueAsString(map); |
| | | } catch (JsonProcessingException e) { |
| | | } |
| | | sysUserClient.pushAll(msg, SecurityConstants.INNER); |
| | | |
| | | } |
| | | |
| | |
| | | * |
| | | */ |
| | | @Override |
| | | public void auctionSalesroomEnd(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) { |
| | | ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO =new ForepartAuctionSalesroomGoodsVO(); |
| | | AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | public void auctionSalesroomEnd(AuctionSalesroomDTO ationSalesroomGoodsDTO) { |
| | | AuctionSalesroom auctionSalesroom = auctionSalesroomMapper.selectById( |
| | | ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | auctionSalesroom.setStatus(AuctionStartStatusEnum.ENDED); |
| | | auctionSalesroom.setEndTime(LocalDateTime.now()); |
| | | iAuctionSalesroomService.updateById(auctionSalesroom); |
| | | auctionSalesroomMapper.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<AuctionSalesroomGoods> auctionSalesroomGoods=this.list(wrapper2); |
| | | if (auctionSalesroomGoods.size()>0){ |
| | | for (AuctionSalesroomGoods salesroomGoods:auctionSalesroomGoods){ |
| | | salesroomGoods.setStatus(AuctionGoodsStatusEnum.ENDED); |
| | | this.updateById(salesroomGoods); |
| | | |
| | | GoodsStockUpdDTO goodsStockUpdDTO = new GoodsStockUpdDTO(); |
| | | goodsStockUpdDTO.setGoodsSkuId(salesroomGoods.getGoodsSkuId()); |
| | | goodsStockUpdDTO.setAuctionStock(salesroomGoods.getSalesroomStock()); |
| | | goodsSkuClient.updGoodsStock(Lists.newArrayList(goodsStockUpdDTO), |
| | | SecurityConstants.INNER); |
| | | |
| | | } |
| | | |
| | | } |
| | | List<Long> list=new ArrayList<>(); |
| | | |
| | | |
| | | Set<Long> list=new HashSet<>(); |
| | | 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); |
| | | wrapper.eq(AuctionBidRecord::getStatus,2); |
| | | List<AuctionBidRecord> auctionBidRecordList = auctionBidRecordMapper.selectList(wrapper); |
| | | for (AuctionBidRecord auctionBidRecord:auctionBidRecordList){ |
| | | list.add(auctionBidRecord.getMemberId()); |
| | | } |
| | |
| | | orderAuctionBondDTO.setUserList(list); |
| | | orderClient.getOrderAuctionBond(orderAuctionBondDTO, |
| | | SecurityConstants.INNER); |
| | | }else{ |
| | | OrderAuctionBondDTO orderAuctionBondDTO=new OrderAuctionBondDTO(); |
| | | orderAuctionBondDTO.setAuctionSalesroomId(auctionSalesroom.getId()); |
| | | orderAuctionBondDTO.setUserList(list); |
| | | orderClient.getOrderAuctionBond(orderAuctionBondDTO, |
| | | SecurityConstants.INNER); |
| | | } |
| | | |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM); |
| | | map.put("AuctionTypeEnum",auctionSalesroom.getStatus()); |
| | | map.put("auctionSalesroomId", auctionSalesroom.getId()); |
| | | map.put("message_type", "end"); |
| | | map.put("type", "1"); |
| | | String msg = null; |
| | | try { |
| | | msg = objectMapper.writeValueAsString(map); |
| | | } catch (JsonProcessingException e) { |
| | | } |
| | | sysUserClient.pushAll(msg, SecurityConstants.INNER); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | */ |
| | | @Override |
| | | public List<AuctionSalesroomGoods> isAuctionSalesroom(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) { |
| | | public List<AuctionSalesroomGoods> isAuctionSalesroom(AuctionSalesroomDTO ationSalesroomGoodsDTO) { |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery(); |
| | | wrapper2.eq(AuctionSalesroomGoods::getStatus,0); |
| | | wrapper2.eq(AuctionSalesroomGoods::getStatus,1); |
| | | wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | List<AuctionSalesroomGoods> auctionSalesroomGoods=iAuctionSalesroomGoodsService.list(wrapper2); |
| | | List<AuctionSalesroomGoods> auctionSalesroomGoods = this.list(wrapper2); |
| | | return auctionSalesroomGoods; |
| | | } |
| | | |
| | |
| | | * |
| | | */ |
| | | @Override |
| | | public void auctionSalesroomGoodsStart(AuctionSalesroomGoodsDTO auctionSalesroomGoodsDTO) { |
| | | public void auctionSalesroomGoodsStart(AuctionSalesroomDTO 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); |
| | | wrapper2.eq(AuctionSalesroomGoods::getId,auctionSalesroomGoodsDTO.getGoodsSkuId()); |
| | | AuctionSalesroomGoods auctionSalesroomGoods=this.getOne(wrapper2); |
| | | if (auctionSalesroomGoods==null){ |
| | | throw new ServiceException("拍卖会已没有待开始拍卖商品"); |
| | | } |
| | | auctionSalesroomGoods.setStatus(AuctionGoodsStatusEnum.IN_PROGRESS); |
| | | auctionSalesroomGoods.setStartTime(LocalDateTime.now()); |
| | | if (auctionSalesroomGoods.getBackupStatus()){ |
| | | auctionSalesroomGoods.setBackupStatus(false); |
| | | } |
| | | this.updateById(auctionSalesroomGoods); |
| | | |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM_GOODS); |
| | | map.put("notification_time", DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss")); |
| | | map.put("goodsSkuId", auctionSalesroomGoods.getId().toString()); |
| | | map.put("auctionSalesroomId", auctionSalesroomGoods.getAuctionSalesroomId().toString()); |
| | | map.put("message_type", "start"); |
| | | map.put("type",2); |
| | | map.put("AuctionGoodsStatusEnum",auctionSalesroomGoods.getStatus()); |
| | | String msg = null; |
| | | try { |
| | | msg = objectMapper.writeValueAsString(map); |
| | | } catch (JsonProcessingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | sysUserClient.pushAll(msg, SecurityConstants.INNER); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | */ |
| | | @Override |
| | | public void auctionSalesroomGoodsEnd(AuctionSalesroomGoodsDTO auctionSalesroomGoodsDTO) { |
| | | public void auctionSalesroomGoodsEnd(AuctionSalesroomDTO 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); |
| | | wrapper2.eq(AuctionSalesroomGoods::getId,auctionSalesroomGoodsDTO.getGoodsSkuId()); |
| | | AuctionSalesroomGoods auctionSalesroomGoods=this.getOne(wrapper2); |
| | | AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(auctionSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | |
| | | |
| | | 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::getAuctionSalesroomId,auctionSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper.eq(AuctionBidRecord::getTargetId, auctionSalesroomGoodsDTO.getGoodsSkuId()); |
| | | wrapper.eq(AuctionBidRecord::getDelFlag, 0); |
| | | wrapper.orderByDesc(AuctionBidRecord::getLastBidAmount); |
| | | auctionBidRecordList = iAuctionBidRecordService.list(wrapper); |
| | | //判断 |
| | | if (auctionBidRecordList.size() >= auctionSalesroomGoods.getSalesroomStock()) { |
| | | for (int i = 0; i <= auctionSalesroomGoods.getSalesroomStock(); i++) { |
| | | AuctionBidRecord auctionBidRecord = auctionBidRecordList.get(i); |
| | | auctionBidRecord.setStatus(BidStatusEnum.SUCCESSFUL); |
| | | AddOrder(auctionBidRecord.getTargetId(),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.getTargetId(),auctionBidRecord.getMemberId(),auctionBidRecord.getLastBidAmount(),auctionSalesroom.getBound()); |
| | | auctionBidRecordList = auctionBidRecordMapper.selectList(wrapper); |
| | | if(auctionBidRecordList.size()>0){ |
| | | //判断 |
| | | 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); |
| | | AddOrder(auctionBidRecord.getTargetId(), auctionBidRecord.getMemberId(), |
| | | auctionBidRecord.getLastBidAmount(), auctionSalesroom.getBond()); |
| | | } |
| | | } else { |
| | | GoodsStockUpdDTO goodsStockUpdDTO = new GoodsStockUpdDTO(); |
| | | goodsStockUpdDTO.setGoodsSkuId(auctionSalesroomGoods.getGoodsSkuId()); |
| | | goodsStockUpdDTO.setAuctionStock(auctionSalesroomGoods.getSalesroomStock()- auctionBidRecordList.size()); |
| | | goodsSkuClient.updGoodsStock(Lists.newArrayList(goodsStockUpdDTO), |
| | | SecurityConstants.INNER); |
| | | |
| | | |
| | | for (int i = 0; i < auctionBidRecordList.size(); i++) { |
| | | AuctionBidRecord auctionBidRecord = auctionBidRecordList.get(i); |
| | | auctionBidRecord.setStatus(BidStatusEnum.SUCCESSFUL); |
| | | auctionBidRecordMapper.updateById(auctionBidRecord); |
| | | AddOrder(auctionBidRecord.getTargetId(), auctionBidRecord.getMemberId(), |
| | | auctionBidRecord.getLastBidAmount(), auctionSalesroom.getBond()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | auctionSalesroomGoods.setEndTime(LocalDateTime.now()); |
| | | auctionSalesroomGoods.setStatus(AuctionGoodsStatusEnum.ENDED); |
| | | this.updateById(auctionSalesroomGoods); |
| | | |
| | | auctionSalesroomGood.setStatus(AuctionStartStatusEnum.ENDED); |
| | | iAuctionSalesroomGoodsService.updateById(auctionSalesroomGood); |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM_GOODS); |
| | | map.put("notification_time", DateUtils.dateTimeNow("yyyy-MM-dd HH:mm:ss")); |
| | | map.put("goodsSkuId", auctionSalesroomGoods.getId().toString()); |
| | | map.put("auctionSalesroomId", auctionSalesroomGoods.getAuctionSalesroomId().toString()); |
| | | map.put("message_type", "end"); |
| | | map.put("type",2); |
| | | map.put("AuctionGoodsStatusEnum",auctionSalesroomGoods.getStatus()); |
| | | String msg = null; |
| | | try { |
| | | msg = objectMapper.writeValueAsString(map); |
| | | } catch (JsonProcessingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | sysUserClient.pushAll(msg, SecurityConstants.INNER); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public AuctionSalesroomGoodsInfoVO getAuctionSalesroomGoodsInfo(AuctionSalesroomGoodsInfoDTO auctionSalesroomGoodsInfoDTO) { |
| | | AuctionSalesroom byId = iAuctionSalesroomService.getById(auctionSalesroomGoodsInfoDTO.getAuctionSalesroomId()); |
| | | AuctionSalesroomGoods byId1 = iAuctionSalesroomGoodsService.getById(auctionSalesroomGoodsInfoDTO.getGoodsSkuId()); |
| | | AuctionSalesroom byId = auctionSalesroomMapper.selectById(auctionSalesroomGoodsInfoDTO.getAuctionSalesroomId()); |
| | | if (byId==null){ |
| | | LambdaQueryWrapper<AuctionSalesroom> wrapper=Wrappers.lambdaQuery(); |
| | | wrapper.eq(AuctionSalesroom::getAuctionSalesroomNo,auctionSalesroomGoodsInfoDTO.getAuctionSalesroomId()); |
| | | wrapper.eq(AuctionSalesroom::getDelFlag,0); |
| | | byId =auctionSalesroomMapper.selectOne(wrapper); |
| | | } |
| | | AuctionSalesroomGoods byId1 = this.getById(auctionSalesroomGoodsInfoDTO.getGoodsSkuId()); |
| | | GoodsSku goodsSku = goodsSkuClient.getGoodsSkuOne(byId1.getGoodsSkuId(), SecurityConstants.INNER).getData(); |
| | | AuctionSalesroomGoodsInfoVO AuctionSalesroomGoodsInfoVO=new AuctionSalesroomGoodsInfoVO(); |
| | | AuctionSalesroomGoodsInfoVO.setSalesroomId(byId.getId()); |
| | |
| | | AuctionSalesroomGoodsInfoVO.setStartTime(byId1.getStartTime()); |
| | | AuctionSalesroomGoodsInfoVO.setUnit(goodsSku.getUnit()); |
| | | AuctionSalesroomGoodsInfoVO.setDescription(goodsSku.getDescription()); |
| | | AuctionSalesroomGoodsInfoVO.setYears(goodsSku.getYears()); |
| | | AuctionSalesroomGoodsInfoVO.setDetail(goodsSku.getDetail()); |
| | | AuctionSalesroomGoodsInfoVO.setSharePic(goodsSku.getSharePic()); |
| | | AuctionSalesroomGoodsInfoVO.setShareTitle(goodsSku.getShareTitle()); |
| | | AuctionSalesroomGoodsInfoVO.setYears(String.valueOf(goodsSku.getYears().getYear())); |
| | | GoodsBrand data = goodsSkuClient.getBrandOne(goodsSku.getBrandId(), SecurityConstants.INNER).getData(); |
| | | GoodsCategory data1 = goodsSkuClient.getCategoryOne(goodsSku.getCategoryId(), SecurityConstants.INNER).getData(); |
| | | GoodsSeries data2 = goodsSkuClient.getSeriesOne(goodsSku.getSeriesId(), SecurityConstants.INNER).getData(); |
| | | GoodsFlavorType data3 = goodsSkuClient.getFlavorTypeOne(goodsSku.getFlavorTypeId(), SecurityConstants.INNER).getData(); |
| | | AuctionSalesroomGoodsInfoVO.setBrand(data.getBrandName()); |
| | | if(data!=null){ |
| | | AuctionSalesroomGoodsInfoVO.setBrand(data.getBrandName()); |
| | | } |
| | | if(data1!=null){ |
| | | AuctionSalesroomGoodsInfoVO.setCategory(data1.getCategoryName()); |
| | | } |
| | | if(data2!=null){ |
| | | AuctionSalesroomGoodsInfoVO.setSeries(data2.getSeriesName()); |
| | | } |
| | | if(data3!=null){ |
| | | AuctionSalesroomGoodsInfoVO.setFlavorType(data3.getFlavorTypeName()); |
| | | } |
| | | AuctionSalesroomGoodsInfoVO.setCoverPic(goodsSku.getCoverPic()); |
| | | AuctionSalesroomGoodsInfoVO.setAlbum(goodsSku.getAlbum()); |
| | | AuctionSalesroomGoodsInfoVO.setSpec(goodsSku.getSpec()); |
| | | AuctionSalesroomGoodsInfoVO.setSpecUnit(goodsSku.getSpecUnit()); |
| | | |
| | | CustomConfig returnAddressUserName = sysUserClient.getconfig("MALL_ORDER_DESCRIPTION").getData(); |
| | | AuctionSalesroomGoodsInfoVO.setExplain(returnAddressUserName.getConfigValue()); |
| | | AuctionSalesroomGoodsInfoVO.setMinimumMarkupAmount(byId1.getMinimumMarkupAmount()); |
| | | LambdaQueryWrapper<AuctionBidRecord> wrapper1=Wrappers.lambdaQuery(); |
| | | wrapper1.eq(AuctionBidRecord::getMemberId,auctionSalesroomGoodsInfoDTO.getMemberId()); |
| | | wrapper1.eq(AuctionBidRecord::getAuctionSalesroomId,byId.getId()); |
| | | wrapper1.eq(AuctionBidRecord::getAuctionType,2); |
| | | wrapper1.eq(AuctionBidRecord::getTargetId,byId1.getId()); |
| | | wrapper1.eq(AuctionBidRecord::getMemberId,auctionSalesroomGoodsInfoDTO.getMemberId()); |
| | | wrapper1.eq(AuctionBidRecord::getDelFlag,0); |
| | | AuctionBidRecord list1 = auctionBidRecordService.getOne(wrapper1); |
| | | AuctionBidRecord list1 = auctionBidRecordMapper.selectOne(wrapper1); |
| | | if (list1!=null){ |
| | | AuctionSalesroomGoodsInfoVO.setIsBond(2); |
| | | AuctionSalesroomGoodsInfoVO.setPresentBid(list1.getLastBidAmount()); |
| | | if (list1.getStatus().getCode()==2){ |
| | | AuctionSalesroomGoodsInfoVO.setIsStatus(2); |
| | | OrderDTO orderDTO =new OrderDTO(); |
| | | orderDTO.setMemberId(auctionSalesroomGoodsInfoDTO.getMemberId()); |
| | | orderDTO.setGoodsSkuId(byId1.getId()); |
| | | Order data4 = orderClient.getOrderOne(orderDTO, SecurityConstants.INNER).getData(); |
| | | if (data4!=null){ |
| | | AuctionSalesroomGoodsInfoVO.setOrderId(data4.getId()); |
| | | AuctionSalesroomGoodsInfoVO.setOrderNo(data4.getOrderNo()); |
| | | } |
| | | |
| | | }else{ |
| | | AuctionSalesroomGoodsInfoVO.setIsStatus(1); |
| | | } |
| | |
| | | AuctionSalesroomGoodsInfoVO.setIsBond(1); |
| | | AuctionSalesroomGoodsInfoVO.setIsStatus(1); |
| | | } |
| | | |
| | | LambdaQueryWrapper<AuctionBidRecord> wrapper2=Wrappers.lambdaQuery(); |
| | | wrapper2.eq(AuctionBidRecord::getAuctionSalesroomId,byId.getId()); |
| | | wrapper2.eq(AuctionBidRecord::getAuctionType,2); |
| | | wrapper2.eq(AuctionBidRecord::getTargetId,byId1.getId()); |
| | | wrapper2.eq(AuctionBidRecord::getDelFlag,0); |
| | | wrapper2.orderByDesc(AuctionBidRecord::getLastBidAmount); |
| | | wrapper2.last("limit 1"); |
| | | AuctionBidRecord list2 = auctionBidRecordMapper.selectOne(wrapper2); |
| | | if (list2!=null){ |
| | | AuctionSalesroomGoodsInfoVO.setZgBid(list2.getLastBidAmount()); |
| | | } |
| | | List<getHomeGoodsSkuXxiVO> homeGoodsSkuXxiVOS=new ArrayList<>(); |
| | | List<GoodsInfoTitleValueVO> goodsInfoTitleValueVOList = goodsSkuClient.getlistByGoodsId(goodsSku.getId(), SecurityConstants.INNER).getData(); |
| | | if (goodsInfoTitleValueVOList!=null){ |
| | | Collections.sort(goodsInfoTitleValueVOList, Comparator.comparingInt(GoodsInfoTitleValueVO::getSortNum)); |
| | | for (GoodsInfoTitleValueVO goodsInfoTitleValueVO:goodsInfoTitleValueVOList){ |
| | | getHomeGoodsSkuXxiVO getHomeGoodsSkuXxiVOs=new getHomeGoodsSkuXxiVO(); |
| | | getHomeGoodsSkuXxiVOs.setContent(goodsInfoTitleValueVO.getContent()); |
| | | getHomeGoodsSkuXxiVOs.setTitleName(goodsInfoTitleValueVO.getTitleName()); |
| | | homeGoodsSkuXxiVOS.add(getHomeGoodsSkuXxiVOs); |
| | | } |
| | | } |
| | | |
| | | AuctionSalesroomGoodsInfoVO.setXxiVOS(homeGoodsSkuXxiVOS); |
| | | |
| | | return AuctionSalesroomGoodsInfoVO; |
| | | } |
| | | |
| | | @Override |
| | | public List<AuctionBidRecordVO> getAuctionBidRecord(AuctionSalesroomGoodsInfoDTO auctionSalesroomGoodsInfoDTO) { |
| | | LambdaQueryWrapper<AuctionBidRecord> wrapper=Wrappers.lambdaQuery(); |
| | | wrapper.eq(AuctionBidRecord::getAuctionSalesroomId,auctionSalesroomGoodsInfoDTO.getAuctionSalesroomId()); |
| | | |
| | | AuctionSalesroom byId = auctionSalesroomMapper.selectById(auctionSalesroomGoodsInfoDTO.getAuctionSalesroomId()); |
| | | if (byId==null){ |
| | | LambdaQueryWrapper<AuctionSalesroom> wrapper1=Wrappers.lambdaQuery(); |
| | | wrapper1.eq(AuctionSalesroom::getAuctionSalesroomNo,auctionSalesroomGoodsInfoDTO.getAuctionSalesroomId()); |
| | | wrapper1.eq(AuctionSalesroom::getDelFlag,0); |
| | | byId =auctionSalesroomMapper.selectOne(wrapper1); |
| | | } |
| | | |
| | | if (auctionSalesroomGoodsInfoDTO.getAuctionSalesroomId()!=null){ |
| | | wrapper.eq(AuctionBidRecord::getAuctionSalesroomId,byId.getId()); |
| | | } |
| | | wrapper.eq(AuctionBidRecord::getDelFlag,0); |
| | | wrapper.eq(AuctionBidRecord::getTargetId,auctionSalesroomGoodsInfoDTO.getGoodsSkuId()); |
| | | wrapper.orderByDesc(AuctionBidRecord::getLastBidAmount); |
| | | wrapper.last("limit 10"); |
| | | List<AuctionBidRecord> auctionBidRecordList=auctionBidRecordService.list(wrapper); |
| | | List<AuctionBidRecord> auctionBidRecordList = auctionBidRecordMapper.selectList(wrapper); |
| | | List<AuctionBidRecordVO> auctionBidRecordVOList=new ArrayList<>(); |
| | | for (int i=0;i<auctionBidRecordList.size();i++){ |
| | | AuctionBidRecordVO auctionBidRecordVO=new AuctionBidRecordVO(); |
| | | auctionBidRecordVO.setSort(i+1); |
| | | auctionBidRecordVO.setLastBidAmount(auctionBidRecordList.get(i).getLastBidAmount()); |
| | | auctionBidRecordVO.setLastBidTime(auctionBidRecordList.get(i).getLastBidTime()); |
| | | Member data = emberClient.getMembeOne(auctionBidRecordList.get(i).getMemberId(), |
| | | SecurityConstants.INNER).getData(); |
| | | auctionBidRecordVO.setMemberName(data.getNickname()); |
| | | auctionBidRecordVO.setMemberId(data.getId()); |
| | | auctionBidRecordVO.setMemberName(auctionBidRecordList.get(i).getNickname()); |
| | | auctionBidRecordVO.setMemberId(auctionBidRecordList.get(i).getMemberId()); |
| | | auctionBidRecordVOList.add(auctionBidRecordVO); |
| | | } |
| | | LambdaQueryWrapper<AuctionBidRecord> wrapper1=Wrappers.lambdaQuery(); |
| | | wrapper1.eq(AuctionBidRecord::getAuctionSalesroomId,auctionSalesroomGoodsInfoDTO.getAuctionSalesroomId()); |
| | | if (auctionSalesroomGoodsInfoDTO.getAuctionSalesroomId()!=null){ |
| | | wrapper1.eq(AuctionBidRecord::getAuctionSalesroomId,auctionSalesroomGoodsInfoDTO.getAuctionSalesroomId()); |
| | | } |
| | | wrapper1.eq(AuctionBidRecord::getDelFlag,0); |
| | | wrapper1.eq(AuctionBidRecord::getTargetId,auctionSalesroomGoodsInfoDTO.getGoodsSkuId()); |
| | | wrapper1.eq(AuctionBidRecord::getMemberId,auctionSalesroomGoodsInfoDTO.getMemberId()); |
| | | wrapper.last("limit 1"); |
| | | AuctionBidRecord auctionBidRecord=auctionBidRecordService.getOne(wrapper); |
| | | wrapper1.last("limit 1"); |
| | | AuctionBidRecord auctionBidRecord = auctionBidRecordMapper.selectOne(wrapper1); |
| | | if (auctionBidRecord!=null){ |
| | | LambdaQueryWrapper<AuctionBidRecord> wrapper3=Wrappers.lambdaQuery(); |
| | | wrapper3.eq(AuctionBidRecord::getAuctionSalesroomId,auctionSalesroomGoodsInfoDTO.getAuctionSalesroomId()); |
| | | wrapper3.eq(AuctionBidRecord::getDelFlag,0); |
| | | wrapper3.eq(AuctionBidRecord::getTargetId,auctionSalesroomGoodsInfoDTO.getGoodsSkuId()); |
| | | wrapper3.le(AuctionBidRecord::getId,auctionBidRecord.getId()); |
| | | wrapper3.orderByDesc(AuctionBidRecord::getLastBidAmount); |
| | | Long count = auctionBidRecordMapper.selectCount(wrapper); |
| | | if (count>0){ |
| | | AuctionBidRecordVO auctionBidRecordVO=new AuctionBidRecordVO(); |
| | | auctionBidRecordVO.setSort(Integer.valueOf(count.intValue())); |
| | | auctionBidRecordVO.setLastBidAmount(auctionBidRecord.getLastBidAmount()); |
| | | auctionBidRecordVO.setLastBidTime(auctionBidRecord.getLastBidTime()); |
| | | Member data = emberClient.getMembeOne(auctionBidRecord.getMemberId(), |
| | | SecurityConstants.INNER).getData(); |
| | | if (data!=null){ |
| | | auctionBidRecordVO.setMemberName(data.getNickname()); |
| | | auctionBidRecordVO.setMemberId(data.getId()); |
| | | } |
| | | if (data!=null){ |
| | | Boolean b=false; |
| | | for (AuctionBidRecordVO auctionBidRecordVOs:auctionBidRecordVOList){ |
| | | if (auctionBidRecordVOs.getMemberId().equals(data.getId())){ |
| | | b=true; |
| | | break; |
| | | } |
| | | } |
| | | if (!b){ |
| | | auctionBidRecordVOList.add(auctionBidRecordVO); |
| | | } |
| | | }else{ |
| | | auctionBidRecordVOList.add(auctionBidRecordVO); |
| | | } |
| | | |
| | | LambdaQueryWrapper<AuctionBidRecord> wrapper3=Wrappers.lambdaQuery(); |
| | | wrapper3.eq(AuctionBidRecord::getAuctionSalesroomId,auctionSalesroomGoodsInfoDTO.getAuctionSalesroomId()); |
| | | wrapper3.eq(AuctionBidRecord::getDelFlag,0); |
| | | wrapper3.eq(AuctionBidRecord::getTargetId,auctionSalesroomGoodsInfoDTO.getGoodsSkuId()); |
| | | wrapper3.le(AuctionBidRecord::getId,auctionBidRecord.getId()); |
| | | wrapper3.orderByDesc(AuctionBidRecord::getLastBidAmount); |
| | | Long count=auctionBidRecordService.count(wrapper); |
| | | if (count>0){ |
| | | AuctionBidRecordVO auctionBidRecordVO=new AuctionBidRecordVO(); |
| | | auctionBidRecordVO.setSort(Integer.valueOf(count.intValue())); |
| | | auctionBidRecordVO.setLastBidAmount(auctionBidRecord.getLastBidAmount()); |
| | | auctionBidRecordVO.setLastBidTime(auctionBidRecord.getLastBidTime()); |
| | | Member data = emberClient.getMembeOne(auctionBidRecord.getMemberId(), |
| | | SecurityConstants.INNER).getData(); |
| | | auctionBidRecordVO.setMemberName(data.getNickname()); |
| | | auctionBidRecordVO.setMemberId(data.getId()); |
| | | auctionBidRecordVOList.add(auctionBidRecordVO); |
| | | } |
| | | } |
| | | |
| | | return auctionBidRecordVOList; |
| | | } |
| | | |
| | |
| | | order.setOrderTime(LocalDateTime.now()); |
| | | order.setOrderFrom(OrderFromEnum.AUCTION_ORDERS); |
| | | order.setMemberId(memberId); |
| | | AuctionSalesroomGoods auctionSalesroomGoods=iAuctionSalesroomGoodsService.getById(goodsSkuId); |
| | | AuctionSalesroomGoods auctionSalesroomGoods = this.getById(goodsSkuId); |
| | | |
| | | order.setGoodsQuantity(1); |
| | | order.setTotalAmount(lastBidAmount); |
| | | order.setAuctionSalesroomId(auctionSalesroomGoods.getAuctionSalesroomId()); |
| | | |
| | | R<MemberAddress> memberAddressR = emberClient.getMemberAddressOne(memberId, |
| | | SecurityConstants.INNER); |
| | | MemberAddress memberAddress=memberAddressR.getData(); |
| | | order.setReceiverCity(memberAddress.getCity()); |
| | | order.setReceiverDetailAddress(memberAddress.getDetailedAddress()); |
| | | order.setReceiverphone(memberAddress.getRecipientPhone()); |
| | | order.setReceiverName(memberAddress.getRecipientName()); |
| | | |
| | | CustomConfig memberPointsMoney = sysUserClient.getconfig("MEMBER_POINTS_MONEY").getData(); |
| | | CustomConfig memberPointsPoints = sysUserClient.getconfig("MEMBER_POINTS_POINTS").getData(); |
| | | |
| | | if (lastBidAmount.intValue()>0){ |
| | | BigDecimal divide = lastBidAmount.divide(new BigDecimal(memberPointsMoney.getConfigValue())); |
| | | BigDecimal roundedDown = divide.setScale(0, RoundingMode.DOWN); |
| | | BigDecimal aDouble= roundedDown.multiply(new BigDecimal(memberPointsPoints.getConfigValue())); |
| | | order.setPoints(aDouble.intValue()); |
| | | }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); |
| | | orderClient.saveOrderOne(order,SecurityConstants.INNER); |
| | | } |
| | | |
| | | |