Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
GeoFlyApi
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
GeoFly
GeoFlyApi
Commits
f3b25e48
Commit
f3b25e48
authored
Apr 28, 2025
by
gdj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化新增机场,同时新增飞机。
parent
a73a94fa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
4 deletions
+43
-4
sample/src/main/java/com/dji/sample/manage/service/impl/DeviceServiceImpl.java
+43
-4
No files found.
sample/src/main/java/com/dji/sample/manage/service/impl/DeviceServiceImpl.java
View file @
f3b25e48
...
...
@@ -758,7 +758,7 @@ public class DeviceServiceImpl implements IDeviceService {
// sn码不重复
List
<
DeviceEntity
>
dbDroneList
=
mapper
.
selectList
(
new
LambdaQueryWrapper
<
DeviceEntity
>().
eq
(
DeviceEntity:
:
getDeviceSn
,
droneDeviceSn
));
if
(!
CollectionUtils
.
isEmpty
(
dbDroneList
))
{
throw
new
RuntimeException
(
"d
evic
eSn is already exit"
);
throw
new
RuntimeException
(
"d
ron
eSn is already exit"
);
}
}
...
...
@@ -816,7 +816,7 @@ public class DeviceServiceImpl implements IDeviceService {
List
<
DeviceEntity
>
snList
=
this
.
mapper
.
selectList
(
deviceSnQueryWrapper
);
if
(!
CollectionUtils
.
isEmpty
(
snList
))
{
throw
new
RuntimeException
(
"d
evic
eSn is already exit"
);
throw
new
RuntimeException
(
"d
ron
eSn is already exit"
);
}
updateEntity
.
setDeviceSn
(
drone
.
getDeviceSn
());
...
...
@@ -861,7 +861,7 @@ public class DeviceServiceImpl implements IDeviceService {
// sn码不重复
List
<
DeviceEntity
>
dbDeviceList
=
mapper
.
selectList
(
new
LambdaQueryWrapper
<
DeviceEntity
>().
eq
(
DeviceEntity:
:
getDeviceSn
,
dockSn
));
if
(!
CollectionUtils
.
isEmpty
(
dbDeviceList
))
{
throw
new
RuntimeException
(
"d
evice
Sn is already exit"
);
throw
new
RuntimeException
(
"d
ock
Sn is already exit"
);
}
}
...
...
@@ -876,6 +876,43 @@ public class DeviceServiceImpl implements IDeviceService {
// 飞机绑定了其他设备
// 飞机不存在? 新建飞机?
if
(
drone
==
null
)
{
DeviceEntity
newDrone
=
new
DeviceEntity
();
newDrone
.
setDeviceSn
(
droneSn
);
newDrone
.
setWorkspaceId
(
dock
.
getWorkspaceId
());
// 飞机型号
DeviceDTO
children
=
dock
.
getChildren
();
// 飞机名称
newDrone
.
setNickname
(
children
.
getNickname
());
newDrone
.
setDeviceName
(
children
.
getDeviceName
());
newDrone
.
setDomain
(
children
.
getDomain
().
getDomain
());
newDrone
.
setDeviceType
(
children
.
getType
().
getType
());
newDrone
.
setSubType
(
children
.
getSubType
().
getSubType
());
newDrone
.
setCreateTime
(
System
.
currentTimeMillis
());
newDrone
.
setUpdateTime
(
System
.
currentTimeMillis
());
newDrone
.
setBoundStatus
(
true
);
newDrone
.
setBoundTime
(
System
.
currentTimeMillis
());
int
droneInsert
=
mapper
.
insert
(
newDrone
);
}
else
{
// 飞机存在
if
(
StringUtils
.
hasText
(
drone
.
getWorkspaceId
()))
{
throw
new
RuntimeException
(
"The current drone has been bound"
);
}
// 绑定无人机
LambdaUpdateWrapper
<
DeviceEntity
>
updateDroneWrapper
=
new
LambdaUpdateWrapper
<>();
updateDroneWrapper
.
set
(
DeviceEntity:
:
getWorkspaceId
,
dock
.
getWorkspaceId
());
updateDroneWrapper
.
eq
(
DeviceEntity:
:
getDeviceSn
,
droneSn
);
int
updateDroneInt
=
mapper
.
update
(
new
DeviceEntity
(),
updateDroneWrapper
);
}
}
addDockEntity
.
setWorkspaceId
(
dock
.
getWorkspaceId
());
...
...
@@ -905,6 +942,8 @@ public class DeviceServiceImpl implements IDeviceService {
// bound_time bigint
// bound_status The status when the device is bound to the workspace. 1: bound; 0: not bound;
addDockEntity
.
setBoundStatus
(
true
);
addDockEntity
.
setBoundTime
(
System
.
currentTimeMillis
());
// device_desc
// url_normal The icon displayed on the remote control.
// url_select The icon displayed on the remote control when it is selected.
...
...
@@ -936,7 +975,7 @@ public class DeviceServiceImpl implements IDeviceService {
List
<
DeviceEntity
>
snList
=
this
.
mapper
.
selectList
(
deviceSnQueryWrapper
);
if
(!
CollectionUtils
.
isEmpty
(
snList
))
{
throw
new
RuntimeException
(
"d
evice
Sn is already exit"
);
throw
new
RuntimeException
(
"d
ock
Sn is already exit"
);
}
updateEntity
.
setDeviceSn
(
dock
.
getDeviceSn
());
...
...
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