luodangjia
2024-12-10 ee7ce5d1cbf80bee0a15c1e5bc5eaa30858d812b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package com.hollywood.manage.controller;
 
 
import com.hollywood.common.basic.ApiResult;
import com.hollywood.common.basic.PageInfo;
import com.hollywood.common.model.TUser;
import com.hollywood.common.model.TVideo;
import com.hollywood.common.model.TVideoReport;
import com.hollywood.manage.query.TVideoReportQuery;
import com.hollywood.manage.service.TUserService;
import com.hollywood.manage.service.TVideoReportService;
import com.hollywood.manage.service.TVideoService;
import com.hollywood.manage.vo.TVideoReportVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.Objects;
 
/**
 * <p>
 * 短视频举报举报管理 前端控制器
 * </p>
 *
 * @author xiaochen
 * @since 2024-02-29
 */
@Api(tags = "短视频举报管理")
@RestController
@RequestMapping("/tVideoReport")
public class TVideoReportController {
 
    private final TVideoReportService videoReportService;
    private final TVideoService videoService;
    private final TUserService userService;
 
    @Autowired
    public TVideoReportController(TVideoReportService videoReportService, TVideoService videoService, TUserService userService) {
        this.videoReportService = videoReportService;
        this.videoService = videoService;
        this.userService = userService;
    }
 
 
    /**
     * 获取短视频举报管理分页列表
     */
    @ApiOperation(value = "获取短视频举报管理分页列表")
    @PostMapping(value = "/pageList")
    public ApiResult<PageInfo<TVideoReportVO>> pageList(@RequestBody TVideoReportQuery query) {
        PageInfo<TVideoReportVO> videoReportVOPageInfo = videoReportService.pageList(query);
        return ApiResult.success(videoReportVOPageInfo);
    }
 
    /**
     * 获取短视频举报管理详情
     */
    @ApiOperation(value = "获取短视频举报管理详情")
    @GetMapping(value = "/getDetailById")
    public ApiResult<TVideoReportVO> getDetailById(@RequestParam Long id) {
        TVideoReport videoReport = videoReportService.getById(id);
        TVideoReportVO videoReportVO = new TVideoReportVO();
        BeanUtils.copyProperties(videoReport, videoReportVO);
        // 查询视频信息
        TVideo video = videoService.getById(videoReport.getVideoId());
        if(Objects.nonNull(video)){
            videoReportVO.setVideoTitle(video.getVideoTitle());
        }
        // 查询用户信息
        TUser user = userService.getById(videoReport.getUserId());
        if(Objects.nonNull(user)){
            videoReportVO.setNickName(user.getNickName());
        }
        return ApiResult.success(videoReportVO);
    }
 
    /**
     * 通过id删除短视频举报
     */
    @ApiOperation(value = "通过id删除短视频举报")
    @DeleteMapping(value = "/deleteById")
    public ApiResult<Boolean> deleteById(@RequestParam Long id) {
        return ApiResult.success(videoReportService.removeById(id));
    }
 
    /**
     * 短视频举报上下架
     */
    @ApiOperation(value = "短视频举报处理")
    @GetMapping(value = "/upAndDown")
    public ApiResult upAndDown(@RequestParam Long id,
                                @RequestParam Integer status) {
        return ApiResult.success(videoReportService.upAndDown(id,status));
    }
 
}