Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wj-datacenter-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jinan
wj-datacenter-platform
Commits
370538b2
Commit
370538b2
authored
May 11, 2024
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 测试平台-停车事件接收入库优化
parent
d4287251
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
196 additions
and
52 deletions
+196
-52
EventAnalysis.java
.../main/java/com/wanji/indicators/entity/EventAnalysis.java
+3
-1
EventInfo.java
.../src/main/java/com/wanji/indicators/entity/EventInfo.java
+101
-0
EventInfoMapper.java
...ain/java/com/wanji/indicators/mapper/EventInfoMapper.java
+11
-0
LaneParkEventReceiveMain.java
...citybrainreceive/event/park/LaneParkEventReceiveMain.java
+3
-3
LaneParkEventReceiveMap.java
.../citybrainreceive/event/park/LaneParkEventReceiveMap.java
+58
-27
LaneParkEventSaveFunction.java
...itybrainreceive/event/park/LaneParkEventSaveFunction.java
+8
-8
LaneStatisticsReceiveMain.java
...rainreceive/lanestatistics/LaneStatisticsReceiveMain.java
+10
-10
EventInfoMapper.xml
...e-computing/src/main/resources/mapper/EventInfoMapper.xml
+2
-3
No files found.
wj-realtime-computing/src/main/java/com/wanji/indicators/entity/EventAnalysis.java
View file @
370538b2
package
com
.
wanji
.
indicators
.
entity
;
package
com
.
wanji
.
indicators
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
...
@@ -9,6 +10,7 @@ import java.util.Date;
...
@@ -9,6 +10,7 @@ import java.util.Date;
@Data
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@EqualsAndHashCode
(
callSuper
=
false
)
@TableName
(
"t_analysis_event"
)
public
class
EventAnalysis
implements
Serializable
{
public
class
EventAnalysis
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
wj-realtime-computing/src/main/java/com/wanji/indicators/entity/EventInfo.java
0 → 100644
View file @
370538b2
package
com
.
wanji
.
indicators
.
entity
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@TableName
(
"t_event_info"
)
@ApiModel
(
value
=
"EventInfo"
,
description
=
"交通事件信息"
)
public
class
EventInfo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"主键ID"
,
hidden
=
true
)
@JSONField
(
serialize
=
false
)
private
Long
oid
;
@ApiModelProperty
(
value
=
"车牌号"
)
private
String
plateNo
;
@ApiModelProperty
(
value
=
"参与者类别 1:机动车 2:非机动车 3:行人"
)
private
String
objectType
;
@ApiModelProperty
(
value
=
"可信度"
)
private
Integer
confidence
;
@ApiModelProperty
(
value
=
"检测时间"
,
notes
=
"格式:yyyy-MM-dd HH:mm:ss"
)
@JSONField
(
format
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
detectTime
;
@ApiModelProperty
(
value
=
"事件等级:1扣分 2 罚款 3警告 0 未知"
)
private
Integer
grade
;
@ApiModelProperty
(
value
=
"事件地点描述"
)
private
String
placeDesc
;
@ApiModelProperty
(
value
=
"发生地点经度"
)
private
BigDecimal
lng
;
@ApiModelProperty
(
value
=
"发生地点纬度"
)
private
BigDecimal
lat
;
@ApiModelProperty
(
value
=
"事件一级类别 1:非机动事件 2:行人事件 3:机动车事件"
)
private
String
category
;
@ApiModelProperty
(
value
=
"二级类别"
)
@JsonProperty
(
"eventType"
)
@JSONField
(
name
=
"eventType"
)
private
String
type
;
@ApiModelProperty
(
value
=
"事件发生时间"
)
@JSONField
(
format
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
startTime
;
@ApiModelProperty
(
value
=
"事件结束时间"
)
@JSONField
(
format
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
endTime
;
@ApiModelProperty
(
value
=
"事件持续时长,单位分钟"
)
private
Integer
duration
;
@ApiModelProperty
(
value
=
"事件来源"
)
private
String
source
;
@ApiModelProperty
(
value
=
"车道ID"
)
private
String
laneId
;
@ApiModelProperty
(
value
=
"路段ID"
)
private
String
rid
;
@ApiModelProperty
(
value
=
"路口ID"
)
private
String
crossId
;
@ApiModelProperty
(
value
=
"渠化ID"
)
private
String
segmentId
;
@ApiModelProperty
(
value
=
"关联的事件摄像头信息ID"
)
private
String
cameraOid
;
@ApiModelProperty
(
value
=
"序列号"
)
private
String
eventSerialNumber
;
@ApiModelProperty
(
value
=
"事件状态"
)
private
String
dataStatus
;
private
String
globalId
;
private
Integer
stationId
;
private
String
eventId
;
@ApiModelProperty
(
value
=
"入库时间"
,
hidden
=
true
)
@JSONField
(
serialize
=
false
)
private
LocalDateTime
ruksj
;
}
wj-realtime-computing/src/main/java/com/wanji/indicators/mapper/Event
Analysis
Mapper.java
→
wj-realtime-computing/src/main/java/com/wanji/indicators/mapper/Event
Info
Mapper.java
View file @
370538b2
package
com
.
wanji
.
indicators
.
mapper
;
package
com
.
wanji
.
indicators
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.wanji.indicators.entity.Event
Analysis
;
import
com.wanji.indicators.entity.Event
Info
;
public
interface
EventAnalysisMapper
extends
BaseMapper
<
EventAnalysis
>
{
/**
* @author duanruiming
* @date 2024/05/10 10:34
*/
public
interface
EventInfoMapper
extends
BaseMapper
<
EventInfo
>
{
}
}
wj-realtime-computing/src/main/java/com/wanji/indicators/task/citybrainreceive/event/park/LaneParkEventReceiveMain.java
View file @
370538b2
package
com
.
wanji
.
indicators
.
task
.
citybrainreceive
.
event
.
park
;
package
com
.
wanji
.
indicators
.
task
.
citybrainreceive
.
event
.
park
;
import
com.wanji.indicators.entity.Event
Analysis
;
import
com.wanji.indicators.entity.Event
Info
;
import
com.wanji.indicators.util.PropertiesHelper
;
import
com.wanji.indicators.util.PropertiesHelper
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.flink.api.common.eventtime.WatermarkStrategy
;
import
org.apache.flink.api.common.eventtime.WatermarkStrategy
;
...
@@ -48,11 +48,11 @@ public class LaneParkEventReceiveMain {
...
@@ -48,11 +48,11 @@ public class LaneParkEventReceiveMain {
DataStream
<
String
>
stream
=
env
.
fromSource
(
source
,
WatermarkStrategy
.
noWatermarks
(),
DataStream
<
String
>
stream
=
env
.
fromSource
(
source
,
WatermarkStrategy
.
noWatermarks
(),
"city-brain-laneParkEvent-receive-data-source"
);
"city-brain-laneParkEvent-receive-data-source"
);
SingleOutputStreamOperator
<
List
<
Event
Analysis
>>
eventAnalysis
Stream
=
stream
SingleOutputStreamOperator
<
List
<
Event
Info
>>
eventInfo
Stream
=
stream
.
map
(
new
LaneParkEventReceiveMap
())
.
map
(
new
LaneParkEventReceiveMap
())
.
name
(
"接收城市大脑车道停车事件数据-JsonToObject"
);
.
name
(
"接收城市大脑车道停车事件数据-JsonToObject"
);
event
Analysis
Stream
.
addSink
(
new
LaneParkEventSaveFunction
());
event
Info
Stream
.
addSink
(
new
LaneParkEventSaveFunction
());
// 启动 Flink 作业
// 启动 Flink 作业
env
.
execute
(
"接收城市大脑车道停车事件数据存入数据库"
);
env
.
execute
(
"接收城市大脑车道停车事件数据存入数据库"
);
...
...
wj-realtime-computing/src/main/java/com/wanji/indicators/task/citybrainreceive/event/park/LaneParkEventReceiveMap.java
View file @
370538b2
...
@@ -2,19 +2,26 @@ package com.wanji.indicators.task.citybrainreceive.event.park;
...
@@ -2,19 +2,26 @@ package com.wanji.indicators.task.citybrainreceive.event.park;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.wanji.indicators.entity.EventAnalysis
;
import
com.wanji.indicators.constant.Constant
;
import
com.wanji.indicators.entity.EventInfo
;
import
com.wanji.indicators.task.citybrain.vo.LaneParkEventVO
;
import
com.wanji.indicators.task.citybrain.vo.LaneParkEventVO
;
import
com.wanji.indicators.task.citybrainreceive.CommonReceiveModel
;
import
com.wanji.indicators.task.citybrainreceive.CommonReceiveModel
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.common.framework.Constants
;
import
net.wanji.common.framework.Constants
;
import
net.wanji.common.utils.tool.DateUtil
;
import
net.wanji.common.utils.tool.DateUtil
;
import
net.wanji.common.utils.tool.JacksonUtils
;
import
net.wanji.common.utils.tool.JacksonUtils
;
import
net.wanji.common.utils.tool.StringUtils
;
import
org.apache.flink.api.common.functions.MapFunction
;
import
org.apache.flink.api.common.functions.MapFunction
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.time.Instant
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.time.ZoneId
;
import
java.time.ZonedDateTime
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -23,35 +30,59 @@ import java.util.List;
...
@@ -23,35 +30,59 @@ import java.util.List;
* @date 2024/04/11 9:34
* @date 2024/04/11 9:34
*/
*/
@Service
@Service
public
class
LaneParkEventReceiveMap
implements
MapFunction
<
String
,
List
<
EventAnalysis
>>
{
@Slf4j
public
class
LaneParkEventReceiveMap
implements
MapFunction
<
String
,
List
<
EventInfo
>>
{
@Override
@Override
public
List
<
EventAnalysis
>
map
(
String
value
)
throws
Exception
{
public
List
<
EventInfo
>
map
(
String
value
)
throws
Exception
{
ObjectMapper
mapper
=
JacksonUtils
.
getInstance
();
try
{
CommonReceiveModel
model
=
mapper
.
readValue
(
value
,
CommonReceiveModel
.
class
);
ObjectMapper
mapper
=
JacksonUtils
.
getInstance
();
String
body
=
model
.
getBody
();
CommonReceiveModel
model
=
mapper
.
readValue
(
value
,
CommonReceiveModel
.
class
);
List
<
EventAnalysis
>
eventAnalyses
=
new
ArrayList
<>();
String
body
=
model
.
getBody
();
List
<
LaneParkEventVO
>
laneParkEventVOS
=
mapper
.
readValue
(
body
,
new
TypeReference
<
List
<
LaneParkEventVO
>>()
{});
String
headers
=
model
.
getHeaders
();
if
(!
CollectionUtils
.
isEmpty
(
laneParkEventVOS
))
{
if
(
StringUtils
.
isNotBlank
(
headers
)
&&
headers
.
contains
(
Constant
.
WAN_JI_NAME
))
{
for
(
LaneParkEventVO
laneParkEventVO
:
laneParkEventVOS
)
{
return
Collections
.
emptyList
();
}
List
<
EventInfo
>
eventInfos
=
new
ArrayList
<>();
List
<
LaneParkEventVO
>
laneParkEventVOS
=
mapper
.
readValue
(
body
,
new
TypeReference
<
List
<
LaneParkEventVO
>>()
{
});
if
(!
CollectionUtils
.
isEmpty
(
laneParkEventVOS
))
{
for
(
LaneParkEventVO
laneParkEventVO
:
laneParkEventVOS
)
{
String
dataTime
=
laneParkEventVO
.
getData_time
();
Instant
instant
=
Instant
.
ofEpochMilli
(
Long
.
parseLong
(
dataTime
));
ZonedDateTime
zonedDateTime
=
instant
.
atZone
(
ZoneId
.
of
(
"+8"
));
LocalDateTime
localDateTime
=
zonedDateTime
.
toLocalDateTime
();
String
dataTime
=
laneParkEventVO
.
getData_time
();
Date
date
=
new
Date
(
Long
.
parseLong
(
dataTime
));
Date
date
=
new
Date
(
Integer
.
parseInt
(
dataTime
));
String
dateStr
=
DateUtil
.
format
(
date
,
Constants
.
DATE_FORMAT
.
E_DATE_FORMAT_MILLIS
);
String
dateStr
=
DateUtil
.
format
(
date
,
Constants
.
DATE_FORMAT
.
E_DATE_FORMAT_MILLIS
);
EventInfo
eventInfo
=
new
EventInfo
();
LocalDateTime
localDateTime
=
date
.
toInstant
().
atZone
(
ZoneId
.
systemDefault
()).
toLocalDateTime
();
eventInfo
.
setDetectTime
(
localDateTime
);
EventAnalysis
eventAnalysis
=
new
EventAnalysis
();
eventInfo
.
setCategory
(
"1"
);
eventAnalysis
.
setOid
(
Integer
.
parseInt
(
dataTime
));
eventInfo
.
setType
(
"401"
);
eventAnalysis
.
setEventCategory
(
"1"
);
eventInfo
.
setStartTime
(
localDateTime
);
eventAnalysis
.
setEventType
(
"401"
);
//eventInfo.setEndTime(localDateTime);
eventAnalysis
.
setRuksj
(
localDateTime
);
eventInfo
.
setDuration
(
0
);
eventAnalysis
.
setWindowStartTime
(
date
);
eventInfo
.
setRuksj
(
localDateTime
);
eventAnalysis
.
setWindowEndTime
(
DateUtil
.
addMinute
(
dateStr
,
5
));
eventInfo
.
setLaneId
(
laneParkEventVO
.
getLaneId
());
eventAnalysis
.
setGranularity
(
"5m"
);
eventInfo
.
setCrossId
(
laneParkEventVO
.
getDeviceNo
());
eventAnalysis
.
setCrossId
(
laneParkEventVO
.
getDeviceNo
());
eventInfo
.
setEventSerialNumber
(
laneParkEventVO
.
getDeviceNo
()
+
dataTime
);
eventAnalysis
.
setLaneId
(
laneParkEventVO
.
getLaneId
());
eventInfo
.
setPlateNo
(
laneParkEventVO
.
getPlateNumber
());
eventAnalyses
.
add
(
eventAnalysis
);
String
geography
=
laneParkEventVO
.
getGeography
();
String
[]
split
=
null
;
if
(
StringUtils
.
isNotBlank
(
geography
))
{
split
=
geography
.
replaceAll
(
"\\["
,
""
).
replaceAll
(
"\\]"
,
""
).
split
(
","
);
eventInfo
.
setLng
(
new
BigDecimal
(
split
[
0
]));
eventInfo
.
setLat
(
new
BigDecimal
(
split
[
1
]));
}
eventInfo
.
setPlaceDesc
(
laneParkEventVO
.
getType
()
+
"-"
+
laneParkEventVO
.
getState
());
eventInfos
.
add
(
eventInfo
);
}
}
}
}
return
eventAnalyses
;
return
eventInfos
;
}
catch
(
Exception
e
)
{
log
.
error
(
"停车事件数据转化异常:"
,
e
);
throw
new
RuntimeException
(
e
);
}
}
}
}
}
\ No newline at end of file
wj-realtime-computing/src/main/java/com/wanji/indicators/task/citybrainreceive/event/park/LaneParkEventSaveFunction.java
View file @
370538b2
package
com
.
wanji
.
indicators
.
task
.
citybrainreceive
.
event
.
park
;
package
com
.
wanji
.
indicators
.
task
.
citybrainreceive
.
event
.
park
;
import
com.wanji.indicators.entity.Event
Analysis
;
import
com.wanji.indicators.entity.Event
Info
;
import
com.wanji.indicators.mapper.Event
Analysis
Mapper
;
import
com.wanji.indicators.mapper.Event
Info
Mapper
;
import
org.apache.flink.configuration.Configuration
;
import
org.apache.flink.configuration.Configuration
;
import
org.apache.flink.streaming.api.functions.sink.RichSinkFunction
;
import
org.apache.flink.streaming.api.functions.sink.RichSinkFunction
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContext
;
...
@@ -16,22 +16,22 @@ import java.util.List;
...
@@ -16,22 +16,22 @@ import java.util.List;
* @date 2024/04/16 16:15
* @date 2024/04/16 16:15
*/
*/
@Service
@Service
public
class
LaneParkEventSaveFunction
extends
RichSinkFunction
<
List
<
Event
Analysis
>>
{
public
class
LaneParkEventSaveFunction
extends
RichSinkFunction
<
List
<
Event
Info
>>
{
Event
AnalysisMapper
eventAnalysis
Mapper
;
Event
InfoMapper
eventInfo
Mapper
;
@Override
@Override
public
void
open
(
Configuration
parameters
)
throws
Exception
{
public
void
open
(
Configuration
parameters
)
throws
Exception
{
super
.
open
(
parameters
);
super
.
open
(
parameters
);
ApplicationContext
beanConf
=
new
ClassPathXmlApplicationContext
(
"spring-container.xml"
);
ApplicationContext
beanConf
=
new
ClassPathXmlApplicationContext
(
"spring-container.xml"
);
event
AnalysisMapper
=
beanConf
.
getBean
(
EventAnalysis
Mapper
.
class
);
event
InfoMapper
=
beanConf
.
getBean
(
EventInfo
Mapper
.
class
);
}
}
@Override
@Override
public
void
invoke
(
List
<
Event
Analysis
>
value
,
Context
context
)
throws
Exception
{
public
void
invoke
(
List
<
Event
Info
>
value
,
Context
context
)
throws
Exception
{
if
(!
CollectionUtils
.
isEmpty
(
value
))
{
if
(!
CollectionUtils
.
isEmpty
(
value
))
{
for
(
Event
Analysis
eventAnalysis
:
value
)
{
for
(
Event
Info
eventInfo
:
value
)
{
event
AnalysisMapper
.
insert
(
eventAnalysis
);
event
InfoMapper
.
insert
(
eventInfo
);
}
}
}
}
}
}
...
...
wj-realtime-computing/src/main/java/com/wanji/indicators/task/citybrainreceive/lanestatistics/LaneStatisticsReceiveMain.java
View file @
370538b2
...
@@ -38,19 +38,19 @@ public class LaneStatisticsReceiveMain {
...
@@ -38,19 +38,19 @@ public class LaneStatisticsReceiveMain {
String
statisticsTopic
=
properties
.
getProperty
(
"lane.statistics.receive.topic"
);
String
statisticsTopic
=
properties
.
getProperty
(
"lane.statistics.receive.topic"
);
String
spilloverTopic
=
properties
.
getProperty
(
"lane.spillover.event.receive.topic"
);
String
spilloverTopic
=
properties
.
getProperty
(
"lane.spillover.event.receive.topic"
);
KafkaSource
<
String
>
stati
c
ticsSource
=
getStringKafkaSource
(
statisticsTopic
);
KafkaSource
<
String
>
stati
s
ticsSource
=
getStringKafkaSource
(
statisticsTopic
);
KafkaSource
<
String
>
spillover
R
ource
=
getStringKafkaSource
(
spilloverTopic
);
KafkaSource
<
String
>
spillover
S
ource
=
getStringKafkaSource
(
spilloverTopic
);
DataStream
<
String
>
stati
cticsStream
=
env
.
fromSource
(
static
ticsSource
,
WatermarkStrategy
.
noWatermarks
(),
DataStream
<
String
>
stati
sticsStream
=
env
.
fromSource
(
statis
ticsSource
,
WatermarkStrategy
.
noWatermarks
(),
"city-brain-laneStatistics-receive-data-source"
);
"city-brain-laneStatistics-receive-data-source"
);
DataStream
<
String
>
spilloverStream
=
env
.
fromSource
(
spillover
R
ource
,
WatermarkStrategy
.
noWatermarks
(),
DataStream
<
String
>
spilloverStream
=
env
.
fromSource
(
spillover
S
ource
,
WatermarkStrategy
.
noWatermarks
(),
"city-brain-spillover-receive-data-source"
);
"city-brain-spillover-receive-data-source"
);
dealLaneRealTimeData
(
stati
c
ticsStream
);
dealLaneRealTimeData
(
stati
s
ticsStream
);
// 车道数据中不能处理转向,暂不处理
// 车道数据中不能处理转向,暂不处理
//dealTurnRealTimeData(stati
c
ticsStream);
//dealTurnRealTimeData(stati
s
ticsStream);
dealDirRealTimeData
(
stati
c
ticsStream
);
dealDirRealTimeData
(
stati
s
ticsStream
);
dealCrossRealTimeData
(
env
,
stati
c
ticsStream
,
spilloverStream
);
dealCrossRealTimeData
(
env
,
stati
s
ticsStream
,
spilloverStream
);
env
.
execute
(
"接收城市大脑统计数据发送到kafka准备入库"
);
env
.
execute
(
"接收城市大脑统计数据发送到kafka准备入库"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -63,7 +63,7 @@ public class LaneStatisticsReceiveMain {
...
@@ -63,7 +63,7 @@ public class LaneStatisticsReceiveMain {
// 获取配置文件中的kafka消费topic
// 获取配置文件中的kafka消费topic
String
kafkaServerAddress
=
properties
.
getProperty
(
"bootstrap.servers.citybrain.receive"
);
String
kafkaServerAddress
=
properties
.
getProperty
(
"bootstrap.servers.citybrain.receive"
);
KafkaSource
<
String
>
source
=
KafkaSource
.<
String
>
builder
()
return
KafkaSource
.<
String
>
builder
()
.
setProperties
(
instance
.
getConsumerProperties
())
.
setProperties
(
instance
.
getConsumerProperties
())
.
setProperty
(
"auto.offset.commit"
,
"true"
)
.
setProperty
(
"auto.offset.commit"
,
"true"
)
.
setProperty
(
"auto.commit.interval.ms"
,
"1000"
)
.
setProperty
(
"auto.commit.interval.ms"
,
"1000"
)
...
@@ -74,7 +74,6 @@ public class LaneStatisticsReceiveMain {
...
@@ -74,7 +74,6 @@ public class LaneStatisticsReceiveMain {
.
setStartingOffsets
(
OffsetsInitializer
.
latest
())
.
setStartingOffsets
(
OffsetsInitializer
.
latest
())
.
setDeserializer
(
KafkaRecordDeserializationSchema
.
valueOnly
(
StringDeserializer
.
class
))
.
setDeserializer
(
KafkaRecordDeserializationSchema
.
valueOnly
(
StringDeserializer
.
class
))
.
build
();
.
build
();
return
source
;
}
}
private
static
void
dealCrossRealTimeData
(
StreamExecutionEnvironment
env
,
DataStream
<
String
>
staticticsStream
,
DataStream
<
String
>
spilloverStream
)
{
private
static
void
dealCrossRealTimeData
(
StreamExecutionEnvironment
env
,
DataStream
<
String
>
staticticsStream
,
DataStream
<
String
>
spilloverStream
)
{
...
@@ -112,6 +111,7 @@ public class LaneStatisticsReceiveMain {
...
@@ -112,6 +111,7 @@ public class LaneStatisticsReceiveMain {
}
}
private
static
void
dealLaneRealTimeData
(
DataStream
<
String
>
stream
)
{
private
static
void
dealLaneRealTimeData
(
DataStream
<
String
>
stream
)
{
// todo 添加溢出事件,将溢出状态写入,默认最小溢出指数
SingleOutputStreamOperator
<
String
>
laneRealtimeStream
=
stream
SingleOutputStreamOperator
<
String
>
laneRealtimeStream
=
stream
.
map
(
new
LaneStatisticsReceive2LaneDataMap
())
.
map
(
new
LaneStatisticsReceive2LaneDataMap
())
.
name
(
"接收城市大脑统计数据-JsonToObject"
);
.
name
(
"接收城市大脑统计数据-JsonToObject"
);
...
...
wj-realtime-computing/src/main/resources/mapper/Event
Analysis
Mapper.xml
→
wj-realtime-computing/src/main/resources/mapper/Event
Info
Mapper.xml
View file @
370538b2
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.wanji.indicators.mapper.EventAnalysisMapper"
>
<mapper
namespace=
"com.wanji.indicators.mapper.EventInfoMapper"
>
</mapper>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment