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
58e16078
Commit
58e16078
authored
Oct 20, 2019
by
杜发飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
b937c9b0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
2 deletions
+41
-2
src/main/scala/com/hikcreate/data/client/IgniteClient.scala
+28
-1
src/main/scala/com/hikcreate/data/sync/SyncIgnite.scala
+13
-1
No files found.
src/main/scala/com/hikcreate/data/client/IgniteClient.scala
View file @
58e16078
package
com.hikcreate.data.client
import
java.util.concurrent.TimeUnit
import
com.hikcreate.ignite.domain.PrimaryKey
import
com.hikcreate.ignite.domain.alarm.
{
AttachmentInfo
,
DailyAlarm
,
DailyAlarmDeal
,
DailyAlarmDetail
}
import
com.hikcreate.ignite.domain.basic._
...
...
@@ -9,8 +10,10 @@ import com.hikcreate.ignite.processor._
import
javax.cache.expiry.
{
CreatedExpiryPolicy
,
Duration
}
import
org.apache.ignite.binary.BinaryObject
import
org.apache.ignite.cache.CacheMode
import
org.apache.ignite.cache.query.SqlFieldsQuery
import
org.apache.ignite.configuration.CacheConfiguration
import
org.apache.ignite.
{
Ignite
,
IgniteCache
,
Ignition
}
import
scala.collection.JavaConversions.mapAsJavaMap
import
scala.collection.JavaConverters._
/**
...
...
@@ -191,7 +194,7 @@ object IgniteClient {
lazy
val
dailyAlarmDealCache
:
IgniteCache
[
PrimaryKey
,
DailyAlarmDeal
]
=
ignite
.
getOrCreateCache
(
new
CacheConfiguration
[
PrimaryKey
,
DailyAlarmDeal
]()
.
setSqlSchema
(
"Alarm"
)
.
setName
(
"DailyAlarm
Process
"
)
.
setName
(
"DailyAlarm
Deal
"
)
.
setIndexedTypes
(
classOf
[
PrimaryKey
],
classOf
[
DailyAlarmDeal
])
.
setDataRegionName
(
"500MB_Region"
)
.
setCacheMode
(
CacheMode
.
REPLICATED
)
...
...
@@ -238,6 +241,30 @@ object IgniteClient {
dailyAlarmDealCache.destroy()
dailyAlarmDetailCache.destroy()*/
/*ignite.destroyCache("DailyAlarmProcess")
IgniteClient.dailyAlarmDealCache.clear()
val value = new DailyAlarmDeal("01","2","","001","2019-10-20 10:00:00",true)
IgniteClient.dailyAlarmDealCache.withKeepBinary().putIfAbsent(getBinaryObject(new PrimaryKey("01","2","001")),value)
val value1 = new DailyAlarmDeal("01","2","","002","2019-10-20 12:00:00",true)
IgniteClient.dailyAlarmDealCache.withKeepBinary().putIfAbsent(getBinaryObject(new PrimaryKey("01","2","002")),value1)
val value2 = new DailyAlarmDeal("01","2","","003","2019-10-20 12:00:00",true)
IgniteClient.dailyAlarmDealCache.withKeepBinary().putIfAbsent(getBinaryObject(new PrimaryKey("01","2","003")),value2)*/
/*val dailyAlarmDetail = new DailyAlarmDetail(
"33","08","01","01","2","",
"0x00","2019-10-20 10:00:00",100.00,100.00,1L,"CES")
IgniteClient.dailyAlarmDetailCache.withKeepBinary().put(getBinaryObject(new PrimaryKey("01","2","2019-10-20 10:00:00")),dailyAlarmDetail)*/
/*val attachmentInfo = new AttachmentInfo("100","01","2","1","0x00","2019-10-20 10:00:00","1","1","1","/opt/a.txt","")
attachmentCache.withKeepBinary().put(getBinaryObject(new PrimaryKey("xxxxxxxxxx")),attachmentInfo)*/
//val query = new SqlFieldsQuery("select count(*) from DailyAlarmDeal where isDeal = true")
val
me
=
new
DailyMileage
(
"33"
,
"08"
,
"01"
,
""
,
"2019-10-12"
,
200.00
,
200.00
,
""
,
10.00
,
1L
)
mileageCache
.
withKeepBinary
().
withKeepBinary
().
put
(
getBinaryObject
(
new
PrimaryKey
(
""
)),
me
)
ignite
.
close
()
}
}
src/main/scala/com/hikcreate/data/sync/SyncIgnite.scala
View file @
58e16078
...
...
@@ -89,7 +89,19 @@ object SyncIgnite extends Sparking with Logging{
}*/
//车辆定位消息补报
case
tableKey
if
tableKey
==
TableKey
(
Some
(
"0x1200"
),
Some
(
"0x1203"
))
=>
Tools
.
addLocation
(
json
).
foreach
{
x
=>
val
vehicleNo
=
x
.
getString
(
"vehicleNo"
)
val
vehicleColor
=
x
.
getString
(
"vehicleColor"
)
val
lon
=
x
.
getDouble
(
"lon"
)/
1000000
val
lat
=
x
.
getDouble
(
"lat"
)/
1000000
val
code
=
Tools
.
getLocationCode
(
lon
,
lat
)
val
vehicleInfoOptional
=
Tools
.
getVehicleInfo
(
vehicleNo
,
vehicleColor
)
val
useNature
=
vehicleInfoOptional
.
map
(
x
=>
x
.
getUseNature
).
getOrElse
(
"无"
)
//累计行驶车辆数
val
vehicleNumberKey
=
IgniteClient
.
getBinaryObject
(
new
PrimaryKey
(
code
.
_1
,
code
.
_2
,
code
.
_3
,
vehicleNo
,
vehicleColor
))
val
vehicleNumberValue
=
new
VehicleNumber
(
code
.
_1
,
code
.
_2
,
code
.
_3
,
useNature
)
IgniteClient
.
vehicleNumberCache
.
withKeepBinary
().
put
(
vehicleNumberKey
,
vehicleNumberValue
)
}
//定时上传驾驶员身份识别信息
case
tableKey
if
tableKey
==
TableKey
(
Some
(
"0x1D00"
),
Some
(
"0x1d02"
))
=>
val
vehicleNo
=
json
.
getString
(
"vehicleNo"
)
...
...
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