xgb 2 недель назад
Родитель
Сommit
cdff97077b

+ 30 - 21
fs-admin/src/main/java/com/fs/admin/controller/LiveAdminController.java

@@ -15,9 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
-/**
- * 总后台直播视频管理控制器
- */
 @RestController
 @RequestMapping("/admin/live")
 public class LiveAdminController extends BaseController {
@@ -30,17 +27,27 @@ public class LiveAdminController extends BaseController {
     @Data
     public static class LiveExportVO {
         @Excel(name = "租户名称") private String companyName;
-        @Excel(name = "视频ID") private String videoId;
         @Excel(name = "直播ID") private String liveId;
-        @Excel(name = "视频地址") private String videoUrl;
-        @Excel(name = "视频类型") private String videoType;
-        @Excel(name = "时长(秒)") private String duration;
-        @Excel(name = "文件大小") private String fileSize;
-        @Excel(name = "转码状态") private String finishStatus;
+        @Excel(name = "直播标题") private String liveName;
+        @Excel(name = "封面地址") private String coverUrl;
+        @Excel(name = "直播类型") private String liveType;
+        @Excel(name = "直播状态") private String liveStatus;
+        @Excel(name = "开始时间") private String startTime;
+        @Excel(name = "结束时间") private String finishTime;
         @Excel(name = "创建时间") private String createTime;
     }
 
-    @Log(title = "导出直播视频", businessType = BusinessType.EXPORT)
+    private String statusText(Integer status) {
+        if (status == null) return "";
+        switch (status) {
+            case 1: return "待支付";
+            case 2: return "直播中";
+            case 3: return "已结束";
+            default: return String.valueOf(status);
+        }
+    }
+
+    @Log(title = "导出直播", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('admin:live:list')")
     @GetMapping("/export")
     public AjaxResult export(@RequestParam(required = false) String liveTitle,
@@ -52,18 +59,18 @@ public class LiveAdminController extends BaseController {
         for (Map<String, Object> m : allList) {
             LiveExportVO vo = new LiveExportVO();
             vo.setCompanyName(str(m.get("companyName")));
-            vo.setVideoId(str(m.get("videoId")));
             vo.setLiveId(str(m.get("liveId")));
-            vo.setVideoUrl(str(m.get("videoUrl")));
-            vo.setVideoType("1".equals(str(m.get("videoType"))) ? "录播" : "2".equals(str(m.get("videoType"))) ? "回放" : str(m.get("videoType")));
-            vo.setDuration(str(m.get("duration")));
-            vo.setFileSize(str(m.get("fileSize")));
-            vo.setFinishStatus(str(m.get("finishStatus")));
+            vo.setLiveName(str(m.get("liveName")));
+            vo.setCoverUrl(str(m.get("coverUrl")));
+            vo.setLiveType("1".equals(str(m.get("liveType"))) ? "直播" : "2".equals(str(m.get("liveType"))) ? "录播" : "");
+            vo.setLiveStatus(statusText((Integer) m.get("status")));
+            vo.setStartTime(str(m.get("startTime")));
+            vo.setFinishTime(str(m.get("finishTime")));
             vo.setCreateTime(str(m.get("createTime")));
             voList.add(vo);
         }
         ExcelUtil<LiveExportVO> util = new ExcelUtil<>(LiveExportVO.class);
-        return util.exportExcel(voList, "直播视频数据");
+        return util.exportExcel(voList, "直播数据");
     }
 
     @PreAuthorize("@ss.hasPermi('admin:live:list')")
@@ -77,10 +84,10 @@ public class LiveAdminController extends BaseController {
     }
 
     @PreAuthorize("@ss.hasPermi('admin:live:query')")
-    @GetMapping("/{videoId}")
-    public AjaxResult getInfo(@PathVariable Long videoId) {
-        Map<String, Object> data = adminLiveService.selectLiveById(videoId);
-        if (data == null) return AjaxResult.error("直播视频不存在");
+    @GetMapping("/{liveId}")
+    public AjaxResult getInfo(@PathVariable Long liveId) {
+        Map<String, Object> data = adminLiveService.selectLiveById(liveId);
+        if (data == null) return AjaxResult.error("直播不存在");
         return AjaxResult.success(data);
     }
 
@@ -92,6 +99,8 @@ public class LiveAdminController extends BaseController {
         List<Map<String, Object>> allList = adminLiveService.selectLiveListForExport(companyId, companyName, null, status);
         Map<String, Object> result = new HashMap<>();
         result.put("totalCount", allList.size());
+        result.put("livingCount", allList.stream().filter(m -> Integer.valueOf(2).equals(m.get("status"))).count());
+        result.put("endedCount", allList.stream().filter(m -> Integer.valueOf(3).equals(m.get("status"))).count());
         return AjaxResult.success(result);
     }
 }

+ 1 - 1
fs-service/src/main/java/com/fs/admin/mapper/AdminLiveMapper.java

@@ -10,5 +10,5 @@ public interface AdminLiveMapper {
     List<AdminLiveVO> selectLiveList(@Param("liveTitle") String liveTitle,
                                      @Param("status") Integer status);
 
-    AdminLiveVO selectLiveById(@Param("videoId") Long videoId);
+    AdminLiveVO selectLiveById(@Param("liveId") Long liveId);
 }

+ 1 - 1
fs-service/src/main/java/com/fs/admin/service/IAdminLiveService.java

@@ -9,5 +9,5 @@ public interface IAdminLiveService {
 
     List<Map<String, Object>> selectLiveListForExport(Long companyId, String companyName, String liveTitle, Integer status);
 
-    Map<String, Object> selectLiveById(Long videoId);
+    Map<String, Object> selectLiveById(Long liveId);
 }

+ 23 - 28
fs-service/src/main/java/com/fs/admin/service/impl/AdminLiveServiceImpl.java

@@ -27,43 +27,38 @@ public class AdminLiveServiceImpl implements IAdminLiveService {
     }
 
     @Override
-    public Map<String, Object> selectLiveById(Long videoId) {
-        AdminLiveVO vo = adminLiveMapper.selectLiveById(videoId);
+    public Map<String, Object> selectLiveById(Long liveId) {
+        AdminLiveVO vo = adminLiveMapper.selectLiveById(liveId);
         if (vo == null) return null;
+        return toMap(vo);
+    }
+
+    private Map<String, Object> toMap(AdminLiveVO vo) {
         Map<String, Object> map = new HashMap<>();
-        map.put("videoId", vo.getVideoId());
         map.put("liveId", vo.getLiveId());
-        map.put("videoUrl", vo.getVideoUrl());
-        map.put("videoType", vo.getVideoType());
-        map.put("duration", vo.getDuration());
-        map.put("createTime", vo.getCreateTime());
-        map.put("sort", vo.getSort());
-        map.put("fileSize", vo.getFileSize());
-        map.put("finishStatus", vo.getFinishStatus());
-        map.put("remark", vo.getRemark());
         map.put("companyId", vo.getCompanyId());
+        map.put("liveTitle", vo.getLiveName());
+        map.put("liveName", vo.getLiveName());
+        map.put("coverUrl", vo.getLiveImgUrl());
+        map.put("startTime", vo.getStartTime());
+        map.put("finishTime", vo.getFinishTime());
+        map.put("status", vo.getStatus());
+        map.put("liveType", vo.getLiveType());
+        map.put("showType", vo.getShowType());
+        map.put("anchorId", vo.getAnchorId());
+        map.put("isShow", vo.getIsShow());
+        map.put("isDel", vo.getIsDel());
+        map.put("createTime", vo.getCreateTime());
+        map.put("liveDesc", vo.getLiveDesc());
+        map.put("liveConfig", vo.getLiveConfig());
+        map.put("rtmpUrl", vo.getRtmpUrl());
+        map.put("flvHlsUrl", vo.getFlvHlsUrl());
         map.put("companyName", vo.getCompanyName());
         map.put("tenantCode", vo.getTenantCode());
         return map;
     }
 
     private List<Map<String, Object>> toMapList(List<AdminLiveVO> voList) {
-        return voList.stream().map(vo -> {
-            Map<String, Object> map = new HashMap<>();
-            map.put("videoId", vo.getVideoId());
-            map.put("liveId", vo.getLiveId());
-            map.put("videoUrl", vo.getVideoUrl());
-            map.put("videoType", vo.getVideoType());
-            map.put("duration", vo.getDuration());
-            map.put("createTime", vo.getCreateTime());
-            map.put("sort", vo.getSort());
-            map.put("fileSize", vo.getFileSize());
-            map.put("finishStatus", vo.getFinishStatus());
-            map.put("remark", vo.getRemark());
-            map.put("companyId", vo.getCompanyId());
-            map.put("companyName", vo.getCompanyName());
-            map.put("tenantCode", vo.getTenantCode());
-            return map;
-        }).collect(java.util.stream.Collectors.toList());
+        return voList.stream().map(this::toMap).collect(java.util.stream.Collectors.toList());
     }
 }

+ 22 - 20
fs-service/src/main/java/com/fs/admin/vo/AdminLiveVO.java

@@ -5,29 +5,31 @@ import lombok.Data;
 @Data
 public class AdminLiveVO {
 
-    private Long videoId;
-
     private Long liveId;
-
-    private String videoUrl;
-
-    private Integer videoType;
-
-    private Integer duration;
-
-    private String createTime;
-
-    private Integer sort;
-
-    private Integer fileSize;
-
-    private Integer finishStatus;
-
-    private String remark;
-
     private Long companyId;
+    private Long companyUserId;
+    private Long talentId;
+    private String liveName;
+    private String liveDesc;
+    private Integer showType;
+    private Integer status;
+    private String createTime;
+    private Long anchorId;
+    private Integer liveType;
+    private String startTime;
+    private String finishTime;
+    private String liveImgUrl;
+    private String liveConfig;
+    private Integer isShow;
+    private Integer isDel;
+    private String qwQrCode;
+    private String rtmpUrl;
+    private String configJson;
+    private Integer isAudit;
+    private String flvHlsUrl;
+    private String idCardUrl;
+    private Integer globalVisible;
 
     private String companyName;
-
     private String tenantCode;
 }

+ 37 - 16
fs-service/src/main/resources/mapper/admin/AdminLiveMapper.xml

@@ -5,38 +5,59 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 <mapper namespace="com.fs.admin.mapper.AdminLiveMapper">
 
     <resultMap type="com.fs.admin.vo.AdminLiveVO" id="AdminLiveVOResult">
-        <id     property="videoId"       column="video_id"       />
-        <result property="liveId"        column="live_id"        />
-        <result property="videoUrl"      column="video_url"      />
-        <result property="videoType"     column="video_type"     />
-        <result property="duration"      column="duration"       />
+        <id     property="liveId"        column="live_id"        />
+        <result property="companyId"     column="company_id"     />
+        <result property="companyUserId" column="company_user_id" />
+        <result property="talentId"      column="talent_id"      />
+        <result property="liveName"      column="live_name"      />
+        <result property="liveDesc"      column="live_desc"      />
+        <result property="showType"      column="show_type"      />
+        <result property="status"        column="status"         />
         <result property="createTime"    column="create_time"    />
-        <result property="sort"          column="sort"           />
-        <result property="fileSize"      column="file_size"      />
-        <result property="finishStatus"  column="finish_status"  />
-        <result property="remark"        column="remark"         />
+        <result property="anchorId"      column="anchor_id"      />
+        <result property="liveType"      column="live_type"      />
+        <result property="startTime"     column="start_time"     />
+        <result property="finishTime"    column="finish_time"    />
+        <result property="liveImgUrl"    column="live_img_url"   />
+        <result property="liveConfig"    column="live_config"    />
+        <result property="isShow"        column="is_show"        />
+        <result property="isDel"         column="is_del"         />
+        <result property="qwQrCode"      column="qw_qr_code"     />
+        <result property="rtmpUrl"       column="rtmp_url"       />
+        <result property="configJson"    column="config_json"    />
+        <result property="isAudit"       column="is_audit"       />
+        <result property="flvHlsUrl"     column="flv_hls_url"    />
+        <result property="idCardUrl"     column="id_card_url"    />
+        <result property="globalVisible" column="global_visible" />
     </resultMap>
 
     <sql id="selectAdminLiveVo">
-        SELECT v.video_id, v.live_id, v.video_url, v.video_type,
-               v.duration, v.create_time, v.sort, v.file_size,
-               v.finish_status, v.remark
-        FROM live_video v
+        SELECT l.live_id, l.company_id, l.company_user_id, l.talent_id,
+               l.live_name, l.live_desc, l.show_type, l.status,
+               l.create_time, l.anchor_id, l.live_type, l.start_time,
+               l.finish_time, l.live_img_url, l.live_config,
+               l.is_show, l.is_del, l.qw_qr_code, l.rtmp_url,
+               l.config_json, l.is_audit, l.flv_hls_url, l.id_card_url,
+               l.global_visible
+        FROM live l
     </sql>
 
     <select id="selectLiveList" resultMap="AdminLiveVOResult">
         <include refid="selectAdminLiveVo"/>
         <where>
+            <if test="liveTitle != null and liveTitle != ''">
+                AND l.live_name LIKE CONCAT('%', #{liveTitle}, '%')
+            </if>
             <if test="status != null">
-                AND v.finish_status = #{status}
+                AND l.status = #{status}
             </if>
         </where>
-        ORDER BY v.create_time DESC
+        ORDER BY l.create_time DESC
     </select>
 
     <select id="selectLiveById" resultMap="AdminLiveVOResult">
         <include refid="selectAdminLiveVo"/>
-        WHERE v.video_id = #{videoId}
+        WHERE l.live_id = #{liveId}
     </select>
 
 </mapper>