Showing
4 changed files
with
62 additions
and
4 deletions
| @@ -16,10 +16,7 @@ import com.wondertek.entity.StreamTask; | @@ -16,10 +16,7 @@ import com.wondertek.entity.StreamTask; | ||
| 16 | import com.wondertek.mapper.LiveMonitorRoomMapper; | 16 | import com.wondertek.mapper.LiveMonitorRoomMapper; |
| 17 | import com.wondertek.service.LiveMonitorRoomService; | 17 | import com.wondertek.service.LiveMonitorRoomService; |
| 18 | import com.wondertek.service.StreamTaskService; | 18 | import com.wondertek.service.StreamTaskService; |
| 19 | -import com.wondertek.util.HttpClientUtils; | ||
| 20 | -import com.wondertek.util.JSONUtils; | ||
| 21 | -import com.wondertek.util.PageBean; | ||
| 22 | -import com.wondertek.util.ResultBean; | 19 | +import com.wondertek.util.*; |
| 23 | import com.wondertek.vo.LMRoomListVo; | 20 | import com.wondertek.vo.LMRoomListVo; |
| 24 | import jakarta.annotation.Resource; | 21 | import jakarta.annotation.Resource; |
| 25 | import lombok.extern.slf4j.Slf4j; | 22 | import lombok.extern.slf4j.Slf4j; |
| @@ -44,10 +41,28 @@ public class LiveMonitorRoomServiceImpl extends ServiceImpl<LiveMonitorRoomMappe | @@ -44,10 +41,28 @@ public class LiveMonitorRoomServiceImpl extends ServiceImpl<LiveMonitorRoomMappe | ||
| 44 | @Value("${transcode.getTaskDetail}") | 41 | @Value("${transcode.getTaskDetail}") |
| 45 | private String getTaskDetail; | 42 | private String getTaskDetail; |
| 46 | 43 | ||
| 44 | + | ||
| 45 | + @Value("${crp.pIp}") | ||
| 46 | + private String pIp; | ||
| 47 | + | ||
| 48 | + | ||
| 49 | + @Value("${crp.pPort}") | ||
| 50 | + private String pProt; | ||
| 51 | + | ||
| 47 | @Override | 52 | @Override |
| 48 | public PageBean queryPage(LMRoomDto lmRoomDto) { | 53 | public PageBean queryPage(LMRoomDto lmRoomDto) { |
| 49 | Page<LMRoomListVo> page = new Page<>(lmRoomDto.getPage(), lmRoomDto.getSize()); | 54 | Page<LMRoomListVo> page = new Page<>(lmRoomDto.getPage(), lmRoomDto.getSize()); |
| 50 | IPage<LMRoomListVo> resultPage = liveMonitorRoomMapper.findPageList(page, lmRoomDto); | 55 | IPage<LMRoomListVo> resultPage = liveMonitorRoomMapper.findPageList(page, lmRoomDto); |
| 56 | + | ||
| 57 | + List<LMRoomListVo> records = resultPage.getRecords(); | ||
| 58 | + if(!CollectionUtils.isEmpty(records)){ | ||
| 59 | + for (LMRoomListVo record : records) { | ||
| 60 | + String mixOutputUrl = record.getMixOutputUrl(); | ||
| 61 | + record.setMixOutputUrl(FileUtils.replacePUrl(mixOutputUrl,pIp,pProt)); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + } | ||
| 65 | + | ||
| 51 | return new PageBean(Integer.parseInt(String.valueOf(resultPage.getPages())),resultPage.getTotal(),resultPage.getRecords()); | 66 | return new PageBean(Integer.parseInt(String.valueOf(resultPage.getPages())),resultPage.getTotal(),resultPage.getRecords()); |
| 52 | } | 67 | } |
| 53 | 68 | ||
| @@ -66,6 +81,9 @@ public class LiveMonitorRoomServiceImpl extends ServiceImpl<LiveMonitorRoomMappe | @@ -66,6 +81,9 @@ public class LiveMonitorRoomServiceImpl extends ServiceImpl<LiveMonitorRoomMappe | ||
| 66 | wrapper.eq(StreamTask::getRoomId,record.getId()); | 81 | wrapper.eq(StreamTask::getRoomId,record.getId()); |
| 67 | wrapper.eq(StreamTask::getTaskType,"0"); | 82 | wrapper.eq(StreamTask::getTaskType,"0"); |
| 68 | wrapper.eq(StreamTask::getPlayType,"play"); | 83 | wrapper.eq(StreamTask::getPlayType,"play"); |
| 84 | + String mixOutputUrl = record.getMixOutputUrl(); | ||
| 85 | + record.setMixOutputUrl(FileUtils.replacePUrl(mixOutputUrl,pIp,pProt)); | ||
| 86 | + | ||
| 69 | List<StreamTask> taskList = monitorMarkService.list(wrapper); | 87 | List<StreamTask> taskList = monitorMarkService.list(wrapper); |
| 70 | if(!CollectionUtils.isEmpty(taskList)){ | 88 | if(!CollectionUtils.isEmpty(taskList)){ |
| 71 | record.setDelayTime(taskList.get(0).getDelayTime()); | 89 | record.setDelayTime(taskList.get(0).getDelayTime()); |
| @@ -325,6 +343,13 @@ public class LiveMonitorRoomServiceImpl extends ServiceImpl<LiveMonitorRoomMappe | @@ -325,6 +343,13 @@ public class LiveMonitorRoomServiceImpl extends ServiceImpl<LiveMonitorRoomMappe | ||
| 325 | Map<String, Object> result = JSON.parseObject(JSON.toJSONString(monitorRoom), new TypeReference<Map<String, Object>>() { | 343 | Map<String, Object> result = JSON.parseObject(JSON.toJSONString(monitorRoom), new TypeReference<Map<String, Object>>() { |
| 326 | }); | 344 | }); |
| 327 | List<StreamTask> taskList = monitorMarkService.list(new QueryWrapper<StreamTask>().eq("room_id", id)); | 345 | List<StreamTask> taskList = monitorMarkService.list(new QueryWrapper<StreamTask>().eq("room_id", id)); |
| 346 | + | ||
| 347 | + if(!CollectionUtils.isEmpty(taskList)){ | ||
| 348 | + for (StreamTask streamTask : taskList) { | ||
| 349 | + String mixOutputUrl = streamTask.getOutputDir(); | ||
| 350 | + streamTask.setOutputDir(FileUtils.replacePUrl(mixOutputUrl,pIp,pProt)); | ||
| 351 | + } | ||
| 352 | + } | ||
| 328 | result.put("taskList",taskList); | 353 | result.put("taskList",taskList); |
| 329 | return ResultBean.ok(result); | 354 | return ResultBean.ok(result); |
| 330 | } | 355 | } |
| @@ -37,5 +37,34 @@ public class FileUtils { | @@ -37,5 +37,34 @@ public class FileUtils { | ||
| 37 | return StrUtil.concat(false, new String[] { realPath,"dianpian/", time, "/", id, "/" }); | 37 | return StrUtil.concat(false, new String[] { realPath,"dianpian/", time, "/", id, "/" }); |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | + public static String replacePUrl(String originalUrl, String newIp, String newPort) { | ||
| 41 | +// // 原始URL | ||
| 42 | +// String originalUrl = "http://180.167.180.242:42085/live/flv-ShuChu_1_1.flv"; | ||
| 43 | +// // 新的IP和端口 | ||
| 44 | +// String newIp = "1.12.3.4"; | ||
| 45 | +// int newPort = 42333; | ||
| 46 | + | ||
| 47 | + // 解析原始URL,获取路径部分 | ||
| 48 | + if(originalUrl == null){ | ||
| 49 | + return ""; | ||
| 50 | + } | ||
| 51 | + String[] urlParts = originalUrl.split("://"); | ||
| 52 | + if (urlParts.length < 2) { | ||
| 53 | + System.out.println("无效的URL格式"); | ||
| 54 | + return ""; | ||
| 55 | + } | ||
| 56 | + String afterProtocol = urlParts[1]; | ||
| 57 | + String[] hostAndPath = afterProtocol.split("/", 2); | ||
| 58 | + String path = ""; | ||
| 59 | + if (hostAndPath.length > 1) { | ||
| 60 | + path = "/" + hostAndPath[1]; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + // 构建新的URL | ||
| 64 | + String newUrl = "http://" + newIp + ":" + newPort + path; | ||
| 65 | + System.out.println("替换后的URL: " + newUrl); | ||
| 66 | + return newUrl; | ||
| 67 | + } | ||
| 68 | + | ||
| 40 | 69 | ||
| 41 | } | 70 | } |
| @@ -70,6 +70,8 @@ file: | @@ -70,6 +70,8 @@ file: | ||
| 70 | realPath: /home/wondertek/material_file_assets/dianpian/ | 70 | realPath: /home/wondertek/material_file_assets/dianpian/ |
| 71 | 71 | ||
| 72 | crp: | 72 | crp: |
| 73 | + pIp: 180.167.180.242 | ||
| 74 | + pPort: 42085 | ||
| 73 | user: | 75 | user: |
| 74 | username: admin | 76 | username: admin |
| 75 | password: 123456 | 77 | password: 123456 |
| @@ -70,6 +70,8 @@ file: | @@ -70,6 +70,8 @@ file: | ||
| 70 | realPath: /home/wondertek/material_file_assets/dianpian/ | 70 | realPath: /home/wondertek/material_file_assets/dianpian/ |
| 71 | 71 | ||
| 72 | crp: | 72 | crp: |
| 73 | + pIp: 180.167.180.242 | ||
| 74 | + pPort: 42085 | ||
| 73 | user: | 75 | user: |
| 74 | username: admin | 76 | username: admin |
| 75 | password: 123456 | 77 | password: 123456 |
-
Please register or login to post a comment