wanghongbo

Merge remote-tracking branch 'origin/master'

... ... @@ -16,10 +16,7 @@ import com.wondertek.entity.StreamTask;
import com.wondertek.mapper.LiveMonitorRoomMapper;
import com.wondertek.service.LiveMonitorRoomService;
import com.wondertek.service.StreamTaskService;
import com.wondertek.util.HttpClientUtils;
import com.wondertek.util.JSONUtils;
import com.wondertek.util.PageBean;
import com.wondertek.util.ResultBean;
import com.wondertek.util.*;
import com.wondertek.vo.LMRoomListVo;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
... ... @@ -44,10 +41,28 @@ public class LiveMonitorRoomServiceImpl extends ServiceImpl<LiveMonitorRoomMappe
@Value("${transcode.getTaskDetail}")
private String getTaskDetail;
@Value("${crp.pIp}")
private String pIp;
@Value("${crp.pPort}")
private String pProt;
@Override
public PageBean queryPage(LMRoomDto lmRoomDto) {
Page<LMRoomListVo> page = new Page<>(lmRoomDto.getPage(), lmRoomDto.getSize());
IPage<LMRoomListVo> resultPage = liveMonitorRoomMapper.findPageList(page, lmRoomDto);
List<LMRoomListVo> records = resultPage.getRecords();
if(!CollectionUtils.isEmpty(records)){
for (LMRoomListVo record : records) {
String mixOutputUrl = record.getMixOutputUrl();
record.setMixOutputUrl(FileUtils.replacePUrl(mixOutputUrl,pIp,pProt));
}
}
return new PageBean(Integer.parseInt(String.valueOf(resultPage.getPages())),resultPage.getTotal(),resultPage.getRecords());
}
... ... @@ -66,6 +81,9 @@ public class LiveMonitorRoomServiceImpl extends ServiceImpl<LiveMonitorRoomMappe
wrapper.eq(StreamTask::getRoomId,record.getId());
wrapper.eq(StreamTask::getTaskType,"0");
wrapper.eq(StreamTask::getPlayType,"play");
String mixOutputUrl = record.getMixOutputUrl();
record.setMixOutputUrl(FileUtils.replacePUrl(mixOutputUrl,pIp,pProt));
List<StreamTask> taskList = monitorMarkService.list(wrapper);
if(!CollectionUtils.isEmpty(taskList)){
record.setDelayTime(taskList.get(0).getDelayTime());
... ... @@ -325,6 +343,13 @@ public class LiveMonitorRoomServiceImpl extends ServiceImpl<LiveMonitorRoomMappe
Map<String, Object> result = JSON.parseObject(JSON.toJSONString(monitorRoom), new TypeReference<Map<String, Object>>() {
});
List<StreamTask> taskList = monitorMarkService.list(new QueryWrapper<StreamTask>().eq("room_id", id));
if(!CollectionUtils.isEmpty(taskList)){
for (StreamTask streamTask : taskList) {
String mixOutputUrl = streamTask.getOutputDir();
streamTask.setOutputDir(FileUtils.replacePUrl(mixOutputUrl,pIp,pProt));
}
}
result.put("taskList",taskList);
return ResultBean.ok(result);
}
... ...
... ... @@ -37,5 +37,34 @@ public class FileUtils {
return StrUtil.concat(false, new String[] { realPath,"dianpian/", time, "/", id, "/" });
}
public static String replacePUrl(String originalUrl, String newIp, String newPort) {
// // 原始URL
// String originalUrl = "http://180.167.180.242:42085/live/flv-ShuChu_1_1.flv";
// // 新的IP和端口
// String newIp = "1.12.3.4";
// int newPort = 42333;
// 解析原始URL,获取路径部分
if(originalUrl == null){
return "";
}
String[] urlParts = originalUrl.split("://");
if (urlParts.length < 2) {
System.out.println("无效的URL格式");
return "";
}
String afterProtocol = urlParts[1];
String[] hostAndPath = afterProtocol.split("/", 2);
String path = "";
if (hostAndPath.length > 1) {
path = "/" + hostAndPath[1];
}
// 构建新的URL
String newUrl = "http://" + newIp + ":" + newPort + path;
System.out.println("替换后的URL: " + newUrl);
return newUrl;
}
}
... ...
... ... @@ -70,6 +70,8 @@ file:
realPath: /home/wondertek/material_file_assets/dianpian/
crp:
pIp: 180.167.180.242
pPort: 42085
user:
username: admin
password: 123456
... ...
... ... @@ -70,6 +70,8 @@ file:
realPath: /home/wondertek/material_file_assets/dianpian/
crp:
pIp: 180.167.180.242
pPort: 42085
user:
username: admin
password: 123456
... ...