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 713483d7
authored
Nov 18, 2021
by
xmh
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
<feat> 设备注册添加算法版本和软件版本
<feat> 数据检索接口重新组织数据 <feat> 过车数据解析字段 special_type
1 parent
576de3be
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
90 additions
and
38 deletions
fanxing-commons/src/main/java/com/viontech/fanxing/commons/vo/BehaviorVo.java
fanxing-commons/src/main/java/com/viontech/fanxing/commons/vo/TrafficVo.java
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/processor/TrafficProcessor.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/adapter/BehaviorService.java
fanxing-query/src/main/java/com/viontech/fanxing/query/service/adapter/TrafficService.java
fanxing-query/src/main/java/com/viontech/fanxing/query/service/impl/BehaviorServiceImpl.java
fanxing-query/src/main/java/com/viontech/fanxing/query/service/impl/TrafficServiceImpl.java
fanxing-task/src/main/java/com/viontech/fanxing/task/model/vaserver/VaServerInfo.java
fanxing-commons/src/main/java/com/viontech/fanxing/commons/vo/BehaviorVo.java
View file @
713483d
package
com
.
viontech
.
fanxing
.
commons
.
vo
;
import
com.alibaba.fastjson.JSONObject
;
import
com.viontech.fanxing.commons.model.Behavior
;
import
com.viontech.fanxing.commons.vobase.BehaviorVoBase
;
public
class
BehaviorVo
extends
BehaviorVoBase
{
private
JSONObject
data
;
public
BehaviorVo
()
{
super
();
}
...
...
@@ -12,4 +15,13 @@ public class BehaviorVo extends BehaviorVoBase {
public
BehaviorVo
(
Behavior
behavior
)
{
super
(
behavior
);
}
public
JSONObject
getData
()
{
return
data
;
}
public
BehaviorVo
setData
(
JSONObject
data
)
{
this
.
data
=
data
;
return
this
;
}
}
\ No newline at end of file
fanxing-commons/src/main/java/com/viontech/fanxing/commons/vo/TrafficVo.java
View file @
713483d
package
com
.
viontech
.
fanxing
.
commons
.
vo
;
import
com.alibaba.fastjson.JSONObject
;
import
com.viontech.fanxing.commons.model.Traffic
;
import
com.viontech.fanxing.commons.vobase.TrafficVoBase
;
public
class
TrafficVo
extends
TrafficVoBase
{
private
JSONObject
data
;
public
TrafficVo
()
{
super
();
}
...
...
@@ -12,4 +15,13 @@ public class TrafficVo extends TrafficVoBase {
public
TrafficVo
(
Traffic
traffic
)
{
super
(
traffic
);
}
public
JSONObject
getData
()
{
return
data
;
}
public
TrafficVo
setData
(
JSONObject
data
)
{
this
.
data
=
data
;
return
this
;
}
}
\ No newline at end of file
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/processor/TrafficProcessor.java
View file @
713483d
...
...
@@ -108,6 +108,8 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten
JSONObject
bodyType
=
body
.
getJSONObject
(
"type"
);
if
(
bodyType
!=
null
)
{
String
vehicleType
=
bodyType
.
getString
(
"code"
);
Long
specialType
=
bodyType
.
getLong
(
"special_type"
);
traffic
.
setSpecialType
(
String
.
valueOf
(
specialType
));
traffic
.
setVehicleType
(
vehicleType
);
}
JSONObject
bodyColor
=
body
.
getJSONObject
(
"color"
);
...
...
fanxing-query/src/main/java/com/viontech/fanxing/query/controller/web/BehaviorController.java
View file @
713483d
...
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.serializer.SerializeConfig
;
import
com.alibaba.fastjson.serializer.SerializeFilter
;
import
com.alibaba.fastjson.serializer.SimplePropertyPreFilter
;
import
com.github.pagehelper.PageInfo
;
import
com.viontech.fanxing.commons.base.BaseExample
;
import
com.viontech.fanxing.commons.model.BehaviorExample
;
import
com.viontech.fanxing.commons.vo.BehaviorVo
;
...
...
@@ -11,16 +12,12 @@ 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
;
import
static
com
.
viontech
.
keliu
.
util
.
JsonMessageUtil
.
getSuccessJsonMsg
;
@Controller
@RequestMapping
(
"/behaviors"
)
...
...
@@ -44,6 +41,13 @@ public class BehaviorController extends BehaviorBaseController {
simplePropertyPreFilter
.
getExcludes
().
add
(
"model"
);
opsClientService
.
addLog
(
"检索分析结果,条件:"
+
JSON
.
toJSONString
(
behaviorVo
,
SerializeConfig
.
globalInstance
,
new
SerializeFilter
[]{
simplePropertyPreFilter
},
"yyyy-MM-dd HH:mm:ss"
,
JSON
.
DEFAULT_GENERATE_FEATURE
));
return
super
.
page
(
behaviorVo
,
page
,
pageSize
,
sortName
,
sortOrder
);
BaseExample
baseExample
=
getExample
(
behaviorVo
,
EXAMPLE_TYPE_PAGE
);
if
(
isNotNull
(
sortOrder
)
&&
isNotNull
(
sortName
))
{
baseExample
.
setOrderByClause
(
baseExample
.
getTableAlias
()
+
"."
+
sortName
+
" "
+
sortOrder
);
}
else
if
(
isNotNull
(
sortName
)
&&
!
isNotNull
(
sortOrder
))
{
baseExample
.
setOrderByClause
(
sortName
);
}
PageInfo
<
BehaviorVo
>
pageInfo
=
behaviorService
.
getJsonData
(
baseExample
,
page
,
pageSize
);
return
getSuccessJsonMsg
(
MESSAGE_PAGE_SUCCESS
,
pageInfo
);
}
}
\ No newline at end of file
fanxing-query/src/main/java/com/viontech/fanxing/query/controller/web/TrafficController.java
View file @
713483d
...
...
@@ -18,7 +18,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
static
com
.
viontech
.
keliu
.
util
.
JsonMessageUtil
.
getSuccessJsonMsg
;
...
...
@@ -39,10 +38,13 @@ public class TrafficController extends TrafficBaseController {
@Override
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
page
(
TrafficVo
trafficVo
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"
-
1"
)
int
page
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"30"
)
int
pageSize
,
String
sortName
,
String
sortOrder
)
{
public
Object
page
(
TrafficVo
trafficVo
,
@RequestParam
(
value
=
"page"
,
defaultValue
=
"1"
)
int
page
,
@RequestParam
(
value
=
"pageSize"
,
defaultValue
=
"30"
)
int
pageSize
,
String
sortName
,
String
sortOrder
)
{
Assert
.
hasLength
(
trafficVo
.
getEventType
(),
"数据类型不能为空"
);
Assert
.
notNull
(
trafficVo
.
getEventTime_gte
(),
"起始时间不能为空"
);
Assert
.
notNull
(
trafficVo
.
getEventTime_lte
(),
"结束时间不能为空"
);
Assert
.
isTrue
(
pageSize
>
0
,
"页面大小不正确"
);
Assert
.
isTrue
(
page
>
0
,
"页面参数不正确"
);
SimplePropertyPreFilter
simplePropertyPreFilter
=
new
SimplePropertyPreFilter
();
simplePropertyPreFilter
.
getExcludes
().
add
(
"model"
);
opsClientService
.
addLog
(
"检索分析结果,条件:"
+
JSON
.
toJSONString
(
trafficVo
,
SerializeConfig
.
globalInstance
,
new
SerializeFilter
[]{
simplePropertyPreFilter
},
"yyyy-MM-dd HH:mm:ss"
,
JSON
.
DEFAULT_GENERATE_FEATURE
));
...
...
@@ -53,12 +55,7 @@ public class TrafficController extends TrafficBaseController {
}
else
if
(
isNotNull
(
sortName
)
&&
!
isNotNull
(
sortOrder
))
{
baseExample
.
setOrderByClause
(
sortName
);
}
if
(
page
<=
0
)
{
List
result
=
getService
().
selectByExample
(
baseExample
);
return
getSuccessJsonMsg
(
MESSAGE_SELECT_SUCCESS
,
result
);
}
else
{
PageInfo
pageInfo
=
getService
().
pagedQuery
(
baseExample
,
page
,
pageSize
);
return
getSuccessJsonMsg
(
MESSAGE_PAGE_SUCCESS
,
pageInfo
);
}
PageInfo
<
TrafficVo
>
pageInfo
=
trafficService
.
getJsonData
(
baseExample
,
page
,
pageSize
);
return
getSuccessJsonMsg
(
MESSAGE_PAGE_SUCCESS
,
pageInfo
);
}
}
\ No newline at end of file
fanxing-query/src/main/java/com/viontech/fanxing/query/service/adapter/BehaviorService.java
View file @
713483d
package
com
.
viontech
.
fanxing
.
query
.
service
.
adapter
;
import
com.github.pagehelper.PageInfo
;
import
com.viontech.fanxing.commons.base.BaseExample
;
import
com.viontech.fanxing.commons.base.BaseService
;
import
com.viontech.fanxing.commons.model.Behavior
;
import
com.viontech.fanxing.commons.vo.BehaviorVo
;
public
interface
BehaviorService
extends
BaseService
<
Behavior
>
{
PageInfo
<
BehaviorVo
>
getJsonData
(
BaseExample
example
,
int
pageNum
,
int
pageSize
);
}
\ No newline at end of file
fanxing-query/src/main/java/com/viontech/fanxing/query/service/adapter/TrafficService.java
View file @
713483d
package
com
.
viontech
.
fanxing
.
query
.
service
.
adapter
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.pagehelper.PageInfo
;
import
com.viontech.fanxing.commons.base.BaseExample
;
import
com.viontech.fanxing.commons.base.BaseService
;
import
com.viontech.fanxing.commons.model.Traffic
;
import
com.viontech.fanxing.commons.vo.TrafficVo
;
public
interface
TrafficService
extends
BaseService
<
Traffic
>
{
PageInfo
<
TrafficVo
>
getJsonData
(
BaseExample
example
,
int
pageNum
,
int
pageSize
);
}
\ No newline at end of file
fanxing-query/src/main/java/com/viontech/fanxing/query/service/impl/BehaviorServiceImpl.java
View file @
713483d
package
com
.
viontech
.
fanxing
.
query
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
...
...
@@ -8,12 +9,14 @@ import com.viontech.fanxing.commons.base.BaseMapper;
import
com.viontech.fanxing.commons.base.BaseServiceImpl
;
import
com.viontech.fanxing.commons.model.Behavior
;
import
com.viontech.fanxing.commons.model.BehaviorExample
;
import
com.viontech.fanxing.commons.vo.BehaviorVo
;
import
com.viontech.fanxing.query.mapper.BehaviorMapper
;
import
com.viontech.fanxing.query.service.adapter.BehaviorService
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
public
class
BehaviorServiceImpl
extends
BaseServiceImpl
<
Behavior
>
implements
BehaviorService
{
...
...
@@ -27,17 +30,20 @@ public class BehaviorServiceImpl extends BaseServiceImpl<Behavior> implements Be
@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
);
}
public
PageInfo
<
BehaviorVo
>
getJsonData
(
BaseExample
example
,
int
pageNum
,
int
pageSize
)
{
PageHelper
.
startPage
(
pageNum
,
pageSize
);
Page
<
Behavior
>
behaviors
=
(
Page
<
Behavior
>)
behaviorMapper
.
selectByExampleWithBLOBs
((
BehaviorExample
)
example
);
Page
<
BehaviorVo
>
page
=
new
Page
<>(
pageNum
,
pageSize
,
true
);
page
.
setTotal
(
behaviors
.
getTotal
());
List
<
BehaviorVo
>
collect
=
behaviors
.
stream
().
map
(
x
->
{
BehaviorVo
trafficVo
=
new
BehaviorVo
(
x
);
trafficVo
.
setData
(
JSON
.
parseObject
(
x
.
getEventData
()));
trafficVo
.
setEventData
(
null
);
return
trafficVo
;
}).
collect
(
Collectors
.
toList
());
page
.
addAll
(
collect
);
return
new
PageInfo
<>(
page
);
}
@Override
...
...
fanxing-query/src/main/java/com/viontech/fanxing/query/service/impl/TrafficServiceImpl.java
View file @
713483d
package
com
.
viontech
.
fanxing
.
query
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
...
...
@@ -8,12 +9,14 @@ import com.viontech.fanxing.commons.base.BaseMapper;
import
com.viontech.fanxing.commons.base.BaseServiceImpl
;
import
com.viontech.fanxing.commons.model.Traffic
;
import
com.viontech.fanxing.commons.model.TrafficExample
;
import
com.viontech.fanxing.commons.vo.TrafficVo
;
import
com.viontech.fanxing.query.mapper.TrafficMapper
;
import
com.viontech.fanxing.query.service.adapter.TrafficService
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
public
class
TrafficServiceImpl
extends
BaseServiceImpl
<
Traffic
>
implements
TrafficService
{
...
...
@@ -32,16 +35,19 @@ public class TrafficServiceImpl extends BaseServiceImpl<Traffic> implements Traf
}
@Override
public
PageInfo
<
Traffic
>
pagedQuery
(
BaseExample
example
,
int
pageNum
,
int
pageSize
)
{
if
(
pageSize
>
0
)
{
PageHelper
.
startPage
(
pageNum
,
pageSize
);
Page
<
Traffic
>
result
=
(
Page
<
Traffic
>)
trafficMapper
.
selectByExampleWithBLOBs
((
TrafficExample
)
example
);
return
new
PageInfo
<>(
result
);
}
else
{
List
<
Traffic
>
result
=
trafficMapper
.
selectByExampleWithBLOBs
((
TrafficExample
)
example
);
Page
<
Traffic
>
p
=
new
Page
<>();
p
.
addAll
(
result
);
return
new
PageInfo
<>(
p
);
}
public
PageInfo
<
TrafficVo
>
getJsonData
(
BaseExample
example
,
int
pageNum
,
int
pageSize
)
{
PageHelper
.
startPage
(
pageNum
,
pageSize
);
Page
<
Traffic
>
traffic
=
(
Page
<
Traffic
>)
trafficMapper
.
selectByExampleWithBLOBs
((
TrafficExample
)
example
);
Page
<
TrafficVo
>
page
=
new
Page
<>(
pageNum
,
pageSize
,
true
);
page
.
setTotal
(
traffic
.
getTotal
());
List
<
TrafficVo
>
collect
=
traffic
.
stream
().
map
(
x
->
{
TrafficVo
trafficVo
=
new
TrafficVo
(
x
);
trafficVo
.
setData
(
JSON
.
parseObject
(
x
.
getJsonData
()));
trafficVo
.
setJsonData
(
null
);
return
trafficVo
;
}).
collect
(
Collectors
.
toList
());
page
.
addAll
(
collect
);
return
new
PageInfo
<>(
page
);
}
}
\ No newline at end of file
fanxing-task/src/main/java/com/viontech/fanxing/task/model/vaserver/VaServerInfo.java
View file @
713483d
...
...
@@ -25,6 +25,10 @@ public class VaServerInfo implements Serializable {
private
Float
availableResources
;
/** 设备类型 */
private
String
platType
;
/** 软件版本 */
private
String
softVersion
;
/** 算法版本 */
private
String
algoVersion
;
/** 状态 1在线,0离线 */
private
int
status
=
1
;
...
...
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