|
@@ -0,0 +1,111 @@
|
|
|
+package com.fdkankan.scene.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import com.fdkankan.common.constant.ErrorCode;
|
|
|
+import com.fdkankan.common.constant.RebuildResult;
|
|
|
+import com.fdkankan.common.constant.RecStatus;
|
|
|
+import com.fdkankan.common.exception.BusinessException;
|
|
|
+import com.fdkankan.common.response.ResultData;
|
|
|
+import com.fdkankan.scene.entity.ScenePro;
|
|
|
+import com.fdkankan.scene.entity.VideoSceneProgress;
|
|
|
+import com.fdkankan.scene.mapper.IVideoSceneProgressMapper;
|
|
|
+import com.fdkankan.scene.service.ISceneProService;
|
|
|
+import com.fdkankan.scene.service.IVideoSceneProgressService;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fdkankan.scene.vo.RebuildVedioSceneParamVO;
|
|
|
+import com.fdkankan.scene.vo.VideoSceneProgressVO;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.Calendar;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 视频重算进度 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author
|
|
|
+ * @since 2022-01-14
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class VideoSceneProgressServiceImpl extends ServiceImpl<IVideoSceneProgressMapper, VideoSceneProgress> implements IVideoSceneProgressService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISceneProService sceneProService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<VideoSceneProgressVO> findVideoSceneProgress(RebuildVedioSceneParamVO param) {
|
|
|
+
|
|
|
+ List<VideoSceneProgress> videoSceneProgressyList =
|
|
|
+ this.list(new LambdaQueryWrapper<VideoSceneProgress>()
|
|
|
+ .select(VideoSceneProgress::getId, VideoSceneProgress::getVideoName, VideoSceneProgress::getRebuildResult)
|
|
|
+ .eq(VideoSceneProgress::getRecStatus, RecStatus.VALID.code())
|
|
|
+ .eq(VideoSceneProgress::getSceneCode, param.getSceneNum()));
|
|
|
+
|
|
|
+ List<VideoSceneProgressVO> result = videoSceneProgressyList.parallelStream().map(vsp -> {
|
|
|
+ VideoSceneProgressVO vo = new VideoSceneProgressVO();
|
|
|
+ BeanUtils.copyProperties(vsp, vo);
|
|
|
+ return vo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ this.update(new LambdaUpdateWrapper<VideoSceneProgress>()
|
|
|
+ .set(VideoSceneProgress::getRebuildResult, RebuildResult.POLLED.code())
|
|
|
+ .eq(VideoSceneProgress::getSceneCode, param.getSceneNum())
|
|
|
+ .eq(VideoSceneProgress::getRecStatus, RecStatus.VALID.code())
|
|
|
+ .eq(VideoSceneProgress::getRebuildResult, RebuildResult.SUCCESS.code()));
|
|
|
+
|
|
|
+ //更新访问量
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateProgressRec(RebuildVedioSceneParamVO param) {
|
|
|
+ this.update(new LambdaUpdateWrapper<VideoSceneProgress>()
|
|
|
+ .set(VideoSceneProgress::getRecStatus, RecStatus.DISABLE.code())
|
|
|
+ .eq(VideoSceneProgress::getSceneCode, param.getSceneNum())
|
|
|
+ .eq(VideoSceneProgress::getVideoName, param.getPanoId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public VideoSceneProgress findrebuildVideoProgressDetail(String num,String panId) {
|
|
|
+ VideoSceneProgress videoSceneProgress =
|
|
|
+ this.getOne(new LambdaQueryWrapper<VideoSceneProgress>()
|
|
|
+ .eq(VideoSceneProgress::getRecStatus, RecStatus.VALID.code())
|
|
|
+ .eq(VideoSceneProgress::getSceneCode, num)
|
|
|
+ .eq(VideoSceneProgress::getVideoName, panId));
|
|
|
+ return videoSceneProgress;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateProgress(String num, String panId, Integer status) {
|
|
|
+
|
|
|
+ this.update(new LambdaUpdateWrapper<VideoSceneProgress>()
|
|
|
+ .set(VideoSceneProgress::getRebuildResult, status)
|
|
|
+ .set(VideoSceneProgress::getRebuildEndTime, Calendar.getInstance().getTime())
|
|
|
+ .eq(VideoSceneProgress::getSceneCode, num)
|
|
|
+ .eq(VideoSceneProgress::getRecStatus, RecStatus.VALID.code())
|
|
|
+ .eq(VideoSceneProgress::getVideoName, panId));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public ResultData rebuildVideoSceneProgress(RebuildVedioSceneParamVO param) throws Exception {
|
|
|
+
|
|
|
+ if(StringUtils.isEmpty(param.getSceneNum())){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
|
+ }
|
|
|
+
|
|
|
+ ScenePro scenePro = sceneProService.findBySceneNum(param.getSceneNum());
|
|
|
+ if(null == scenePro){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
+ }
|
|
|
+
|
|
|
+ return ResultData.ok(this.findVideoSceneProgress(param));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|