VideoContentController.java 21.2 KB
Newer Older
liqin's avatar
liqin committed
1
package cn.chnmuseum.party.web.controller;
liqin's avatar
liqin committed
2

liqin's avatar
liqin committed
3 4 5 6 7 8 9 10 11 12
import cn.chnmuseum.party.common.enums.*;
import cn.chnmuseum.party.common.log.MethodLog;
import cn.chnmuseum.party.common.log.OperModule;
import cn.chnmuseum.party.common.log.OperType;
import cn.chnmuseum.party.common.validator.groups.Add;
import cn.chnmuseum.party.common.validator.groups.Update;
import cn.chnmuseum.party.common.vo.GenericPageParam;
import cn.chnmuseum.party.model.*;
import cn.chnmuseum.party.service.*;
import cn.chnmuseum.party.web.controller.base.BaseController;
13
import cn.hutool.core.collection.CollectionUtil;
liqin's avatar
liqin committed
14
import com.alibaba.fastjson.JSONObject;
liqin's avatar
liqin committed
15
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
16
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
17 18
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
liqin's avatar
liqin committed
19 20 21 22 23 24 25 26
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
wzp's avatar
wzp committed
27
import org.apache.shiro.authz.annotation.RequiresAuthentication;
liqin's avatar
liqin committed
28 29 30 31
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
32
import java.time.LocalDateTime;
liqin's avatar
liqin committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * <pre>
 * 视频内容 前端控制器
 * </pre>
 *
 * @author Danny Lee
 * @since 2021-03-16
 */
@Slf4j
@RestController
@RequestMapping("/videoContent")
liqin's avatar
liqin committed
48
@Api(tags = {"视频内容接口"})
liqin's avatar
liqin committed
49 50
public class VideoContentController extends BaseController {

liqin's avatar
liqin committed
51 52
    @Resource
    private ExhibitionBoardService exhibitionBoardService;
liqin's avatar
liqin committed
53 54 55 56 57 58 59 60 61 62 63 64
    @Resource
    private VideoContentService videoContentService;
    @Resource
    private CopyrightOwnerService copyrightOwnerService;
    @Resource
    private VideoContentCatService videoContentCatService;
    @Resource
    private AssetService assetService;
    @Resource
    private AuditService auditService;

    @PostMapping(value = "/save")
wzp's avatar
wzp committed
65
    @RequiresAuthentication  //@RequiresPermissions("video:content:save")
liqin's avatar
liqin committed
66
    @ApiOperation(value = "添加视频内容", notes = "添加视频内容")
wzp's avatar
wzp committed
67
    @MethodLog(operModule = OperModule.VIDEOCONTENT, operType = OperType.ADD)
liqin's avatar
liqin committed
68
    public Map<String, Object> saveVideoContent(@Validated(value = {Add.class}) VideoContent videoContent) {
liqin's avatar
liqin committed
69 70 71 72 73
        final LambdaQueryWrapper<VideoContent> lambdaQueryWrapper = Wrappers.<VideoContent>lambdaQuery().eq(VideoContent::getName, videoContent.getName().trim());
        final int count = this.videoContentService.count(lambdaQueryWrapper);
        if (count > 0) {
            return getFailResult("400", "名称已存在,请修改名称");
        }
liqin's avatar
liqin committed
74 75
        final List<String> videoFileIdList = videoContent.getVideoFileIdList();
        if (videoFileIdList == null || videoFileIdList.isEmpty()) {
liqin's avatar
liqin committed
76 77
            return getFailResult("400", "视频文件必须上传");
        }
liqin's avatar
liqin committed
78 79 80 81 82
        final List<Asset> assetList = this.assetService.listByIds(videoFileIdList);
        final List<String> languageList = assetList.stream().map(Asset::getLanguage).collect(Collectors.toList());
        if (!languageList.contains(LanguageEnum.ZH.name())) {
            return getFailResult("视频文件必须包含汉语");
        }
83 84 85
        if (StringUtils.isBlank(videoContent.getVideoContentCatId())) {
            return getFailResult("视频内容必须选择");
        }
liqin's avatar
liqin committed
86

liqin's avatar
liqin committed
87 88 89 90 91 92 93
        videoContent.setAuditStatus(AuditStatusEnum.TBC.name());
        videoContent.setPublished(false);
        videoContent.setDeleted(false);
        // 保存业务节点信息
        boolean result = videoContentService.save(videoContent);
        // 返回操作结果
        if (result) {
liqin's avatar
liqin committed
94 95
            for (String videoFileId : videoFileIdList) {
                final Asset asset = this.assetService.getById(videoFileId);
liqin's avatar
liqin committed
96 97 98 99 100
                asset.setThumbnail(videoContent.getThumbnail());
                asset.setFileType(FileTypeEnum.VIDEO.name());
                asset.setFileCat(FileCatEnum.VIDEO_CONTENT.name());
                asset.setRefItemId(videoContent.getId());
                this.assetService.updateById(asset);
liqin's avatar
liqin committed
101 102 103 104 105

                if (StringUtils.isBlank(videoContent.getName())) {
                    videoContent.setName(asset.getVideoContentName());
                    this.videoContentService.updateById(videoContent);
                }
liqin's avatar
liqin committed
106 107
            }

liqin's avatar
liqin committed
108 109
            final Audit audit = Audit.builder()
                    .content(videoContent.getName())
liqin's avatar
liqin committed
110
                    .name(videoContent.getName())
liqin's avatar
liqin committed
111
                    .userId(getcurUser().getId())
liqin's avatar
liqin committed
112
                    .organId(getcurUser().getOrgId())
liqin's avatar
liqin committed
113
                    .refItemId(videoContent.getId())
liqin's avatar
liqin committed
114 115
                    .type(AuditTypeEnum.VIDEO_CONTENT.name())
                    .operation(AuditOperationEnum.ADD.name())
liqin's avatar
liqin committed
116
                    .status(AuditStatusEnum.TBC.name())
liqin's avatar
liqin committed
117 118
                    .level(AuditStatusEnum.TBC.name())
                    .build();
liqin's avatar
liqin committed
119 120 121 122 123 124 125
            this.auditService.save(audit);
            return getSuccessResult();
        }
        return getFailResult();
    }

    @PutMapping("/update")
wzp's avatar
wzp committed
126
    @RequiresAuthentication  //@RequiresPermissions("video:content:update")
liqin's avatar
liqin committed
127
    @ApiOperation(value = "修改视频内容信息", notes = "修改视频内容信息")
wzp's avatar
wzp committed
128
    @MethodLog(operModule = OperModule.VIDEOCONTENT, operType = OperType.UPDATE)
liqin's avatar
liqin committed
129
    public Map<String, Object> updateVideoContent(@Validated(value = {Update.class}) VideoContent videoContent) {
liqin's avatar
liqin committed
130 131 132 133 134 135
        final LambdaQueryWrapper<VideoContent> lambdaQueryWrapper = Wrappers.<VideoContent>lambdaQuery().eq(VideoContent::getName, videoContent.getName().trim());
        lambdaQueryWrapper.ne(VideoContent::getId, videoContent.getId());
        final int count = this.videoContentService.count(lambdaQueryWrapper);
        if (count > 0) {
            return getFailResult("400", "名称已存在,请修改名称");
        }
liqin's avatar
liqin committed
136 137 138 139
        final List<String> videoFileIdList = videoContent.getVideoFileIdList();
        if (videoFileIdList == null || videoFileIdList.isEmpty()) {
            return getFailResult("400", "视频文件必须上传");
        }
liqin's avatar
liqin committed
140 141 142 143 144
        final List<Asset> assetList = this.assetService.listByIds(videoFileIdList);
        final List<String> languageList = assetList.stream().map(Asset::getLanguage).collect(Collectors.toList());
        if (!languageList.contains(LanguageEnum.ZH.name())) {
            return getFailResult("视频文件必须包含汉语");
        }
145 146 147 148 149 150
        //如果不上传文件id,就代表前端删除这个视频文件
        LambdaQueryWrapper<Asset> assetWrapper = new QueryWrapper<Asset>().lambda()
                .eq(Asset::getRefItemId, videoContent.getId())
                .notIn(Asset::getId, videoFileIdList);
        boolean remove = assetService.remove(assetWrapper);

liqin's avatar
liqin committed
151 152 153 154 155 156 157 158 159 160
        for (String videoFileId : videoFileIdList) {
            final Asset asset = this.assetService.getById(videoFileId);
            if (!asset.getPublished()) {
                asset.setThumbnail(videoContent.getThumbnail());
                asset.setFileType(FileTypeEnum.VIDEO.name());
                asset.setFileCat(FileCatEnum.VIDEO_CONTENT.name());
                asset.setRefItemId(videoContent.getId());
                this.assetService.updateById(asset);
            }
        }
liqin's avatar
liqin committed
161

liqin's avatar
liqin committed
162 163 164 165
        final Audit audit = Audit.builder()
                .content(videoContent.getName())
                .name(videoContent.getName())
                .userId(getcurUser().getId())
liqin's avatar
liqin committed
166
                .organId(getcurUser().getOrgId())
liqin's avatar
liqin committed
167 168 169 170 171 172 173 174
                .refItemId(videoContent.getId())
                .type(AuditTypeEnum.VIDEO_CONTENT.name())
                .operation(AuditOperationEnum.EDIT.name())
                .status(AuditStatusEnum.TBC.name())
                .level(AuditStatusEnum.TBC.name())
                .modelData(JSONObject.toJSONString(videoContent))
                .build();
        this.auditService.save(audit);
175 176 177
        //修改自身审核状态信息为待初审
        videoContent.setAuditStatus(AuditStatusEnum.TBC.name());
        videoContentService.updateById(videoContent);
liqin's avatar
liqin committed
178
        return getSuccessResult();
liqin's avatar
liqin committed
179 180
    }

liqin's avatar
liqin committed
181 182 183 184 185 186
    @GetMapping("/getExhibitionBoardById/{id}")
    @RequiresAuthentication  //@RequiresPermissions("video:content:delete")
    @ApiOperation(value = "根据视频内容ID查询被引用的展板", notes = "根据视频内容ID查询被引用的展板")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "标识ID", paramType = "path", dataType = "String", required = true)
    })
wzp's avatar
wzp committed
187
    @MethodLog(operModule = OperModule.VIDEOCONTENT, operType = OperType.SELECT)
liqin's avatar
liqin committed
188 189 190 191
    public Map<String, Object> getExhibitionBoardById(@PathVariable("id") String id) {
        final List<ExhibitionBoard> exhibitionBoardList = this.exhibitionBoardService.list(Wrappers.<ExhibitionBoard>lambdaQuery().eq(ExhibitionBoard::getVideoContentId, id));
        if (!exhibitionBoardList.isEmpty()) {
            final String collect = exhibitionBoardList.stream().map(ExhibitionBoard::getName).collect(Collectors.joining("、"));
liqin's avatar
liqin committed
192
            return getResult(collect);
liqin's avatar
liqin committed
193 194 195 196
        }
        return getSuccessResult();
    }

liqin's avatar
liqin committed
197
    @GetMapping("/getList")
wzp's avatar
wzp committed
198
    @RequiresAuthentication  //@RequiresPermissions("video:content:list")
liqin's avatar
liqin committed
199 200 201 202 203 204
    @ApiOperation(value = "获取视频内容全部列表(无分页)", notes = "获取视频内容全部列表(无分页)")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "auditStatus", value = "审核状态", paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "videoContentCatId", value = "视频内容分类ID", paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "videoContentCopyrightOwnerId", value = "视频内容版权方ID", paramType = "query", dataType = "String")
    })
wzp's avatar
wzp committed
205
    @MethodLog(operModule = OperModule.VIDEOCONTENT, operType = OperType.SELECT)
liqin's avatar
liqin committed
206 207 208 209
    public Map<String, Object> getVideoContentList(@RequestParam(value = "auditStatus", required = false) AuditStatusEnum auditStatus,
                                                   @RequestParam(value = "videoContentCatId", required = false) String videoContentCatId,
                                                   @RequestParam(value = "videoContentCopyrightOwnerId", required = false) String videoContentCopyrightOwnerId) {
        final LambdaQueryWrapper<VideoContent> lambdaQueryWrapper = new LambdaQueryWrapper<>();
liqin's avatar
liqin committed
210
        lambdaQueryWrapper.eq(VideoContent::getPublished, true);
liqin's avatar
liqin committed
211 212 213 214 215 216 217 218 219
        if (auditStatus != null) {
            lambdaQueryWrapper.eq(VideoContent::getAuditStatus, auditStatus.name());
        }
        if (StringUtils.isNotBlank(videoContentCatId)) {
            lambdaQueryWrapper.eq(VideoContent::getVideoContentCatId, videoContentCatId);
        }
        if (StringUtils.isNotBlank(videoContentCopyrightOwnerId)) {
            lambdaQueryWrapper.eq(VideoContent::getVideoContentCopyrightOwnerId, videoContentCopyrightOwnerId);
        }
liqin's avatar
liqin committed
220
        lambdaQueryWrapper.orderByDesc(VideoContent::getCreateTime);
liqin's avatar
liqin committed
221 222 223 224 225 226 227 228 229 230 231 232 233 234
        List<VideoContent> videoContentList = videoContentService.list(lambdaQueryWrapper);
        return getResult(videoContentList);
    }

    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
            @ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
            @ApiImplicitParam(name = "nameOrCode", value = "名称或编码", paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "videoContentCatId", value = "视频内容分类ID", paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "videoContentCopyrightOwnerId", value = "视频内容版权方ID", paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "startDate", value = "创建时间-开始", paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "endDate", value = "创建时间-结束", paramType = "query", dataType = "String")
    })
    @PostMapping("/getPageList")
wzp's avatar
wzp committed
235
    @RequiresAuthentication  //@RequiresPermissions("video:content:page")
liqin's avatar
liqin committed
236
    @ApiOperation(value = "获取视频内容分页列表", notes = "获取视频内容分页列表")
wzp's avatar
wzp committed
237
    @MethodLog(operModule = OperModule.VIDEOCONTENT, operType = OperType.SELECT)
liqin's avatar
liqin committed
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
    public Map<String, Object> getAssetPageList(GenericPageParam genericPageParam) {
        LambdaQueryWrapper<VideoContent> queryWrapper = new LambdaQueryWrapper<>();
        // 对名称或编码模糊查询
        if (StringUtils.isNotBlank(genericPageParam.getNameOrCode())) {
            queryWrapper.like(VideoContent::getName, genericPageParam.getNameOrCode());
        }
        if (StringUtils.isNotBlank(genericPageParam.getVideoContentCatId())) {
            queryWrapper.eq(VideoContent::getVideoContentCatId, genericPageParam.getVideoContentCatId());
        }
        if (StringUtils.isNotBlank(genericPageParam.getVideoContentCopyrightOwnerId())) {
            queryWrapper.eq(VideoContent::getVideoContentCopyrightOwnerId, genericPageParam.getVideoContentCopyrightOwnerId());
        }
        // 根据创建时间区间检索
        if (genericPageParam.getStartDate() != null && genericPageParam.getEndDate() != null) {
            queryWrapper.ge(VideoContent::getCreateTime, genericPageParam.getStartDate().atTime(0, 0, 0))
                    .le(VideoContent::getCreateTime, genericPageParam.getEndDate().atTime(23, 59, 59));
        }
liqin's avatar
liqin committed
255
        queryWrapper.eq(VideoContent::getDeleted, false);
liqin's avatar
liqin committed
256 257 258 259 260 261 262 263
        // 设置排序规则
        queryWrapper.orderByDesc(VideoContent::getCreateTime);
        // 设置查询内容
        queryWrapper.select(
                VideoContent::getId,
                VideoContent::getName,
                VideoContent::getAuditStatus,
                VideoContent::getPublished,
liqin's avatar
liqin committed
264
                VideoContent::getDeleted,
liqin's avatar
liqin committed
265 266 267 268 269 270 271 272 273 274 275 276
                VideoContent::getVideoContentCatId,
                VideoContent::getVideoContentCopyrightOwnerId,
                VideoContent::getCreateTime,
                VideoContent::getUpdateTime);
        Page<VideoContent> page = this.videoContentService.page(getPage(), queryWrapper);
        for (VideoContent videoContent : page.getRecords()) {
            if (videoContent.getVideoContentCatId() != null) {
                VideoContentCat videoContentCat = this.videoContentCatService.getById(videoContent.getVideoContentCatId());
                videoContent.setVideoContentCatName(videoContentCat.getName());
            }
            if (videoContent.getVideoContentCopyrightOwnerId() != null) {
                CopyrightOwner copyrightOwner = this.copyrightOwnerService.getById(videoContent.getVideoContentCopyrightOwnerId());
liqin's avatar
liqin committed
277 278 279 280 281
                if (copyrightOwner == null) {
                    videoContent.setVideoContentCopyrightOwnerName("对应的版权方已被删除");
                } else {
                    videoContent.setVideoContentCopyrightOwnerName(copyrightOwner.getName());
                }
liqin's avatar
liqin committed
282 283 284 285 286 287 288 289 290 291
            }
        }
        return getResult(page);
    }

    @ApiOperation(value = "获取视频内容详情", notes = "获取视频内容详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "标识ID", dataType = "String", paramType = "path", required = true)
    })
    @GetMapping("/get/{id}")
wzp's avatar
wzp committed
292
    @RequiresAuthentication  //@RequiresPermissions("video:content:get:id")
wzp's avatar
wzp committed
293
    @MethodLog(operModule = OperModule.VIDEOCONTENT, operType = OperType.SELECT)
liqin's avatar
liqin committed
294 295
    public Map<String, Object> getById(@PathVariable("id") String id) {
        VideoContent videoContent = videoContentService.getById(id);
296 297 298 299
        //修改服务器报500错误
        if (videoContent==null){
            return getSuccessResult();
        }
liqin's avatar
liqin committed
300 301 302 303 304 305 306 307 308 309 310 311 312
        if (videoContent.getVideoContentCatId() != null) {
            VideoContentCat videoContentCat = this.videoContentCatService.getById(videoContent.getVideoContentCatId());
            if (videoContentCat != null) {
                videoContent.setVideoContentCatName(videoContentCat.getName());
            }
        }
        if (videoContent.getVideoContentCopyrightOwnerId() != null) {
            CopyrightOwner copyrightOwner = this.copyrightOwnerService.getById(videoContent.getVideoContentCopyrightOwnerId());
            if (copyrightOwner != null) {
                videoContent.setVideoContentCopyrightOwnerName(copyrightOwner.getName());
            }
        }
        final LambdaQueryWrapper<Asset> assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, id);
313
//        assetQueryWrapper.eq(Asset::getPublished, true);
liqin's avatar
liqin committed
314 315 316 317
        assetQueryWrapper.eq(Asset::getFileCat, FileCatEnum.VIDEO_CONTENT.name());
        final List<Asset> videoFileList = this.assetService.list(assetQueryWrapper);
        videoContent.setVideoFileList(videoFileList);
        videoContent.setVideoFileIdList(videoFileList.stream().map(Asset::getId).collect(Collectors.toList()));
liqin's avatar
liqin committed
318 319 320 321 322

        final LambdaQueryWrapper<Audit> auditQueryWrapper = Wrappers.<Audit>lambdaQuery().eq(Audit::getRefItemId, id);
        final List<Audit> auditList = this.auditService.list(auditQueryWrapper);
        videoContent.setAuditHistoryList(auditList);

liqin's avatar
liqin committed
323 324 325 326 327
        return getResult(videoContent);
    }

    @ApiOperation(value = "获取视频内容详情(审核详情使用)", notes = "获取视频内容详情(审核详情使用)")
    @ApiImplicitParams({
liqin's avatar
liqin committed
328
            @ApiImplicitParam(name = "auditId", value = "审核ID", dataType = "String", paramType = "path", required = true)
liqin's avatar
liqin committed
329
    })
liqin's avatar
liqin committed
330
    @GetMapping("/getAudit/{auditId}")
liqin's avatar
liqin committed
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347
    @RequiresAuthentication  //@RequiresPermissions("video:content:get:id")
    @MethodLog(operModule = OperModule.VIDEOCONTENT, operType = OperType.SELECT)
    public Map<String, Object> getAuditInfoById(@PathVariable("auditId") String auditId) {
        final VideoContent videoContent = JSONObject.parseObject(this.auditService.getById(auditId).getModelData(), VideoContent.class);
        final String id = videoContent.getId();
        if (videoContent.getVideoContentCatId() != null) {
            VideoContentCat videoContentCat = this.videoContentCatService.getById(videoContent.getVideoContentCatId());
            if (videoContentCat != null) {
                videoContent.setVideoContentCatName(videoContentCat.getName());
            }
        }
        if (videoContent.getVideoContentCopyrightOwnerId() != null) {
            CopyrightOwner copyrightOwner = this.copyrightOwnerService.getById(videoContent.getVideoContentCopyrightOwnerId());
            if (copyrightOwner != null) {
                videoContent.setVideoContentCopyrightOwnerName(copyrightOwner.getName());
            }
        }
liqin's avatar
liqin committed
348 349 350 351

        final List<String> videoFileIdList = videoContent.getVideoFileIdList();
        final List<Asset> videoFileList = this.assetService.listByIds(videoFileIdList);
        videoContent.setVideoFileIdList(videoFileIdList);
liqin's avatar
liqin committed
352 353
        videoContent.setVideoFileList(videoFileList);

liqin's avatar
liqin committed
354 355 356 357
        final LambdaQueryWrapper<Audit> auditQueryWrapper = Wrappers.<Audit>lambdaQuery().eq(Audit::getRefItemId, id);
        final List<Audit> auditList = this.auditService.list(auditQueryWrapper);
        videoContent.setAuditHistoryList(auditList);

liqin's avatar
liqin committed
358 359 360
        return getResult(videoContent);
    }

liqin's avatar
liqin committed
361 362 363 364 365 366 367 368
    @DeleteMapping("/delete/{id}")
    @RequiresAuthentication  //@RequiresPermissions("video:content:delete")
    @ApiOperation(value = "根据ID删除视频内容", notes = "根据ID删除视频内容")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "标识ID", paramType = "path", dataType = "String", required = true)
    })
    @MethodLog(operModule = OperModule.VIDEOCONTENT, operType = OperType.DELETE)
    public Map<String, Object> deleteVideoContent(@PathVariable("id") String id) {
369 370 371
        // 视频关联展板时视频不能被删除
        final List<ExhibitionBoard> exhibitionBoardList = this.exhibitionBoardService.list(Wrappers.<ExhibitionBoard>lambdaQuery().eq(ExhibitionBoard::getVideoContentId, id));
        if (CollectionUtil.isNotEmpty(exhibitionBoardList)) {
372
            return getFailResult("该视频有对应的展板信息,无法删除!");
373
        }
liqin's avatar
liqin committed
374
        final VideoContent videoContent = this.videoContentService.getById(id);
liqin's avatar
liqin committed
375
        final Audit audit = Audit.builder()
liqin's avatar
liqin committed
376 377
                .content(videoContent.getName())
                .name(videoContent.getName())
liqin's avatar
liqin committed
378
                .refItemId(id)
liqin's avatar
liqin committed
379
                .userId(getcurUser().getId())
liqin's avatar
liqin committed
380 381 382 383 384 385
                .type(AuditTypeEnum.VIDEO_CONTENT.name())
                .operation(AuditOperationEnum.REMOVE.name())
                .status(AuditStatusEnum.TBC.name())
                .level(AuditStatusEnum.TBC.name())
                .build();
        final boolean result = this.auditService.save(audit);
386 387 388 389 390 391 392
        //修改自己的状态为 待初审
        LambdaUpdateWrapper<VideoContent> set = new UpdateWrapper<VideoContent>().lambda()
                .eq(VideoContent::getId, videoContent.getId())
                .set(VideoContent::getUpdateTime, LocalDateTime.now())
                .set(VideoContent::getAuditStatus, AuditStatusEnum.TBC.name());
        boolean update = videoContentService.update(set);

liqin's avatar
liqin committed
393 394 395 396 397 398
        if (result) {
            return getSuccessResult();
        }
        return getFailResult();
    }

liqin's avatar
liqin committed
399 400
}