Browse Source

fix 同步

he2802 3 years ago
parent
commit
77be9de84e

+ 2 - 1
zhongzheng-admin/src/main/java/com/zhongzheng/controller/schedule/ScheduleController.java

@@ -185,7 +185,8 @@ public class ScheduleController extends BaseController {
     @ApiOperation("保利威直播结束提问同步")
     @GetMapping("/chatLog")
     public AjaxResult GetConsultingRecord(PolyvLiveQueryBo bo) throws Exception {
-        iPolyvLiveService.GetConsultingRecord(bo);
+        iPolyvLiveService.ListChannelVideoLibrary(bo);
         return AjaxResult.success();
     }
+
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/polyv/service/IPolyvLiveService.java

@@ -14,6 +14,7 @@ import com.zhongzheng.modules.polyv.vo.PolyvVo;
 import net.polyv.live.v1.entity.channel.operate.LiveChannelBasicInfoResponse;
 import net.polyv.live.v1.entity.channel.playback.LiveChannelVideoListResponse;
 import net.polyv.live.v1.entity.channel.playback.LiveListChannelSessionInfoResponse;
+import net.polyv.live.v1.entity.channel.playback.LiveListChannelVideoLibraryResponse;
 import net.polyv.live.v1.entity.channel.viewdata.LiveListChannelViewlogResponse;
 import net.polyv.live.v1.entity.chat.LiveGetMessageListResponse;
 
@@ -46,4 +47,6 @@ public interface IPolyvLiveService {
 	void GetConsultingRecord(PolyvLiveQueryBo bo) throws IOException, NoSuchAlgorithmException;
 
 	List<LiveGetMessageListResponse.MessageList> GetHistoryChatMsg(PolyvLiveQueryBo bo) throws IOException, NoSuchAlgorithmException;
+
+	LiveListChannelVideoLibraryResponse.ChannelVideoLibrary ListChannelVideoLibrary(PolyvLiveQueryBo bo) throws IOException, NoSuchAlgorithmException;
 }

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

@@ -43,10 +43,7 @@ import net.polyv.live.v1.entity.channel.operate.LiveChannelAuthTokenRequest;
 import net.polyv.live.v1.entity.channel.operate.LiveChannelAuthTokenResponse;
 import net.polyv.live.v1.entity.channel.operate.LiveChannelBasicInfoRequest;
 import net.polyv.live.v1.entity.channel.operate.LiveChannelBasicInfoResponse;
-import net.polyv.live.v1.entity.channel.playback.LiveChannelVideoListRequest;
-import net.polyv.live.v1.entity.channel.playback.LiveChannelVideoListResponse;
-import net.polyv.live.v1.entity.channel.playback.LiveListChannelSessionInfoRequest;
-import net.polyv.live.v1.entity.channel.playback.LiveListChannelSessionInfoResponse;
+import net.polyv.live.v1.entity.channel.playback.*;
 import net.polyv.live.v1.entity.channel.viewdata.LiveListChannelViewlogRequest;
 import net.polyv.live.v1.entity.channel.viewdata.LiveListChannelViewlogResponse;
 import net.polyv.live.v1.entity.chat.*;
@@ -192,6 +189,7 @@ public class PolyvLiveServiceImpl implements IPolyvLiveService {
                 //to do something ......
                 //获取场次的详细信息
                 if(Validator.isNotEmpty(liveChannelVideoListResponse.getChannelVedioInfos())&&liveChannelVideoListResponse.getChannelVedioInfos().size()>0){
+                    System.out.println(liveChannelVideoListResponse.getChannelVedioInfos());
                     return liveChannelVideoListResponse.getChannelVedioInfos().get(0);
                 }
                System.out.println(JSON.toJSONString(liveChannelVideoListResponse));
@@ -317,4 +315,40 @@ public class PolyvLiveServiceImpl implements IPolyvLiveService {
         }
         return null;
     }
+
+    /**
+     * 获取场次的回放VID
+     * @param bo
+     * @throws IOException
+     * @throws NoSuchAlgorithmException
+     */
+    @Override
+    public LiveListChannelVideoLibraryResponse.ChannelVideoLibrary ListChannelVideoLibrary(PolyvLiveQueryBo bo) throws IOException, NoSuchAlgorithmException {
+        LiveListChannelVideoLibraryRequest liveListChannelVideoLibraryRequest =
+                new LiveListChannelVideoLibraryRequest();
+        LiveListChannelVideoLibraryResponse liveListChannelVideoLibraryResponse;
+        try {
+            liveListChannelVideoLibraryRequest.setChannelId(bo.getChannelId())
+                    .setSessionIds(bo.getSessionId())
+                    .setListType("playback");
+            liveListChannelVideoLibraryResponse = new LiveChannelPlaybackServiceImpl().listChannelVideoLibrary(
+                    liveListChannelVideoLibraryRequest);
+            if (liveListChannelVideoLibraryResponse != null) {
+                if(Validator.isNotEmpty(liveListChannelVideoLibraryResponse.getContents())){
+                    if(liveListChannelVideoLibraryResponse.getContents().size()>0){
+                        return liveListChannelVideoLibraryResponse.getContents().get(0);
+                    }
+                }
+                //to do something ......
+                System.out.println(JSON.toJSONString(liveListChannelVideoLibraryResponse));
+            }
+        } catch (PloyvSdkException e) {
+            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
+            // 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
+            throw e;
+        } catch (Exception e) {
+            throw e;
+        }
+        return null;
+    }
 }

+ 6 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/impl/ScheduleServiceImpl.java

@@ -104,6 +104,7 @@ import com.zhongzheng.modules.user.vo.*;
 import com.zhongzheng.modules.wx.service.IWxPayService;
 import net.polyv.live.v1.entity.channel.playback.LiveChannelVideoListResponse;
 import net.polyv.live.v1.entity.channel.playback.LiveListChannelSessionInfoResponse;
+import net.polyv.live.v1.entity.channel.playback.LiveListChannelVideoLibraryResponse;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -1107,7 +1108,11 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
                                 sectionVo.setRealDuration(info.getDuration().longValue()); //视频秒数
                                 sectionVo.setRealLiveStartTime(info.getStartTime().getTime()/1000);
                                 sectionVo.setRealLiveEndTime(info.getEndTime().getTime()/1000);
-                                sectionVo.setRecordingUrl(info.getUrl());
+                                PolyvLiveQueryBo queryBo1 = new PolyvLiveQueryBo();
+                                queryBo1.setChannelId(sectionVo.getLiveUrl());
+                                queryBo1.setSessionId(info.getChannelSessionId());
+                                LiveListChannelVideoLibraryResponse.ChannelVideoLibrary channelVideoLibrary = iPolyvLiveService.ListChannelVideoLibrary(queryBo1);
+                                sectionVo.setRecordingUrl(channelVideoLibrary.getVideoPoolId());
                                 sectionVo.setSectionType(3); //直播变为回放
                                 CourseSection section = BeanUtil.toBean(sectionVo, CourseSection.class);
                                 section.setUpdateTime(DateUtils.getNowTime());