rentaiming
2024-05-20 eae081c85a3f570a1ada34b2fbf63140b037d9a3
ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/controller/forepart/ForepartAuctionSalesroomGoodsController.java
@@ -3,7 +3,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.auction.controller.forepart.VO.AuctionSalesroomGoodsVO;
import com.ruoyi.auction.controller.forepart.VO.ForepartAuctionSalesroomGoodsVO;
import com.ruoyi.auction.domain.pojo.AuctionSalesroom;
import com.ruoyi.auction.domain.pojo.AuctionSalesroomGoods;
import com.ruoyi.auction.service.IAuctionSalesroomGoodsService;
@@ -49,54 +49,57 @@
    @RequestMapping("/getAuctionSalesroomGoods")
    @ResponseBody @ApiOperation(value = "拍卖大屏的商品介绍")
    public R<AuctionSalesroomGoodsVO> getAuctionSalesroomGoods(String SalesroomId) {
        AuctionSalesroomGoodsVO auctionSalesroomGoodsVO=new AuctionSalesroomGoodsVO();
    public R<ForepartAuctionSalesroomGoodsVO> getAuctionSalesroomGoods(Integer SalesroomId) {
        ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO =new ForepartAuctionSalesroomGoodsVO();
        AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(SalesroomId);
        auctionSalesroomGoodsVO.setSalesroomId(auctionSalesroom.getId());
        auctionSalesroomGoodsVO.setSalesroomName(auctionSalesroom.getSalesroomName());
        auctionSalesroomGoodsVO.setSalesroomType(auctionSalesroom.getType().getCode());
        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,SalesroomId);
        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);
            wrapper.eq(AuctionSalesroomGoods::getAuctionSalesroomId,SalesroomId);
            wrapper1.orderByDesc(AuctionSalesroomGoods::getSortNum);
            wrapper.last("limit 1");
            auctionSalesroomGoods=iAuctionSalesroomGoodsService.getOne(wrapper1);
            if (auctionSalesroomGoods==null){
                LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery();
                wrapper2.eq(AuctionSalesroomGoods::getStatus,1);
                wrapper2.eq(AuctionSalesroomGoods::getStatus,0);
                wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0);
                wrapper.eq(AuctionSalesroomGoods::getAuctionSalesroomId,SalesroomId);
                wrapper2.orderByAsc(AuctionSalesroomGoods::getSortNum);
                wrapper2.last("limit 1");
                auctionSalesroomGoods=iAuctionSalesroomGoodsService.getOne(wrapper2);
            }
        }
        auctionSalesroomGoodsVO.setGoodsSkuId(auctionSalesroomGoods.getGoodsSkuId());
        auctionSalesroomGoodsVO.setGoodsSkuName(auctionSalesroomGoods.getGoodsSkuName());
        auctionSalesroomGoodsVO.setGoodsSkustatus(auctionSalesroomGoods.getStatus().getCode());
        auctionSalesroomGoodsVO.setStartingPrice(auctionSalesroomGoods.getStartingPrice());
        auctionSalesroomGoodsVO.setItemQuantity(auctionSalesroomGoods.getItemQuantity());
        auctionSalesroomGoodsVO.setListingDuration(auctionSalesroomGoods.getListingDuration());
        auctionSalesroomGoodsVO.setStartTime(auctionSalesroomGoods.getStartTime());
        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();
        auctionSalesroomGoodsVO.setCoverPic(goodsSku.getCoverPic());
        auctionSalesroomGoodsVO.setDescription(goodsSku.getDescription());
        auctionSalesroomGoodsVO.setUnit(goodsSku.getUnit());
        forepartAuctionSalesroomGoodsVO.setCoverPic(goodsSku.getCoverPic());
        forepartAuctionSalesroomGoodsVO.setDescription(goodsSku.getDescription());
        forepartAuctionSalesroomGoodsVO.setUnit(goodsSku.getUnit());
        if (auctionSalesroomGoods.getStatus().getCode()==0){
            auctionSalesroomGoodsVO.setNextGoodsSkuName(auctionSalesroomGoods.getGoodsSkuName());
            forepartAuctionSalesroomGoodsVO.setNextGoodsSkuName(auctionSalesroomGoods.getGoodsSkuName());
        }if (auctionSalesroomGoods.getStatus().getCode()==2){
            AuctionSalesroomGoods auctionSalesroomGoodsOne= iAuctionSalesroomGoodsService.getById(auctionSalesroomGoods.getGoodsSkuId()+1);
            if (auctionSalesroomGoodsOne!=null){
                auctionSalesroomGoodsVO.setNextGoodsSkuName(auctionSalesroomGoods.getGoodsSkuName());
                forepartAuctionSalesroomGoodsVO.setNextGoodsSkuName(auctionSalesroomGoods.getGoodsSkuName());
            }
        }
        return R.ok(auctionSalesroomGoodsVO);
        return R.ok(forepartAuctionSalesroomGoodsVO);
    }
}