mitao
2024-07-29 fc8b51f40e71aa09bb49f407c1e9f68ac94ceb58
ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/controller/management/MgtAuctionScreenController.java
@@ -1,15 +1,22 @@
package com.ruoyi.auction.controller.management;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.ruoyi.auction.controller.management.dto.MgtAuctionSalesroomGoodsQuery;
import com.ruoyi.auction.controller.management.dto.MgtAuctionSalesroomQuery;
import com.ruoyi.auction.controller.management.dto.MgtScreenBidPage;
import com.ruoyi.auction.controller.management.dto.MgtScreenSalesroomGoodsDTO;
import com.ruoyi.auction.controller.management.dto.MgtScreenVideoDTO;
import com.ruoyi.auction.controller.management.vo.MgtAuctionBidRecordVO;
import com.ruoyi.auction.controller.management.vo.MgtAuctionSalesroomGoodsVO;
import com.ruoyi.auction.controller.management.vo.MgtAuctionSalesroomScreenVO;
import com.ruoyi.auction.controller.management.vo.MgtAuctionSalesroomVO;
import com.ruoyi.auction.service.IAuctionSalesroomService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.page.PageDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
@@ -17,8 +24,10 @@
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
@@ -46,7 +55,7 @@
    @PostMapping("/page")
    @ApiOperation(value = "获取拍卖场列表的分页数据", notes = "获取拍卖场列表的分页数据")
    public R<PageDTO<MgtAuctionSalesroomVO>> getAuctionSalesroom4ScreenPage(
            MgtAuctionSalesroomQuery query) {
            @Validated @RequestBody MgtAuctionSalesroomQuery query) {
        return R.ok(auctionSalesroomService.getAuctionSalesroom4ScreenPage(query));
    }
@@ -75,5 +84,140 @@
            @Validated @RequestBody MgtScreenBidPage mgtScreenBidPage) {
        return R.ok(auctionSalesroomService.getScreenBidRecordList(mgtScreenBidPage));
    }
    /**
     * 添加商品
     *
     * @param dto 大屏操作台添加商品数据传输对象
     */
    @PostMapping("/add-goods")
    @ApiOperation(value = "添加商品", notes = "添加商品")
    public R<?> addGoods(@Validated @RequestBody MgtScreenSalesroomGoodsDTO dto) {
        auctionSalesroomService.addGoods(dto);
        return R.ok();
    }
    /**
     * 获取备选拍品列表的分页数据
     *
     * @param query 拍卖场商品关系查询对象
     * @return PageDTO<MgtAuctionSalesroomGoodsVO>
     */
    @PostMapping("/backup-goods")
    @ApiOperation(value = "获取备选拍品列表的分页数据", notes = "获取备选拍品列表的分页数据")
    public R<PageDTO<MgtAuctionSalesroomGoodsVO>> backupGoods(
            @Validated @RequestBody MgtAuctionSalesroomGoodsQuery query) {
        return R.ok(auctionSalesroomService.backupGoods(query));
    }
    /**
     * 添加备选商品
     *
     * @param idStr 备选商品id集合
     */
    @PutMapping("/add-backup-goods")
    @ApiOperation(value = "选择备选商品", notes = "选择备选商品")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "idStr", value = "商品id集合", required = true)
    })
    public R<?> addBackupGoods(@RequestParam("idStr") String idStr) {
        auctionSalesroomService.addBackupGoods(idStr);
        return R.ok();
    }
    /**
     * 结束当前拍卖商品
     *
     * @param id 拍卖场商品id
     */
    @PutMapping("/stop-current/{id}")
    @ApiOperation("结束当前拍卖商品")
    public R<?> stopCurrentGoods(
            @ApiParam(name = "id", value = "拍卖场商品id", required = true) @PathVariable("id") Long id) {
        try {
            auctionSalesroomService.stopCurrentGoods(id);
        } catch (JsonProcessingException e) {
            throw new RuntimeException(e);
        }
        return R.ok();
    }
    /**
     * 开始下一拍卖商品
     *
     * @param id 拍卖场商品id
     */
    @PutMapping("/start-next/{id}")
    @ApiOperation("开始下一拍卖商品")
    public R<?> startNextGoods(
            @ApiParam(name = "id", value = "拍卖场商品id", required = true) @PathVariable("id") Long id) {
        try {
            auctionSalesroomService.startNextGoods(id);
        } catch (JsonProcessingException e) {
            throw new RuntimeException(e);
        }
        return R.ok();
    }
    /**
     * 播放视频
     *
     * @param dto 大屏播放视频对象
     */
    @PostMapping("/play")
    @ApiOperation("播放视频-确认")
    public R<?> play(@Validated @RequestBody MgtScreenVideoDTO dto) {
        auctionSalesroomService.play(dto);
        return R.ok();
    }
    /**
     * 结束播放
     *
     * @param auctionSalesroomId 拍卖场id
     */
    @PutMapping("/stop-play/{auctionSalesroomId}")
    @ApiOperation("结束播放")
    public R<?> stopPlay(
            @ApiParam(name = "auctionSalesroomId", value = "拍卖场id", required = true)
            @PathVariable("auctionSalesroomId") Long auctionSalesroomId) {
        auctionSalesroomService.stopPlay(auctionSalesroomId);
        return R.ok();
    }
    /**
     * 开始当前拍卖场
     *
     * @param auctionSalesroomId 拍卖场id
     */
    @PutMapping("/start-auction/{auctionSalesroomId}")
    @ApiOperation("开始当前拍卖场")
    public R<?> startCurrentAuctionSalesroom(
            @ApiParam(name = "auctionSalesroomId", value = "拍卖场id", required = true)
            @PathVariable("auctionSalesroomId") Long auctionSalesroomId) {
        try {
            auctionSalesroomService.startCurrentAuctionSalesroom(auctionSalesroomId);
        } catch (JsonProcessingException e) {
            throw new RuntimeException(e);
        }
        return R.ok();
    }
    /**
     * 结束当前拍卖场
     *
     * @param auctionSalesroomId 拍卖场id
     */
    @PutMapping("/stop-auction/{auctionSalesroomId}")
    @ApiOperation("结束当前拍卖场")
    public R<?> stopCurrentAuctionSalesroom(
            @ApiParam(name = "auctionSalesroomId", value = "拍卖场id", required = true)
            @PathVariable("auctionSalesroomId") Long auctionSalesroomId) {
        try {
            auctionSalesroomService.stopCurrentAuctionSalesroom(auctionSalesroomId);
        } catch (JsonProcessingException e) {
            throw new RuntimeException(e);
        }
        return R.ok();
    }
}