|
@@ -1,16 +1,20 @@
|
1
|
1
|
package com.xhkjedu.slive.service.liveplay;
|
2
|
2
|
|
|
3
|
+import com.alibaba.fastjson.JSON;
|
3
|
4
|
import com.xhkjedu.slive.mapper.liveplay.CourseSectionPlaybackMapper;
|
4
|
5
|
import com.xhkjedu.slive.mapper.liveplay.CourseSectionPlaybackSeeMapper;
|
5
|
6
|
import com.xhkjedu.slive.model.liveplay.LCourseSectionPlayback;
|
6
|
7
|
import com.xhkjedu.slive.model.liveplay.LCourseSectionPlaybackSee;
|
|
8
|
+import com.xhkjedu.slive.utils.LiveUtil;
|
|
9
|
+import com.xhkjedu.slive.vo.liveplay.*;
|
7
|
10
|
import com.xhkjedu.utils.N_Utils;
|
8
|
11
|
import com.xhkjedu.vo.ResultVo;
|
|
12
|
+import lombok.extern.slf4j.Slf4j;
|
9
|
13
|
import org.springframework.stereotype.Service;
|
10
|
14
|
|
11
|
15
|
import javax.annotation.Resource;
|
12
|
|
-import java.util.List;
|
13
|
|
-import java.util.Map;
|
|
16
|
+import java.util.*;
|
|
17
|
+import java.util.stream.Collectors;
|
14
|
18
|
|
15
|
19
|
/**
|
16
|
20
|
* @ClassName CourseSectionPlaybackService
|
|
@@ -19,6 +23,7 @@ import java.util.Map;
|
19
|
23
|
* Date 2021/6/16 10:20
|
20
|
24
|
**/
|
21
|
25
|
@Service
|
|
26
|
+@Slf4j
|
22
|
27
|
public class CourseSectionPlaybackService {
|
23
|
28
|
|
24
|
29
|
@Resource
|
|
@@ -75,4 +80,38 @@ public class CourseSectionPlaybackService {
|
75
|
80
|
public void updateDownnum(LCourseSectionPlayback playback) {
|
76
|
81
|
courseSectionPlaybackMapper.updateDownnum(playback.getPbid());//修改回放观看次数
|
77
|
82
|
}
|
|
83
|
+
|
|
84
|
+ /**
|
|
85
|
+ * @Description 根据课节名称删除回放地址
|
|
86
|
+ * @Date 2023/11/20 16:36
|
|
87
|
+ * @Author YWX
|
|
88
|
+ * @Param [pb]
|
|
89
|
+ * @Return void
|
|
90
|
+ **/
|
|
91
|
+ public void deletePb(CSPlaybackVo pb) {
|
|
92
|
+ List<Map> list = courseSectionPlaybackMapper.listPb(pb.getSectionnames());
|
|
93
|
+ for (Map map : list) {
|
|
94
|
+ String rspath = map.get("rspath").toString();
|
|
95
|
+ List<String> pbs = (List<String>) map.get("pbs");
|
|
96
|
+ Map<String, Object> params = new HashMap<>();
|
|
97
|
+ Integer batchnum = pb.getBatchnum();
|
|
98
|
+ for (int i = 0; i < pbs.size(); i += batchnum) {
|
|
99
|
+ List<String> filelist = pbs.stream().skip(i).limit(batchnum).collect(Collectors.toList());
|
|
100
|
+ params.put("fileList", filelist);
|
|
101
|
+ params.put("sign", N_Utils.getMD5Pwd(JSON.toJSONString(filelist)));
|
|
102
|
+ ResultVo vo = LiveUtil.sendJsonPost(rspath + "/recorder/v1/delfiles", JSON.toJSONString(params));
|
|
103
|
+ if (vo.getCode() == 0) {
|
|
104
|
+ Map<String, List<String>> result = (Map<String, List<String>>) vo.getObj();
|
|
105
|
+ List<String> successList = result.get("successList");
|
|
106
|
+ courseSectionPlaybackMapper.deletePb(successList);
|
|
107
|
+ List<String> failList = result.get("failList");
|
|
108
|
+ if (N_Utils.isListNotEmpty(failList)) {
|
|
109
|
+ log.error("删除回放失败:{}", failList);
|
|
110
|
+ }
|
|
111
|
+ } else {
|
|
112
|
+ log.error("删除回放失败:{}", vo.getMsg());
|
|
113
|
+ }
|
|
114
|
+ }
|
|
115
|
+ }
|
|
116
|
+ }
|
78
|
117
|
}
|