he2802 3 anni fa
parent
commit
13e81fa08e

+ 18 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/schedule/ScheduleController.java

@@ -182,6 +182,24 @@ public class ScheduleController extends BaseController {
         return AjaxResult.success();
     }
 
+    @ApiOperation("同步保利威场次vid")
+    @GetMapping("/syncToReplay")
+    public AjaxResult syncToReplay(UserQueryBo bo) throws Exception {
+        iScheduleService.syncToReplay(bo);
+        return AjaxResult.success();
+    }
 
+    @ApiOperation("测试")
+    @GetMapping("/getChannelVideo")
+    public AjaxResult getChannelVideo(PolyvLiveQueryBo bo) throws Exception {
+        iPolyvLiveService.getChannelVideo(bo);
+        return AjaxResult.success();
+    }
 
+    @ApiOperation("测试1")
+    @GetMapping("/ListChannelVideoLibrary")
+    public AjaxResult ListChannelVideoLibrary(PolyvLiveQueryBo bo) throws Exception {
+        iPolyvLiveService.ListChannelVideoLibrary(bo);
+        return AjaxResult.success();
+    }
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseSectionQueryBo.java

@@ -99,4 +99,6 @@ public class CourseSectionQueryBo extends BaseEntity {
 	private Long realDuration;
 	@ApiModelProperty("节ID")
 	private Long sectionId;
+	@ApiModelProperty("是否获取未同步节 1是")
+	private Integer syncVid;
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseSectionServiceImpl.java

@@ -117,6 +117,10 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
         lqw.eq(bo.getLiveEndTime() != null, CourseSection::getLiveEndTime, bo.getLiveEndTime());
         lqw.eq(StrUtil.isNotBlank(bo.getRecordingUrl()), CourseSection::getRecordingUrl, bo.getRecordingUrl());
         lqw.eq(bo.getDurationTime() != null, CourseSection::getDurationTime, bo.getDurationTime());
+        if(bo.getSyncVid()==1){
+            lqw.isNull(CourseSection::getRecordingUrl);
+            lqw.isNotNull(CourseSection::getSessionId);
+        }
         return entity2Vo(this.list(lqw));
     }
 

+ 6 - 6
zhongzheng-system/src/main/java/com/zhongzheng/modules/polyv/service/impl/PolyvLiveServiceImpl.java

@@ -139,8 +139,7 @@ public class PolyvLiveServiceImpl implements IPolyvLiveService {
         LiveListChannelSessionInfoRequest liveListChannelSessionInfoRequest = new LiveListChannelSessionInfoRequest();
         LiveListChannelSessionInfoResponse liveListChannelSessionInfoResponse;
         try {
-            Calendar instance = Calendar.getInstance();
-            instance.set(2020, 10, 1);
+            System.out.println(bo);
             liveListChannelSessionInfoRequest.setChannelId(bo.getChannelId())
                     .setStartDate(new Date((bo.getStartTime()*1000)))
                     .setEndDate(new Date((bo.getEndTime()*1000)))
@@ -150,7 +149,8 @@ public class PolyvLiveServiceImpl implements IPolyvLiveService {
             if (liveListChannelSessionInfoResponse != null) {
                 if(Validator.isNotEmpty(liveListChannelSessionInfoResponse.getContents())&&liveListChannelSessionInfoResponse.getContents().size()>0){
                     //获取该房间最近一次场次
-                    System.out.println(JSON.toJSONString(liveListChannelSessionInfoResponse));
+                    System.out.println("哈哈");
+                    System.out.println(JSON.toJSONString(liveListChannelSessionInfoResponse.getContents().get(0)));
                     LiveListChannelSessionInfoResponse.ChannelSessionInfo sessionInfo = liveListChannelSessionInfoResponse.getContents().get(0);
                     bo.setSessionId(sessionInfo.getSessionId());
                     return getChannelVideo(bo);
@@ -189,10 +189,9 @@ public class PolyvLiveServiceImpl implements IPolyvLiveService {
                 //to do something ......
                 //获取场次的详细信息
                 if(Validator.isNotEmpty(liveChannelVideoListResponse.getChannelVedioInfos())&&liveChannelVideoListResponse.getChannelVedioInfos().size()>0){
-                    System.out.println(liveChannelVideoListResponse.getChannelVedioInfos());
+                    System.out.println(JSON.toJSONString(liveChannelVideoListResponse.getChannelVedioInfos().get(0)));
                     return liveChannelVideoListResponse.getChannelVedioInfos().get(0);
                 }
-               System.out.println(JSON.toJSONString(liveChannelVideoListResponse));
             }
         } catch (PloyvSdkException e) {
             //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
@@ -336,11 +335,12 @@ public class PolyvLiveServiceImpl implements IPolyvLiveService {
             if (liveListChannelVideoLibraryResponse != null) {
                 if(Validator.isNotEmpty(liveListChannelVideoLibraryResponse.getContents())){
                     if(liveListChannelVideoLibraryResponse.getContents().size()>0){
+                        System.out.println(JSON.toJSONString(liveListChannelVideoLibraryResponse.getContents()));
                         return liveListChannelVideoLibraryResponse.getContents().get(0);
                     }
                 }
                 //to do something ......
-                System.out.println(JSON.toJSONString(liveListChannelVideoLibraryResponse));
+
             }
         } catch (PloyvSdkException e) {
             //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/IScheduleService.java

@@ -50,4 +50,6 @@ public interface IScheduleService extends IService<PolyvVideo> {
     void overLive(UserQueryBo bo);
 
     void liveToReplay(UserQueryBo bo) throws Exception;
+
+    void syncToReplay(UserQueryBo bo) throws Exception;
 }

+ 28 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/impl/ScheduleServiceImpl.java

@@ -28,6 +28,7 @@ import com.zhongzheng.modules.base.vo.UserProfileVo;
 import com.zhongzheng.modules.course.bo.CourseChapterSectionQueryBo;
 import com.zhongzheng.modules.course.bo.CourseMenuQueryBo;
 import com.zhongzheng.modules.course.bo.CourseModuleChapterQueryBo;
+import com.zhongzheng.modules.course.bo.CourseSectionQueryBo;
 import com.zhongzheng.modules.course.domain.CourseBusiness;
 import com.zhongzheng.modules.course.domain.CourseSection;
 import com.zhongzheng.modules.course.service.ICourseChapterSectionService;
@@ -1156,13 +1157,13 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
                                 sectionVo.setSessionId(info.getChannelSessionId());//场次ID
                                 sectionVo.setRealDuration(info.getDuration().longValue()); //视频秒数
                                 sectionVo.setDurationTime(info.getDuration().longValue());
-                                sectionVo.setRealLiveStartTime(info.getStartTime().getTime()/1000);
                                 sectionVo.setRealLiveEndTime(info.getEndTime().getTime()/1000);
-                                PolyvLiveQueryBo queryBo1 = new PolyvLiveQueryBo();
+                                sectionVo.setRealLiveStartTime(info.getStartTime().getTime()/1000);
+                             /*    PolyvLiveQueryBo queryBo1 = new PolyvLiveQueryBo();
                                 queryBo1.setChannelId(sectionVo.getLiveUrl());
                                 queryBo1.setSessionId(info.getChannelSessionId());
                                 LiveListChannelVideoLibraryResponse.ChannelVideoLibrary channelVideoLibrary = iPolyvLiveService.ListChannelVideoLibrary(queryBo1);
-                                sectionVo.setRecordingUrl(channelVideoLibrary.getVideoPoolId());
+                                sectionVo.setRecordingUrl(channelVideoLibrary.getVideoPoolId());*/
                                 sectionVo.setSectionType(3); //直播变为回放
                                 CourseSection section = BeanUtil.toBean(sectionVo, CourseSection.class);
                                 section.setUpdateTime(DateUtils.getNowTime());
@@ -1176,6 +1177,30 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
         }
     }
 
+    /**
+     * 同步保利威场次vid
+     * @param bo
+     * @throws Exception
+     */
+    @Override
+    public void syncToReplay(UserQueryBo bo) throws Exception {
+        CourseSectionQueryBo queryBo = new CourseSectionQueryBo();
+        queryBo.setSyncVid(1);
+        List<CourseSectionVo> list = iCourseSectionService.queryList(queryBo);
+        System.out.println("节节");
+        System.out.println(list);
+        for(CourseSectionVo vo : list){
+            PolyvLiveQueryBo queryBo1 = new PolyvLiveQueryBo();
+            queryBo1.setChannelId(vo.getLiveUrl());
+            queryBo1.setSessionId(vo.getSessionId());
+            LiveListChannelVideoLibraryResponse.ChannelVideoLibrary channelVideoLibrary = iPolyvLiveService.ListChannelVideoLibrary(queryBo1);
+            vo.setRecordingUrl(channelVideoLibrary.getVideoPoolId());
+            CourseSection section = BeanUtil.toBean(vo, CourseSection.class);
+            section.setUpdateTime(DateUtils.getNowTime());
+            iCourseSectionService.updateById(section);
+        }
+    }
+
     //获得可用学习天数
     private static int getDutyDays(Date startDateStr, Date endDateStr, Long[] longs, Long studyDay) {
         int result = 0;

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/domain/UserExamRecord.java

@@ -73,4 +73,6 @@ private static final long serialVersionUID=1L;
     /** 订单商品ID */
     private Long orderGoodsId;
     private Long lessQuestionNum;
+    /** 提交时间 */
+    private Long commitTime;
 }