Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
operating-vehicle
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杜发飞
operating-vehicle
Commits
109b0e80
Commit
109b0e80
authored
Oct 18, 2019
by
杜发飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
d4b37168
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
239 additions
and
47 deletions
+239
-47
src/main/java/com/hikcreate/ignite/pojo/alarm/DailyAlarmDeal.java
+7
-14
src/main/java/com/hikcreate/ignite/pojo/alarm/DailyAlarmProcess.java
+39
-0
src/main/java/com/hikcreate/ignite/pojo/basic/VehicleInfo.java
+152
-0
src/main/java/com/hikcreate/ignite/processor/DailyAlarmProcessUpdate.java
+11
-4
src/main/scala/com/hikcreate/data/SyncHive.scala
+1
-3
src/main/scala/com/hikcreate/data/SyncIgnite.scala
+0
-0
src/main/scala/com/hikcreate/data/client/IgniteClient.scala
+28
-25
src/test/scala/Test1.scala
+1
-1
No files found.
src/main/java/com/hikcreate/ignite/pojo/alarm/DailyAlarmDeal.java
View file @
109b0e80
...
...
@@ -8,28 +8,21 @@ public class DailyAlarmDeal implements Serializable {
private
static
final
long
serialVersionUID
=
1L
;
@QuerySqlField
private
String
province
;
//省 浙江省
@QuerySqlField
private
String
city
;
//市 杭州市
@QuerySqlField
private
String
area
;
//区 萧山区
private
String
useNature
;
//使用性质 公交
@QuerySqlField
private
String
useNature
;
//使用性质 公交
private
String
supervisionId
;
//报警督办 ID
@QuerySqlField
private
String
date
;
//报警日期
private
String
warnTime
;
//报警时间
@QuerySqlField
private
Boolean
isDeal
=
false
;
//是否处理
public
DailyAlarmDeal
(
String
province
,
String
city
,
String
area
,
String
useNature
,
String
date
)
{
this
.
province
=
province
;
this
.
city
=
city
;
this
.
area
=
area
;
public
DailyAlarmDeal
(
String
useNature
,
String
supervisionId
,
String
warnTime
,
Boolean
isDeal
)
{
this
.
useNature
=
useNature
;
this
.
date
=
date
;
this
.
supervisionId
=
supervisionId
;
this
.
warnTime
=
warnTime
;
this
.
isDeal
=
isDeal
;
}
}
src/main/java/com/hikcreate/ignite/pojo/alarm/DailyAlarmProcess.java
0 → 100644
View file @
109b0e80
package
com
.
hikcreate
.
ignite
.
pojo
.
alarm
;
import
org.apache.ignite.cache.query.annotations.QuerySqlField
;
import
java.io.Serializable
;
public
class
DailyAlarmProcess
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@QuerySqlField
private
String
vehicleNo
;
//车牌号
@QuerySqlField
private
String
vehicleColor
;
//车牌颜色
@QuerySqlField
private
String
useNature
;
//使用性质 公交
@QuerySqlField
private
String
supervisionId
;
//报警督办 ID
@QuerySqlField
private
String
warnTime
;
//报警时间
@QuerySqlField
private
Boolean
isDeal
;
//是否处理
public
DailyAlarmProcess
(
String
useNature
,
String
supervisionId
,
String
warnTime
,
Boolean
isDeal
)
{
this
.
useNature
=
useNature
;
this
.
supervisionId
=
supervisionId
;
this
.
warnTime
=
warnTime
;
this
.
isDeal
=
isDeal
;
}
public
DailyAlarmProcess
(
Boolean
isDeal
)
{
this
.
isDeal
=
isDeal
;
}
}
src/main/java/com/hikcreate/ignite/pojo/basic/VehicleInfo.java
View file @
109b0e80
...
...
@@ -79,4 +79,156 @@ public class VehicleInfo implements Serializable{
public
void
setUseNature
(
String
useNature
)
{
this
.
useNature
=
useNature
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getVehicleCode
()
{
return
vehicleCode
;
}
public
void
setVehicleCode
(
String
vehicleCode
)
{
this
.
vehicleCode
=
vehicleCode
;
}
public
String
getPlateNum
()
{
return
plateNum
;
}
public
void
setPlateNum
(
String
plateNum
)
{
this
.
plateNum
=
plateNum
;
}
public
String
getPlateColor
()
{
return
plateColor
;
}
public
void
setPlateColor
(
String
plateColor
)
{
this
.
plateColor
=
plateColor
;
}
public
Date
getIntoTime
()
{
return
intoTime
;
}
public
void
setIntoTime
(
Date
intoTime
)
{
this
.
intoTime
=
intoTime
;
}
public
String
getBusinessScope
()
{
return
businessScope
;
}
public
void
setBusinessScope
(
String
businessScope
)
{
this
.
businessScope
=
businessScope
;
}
public
String
getBusinessScopeDetail
()
{
return
businessScopeDetail
;
}
public
void
setBusinessScopeDetail
(
String
businessScopeDetail
)
{
this
.
businessScopeDetail
=
businessScopeDetail
;
}
public
String
getIndentifier
()
{
return
indentifier
;
}
public
void
setIndentifier
(
String
indentifier
)
{
this
.
indentifier
=
indentifier
;
}
public
Boolean
getIntoStatus
()
{
return
intoStatus
;
}
public
void
setIntoStatus
(
Boolean
intoStatus
)
{
this
.
intoStatus
=
intoStatus
;
}
public
String
getStatus
()
{
return
status
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
String
getOperatingCertificateNo
()
{
return
operatingCertificateNo
;
}
public
void
setOperatingCertificateNo
(
String
operatingCertificateNo
)
{
this
.
operatingCertificateNo
=
operatingCertificateNo
;
}
public
String
getClassLine
()
{
return
classLine
;
}
public
void
setClassLine
(
String
classLine
)
{
this
.
classLine
=
classLine
;
}
public
String
getEnterpriseCode
()
{
return
enterpriseCode
;
}
public
void
setEnterpriseCode
(
String
enterpriseCode
)
{
this
.
enterpriseCode
=
enterpriseCode
;
}
public
String
getDrivingPermitNo
()
{
return
drivingPermitNo
;
}
public
void
setDrivingPermitNo
(
String
drivingPermitNo
)
{
this
.
drivingPermitNo
=
drivingPermitNo
;
}
public
String
getVehicleBrand
()
{
return
vehicleBrand
;
}
public
void
setVehicleBrand
(
String
vehicleBrand
)
{
this
.
vehicleBrand
=
vehicleBrand
;
}
public
String
getBusinessTime
()
{
return
businessTime
;
}
public
void
setBusinessTime
(
String
businessTime
)
{
this
.
businessTime
=
businessTime
;
}
public
String
getProvince
()
{
return
province
;
}
public
void
setProvince
(
String
province
)
{
this
.
province
=
province
;
}
public
String
getCity
()
{
return
city
;
}
public
void
setCity
(
String
city
)
{
this
.
city
=
city
;
}
public
String
getArea
()
{
return
area
;
}
public
void
setArea
(
String
area
)
{
this
.
area
=
area
;
}
}
src/main/java/com/hikcreate/ignite/processor/DailyAlarm
Deal
Update.java
→
src/main/java/com/hikcreate/ignite/processor/DailyAlarm
Process
Update.java
View file @
109b0e80
...
...
@@ -5,17 +5,24 @@ import org.apache.ignite.binary.BinaryObjectBuilder;
import
org.apache.ignite.cache.CacheEntryProcessor
;
import
javax.cache.processor.EntryProcessorException
;
import
javax.cache.processor.MutableEntry
;
import
java.util.Map
;
public
class
DailyAlarmDealUpdate
implements
CacheEntryProcessor
<
BinaryObject
,
BinaryObject
,
Void
>
{
public
class
DailyAlarmProcessUpdate
implements
CacheEntryProcessor
<
BinaryObject
,
BinaryObject
,
Void
>
{
private
Map
<
String
,
Object
>
parameter
;
public
DailyAlarmProcessUpdate
(
Map
<
String
,
Object
>
parameter
){
this
.
parameter
=
parameter
;
}
@Override
public
Void
process
(
MutableEntry
<
BinaryObject
,
BinaryObject
>
mutableEntry
,
Object
...
objects
)
throws
EntryProcessorException
{
BinaryObject
value
=
mutableEntry
.
getValue
();
if
(
value
!=
null
){
BinaryObjectBuilder
builder
=
value
.
toBuilder
();
builder
.
setField
(
"isDeal"
,
true
);
mutableEntry
.
setValue
(
builder
.
build
());
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
parameter
.
entrySet
())
{
builder
.
setField
(
entry
.
getKey
(),
entry
.
getValue
());
}
mutableEntry
.
setValue
(
builder
.
build
());
return
null
;
}
}
src/main/scala/com/hikcreate/data/SyncHive.scala
View file @
109b0e80
...
...
@@ -102,8 +102,6 @@ object SyncHive extends Sparking with Logging {
if
(
tableName
==
Const
.
tableMap
(
TableKey
(
Some
(
"0x1200"
),
Some
(
"0x1202"
)))
||
tableName
==
Const
.
tableMap
(
TableKey
(
Some
(
"0x1200"
),
Some
(
"0x1203"
)))){
val
addressAndLocation
=
Tools
.
getAddressAndLocationCode
(
json
.
getDouble
(
"lon"
)/
1000000
,
json
.
getDouble
(
"lat"
)/
1000000
)
println
(
addressAndLocation
.
_1
)
println
(
addressAndLocation
.
_2
)
json
.
put
(
"districtcode"
,
addressAndLocation
.
_2
)
}
//报警信息 增加区县代码和事件类型,经纬度,详细地址
...
...
@@ -117,7 +115,7 @@ object SyncHive extends Sparking with Logging {
json
.
put
(
"longitude"
,
infoJson
.
get
(
"LONGITUDE"
))
json
.
put
(
"latitude"
,
infoJson
.
get
(
"LATITUDE"
))
json
.
put
(
"eventtype"
,
infoJson
.
get
(
"EVENT_TYPE"
))
val
addressAndLocation
=
Tools
.
getAddressAndLocationCode
(
infoJson
.
getDouble
(
"LONGITUDE"
)
,
infoJson
.
getDouble
(
"LATITUDE"
)
)
val
addressAndLocation
=
Tools
.
getAddressAndLocationCode
(
infoJson
.
getDouble
(
"LONGITUDE"
)
/
1000000
,
infoJson
.
getDouble
(
"LATITUDE"
)/
1000000
)
json
.
put
(
"fulladdress"
,
addressAndLocation
.
_1
)
println
(
addressAndLocation
.
_1
)
json
.
put
(
"districtcode"
,
addressAndLocation
.
_2
)
...
...
src/main/scala/com/hikcreate/data/SyncIgnite.scala
View file @
109b0e80
This diff is collapsed.
Click to expand it.
src/main/scala/com/hikcreate/data/client/IgniteClient.scala
View file @
109b0e80
...
...
@@ -2,8 +2,10 @@ package com.hikcreate.data.client
import
java.util
import
java.util.concurrent.TimeUnit
import
com.alibaba.fastjson.JSON
import
com.hikcreate.ignite.pojo.PrimaryKey
import
com.hikcreate.ignite.pojo.alarm.
{
DailyAlarm
,
DailyAlarmDeal
,
DailyAlarmDetail
}
import
com.hikcreate.ignite.pojo.alarm.
{
DailyAlarm
,
DailyAlarmDeal
,
DailyAlarmDetail
,
DailyAlarmProcess
}
import
com.hikcreate.ignite.pojo.basic._
import
com.hikcreate.ignite.pojo.vehicles.
{
AlarmNumber
,
DailyMileage
,
DriverNumber
,
VehicleNumber
}
import
com.hikcreate.ignite.processor._
...
...
@@ -13,6 +15,8 @@ import org.apache.ignite.cache.{CacheMode, QueryEntity}
import
org.apache.ignite.cache.query.SqlFieldsQuery
import
org.apache.ignite.configuration.
{
CacheConfiguration
,
IgniteConfiguration
}
import
org.apache.ignite.
{
Ignite
,
IgniteCache
,
Ignition
}
import
org.joda.time.DateTime
import
scala.collection.JavaConverters._
/**
* binary type无法自动更改
...
...
@@ -182,48 +186,47 @@ object IgniteClient {
}
/**
* 今日报警详情
* 主键:车牌号 车牌颜色 报警时间 信息 ID
* 数据来源:上报报警信息消息,智能视频报警附件上传结果上报
* 根据 车牌号,车牌颜色,报警时间 关联 智能视频报警附件上传结果上报 获取视频地址信息
* 今日报警处理数
* 主键:车牌号 车牌颜色 报警督办ID
* 数据来源: 报警督办请求消息 报警督办应答消息
*/
lazy
val
dailyAlarm
DetailCache
:
IgniteCache
[
PrimaryKey
,
DailyAlarmDetail
]
=
ignite
.
getOrCreateCache
(
new
CacheConfiguration
[
PrimaryKey
,
DailyAlarm
Detail
]()
lazy
val
dailyAlarm
ProcessCache
:
IgniteCache
[
PrimaryKey
,
DailyAlarmProcess
]
=
ignite
.
getOrCreateCache
(
new
CacheConfiguration
[
PrimaryKey
,
DailyAlarm
Process
]()
.
setSqlSchema
(
"Alarm"
)
.
setName
(
"DailyAlarm
Detail
"
)
.
setIndexedTypes
(
classOf
[
PrimaryKey
],
classOf
[
DailyAlarm
Detail
])
.
setName
(
"DailyAlarm
Process
"
)
.
setIndexedTypes
(
classOf
[
PrimaryKey
],
classOf
[
DailyAlarm
Process
])
.
setDataRegionName
(
"500MB_Region"
)
.
setCacheMode
(
CacheMode
.
REPLICATED
)
//.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.HOURS,24)))
)
def
updateDailyAlarmDealCache
(
key
:
BinaryObject
,
map
:
Map
[
String
,
AnyRef
])
:
Unit
=
{
dailyAlarmProcessCache
.
withKeepBinary
()
.
invoke
(
key
,
new
DailyAlarmProcessUpdate
(
map
.
asJava
))
}
/**
* 今日报警处理量
* 主键:车牌号 车牌颜色 报警督办ID
* 数据来源: 报警督办请求消息 报警督办应答消息
* 今日报警详情
* 主键:车牌号 车牌颜色 报警时间 信息 ID
* 数据来源:上报报警信息消息,智能视频报警附件上传结果上报
* 根据 车牌号,车牌颜色,报警时间 关联 智能视频报警附件上传结果上报 获取视频地址信息
*/
lazy
val
dailyAlarmDe
alCache
:
IgniteCache
[
PrimaryKey
,
DailyAlarmDea
l
]
=
ignite
.
getOrCreateCache
(
new
CacheConfiguration
[
PrimaryKey
,
DailyAlarmDe
a
l
]()
lazy
val
dailyAlarmDe
tailCache
:
IgniteCache
[
PrimaryKey
,
DailyAlarmDetai
l
]
=
ignite
.
getOrCreateCache
(
new
CacheConfiguration
[
PrimaryKey
,
DailyAlarmDe
tai
l
]()
.
setSqlSchema
(
"Alarm"
)
.
setName
(
"DailyAlarmDe
a
l"
)
.
setIndexedTypes
(
classOf
[
PrimaryKey
],
classOf
[
DailyAlarmDe
a
l
])
.
setName
(
"DailyAlarmDe
tai
l"
)
.
setIndexedTypes
(
classOf
[
PrimaryKey
],
classOf
[
DailyAlarmDe
tai
l
])
.
setDataRegionName
(
"500MB_Region"
)
.
setCacheMode
(
CacheMode
.
REPLICATED
)
//.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.HOURS,24)))
)
def
updateDailyAlarmDealCache
(
key
:
BinaryObject
)
:
Unit
=
{
dailyAlarmDealCache
.
withKeepBinary
()
.
invoke
(
key
,
new
DailyAlarmDealUpdate
())
}
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
val
a
=
ignite
.
binary
.
`type`
(
"com.hikcreate.ignite.pojo.alarm.AlarmDetail"
)
val
builder
=
ignite
.
binary
().
builder
(
"com.hikcreate.ignite.pojo.alarm.AlarmDetail"
)
val
build
=
builder
.
setField
(
"warnType"
,
1L
,
classOf
[
Long
]).
build
()
println
(
a
.
fieldTypeName
(
"warnType"
))
//无法自动更新修改后的字段类型
ignite
.
binary
()
println
(
a
.
fieldTypeName
(
"warnType"
))
//无法自动更新修改后的字段类型
//alarmDetailCache.destroy()
//basicCompanyInfo.clear()
...
...
src/test/scala/Test1.scala
View file @
109b0e80
...
...
@@ -5,7 +5,7 @@ object Test1 {
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
val
a
=
Tools
.
getAddressAndLocationCode
(
1
15.0031
,
27.2773
)
val
a
=
Tools
.
getAddressAndLocationCode
(
1
20.485443
,
30.183996
)
println
(
a
.
_1
+
"----"
+
a
.
_2
)
}
...
...
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