|
|
@@ -2,7 +2,7 @@ package com.fs.admin.controller;
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
-import com.fs.admin.helper.AdminCrossTenantHelper;
|
|
|
+import com.fs.admin.service.IAdminLiveService;
|
|
|
import com.fs.common.annotation.Excel;
|
|
|
import com.fs.common.annotation.Log;
|
|
|
import com.fs.common.core.controller.BaseController;
|
|
|
@@ -16,102 +16,80 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
/**
|
|
|
- * 总后台直播内容管理控制器
|
|
|
- * 遍历所有租户库查询 live_video 数据
|
|
|
+ * 总后台直播视频管理控制器
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/admin/live")
|
|
|
public class LiveAdminController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
- private AdminCrossTenantHelper crossTenantHelper;
|
|
|
+ private IAdminLiveService adminLiveService;
|
|
|
|
|
|
private String str(Object o) { return o == null ? "" : o.toString(); }
|
|
|
|
|
|
@Data
|
|
|
public static class LiveExportVO {
|
|
|
@Excel(name = "租户名称") private String companyName;
|
|
|
- @Excel(name = "直播标题") private String title;
|
|
|
- @Excel(name = "状态") private String liveStatus;
|
|
|
- @Excel(name = "开始时间") private String startTime;
|
|
|
- @Excel(name = "结束时间") private String endTime;
|
|
|
+ @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 createTime;
|
|
|
}
|
|
|
|
|
|
- @Log(title = "导出直播", businessType = BusinessType.EXPORT)
|
|
|
+ @Log(title = "导出直播视频", businessType = BusinessType.EXPORT)
|
|
|
@PreAuthorize("@ss.hasPermi('admin:live:list')")
|
|
|
@GetMapping("/export")
|
|
|
- public AjaxResult export(@RequestParam(required = false) String liveName,
|
|
|
+ public AjaxResult export(@RequestParam(required = false) String liveTitle,
|
|
|
@RequestParam(required = false) Long companyId,
|
|
|
- @RequestParam(required = false) String companyName) {
|
|
|
- List<Map<String, Object>> allList = crossTenantHelper.queryAcrossTenants(
|
|
|
- companyId, companyName, (tenant, jdbc) -> {
|
|
|
- StringBuilder sql = new StringBuilder(
|
|
|
- "SELECT v.video_id, v.title, v.cover_url, v.live_status, " +
|
|
|
- "v.start_time, v.end_time, v.create_time " +
|
|
|
- "FROM live_video v WHERE 1=1");
|
|
|
- List<Object> params = new ArrayList<>();
|
|
|
- if (liveName != null && !liveName.isEmpty()) {
|
|
|
- sql.append(" AND v.title LIKE ?");
|
|
|
- params.add("%" + liveName + "%");
|
|
|
- }
|
|
|
- sql.append(" ORDER BY v.create_time DESC");
|
|
|
- return params.isEmpty()
|
|
|
- ? jdbc.queryForList(sql.toString())
|
|
|
- : jdbc.queryForList(sql.toString(), params.toArray());
|
|
|
- });
|
|
|
+ @RequestParam(required = false) String companyName,
|
|
|
+ @RequestParam(required = false) Integer status) {
|
|
|
+ List<Map<String, Object>> allList = adminLiveService.selectLiveListForExport(companyId, companyName, liveTitle, status);
|
|
|
List<LiveExportVO> voList = new ArrayList<>();
|
|
|
for (Map<String, Object> m : allList) {
|
|
|
LiveExportVO vo = new LiveExportVO();
|
|
|
- vo.setCompanyName(str(m.get("company_name")));
|
|
|
- vo.setTitle(str(m.get("title")));
|
|
|
- vo.setLiveStatus(str(m.get("live_status")));
|
|
|
- vo.setStartTime(str(m.get("start_time")));
|
|
|
- vo.setEndTime(str(m.get("end_time")));
|
|
|
- vo.setCreateTime(str(m.get("create_time")));
|
|
|
+ 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.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')")
|
|
|
@GetMapping("/list")
|
|
|
- public TableDataInfo list(@RequestParam(required = false) String liveName,
|
|
|
+ public TableDataInfo list(@RequestParam(required = false) String liveTitle,
|
|
|
@RequestParam(required = false) Long companyId,
|
|
|
- @RequestParam(required = false) String companyName) {
|
|
|
- List<Map<String, Object>> allList = crossTenantHelper.queryAcrossTenants(
|
|
|
- companyId, companyName, (tenant, jdbc) -> {
|
|
|
- StringBuilder sql = new StringBuilder(
|
|
|
- "SELECT v.video_id, v.title, v.cover_url, v.live_status, " +
|
|
|
- "v.start_time, v.end_time, v.create_time " +
|
|
|
- "FROM live_video v WHERE 1=1");
|
|
|
- List<Object> params = new ArrayList<>();
|
|
|
- if (liveName != null && !liveName.isEmpty()) {
|
|
|
- sql.append(" AND v.title LIKE ?");
|
|
|
- params.add("%" + liveName + "%");
|
|
|
- }
|
|
|
- sql.append(" ORDER BY v.create_time DESC LIMIT 200");
|
|
|
- return params.isEmpty()
|
|
|
- ? jdbc.queryForList(sql.toString())
|
|
|
- : jdbc.queryForList(sql.toString(), params.toArray());
|
|
|
- });
|
|
|
+ @RequestParam(required = false) String companyName,
|
|
|
+ @RequestParam(required = false) Integer status) {
|
|
|
+ List<Map<String, Object>> allList = adminLiveService.selectLiveList(companyId, companyName, liveTitle, status);
|
|
|
return getDataTable(allList);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 直播统计信息
|
|
|
- */
|
|
|
+ @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("直播视频不存在");
|
|
|
+ return AjaxResult.success(data);
|
|
|
+ }
|
|
|
+
|
|
|
@PreAuthorize("@ss.hasPermi('admin:live:query')")
|
|
|
@GetMapping("/statistics")
|
|
|
public AjaxResult statistics(@RequestParam(required = false) Long companyId,
|
|
|
- @RequestParam(required = false) String companyName) {
|
|
|
- List<Map<String, Object>> allList = crossTenantHelper.queryAcrossTenants(
|
|
|
- companyId, companyName, (tenant, jdbc) ->
|
|
|
- jdbc.queryForList("SELECT video_id, live_status FROM live_video"));
|
|
|
+ @RequestParam(required = false) String companyName,
|
|
|
+ @RequestParam(required = false) Integer status) {
|
|
|
+ List<Map<String, Object>> allList = adminLiveService.selectLiveListForExport(companyId, companyName, null, status);
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
result.put("totalCount", allList.size());
|
|
|
return AjaxResult.success(result);
|