Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
项目统一框架
amos-boot-biz
Commits
aae26323
Commit
aae26323
authored
May 31, 2024
by
刘凡
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register
parents
98220b51
e72fcf0c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
44 deletions
+47
-44
CylinderUnitVideoServiceImpl.java
...er/flc/biz/service/impl/CylinderUnitVideoServiceImpl.java
+47
-44
No files found.
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/biz/service/impl/CylinderUnitVideoServiceImpl.java
View file @
aae26323
...
...
@@ -41,56 +41,59 @@ public class CylinderUnitVideoServiceImpl extends BaseService<CylinderUnitVideoD
private
static
final
String
CODE_20001
=
"20001"
;
@Override
public
List
<
String
>
getUnitVideoUrl
(
Long
unitSeq
)
{
List
<
String
>
result
=
new
ArrayList
<
String
>();
LambdaQueryWrapper
<
CylinderUnitVideo
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
CylinderUnitVideo:
:
getUnitSeq
,
unitSeq
);
CylinderUnitVideo
cylinderUnitVideo
=
this
.
getBaseMapper
().
selectOne
(
wrapper
);
HashMap
<
String
,
Object
>
requestInfo
=
new
HashMap
<>();
requestInfo
.
put
(
"appKey"
,
cylinderUnitVideo
.
getAppKey
());
requestInfo
.
put
(
"appSecret"
,
cylinderUnitVideo
.
getAppSecret
());
List
<
String
>
result
=
new
ArrayList
<
String
>();
try
{
String
accessTokenData
=
HttpUtil
.
post
(
cylinderUnitVideo
.
getTokenUrl
(),
requestInfo
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
accessTokenData
);
String
msg
=
jsonObject
.
get
(
"msg"
).
toString
();
String
code
=
jsonObject
.
get
(
"code"
).
toString
();
if
(
CODE_10001
.
equals
(
code
)
||
CODE_10005
.
equals
(
code
)
||
CODE_10017
.
equals
(
code
)
||
CODE_10030
.
equals
(
code
)
||
CODE_49999
.
equals
(
code
)){
String
errorMsg
=
"code:"
+
code
+
"msg:"
+
msg
+
"appKey:"
+
cylinderUnitVideo
.
getAppKey
()+
"appSecret:"
+
cylinderUnitVideo
.
getAppSecret
();
logger
.
info
(
"视频token获取失败errorMsg"
,
errorMsg
);
return
result
;
}
if
(
CODE_200
.
equals
(
code
)){
String
data
=
jsonObject
.
get
(
"data"
).
toString
();
JSONObject
objTokenJson
=
JSON
.
parseObject
(
data
);
String
accessToken
=
objTokenJson
.
get
(
"accessToken"
).
toString
();
System
.
out
.
println
(
accessToken
);
String
channelNos
=
cylinderUnitVideo
.
getChannelNo
();
List
<
String
>
channelNoList
=
Arrays
.
asList
(
channelNos
.
split
(
","
));
for
(
String
channelNo
:
channelNoList
)
{
HashMap
<
String
,
Object
>
requestVideosInfo
=
new
HashMap
<>();
requestVideosInfo
.
put
(
"accessToken"
,
accessToken
);
requestVideosInfo
.
put
(
"deviceSerial"
,
cylinderUnitVideo
.
getDeviceSerial
());
requestVideosInfo
.
put
(
"channelNo"
,
channelNo
);
requestVideosInfo
.
put
(
"protocol"
,
cylinderUnitVideo
.
getProtocol
());
requestVideosInfo
.
put
(
"expireTime"
,
cylinderUnitVideo
.
getExpireTime
());
String
videoData
=
HttpUtil
.
post
(
cylinderUnitVideo
.
getUrl
(),
requestVideosInfo
);
JSONObject
videoJsonObject
=
JSON
.
parseObject
(
videoData
);
String
msgVideo
=
videoJsonObject
.
get
(
"msg"
).
toString
();
String
codeVideo
=
videoJsonObject
.
get
(
"code"
).
toString
();
if
(
CODE_201
.
equals
(
codeVideo
)
||
CODE_401
.
equals
(
codeVideo
)
||
CODE_403
.
equals
(
codeVideo
)
||
CODE_404
.
equals
(
codeVideo
)
||
CODE_20001
.
equals
(
codeVideo
)){
String
errorMsg
=
"code:"
+
codeVideo
+
"msg:"
+
msgVideo
+
"appKey:"
+
cylinderUnitVideo
.
getAppKey
()+
"appSecret:"
+
cylinderUnitVideo
.
getAppSecret
()+
"accessToken:"
+
accessToken
;
logger
.
info
(
"视频地址获取失败errorMsg"
,
errorMsg
);
}
if
(
CODE_200
.
equals
(
codeVideo
)){
String
dataS
=
videoJsonObject
.
get
(
"data"
).
toString
();
JSONObject
dd
=
JSON
.
parseObject
(
dataS
);
String
url
=
dd
.
get
(
"url"
).
toString
();
result
.
add
(
url
);
if
(
null
!=
cylinderUnitVideo
){
HashMap
<
String
,
Object
>
requestInfo
=
new
HashMap
<>();
requestInfo
.
put
(
"appKey"
,
cylinderUnitVideo
.
getAppKey
());
requestInfo
.
put
(
"appSecret"
,
cylinderUnitVideo
.
getAppSecret
());
try
{
String
accessTokenData
=
HttpUtil
.
post
(
cylinderUnitVideo
.
getTokenUrl
(),
requestInfo
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
accessTokenData
);
String
msg
=
jsonObject
.
get
(
"msg"
).
toString
();
String
code
=
jsonObject
.
get
(
"code"
).
toString
();
if
(
CODE_10001
.
equals
(
code
)
||
CODE_10005
.
equals
(
code
)
||
CODE_10017
.
equals
(
code
)
||
CODE_10030
.
equals
(
code
)
||
CODE_49999
.
equals
(
code
)){
String
errorMsg
=
"code:"
+
code
+
"msg:"
+
msg
+
"appKey:"
+
cylinderUnitVideo
.
getAppKey
()+
"appSecret:"
+
cylinderUnitVideo
.
getAppSecret
();
logger
.
info
(
"视频token获取失败errorMsg"
,
errorMsg
);
return
result
;
}
if
(
CODE_200
.
equals
(
code
)){
String
data
=
jsonObject
.
get
(
"data"
).
toString
();
JSONObject
objTokenJson
=
JSON
.
parseObject
(
data
);
String
accessToken
=
objTokenJson
.
get
(
"accessToken"
).
toString
();
System
.
out
.
println
(
accessToken
);
String
channelNos
=
cylinderUnitVideo
.
getChannelNo
();
List
<
String
>
channelNoList
=
Arrays
.
asList
(
channelNos
.
split
(
","
));
for
(
String
channelNo
:
channelNoList
)
{
HashMap
<
String
,
Object
>
requestVideosInfo
=
new
HashMap
<>();
requestVideosInfo
.
put
(
"accessToken"
,
accessToken
);
requestVideosInfo
.
put
(
"deviceSerial"
,
cylinderUnitVideo
.
getDeviceSerial
());
requestVideosInfo
.
put
(
"channelNo"
,
channelNo
);
requestVideosInfo
.
put
(
"protocol"
,
cylinderUnitVideo
.
getProtocol
());
requestVideosInfo
.
put
(
"expireTime"
,
cylinderUnitVideo
.
getExpireTime
());
String
videoData
=
HttpUtil
.
post
(
cylinderUnitVideo
.
getUrl
(),
requestVideosInfo
);
JSONObject
videoJsonObject
=
JSON
.
parseObject
(
videoData
);
String
msgVideo
=
videoJsonObject
.
get
(
"msg"
).
toString
();
String
codeVideo
=
videoJsonObject
.
get
(
"code"
).
toString
();
if
(
CODE_201
.
equals
(
codeVideo
)
||
CODE_401
.
equals
(
codeVideo
)
||
CODE_403
.
equals
(
codeVideo
)
||
CODE_404
.
equals
(
codeVideo
)
||
CODE_20001
.
equals
(
codeVideo
)){
String
errorMsg
=
"code:"
+
codeVideo
+
"msg:"
+
msgVideo
+
"appKey:"
+
cylinderUnitVideo
.
getAppKey
()+
"appSecret:"
+
cylinderUnitVideo
.
getAppSecret
()+
"accessToken:"
+
accessToken
;
logger
.
info
(
"视频地址获取失败errorMsg"
,
errorMsg
);
}
if
(
CODE_200
.
equals
(
codeVideo
)){
String
dataS
=
videoJsonObject
.
get
(
"data"
).
toString
();
JSONObject
dd
=
JSON
.
parseObject
(
dataS
);
String
url
=
dd
.
get
(
"url"
).
toString
();
result
.
add
(
url
);
}
}
}
}
catch
(
Exception
e
){
logger
.
error
(
e
.
getMessage
());
e
.
printStackTrace
();
}
}
catch
(
Exception
e
){
logger
.
error
(
e
.
getMessage
());
e
.
printStackTrace
();
}
return
result
;
}
...
...
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