Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hzjtpushdateService
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
建金
hzjtpushdateService
Commits
0f7cd3fd
Commit
0f7cd3fd
authored
Dec 28, 2020
by
高飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改调用服务为传递rtsp 解析为flv
parent
b04165ba
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
24 deletions
+22
-24
src/main/java/com/hzjt/controller/TraffController.java
src/main/java/com/hzjt/controller/TraffController.java
+7
-14
src/main/java/com/hzjt/handler/FileTransferManager.java
src/main/java/com/hzjt/handler/FileTransferManager.java
+1
-1
src/main/java/com/hzjt/listener/MyApplicationStartingEventListener.java
...com/hzjt/listener/MyApplicationStartingEventListener.java
+0
-1
src/main/java/com/hzjt/service/FLVCacheService.java
src/main/java/com/hzjt/service/FLVCacheService.java
+14
-8
No files found.
src/main/java/com/hzjt/controller/TraffController.java
View file @
0f7cd3fd
...
...
@@ -338,25 +338,18 @@ public void sendevent( Alarm trffClientMessage){
//huode resid 中值、
if
(
null
!=
rtsp
)
{
if
(
null
==
stringRedisTemplate
.
opsForValue
().
get
(
resisvalue
))
if
(
null
==
stringRedisTemplate
.
opsForValue
().
get
(
videoid
))
{
log
.
info
(
"flv-----"
);
flvCacheService
.
getvalue
();
flvCacheService
.
getvalue
(
videoid
,
rtsp
);
}
log
.
info
(
stringRedisTemplate
.
opsForValue
().
get
(
videoid
));
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
stringRedisTemplate
.
opsForValue
().
get
(
videoid
));
JSONArray
jsonArr
=
JSONObject
.
parseArray
(
stringRedisTemplate
.
opsForValue
().
get
(
resisvalue
));
log
.
info
(
"jsonArr"
+
jsonArr
.
size
());
for
(
int
i
=
0
;
i
<
jsonArr
.
size
();
i
++)
{
JSONObject
jsonObject
=
jsonArr
.
getJSONObject
(
i
);
if
(
jsonObject
.
getString
(
"source"
).
equalsIgnoreCase
(
rtsp
))
{
if
(
null
!=
jsonObject
.
getJSONArray
(
"play_uris"
)
&&
jsonObject
.
getJSONArray
(
"play_uris"
).
size
()
>
3
)
{
return
String
.
valueOf
(
jsonObject
.
getJSONArray
(
"play_uris"
).
get
(
2
));
}
}
if
(
null
!=
jsonObject
.
getJSONArray
(
"play_list"
)
&&
jsonObject
.
getJSONArray
(
"play_list"
).
size
()
>
0
)
{
return
String
.
valueOf
(
jsonObject
.
getJSONArray
(
"play_list"
).
get
(
0
));
}
}
return
""
;
...
...
src/main/java/com/hzjt/handler/FileTransferManager.java
View file @
0f7cd3fd
...
...
@@ -51,7 +51,7 @@ public class FileTransferManager {
/// System.out.println("connection.getResponseCode:" + connection.getResponseCode() );
if
(
connection
.
getResponseCode
()
==
HttpURLConnection
.
HTTP_OK
)
{
InputStream
inputStream
=
connection
.
getInputStream
();
log
.
info
(
"url:"
,
url
,
" --- "
+
"key:"
,
key
);
log
.
info
(
"url:"
+
url
+
" ---key:"
+
key
);
String
pname
=
DateUtils
.
formatCurrDayNoSign
()
+
"_"
+
recordid
+
"_0000_"
+
key
.
replace
(
"path"
,
""
);
String
fileName
=
pname
+
filesuff
;
String
ftputl
=
FTPUtil
.
getFtpUrl
(
ftp
)
+
basePath
+
"/"
+
fileName
;
...
...
src/main/java/com/hzjt/listener/MyApplicationStartingEventListener.java
View file @
0f7cd3fd
...
...
@@ -18,7 +18,6 @@ import org.springframework.stereotype.Component;
import
java.util.concurrent.TimeUnit
;
@Slf4j
@Component
public
class
MyApplicationStartingEventListener
implements
ApplicationListener
<
SpringApplicationEvent
>,
ApplicationContextAware
{
private
ApplicationContext
applicationContext
;
...
...
src/main/java/com/hzjt/service/FLVCacheService.java
View file @
0f7cd3fd
package
com
.
hzjt
.
service
;
import
com.hzjt.domain.ResultObj
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.http.*
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.client.RestTemplate
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -24,18 +28,20 @@ public class FLVCacheService {
@Value
(
"${flv.url}"
)
private
String
url
;
public
void
getvalue
()
{
public
void
getvalue
(
String
videoid
,
String
rtsp
)
{
try
{
HttpHeaders
headers
=
getHttpHeaders
();
HttpEntity
<
String
>
requestEntity
=
new
HttpEntity
<>(
null
,
headers
);
HttpHeaders
headers
=
new
HttpHeaders
();
RestTemplate
client
=
new
RestTemplate
();
ResponseEntity
<
String
>
request
=
client
.
exchange
((
url
),
HttpMethod
.
GET
,
requestEntity
,
String
.
class
);
String
jsonString
=
"{\"video_id\":\""
+
videoid
+
"\",\"url\":\""
+
rtsp
+
"\"}"
;
log
.
info
(
"jsonString"
+
jsonString
);
headers
.
setContentType
(
MediaType
.
valueOf
(
"application/json;UTF-8"
));
HttpEntity
<
String
>
strEntity
=
new
HttpEntity
<>(
jsonString
,
headers
);
ResponseEntity
<
String
>
response
=
client
.
postForEntity
(
url
,
strEntity
,
String
.
class
);
//解析返回结果
if
(
re
quest
.
getBody
()
!=
null
)
{
log
.
info
(
"response"
+
response
.
getBody
());
if
(
re
sponse
.
getBody
()
!=
null
)
{
log
.
info
(
"flv response success"
);
stringRedisTemplate
.
opsForValue
().
set
(
resisvalue
,
request
.
getBody
(),
32
,
TimeUnit
.
MINUTES
);
stringRedisTemplate
.
opsForValue
().
set
(
videoid
,
response
.
getBody
(),
10
,
TimeUnit
.
MINUTES
);
}
else
{
log
.
error
(
"flv response "
+
"empty..."
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment