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
fd812606
Commit
fd812606
authored
May 31, 2024
by
kinky2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加气瓶单位视频接口
parent
a6335c89
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
257 additions
and
2 deletions
+257
-2
CylinderUnitVideoDto.java
...oot/module/cylinder/flc/api/dto/CylinderUnitVideoDto.java
+51
-0
CylinderUnitVideo.java
...oot/module/cylinder/flc/api/entity/CylinderUnitVideo.java
+68
-0
CylinderUnitVideoMapper.java
...dule/cylinder/flc/api/mapper/CylinderUnitVideoMapper.java
+16
-0
ICylinderUnitVideoService.java
...e/cylinder/flc/api/service/ICylinderUnitVideoService.java
+15
-0
CylinderUnitController.java
...e/cylinder/flc/biz/controller/CylinderUnitController.java
+9
-2
CylinderUnitVideoServiceImpl.java
...er/flc/biz/service/impl/CylinderUnitVideoServiceImpl.java
+98
-0
No files found.
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/api/dto/CylinderUnitVideoDto.java
0 → 100644
View file @
fd812606
package
com
.
yeejoin
.
amos
.
boot
.
module
.
cylinder
.
flc
.
api
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"CylinderUnitVideoDto"
,
description
=
"气瓶企业视频信息"
)
public
class
CylinderUnitVideoDto
extends
BaseDto
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
/**
*获取token地址
*/
private
String
tokenUrl
;
/**
*获取播放地址
*/
private
String
url
;
/**
*appkey
*/
private
String
appKey
;
/**
*appsecret
*/
private
String
appSecret
;
/**
*设备序列号
*/
private
String
deviceSerial
;
/**
*流播放协议,1-ezopen、2-hls、3-rtmp、4-flv,默认为1
*/
private
String
protocol
;
/**
* 通道号
*/
private
String
channelNo
;
/**
* 过期时长,单位秒;针对hls/rtmp/flv设置有效期,相对时间;30秒-720天
*/
private
Long
expireTime
;
/**
* 单位ID
*/
private
Long
unitSeq
;
}
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/api/entity/CylinderUnitVideo.java
0 → 100644
View file @
fd812606
package
com
.
yeejoin
.
amos
.
boot
.
module
.
cylinder
.
flc
.
api
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
/**
* 气瓶企业视频信息
* @author kinky
*
*/
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
@Accessors
(
chain
=
true
)
@TableName
(
"tz_cylinder_unit_video"
)
public
class
CylinderUnitVideo
extends
BaseEntity
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
/**
*获取token地址
*/
@TableField
(
"token_url"
)
private
String
tokenUrl
;
/**
*获取播放地址
*/
@TableField
(
"url"
)
private
String
url
;
/**
*appkey
*/
@TableField
(
"app_key"
)
private
String
appKey
;
/**
*appsecret
*/
@TableField
(
"app_secret"
)
private
String
appSecret
;
/**
*设备序列号
*/
@TableField
(
"device_serial"
)
private
String
deviceSerial
;
/**
*流播放协议,1-ezopen、2-hls、3-rtmp、4-flv,默认为1
*/
@TableField
(
"protocol"
)
private
String
protocol
;
/**
* 通道号
*/
@TableField
(
"channel_no"
)
private
String
channelNo
;
/**
* 过期时长,单位秒;针对hls/rtmp/flv设置有效期,相对时间;30秒-720天
*/
@TableField
(
"expire_time"
)
private
Long
expireTime
;
/**
* 单位ID
*/
@TableField
(
"unit_seq"
)
private
Long
unitSeq
;
}
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/api/mapper/CylinderUnitVideoMapper.java
0 → 100644
View file @
fd812606
package
com
.
yeejoin
.
amos
.
boot
.
module
.
cylinder
.
flc
.
api
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderUnitVideo
;
import
java.util.List
;
/**
* 气瓶企业视频信息 Mapper 接口
*
* @author system_generator
* @date 2021-12-14
*/
public
interface
CylinderUnitVideoMapper
extends
BaseMapper
<
CylinderUnitVideo
>
{
}
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/api/service/ICylinderUnitVideoService.java
0 → 100644
View file @
fd812606
package
com
.
yeejoin
.
amos
.
boot
.
module
.
cylinder
.
flc
.
api
.
service
;
import
java.util.List
;
/**
* 气瓶企业视频信息接口类
*
* @author system_generator
* @date 2021-12-14
*/
public
interface
ICylinderUnitVideoService
{
List
<
String
>
getUnitVideoUrl
(
Long
unitSeq
);
}
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/biz/controller/CylinderUnitController.java
View file @
fd812606
...
@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
...
@@ -6,6 +6,7 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderUnitDto
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderUnitDto
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderUnit
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderUnit
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.service.ICylinderInfoService
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.service.ICylinderInfoService
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.service.ICylinderUnitVideoService
;
import
com.yeejoin.amos.boot.module.cylinder.flc.biz.service.impl.CylinderUnitServiceImpl
;
import
com.yeejoin.amos.boot.module.cylinder.flc.biz.service.impl.CylinderUnitServiceImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -41,7 +42,8 @@ public class CylinderUnitController extends BaseController {
...
@@ -41,7 +42,8 @@ public class CylinderUnitController extends BaseController {
@Autowired
@Autowired
ICylinderInfoService
iCylinderInfoService
;
ICylinderInfoService
iCylinderInfoService
;
@Autowired
ICylinderUnitVideoService
icylinderUnitVideoService
;
/**
/**
...
@@ -123,5 +125,10 @@ public class CylinderUnitController extends BaseController {
...
@@ -123,5 +125,10 @@ public class CylinderUnitController extends BaseController {
page
.
setSize
(
size
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(
cylinderUnitServiceImpl
.
queryForCylinderUnitPage
(
page
));
return
ResponseHelper
.
buildResponse
(
cylinderUnitServiceImpl
.
queryForCylinderUnitPage
(
page
));
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/getUnitVideoUrl"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据气瓶企业seq查询视频链接"
,
notes
=
"根据气瓶企业seq查询视频链接"
)
public
ResponseModel
<
List
<
String
>>
getUnitVideoUrl
(
@RequestParam
Long
unitSeq
)
{
return
ResponseHelper
.
buildResponse
(
icylinderUnitVideoService
.
getUnitVideoUrl
(
unitSeq
));
}
}
}
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
0 → 100644
View file @
fd812606
package
com
.
yeejoin
.
amos
.
boot
.
module
.
cylinder
.
flc
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderUnitVideoDto
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderUnitVideo
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.mapper.CylinderUnitVideoMapper
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.service.ICylinderUnitVideoService
;
import
cn.hutool.http.HttpUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
/**
* 气瓶企业信息服务实现类
*
* @author system_generator
* @date 2021-12-14
*/
@Service
public
class
CylinderUnitVideoServiceImpl
extends
BaseService
<
CylinderUnitVideoDto
,
CylinderUnitVideo
,
CylinderUnitVideoMapper
>
implements
ICylinderUnitVideoService
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
CylinderUnitVideoServiceImpl
.
class
);
private
static
final
String
CODE_200
=
"200"
;
private
static
final
String
CODE_10001
=
"10001"
;
private
static
final
String
CODE_10005
=
"10005"
;
private
static
final
String
CODE_10017
=
"10017"
;
private
static
final
String
CODE_10030
=
"10030"
;
private
static
final
String
CODE_49999
=
"49999"
;
private
static
final
String
CODE_201
=
"201"
;
private
static
final
String
CODE_401
=
"401"
;
private
static
final
String
CODE_403
=
"403"
;
private
static
final
String
CODE_404
=
"404"
;
private
static
final
String
CODE_20001
=
"20001"
;
@Override
public
List
<
String
>
getUnitVideoUrl
(
Long
unitSeq
)
{
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
);
}
}
}
}
catch
(
Exception
e
){
logger
.
error
(
e
.
getMessage
());
e
.
printStackTrace
();
}
return
result
;
}
}
\ No newline at end of file
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