Toggle navigation
Toggle navigation
This project
Loading...
Sign in
crp
/
crp-operation
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
zhongdaoyi@wondertek.com.cn
2025-08-05 14:58:02 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e151d8321eafd0a5fe564d7f931f75206429deb5
e151d832
1 parent
d65f8939
审片间ip公网转换
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
4 deletions
src/main/java/com/wondertek/service/impl/LiveMonitorRoomServiceImpl.java
src/main/java/com/wondertek/util/FileUtils.java
src/main/resources/application-dev.yml
src/main/resources/application-test.yml
src/main/java/com/wondertek/service/impl/LiveMonitorRoomServiceImpl.java
View file @
e151d83
...
...
@@ -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
);
}
...
...
src/main/java/com/wondertek/util/FileUtils.java
View file @
e151d83
...
...
@@ -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
;
}
}
...
...
src/main/resources/application-dev.yml
View file @
e151d83
...
...
@@ -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
...
...
src/main/resources/application-test.yml
View file @
e151d83
...
...
@@ -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
...
...
Please
register
or
login
to post a comment