| | |
| | | package com.ruoyi.auction.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.auction.controller.forepart.vo.MemberAuctionSalesroomVO; |
| | | import com.ruoyi.auction.controller.management.dto.AuctionGoodsDTO; |
| | | import com.ruoyi.auction.controller.management.dto.AuctionGoodsQuery; |
| | | import com.ruoyi.auction.controller.management.vo.AuctionBidRecordVO; |
| | | import com.ruoyi.auction.controller.management.vo.AuctionGoodsVO; |
| | | import com.ruoyi.auction.domain.AuctionBidRecord; |
| | | import com.ruoyi.auction.domain.MemberAuctionCollection; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.api.domain.*; |
| | | import com.ruoyi.auction.mapper.AuctionGoodsMapper; |
| | | import com.ruoyi.auction.service.IAuctionBidRecordService; |
| | | import com.ruoyi.auction.service.IAuctionGoodsService; |
| | |
| | | import com.ruoyi.common.core.utils.page.BeanUtils; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.system.api.domain.AuctionGoods; |
| | | 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.dto.AuctionGoodsListDTO; |
| | | import com.ruoyi.system.api.domain.dto.AuctionGoodsListPageDTO; |
| | | import com.ruoyi.system.api.domain.dto.OrderDTO; |
| | | import com.ruoyi.system.api.domain.dto.RefundDTO; |
| | | import com.ruoyi.system.api.domain.vo.AuctionGoodsListVO; |
| | | import com.ruoyi.system.api.domain.vo.AuctionGoodsinfoVO; |
| | | import com.ruoyi.system.api.feignClient.GoodsSkuClient; |
| | | import com.ruoyi.system.api.feignClient.MemberClient; |
| | | import com.ruoyi.system.api.feignClient.OrderClient; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private final MemberClient memberClient; |
| | | private final OrderClient orderClient; |
| | | private final IAuctionBidRecordService auctionBidRecordService; |
| | | |
| | | @Resource |
| | | private MemberAuctionCollectionServiceImpl memberAuctionCollectionServiceImpl; |
| | | |
| | | @Resource |
| | | private IAuctionGoodsService auctionGoodsService; |
| | | |
| | | @Resource |
| | | private AuctionGoodsMapper auctionGoodsMapper; |
| | | |
| | | /** |
| | | * 获取拍卖商品列表的分页数据 |
| | | * |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public PageDTO<AuctionGoodsListVO> getAuctionGoodsList(AuctionGoodsListDTO auctionGoodsListDTO) { |
| | | Set<Long> goodsSkuIdList = null; |
| | | if (StringUtils.isNotEmpty(auctionGoodsListDTO.getGoodsSkuName())) { |
| | | List<GoodsSku> goodsSku = goodsSkuClient.getGoodsByName(auctionGoodsListDTO.getGoodsSkuName(), |
| | | SecurityConstants.INNER) |
| | | .getData(); |
| | | goodsSkuIdList = goodsSku.stream().map(GoodsSku::getId) |
| | | .collect(Collectors.toSet()); |
| | | } |
| | | AuctionGoodsListPageDTO auctionGoodsListPageDTO=new AuctionGoodsListPageDTO(); |
| | | auctionGoodsListPageDTO.setGoodsSkuIdList(goodsSkuIdList); |
| | | |
| | | Page<AuctionGoodsListVO> page = new Page<>(); |
| | | page.setSize(auctionGoodsListDTO.getPageSize()); |
| | | page.setCurrent(auctionGoodsListDTO.getPageCurr()); |
| | | List<AuctionGoods> auctionGoodsPgeList = auctionGoodsMapper.getAuctionGoodsPgeList(page, auctionGoodsListPageDTO); |
| | | List<AuctionGoodsListVO> auctionGoodsVOS=new ArrayList<>(); |
| | | for (AuctionGoods auctionGoods:auctionGoodsPgeList){ |
| | | AuctionGoodsListVO auctionGoodsVO=new AuctionGoodsListVO(); |
| | | auctionGoodsVO.setAuctionStock(auctionGoods.getAuctionStock()); |
| | | auctionGoodsVO.setGoodsSkuId(auctionGoods.getId()); |
| | | auctionGoodsVO.setEndTime(auctionGoods.getEndTime()); |
| | | auctionGoodsVO.setStartTime(auctionGoods.getStartTime()); |
| | | auctionGoodsVO.setStartingPrice(auctionGoods.getStartingPrice()); |
| | | auctionGoodsVO.setStartStatus(auctionGoods.getStartStatus()); |
| | | GoodsSku goodsSkuOne = goodsSkuClient.getGoodsSkuOne(auctionGoods.getGoodsSkuId(), SecurityConstants.INNER).getData(); |
| | | auctionGoodsVO.setUnit(goodsSkuOne.getUnit()); |
| | | auctionGoodsVO.setSpec(goodsSkuOne.getSpec()); |
| | | auctionGoodsVO.setSpecUnit(goodsSkuOne.getSpecUnit()); |
| | | auctionGoodsVO.setGoodsSkuName(goodsSkuOne.getSkuName()); |
| | | auctionGoodsVO.setCoverPic(goodsSkuOne.getCoverPic()); |
| | | auctionGoodsVOS.add(auctionGoodsVO); |
| | | |
| | | } |
| | | page.setRecords(auctionGoodsVOS); |
| | | return PageDTO.of(page); |
| | | } |
| | | |
| | | @Override |
| | | public AuctionGoodsinfoVO getAuctionGoodsInfo(AuctionGoodsListDTO auctionGoodsListDTO) { |
| | | AuctionGoods byId = auctionGoodsService.getById(auctionGoodsListDTO.getGoodsSkuId()); |
| | | GoodsSku goodsSkuOne = goodsSkuClient.getGoodsSkuOne(byId.getGoodsSkuId(), SecurityConstants.INNER).getData(); |
| | | AuctionGoodsinfoVO auctionGoodsinfoVO=new AuctionGoodsinfoVO(); |
| | | auctionGoodsinfoVO.setGoodsSkuId(byId.getGoodsSkuId()); |
| | | auctionGoodsinfoVO.setGoodsSkuName(goodsSkuOne.getSkuName()); |
| | | auctionGoodsinfoVO.setStartingPrice(byId.getStartingPrice()); |
| | | auctionGoodsinfoVO.setSalesroomStock(byId.getAuctionStock()); |
| | | auctionGoodsinfoVO.setStartStatus(byId.getStartStatus()); |
| | | auctionGoodsinfoVO.setStartTime(byId.getStartTime()); |
| | | auctionGoodsinfoVO.setEndTime(byId.getEndTime()); |
| | | auctionGoodsinfoVO.setUnit(goodsSkuOne.getUnit()); |
| | | auctionGoodsinfoVO.setDescription(goodsSkuOne.getDescription()); |
| | | auctionGoodsinfoVO.setYears(goodsSkuOne.getYears()); |
| | | GoodsBrand data = goodsSkuClient.getBrandOne(goodsSkuOne.getBrandId(), SecurityConstants.INNER).getData(); |
| | | GoodsCategory data1 = goodsSkuClient.getCategoryOne(goodsSkuOne.getCategoryId(), SecurityConstants.INNER).getData(); |
| | | GoodsSeries data2 = goodsSkuClient.getSeriesOne(goodsSkuOne.getSeriesId(), SecurityConstants.INNER).getData(); |
| | | GoodsFlavorType data3 = goodsSkuClient.getFlavorTypeOne(goodsSkuOne.getFlavorTypeId(), SecurityConstants.INNER).getData(); |
| | | auctionGoodsinfoVO.setBrand(data.getBrandName()); |
| | | auctionGoodsinfoVO.setCategory(data1.getCategoryName()); |
| | | auctionGoodsinfoVO.setSeries(data2.getSeriesName()); |
| | | auctionGoodsinfoVO.setFlavorType(data3.getFlavorTypeName()); |
| | | auctionGoodsinfoVO.setCoverPic(goodsSkuOne.getCoverPic()); |
| | | auctionGoodsinfoVO.setAlbum(goodsSkuOne.getAlbum()); |
| | | auctionGoodsinfoVO.setAuthentication(byId.getAuthentication()); |
| | | auctionGoodsinfoVO.setMinimumMarkupAmount(byId.getMinimumMarkupAmount()); |
| | | auctionGoodsinfoVO.setSpec(goodsSkuOne.getSpec()); |
| | | auctionGoodsinfoVO.setSpecUnit(goodsSkuOne.getSpecUnit()); |
| | | auctionGoodsinfoVO.setShareTitle(goodsSkuOne.getShareTitle()); |
| | | auctionGoodsinfoVO.setSpecUnit(goodsSkuOne.getSpecUnit()); |
| | | LambdaQueryWrapper<AuctionBidRecord> wrapper1= Wrappers.lambdaQuery(); |
| | | wrapper1.eq(AuctionBidRecord::getMemberId,auctionGoodsListDTO.getMemberId()); |
| | | wrapper1.eq(AuctionBidRecord::getAuctionType,1); |
| | | wrapper1.eq(AuctionBidRecord::getTargetId,byId.getId()); |
| | | wrapper1.eq(AuctionBidRecord::getDelFlag,0); |
| | | AuctionBidRecord list1 = auctionBidRecordService.getOne(wrapper1); |
| | | if (list1!=null){ |
| | | auctionGoodsinfoVO.setIsBond(2); |
| | | auctionGoodsinfoVO.setPresentBid(list1.getLastBidAmount()); |
| | | if (list1.getStatus().getCode()==2){ |
| | | auctionGoodsinfoVO.setIsStatus(2); |
| | | }else{ |
| | | auctionGoodsinfoVO.setIsStatus(1); |
| | | } |
| | | }else{ |
| | | auctionGoodsinfoVO.setIsBond(1); |
| | | auctionGoodsinfoVO.setIsStatus(1); |
| | | } |
| | | LambdaQueryWrapper<MemberAuctionCollection> wrapper2= Wrappers.lambdaQuery(); |
| | | wrapper2.eq(MemberAuctionCollection::getMemberId,auctionGoodsListDTO.getMemberId()); |
| | | wrapper2.eq(MemberAuctionCollection::getTargetId,byId.getId()); |
| | | wrapper2.eq(MemberAuctionCollection::getDelFlag,0); |
| | | MemberAuctionCollection one = memberAuctionCollectionServiceImpl.getOne(wrapper2); |
| | | if (one!=null){ |
| | | auctionGoodsinfoVO.setIsCollection(2); |
| | | }else { |
| | | auctionGoodsinfoVO.setIsCollection(1); |
| | | } |
| | | List<OrderAuctionBond> datas = orderClient.getAuctionGoodsOrderAuctionBondList(auctionGoodsListDTO, SecurityConstants.INNER).getData(); |
| | | if (datas.size()>0){ |
| | | auctionGoodsinfoVO.setIsApply(2); |
| | | }else{ |
| | | auctionGoodsinfoVO.setIsApply(1); |
| | | } |
| | | return auctionGoodsinfoVO; |
| | | } |
| | | } |