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