Procházet zdrojové kódy

Merge branch 'dev'

yangdamao před 1 rokem
rodič
revize
0a9e9077a4

+ 24 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseSectionServiceImpl.java

@@ -8,6 +8,7 @@ import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
@@ -35,6 +36,7 @@ import com.zhongzheng.modules.polyv.service.IPolyvLiveService;
 import com.zhongzheng.modules.polyv.service.IPolyvVideoService;
 import com.zhongzheng.modules.polyv.vo.PolyvVideoQuerVo;
 import com.zhongzheng.modules.tencentcloud.service.IVodService;
+import net.polyv.common.v1.util.StringUtils;
 import net.polyv.live.v1.entity.chat.LiveGetMessageListResponse;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -460,6 +462,7 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
                 String chapterName = item.getChapterName();//章标题
                 String chapterPrefixName = item.getChapterPrefixName();//章前缀
                 int sortIndex = item.getSectionList().size();
+                Integer chapterViewSign = 1;
                 for(CourseSectionEasyImport sectionImport : item.getSectionList()){
                     Index++;
                     CourseSectionAddBo bo = new CourseSectionAddBo();
@@ -482,6 +485,8 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
                         errorLog+="第"+(size - Index)+"条:"+sectionImport.getSectionType()+"-该节类型不存在。\r\n";
                         continue;
                     }
+
+                    Integer viewSign = findViewSign(sectionImport.getViewSign());
                     bo.setPrefixName(sectionImport.getPrefixName());
                     bo.setName(sectionImport.getName());
                     bo.setName(sectionImport.getName());
@@ -489,6 +494,7 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
                     bo.setImportBy(operName);
                     bo.setImportNo(importNo);
                     bo.setSectionType(sectionType);
+                    bo.setViewSign(viewSign);
                     //    bo.setDurationTime(sectionImport.getDurationTime());
                     bo.setRecordingUrl(sectionImport.getRecordingUrl());
                     bo.setLiveUrl(sectionImport.getLiveUrl());
@@ -502,7 +508,7 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
                     if(Validator.isNotEmpty(sectionImport.getLiveEndTime())){
                         bo.setLiveEndTime(Convert.toLong(sectionImport.getLiveEndTime().getTime())/1000);
                     }
-                    if(bo.getSectionType()==1){
+                    if(bo.getSectionType()==1 && bo.getViewSign() != 2){
                         try{
                             PolyvVideoQuerVo poly = iPolyvVideoService.queryById(bo.getRecordingUrl());
                             if(Validator.isNotEmpty(poly)){
@@ -513,6 +519,15 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
                             continue;
                         }
                     }
+                    if (bo.getSectionType()==1 && bo.getViewSign() == 2){
+                        //腾讯视频
+                        if (StringUtils.isEmpty(sectionImport.getDurationTimeTX())){
+                            errorLog+="第"+(size - Index)+"条:腾讯视频时长不能为空。\r\n";
+                            continue;
+                        }
+                        chapterViewSign = 2;
+                        bo.setDurationTime(Long.valueOf(sectionImport.getDurationTimeTX()));
+                    }
                     if(bo.getSectionType()==2){
                         bo.setDurationTime(bo.getLiveEndTime().longValue() - bo.getLiveStartTime().longValue());
                     }
@@ -535,6 +550,7 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
                 courseChapterAddBo.setCoverUrl("oss/images/avatar/20211013/1634097664410_1397766697");
                 courseChapterAddBo.setSectionIdList(sectionIdList);
                 courseChapterAddBo.setBusinessList(chapterBusinessList);
+                courseChapterAddBo.setViewSign(chapterViewSign);
                 iCourseChapterService.insertByAddBo(courseChapterAddBo);
             }
 
@@ -545,6 +561,13 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
         return rs;
     }
 
+    private Integer findViewSign(String viewSign) {
+        if (viewSign.equals("腾讯")){
+            return 2;
+        }
+        return 1;
+    }
+
     @Override
     public List<CourseSectionVo> overSectionList(Long startTime, Long endTime) {
         return this.baseMapper.overSectionList(startTime,endTime);

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CourseSectionEasyImport.java

@@ -48,6 +48,11 @@ public class CourseSectionEasyImport {
     @Excel(name = "节类型")
     @ApiModelProperty("节类型 1录播 2直播 3回放")
     private String sectionType;
+    /** 节类型 1录播 2直播 3回放 */
+    @Excel(name = "视频标签")
+    private String viewSign;
+    @Excel(name = "腾讯视频节时长(秒)")
+    private String durationTimeTX;
     /** 发布状态 1发布 0未发布 */
     @Excel(name = "*节发布状态")
     private String publishStatus;