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 d9f6a1f8
authored
Jul 20, 2021
by
xmh
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改
1 parent
d0a7414b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
42 changed files
with
630 additions
and
339 deletions
fanxing-code/src/main/resources/application.yml
fanxing-commons/src/main/java/com/viontech/fanxing/commons/constant/RedisKeys.java
fanxing-commons/src/main/java/com/viontech/fanxing/commons/model/Behavior.java
fanxing-commons/src/main/java/com/viontech/fanxing/commons/model/BehaviorExample.java
fanxing-commons/src/main/java/com/viontech/fanxing/commons/model/FlowEvent.java
fanxing-commons/src/main/java/com/viontech/fanxing/commons/model/FlowEventExample.java
fanxing-commons/src/main/java/com/viontech/fanxing/commons/model/Traffic.java
fanxing-commons/src/main/java/com/viontech/fanxing/commons/model/TrafficExample.java
fanxing-commons/src/main/java/com/viontech/fanxing/commons/vobase/BehaviorVoBase.java
fanxing-commons/src/main/java/com/viontech/fanxing/commons/vobase/FlowEventVoBase.java
fanxing-commons/src/main/java/com/viontech/fanxing/commons/vobase/TrafficVoBase.java
fanxing-commons/src/main/resources/redisson.yml
fanxing-forward/src/main/java/com/viontech/fanxing/forward/ForwardApp.java
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/configuration/BehaviorJobConfiguration.java
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/configuration/ForwardJobConfiguration.java
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/configuration/TrafficFlowJobConfiguration.java
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/configuration/TrafficJobConfiguration.java
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/processor/BehaviorProcessor.java
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/processor/PicProcessor.java
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/processor/TrafficFlowProcessor.java
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/processor/TrafficProcessor.java
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/writer/BehaviorWriter.java
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/writer/TrafficFlowWriter.java
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/writer/TrafficWriter.java
fanxing-forward/src/main/java/com/viontech/fanxing/forward/util/PicUtils.java
fanxing-forward/src/main/resources/application.yml
fanxing-gateway/src/main/resources/application.yml
fanxing-ops/src/main/resources/application.yml
fanxing-query/src/main/java/com/viontech/fanxing/query/QueryApp.java
fanxing-query/src/main/java/com/viontech/fanxing/query/controller/base/BehaviorBaseController.java
fanxing-query/src/main/java/com/viontech/fanxing/query/controller/base/FlowEventBaseController.java
fanxing-query/src/main/java/com/viontech/fanxing/query/controller/base/TrafficBaseController.java
fanxing-query/src/main/java/com/viontech/fanxing/query/mapping/BehaviorMapper.xml
fanxing-query/src/main/java/com/viontech/fanxing/query/mapping/FlowEventMapper.xml
fanxing-query/src/main/java/com/viontech/fanxing/query/mapping/TrafficMapper.xml
fanxing-query/src/main/resources/application.yml
fanxing-task-manager/src/main/resources/application.yml
fanxing-task-scheduling/src/main/java/com/viontech/fanxing/task/scheduling/controller/TaskController.java
fanxing-task-scheduling/src/main/java/com/viontech/fanxing/task/scheduling/controller/VAServerController.java
fanxing-task-scheduling/src/main/java/com/viontech/fanxing/task/scheduling/runner/TaskRunner.java
fanxing-task-scheduling/src/main/java/com/viontech/fanxing/task/scheduling/service/VAServerService.java
fanxing-task-scheduling/src/main/resources/application.yml
fanxing-code/src/main/resources/application.yml
View file @
d9f6a1f
...
...
@@ -26,10 +26,10 @@ spring:
username
:
root
password
:
123456
redis
:
host
:
localhost
host
:
192.168.9.233
port
:
6379
password
:
vionredis
database
:
2
password
:
3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database
:
15
jackson
:
date-format
:
yyyy-MM-dd HH:mm:ss
time-zone
:
GMT+8
...
...
fanxing-commons/src/main/java/com/viontech/fanxing/commons/constant/RedisKeys.java
View file @
d9f6a1f
...
...
@@ -9,18 +9,34 @@ package com.viontech.fanxing.commons.constant;
public
class
RedisKeys
{
/** 将要被执行的任务的 unid 有序集合,执行时间作为分数 */
public
static
final
String
SCHEDULING_TO_BE_EXECUTED_TASK_UNID_SET
=
"scheduling:toBeExecutedTaskUnidSet"
;
/** 将要被终止的任务的 unid 有序集合,执行时间作为分数 */
public
static
final
String
SCHEDULING_TO_BE_TERMINATED_TASK_UNID_SET
=
"scheduling:toBeTerminatedTaskUnidSet"
;
/** 用来存储 TaskData 的 map, taskUnid 作为 key, taskData 作为 value */
public
static
final
String
SCHEDULING_TASK_DATA_MAP
=
"scheduling:taskDataMap"
;
/** 用来存储 VaServerInfo 的 map, devId 作为 key, vaServerInfo 作为 value */
public
static
final
String
SCHEDULING_VASERVER_MAP
=
"scheduling:vaServerMap"
;
/** 用来关联任务和 vaServer 的 map, 表示任务在哪个vaServer上运行, taskUnid 作为 key, devId 作为 value */
public
static
final
String
SCHEDULING_TASK_VASERVER_MAP
=
"scheduling:taskVAServerMap"
;
/** 用来接收 traffic 数据的队列 */
public
static
final
String
FORWARD_TRAFFIC_QUEUE
=
"forward:trafficQueue"
;
/** 用来接收 flow 数据的队列 */
public
static
final
String
FORWARD_FLOW_QUEUE
=
"forward:flowQueue"
;
/** 用来接收 behavior 数据的队列 */
public
static
final
String
FORWARD_BEHAVIOR_QUEUE
=
"forward:behaviorQueue"
;
/** 用来接收所有数据的队列,用于转发 */
public
static
final
String
FORWARD_FORWARD_QUEUE
=
"forward:forwardQueue"
;
/**
* 用来获取 vaServer 的心跳在 redis 中对应的 key
*
* @param devId vaServer 的 devId
*
* @return redis 中的 key
*/
public
static
String
getVAServerKeepAliveKey
(
String
devId
)
{
return
devId
==
null
?
"scheduling:keepalive"
:
"scheduling:keepalive"
+
":"
+
devId
;
}
...
...
fanxing-commons/src/main/java/com/viontech/fanxing/commons/model/Behavior.java
View file @
d9f6a1f
...
...
@@ -18,6 +18,8 @@ public class Behavior extends BaseModel {
private
Date
eventTime
;
private
String
pics
;
private
String
channelUnid
;
private
String
testPicFile
;
...
...
@@ -32,8 +34,6 @@ public class Behavior extends BaseModel {
private
String
eventData
;
private
String
pics
;
private
String
video
;
public
Long
getId
()
{
...
...
@@ -92,6 +92,14 @@ public class Behavior extends BaseModel {
this
.
eventTime
=
eventTime
;
}
public
String
getPics
()
{
return
pics
;
}
public
void
setPics
(
String
pics
)
{
this
.
pics
=
pics
==
null
?
null
:
pics
.
trim
();
}
public
String
getChannelUnid
()
{
return
channelUnid
;
}
...
...
@@ -148,14 +156,6 @@ public class Behavior extends BaseModel {
this
.
eventData
=
eventData
==
null
?
null
:
eventData
.
trim
();
}
public
String
getPics
()
{
return
pics
;
}
public
void
setPics
(
String
pics
)
{
this
.
pics
=
pics
==
null
?
null
:
pics
.
trim
();
}
public
String
getVideo
()
{
return
video
;
}
...
...
fanxing-commons/src/main/java/com/viontech/fanxing/commons/model/BehaviorExample.java
View file @
d9f6a1f
...
...
@@ -549,6 +549,76 @@ public class BehaviorExample extends BaseExample {
return
(
Criteria
)
this
;
}
public
Criteria
andPicsIsNull
()
{
addCriterion
(
"`behavior`.pics is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPicsIsNotNull
()
{
addCriterion
(
"`behavior`.pics is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPicsEqualTo
(
String
value
)
{
addCriterion
(
"`behavior`.pics ="
,
value
,
"pics"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPicsNotEqualTo
(
String
value
)
{
addCriterion
(
"`behavior`.pics <>"
,
value
,
"pics"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPicsGreaterThan
(
String
value
)
{
addCriterion
(
"`behavior`.pics >"
,
value
,
"pics"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPicsGreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"`behavior`.pics >="
,
value
,
"pics"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPicsLessThan
(
String
value
)
{
addCriterion
(
"`behavior`.pics <"
,
value
,
"pics"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPicsLessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"`behavior`.pics <="
,
value
,
"pics"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPicsLike
(
String
value
)
{
addCriterion
(
"`behavior`.pics like"
,
value
,
"pics"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPicsNotLike
(
String
value
)
{
addCriterion
(
"`behavior`.pics not like"
,
value
,
"pics"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPicsIn
(
List
<
String
>
values
)
{
addCriterion
(
"`behavior`.pics in"
,
values
,
"pics"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPicsNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"`behavior`.pics not in"
,
values
,
"pics"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPicsBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"`behavior`.pics between"
,
value1
,
value2
,
"pics"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPicsNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"`behavior`.pics not between"
,
value1
,
value2
,
"pics"
);
return
(
Criteria
)
this
;
}
public
Criteria
andChannelUnidIsNull
()
{
addCriterion
(
"`behavior`.channel_unid is null"
);
return
(
Criteria
)
this
;
...
...
@@ -941,6 +1011,11 @@ public class BehaviorExample extends BaseExample {
return
(
ColumnContainer
)
this
;
}
public
ColumnContainer
hasPicsColumn
()
{
addColumnStr
(
"`behavior`.pics as behavior_pics "
);
return
(
ColumnContainer
)
this
;
}
public
ColumnContainer
hasChannelUnidColumn
()
{
addColumnStr
(
"`behavior`.channel_unid as behavior_channel_unid "
);
return
(
ColumnContainer
)
this
;
...
...
fanxing-commons/src/main/java/com/viontech/fanxing/commons/model/FlowEvent.java
View file @
d9f6a1f
...
...
@@ -24,7 +24,7 @@ public class FlowEvent extends BaseModel {
private
String
locationName
;
private
String
pic
Name
;
private
String
pic
s
;
private
String
videoName
;
...
...
@@ -110,12 +110,12 @@ public class FlowEvent extends BaseModel {
this
.
locationName
=
locationName
==
null
?
null
:
locationName
.
trim
();
}
public
String
getPic
Name
()
{
return
pic
Name
;
public
String
getPic
s
()
{
return
pic
s
;
}
public
void
setPic
Name
(
String
picName
)
{
this
.
pic
Name
=
picName
==
null
?
null
:
picName
.
trim
();
public
void
setPic
s
(
String
pics
)
{
this
.
pic
s
=
pics
==
null
?
null
:
pics
.
trim
();
}
public
String
getVideoName
()
{
...
...
fanxing-commons/src/main/java/com/viontech/fanxing/commons/model/FlowEventExample.java
View file @
d9f6a1f
...
...
@@ -759,73 +759,73 @@ public class FlowEventExample extends BaseExample {
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
IsNull
()
{
addCriterion
(
"`flowEvent`.pic
_name
is null"
);
public
Criteria
andPic
s
IsNull
()
{
addCriterion
(
"`flowEvent`.pic
s
is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
IsNotNull
()
{
addCriterion
(
"`flowEvent`.pic
_name
is not null"
);
public
Criteria
andPic
s
IsNotNull
()
{
addCriterion
(
"`flowEvent`.pic
s
is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
EqualTo
(
String
value
)
{
addCriterion
(
"`flowEvent`.pic
_name ="
,
value
,
"picName
"
);
public
Criteria
andPic
s
EqualTo
(
String
value
)
{
addCriterion
(
"`flowEvent`.pic
s ="
,
value
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
NotEqualTo
(
String
value
)
{
addCriterion
(
"`flowEvent`.pic
_name <>"
,
value
,
"picName
"
);
public
Criteria
andPic
s
NotEqualTo
(
String
value
)
{
addCriterion
(
"`flowEvent`.pic
s <>"
,
value
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
GreaterThan
(
String
value
)
{
addCriterion
(
"`flowEvent`.pic
_name >"
,
value
,
"picName
"
);
public
Criteria
andPic
s
GreaterThan
(
String
value
)
{
addCriterion
(
"`flowEvent`.pic
s >"
,
value
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
GreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"`flowEvent`.pic
_name >="
,
value
,
"picName
"
);
public
Criteria
andPic
s
GreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"`flowEvent`.pic
s >="
,
value
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
LessThan
(
String
value
)
{
addCriterion
(
"`flowEvent`.pic
_name <"
,
value
,
"picName
"
);
public
Criteria
andPic
s
LessThan
(
String
value
)
{
addCriterion
(
"`flowEvent`.pic
s <"
,
value
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
LessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"`flowEvent`.pic
_name <="
,
value
,
"picName
"
);
public
Criteria
andPic
s
LessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"`flowEvent`.pic
s <="
,
value
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
Like
(
String
value
)
{
addCriterion
(
"`flowEvent`.pic
_name like"
,
value
,
"picName
"
);
public
Criteria
andPic
s
Like
(
String
value
)
{
addCriterion
(
"`flowEvent`.pic
s like"
,
value
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
NotLike
(
String
value
)
{
addCriterion
(
"`flowEvent`.pic
_name not like"
,
value
,
"picName
"
);
public
Criteria
andPic
s
NotLike
(
String
value
)
{
addCriterion
(
"`flowEvent`.pic
s not like"
,
value
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
In
(
List
<
String
>
values
)
{
addCriterion
(
"`flowEvent`.pic
_name in"
,
values
,
"picName
"
);
public
Criteria
andPic
s
In
(
List
<
String
>
values
)
{
addCriterion
(
"`flowEvent`.pic
s in"
,
values
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
NotIn
(
List
<
String
>
values
)
{
addCriterion
(
"`flowEvent`.pic
_name not in"
,
values
,
"picName
"
);
public
Criteria
andPic
s
NotIn
(
List
<
String
>
values
)
{
addCriterion
(
"`flowEvent`.pic
s not in"
,
values
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
Between
(
String
value1
,
String
value2
)
{
addCriterion
(
"`flowEvent`.pic
_name between"
,
value1
,
value2
,
"picName
"
);
public
Criteria
andPic
s
Between
(
String
value1
,
String
value2
)
{
addCriterion
(
"`flowEvent`.pic
s between"
,
value1
,
value2
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
NotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"`flowEvent`.pic
_name not between"
,
value1
,
value2
,
"picName
"
);
public
Criteria
andPic
s
NotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"`flowEvent`.pic
s not between"
,
value1
,
value2
,
"pics
"
);
return
(
Criteria
)
this
;
}
...
...
@@ -956,8 +956,8 @@ public class FlowEventExample extends BaseExample {
return
(
ColumnContainer
)
this
;
}
public
ColumnContainer
hasPic
Name
Column
()
{
addColumnStr
(
"`flowEvent`.pic
_name as flowEvent_pic_name
"
);
public
ColumnContainer
hasPic
s
Column
()
{
addColumnStr
(
"`flowEvent`.pic
s as flowEvent_pics
"
);
return
(
ColumnContainer
)
this
;
}
...
...
fanxing-commons/src/main/java/com/viontech/fanxing/commons/model/Traffic.java
View file @
d9f6a1f
...
...
@@ -56,7 +56,7 @@ public class Traffic extends BaseModel {
private
Integer
withHelmet
;
private
String
pic
Name
;
private
String
pic
s
;
private
String
videoName
;
...
...
@@ -272,12 +272,12 @@ public class Traffic extends BaseModel {
this
.
withHelmet
=
withHelmet
;
}
public
String
getPic
Name
()
{
return
pic
Name
;
public
String
getPic
s
()
{
return
pic
s
;
}
public
void
setPic
Name
(
String
picName
)
{
this
.
pic
Name
=
picName
==
null
?
null
:
picName
.
trim
();
public
void
setPic
s
(
String
pics
)
{
this
.
pic
s
=
pics
==
null
?
null
:
pics
.
trim
();
}
public
String
getVideoName
()
{
...
...
fanxing-commons/src/main/java/com/viontech/fanxing/commons/model/TrafficExample.java
View file @
d9f6a1f
...
...
@@ -1819,73 +1819,73 @@ public class TrafficExample extends BaseExample {
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
IsNull
()
{
addCriterion
(
"`traffic`.pic
_name
is null"
);
public
Criteria
andPic
s
IsNull
()
{
addCriterion
(
"`traffic`.pic
s
is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
IsNotNull
()
{
addCriterion
(
"`traffic`.pic
_name
is not null"
);
public
Criteria
andPic
s
IsNotNull
()
{
addCriterion
(
"`traffic`.pic
s
is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
EqualTo
(
String
value
)
{
addCriterion
(
"`traffic`.pic
_name ="
,
value
,
"picName
"
);
public
Criteria
andPic
s
EqualTo
(
String
value
)
{
addCriterion
(
"`traffic`.pic
s ="
,
value
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
NotEqualTo
(
String
value
)
{
addCriterion
(
"`traffic`.pic
_name <>"
,
value
,
"picName
"
);
public
Criteria
andPic
s
NotEqualTo
(
String
value
)
{
addCriterion
(
"`traffic`.pic
s <>"
,
value
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
GreaterThan
(
String
value
)
{
addCriterion
(
"`traffic`.pic
_name >"
,
value
,
"picName
"
);
public
Criteria
andPic
s
GreaterThan
(
String
value
)
{
addCriterion
(
"`traffic`.pic
s >"
,
value
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
GreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"`traffic`.pic
_name >="
,
value
,
"picName
"
);
public
Criteria
andPic
s
GreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"`traffic`.pic
s >="
,
value
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
LessThan
(
String
value
)
{
addCriterion
(
"`traffic`.pic
_name <"
,
value
,
"picName
"
);
public
Criteria
andPic
s
LessThan
(
String
value
)
{
addCriterion
(
"`traffic`.pic
s <"
,
value
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
LessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"`traffic`.pic
_name <="
,
value
,
"picName
"
);
public
Criteria
andPic
s
LessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"`traffic`.pic
s <="
,
value
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
Like
(
String
value
)
{
addCriterion
(
"`traffic`.pic
_name like"
,
value
,
"picName
"
);
public
Criteria
andPic
s
Like
(
String
value
)
{
addCriterion
(
"`traffic`.pic
s like"
,
value
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
NotLike
(
String
value
)
{
addCriterion
(
"`traffic`.pic
_name not like"
,
value
,
"picName
"
);
public
Criteria
andPic
s
NotLike
(
String
value
)
{
addCriterion
(
"`traffic`.pic
s not like"
,
value
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
In
(
List
<
String
>
values
)
{
addCriterion
(
"`traffic`.pic
_name in"
,
values
,
"picName
"
);
public
Criteria
andPic
s
In
(
List
<
String
>
values
)
{
addCriterion
(
"`traffic`.pic
s in"
,
values
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
NotIn
(
List
<
String
>
values
)
{
addCriterion
(
"`traffic`.pic
_name not in"
,
values
,
"picName
"
);
public
Criteria
andPic
s
NotIn
(
List
<
String
>
values
)
{
addCriterion
(
"`traffic`.pic
s not in"
,
values
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
Between
(
String
value1
,
String
value2
)
{
addCriterion
(
"`traffic`.pic
_name between"
,
value1
,
value2
,
"picName
"
);
public
Criteria
andPic
s
Between
(
String
value1
,
String
value2
)
{
addCriterion
(
"`traffic`.pic
s between"
,
value1
,
value2
,
"pics
"
);
return
(
Criteria
)
this
;
}
public
Criteria
andPic
Name
NotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"`traffic`.pic
_name not between"
,
value1
,
value2
,
"picName
"
);
public
Criteria
andPic
s
NotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"`traffic`.pic
s not between"
,
value1
,
value2
,
"pics
"
);
return
(
Criteria
)
this
;
}
...
...
@@ -2156,8 +2156,8 @@ public class TrafficExample extends BaseExample {
return
(
ColumnContainer
)
this
;
}
public
ColumnContainer
hasPic
Name
Column
()
{
addColumnStr
(
"`traffic`.pic
_name as traffic_pic_name
"
);
public
ColumnContainer
hasPic
s
Column
()
{
addColumnStr
(
"`traffic`.pic
s as traffic_pics
"
);
return
(
ColumnContainer
)
this
;
}
...
...
fanxing-commons/src/main/java/com/viontech/fanxing/commons/vobase/BehaviorVoBase.java
View file @
d9f6a1f
...
...
@@ -94,6 +94,15 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> {
private
Date
eventTime_lte
;
@JsonIgnore
private
Boolean
pics_null
;
@JsonIgnore
private
ArrayList
<
String
>
pics_arr
;
@JsonIgnore
private
String
pics_like
;
@JsonIgnore
private
Boolean
channelUnid_null
;
@JsonIgnore
...
...
@@ -157,15 +166,6 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> {
private
String
eventData_like
;
@JsonIgnore
private
Boolean
pics_null
;
@JsonIgnore
private
ArrayList
<
String
>
pics_arr
;
@JsonIgnore
private
String
pics_like
;
@JsonIgnore
private
Boolean
video_null
;
@JsonIgnore
...
...
@@ -516,6 +516,44 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> {
this
.
getModel
().
setEventTime
(
eventTime
);
}
public
Boolean
getPics_null
()
{
return
pics_null
;
}
public
void
setPics_null
(
Boolean
pics_null
)
{
this
.
pics_null
=
pics_null
;
}
public
ArrayList
<
String
>
getPics_arr
()
{
return
pics_arr
;
}
public
void
setPics_arr
(
ArrayList
<
String
>
pics_arr
)
{
this
.
pics_arr
=
pics_arr
;
}
public
String
getPics_like
()
{
return
pics_like
;
}
public
void
setPics_like
(
String
pics_like
)
{
this
.
pics_like
=
pics_like
;
}
public
String
getPics
()
{
if
(
getModel
()
==
null
){
throw
new
RuntimeException
(
"model is null"
);
}
return
this
.
getModel
().
getPics
();
}
public
void
setPics
(
String
pics
)
{
if
(
getModel
()
==
null
){
throw
new
RuntimeException
(
"model is null"
);
}
this
.
getModel
().
setPics
(
pics
);
}
public
Boolean
getChannelUnid_null
()
{
return
channelUnid_null
;
}
...
...
@@ -782,44 +820,6 @@ public class BehaviorVoBase extends Behavior implements VoInterface<Behavior> {
this
.
getModel
().
setEventData
(
eventData
);
}
public
Boolean
getPics_null
()
{
return
pics_null
;
}
public
void
setPics_null
(
Boolean
pics_null
)
{
this
.
pics_null
=
pics_null
;
}
public
ArrayList
<
String
>
getPics_arr
()
{
return
pics_arr
;
}
public
void
setPics_arr
(
ArrayList
<
String
>
pics_arr
)
{
this
.
pics_arr
=
pics_arr
;
}
public
String
getPics_like
()
{
return
pics_like
;
}
public
void
setPics_like
(
String
pics_like
)
{
this
.
pics_like
=
pics_like
;
}
public
String
getPics
()
{
if
(
getModel
()
==
null
){
throw
new
RuntimeException
(
"model is null"
);
}
return
this
.
getModel
().
getPics
();
}
public
void
setPics
(
String
pics
)
{
if
(
getModel
()
==
null
){
throw
new
RuntimeException
(
"model is null"
);
}
this
.
getModel
().
setPics
(
pics
);
}
public
Boolean
getVideo_null
()
{
return
video_null
;
}
...
...
fanxing-commons/src/main/java/com/viontech/fanxing/commons/vobase/FlowEventVoBase.java
View file @
d9f6a1f
...
...
@@ -121,13 +121,13 @@ public class FlowEventVoBase extends FlowEvent implements VoInterface<FlowEvent>
private
String
locationName_like
;
@JsonIgnore
private
Boolean
pic
Name
_null
;
private
Boolean
pic
s
_null
;
@JsonIgnore
private
ArrayList
<
String
>
pic
Name
_arr
;
private
ArrayList
<
String
>
pic
s
_arr
;
@JsonIgnore
private
String
pic
Name
_like
;
private
String
pic
s
_like
;
@JsonIgnore
private
Boolean
videoName_null
;
...
...
@@ -603,42 +603,42 @@ public class FlowEventVoBase extends FlowEvent implements VoInterface<FlowEvent>
this
.
getModel
().
setLocationName
(
locationName
);
}
public
Boolean
getPic
Name
_null
()
{
return
pic
Name
_null
;
public
Boolean
getPic
s
_null
()
{
return
pic
s
_null
;
}
public
void
setPic
Name_null
(
Boolean
picName
_null
)
{
this
.
pic
Name_null
=
picName
_null
;
public
void
setPic
s_null
(
Boolean
pics
_null
)
{
this
.
pic
s_null
=
pics
_null
;
}
public
ArrayList
<
String
>
getPic
Name
_arr
()
{
return
pic
Name
_arr
;
public
ArrayList
<
String
>
getPic
s
_arr
()
{
return
pic
s
_arr
;
}
public
void
setPic
Name_arr
(
ArrayList
<
String
>
picName
_arr
)
{
this
.
pic
Name_arr
=
picName
_arr
;
public
void
setPic
s_arr
(
ArrayList
<
String
>
pics
_arr
)
{
this
.
pic
s_arr
=
pics
_arr
;
}
public
String
getPic
Name
_like
()
{
return
pic
Name
_like
;
public
String
getPic
s
_like
()
{
return
pic
s
_like
;
}
public
void
setPic
Name_like
(
String
picName
_like
)
{
this
.
pic
Name_like
=
picName
_like
;
public
void
setPic
s_like
(
String
pics
_like
)
{
this
.
pic
s_like
=
pics
_like
;
}
public
String
getPic
Name
()
{
public
String
getPic
s
()
{
if
(
getModel
()
==
null
){
throw
new
RuntimeException
(
"model is null"
);
}
return
this
.
getModel
().
getPic
Name
();
return
this
.
getModel
().
getPic
s
();
}
public
void
setPic
Name
(
String
picName
)
{
public
void
setPic
s
(
String
pics
)
{
if
(
getModel
()
==
null
){
throw
new
RuntimeException
(
"model is null"
);
}
this
.
getModel
().
setPic
Name
(
picName
);
this
.
getModel
().
setPic
s
(
pics
);
}
public
Boolean
getVideoName_null
()
{
...
...
fanxing-commons/src/main/java/com/viontech/fanxing/commons/vobase/TrafficVoBase.java
View file @
d9f6a1f
...
...
@@ -316,13 +316,13 @@ public class TrafficVoBase extends Traffic implements VoInterface<Traffic> {
private
Integer
withHelmet_lte
;
@JsonIgnore
private
Boolean
pic
Name
_null
;
private
Boolean
pic
s
_null
;
@JsonIgnore
private
ArrayList
<
String
>
pic
Name
_arr
;
private
ArrayList
<
String
>
pic
s
_arr
;
@JsonIgnore
private
String
pic
Name
_like
;
private
String
pic
s
_like
;
@JsonIgnore
private
Boolean
videoName_null
;
...
...
@@ -1557,42 +1557,42 @@ public class TrafficVoBase extends Traffic implements VoInterface<Traffic> {
this
.
getModel
().
setWithHelmet
(
withHelmet
);
}
public
Boolean
getPic
Name
_null
()
{
return
pic
Name
_null
;
public
Boolean
getPic
s
_null
()
{
return
pic
s
_null
;
}
public
void
setPic
Name_null
(
Boolean
picName
_null
)
{
this
.
pic
Name_null
=
picName
_null
;
public
void
setPic
s_null
(
Boolean
pics
_null
)
{
this
.
pic
s_null
=
pics
_null
;
}
public
ArrayList
<
String
>
getPic
Name
_arr
()
{
return
pic
Name
_arr
;
public
ArrayList
<
String
>
getPic
s
_arr
()
{
return
pic
s
_arr
;
}
public
void
setPic
Name_arr
(
ArrayList
<
String
>
picName
_arr
)
{
this
.
pic
Name_arr
=
picName
_arr
;
public
void
setPic
s_arr
(
ArrayList
<
String
>
pics
_arr
)
{
this
.
pic
s_arr
=
pics
_arr
;
}
public
String
getPic
Name
_like
()
{
return
pic
Name
_like
;
public
String
getPic
s
_like
()
{
return
pic
s
_like
;
}
public
void
setPic
Name_like
(
String
picName
_like
)
{
this
.
pic
Name_like
=
picName
_like
;
public
void
setPic
s_like
(
String
pics
_like
)
{
this
.
pic
s_like
=
pics
_like
;
}
public
String
getPic
Name
()
{
public
String
getPic
s
()
{
if
(
getModel
()
==
null
){
throw
new
RuntimeException
(
"model is null"
);
}
return
this
.
getModel
().
getPic
Name
();
return
this
.
getModel
().
getPic
s
();
}
public
void
setPic
Name
(
String
picName
)
{
public
void
setPic
s
(
String
pics
)
{
if
(
getModel
()
==
null
){
throw
new
RuntimeException
(
"model is null"
);
}
this
.
getModel
().
setPic
Name
(
picName
);
this
.
getModel
().
setPic
s
(
pics
);
}
public
Boolean
getVideoName_null
()
{
...
...
fanxing-commons/src/main/resources/redisson.yml
View file @
d9f6a1f
...
...
@@ -7,15 +7,15 @@ singleServerConfig:
timeout
:
3000
retryAttempts
:
3
retryInterval
:
1500
password
:
vionredis
password
:
3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
subscriptionsPerConnection
:
5
clientName
:
null
address
:
"
redis://1
27.0.0.1
:6379"
address
:
"
redis://1
92.168.9.233
:6379"
subscriptionConnectionMinimumIdleSize
:
1
subscriptionConnectionPoolSize
:
50
connectionMinimumIdleSize
:
32
connectionPoolSize
:
64
database
:
2
database
:
15
dnsMonitoringInterval
:
5000
# 集群配置
#clusterServersConfig:
...
...
fanxing-forward/src/main/java/com/viontech/fanxing/forward/ForwardApp.java
View file @
d9f6a1f
...
...
@@ -33,6 +33,8 @@ import java.util.concurrent.TimeUnit;
@Slf4j
public
class
ForwardApp
{
public
static
final
ThreadPoolExecutor
THREAD_POOL_EXECUTOR
=
new
ThreadPoolExecutor
(
50
,
50
,
1
,
TimeUnit
.
MINUTES
,
new
LinkedBlockingDeque
<>(
5000
),
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
public
static
void
main
(
String
[]
args
)
{
try
{
SpringApplication
.
run
(
ForwardApp
.
class
,
args
);
...
...
@@ -41,8 +43,6 @@ public class ForwardApp {
}
}
public
static
final
ThreadPoolExecutor
THREAD_POOL_EXECUTOR
=
new
ThreadPoolExecutor
(
50
,
50
,
1
,
TimeUnit
.
MINUTES
,
new
LinkedBlockingDeque
<>(
5000
),
new
ThreadPoolExecutor
.
CallerRunsPolicy
());
@Bean
public
TaskExecutor
taskExecutor
()
{
ThreadPoolTaskExecutor
threadPoolTaskExecutor
=
new
ThreadPoolTaskExecutor
();
...
...
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/configuration/BehaviorJobConfiguration.java
View file @
d9f6a1f
package
com
.
viontech
.
fanxing
.
forward
.
batch
.
configuration
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.viontech.fanxing.commons.constant.RedisKeys
;
import
com.viontech.fanxing.commons.model.Behavior
;
...
...
@@ -8,6 +7,8 @@ import com.viontech.fanxing.forward.batch.listener.ExecutionContextClearListener
import
com.viontech.fanxing.forward.batch.listener.JobRestartListener
;
import
com.viontech.fanxing.forward.batch.listener.WorkQueueClearChunkListener
;
import
com.viontech.fanxing.forward.batch.processor.BehaviorProcessor
;
import
com.viontech.fanxing.forward.batch.processor.CompositeItemStreamProcessor
;
import
com.viontech.fanxing.forward.batch.processor.PicProcessor
;
import
com.viontech.fanxing.forward.batch.reader.ConcurrencyReader
;
import
com.viontech.fanxing.forward.batch.reader.RedisPopReader
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -15,12 +16,11 @@ import org.redisson.api.RedissonClient;
import
org.springframework.batch.core.Job
;
import
org.springframework.batch.core.Step
;
import
org.springframework.batch.core.configuration.annotation.JobBuilderFactory
;
import
org.springframework.batch.core.configuration.annotation.JobScope
;
import
org.springframework.batch.core.configuration.annotation.StepBuilderFactory
;
import
org.springframework.batch.core.launch.support.RunIdIncrementer
;
import
org.springframework.batch.core.repository.JobRepository
;
import
org.springframework.batch.item.ItemReader
;
import
org.springframework.batch.item.ItemStreamReader
;
import
org.springframework.batch.item.ItemWriter
;
import
org.springframework.batch.item.*
;
import
org.springframework.batch.repeat.RepeatContext
;
import
org.springframework.batch.repeat.RepeatStatus
;
import
org.springframework.batch.repeat.policy.CompletionPolicySupport
;
...
...
@@ -30,7 +30,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
java
x.sql.DataSource
;
import
java
.util.LinkedList
;
/**
* .
...
...
@@ -58,7 +58,7 @@ public class BehaviorJobConfiguration {
}
@Bean
(
name
=
"behaviorStep"
)
public
Step
behaviorStep
(
ItemReader
<
JSONObject
>
behaviorReader
,
ItemWriter
<
Behavior
>
behaviorWriter
,
BehaviorProcessor
behaviorProcessor
)
{
public
Step
behaviorStep
(
ItemReader
<
JSONObject
>
behaviorReader
,
ItemWriter
<
Behavior
>
behaviorWriter
,
ItemProcessor
<
JSONObject
,
Behavior
>
behaviorProcessorCompose
)
{
RepeatTemplate
stepOperations
=
new
RepeatTemplate
();
stepOperations
.
setCompletionPolicy
(
new
CompletionPolicySupport
()
{
@Override
...
...
@@ -76,13 +76,14 @@ public class BehaviorJobConfiguration {
.
listener
(
new
ExecutionContextClearListener
())
.<
JSONObject
,
Behavior
>
chunk
(
1
)
.
reader
(
behaviorReader
)
.
processor
(
behaviorProcessor
)
.
processor
(
behaviorProcessor
Compose
)
.
writer
(
behaviorWriter
)
.
stepOperations
(
stepOperations
)
.
listener
(
new
WorkQueueClearChunkListener
())
.
build
();
}
@Bean
(
name
=
"behaviorReader"
)
public
ItemReader
<
JSONObject
>
behaviorReader
(
RedissonClient
redissonClient
,
@Value
(
"${spring.cloud.consul.discovery.instance-id}"
)
String
instanceId
)
{
return
new
ConcurrencyReader
<
JSONObject
>()
{
...
...
@@ -97,4 +98,16 @@ public class BehaviorJobConfiguration {
}
};
}
@Bean
(
name
=
"behaviorProcessorCompose"
)
public
ItemProcessor
<
JSONObject
,
Behavior
>
behaviorProcessorCompose
(
BehaviorProcessor
behaviorProcessor
,
PicProcessor
picProcessor
)
{
LinkedList
delegates
=
new
LinkedList
<>();
delegates
.
add
(
picProcessor
);
delegates
.
add
(
behaviorProcessor
);
CompositeItemStreamProcessor
<
JSONObject
,
Behavior
>
item
=
new
CompositeItemStreamProcessor
<>();
item
.
setDelegates
(
delegates
);
return
item
;
}
}
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/configuration/ForwardJobConfiguration.java
View file @
d9f6a1f
package
com
.
viontech
.
fanxing
.
forward
.
batch
.
configuration
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.viontech.fanxing.commons.constant.RedisKeys
;
import
com.viontech.fanxing.forward.batch.listener.ExecutionContextClearListener
;
...
...
@@ -15,9 +14,11 @@ import org.redisson.api.RedissonClient;
import
org.springframework.batch.core.Job
;
import
org.springframework.batch.core.Step
;
import
org.springframework.batch.core.configuration.annotation.JobBuilderFactory
;
import
org.springframework.batch.core.configuration.annotation.JobScope
;
import
org.springframework.batch.core.configuration.annotation.StepBuilderFactory
;
import
org.springframework.batch.core.launch.support.RunIdIncrementer
;
import
org.springframework.batch.core.repository.JobRepository
;
import
org.springframework.batch.item.ExecutionContext
;
import
org.springframework.batch.item.ItemReader
;
import
org.springframework.batch.item.ItemStreamReader
;
import
org.springframework.batch.item.ItemWriter
;
...
...
@@ -30,8 +31,6 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
javax.sql.DataSource
;
/**
* .
*
...
...
@@ -92,27 +91,10 @@ public class ForwardJobConfiguration {
RedisPopReader
<
JSONObject
>
redisPopReader
=
new
RedisPopReader
<>();
redisPopReader
.
setRedissonClient
(
redissonClient
);
redisPopReader
.
setPopType
(
RedisPopReader
.
POP_TYPE_RPOPLPUSH
);
redisPopReader
.
setKey
(
RedisKeys
.
FORWARD_
BEHAVIOR
_QUEUE
);
redisPopReader
.
setKey
(
RedisKeys
.
FORWARD_
FORWARD
_QUEUE
);
redisPopReader
.
setInstanceId
(
instanceId
);
return
redisPopReader
;
}
};
}
@Bean
(
name
=
"forwardWriter"
)
public
ItemWriter
<
ForwardContent
>
forwardWriter
(
DataSource
dataSource
)
{
return
list
->
{
for
(
ForwardContent
item
:
list
)
{
log
.
info
(
JSON
.
toJSONString
(
item
));
}
};
// JdbcBatchItemWriter<ForwardData> writer = new JdbcBatchItemWriter<>();
// writer.setItemSqlParameterSourceProvider(new BeanPropertyItemSqlParameterSourceProvider<>());
// String sql = "";
// writer.setSql(sql);
// writer.setDataSource(dataSource);
// return writer;
}
}
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/configuration/TrafficFlowJobConfiguration.java
View file @
d9f6a1f
package
com
.
viontech
.
fanxing
.
forward
.
batch
.
configuration
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.viontech.fanxing.commons.constant.RedisKeys
;
import
com.viontech.fanxing.forward.batch.listener.ExecutionContextClearListener
;
import
com.viontech.fanxing.forward.batch.listener.JobRestartListener
;
import
com.viontech.fanxing.forward.batch.listener.WorkQueueClearChunkListener
;
import
com.viontech.fanxing.forward.batch.processor.CompositeItemStreamProcessor
;
import
com.viontech.fanxing.forward.batch.processor.PicProcessor
;
import
com.viontech.fanxing.forward.batch.processor.TrafficFlowProcessor
;
import
com.viontech.fanxing.forward.batch.reader.ConcurrencyReader
;
import
com.viontech.fanxing.forward.batch.reader.RedisPopReader
;
...
...
@@ -15,12 +16,11 @@ import org.redisson.api.RedissonClient;
import
org.springframework.batch.core.Job
;
import
org.springframework.batch.core.Step
;
import
org.springframework.batch.core.configuration.annotation.JobBuilderFactory
;
import
org.springframework.batch.core.configuration.annotation.JobScope
;
import
org.springframework.batch.core.configuration.annotation.StepBuilderFactory
;
import
org.springframework.batch.core.launch.support.RunIdIncrementer
;
import
org.springframework.batch.core.repository.JobRepository
;
import
org.springframework.batch.item.ItemReader
;
import
org.springframework.batch.item.ItemStreamReader
;
import
org.springframework.batch.item.ItemWriter
;
import
org.springframework.batch.item.*
;
import
org.springframework.batch.repeat.RepeatContext
;
import
org.springframework.batch.repeat.RepeatStatus
;
import
org.springframework.batch.repeat.policy.CompletionPolicySupport
;
...
...
@@ -30,7 +30,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
java
x.sql.DataSource
;
import
java
.util.LinkedList
;
/**
* .
...
...
@@ -58,7 +58,7 @@ public class TrafficFlowJobConfiguration {
}
@Bean
(
name
=
"trafficFlowStep"
)
public
Step
trafficFlowStep
(
ItemReader
<
JSONObject
>
trafficFlowReader
,
ItemWriter
<
TrafficFlowContent
>
trafficFlowWriter
,
TrafficFlowProcessor
trafficFlowProcessor
)
{
public
Step
trafficFlowStep
(
ItemReader
<
JSONObject
>
trafficFlowReader
,
ItemWriter
<
TrafficFlowContent
>
trafficFlowWriter
,
ItemProcessor
<
JSONObject
,
TrafficFlowContent
>
trafficFlowProcessorCompose
)
{
RepeatTemplate
stepOperations
=
new
RepeatTemplate
();
stepOperations
.
setCompletionPolicy
(
new
CompletionPolicySupport
()
{
@Override
...
...
@@ -76,7 +76,7 @@ public class TrafficFlowJobConfiguration {
.
listener
(
new
ExecutionContextClearListener
())
.<
JSONObject
,
TrafficFlowContent
>
chunk
(
1
)
.
reader
(
trafficFlowReader
)
.
processor
(
trafficFlowProcessor
)
.
processor
(
trafficFlowProcessor
Compose
)
.
writer
(
trafficFlowWriter
)
.
stepOperations
(
stepOperations
)
.
listener
(
new
WorkQueueClearChunkListener
())
...
...
@@ -91,10 +91,22 @@ public class TrafficFlowJobConfiguration {
RedisPopReader
<
JSONObject
>
redisPopReader
=
new
RedisPopReader
<>();
redisPopReader
.
setRedissonClient
(
redissonClient
);
redisPopReader
.
setPopType
(
RedisPopReader
.
POP_TYPE_RPOPLPUSH
);
redisPopReader
.
setKey
(
RedisKeys
.
FORWARD_
BEHAVIOR
_QUEUE
);
redisPopReader
.
setKey
(
RedisKeys
.
FORWARD_
FLOW
_QUEUE
);
redisPopReader
.
setInstanceId
(
instanceId
);
return
redisPopReader
;
}
};
}
@Bean
(
name
=
"trafficFlowProcessorCompose"
)
public
ItemProcessor
<
JSONObject
,
TrafficFlowContent
>
trafficFlowProcessorCompose
(
TrafficFlowProcessor
trafficFlowProcessor
,
PicProcessor
picProcessor
)
{
LinkedList
delegates
=
new
LinkedList
<>();
delegates
.
add
(
picProcessor
);
delegates
.
add
(
trafficFlowProcessor
);
CompositeItemStreamProcessor
<
JSONObject
,
TrafficFlowContent
>
item
=
new
CompositeItemStreamProcessor
<>();
item
.
setDelegates
(
delegates
);
return
item
;
}
}
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/configuration/TrafficJobConfiguration.java
View file @
d9f6a1f
package
com
.
viontech
.
fanxing
.
forward
.
batch
.
configuration
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.viontech.fanxing.commons.constant.RedisKeys
;
import
com.viontech.fanxing.forward.batch.listener.ExecutionContextClearListener
;
import
com.viontech.fanxing.forward.batch.listener.JobRestartListener
;
import
com.viontech.fanxing.forward.batch.listener.WorkQueueClearChunkListener
;
import
com.viontech.fanxing.forward.batch.processor.CompositeItemStreamProcessor
;
import
com.viontech.fanxing.forward.batch.processor.PicProcessor
;
import
com.viontech.fanxing.forward.batch.processor.TrafficProcessor
;
import
com.viontech.fanxing.forward.batch.reader.ConcurrencyReader
;
import
com.viontech.fanxing.forward.batch.reader.RedisPopReader
;
...
...
@@ -15,12 +16,11 @@ import org.redisson.api.RedissonClient;
import
org.springframework.batch.core.Job
;
import
org.springframework.batch.core.Step
;
import
org.springframework.batch.core.configuration.annotation.JobBuilderFactory
;
import
org.springframework.batch.core.configuration.annotation.JobScope
;
import
org.springframework.batch.core.configuration.annotation.StepBuilderFactory
;
import
org.springframework.batch.core.launch.support.RunIdIncrementer
;
import
org.springframework.batch.core.repository.JobRepository
;
import
org.springframework.batch.item.ItemReader
;
import
org.springframework.batch.item.ItemStreamReader
;
import
org.springframework.batch.item.ItemWriter
;
import
org.springframework.batch.item.*
;
import
org.springframework.batch.repeat.RepeatContext
;
import
org.springframework.batch.repeat.RepeatStatus
;
import
org.springframework.batch.repeat.policy.CompletionPolicySupport
;
...
...
@@ -30,6 +30,8 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
java.util.LinkedList
;
/**
* .
*
...
...
@@ -57,7 +59,7 @@ public class TrafficJobConfiguration {
}
@Bean
(
name
=
"trafficStep"
)
public
Step
trafficStep
(
ItemReader
<
JSONObject
>
trafficReader
,
ItemWriter
<
TrafficContent
>
trafficWriter
,
TrafficProcessor
trafficProcessor
)
{
public
Step
trafficStep
(
ItemReader
<
JSONObject
>
trafficReader
,
ItemWriter
<
TrafficContent
>
trafficWriter
,
ItemProcessor
<
JSONObject
,
TrafficContent
>
trafficProcessorCompose
)
{
RepeatTemplate
stepOperations
=
new
RepeatTemplate
();
stepOperations
.
setCompletionPolicy
(
new
CompletionPolicySupport
()
{
@Override
...
...
@@ -75,7 +77,7 @@ public class TrafficJobConfiguration {
.
listener
(
new
ExecutionContextClearListener
())
.<
JSONObject
,
TrafficContent
>
chunk
(
1
)
.
reader
(
trafficReader
)
.
processor
(
trafficProcessor
)
.
processor
(
trafficProcessor
Compose
)
.
writer
(
trafficWriter
)
.
stepOperations
(
stepOperations
)
.
listener
(
new
WorkQueueClearChunkListener
())
...
...
@@ -96,4 +98,16 @@ public class TrafficJobConfiguration {
}
};
}
@Bean
(
name
=
"trafficProcessorCompose"
)
public
ItemProcessor
<
JSONObject
,
TrafficContent
>
trafficFlowProcessorCompose
(
TrafficProcessor
trafficProcessor
,
PicProcessor
picProcessor
)
{
LinkedList
delegates
=
new
LinkedList
<>();
delegates
.
add
(
picProcessor
);
delegates
.
add
(
trafficProcessor
);
CompositeItemStreamProcessor
<
JSONObject
,
TrafficContent
>
item
=
new
CompositeItemStreamProcessor
<>();
item
.
setDelegates
(
delegates
);
return
item
;
}
}
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/processor/BehaviorProcessor.java
View file @
d9f6a1f
...
...
@@ -31,6 +31,8 @@ public class BehaviorProcessor implements ItemStream, ItemProcessor<JSONObject,
@Override
public
Behavior
process
(
JSONObject
item
)
throws
Exception
{
log
.
info
(
"收到 behavior 消息 , eventId:{}"
,
item
.
getString
(
"event_refid"
));
// final Map<String, Task> taskMap = cacheUtils.getTaskMap();
// String taskUnid = item.getString("task_id");
// final Task task = taskMap.get(taskUnid);
...
...
@@ -54,6 +56,7 @@ public class BehaviorProcessor implements ItemStream, ItemProcessor<JSONObject,
JSONArray
video
=
item
.
getJSONArray
(
"video"
);
JSONArray
pics
=
item
.
getJSONArray
(
"pics"
);
JSONObject
auxDevInfo
=
item
.
getJSONObject
(
"aux_dev_info"
);
String
picArray
=
item
.
getString
(
"pic_path_array"
);
behavior
.
setEventType
(
eventType
);
behavior
.
setEventRefid
(
eventRefid
);
...
...
@@ -61,10 +64,10 @@ public class BehaviorProcessor implements ItemStream, ItemProcessor<JSONObject,
behavior
.
setEventCate
(
eventCate
);
behavior
.
setChannelUnid
(
channelUnid
);
behavior
.
setTaskName
(
taskName
);
behavior
.
setPics
(
picArray
);
behavior
.
setEventData
(
eventData
==
null
?
null
:
eventData
.
toJSONString
());
behavior
.
setVideo
(
video
==
null
?
null
:
video
.
toJSONString
());
behavior
.
setPics
(
pics
==
null
?
null
:
pics
.
toJSONString
());
behavior
.
setAuxDevInfo
(
auxDevInfo
==
null
?
null
:
auxDevInfo
.
toJSONString
());
return
behavior
;
...
...
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/processor/PicProcessor.java
0 → 100644
View file @
d9f6a1f
package
com
.
viontech
.
fanxing
.
forward
.
batch
.
processor
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.viontech.fanxing.forward.util.PicUtils
;
import
com.viontech.keliu.util.DateUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.batch.item.ExecutionContext
;
import
org.springframework.batch.item.ItemProcessor
;
import
org.springframework.batch.item.ItemStream
;
import
org.springframework.batch.item.ItemStreamException
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Date
;
/**
* .
*
* @author 谢明辉
* @date 2021/7/19
*/
@Component
@Slf4j
public
class
PicProcessor
implements
ItemStream
,
ItemProcessor
<
JSONObject
,
JSONObject
>
{
@Resource
private
PicUtils
picUtils
;
@Override
public
JSONObject
process
(
JSONObject
item
)
throws
Exception
{
JSONArray
pics
=
item
.
getJSONArray
(
"pics"
);
if
(
pics
!=
null
&&
pics
.
size
()
>
0
)
{
String
eventDt
=
item
.
getString
(
"event_dt"
);
Date
eventTime
=
DateUtil
.
parse
(
DateUtil
.
FORMAT_FULL
,
eventDt
);
ArrayList
<
String
>
picList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
pics
.
size
();
i
++)
{
JSONObject
picObject
=
pics
.
getJSONObject
(
i
);
String
base64
=
picObject
.
getString
(
"pic_base64"
);
String
format
=
picObject
.
getString
(
"format"
);
String
picUnid
=
picObject
.
getString
(
"pic_unid"
);
picObject
.
remove
(
"pic_base64"
);
String
path
=
picUtils
.
savePicBase64
(
picUnid
,
eventTime
,
format
,
base64
);
picList
.
add
(
path
);
}
String
picPathArray
=
String
.
join
(
","
,
picList
);
item
.
put
(
"pic_path_array"
,
picPathArray
);
}
return
item
;
}
@Override
public
void
open
(
ExecutionContext
executionContext
)
throws
ItemStreamException
{
}
@Override
public
void
update
(
ExecutionContext
executionContext
)
throws
ItemStreamException
{
}
@Override
public
void
close
()
throws
ItemStreamException
{
}
}
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/processor/TrafficFlowProcessor.java
View file @
d9f6a1f
...
...
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.viontech.fanxing.commons.model.FlowData
;
import
com.viontech.fanxing.commons.model.FlowEvent
;
import
com.viontech.fanxing.commons.model.Task
;
import
com.viontech.fanxing.forward.model.TrafficFlowContent
;
import
com.viontech.fanxing.forward.util.CacheUtils
;
import
com.viontech.keliu.util.DateUtil
;
...
...
@@ -19,7 +18,6 @@ import javax.annotation.Resource;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
/**
* .
...
...
@@ -36,6 +34,8 @@ public class TrafficFlowProcessor implements ItemProcessor<JSONObject, TrafficFl
@Override
public
TrafficFlowContent
process
(
JSONObject
item
)
throws
Exception
{
log
.
info
(
"收到 flow 消息 , eventId:{}"
,
item
.
getString
(
"event_refid"
));
// final Map<String, Task> taskMap = cacheUtils.getTaskMap();
// String taskUnid = item.getString("task_id");
// final Task task = taskMap.get(taskUnid);
...
...
@@ -56,11 +56,13 @@ public class TrafficFlowProcessor implements ItemProcessor<JSONObject, TrafficFl
String
eventType
=
item
.
getString
(
"event_type"
);
String
eventRefid
=
item
.
getString
(
"event_refid"
);
String
eventDt
=
item
.
getString
(
"event_dt"
);
String
picArray
=
item
.
getString
(
"pic_path_array"
);
Date
eventTime
=
DateUtil
.
parse
(
DateUtil
.
FORMAT_FULL
,
eventDt
);
flowEvent
.
setEventType
(
eventType
);
flowEvent
.
setEventId
(
eventRefid
);
flowEvent
.
setEventTime
(
eventTime
);
flowEvent
.
setPics
(
picArray
);
// flowEvent.setTaskId(taskId);
JSONObject
eventData
=
item
.
getJSONObject
(
"event_data"
);
...
...
@@ -89,7 +91,7 @@ public class TrafficFlowProcessor implements ItemProcessor<JSONObject, TrafficFl
flowDataList
.
addAll
(
getFlowData
(
eventTime
,
taskId
,
"xcycle"
,
eventData
));
flowDataList
.
addAll
(
getFlowData
(
eventTime
,
taskId
,
"pedestrian"
,
eventData
));
flowDataList
.
addAll
(
getFlowData
(
eventTime
,
taskId
,
"density"
,
eventData
));
flowDataList
.
addAll
(
getFlowData
(
eventTime
,
taskId
,
"
B
us"
,
eventData
));
flowDataList
.
addAll
(
getFlowData
(
eventTime
,
taskId
,
"
b
us"
,
eventData
));
}
...
...
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/processor/TrafficProcessor.java
View file @
d9f6a1f
...
...
@@ -2,7 +2,6 @@ package com.viontech.fanxing.forward.batch.processor;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.viontech.fanxing.commons.model.Task
;
import
com.viontech.fanxing.commons.model.Traffic
;
import
com.viontech.fanxing.commons.model.TrafficFace
;
import
com.viontech.fanxing.forward.model.TrafficContent
;
...
...
@@ -18,7 +17,6 @@ import org.springframework.stereotype.Component;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Map
;
/**
* .
...
...
@@ -36,6 +34,7 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten
@Override
public
TrafficContent
process
(
JSONObject
item
)
throws
Exception
{
log
.
info
(
"收到 traffic 消息 , eventId:{}"
,
item
.
getString
(
"event_refid"
));
// final Map<String, Task> taskMap = cacheUtils.getTaskMap();
//
// String taskUnid = item.getString("task_id");
...
...
@@ -59,6 +58,7 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten
String
eventDt
=
item
.
getString
(
"event_dt"
);
Date
eventTime
=
DateUtil
.
parse
(
DateUtil
.
FORMAT_FULL
,
eventDt
);
String
channelUnid
=
item
.
getString
(
"vchan_refid"
);
String
picArray
=
item
.
getString
(
"pic_path_array"
);
// todo taskId
traffic
.
setEventCate
(
eventCate
);
...
...
@@ -66,6 +66,7 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten
traffic
.
setEventId
(
eventRefid
);
traffic
.
setEventDt
(
eventTime
);
traffic
.
setChannelUnid
(
channelUnid
);
traffic
.
setPics
(
picArray
);
// traffic.setTaskId(taskId);
JSONObject
eventData
=
item
.
getJSONObject
(
"event_data"
);
...
...
@@ -169,12 +170,12 @@ public class TrafficProcessor implements ItemProcessor<JSONObject, TrafficConten
trafficFace
.
setState
(
state
);
JSONObject
upbody
=
faceData
.
getJSONObject
(
"upbody"
);
if
(
upbody
!=
null
)
{
String
upperColor
=
upbody
.
getString
(
"co
lor
"
);
String
upperColor
=
upbody
.
getString
(
"co
de
"
);
trafficFace
.
setUpperColor
(
upperColor
);
}
JSONObject
lobody
=
faceData
.
getJSONObject
(
"lobody"
);
if
(
lobody
!=
null
)
{
String
lowerColor
=
lobody
.
getString
(
"co
lor
"
);
String
lowerColor
=
lobody
.
getString
(
"co
de
"
);
trafficFace
.
setLowerColor
(
lowerColor
);
}
trafficFaces
.
add
(
trafficFace
);
...
...
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/writer/BehaviorWriter.java
View file @
d9f6a1f
...
...
@@ -30,6 +30,5 @@ public class BehaviorWriter implements ItemWriter<Behavior> {
public
void
write
(
List
<?
extends
Behavior
>
items
)
throws
Exception
{
SqlParameterSource
[]
batchParam
=
SqlParameterSourceUtils
.
createBatch
(
items
);
namedParameterJdbcTemplate
.
batchUpdate
(
INSERT_BEHAVIOR
,
batchParam
);
}
}
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/writer/TrafficFlowWriter.java
View file @
d9f6a1f
...
...
@@ -24,8 +24,8 @@ import java.util.List;
public
class
TrafficFlowWriter
implements
ItemWriter
<
TrafficFlowContent
>
{
private
final
static
String
INSERT_FLOW_EVENT
=
"insert into d_flow_event ("
+
"task_id,event_type,event_time,event_id,device_code,device_name,location_code,location_name,json_data,pic
_name
,video_name) values("
+
":taskId,:eventType,:eventTime,:eventId,
,:deviceCode,:deviceName,:locationCode,:locationName,:jsonData,:picName
,:videoName)"
;
"task_id,event_type,event_time,event_id,device_code,device_name,location_code,location_name,json_data,pic
s
,video_name) values("
+
":taskId,:eventType,:eventTime,:eventId,
:deviceCode,:deviceName,:locationCode,:locationName,:jsonData,:pics
,:videoName)"
;
private
final
static
String
INSERT_FLOW_DATA
=
"insert into d_flow_data ("
+
"flow_event_id,task_id,detection_type,road_code,direction_code,sample_dura,sample_num,velocity,velocity_unit,occupy,distance,queue_length,region_id,region_name,position_content,head_content,area,density,sample_num_in,sample_num_out,event_time,dist_time,time_occupy) values ("
+
":flowEventId,:taskId,:detectionType,:roadCode,:directionCode,:sampleDura,:sampleNum,:velocity,:velocityUnit,:occupy,:distance,:queueLength,:regionId,:regionName,:positionContent,:headContent,:area,:density,:sampleNumIn,:sampleNumOut,:eventTime,:distTime,:timeOccupy)"
;
...
...
fanxing-forward/src/main/java/com/viontech/fanxing/forward/batch/writer/TrafficWriter.java
View file @
d9f6a1f
package
com
.
viontech
.
fanxing
.
forward
.
batch
.
writer
;
import
com.viontech.fanxing.commons.model.Traffic
;
import
com.viontech.fanxing.commons.model.TrafficFace
;
import
com.viontech.fanxing.forward.model.TrafficContent
;
import
org.springframework.batch.item.ItemWriter
;
...
...
@@ -12,6 +13,7 @@ import org.springframework.stereotype.Component;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* .
...
...
@@ -24,8 +26,8 @@ import java.util.List;
public
class
TrafficWriter
implements
ItemWriter
<
TrafficContent
>
{
private
final
static
String
INSERT_TRAFFIC
=
"insert into d_traffic ("
+
"event_cate,event_type,event_dt,channel_unid,plate_color,plate_number,location_code,location_name,lane_code,direction_code,vehicle_type,vehicle_color,vehicle_logo,illegal_code,illegal_state,feature_annual_inspection_mark,feature_pendant,feature_decoration,feature_sun_shield,xcycle_type,event_id,special_type,with_helmet,json_data,pic
_name
,video_name) values("
+
":eventCate,:eventType,:eventDt,:channelUnid,:plateColor,:plateNumber,:locationCode,:locationName,:laneCode,:directionCode,:vehicleType,:vehicleColor,:vehicleLogo,:illegalCode,:illegalState,:featureAnnualInspectionMark,:featurePendant,:featureDecoration,:featureSunShield,:xcycleType,:eventId,:specialType,:withHelmet,:jsonData,:pic
Name
,:videoName)"
;
"event_cate,event_type,event_dt,channel_unid,plate_color,plate_number,location_code,location_name,lane_code,direction_code,vehicle_type,vehicle_color,vehicle_logo,illegal_code,illegal_state,feature_annual_inspection_mark,feature_pendant,feature_decoration,feature_sun_shield,xcycle_type,event_id,special_type,with_helmet,json_data,pic
s
,video_name) values("
+
":eventCate,:eventType,:eventDt,:channelUnid,:plateColor,:plateNumber,:locationCode,:locationName,:laneCode,:directionCode,:vehicleType,:vehicleColor,:vehicleLogo,:illegalCode,:illegalState,:featureAnnualInspectionMark,:featurePendant,:featureDecoration,:featureSunShield,:xcycleType,:eventId,:specialType,:withHelmet,:jsonData,:pic
s
,:videoName)"
;
private
final
static
String
INSERT_TRAFFIC_FACE
=
"insert into d_traffic_face ("
+
"traffic_id,state,sex,upper_color,lower_color) values (:trafficId,:state,:sex,:upperColor,:lowerColor)"
;
...
...
@@ -55,7 +57,8 @@ public class TrafficWriter implements ItemWriter<TrafficContent> {
}
for
(
TrafficContent
item
:
list
)
{
List
<
TrafficFace
>
trafficFaces
=
item
.
getTrafficFaces
();
SqlParameterSource
[]
batch
=
SqlParameterSourceUtils
.
createBatch
(
item
);
Traffic
traffic
=
item
.
getTraffic
();
SqlParameterSource
[]
batch
=
SqlParameterSourceUtils
.
createBatch
(
traffic
);
SqlParameterSource
param
=
batch
[
0
];
GeneratedKeyHolder
generatedKeyHolder
=
new
GeneratedKeyHolder
();
namedParameterJdbcTemplate
.
update
(
INSERT_TRAFFIC
,
param
,
generatedKeyHolder
);
...
...
@@ -73,7 +76,8 @@ public class TrafficWriter implements ItemWriter<TrafficContent> {
if
(
list
==
null
||
list
.
size
()
==
0
)
{
return
;
}
SqlParameterSource
[]
batch
=
SqlParameterSourceUtils
.
createBatch
(
list
);
List
<
Traffic
>
trafficList
=
list
.
stream
().
map
(
TrafficContent:
:
getTraffic
).
collect
(
Collectors
.
toList
());
SqlParameterSource
[]
batch
=
SqlParameterSourceUtils
.
createBatch
(
trafficList
);
namedParameterJdbcTemplate
.
batchUpdate
(
INSERT_TRAFFIC
,
batch
);
}
}
fanxing-forward/src/main/java/com/viontech/fanxing/forward/util/PicUtils.java
0 → 100644
View file @
d9f6a1f
package
com
.
viontech
.
fanxing
.
forward
.
util
;
import
com.viontech.keliu.util.DateUtil
;
import
org.apache.commons.io.FileUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.Base64
;
import
java.util.Date
;
import
java.util.UUID
;
/**
* .
*
* @author 谢明辉
* @date 2021/7/19
*/
@Component
public
class
PicUtils
{
@Value
(
"${vion.pic.path:/images}"
)
private
String
basePath
;
public
String
savePic
(
String
unid
,
Date
date
,
String
format
,
byte
[]
data
)
throws
IOException
{
if
(
unid
==
null
||
""
.
equals
(
unid
))
{
unid
=
UUID
.
randomUUID
().
toString
();
}
int
i
=
unid
.
hashCode
();
i
^=
(
i
>>>
16
);
i
=
15
&
i
;
String
dateStr
=
DateUtil
.
format
(
"yyyyMMdd"
,
date
);
String
path
=
basePath
+
File
.
separator
+
dateStr
+
File
.
separator
+
i
+
File
.
separator
+
unid
+
"."
+
format
;
File
file
=
new
File
(
path
);
if
(!
file
.
getParentFile
().
exists
())
{
file
.
getParentFile
().
mkdirs
();
}
FileUtils
.
writeByteArrayToFile
(
file
,
data
);
return
path
;
}
public
String
savePicBase64
(
String
unid
,
Date
date
,
String
format
,
String
base64
)
throws
IOException
{
byte
[]
decode
=
Base64
.
getDecoder
().
decode
(
base64
);
return
savePic
(
unid
,
date
,
format
,
decode
);
}
}
fanxing-forward/src/main/resources/application.yml
View file @
d9f6a1f
...
...
@@ -22,14 +22,14 @@ spring:
ip-address
:
192.168.9.146
datasource
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://192.168.9.233:3306/fanxing3
url
:
jdbc:mysql://192.168.9.233:3306/fanxing3
?serverTimezone=Asia/Shanghai
username
:
root
password
:
123456
redis
:
host
:
localhost
host
:
192.168.9.233
port
:
6379
password
:
vionredis
database
:
2
password
:
3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database
:
15
jackson
:
date-format
:
yyyy-MM-dd HH:mm:ss
time-zone
:
GMT+8
...
...
@@ -48,6 +48,8 @@ pagehelper:
supportMethodsArguments
:
true
params
:
count=countByExample
vion
:
pic
:
path
:
G:\data
redisson
:
path
:
F:\myIDEAworkspace\jt\fanxing3\fanxing-commons\src\main\resources\redisson.yml
debug
:
true
\ No newline at end of file
fanxing-gateway/src/main/resources/application.yml
View file @
d9f6a1f
...
...
@@ -37,10 +37,10 @@ spring:
username
:
root
password
:
123456
redis
:
host
:
localhost
host
:
192.168.9.233
port
:
6379
password
:
vionredis
database
:
2
password
:
3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database
:
15
jackson
:
date-format
:
yyyy-MM-dd HH:mm:ss
time-zone
:
GMT+8
...
...
fanxing-ops/src/main/resources/application.yml
View file @
d9f6a1f
...
...
@@ -26,10 +26,10 @@ spring:
username
:
root
password
:
123456
redis
:
host
:
localhost
host
:
192.168.9.233
port
:
6379
password
:
vionredis
database
:
2
password
:
3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database
:
15
jackson
:
date-format
:
yyyy-MM-dd HH:mm:ss
time-zone
:
GMT+8
...
...
fanxing-query/src/main/java/com/viontech/fanxing/query/QueryApp.java
View file @
d9f6a1f
package
com
.
viontech
.
fanxing
.
query
;
import
lombok.extern.slf4j.Slf4j
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
...
...
@@ -17,6 +18,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling
@SpringBootApplication
(
scanBasePackages
=
"com.viontech.fanxing"
)
@EnableFeignClients
@MapperScan
(
basePackages
=
"com.viontech.fanxing.query.mapper"
)
@Slf4j
public
class
QueryApp
{
...
...
fanxing-query/src/main/java/com/viontech/fanxing/query/controller/base/BehaviorBaseController.java
View file @
d9f6a1f
...
...
@@ -4,11 +4,11 @@ import com.viontech.fanxing.commons.base.BaseController;
import
com.viontech.fanxing.commons.base.BaseExample
;
import
com.viontech.fanxing.commons.base.BaseMapper
;
import
com.viontech.fanxing.commons.base.BaseService
;
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.service.adapter.BehaviorService
;
import
com.viontech.fanxing.commons.vo.BehaviorVo
;
import
com.viontech.fanxing.query.mapper.BehaviorMapper
;
import
com.viontech.fanxing.query.service.adapter.BehaviorService
;
import
javax.annotation.Resource
;
public
abstract
class
BehaviorBaseController
extends
BaseController
<
Behavior
,
BehaviorVo
>
{
...
...
@@ -144,6 +144,22 @@ public abstract class BehaviorBaseController extends BaseController<Behavior, Be
if
(
behaviorVo
.
getEventTime_lte
()
!=
null
)
{
criteria
.
andEventTimeLessThanOrEqualTo
(
behaviorVo
.
getEventTime_lte
());
}
if
(
behaviorVo
.
getPics
()
!=
null
)
{
criteria
.
andPicsEqualTo
(
behaviorVo
.
getPics
());
}
if
(
behaviorVo
.
getPics_null
()
!=
null
)
{
if
(
behaviorVo
.
getPics_null
().
booleanValue
())
{
criteria
.
andPicsIsNull
();
}
else
{
criteria
.
andPicsIsNotNull
();
}
}
if
(
behaviorVo
.
getPics_arr
()
!=
null
)
{
criteria
.
andPicsIn
(
behaviorVo
.
getPics_arr
());
}
if
(
behaviorVo
.
getPics_like
()
!=
null
)
{
criteria
.
andPicsLike
(
behaviorVo
.
getPics_like
());
}
if
(
behaviorVo
.
getChannelUnid
()
!=
null
)
{
criteria
.
andChannelUnidEqualTo
(
behaviorVo
.
getChannelUnid
());
}
...
...
@@ -224,7 +240,6 @@ public abstract class BehaviorBaseController extends BaseController<Behavior, Be
if
(
behaviorVo
.
getEventDataNum_like
()
!=
null
)
{
criteria
.
andEventDataNumLike
(
behaviorVo
.
getEventDataNum_like
());
}
return
behaviorExample
;
}
...
...
fanxing-query/src/main/java/com/viontech/fanxing/query/controller/base/FlowEventBaseController.java
View file @
d9f6a1f
...
...
@@ -192,21 +192,21 @@ public abstract class FlowEventBaseController extends BaseController<FlowEvent,
if
(
flowEventVo
.
getLocationName_like
()
!=
null
)
{
criteria
.
andLocationNameLike
(
flowEventVo
.
getLocationName_like
());
}
if
(
flowEventVo
.
getPic
Name
()
!=
null
)
{
criteria
.
andPic
NameEqualTo
(
flowEventVo
.
getPicName
());
if
(
flowEventVo
.
getPic
s
()
!=
null
)
{
criteria
.
andPic
sEqualTo
(
flowEventVo
.
getPics
());
}
if
(
flowEventVo
.
getPic
Name
_null
()
!=
null
)
{
if
(
flowEventVo
.
getPic
Name
_null
().
booleanValue
())
{
criteria
.
andPic
Name
IsNull
();
if
(
flowEventVo
.
getPic
s
_null
()
!=
null
)
{
if
(
flowEventVo
.
getPic
s
_null
().
booleanValue
())
{
criteria
.
andPic
s
IsNull
();
}
else
{
criteria
.
andPic
Name
IsNotNull
();
criteria
.
andPic
s
IsNotNull
();
}
}
if
(
flowEventVo
.
getPic
Name
_arr
()
!=
null
)
{
criteria
.
andPic
NameIn
(
flowEventVo
.
getPicName
_arr
());
if
(
flowEventVo
.
getPic
s
_arr
()
!=
null
)
{
criteria
.
andPic
sIn
(
flowEventVo
.
getPics
_arr
());
}
if
(
flowEventVo
.
getPic
Name
_like
()
!=
null
)
{
criteria
.
andPic
NameLike
(
flowEventVo
.
getPicName
_like
());
if
(
flowEventVo
.
getPic
s
_like
()
!=
null
)
{
criteria
.
andPic
sLike
(
flowEventVo
.
getPics
_like
());
}
if
(
flowEventVo
.
getVideoName
()
!=
null
)
{
criteria
.
andVideoNameEqualTo
(
flowEventVo
.
getVideoName
());
...
...
@@ -224,6 +224,7 @@ public abstract class FlowEventBaseController extends BaseController<FlowEvent,
if
(
flowEventVo
.
getVideoName_like
()
!=
null
)
{
criteria
.
andVideoNameLike
(
flowEventVo
.
getVideoName_like
());
}
return
flowEventExample
;
}
...
...
fanxing-query/src/main/java/com/viontech/fanxing/query/controller/base/TrafficBaseController.java
View file @
d9f6a1f
This diff is collapsed.
Click to expand it.
fanxing-query/src/main/java/com/viontech/fanxing/query/mapping/BehaviorMapper.xml
View file @
d9f6a1f
...
...
@@ -9,6 +9,7 @@
<result
column=
"behavior_event_cate"
property=
"eventCate"
/>
<result
column=
"behavior_event_refid"
property=
"eventRefid"
/>
<result
column=
"behavior_event_time"
property=
"eventTime"
/>
<result
column=
"behavior_pics"
property=
"pics"
/>
<result
column=
"behavior_channel_unid"
property=
"channelUnid"
/>
<result
column=
"behavior_test_pic_file"
property=
"testPicFile"
/>
<result
column=
"behavior_test_frame_no"
property=
"testFrameNo"
/>
...
...
@@ -19,7 +20,6 @@
<resultMap
id=
"ResultMapWithBLOBs"
type=
"com.viontech.fanxing.commons.model.Behavior"
extends=
"BaseResultMap"
>
<result
column=
"behavior_aux_dev_info"
property=
"auxDevInfo"
jdbcType=
"LONGVARCHAR"
/>
<result
column=
"behavior_event_data"
property=
"eventData"
jdbcType=
"LONGVARCHAR"
/>
<result
column=
"behavior_pics"
property=
"pics"
jdbcType=
"LONGVARCHAR"
/>
<result
column=
"behavior_video"
property=
"video"
jdbcType=
"LONGVARCHAR"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
...
...
@@ -84,9 +84,9 @@
`behavior`.id as behavior_id, `behavior`.unid as behavior_unid, `behavior`.task_id as behavior_task_id,
`behavior`.event_type as behavior_event_type, `behavior`.event_cate as behavior_event_cate,
`behavior`.event_refid as behavior_event_refid, `behavior`.event_time as behavior_event_time,
`behavior`.
channel_unid as behavior_channel_unid, `behavior`.test_pic_file as behavior_test_pic_file
,
`behavior`.test_
frame_no as behavior_test_frame_no, `behavior`.task_name as behavior_task_name
,
`behavior`.event_data_num as behavior_event_data_num
`behavior`.
pics as behavior_pics, `behavior`.channel_unid as behavior_channel_unid
,
`behavior`.test_
pic_file as behavior_test_pic_file, `behavior`.test_frame_no as behavior_test_frame_no
,
`behavior`.
task_name as behavior_task_name, `behavior`.
event_data_num as behavior_event_data_num
</sql>
<sql
id=
"Base_Column_List"
>
<if
test=
"!(_parameter.getClass().getSimpleName() == 'BehaviorExample')"
>
...
...
@@ -109,7 +109,7 @@
</sql>
<sql
id=
"Blob_Column_List"
>
`behavior`.aux_dev_info as behavior_aux_dev_info, `behavior`.event_data as behavior_event_data,
`behavior`.
pics as behavior_pics, `behavior`.
video as behavior_video
`behavior`.video as behavior_video
</sql>
<select
id=
"selectByExampleWithBLOBs"
resultMap=
"ResultMapWithBLOBs"
parameterType=
"com.viontech.fanxing.commons.model.BehaviorExample"
>
select
...
...
@@ -168,15 +168,15 @@
<insert
id=
"insert"
parameterType=
"com.viontech.fanxing.commons.model.Behavior"
useGeneratedKeys=
"true"
keyProperty=
"id"
keyColumn=
"id"
>
insert into `d_behavior` (unid, task_id, event_type,
event_cate, event_refid, event_time,
channel_unid, test_pic_file, test_frame_no
,
t
ask_name, event_data_num, aux_dev_info
,
event_data, pics
, video
pics, channel_unid, test_pic_file
,
t
est_frame_no, task_name, event_data_num
,
aux_dev_info, event_data
, video
)
values (#{unid,jdbcType=VARCHAR}, #{taskId,jdbcType=BIGINT}, #{eventType,jdbcType=VARCHAR},
#{eventCate,jdbcType=VARCHAR}, #{eventRefid,jdbcType=VARCHAR}, #{eventTime,jdbcType=TIMESTAMP},
#{
channelUnid,jdbcType=VARCHAR}, #{testPicFile,jdbcType=VARCHAR}, #{testFrameNo
,jdbcType=VARCHAR},
#{t
askName,jdbcType=VARCHAR}, #{eventDataNum,jdbcType=VARCHAR}, #{auxDevInfo,jdbcType=LONG
VARCHAR},
#{
eventData,jdbcType=LONGVARCHAR}, #{pics
,jdbcType=LONGVARCHAR}, #{video,jdbcType=LONGVARCHAR}
#{
pics,jdbcType=VARCHAR}, #{channelUnid,jdbcType=VARCHAR}, #{testPicFile
,jdbcType=VARCHAR},
#{t
estFrameNo,jdbcType=VARCHAR}, #{taskName,jdbcType=VARCHAR}, #{eventDataNum,jdbcType=
VARCHAR},
#{
auxDevInfo,jdbcType=LONGVARCHAR}, #{eventData
,jdbcType=LONGVARCHAR}, #{video,jdbcType=LONGVARCHAR}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.viontech.fanxing.commons.model.Behavior"
useGeneratedKeys=
"true"
keyProperty=
"id"
keyColumn=
"id"
>
...
...
@@ -200,6 +200,9 @@
<if
test=
"eventTime != null"
>
event_time,
</if>
<if
test=
"pics != null"
>
pics,
</if>
<if
test=
"channelUnid != null"
>
channel_unid,
</if>
...
...
@@ -221,9 +224,6 @@
<if
test=
"eventData != null"
>
event_data,
</if>
<if
test=
"pics != null"
>
pics,
</if>
<if
test=
"video != null"
>
video,
</if>
...
...
@@ -247,6 +247,9 @@
<if
test=
"eventTime != null"
>
#{eventTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"pics != null"
>
#{pics,jdbcType=VARCHAR},
</if>
<if
test=
"channelUnid != null"
>
#{channelUnid,jdbcType=VARCHAR},
</if>
...
...
@@ -268,9 +271,6 @@
<if
test=
"eventData != null"
>
#{eventData,jdbcType=LONGVARCHAR},
</if>
<if
test=
"pics != null"
>
#{pics,jdbcType=LONGVARCHAR},
</if>
<if
test=
"video != null"
>
#{video,jdbcType=LONGVARCHAR},
</if>
...
...
@@ -306,6 +306,9 @@
<if
test=
"record.eventTime != null"
>
event_time = #{record.eventTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"record.pics != null"
>
pics = #{record.pics,jdbcType=VARCHAR},
</if>
<if
test=
"record.channelUnid != null"
>
channel_unid = #{record.channelUnid,jdbcType=VARCHAR},
</if>
...
...
@@ -327,9 +330,6 @@
<if
test=
"record.eventData != null"
>
event_data = #{record.eventData,jdbcType=LONGVARCHAR},
</if>
<if
test=
"record.pics != null"
>
pics = #{record.pics,jdbcType=LONGVARCHAR},
</if>
<if
test=
"record.video != null"
>
video = #{record.video,jdbcType=LONGVARCHAR},
</if>
...
...
@@ -347,6 +347,7 @@
`behavior`.event_cate = #{record.eventCate,jdbcType=VARCHAR},
`behavior`.event_refid = #{record.eventRefid,jdbcType=VARCHAR},
`behavior`.event_time = #{record.eventTime,jdbcType=TIMESTAMP},
`behavior`.pics = #{record.pics,jdbcType=VARCHAR},
`behavior`.channel_unid = #{record.channelUnid,jdbcType=VARCHAR},
`behavior`.test_pic_file = #{record.testPicFile,jdbcType=VARCHAR},
`behavior`.test_frame_no = #{record.testFrameNo,jdbcType=VARCHAR},
...
...
@@ -354,7 +355,6 @@
`behavior`.event_data_num = #{record.eventDataNum,jdbcType=VARCHAR},
`behavior`.aux_dev_info = #{record.auxDevInfo,jdbcType=LONGVARCHAR},
`behavior`.event_data = #{record.eventData,jdbcType=LONGVARCHAR},
`behavior`.pics = #{record.pics,jdbcType=LONGVARCHAR},
`behavior`.video = #{record.video,jdbcType=LONGVARCHAR}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
...
...
@@ -369,6 +369,7 @@
event_cate = #{record.eventCate,jdbcType=VARCHAR},
event_refid = #{record.eventRefid,jdbcType=VARCHAR},
event_time = #{record.eventTime,jdbcType=TIMESTAMP},
pics = #{record.pics,jdbcType=VARCHAR},
channel_unid = #{record.channelUnid,jdbcType=VARCHAR},
test_pic_file = #{record.testPicFile,jdbcType=VARCHAR},
test_frame_no = #{record.testFrameNo,jdbcType=VARCHAR},
...
...
@@ -399,6 +400,9 @@
<if
test=
"eventTime != null"
>
event_time = #{eventTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"pics != null"
>
pics = #{pics,jdbcType=VARCHAR},
</if>
<if
test=
"channelUnid != null"
>
channel_unid = #{channelUnid,jdbcType=VARCHAR},
</if>
...
...
@@ -420,9 +424,6 @@
<if
test=
"eventData != null"
>
event_data = #{eventData,jdbcType=LONGVARCHAR},
</if>
<if
test=
"pics != null"
>
pics = #{pics,jdbcType=LONGVARCHAR},
</if>
<if
test=
"video != null"
>
video = #{video,jdbcType=LONGVARCHAR},
</if>
...
...
@@ -437,6 +438,7 @@
event_cate = #{eventCate,jdbcType=VARCHAR},
event_refid = #{eventRefid,jdbcType=VARCHAR},
event_time = #{eventTime,jdbcType=TIMESTAMP},
pics = #{pics,jdbcType=VARCHAR},
channel_unid = #{channelUnid,jdbcType=VARCHAR},
test_pic_file = #{testPicFile,jdbcType=VARCHAR},
test_frame_no = #{testFrameNo,jdbcType=VARCHAR},
...
...
@@ -444,7 +446,6 @@
event_data_num = #{eventDataNum,jdbcType=VARCHAR},
aux_dev_info = #{auxDevInfo,jdbcType=LONGVARCHAR},
event_data = #{eventData,jdbcType=LONGVARCHAR},
pics = #{pics,jdbcType=LONGVARCHAR},
video = #{video,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
...
...
@@ -456,6 +457,7 @@
event_cate = #{eventCate,jdbcType=VARCHAR},
event_refid = #{eventRefid,jdbcType=VARCHAR},
event_time = #{eventTime,jdbcType=TIMESTAMP},
pics = #{pics,jdbcType=VARCHAR},
channel_unid = #{channelUnid,jdbcType=VARCHAR},
test_pic_file = #{testPicFile,jdbcType=VARCHAR},
test_frame_no = #{testFrameNo,jdbcType=VARCHAR},
...
...
fanxing-query/src/main/java/com/viontech/fanxing/query/mapping/FlowEventMapper.xml
View file @
d9f6a1f
...
...
@@ -12,7 +12,7 @@
<result
column=
"flowEvent_device_name"
property=
"deviceName"
/>
<result
column=
"flowEvent_location_code"
property=
"locationCode"
/>
<result
column=
"flowEvent_location_name"
property=
"locationName"
/>
<result
column=
"flowEvent_pic
_name"
property=
"picName
"
/>
<result
column=
"flowEvent_pic
s"
property=
"pics
"
/>
<result
column=
"flowEvent_video_name"
property=
"videoName"
/>
</resultMap>
<resultMap
id=
"BaseResultMap"
type=
"com.viontech.fanxing.commons.model.FlowEvent"
extends=
"BaseResultMapRoot"
/>
...
...
@@ -82,7 +82,7 @@
`flowEvent`.event_type as flowEvent_event_type, `flowEvent`.event_time as flowEvent_event_time,
`flowEvent`.event_id as flowEvent_event_id, `flowEvent`.device_code as flowEvent_device_code,
`flowEvent`.device_name as flowEvent_device_name, `flowEvent`.location_code as flowEvent_location_code,
`flowEvent`.location_name as flowEvent_location_name, `flowEvent`.pic
_name as flowEvent_pic_name
,
`flowEvent`.location_name as flowEvent_location_name, `flowEvent`.pic
s as flowEvent_pics
,
`flowEvent`.video_name as flowEvent_video_name
</sql>
<sql
id=
"Base_Column_List"
>
...
...
@@ -165,12 +165,12 @@
insert into `d_flow_event` (unid, task_id, event_type,
event_time, event_id, device_code,
device_name, location_code, location_name,
pic
_name
, video_name, json_data
pic
s
, video_name, json_data
)
values (#{unid,jdbcType=VARCHAR}, #{taskId,jdbcType=BIGINT}, #{eventType,jdbcType=VARCHAR},
#{eventTime,jdbcType=TIMESTAMP}, #{eventId,jdbcType=VARCHAR}, #{deviceCode,jdbcType=VARCHAR},
#{deviceName,jdbcType=VARCHAR}, #{locationCode,jdbcType=VARCHAR}, #{locationName,jdbcType=VARCHAR},
#{pic
Name
,jdbcType=VARCHAR}, #{videoName,jdbcType=VARCHAR}, #{jsonData,jdbcType=LONGVARCHAR}
#{pic
s
,jdbcType=VARCHAR}, #{videoName,jdbcType=VARCHAR}, #{jsonData,jdbcType=LONGVARCHAR}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.viontech.fanxing.commons.model.FlowEvent"
useGeneratedKeys=
"true"
keyProperty=
"id"
keyColumn=
"id"
>
...
...
@@ -203,8 +203,8 @@
<if
test=
"locationName != null"
>
location_name,
</if>
<if
test=
"pic
Name
!= null"
>
pic
_name
,
<if
test=
"pic
s
!= null"
>
pic
s
,
</if>
<if
test=
"videoName != null"
>
video_name,
...
...
@@ -241,8 +241,8 @@
<if
test=
"locationName != null"
>
#{locationName,jdbcType=VARCHAR},
</if>
<if
test=
"pic
Name
!= null"
>
#{pic
Name
,jdbcType=VARCHAR},
<if
test=
"pic
s
!= null"
>
#{pic
s
,jdbcType=VARCHAR},
</if>
<if
test=
"videoName != null"
>
#{videoName,jdbcType=VARCHAR},
...
...
@@ -291,8 +291,8 @@
<if
test=
"record.locationName != null"
>
location_name = #{record.locationName,jdbcType=VARCHAR},
</if>
<if
test=
"record.pic
Name
!= null"
>
pic
_name = #{record.picName
,jdbcType=VARCHAR},
<if
test=
"record.pic
s
!= null"
>
pic
s = #{record.pics
,jdbcType=VARCHAR},
</if>
<if
test=
"record.videoName != null"
>
video_name = #{record.videoName,jdbcType=VARCHAR},
...
...
@@ -317,7 +317,7 @@
`flowEvent`.device_name = #{record.deviceName,jdbcType=VARCHAR},
`flowEvent`.location_code = #{record.locationCode,jdbcType=VARCHAR},
`flowEvent`.location_name = #{record.locationName,jdbcType=VARCHAR},
`flowEvent`.pic
_name = #{record.picName
,jdbcType=VARCHAR},
`flowEvent`.pic
s = #{record.pics
,jdbcType=VARCHAR},
`flowEvent`.video_name = #{record.videoName,jdbcType=VARCHAR},
`flowEvent`.json_data = #{record.jsonData,jdbcType=LONGVARCHAR}
<if
test=
"_parameter != null"
>
...
...
@@ -336,7 +336,7 @@
device_name = #{record.deviceName,jdbcType=VARCHAR},
location_code = #{record.locationCode,jdbcType=VARCHAR},
location_name = #{record.locationName,jdbcType=VARCHAR},
pic
_name = #{record.picName
,jdbcType=VARCHAR},
pic
s = #{record.pics
,jdbcType=VARCHAR},
video_name = #{record.videoName,jdbcType=VARCHAR}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
...
...
@@ -372,8 +372,8 @@
<if
test=
"locationName != null"
>
location_name = #{locationName,jdbcType=VARCHAR},
</if>
<if
test=
"pic
Name
!= null"
>
pic
_name = #{picName
,jdbcType=VARCHAR},
<if
test=
"pic
s
!= null"
>
pic
s = #{pics
,jdbcType=VARCHAR},
</if>
<if
test=
"videoName != null"
>
video_name = #{videoName,jdbcType=VARCHAR},
...
...
@@ -395,7 +395,7 @@
device_name = #{deviceName,jdbcType=VARCHAR},
location_code = #{locationCode,jdbcType=VARCHAR},
location_name = #{locationName,jdbcType=VARCHAR},
pic
_name = #{picName
,jdbcType=VARCHAR},
pic
s = #{pics
,jdbcType=VARCHAR},
video_name = #{videoName,jdbcType=VARCHAR},
json_data = #{jsonData,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
...
...
@@ -411,7 +411,7 @@
device_name = #{deviceName,jdbcType=VARCHAR},
location_code = #{locationCode,jdbcType=VARCHAR},
location_name = #{locationName,jdbcType=VARCHAR},
pic
_name = #{picName
,jdbcType=VARCHAR},
pic
s = #{pics
,jdbcType=VARCHAR},
video_name = #{videoName,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
...
...
fanxing-query/src/main/java/com/viontech/fanxing/query/mapping/TrafficMapper.xml
View file @
d9f6a1f
...
...
@@ -28,7 +28,7 @@
<result
column=
"traffic_event_id"
property=
"eventId"
/>
<result
column=
"traffic_special_type"
property=
"specialType"
/>
<result
column=
"traffic_with_helmet"
property=
"withHelmet"
/>
<result
column=
"traffic_pic
_name"
property=
"picName
"
/>
<result
column=
"traffic_pic
s"
property=
"pics
"
/>
<result
column=
"traffic_video_name"
property=
"videoName"
/>
<result
column=
"traffic_status"
property=
"status"
/>
</resultMap>
...
...
@@ -107,8 +107,8 @@
`traffic`.feature_pendant as traffic_feature_pendant, `traffic`.feature_decoration as traffic_feature_decoration,
`traffic`.feature_sun_shield as traffic_feature_sun_shield, `traffic`.xcycle_type as traffic_xcycle_type,
`traffic`.event_id as traffic_event_id, `traffic`.special_type as traffic_special_type,
`traffic`.with_helmet as traffic_with_helmet, `traffic`.pic
_name as traffic_pic
_name,
`traffic`.
video_name as traffic_video_name, `traffic`.
`status` as `traffic_status`
`traffic`.with_helmet as traffic_with_helmet, `traffic`.pic
s as traffic_pics, `traffic`.video_name as traffic_video
_name,
`traffic`.`status` as `traffic_status`
</sql>
<sql
id=
"Base_Column_List"
>
<if
test=
"!(_parameter.getClass().getSimpleName() == 'TrafficExample')"
>
...
...
@@ -195,7 +195,7 @@
illegal_code, illegal_state, feature_annual_inspection_mark,
feature_pendant, feature_decoration, feature_sun_shield,
xcycle_type, event_id, special_type,
with_helmet, pic
_name
, video_name,
with_helmet, pic
s
, video_name,
`status`, json_data)
values (#{unid,jdbcType=VARCHAR}, #{taskId,jdbcType=BIGINT}, #{eventCate,jdbcType=VARCHAR},
#{eventType,jdbcType=VARCHAR}, #{eventDt,jdbcType=TIMESTAMP}, #{channelUnid,jdbcType=VARCHAR},
...
...
@@ -205,7 +205,7 @@
#{illegalCode,jdbcType=VARCHAR}, #{illegalState,jdbcType=INTEGER}, #{featureAnnualInspectionMark,jdbcType=SMALLINT},
#{featurePendant,jdbcType=SMALLINT}, #{featureDecoration,jdbcType=SMALLINT}, #{featureSunShield,jdbcType=SMALLINT},
#{xcycleType,jdbcType=VARCHAR}, #{eventId,jdbcType=VARCHAR}, #{specialType,jdbcType=VARCHAR},
#{withHelmet,jdbcType=INTEGER}, #{pic
Name
,jdbcType=VARCHAR}, #{videoName,jdbcType=VARCHAR},
#{withHelmet,jdbcType=INTEGER}, #{pic
s
,jdbcType=VARCHAR}, #{videoName,jdbcType=VARCHAR},
#{status,jdbcType=INTEGER}, #{jsonData,jdbcType=LONGVARCHAR})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.viontech.fanxing.commons.model.Traffic"
useGeneratedKeys=
"true"
keyProperty=
"id"
keyColumn=
"id"
>
...
...
@@ -286,8 +286,8 @@
<if
test=
"withHelmet != null"
>
with_helmet,
</if>
<if
test=
"pic
Name
!= null"
>
pic
_name
,
<if
test=
"pic
s
!= null"
>
pic
s
,
</if>
<if
test=
"videoName != null"
>
video_name,
...
...
@@ -375,8 +375,8 @@
<if
test=
"withHelmet != null"
>
#{withHelmet,jdbcType=INTEGER},
</if>
<if
test=
"pic
Name
!= null"
>
#{pic
Name
,jdbcType=VARCHAR},
<if
test=
"pic
s
!= null"
>
#{pic
s
,jdbcType=VARCHAR},
</if>
<if
test=
"videoName != null"
>
#{videoName,jdbcType=VARCHAR},
...
...
@@ -476,8 +476,8 @@
<if
test=
"record.withHelmet != null"
>
with_helmet = #{record.withHelmet,jdbcType=INTEGER},
</if>
<if
test=
"record.pic
Name
!= null"
>
pic
_name = #{record.picName
,jdbcType=VARCHAR},
<if
test=
"record.pic
s
!= null"
>
pic
s = #{record.pics
,jdbcType=VARCHAR},
</if>
<if
test=
"record.videoName != null"
>
video_name = #{record.videoName,jdbcType=VARCHAR},
...
...
@@ -521,7 +521,7 @@
`traffic`.event_id = #{record.eventId,jdbcType=VARCHAR},
`traffic`.special_type = #{record.specialType,jdbcType=VARCHAR},
`traffic`.with_helmet = #{record.withHelmet,jdbcType=INTEGER},
`traffic`.pic
_name = #{record.picName
,jdbcType=VARCHAR},
`traffic`.pic
s = #{record.pics
,jdbcType=VARCHAR},
`traffic`.video_name = #{record.videoName,jdbcType=VARCHAR},
`traffic`.`status` = #{record.status,jdbcType=INTEGER},
`traffic`.json_data = #{record.jsonData,jdbcType=LONGVARCHAR}
...
...
@@ -557,7 +557,7 @@
event_id = #{record.eventId,jdbcType=VARCHAR},
special_type = #{record.specialType,jdbcType=VARCHAR},
with_helmet = #{record.withHelmet,jdbcType=INTEGER},
pic
_name = #{record.picName
,jdbcType=VARCHAR},
pic
s = #{record.pics
,jdbcType=VARCHAR},
video_name = #{record.videoName,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=INTEGER}
<if
test=
"_parameter != null"
>
...
...
@@ -642,8 +642,8 @@
<if
test=
"withHelmet != null"
>
with_helmet = #{withHelmet,jdbcType=INTEGER},
</if>
<if
test=
"pic
Name
!= null"
>
pic
_name = #{picName
,jdbcType=VARCHAR},
<if
test=
"pic
s
!= null"
>
pic
s = #{pics
,jdbcType=VARCHAR},
</if>
<if
test=
"videoName != null"
>
video_name = #{videoName,jdbcType=VARCHAR},
...
...
@@ -684,7 +684,7 @@
event_id = #{eventId,jdbcType=VARCHAR},
special_type = #{specialType,jdbcType=VARCHAR},
with_helmet = #{withHelmet,jdbcType=INTEGER},
pic
_name = #{picName
,jdbcType=VARCHAR},
pic
s = #{pics
,jdbcType=VARCHAR},
video_name = #{videoName,jdbcType=VARCHAR},
`status` = #{status,jdbcType=INTEGER},
json_data = #{jsonData,jdbcType=LONGVARCHAR}
...
...
@@ -717,7 +717,7 @@
event_id = #{eventId,jdbcType=VARCHAR},
special_type = #{specialType,jdbcType=VARCHAR},
with_helmet = #{withHelmet,jdbcType=INTEGER},
pic
_name = #{picName
,jdbcType=VARCHAR},
pic
s = #{pics
,jdbcType=VARCHAR},
video_name = #{videoName,jdbcType=VARCHAR},
`status` = #{status,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
...
...
fanxing-query/src/main/resources/application.yml
View file @
d9f6a1f
...
...
@@ -26,10 +26,10 @@ spring:
username
:
root
password
:
123456
redis
:
host
:
localhost
host
:
192.168.9.233
port
:
6379
password
:
vionredis
database
:
2
password
:
3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database
:
15
jackson
:
date-format
:
yyyy-MM-dd HH:mm:ss
time-zone
:
GMT+8
...
...
fanxing-task-manager/src/main/resources/application.yml
View file @
d9f6a1f
...
...
@@ -26,10 +26,10 @@ spring:
username
:
root
password
:
123456
redis
:
host
:
localhost
host
:
192.168.9.233
port
:
6379
password
:
vionredis
database
:
2
password
:
3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database
:
15
jackson
:
date-format
:
yyyy-MM-dd HH:mm:ss
time-zone
:
GMT+8
...
...
fanxing-task-scheduling/src/main/java/com/viontech/fanxing/task/scheduling/controller/TaskController.java
View file @
d9f6a1f
...
...
@@ -63,8 +63,8 @@ public class TaskController implements TaskSchedulingTasksAdapter {
@DeleteMapping
public
JsonMessageUtil
.
JsonMessage
delete
(
Task
task
)
{
String
unid
=
task
.
getUnid
();
taskService
.
removeTaskDataAll
(
unid
);
vaServerService
.
terminateTask
(
task
);
taskService
.
removeTaskDataAll
(
unid
);
// todo
return
JsonMessageUtil
.
getSuccessJsonMsg
(
"success"
);
}
...
...
fanxing-task-scheduling/src/main/java/com/viontech/fanxing/task/scheduling/controller/VAServerController.java
View file @
d9f6a1f
...
...
@@ -33,9 +33,5 @@ public class VAServerController {
return
"success"
;
}
@PostMapping
(
"/status"
)
public
Object
status
()
{
// todo
return
null
;
}
}
fanxing-task-scheduling/src/main/java/com/viontech/fanxing/task/scheduling/runner/TaskRunner.java
View file @
d9f6a1f
...
...
@@ -61,7 +61,7 @@ public class TaskRunner {
Double
score
=
next
.
getScore
();
String
taskUnid
=
next
.
getValue
();
if
(
System
.
currentTimeMillis
()
<
score
)
{
return
;
break
;
}
else
{
TaskData
taskData
=
taskDataMap
.
get
(
taskUnid
);
Task
task
=
taskData
.
getTask
();
...
...
@@ -84,7 +84,7 @@ public class TaskRunner {
}
boolean
success
=
vaServerService
.
executeTask
(
task
,
server
);
// todo
获取可用的vaserver,执行任务下发动作,如果成功,关联taskData和vaServer,修改可用资源数,并且从zset中移除任务,
修改任务状态
// todo 修改任务状态
set
.
remove
(
taskUnid
);
}
...
...
fanxing-task-scheduling/src/main/java/com/viontech/fanxing/task/scheduling/service/VAServerService.java
View file @
d9f6a1f
...
...
@@ -28,6 +28,9 @@ public class VAServerService {
@Resource
private
RedissonClient
redissonClient
;
/**
* 设备注册
*/
public
void
registeVAServer
(
VaServerInfo
vaServerInfo
)
{
String
devID
=
vaServerInfo
.
getDevID
();
RMap
<
String
,
VaServerInfo
>
map
=
redissonClient
.
getMap
(
RedisKeys
.
SCHEDULING_VASERVER_MAP
);
...
...
@@ -37,6 +40,9 @@ public class VAServerService {
map
.
put
(
devID
,
vaServerInfo
);
}
/**
* 设备心跳
*/
public
void
keepalive
(
String
devId
)
{
RBucket
<
Object
>
bucket
=
redissonClient
.
getBucket
(
RedisKeys
.
getVAServerKeepAliveKey
(
devId
));
bucket
.
set
(
1
);
...
...
@@ -63,26 +69,44 @@ public class VAServerService {
}
/**
* 下发任务
* 下发任务
,关联任务和vaServer,修改vaServer可用资源数
*/
public
boolean
executeTask
(
Task
task
,
VaServerInfo
server
)
{
// todo 执行任务下发
linkTaskAndVaServer
(
task
.
getUnid
(),
server
.
getDevID
());
server
.
setAvailableResources
(
server
.
getAvailableResources
()
-
task
.
getResourceNeed
());
return
false
;
}
/**
* 1. 解除任务和vaServer的关联
* 2. vaServer 资源数增加
* 3. 请求 vaServer 终止任务
* <p>
* 删除任务
*/
public
boolean
terminateTask
(
Task
task
)
{
ImmutablePair
<
String
,
String
>
unlinkResult
=
unlinkTaskAndVaServer
(
task
.
getUnid
());
String
devId
=
unlinkResult
.
right
;
String
taskUnid
=
task
.
getUnid
();
RMap
<
String
,
String
>
map
=
redissonClient
.
getMap
(
RedisKeys
.
SCHEDULING_TASK_VASERVER_MAP
);
String
vaServerId
=
map
.
get
(
taskUnid
);
// todo 下发终止任务请求
// 解除任务和 vaServer 关联
map
.
remove
(
taskUnid
);
RMap
<
String
,
VaServerInfo
>
vaServerMap
=
redissonClient
.
getMap
(
RedisKeys
.
SCHEDULING_VASERVER_MAP
);
VaServerInfo
vaServerInfo
=
vaServerMap
.
get
(
dev
Id
);
VaServerInfo
vaServerInfo
=
vaServerMap
.
get
(
vaServer
Id
);
vaServerInfo
.
setAvailableResources
(
vaServerInfo
.
getAvailableResources
()
+
task
.
getResourceNeed
());
vaServerMap
.
put
(
devId
,
vaServerInfo
);
vaServerMap
.
put
(
vaServerId
,
vaServerInfo
);
return
false
;
}
/**
* 修改任务
*/
public
boolean
modifyTask
(
Task
task
)
{
return
false
;
}
...
...
@@ -96,19 +120,19 @@ public class VAServerService {
}
/**
* 获取
rtsp流
点播地址
* 获取点播地址
*/
public
Object
get
RtspPath
(
)
{
public
Object
get
VideoOnDemandAddress
(
Task
task
)
{
return
null
;
}
/**
*
主动推送rtmp
流
*
输出分析
流
*/
public
Object
rtmp
()
{
return
null
;
public
void
outputAnalysisStream
(
Task
task
)
{
}
/**
* 录像上传
*/
...
...
@@ -116,4 +140,12 @@ public class VAServerService {
return
null
;
}
/**
* 获取 VAServer 运行状态配置参数等
*/
public
Object
getVAServerStatus
(
String
devId
)
{
return
null
;
}
}
fanxing-task-scheduling/src/main/resources/application.yml
View file @
d9f6a1f
...
...
@@ -21,10 +21,10 @@ spring:
instance-id
:
${spring.application.name}:${spring.cloud.consul.discovery.ip-address}:${server.port}
ip-address
:
192.168.9.146
redis
:
host
:
localhost
host
:
192.168.9.233
port
:
6379
password
:
vionredis
database
:
2
password
:
3c61f2e4c4d1877ef9d01319c3a0fccaeabb1518
database
:
15
jackson
:
date-format
:
yyyy-MM-dd HH:mm:ss
time-zone
:
GMT+8
...
...
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