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
e2a15963
Commit
e2a15963
authored
Apr 14, 2025
by
gdj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加机场,无人机增删改功能。
parent
6f09092b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
152 additions
and
0 deletions
+152
-0
sample/src/main/java/com/dji/sample/manage/controller/DeviceController.java
+99
-0
sample/src/main/java/com/dji/sample/manage/model/dto/DeviceDTO.java
+2
-0
sample/src/main/java/com/dji/sample/manage/service/IDeviceDictionaryService.java
+3
-0
sample/src/main/java/com/dji/sample/manage/service/IDeviceService.java
+29
-0
sample/src/main/java/com/dji/sample/manage/service/impl/DeviceDictionaryServiceImpl.java
+19
-0
sample/src/main/java/com/dji/sample/manage/service/impl/DeviceServiceImpl.java
+0
-0
No files found.
sample/src/main/java/com/dji/sample/manage/controller/DeviceController.java
View file @
e2a15963
package
com
.
dji
.
sample
.
manage
.
controller
;
import
com.dji.sample.manage.model.dto.DeviceDTO
;
import
com.dji.sample.manage.model.dto.DeviceDictionaryDTO
;
import
com.dji.sample.manage.model.dto.DeviceFirmwareUpgradeDTO
;
import
com.dji.sample.manage.service.IDeviceDictionaryService
;
import
com.dji.sample.manage.service.IDeviceService
;
import
com.dji.sdk.common.HttpResultResponse
;
import
com.dji.sdk.common.PaginationData
;
...
...
@@ -10,6 +12,7 @@ import com.dji.sdk.mqtt.property.PropertySetReplyResultEnum;
import
com.fasterxml.jackson.databind.JsonNode
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
...
...
@@ -28,6 +31,9 @@ public class DeviceController {
@Autowired
private
IDeviceService
deviceService
;
@Autowired
private
IDeviceDictionaryService
deviceDictionaryService
;
/**
* Get the topology list of all online devices in one workspace.
* @param workspaceId
...
...
@@ -142,4 +148,96 @@ public class DeviceController {
return
PropertySetReplyResultEnum
.
SUCCESS
.
getResult
()
==
result
?
HttpResultResponse
.
success
()
:
HttpResultResponse
.
error
(
result
,
String
.
valueOf
(
result
));
}
/**
* add the addAircraft to the workspace
* @param aircraft
* @return
*/
@PostMapping
(
"/{workspace_id}/addDrone"
)
public
HttpResultResponse
addDrone
(
@RequestBody
DeviceDTO
aircraft
,
@PathVariable
(
"workspace_id"
)
String
workspaceId
)
{
aircraft
.
setWorkspaceId
(
workspaceId
);
boolean
isAdd
=
deviceService
.
addDrone
(
aircraft
);
return
isAdd
?
HttpResultResponse
.
success
()
:
HttpResultResponse
.
error
();
}
/**
* edit the addAircraft to the workspace
* @param aircraft
* @return
*/
@PostMapping
(
"/{workspace_id}/editDrone"
)
public
HttpResultResponse
editDrone
(
@RequestBody
DeviceDTO
aircraft
,
@PathVariable
(
"workspace_id"
)
String
workspaceId
)
{
aircraft
.
setWorkspaceId
(
workspaceId
);
boolean
isAdd
=
deviceService
.
editDrone
(
aircraft
);
return
isAdd
?
HttpResultResponse
.
success
()
:
HttpResultResponse
.
error
();
}
/**
* add the addAirport to the workspace
* @param airport
* @return
*/
@PostMapping
(
"/{workspace_id}/addAirport"
)
public
HttpResultResponse
addAirport
(
@RequestBody
DeviceDTO
airport
,
@PathVariable
(
"workspace_id"
)
String
workspaceId
)
{
airport
.
setWorkspaceId
(
workspaceId
);
boolean
isAdd
=
deviceService
.
addAirport
(
airport
);
return
isAdd
?
HttpResultResponse
.
success
()
:
HttpResultResponse
.
error
();
}
/**
* edit the addAirport to the workspace
* @param airport
* @return
*/
@PostMapping
(
"/{workspace_id}/editAirport"
)
public
HttpResultResponse
editAirport
(
@RequestBody
DeviceDTO
airport
,
@PathVariable
(
"workspace_id"
)
String
workspaceId
)
{
airport
.
setWorkspaceId
(
workspaceId
);
boolean
isAdd
=
deviceService
.
editAirport
(
airport
);
return
isAdd
?
HttpResultResponse
.
success
()
:
HttpResultResponse
.
error
();
}
/**
* get device Dictionary
* @param workspaceId
* @return
*/
@GetMapping
(
"/{workspace_id}/deviceDictionary"
)
public
HttpResultResponse
getDeviceDictionary
(
@PathVariable
(
"workspace_id"
)
String
workspaceId
,
@RequestParam
(
value
=
"domain"
,
required
=
false
)
Integer
domain
)
{
List
<
DeviceDictionaryDTO
>
infoList
=
deviceDictionaryService
.
getDictionaryInfoList
(
domain
);
return
CollectionUtils
.
isEmpty
(
infoList
)
?
HttpResultResponse
.
error
(
"deviceDictionary not found."
)
:
HttpResultResponse
.
success
(
infoList
);
}
/**
* Get the binding devices list in one workspace.
* @param workspaceId
* @param page
* @param pageSize
* @return
*/
@GetMapping
(
"/{workspace_id}/devices/list"
)
public
HttpResultResponse
<
PaginationData
<
DeviceDTO
>>
getDevicesWithDomain
(
@PathVariable
(
"workspace_id"
)
String
workspaceId
,
@RequestParam
(
value
=
"domain"
,
required
=
false
)
Integer
domain
,
@RequestParam
(
value
=
"device_name"
,
required
=
false
)
String
deviceName
,
@RequestParam
(
defaultValue
=
"1"
)
Long
page
,
@RequestParam
(
value
=
"page_size"
,
defaultValue
=
"50"
)
Long
pageSize
)
{
PaginationData
<
DeviceDTO
>
devices
=
deviceService
.
getDevicesWithDomain
(
workspaceId
,
deviceName
,
page
,
pageSize
,
domain
);
return
HttpResultResponse
.
success
(
devices
);
}
/**
* Removing the binding state of the device.
* @param deviceSn
* @return
*/
@DeleteMapping
(
"/{device_sn}/delete"
)
public
HttpResultResponse
deleteDevice
(
@PathVariable
(
"device_sn"
)
String
deviceSn
)
{
deviceService
.
deleteDevice
(
deviceSn
);
return
HttpResultResponse
.
success
();
}
}
\ No newline at end of file
sample/src/main/java/com/dji/sample/manage/model/dto/DeviceDTO.java
View file @
e2a15963
...
...
@@ -25,6 +25,8 @@ import java.util.List;
@Builder
public
class
DeviceDTO
{
private
Integer
id
;
private
String
deviceSn
;
private
String
deviceName
;
...
...
sample/src/main/java/com/dji/sample/manage/service/IDeviceDictionaryService.java
View file @
e2a15963
...
...
@@ -2,6 +2,7 @@ package com.dji.sample.manage.service;
import
com.dji.sample.manage.model.dto.DeviceDictionaryDTO
;
import
java.util.List
;
import
java.util.Optional
;
/**
...
...
@@ -21,4 +22,6 @@ public interface IDeviceDictionaryService {
*/
Optional
<
DeviceDictionaryDTO
>
getOneDictionaryInfoByTypeSubType
(
Integer
domain
,
Integer
deviceType
,
Integer
subType
);
List
<
DeviceDictionaryDTO
>
getDictionaryInfoList
(
Integer
domain
);
}
sample/src/main/java/com/dji/sample/manage/service/IDeviceService.java
View file @
e2a15963
...
...
@@ -140,6 +140,18 @@ public interface IDeviceService {
* @return
*/
PaginationData
<
DeviceDTO
>
getBoundDevicesWithDomain
(
String
workspaceId
,
String
deviceName
,
Long
page
,
Long
pageSize
,
Integer
domain
);
/**
* Get the devices list in one workspace.
* @param workspaceId
* @param deviceName 设备名称
* @param page
* @param pageSize
* @param domain
* @return
*/
PaginationData
<
DeviceDTO
>
getDevicesWithDomain
(
String
workspaceId
,
String
deviceName
,
Long
page
,
Long
pageSize
,
Integer
domain
);
/**
* Unbind device base on device's sn.
* @param deviceSn
...
...
@@ -147,6 +159,13 @@ public interface IDeviceService {
void
unbindDevice
(
String
deviceSn
);
/**
* delete device base on device's sn
* @param deviceSn
* @return
*/
boolean
deleteDevice
(
String
deviceSn
);
/**
* Get device information based on device's sn.
* @param sn device's sn
* @return device
...
...
@@ -207,4 +226,13 @@ public interface IDeviceService {
void
pushOsdDataToWeb
(
String
workspaceId
,
BizCodeEnum
codeEnum
,
String
sn
,
Object
data
);
void
updateFlightControl
(
DeviceDTO
gateway
,
ControlSourceEnum
controlSource
);
boolean
addDrone
(
DeviceDTO
drone
);
boolean
editDrone
(
DeviceDTO
drone
);
boolean
addAirport
(
DeviceDTO
airport
);
boolean
editAirport
(
DeviceDTO
airport
);
}
\ No newline at end of file
sample/src/main/java/com/dji/sample/manage/service/impl/DeviceDictionaryServiceImpl.java
View file @
e2a15963
...
...
@@ -8,8 +8,12 @@ import com.dji.sample.manage.service.IDeviceDictionaryService;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
/**
*
...
...
@@ -39,6 +43,21 @@ public class DeviceDictionaryServiceImpl implements IDeviceDictionaryService {
.
last
(
" limit 1 "
))));
}
@Override
public
List
<
DeviceDictionaryDTO
>
getDictionaryInfoList
(
Integer
domain
)
{
LambdaQueryWrapper
<
DeviceDictionaryEntity
>
wrapper
=
new
LambdaQueryWrapper
<>();
if
(
domain
!=
null
)
{
wrapper
.
eq
(
DeviceDictionaryEntity:
:
getDomain
,
domain
);
}
List
<
DeviceDictionaryEntity
>
deviceDictionaryEntities
=
mapper
.
selectList
(
wrapper
);
if
(
CollectionUtils
.
isEmpty
(
deviceDictionaryEntities
))
{
return
new
ArrayList
<>();
}
return
deviceDictionaryEntities
.
stream
().
map
(
this
::
entityConvertToDTO
).
collect
(
Collectors
.
toList
());
}
/**
* Convert database entity objects into dictionary data transfer object.
* @param entity
...
...
sample/src/main/java/com/dji/sample/manage/service/impl/DeviceServiceImpl.java
View file @
e2a15963
This diff is collapsed.
Click to expand it.
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