# Lesson Service

### 1、创建课节

#### 描述

```
创建课节
接口地址（仅做说明使用）：https://api.polyv.net/hi-class-api/open/lesson/v1/add
```

#### 调用约束

1、接口调用有频率限制，[详细请查看](https://git.polyv.net/help-center/document-center/-/blob/master/vclass/java/limit.md)，调用常见异常，[详细请查看](https://git.polyv.net/help-center/document-center/-/blob/master/vclass/java/exceptionDoc/README.md)

#### 单元测试

```java
	@Test
	public void testAddLesson() throws Exception {
        VClassAddLessonRequest vClassAddLessonRequest;
        VClassAddLessonResponse vClassAddLessonResponse;
        try {
            vClassAddLessonRequest = VClassAddLessonRequest.builder()
                    .name("SDK测试创建课节")
                    .duration(30)
                    .startTime(super.getDate(System.currentTimeMillis() + 10 * 86400000))
                    .watchCondition(VClassConstant.AuthType.NULL.getCode())
                    .linkNumber(2)
                    .build();
            vClassAddLessonResponse = new VClassLessonServiceImpl().addLesson(vClassAddLessonRequest);
            Assert.assertNotNull(vClassAddLessonResponse);
            if (vClassAddLessonResponse != null) {
                log.debug("测试创建课节成功,{}", JSON.toJSONString(vClassAddLessonResponse));
                //TODO 此处创建完成后删除了课节，正式使用需删除该语句
                super.deleteLesson(vClassAddLessonResponse.getLessonId());
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误，错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑，记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }
```

#### 单元测试说明

1、请求正确，返回VClassAddLessonResponse对象，B端依据此对象处理业务逻辑；

2、请求参数校验不合格，抛出PloyvSdkException，错误信息见PloyvSdkException.getMessage()，如 \[ 输入参数 \[xxx.chat.LivexxxRequest]对象校验失败，失败字段 \[pic不能为空 / msg不能为空] ]

3、服务器处理异常，抛出PloyvSdkException，错误信息见PloyvSdkException.getMessage()，如 \[ 保利威请求返回数据错误，请求流水号：66e7ad29fd04425a84c2b2b562d2025b，错误原因： invalid signature. ]

#### 请求入参描述

| 参数名                     | 必选    | 类型      | 说明                                                 |
| ----------------------- | ----- | ------- | -------------------------------------------------- |
| name                    | true  | String  | 课节名称，长度1\~128                                      |
| startTime               | true  | Date    | 开始时间                                               |
| duration                | true  | Integer | 上课时长，单位: 分钟，5\~180                                 |
| linkNumber              | true  | Integer | 连麦人数，0\~16                                         |
| autoConnectMicroEnabled | false | String  | 是否自动连麦，默认：N Y：自动连麦 N：手动上麦                          |
| autoRecordCourseEnabled | false | String  | 是否自动录制课程，默认：N Y：自动录制 N：手动录制                        |
| watchCondition          | true  | String  | 观看条件 NULL：无条件 CODE：验证码 WHITE\_LIST：白名单 DIRECT：独立授权 |
| code                    | false | String  | 当观看条件为CODE时需要填写观看验证码（限制16位以内）                      |
| secretKey               | false | String  | 观看条件为独立授权时传，不传则后台自动生成（限制32位以内）                     |
| resolution              | false | Integer | 录制清晰度, 720, 1080                                   |
| playResolution          | false | Integer | 上课清晰度, 360（如果需要设置更高的清晰度，请联系相关工作人员）                 |
| cover                   | false | String  | 封面地址URL，长度1\~255                                   |
| teacherId               | false | String  | 老师id，如不传，则根据teacherMobile查找现有老师，如果查找不到，则创建一个老师     |
| teacherCode             | false | String  | 老师登录手机区号，默认 +86                                    |
| teacherMobile           | false | String  | 老师手机号，长度5\~15                                      |
| teacherName             | false | String  | 老师名称，如传入的信息可以查找到现有老师，会更新老师名称                       |
| teacherPasswd           | false | String  | 老师密码，长度6\~8                                        |

#### 返回对象描述

| 参数名                     | 类型      | 说明                                                 |
| ----------------------- | ------- | -------------------------------------------------- |
| lessonId                | Long    | 课节ID                                               |
| name                    | String  | 课节名称                                               |
| teacherId               | String  | 老师ID                                               |
| teacherCode             | String  | 老师登录手机区号                                           |
| teacherName             | String  | 老师名称                                               |
| teacherMobile           | String  | 老师账号                                               |
| teacherPasswd           | String  | 老师账号密码                                             |
| startTime               | Date    | 开始时间                                               |
| endTime                 | Date    | 开始时间                                               |
| duration                | Integer | 上课时长，单位: 分钟                                        |
| linkNumber              | Integer | 连麦人数 0 - 16                                        |
| autoConnectMicroEnabled | String  | 是否自动连麦 Y：自动连麦 N：不自动连麦                              |
| autoRecordCourseEnabled | String  | 是否自动录制 Y：自动录制 N：不自动录制                              |
| watchCondition          | String  | 观看条件 NULL：无条件 CODE：验证码 WHITE\_LIST：白名单 DIRECT：独立授权 |
| code                    | String  | 当观看条件为CODE时需要填写观看验证码（限制16位以内）                      |
| secretKey               | String  | 授权观看KEY                                            |
| cover                   | String  | 封面URL                                              |
| resolution              | Integer | 录制清晰度, 720, 1080                                   |
| playResolution          | Integer | 上课清晰度, 360                                         |

\ <br>

***

\ <br>

### 2、获取课节信息

#### 描述

```
获取课节信息
接口地址（仅做说明使用）：https://api.polyv.net/hi-class-api/open/lesson/v1/get
```

#### 调用约束

1、接口调用有频率限制，[详细请查看](https://git.polyv.net/help-center/document-center/-/blob/master/vclass/java/limit.md)，调用常见异常，[详细请查看](https://git.polyv.net/help-center/document-center/-/blob/master/vclass/java/exceptionDoc/README.md)

#### 单元测试

```java
	@Test
	public void testGetLessonInfo() throws IOException, NoSuchAlgorithmException {
        VClassGetLessonInfoRequest vClassGetLessonInfoRequest;
        VClassGetLessonInfoResponse vClassGetLessonInfoResponse;
        try {
            vClassGetLessonInfoRequest = VClassGetLessonInfoRequest.builder().lessonId(super.createLesson()).build();
            vClassGetLessonInfoResponse = new VClassLessonServiceImpl().getLessonInfo(vClassGetLessonInfoRequest);
            Assert.assertNotNull(vClassGetLessonInfoResponse);
            if (vClassGetLessonInfoResponse != null) {
                //to do something ......
                log.debug("测试获取课节信息成功{}", JSON.toJSONString(vClassGetLessonInfoResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误，错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑，记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }
```

#### 单元测试说明

1、请求正确，返回VClassGetLessonInfoResponse对象，B端依据此对象处理业务逻辑；

2、请求参数校验不合格，抛出PloyvSdkException，错误信息见PloyvSdkException.getMessage()，如 \[ 输入参数 \[xxx.chat.LivexxxRequest]对象校验失败，失败字段 \[pic不能为空 / msg不能为空] ]

3、服务器处理异常，抛出PloyvSdkException，错误信息见PloyvSdkException.getMessage()，如 \[ 保利威请求返回数据错误，请求流水号：66e7ad29fd04425a84c2b2b562d2025b，错误原因： invalid signature. ]

#### 请求入参描述

| 参数名      | 必选   | 类型   | 说明  |
| -------- | ---- | ---- | --- |
| lessonId | true | Long | 课节号 |

#### 返回对象描述

| 参数名                     | 类型      | 说明                                                 |
| ----------------------- | ------- | -------------------------------------------------- |
| lessonId                | Long    | 课节ID                                               |
| name                    | String  | 课节名称                                               |
| teacherId               | String  | 老师ID                                               |
| teacherCode             | String  | 老师登录手机区号                                           |
| teacherName             | String  | 老师名称                                               |
| teacherMobile           | String  | 老师账号                                               |
| teacherPasswd           | String  | 老师账号密码                                             |
| startTime               | Date    | 开始时间                                               |
| endTime                 | Date    | 结束时间                                               |
| duration                | Integer | 上课时长，单位: 分钟                                        |
| linkNumber              | Integer | 连麦人数 0 - 16                                        |
| autoConnectMicroEnabled | String  | 是否自动连麦 Y：自动连麦 N：手动上麦                               |
| autoRecordCourseEnabled | String  | 是否自动录制课程 Y：自动录制 N：手动录制                             |
| watchCondition          | String  | 观看条件 NULL：无条件 CODE：验证码 WHITE\_LIST：白名单 DIRECT：独立授权 |
| code                    | String  | 观看密码，当观看条件为CODE时需要填写密码                             |
| secretKey               | String  | 授权观看KEY                                            |
| cover                   | String  | 封面URL                                              |
| resolution              | Integer | 录制清晰度, 720, 1080                                   |
| playResolution          | Integer | 上课清晰度, 360                                         |

\ <br>

***

\ <br>

### 3、更新课节信息

#### 描述

```
更新课节信息
接口地址（仅做说明使用）：https://api.polyv.net/hi-class-api/open/lesson/v1/update
```

#### 调用约束

1、接口调用有频率限制，[详细请查看](https://git.polyv.net/help-center/document-center/-/blob/master/vclass/java/limit.md)，调用常见异常，[详细请查看](https://git.polyv.net/help-center/document-center/-/blob/master/vclass/java/exceptionDoc/README.md)

#### 单元测试

```java
	@Test
	public void testUpdateLessonInfo() throws IOException, NoSuchAlgorithmException {
        VClassUpdateLessonInfoRequest vClassUpdateLessonInfoRequest;
        Boolean vClassUpdateLessonInfoResponse;
        try {
            Long lessonId = super.createLesson();
            vClassUpdateLessonInfoRequest = VClassUpdateLessonInfoRequest.builder()
                    .lessonId(lessonId)
                    .duration(60)
                    .linkNumber(0)
                    .autoConnectMicroEnabled(VClassConstant.Flag.YES.getFlag())
                    .autoRecordCourseEnabled(VClassConstant.Flag.YES.getFlag())
                    .watchCondition(VClassConstant.AuthType.WHITE_LIST.getCode())
                    .resolution(720)
                    .playResolution(720)
                    .build();
            vClassUpdateLessonInfoResponse = new VClassLessonServiceImpl().updateLessonInfo(
                    vClassUpdateLessonInfoRequest);
            Assert.assertTrue(vClassUpdateLessonInfoResponse);
            if (vClassUpdateLessonInfoResponse) {
                //to do something ......
                log.debug("测试更新课节信息成功");
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误，错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑，记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }
```

#### 单元测试说明

1、请求正确，返回Boolean对象，B端依据此对象处理业务逻辑；

2、请求参数校验不合格，抛出PloyvSdkException，错误信息见PloyvSdkException.getMessage()，如 \[ 输入参数 \[xxx.chat.LivexxxRequest]对象校验失败，失败字段 \[pic不能为空 / msg不能为空] ]

3、服务器处理异常，抛出PloyvSdkException，错误信息见PloyvSdkException.getMessage()，如 \[ 保利威请求返回数据错误，请求流水号：66e7ad29fd04425a84c2b2b562d2025b，错误原因： invalid signature. ]

#### 请求入参描述

| 参数名                     | 必选    | 类型      | 说明                                                 |
| ----------------------- | ----- | ------- | -------------------------------------------------- |
| lessonId                | true  | Long    | 课节号                                                |
| name                    | false | String  | 课节名称，长度1\~128                                      |
| startTime               | false | Date    | 开始时间                                               |
| duration                | false | Integer | 上课时长，单位: 分钟，5\~180                                 |
| linkNumber              | false | Integer | 连麦人数，0\~16                                         |
| autoConnectMicroEnabled | false | String  | 是否自动连麦 Y：自动连麦 N：手动上麦                               |
| autoRecordCourseEnabled | false | String  | 是否自动录制课程 Y：自动录制 N：手动录制                             |
| watchCondition          | false | String  | 观看条件 NULL：无条件 CODE：验证码 WHITE\_LIST：白名单 DIRECT：独立授权 |
| code                    | false | String  | 当观看条件为CODE时需要填写观看验证码（限制16位以内）                      |
| secretKey               | false | String  | 观看条件为独立授权时传，不传则后台自动生成（限制32位以内）                     |
| resolution              | false | Integer | 录制清晰度, 720, 1080                                   |
| playResolution          | false | Integer | 上课清晰度, 360（如果需要设置更高的清晰度，请联系相关工作人员）                 |
| cover                   | false | String  | 封面地址URL，长度1\~255                                   |
| teacherId               | false | String  | 老师id，如不传，则不更新，如果传入的是新的id，则根据下列老师信息创新一个新的老师         |
| teacherName             | false | String  | 老师名称，如传入的信息可以查找到现有老师，会更新老师名称                       |
| teacherCode             | false | String  | 老师登录手机区号，默认 +86                                    |
| teacherMobile           | false | String  | 老师手机号，长度5\~15                                      |
| teacherPasswd           | false | String  | 老师密码，长度6\~8                                        |

#### 返回对象描述

更新课节信息返回实体\ <br>

***

\ <br>

### 4、删除课节

#### 描述

```
删除课节
接口地址（仅做说明使用）：https://api.polyv.net/hi-class-api/open/lesson/v1/delete
```

#### 调用约束

1、接口调用有频率限制，[详细请查看](https://git.polyv.net/help-center/document-center/-/blob/master/vclass/java/limit.md)，调用常见异常，[详细请查看](https://git.polyv.net/help-center/document-center/-/blob/master/vclass/java/exceptionDoc/README.md)

#### 单元测试

```java
	@Test
	public void testDeleteLesson() throws IOException, NoSuchAlgorithmException {
        VClassDeleteLessonRequest vClassDeleteLessonRequest;
        Boolean vClassDeleteLessonResponse;
        try {
            vClassDeleteLessonRequest = VClassDeleteLessonRequest.builder().lessonId(super.createLesson()).build();
            vClassDeleteLessonResponse = new VClassLessonServiceImpl().deleteLesson(vClassDeleteLessonRequest);
            Assert.assertTrue(vClassDeleteLessonResponse);
            if (vClassDeleteLessonResponse) {
                //to do something ......
                log.debug("测试删除课节成功");
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误，错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑，记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }
```

#### 单元测试说明

1、请求正确，返回Boolean对象，B端依据此对象处理业务逻辑；

2、请求参数校验不合格，抛出PloyvSdkException，错误信息见PloyvSdkException.getMessage()，如 \[ 输入参数 \[xxx.chat.LivexxxRequest]对象校验失败，失败字段 \[pic不能为空 / msg不能为空] ]

3、服务器处理异常，抛出PloyvSdkException，错误信息见PloyvSdkException.getMessage()，如 \[ 保利威请求返回数据错误，请求流水号：66e7ad29fd04425a84c2b2b562d2025b，错误原因： invalid signature. ]

#### 请求入参描述

| 参数名      | 必选   | 类型   | 说明  |
| -------- | ---- | ---- | --- |
| lessonId | true | Long | 课节号 |

#### 返回对象描述

删除课节返回实体\ <br>

***

\ <br>

### 5、修改课节状态为禁止上课

#### 描述

```
禁止课节上课，禁止有效期为24小时，24小时后会恢复课节允许上课（如果课节已到达下课时间，则不允许再上课）
接口地址（仅做说明使用）：https://api.polyv.net/hi-class-api/open/lesson/v1/%s/cutoff
```

#### 调用约束

1、接口调用有频率限制，[详细请查看](https://git.polyv.net/help-center/document-center/-/blob/master/vclass/java/limit.md)，调用常见异常，[详细请查看](https://git.polyv.net/help-center/document-center/-/blob/master/vclass/java/exceptionDoc/README.md)

#### 单元测试

```java
	@Test
	public void testCutoffLesson() throws IOException, NoSuchAlgorithmException {
        VClassCutoffLessonRequest vClassCutoffLessonRequest;
        Boolean vClassCutoffLessonResponse;
        try {
            vClassCutoffLessonRequest = VClassCutoffLessonRequest.builder().lessonId(super.createLesson()).build();
            vClassCutoffLessonResponse = new VClassLessonServiceImpl().cutoffLesson(vClassCutoffLessonRequest);
            Assert.assertTrue(vClassCutoffLessonResponse);
            if (vClassCutoffLessonResponse) {
                //to do something ......
                log.debug("测试修改课节状态为禁止上课成功");
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误，错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑，记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }
```

#### 单元测试说明

1、请求正确，返回Boolean对象，B端依据此对象处理业务逻辑；

2、请求参数校验不合格，抛出PloyvSdkException，错误信息见PloyvSdkException.getMessage()，如 \[ 输入参数 \[xxx.chat.LivexxxRequest]对象校验失败，失败字段 \[pic不能为空 / msg不能为空] ]

3、服务器处理异常，抛出PloyvSdkException，错误信息见PloyvSdkException.getMessage()，如 \[ 保利威请求返回数据错误，请求流水号：66e7ad29fd04425a84c2b2b562d2025b，错误原因： invalid signature. ]

#### 请求入参描述

| 参数名      | 必选   | 类型   | 说明  |
| -------- | ---- | ---- | --- |
| lessonId | true | Long | 课节号 |

#### 返回对象描述

修改课节状态为禁止上课返回实体\ <br>

***

\ <br>

### 6、恢复课节状态为可以上课

#### 描述

```
恢复课节状态为可以上课（如果课节已到达下课时间，则不允许再上课）
接口地址（仅做说明使用）：https://api.polyv.net/hi-class-api/open/lesson/v1/%s/resume
```

#### 调用约束

1、接口调用有频率限制，[详细请查看](https://git.polyv.net/help-center/document-center/-/blob/master/vclass/java/limit.md)，调用常见异常，[详细请查看](https://git.polyv.net/help-center/document-center/-/blob/master/vclass/java/exceptionDoc/README.md)

#### 单元测试

```java
	@Test
	public void testResumeLesson() throws IOException, NoSuchAlgorithmException {
        VClassResumeLessonRequest vClassResumeLessonRequest;
        Boolean vClassResumeLessonResponse;
        try {
            vClassResumeLessonRequest = VClassResumeLessonRequest.builder().lessonId(super.createLesson()).build();
            vClassResumeLessonResponse = new VClassLessonServiceImpl().resumeLesson(vClassResumeLessonRequest);
            Assert.assertTrue(vClassResumeLessonResponse);
            if (vClassResumeLessonResponse) {
                //to do something ......
                log.debug("测试恢复课节状态为可以上课成功");
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误，错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑，记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }
```

#### 单元测试说明

1、请求正确，返回Boolean对象，B端依据此对象处理业务逻辑；

2、请求参数校验不合格，抛出PloyvSdkException，错误信息见PloyvSdkException.getMessage()，如 \[ 输入参数 \[xxx.chat.LivexxxRequest]对象校验失败，失败字段 \[pic不能为空 / msg不能为空] ]

3、服务器处理异常，抛出PloyvSdkException，错误信息见PloyvSdkException.getMessage()，如 \[ 保利威请求返回数据错误，请求流水号：66e7ad29fd04425a84c2b2b562d2025b，错误原因： invalid signature. ]

#### 请求入参描述

| 参数名      | 必选   | 类型   | 说明  |
| -------- | ---- | ---- | --- |
| lessonId | true | Long | 课节号 |

#### 返回对象描述

恢复课节状态为可以上课返回实体\ <br>

***

\ <br>

### 7、查询课节实时状态和在线人数

#### 描述

```
查询课节实时状态和在线人数
接口地址（仅做说明使用）：https://api.polyv.net/hi-class-api/open/lesson/v1/getLessonLiveInfo
```

#### 调用约束

1、接口调用有频率限制，[详细请查看](https://git.polyv.net/help-center/document-center/-/blob/master/vclass/java/limit.md)，调用常见异常，[详细请查看](https://git.polyv.net/help-center/document-center/-/blob/master/vclass/java/exceptionDoc/README.md)

#### 单元测试

```java
	@Test
	public void testGetLessonLiveInfo() throws IOException, NoSuchAlgorithmException {
        VClassGetLessonLiveInfoRequest vClassGetLessonLiveInfoRequest;
        List<VClassGetLessonLiveInfoResponse> vClassGetLessonLiveInfoResponse;
        try {
            vClassGetLessonLiveInfoRequest = VClassGetLessonLiveInfoRequest.builder()
                    .lessonIds(String.format("%s", super.createLesson()))
                    .build();
            vClassGetLessonLiveInfoResponse = new VClassLessonServiceImpl().getLessonLiveInfo(
                    vClassGetLessonLiveInfoRequest);
            Assert.assertNotNull(vClassGetLessonLiveInfoResponse);
            if (vClassGetLessonLiveInfoResponse != null) {
                //to do something ......
                log.debug("测试查询课节实时状态和在线人数成功 {}", JSON.toJSONString(vClassGetLessonLiveInfoResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误，错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑，记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }
```

#### 单元测试说明

1、请求正确，返回VClassGetLessonLiveInfoResponse对象，B端依据此对象处理业务逻辑；

2、请求参数校验不合格，抛出PloyvSdkException，错误信息见PloyvSdkException.getMessage()，如 \[ 输入参数 \[xxx.chat.LivexxxRequest]对象校验失败，失败字段 \[pic不能为空 / msg不能为空] ]

3、服务器处理异常，抛出PloyvSdkException，错误信息见PloyvSdkException.getMessage()，如 \[ 保利威请求返回数据错误，请求流水号：66e7ad29fd04425a84c2b2b562d2025b，错误原因： invalid signature. ]

#### 请求入参描述

| 参数名       | 必选   | 类型     | 说明                               |
| --------- | ---- | ------ | -------------------------------- |
| lessonIds | true | String | 课节号，以逗号分隔（上限100个课节） 例如：1015,1016 |

#### 返回对象描述

返回对象是List\<VClassGetLessonLiveInfoResponse>，**VClassGetLessonLiveInfoResponse**具体元素内容如下：

| 参数名                | 类型      | 说明                             |
| ------------------ | ------- | ------------------------------ |
| lessonId           | Long    | 课节ID                           |
| currentTime        | Date    | 当前时间【对应api文档的**timestamp**字段】  |
| teacherOnlineCount | Long    | 课节内老师人数                        |
| studentOnlineCount | Long    | 课节内学生人数                        |
| status             | Integer | 课节状态 0：未开始 1：上课中 2：已下课 11：禁止上课 |

\ <br>

***

\ <br>

### 8、查询课节回放视频

#### 描述

```
查询课节回放视频
接口地址（仅做说明使用）：https://api.polyv.net/hi-class-api/open/lesson/v1/getPlaybackVideo
```

#### 调用约束

1、接口调用有频率限制，[详细请查看](https://git.polyv.net/help-center/document-center/-/blob/master/vclass/java/limit.md)，调用常见异常，[详细请查看](https://git.polyv.net/help-center/document-center/-/blob/master/vclass/java/exceptionDoc/README.md)

#### 单元测试

```java
	@Test
	public void testGetPlaybackVideo() throws IOException, NoSuchAlgorithmException {
        VClassGetPlaybackVideoRequest vClassGetPlaybackVideoRequest;
        List<VClassGetPlaybackVideoResponse> vClassGetPlaybackVideoResponse;
        try {
            vClassGetPlaybackVideoRequest = VClassGetPlaybackVideoRequest.builder()
                    .lessonId(super.createLesson())
                    .build();
            vClassGetPlaybackVideoResponse = new VClassLessonServiceImpl().getPlaybackVideo(
                    vClassGetPlaybackVideoRequest);
            Assert.assertNotNull(vClassGetPlaybackVideoResponse);
            if (vClassGetPlaybackVideoResponse != null) {
                //to do something ......
                log.debug("测试查询课节回放视频成功 {}", JSON.toJSONString(vClassGetPlaybackVideoResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误，错误信息见PloyvSdkException.getMessage()
            log.error(e.getMessage(), e);
            // 异常返回做B端异常的业务逻辑，记录log 或者 上报到ETL 或者回滚事务
            throw e;
        } catch (Exception e) {
            log.error("SDK调用异常", e);
            throw e;
        }
    }
}
```

#### 单元测试说明

1、请求正确，返回VClassGetPlaybackVideoResponse对象，B端依据此对象处理业务逻辑；

2、请求参数校验不合格，抛出PloyvSdkException，错误信息见PloyvSdkException.getMessage()，如 \[ 输入参数 \[xxx.chat.LivexxxRequest]对象校验失败，失败字段 \[pic不能为空 / msg不能为空] ]

3、服务器处理异常，抛出PloyvSdkException，错误信息见PloyvSdkException.getMessage()，如 \[ 保利威请求返回数据错误，请求流水号：66e7ad29fd04425a84c2b2b562d2025b，错误原因： invalid signature. ]

#### 请求入参描述

| 参数名      | 必选   | 类型   | 说明  |
| -------- | ---- | ---- | --- |
| lessonId | true | Long | 课节号 |

#### 返回对象描述

返回对象是List\<VClassGetPlaybackVideoResponse>，**VClassGetPlaybackVideoResponse**具体元素内容如下：

| 参数名        | 类型     | 说明                                                       |
| ---------- | ------ | -------------------------------------------------------- |
| lessonId   | Long   | 课节ID                                                     |
| lessonName | String | 课节名称                                                     |
| firstImage | String | 首屏截图                                                     |
| duration   | String | 视频时长，格式 HH:mm:ss                                         |
| vid        | String | 视频id                                                     |
| status     | Long   | 视频状态码 60/61：已发布 10：等待编码 20：正在编码 40：编码失败 50：等待审核 51：审核不通过 |
| createTime | Date   | 视频创建时间                                                   |
| videoSize  | Long   | 视频文件大小，单位：Bytes                                          |
| playTimes  | Long   | 播放次数                                                     |
| url        | String | 视频链接                                                     |

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://polyv.gitbook.io/document/docs/vclass-copy/java/lessonservice.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
