Browse Source

Merge remote-tracking branch 'origin/ywx' into wn

tags/正式3.13.0
王宁 1 year ago
parent
commit
d43a1ead4b

+ 1
- 2
sclass/src/main/resources/mapper/classroom/ClassroomMapper.xml View File

@@ -356,8 +356,7 @@
356 356
         <if test="userVo.usertype!=0">
357 357
             and c.teacherid=#{room.teacherid}
358 358
         </if>
359
-
360
-        <if test="room.directorid!=null and room.directorid!='0'.toString() and room.directorid!=''">AND
359
+        <if test="room.directorid!=null and room.directorid!='0'.toString() and room.directorid!=''">
361 360
             AND c.directorid=#{room.directorid}
362 361
         </if>
363 362
         <if test="room.classid!=null and room.classid!=0">AND c.classid=#{room.classid}</if>

+ 20
- 0
slive/src/main/java/com/xhkjedu/slive/controller/liveplay/CourseSectionPlaybackController.java View File

@@ -3,6 +3,7 @@ package com.xhkjedu.slive.controller.liveplay;
3 3
 import com.xhkjedu.slive.model.liveplay.LCourseSectionPlayback;
4 4
 import com.xhkjedu.slive.model.liveplay.LCourseSectionPlaybackSee;
5 5
 import com.xhkjedu.slive.service.liveplay.CourseSectionPlaybackService;
6
+import com.xhkjedu.slive.vo.liveplay.CSPlaybackVo;
6 7
 import com.xhkjedu.utils.N_Utils;
7 8
 import com.xhkjedu.vo.ResultVo;
8 9
 import org.springframework.web.bind.annotation.PostMapping;
@@ -66,5 +67,24 @@ public class CourseSectionPlaybackController {
66 67
         return new ResultVo(0,"成功更新视频下载次数");
67 68
     }
68 69
 
70
+    /**
71
+     * @Description 根据课节名称删除回放地址
72
+     * @Date 2023/11/20 11:05
73
+     * @Author YWX
74
+     * @Param [pb]
75
+     * @Return com.xhkjedu.vo.ResultVo
76
+     **/
77
+    @PostMapping("/del_pb")
78
+    public ResultVo deletePb(@RequestBody CSPlaybackVo pb) {
79
+        if (!N_Utils.isTrueInteger(pb.getBatchnum())) return new ResultVo(1, "批处理数量不能为空");
80
+        List<String> sectionnames = pb.getSectionnames();
81
+        if (N_Utils.isListEmpty(sectionnames)) return new ResultVo(1, "课节名称不能为空");
82
+        for (String sectionname : sectionnames) {
83
+            if (N_Utils.isEmpty(sectionname)) return new ResultVo(1, "课节名称不能为空");
84
+        }
85
+        courseSectionPlaybackService.deletePb(pb);
86
+        return new ResultVo(0, "删除回放成功");
87
+    }
88
+
69 89
 
70 90
 }

+ 6
- 0
slive/src/main/java/com/xhkjedu/slive/mapper/liveplay/CourseSectionPlaybackMapper.java View File

@@ -29,4 +29,10 @@ public interface CourseSectionPlaybackMapper extends TkMapper<LCourseSectionPlay
29 29
 
30 30
     //修改视频下载次数
31 31
     void updateDownnum(@Param("pbid") Integer pbid);
32
+
33
+    //根据课节名称获取回放地址列表
34
+    List<Map> listPb(@Param("sectionnames") List<String> sectionnames);
35
+
36
+    //删除回放
37
+    void deletePb(@Param("pbs") List<String> pbs);
32 38
 }

+ 41
- 2
slive/src/main/java/com/xhkjedu/slive/service/liveplay/CourseSectionPlaybackService.java View File

@@ -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
 }

+ 11
- 0
slive/src/main/java/com/xhkjedu/slive/utils/LiveUtil.java View File

@@ -1,5 +1,8 @@
1 1
 package com.xhkjedu.slive.utils;
2 2
 
3
+import com.alibaba.fastjson.JSON;
4
+import com.xhkjedu.utils.N_Utils;
5
+import com.xhkjedu.vo.ResultVo;
3 6
 import lombok.extern.slf4j.Slf4j;
4 7
 
5 8
 import java.time.DayOfWeek;
@@ -189,4 +192,12 @@ public class LiveUtil {
189 192
         return rtnlst;
190 193
     }
191 194
 
195
+    //发送请求
196
+    public static ResultVo sendJsonPost(String url, String param) {
197
+        String result = N_Utils.sendJsonPost(url, param);
198
+        if (N_Utils.isEmpty(result)) return new ResultVo(1, "发送请求失败");
199
+        ResultVo vo = JSON.parseObject(result, ResultVo.class);
200
+        return vo;
201
+    }
202
+
192 203
 }

+ 19
- 0
slive/src/main/java/com/xhkjedu/slive/vo/liveplay/CSPlaybackVo.java View File

@@ -0,0 +1,19 @@
1
+package com.xhkjedu.slive.vo.liveplay;
2
+
3
+import lombok.Data;
4
+
5
+import java.util.List;
6
+
7
+/**
8
+ * @Description 删除回放vo
9
+ * @Author: YWX
10
+ * @Date 2023/11/20 16:53
11
+ **/
12
+@Data
13
+public class CSPlaybackVo {
14
+    //课节名称
15
+    private List<String> sectionnames;
16
+
17
+    //批处理数量
18
+    private Integer batchnum;
19
+}

+ 21
- 0
slive/src/main/resources/mapper/liveplay/CourseSectionPlaybackMapper.xml View File

@@ -26,5 +26,26 @@
26 26
     <update id="updateDownnum">
27 27
         update l_course_section_playback set dn = dn+1 where pbid=#{pbid};
28 28
     </update>
29
+    <!--根据课节名称获取回放地址列表-->
30
+    <resultMap id="pbResult" type="java.util.Map">
31
+        <result property="rspath" column="rspath"/>
32
+        <collection property="pbs" javaType="java.util.List" ofType="java.lang.String">
33
+            <result property="pb" column="pb"/>
34
+        </collection>
35
+    </resultMap>
36
+    <select id="listPb" resultMap="pbResult">
37
+        select p.pb,r.rspath
38
+        from l_course_section cs right join l_course_section_playback p on cs.sectionid=p.sectionid
39
+        left join l_recordserver r on p.rsid=r.rsid
40
+        where p.pb is not null and p.pb!=''
41
+        <foreach collection="sectionnames" item="sectionname" open=" and (" separator="or" close=")">
42
+            cs.sectionname LIKE '%${sectionname}%'
43
+        </foreach>
44
+    </select>
45
+    <!--删除回放-->
46
+    <update id="deletePb">
47
+        update l_course_section_playback set pb=null where pb in
48
+        <foreach collection="pbs" item="pb" open="(" separator="," close=")">'${pb}'</foreach>
49
+    </update>
29 50
 
30 51
 </mapper>

Loading…
Cancel
Save