Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
谢明辉
/
fanxing3
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 576de3be
authored
Nov 17, 2021
by
xmh
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
<feat> 分析流播放地址适配ip,去掉配置
<fix> 事件检索重构
1 parent
8bfb5d5e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
171 additions
and
147 deletions
fanxing-commons/src/main/java/com/viontech/fanxing/commons/base/BaseServiceImpl.java
fanxing-commons/src/main/java/com/viontech/fanxing/commons/config/VionConfig.java
fanxing-query/src/main/java/com/viontech/fanxing/query/controller/web/BehaviorController.java
fanxing-query/src/main/java/com/viontech/fanxing/query/controller/web/TrafficController.java
fanxing-query/src/main/java/com/viontech/fanxing/query/service/impl/BehaviorServiceImpl.java
fanxing-task/src/main/java/com/viontech/fanxing/task/service/VAServerService.java
fanxing-task/src/main/resources/application.yml
fanxing-commons/src/main/java/com/viontech/fanxing/commons/base/BaseServiceImpl.java
View file @
576de3b
...
...
@@ -16,143 +16,142 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
public
abstract
class
BaseServiceImpl
<
T
extends
BaseModel
>
implements
BaseService
<
T
>
{
/**
* slf4j 日志对象 用来记录log
*/
protected
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
private
Map
<
String
,
String
>
columnNamePropertyMap
=
null
;
public
T
selectByPrimaryKey
(
Object
id
)
{
return
getMapper
().
selectByPrimaryKey
(
id
);
}
public
T
insert
(
T
record
)
{
getMapper
().
insert
(
record
);
return
record
;
}
@Override
public
T
insertSelective
(
T
record
)
{
getMapper
().
insertSelective
(
record
);
return
record
;
}
@Override
public
int
deleteByPrimaryKey
(
Object
b
)
{
return
getMapper
().
deleteByPrimaryKey
(
b
);
}
@Override
public
int
updateByPrimaryKey
(
T
record
)
{
return
getMapper
().
updateByPrimaryKey
(
record
);
}
@Override
public
int
updateByPrimaryKeySelective
(
T
record
)
{
return
getMapper
().
updateByPrimaryKeySelective
(
record
);
}
@Override
public
PageInfo
<
T
>
pagedQuery
(
BaseExample
example
,
int
pageNum
,
int
pageSize
)
{
if
(
pageSize
>
0
){
PageHelper
.
startPage
(
pageNum
,
pageSize
);
Page
<
T
>
result
=
(
Page
<
T
>)
getMapper
().
selectByExample
(
example
);
PageInfo
<
T
>
pageInfo
=
new
PageInfo
<
T
>(
result
);
return
pageInfo
;
}
else
{
List
<
T
>
result
=
(
List
<
T
>)
getMapper
().
selectByExample
(
example
);
Page
<
T
>
p
=
new
Page
<
T
>();
p
.
addAll
(
result
);
PageInfo
<
T
>
pageInfo
=
new
PageInfo
<
T
>(
p
);
return
pageInfo
;
}
}
@Override
public
int
countByExample
(
BaseExample
example
)
{
return
getMapper
().
countByExample
(
example
);
}
@Override
public
int
deleteByExample
(
BaseExample
example
)
{
return
getMapper
().
deleteByExample
(
example
);
}
@Override
public
List
<
T
>
selectByExample
(
BaseExample
example
)
{
return
getMapper
().
selectByExample
(
example
);
}
@Override
public
int
updateByExampleSelective
(
T
record
,
BaseExample
example
)
{
return
getMapper
().
updateByExampleSelective
(
record
,
example
);
}
@Override
public
int
updateByExample
(
T
record
,
BaseExample
example
)
{
return
getMapper
().
updateByExample
(
record
,
example
);
}
@Override
public
List
<
Object
>
getIdsByByExample
(
BaseExample
example
)
{
List
<
T
>
list
=
selectByExample
(
example
);
List
<
Object
>
result
=
new
ArrayList
<
Object
>();
for
(
T
t
:
list
){
Object
pk
=
getPKByModel
(
t
);
if
(
pk
!=
null
){
result
.
add
(
pk
);
}
}
return
result
;
}
@Override
public
Object
getPKByModel
(
BaseModel
baseModel
)
{
throw
new
UnsupportedOperationException
();
}
public
String
getColumnNameByProperty
(
String
property
){
if
(
columnNamePropertyMap
==
null
){
columnNamePropertyMap
=
getColumnNamePropertyMap
();
}
return
columnNamePropertyMap
.
get
(
property
);
}
public
Map
getColumnNamePropertyMap
(){
Map
<
String
,
String
>
result
=
new
HashMap
<
String
,
String
>();
try
{
SqlSession
sqlSession
=
getSqlSessionByMapper
(
getMapper
());
ResultMap
resultMap
=
sqlSession
.
getConfiguration
().
getResultMap
(
getMapperClassByMapper
(
getMapper
()).
getName
()+
".BaseResultMapRoot"
);
List
<
ResultMapping
>
propertyResultMappings
=
resultMap
.
getPropertyResultMappings
();
for
(
ResultMapping
resultMapping
:
propertyResultMappings
)
{
result
.
put
(
resultMapping
.
getProperty
(),
resultMapping
.
getColumn
());
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
result
;
}
private
SqlSession
getSqlSessionByMapper
(
BaseMapper
mapper
)
throws
Exception
{
Object
mapperProxy
=
((
Proxy
)
mapper
).
getInvocationHandler
(
mapper
);
public
abstract
class
BaseServiceImpl
<
T
extends
BaseModel
>
implements
BaseService
<
T
>
{
/**
* slf4j 日志对象 用来记录log
*/
protected
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
private
Map
<
String
,
String
>
columnNamePropertyMap
=
null
;
public
T
selectByPrimaryKey
(
Object
id
)
{
return
getMapper
().
selectByPrimaryKey
(
id
);
}
public
T
insert
(
T
record
)
{
getMapper
().
insert
(
record
);
return
record
;
}
@Override
public
T
insertSelective
(
T
record
)
{
getMapper
().
insertSelective
(
record
);
return
record
;
}
@Override
public
int
deleteByPrimaryKey
(
Object
b
)
{
return
getMapper
().
deleteByPrimaryKey
(
b
);
}
@Override
public
int
updateByPrimaryKey
(
T
record
)
{
return
getMapper
().
updateByPrimaryKey
(
record
);
}
@Override
public
int
updateByPrimaryKeySelective
(
T
record
)
{
return
getMapper
().
updateByPrimaryKeySelective
(
record
);
}
@Override
public
PageInfo
<
T
>
pagedQuery
(
BaseExample
example
,
int
pageNum
,
int
pageSize
)
{
if
(
pageSize
>
0
)
{
PageHelper
.
startPage
(
pageNum
,
pageSize
);
Page
<
T
>
result
=
(
Page
<
T
>)
getMapper
().
selectByExample
(
example
);
return
new
PageInfo
<
T
>(
result
);
}
else
{
List
<
T
>
result
=
getMapper
().
selectByExample
(
example
);
Page
<
T
>
p
=
new
Page
<
T
>();
p
.
addAll
(
result
);
return
new
PageInfo
<
T
>(
p
);
}
}
@Override
public
int
countByExample
(
BaseExample
example
)
{
return
getMapper
().
countByExample
(
example
);
}
@Override
public
int
deleteByExample
(
BaseExample
example
)
{
return
getMapper
().
deleteByExample
(
example
);
}
@Override
public
List
<
T
>
selectByExample
(
BaseExample
example
)
{
return
getMapper
().
selectByExample
(
example
);
}
@Override
public
int
updateByExampleSelective
(
T
record
,
BaseExample
example
)
{
return
getMapper
().
updateByExampleSelective
(
record
,
example
);
}
@Override
public
int
updateByExample
(
T
record
,
BaseExample
example
)
{
return
getMapper
().
updateByExample
(
record
,
example
);
}
@Override
public
List
<
Object
>
getIdsByByExample
(
BaseExample
example
)
{
List
<
T
>
list
=
selectByExample
(
example
);
List
<
Object
>
result
=
new
ArrayList
<
Object
>();
for
(
T
t
:
list
)
{
Object
pk
=
getPKByModel
(
t
);
if
(
pk
!=
null
)
{
result
.
add
(
pk
);
}
}
return
result
;
}
@Override
public
Object
getPKByModel
(
BaseModel
baseModel
)
{
throw
new
UnsupportedOperationException
();
}
public
String
getColumnNameByProperty
(
String
property
)
{
if
(
columnNamePropertyMap
==
null
)
{
columnNamePropertyMap
=
getColumnNamePropertyMap
();
}
return
columnNamePropertyMap
.
get
(
property
);
}
public
Map
getColumnNamePropertyMap
()
{
Map
<
String
,
String
>
result
=
new
HashMap
<
String
,
String
>();
try
{
SqlSession
sqlSession
=
getSqlSessionByMapper
(
getMapper
());
ResultMap
resultMap
=
sqlSession
.
getConfiguration
().
getResultMap
(
getMapperClassByMapper
(
getMapper
()).
getName
()
+
".BaseResultMapRoot"
);
List
<
ResultMapping
>
propertyResultMappings
=
resultMap
.
getPropertyResultMappings
();
for
(
ResultMapping
resultMapping
:
propertyResultMappings
)
{
result
.
put
(
resultMapping
.
getProperty
(),
resultMapping
.
getColumn
());
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
result
;
}
private
SqlSession
getSqlSessionByMapper
(
BaseMapper
mapper
)
throws
Exception
{
Object
mapperProxy
=
((
Proxy
)
mapper
).
getInvocationHandler
(
mapper
);
Field
sqlSession
=
mapperProxy
.
getClass
().
getDeclaredField
(
"sqlSession"
);
sqlSession
.
setAccessible
(
true
);
return
(
SqlSession
)
sqlSession
.
get
(
mapperProxy
);
return
(
SqlSession
)
sqlSession
.
get
(
mapperProxy
);
}
private
Class
getMapperClassByMapper
(
BaseMapper
mapper
)
throws
Exception
{
Object
mapperProxy
=
((
Proxy
)
mapper
).
getInvocationHandler
(
mapper
);
}
private
Class
getMapperClassByMapper
(
BaseMapper
mapper
)
throws
Exception
{
Object
mapperProxy
=
((
Proxy
)
mapper
).
getInvocationHandler
(
mapper
);
Field
mapperInterface
=
mapperProxy
.
getClass
().
getDeclaredField
(
"mapperInterface"
);
mapperInterface
.
setAccessible
(
true
);
return
(
Class
)
mapperInterface
.
get
(
mapperProxy
);
return
(
Class
)
mapperInterface
.
get
(
mapperProxy
);
}
}
}
fanxing-commons/src/main/java/com/viontech/fanxing/commons/config/VionConfig.java
View file @
576de3b
...
...
@@ -55,21 +55,12 @@ public class VionConfig {
static
class
Srs
{
private
String
ip
;
private
String
rtmpPort
=
"1935"
;
private
String
httpPort
=
"8080"
;
public
String
getRtmpUrl
(
String
taskUnid
)
{
String
url
=
"rtmp://"
+
ip
+
":"
+
rtmpPort
+
"/live/"
+
taskUnid
;
log
.
debug
(
url
);
return
url
;
}
public
String
getHttpUrl
(
String
taskUnid
)
{
// todo
String
url
=
"http://36.112.68.214:30010/srs/live/"
+
taskUnid
+
".flv"
;
// String url = "http://" + ip + ":" + httpPort + "/srs/live/" + taskUnid + ".flv";
log
.
debug
(
url
);
return
url
;
}
}
public
@Getter
...
...
fanxing-query/src/main/java/com/viontech/fanxing/query/controller/web/BehaviorController.java
View file @
576de3b
...
...
@@ -11,9 +11,16 @@ import com.viontech.fanxing.query.controller.base.BehaviorBaseController;
import
com.viontech.fanxing.query.service.main.OpsClientService
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.util.Assert
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.context.request.RequestAttributes
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
@Controller
@RequestMapping
(
"/behaviors"
)
...
...
@@ -25,11 +32,12 @@ public class BehaviorController extends BehaviorBaseController {
@Override
protected
BaseExample
getExample
(
BehaviorVo
behaviorVo
,
int
type
)
{
BehaviorExample
behaviorExample
=
(
BehaviorExample
)
super
.
getExample
(
behaviorVo
,
type
);
behaviorExample
.
createColumns
().
hasIdColumn
().
hasEventTimeColumn
().
hasPicsColumn
();
return
behaviorExample
;
}
@Override
public
Object
page
(
BehaviorVo
behaviorVo
,
int
page
,
int
pageSize
,
String
sortName
,
String
sortOrder
)
{
public
Object
page
(
BehaviorVo
behaviorVo
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"-1"
)
int
page
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"100"
)
int
pageSize
,
String
sortName
,
String
sortOrder
)
{
Assert
.
notNull
(
behaviorVo
.
getEventTime_gte
(),
"起始时间不能为空"
);
Assert
.
notNull
(
behaviorVo
.
getEventTime_lte
(),
"结束时间不能为空"
);
SimplePropertyPreFilter
simplePropertyPreFilter
=
new
SimplePropertyPreFilter
();
...
...
fanxing-query/src/main/java/com/viontech/fanxing/query/controller/web/TrafficController.java
View file @
576de3b
...
...
@@ -32,7 +32,7 @@ public class TrafficController extends TrafficBaseController {
@Override
protected
BaseExample
getExample
(
TrafficVo
trafficVo
,
int
type
)
{
TrafficExample
trafficExample
=
(
TrafficExample
)
super
.
getExample
(
trafficVo
,
type
);
trafficExample
.
createColumns
().
hasIdColumn
().
hasEventTimeColumn
();
trafficExample
.
createColumns
().
hasIdColumn
().
hasEventTimeColumn
()
.
hasVideoNameColumn
().
hasPicsColumn
()
;
return
trafficExample
;
}
...
...
fanxing-query/src/main/java/com/viontech/fanxing/query/service/impl/BehaviorServiceImpl.java
View file @
576de3b
package
com
.
viontech
.
fanxing
.
query
.
service
.
impl
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.viontech.fanxing.commons.base.BaseExample
;
import
com.viontech.fanxing.commons.base.BaseMapper
;
import
com.viontech.fanxing.commons.base.BaseServiceImpl
;
import
com.viontech.fanxing.query.mapper.BehaviorMapper
;
import
com.viontech.fanxing.commons.model.Behavior
;
import
com.viontech.fanxing.commons.model.BehaviorExample
;
import
com.viontech.fanxing.query.mapper.BehaviorMapper
;
import
com.viontech.fanxing.query.service.adapter.BehaviorService
;
import
javax.annotation.Resource
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
@Service
public
class
BehaviorServiceImpl
extends
BaseServiceImpl
<
Behavior
>
implements
BehaviorService
{
@Resource
...
...
@@ -17,4 +24,24 @@ public class BehaviorServiceImpl extends BaseServiceImpl<Behavior> implements Be
public
BaseMapper
<
Behavior
>
getMapper
()
{
return
behaviorMapper
;
}
@Override
public
PageInfo
<
Behavior
>
pagedQuery
(
BaseExample
example
,
int
pageNum
,
int
pageSize
)
{
if
(
pageSize
>
0
)
{
PageHelper
.
startPage
(
pageNum
,
pageSize
);
Page
<
Behavior
>
result
=
(
Page
<
Behavior
>)
behaviorMapper
.
selectByExampleWithBLOBs
((
BehaviorExample
)
example
);
return
new
PageInfo
<>(
result
);
}
else
{
List
<
Behavior
>
result
=
behaviorMapper
.
selectByExampleWithBLOBs
((
BehaviorExample
)
example
);
Page
<
Behavior
>
p
=
new
Page
<>();
p
.
addAll
(
result
);
return
new
PageInfo
<>(
p
);
}
}
@Override
public
List
<
Behavior
>
selectByExample
(
BaseExample
example
)
{
return
behaviorMapper
.
selectByExampleWithBLOBs
(((
BehaviorExample
)
example
));
}
}
\ No newline at end of file
fanxing-task/src/main/java/com/viontech/fanxing/task/service/VAServerService.java
View file @
576de3b
...
...
@@ -183,7 +183,7 @@ public class VAServerService {
throw
new
FanXingException
(
"设备离线"
);
}
String
rtmpUrl
=
vionConfig
.
getSrs
().
getRtmpUrl
(
taskUnid
);
String
httpUrl
=
vionConfig
.
getSrs
().
getHttpUrl
(
taskUnid
)
;
String
httpUrl
=
"/srs/live/"
+
taskUnid
+
".flv"
;
vaServerHttpService
.
startAnalyzeStream
(
taskUnid
,
vaServerInfo
,
rtmpUrl
);
return
httpUrl
;
}
else
{
...
...
fanxing-task/src/main/resources/application.yml
View file @
576de3b
...
...
@@ -57,5 +57,4 @@ vion:
srs
:
ip
:
192.168.9.233
rtmp-port
:
1935
http-port
:
30010
receive-result-prefix-path
:
http://192.168.9.116:30010/api
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment