Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
谢明辉
/
fanxing3-integration
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 37dd53e2
authored
Jun 24, 2022
by
毛树良
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
<fix>:优化
1 parent
ac4e063b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
2 deletions
fanxing-docking-gb1400/src/main/java/com/viontech/scheduled/TrafficIllegalScheduled.java
fanxing-docking-gb1400/src/main/java/com/viontech/scheduled/TrafficVehicleScheduled.java
fanxing-docking-gb1400/src/main/java/com/viontech/utils/CheckUtil.java
fanxing-docking-gb1400/src/main/java/com/viontech/scheduled/TrafficIllegalScheduled.java
View file @
37dd53e
...
@@ -6,6 +6,7 @@ import com.viontech.constant.SystemConstants;
...
@@ -6,6 +6,7 @@ import com.viontech.constant.SystemConstants;
import
com.viontech.handler.TrafficDataConvertHandler
;
import
com.viontech.handler.TrafficDataConvertHandler
;
import
com.viontech.service.Gb1400Service
;
import
com.viontech.service.Gb1400Service
;
import
com.viontech.service.TrafficEventService
;
import
com.viontech.service.TrafficEventService
;
import
com.viontech.utils.CheckUtil
;
import
com.viontech.utils.DateUtil
;
import
com.viontech.utils.DateUtil
;
import
com.viontech.utils.JavaBean2Json
;
import
com.viontech.utils.JavaBean2Json
;
import
com.viontech.utils.JsonMessage
;
import
com.viontech.utils.JsonMessage
;
...
@@ -76,7 +77,12 @@ public class TrafficIllegalScheduled {
...
@@ -76,7 +77,12 @@ public class TrafficIllegalScheduled {
if
(!
CollectionUtils
.
isEmpty
(
trafficModels
))
{
if
(!
CollectionUtils
.
isEmpty
(
trafficModels
))
{
List
<
TrafficMongoModel
>
trafficMongoModels
=
new
ArrayList
<>();
List
<
TrafficMongoModel
>
trafficMongoModels
=
new
ArrayList
<>();
for
(
Object
model
:
trafficModels
)
{
for
(
Object
model
:
trafficModels
)
{
trafficMongoModels
.
add
(
JavaBean2Json
.
Json2JavaBean
(
JavaBean2Json
.
javaBean2Json
(
model
),
TrafficMongoModel
.
class
));
TrafficMongoModel
trafficModel
=
JavaBean2Json
.
Json2JavaBean
(
JavaBean2Json
.
javaBean2Json
(
model
),
TrafficMongoModel
.
class
);
if
(
CheckUtil
.
checkDeviceId
(
trafficModel
))
{
trafficMongoModels
.
add
(
trafficModel
);
}
else
{
redisTemplate
.
opsForValue
().
set
(
RedisConstants
.
FANXING_TO_GB1400_LASTTIME
,
trafficModel
.
getEvent_dt
());
}
}
}
//List<TrafficMongoModel> 转 SubscribeNotificationsObj
//List<TrafficMongoModel> 转 SubscribeNotificationsObj
SubscribeNotificationsObj
subscribeNotificationsObj
=
trafficDataConvertHandler
.
trafficIllegalToSubscribeNotifications
(
trafficMongoModels
);
SubscribeNotificationsObj
subscribeNotificationsObj
=
trafficDataConvertHandler
.
trafficIllegalToSubscribeNotifications
(
trafficMongoModels
);
...
...
fanxing-docking-gb1400/src/main/java/com/viontech/scheduled/TrafficVehicleScheduled.java
View file @
37dd53e
...
@@ -6,6 +6,7 @@ import com.viontech.constant.SystemConstants;
...
@@ -6,6 +6,7 @@ import com.viontech.constant.SystemConstants;
import
com.viontech.handler.TrafficDataConvertHandler
;
import
com.viontech.handler.TrafficDataConvertHandler
;
import
com.viontech.service.Gb1400Service
;
import
com.viontech.service.Gb1400Service
;
import
com.viontech.service.TrafficEventService
;
import
com.viontech.service.TrafficEventService
;
import
com.viontech.utils.CheckUtil
;
import
com.viontech.utils.DateUtil
;
import
com.viontech.utils.DateUtil
;
import
com.viontech.utils.JavaBean2Json
;
import
com.viontech.utils.JavaBean2Json
;
import
com.viontech.utils.JsonMessage
;
import
com.viontech.utils.JsonMessage
;
...
@@ -76,7 +77,12 @@ public class TrafficVehicleScheduled {
...
@@ -76,7 +77,12 @@ public class TrafficVehicleScheduled {
if
(!
CollectionUtils
.
isEmpty
(
trafficModels
))
{
if
(!
CollectionUtils
.
isEmpty
(
trafficModels
))
{
List
<
TrafficMongoModel
>
trafficMongoModels
=
new
ArrayList
<>();
List
<
TrafficMongoModel
>
trafficMongoModels
=
new
ArrayList
<>();
for
(
Object
model
:
trafficModels
)
{
for
(
Object
model
:
trafficModels
)
{
trafficMongoModels
.
add
(
JavaBean2Json
.
Json2JavaBean
(
JavaBean2Json
.
javaBean2Json
(
model
),
TrafficMongoModel
.
class
));
TrafficMongoModel
trafficModel
=
JavaBean2Json
.
Json2JavaBean
(
JavaBean2Json
.
javaBean2Json
(
model
),
TrafficMongoModel
.
class
);
if
(
CheckUtil
.
checkDeviceId
(
trafficModel
))
{
trafficMongoModels
.
add
(
trafficModel
);
}
else
{
redisTemplate
.
opsForValue
().
set
(
RedisConstants
.
FANXING_TO_GB1400_VEHICLE_LASTTIME
,
trafficModel
.
getEvent_dt
());
}
}
}
//List<TrafficMongoModel> 转 SubscribeNotificationsObj
//List<TrafficMongoModel> 转 SubscribeNotificationsObj
SubscribeNotificationsObj
subscribeNotificationsObj
=
trafficDataConvertHandler
.
trafficVehicleToSubscribeNotifications
(
trafficMongoModels
);
SubscribeNotificationsObj
subscribeNotificationsObj
=
trafficDataConvertHandler
.
trafficVehicleToSubscribeNotifications
(
trafficMongoModels
);
...
...
fanxing-docking-gb1400/src/main/java/com/viontech/utils/CheckUtil.java
0 → 100644
View file @
37dd53e
package
com
.
viontech
.
utils
;
import
com.viontech.vo.traffic.TrafficMongoModel
;
import
java.util.Map
;
import
java.util.Optional
;
public
class
CheckUtil
{
public
static
boolean
checkDeviceId
(
TrafficMongoModel
model
)
{
String
deviceId
=
Optional
.
ofNullable
(
model
)
.
map
(
x
->
x
.
getEvent_data
())
.
map
(
x
->
x
.
get
(
"device"
))
.
map
(
x
->
(
String
)
((
Map
)
x
).
get
(
"code"
)).
orElse
(
""
);
if
(
20
==
deviceId
.
length
())
{
return
true
;
}
return
false
;
}
}
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