Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-standard-interfaces
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
1
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9af10910
authored
Apr 14, 2022
by
向延琳
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改null判断
1 parent
64582d98
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
17 deletions
src/main/java/cn/com/glsx/stdinterface/modules/service/BatteryService.java
src/main/java/cn/com/glsx/stdinterface/modules/service/JourneyService.java
src/main/java/cn/com/glsx/stdinterface/modules/service/VehicleService.java
src/main/java/cn/com/glsx/stdinterface/modules/service/BatteryService.java
View file @
9af1091
...
@@ -56,12 +56,9 @@ public class BatteryService {
...
@@ -56,12 +56,9 @@ public class BatteryService {
public
void
saveBatteryInfo
(
DevicePowerDTO
devicePowerDTO
)
{
public
void
saveBatteryInfo
(
DevicePowerDTO
devicePowerDTO
)
{
//从车辆信息中获取创建人信息
//从车辆信息中获取创建人信息
Vehicle
vehicle
=
vehicleMapper
.
getVehicleBySn
(
devicePowerDTO
.
getSn
());
Vehicle
vehicle
=
vehicleMapper
.
getVehicleBySn
(
devicePowerDTO
.
getSn
());
Long
createdBy
=
null
;
Long
createdBy
=
Optional
.
ofNullable
(
vehicle
).
map
(
Vehicle:
:
getCreatedBy
).
orElse
(
null
);
Long
updatedBy
=
null
;
Long
updatedBy
=
Optional
.
ofNullable
(
vehicle
).
map
(
Vehicle:
:
getUpdatedBy
).
orElse
(
null
);
if
(
Objects
.
nonNull
(
vehicle
))
{
if
(
Objects
.
isNull
(
vehicle
))
{
createdBy
=
vehicle
.
getCreatedBy
();
updatedBy
=
vehicle
.
getUpdatedBy
();
}
else
{
log
.
warn
(
"该设备没有绑定车辆"
+
devicePowerDTO
.
getSn
());
log
.
warn
(
"该设备没有绑定车辆"
+
devicePowerDTO
.
getSn
());
}
}
//从关联表从获取关联id
//从关联表从获取关联id
...
...
src/main/java/cn/com/glsx/stdinterface/modules/service/JourneyService.java
View file @
9af1091
...
@@ -18,6 +18,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -18,6 +18,7 @@ import org.springframework.transaction.annotation.Transactional;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.Optional
;
/**
/**
* 新e盾|里程服务实现类
* 新e盾|里程服务实现类
...
@@ -58,12 +59,9 @@ public class JourneyService {
...
@@ -58,12 +59,9 @@ public class JourneyService {
//从车辆信息中获取创建人信息
//从车辆信息中获取创建人信息
Vehicle
vehicle
=
getVehicleBySn
(
deviceJourneyDTO
.
getSn
());
Vehicle
vehicle
=
getVehicleBySn
(
deviceJourneyDTO
.
getSn
());
Long
createdBy
=
null
;
Long
createdBy
=
Optional
.
ofNullable
(
vehicle
).
map
(
Vehicle:
:
getCreatedBy
).
orElse
(
null
);
Long
updatedBy
=
null
;
Long
updatedBy
=
Optional
.
ofNullable
(
vehicle
).
map
(
Vehicle:
:
getUpdatedBy
).
orElse
(
null
);
if
(
Objects
.
nonNull
(
vehicle
))
{
if
(
Objects
.
isNull
(
vehicle
))
{
createdBy
=
vehicle
.
getCreatedBy
();
updatedBy
=
vehicle
.
getUpdatedBy
();
}
else
{
log
.
warn
(
"该设备没有绑定车辆"
+
deviceJourneyDTO
.
getSn
());
log
.
warn
(
"该设备没有绑定车辆"
+
deviceJourneyDTO
.
getSn
());
}
}
//从关联表从获取关联id
//从关联表从获取关联id
...
...
src/main/java/cn/com/glsx/stdinterface/modules/service/VehicleService.java
View file @
9af1091
...
@@ -19,6 +19,7 @@ import java.util.Collection;
...
@@ -19,6 +19,7 @@ import java.util.Collection;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -58,11 +59,9 @@ public class VehicleService {
...
@@ -58,11 +59,9 @@ public class VehicleService {
public
Long
getVdId
(
String
sn
)
{
public
Long
getVdId
(
String
sn
)
{
VehicleDevice
vehicleDevice
=
vehicleDeviceMapper
.
selectVehicleDevcieBySn
(
sn
);
VehicleDevice
vehicleDevice
=
vehicleDeviceMapper
.
selectVehicleDevcieBySn
(
sn
);
Long
vnId
=
null
;
return
Optional
.
ofNullable
(
vehicleDevice
)
if
(
Objects
.
nonNull
(
vehicleDevice
))
{
.
map
(
VehicleDevice:
:
getId
)
vnId
=
vehicleDevice
.
getId
();
.
orElse
(
null
);
}
return
vnId
;
}
}
/**
/**
...
...
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