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
a0d7ec9d
Commit
a0d7ec9d
authored
Mar 14, 2025
by
gdj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加查询条件。
parent
1f16ad0b
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
133 additions
and
19 deletions
+133
-19
sample/src/main/java/com/dji/sample/manage/controller/DeviceController.java
+2
-1
sample/src/main/java/com/dji/sample/manage/controller/LiveStreamController.java
+16
-0
sample/src/main/java/com/dji/sample/manage/service/IDeviceService.java
+10
-0
sample/src/main/java/com/dji/sample/manage/service/ILiveStreamService.java
+8
-0
sample/src/main/java/com/dji/sample/manage/service/impl/DeviceServiceImpl.java
+16
-6
sample/src/main/java/com/dji/sample/manage/service/impl/LiveStreamServiceImpl.java
+24
-0
sample/src/main/java/com/dji/sample/media/controller/FileController.java
+3
-1
sample/src/main/java/com/dji/sample/media/service/IFileService.java
+11
-0
sample/src/main/java/com/dji/sample/media/service/impl/FileServiceImpl.java
+16
-5
sample/src/main/java/com/dji/sample/wayline/controller/WaylineJobController.java
+2
-1
sample/src/main/java/com/dji/sample/wayline/service/IWaylineJobService.java
+10
-0
sample/src/main/java/com/dji/sample/wayline/service/impl/WaylineJobServiceImpl.java
+15
-5
No files found.
sample/src/main/java/com/dji/sample/manage/controller/DeviceController.java
View file @
a0d7ec9d
...
@@ -76,9 +76,10 @@ public class DeviceController {
...
@@ -76,9 +76,10 @@ public class DeviceController {
@GetMapping
(
"/{workspace_id}/devices/bound"
)
@GetMapping
(
"/{workspace_id}/devices/bound"
)
public
HttpResultResponse
<
PaginationData
<
DeviceDTO
>>
getBoundDevicesWithDomain
(
public
HttpResultResponse
<
PaginationData
<
DeviceDTO
>>
getBoundDevicesWithDomain
(
@PathVariable
(
"workspace_id"
)
String
workspaceId
,
Integer
domain
,
@PathVariable
(
"workspace_id"
)
String
workspaceId
,
Integer
domain
,
@RequestParam
(
value
=
"device_name"
,
required
=
false
)
String
deviceName
,
@RequestParam
(
defaultValue
=
"1"
)
Long
page
,
@RequestParam
(
defaultValue
=
"1"
)
Long
page
,
@RequestParam
(
value
=
"page_size"
,
defaultValue
=
"50"
)
Long
pageSize
)
{
@RequestParam
(
value
=
"page_size"
,
defaultValue
=
"50"
)
Long
pageSize
)
{
PaginationData
<
DeviceDTO
>
devices
=
deviceService
.
getBoundDevicesWithDomain
(
workspaceId
,
page
,
pageSize
,
domain
);
PaginationData
<
DeviceDTO
>
devices
=
deviceService
.
getBoundDevicesWithDomain
(
workspaceId
,
deviceName
,
page
,
pageSize
,
domain
);
return
HttpResultResponse
.
success
(
devices
);
return
HttpResultResponse
.
success
(
devices
);
}
}
...
...
sample/src/main/java/com/dji/sample/manage/controller/LiveStreamController.java
View file @
a0d7ec9d
...
@@ -48,6 +48,22 @@ public class LiveStreamController {
...
@@ -48,6 +48,22 @@ public class LiveStreamController {
}
}
/**
/**
* Get live capability data of all drones in the current user's workspace from the database.
* @param request
* @return live capability
*/
@GetMapping
(
"/oneCapacity"
)
public
HttpResultResponse
<
CapacityDeviceDTO
>
getLiveCapacityByDeviceSn
(
HttpServletRequest
request
,
@RequestParam
(
value
=
"device_sn"
)
String
deviceSn
)
{
// Get information about the current user.
CustomClaim
customClaim
=
(
CustomClaim
)
request
.
getAttribute
(
TOKEN_CLAIM
);
CapacityDeviceDTO
liveCapacity
=
liveStreamService
.
getLiveCapacity
(
customClaim
.
getWorkspaceId
(),
deviceSn
);
return
HttpResultResponse
.
success
(
liveCapacity
);
}
/**
* Live streaming according to the parameters passed in from the web side.
* Live streaming according to the parameters passed in from the web side.
* @param liveParam Live streaming parameters.
* @param liveParam Live streaming parameters.
* @return
* @return
...
...
sample/src/main/java/com/dji/sample/manage/service/IDeviceService.java
View file @
a0d7ec9d
...
@@ -131,6 +131,16 @@ public interface IDeviceService {
...
@@ -131,6 +131,16 @@ public interface IDeviceService {
PaginationData
<
DeviceDTO
>
getBoundDevicesWithDomain
(
String
workspaceId
,
Long
page
,
Long
pageSize
,
Integer
domain
);
PaginationData
<
DeviceDTO
>
getBoundDevicesWithDomain
(
String
workspaceId
,
Long
page
,
Long
pageSize
,
Integer
domain
);
/**
/**
* Get the binding devices list in one workspace.
* @param workspaceId
* @param deviceName 设备名称
* @param page
* @param pageSize
* @param domain
* @return
*/
PaginationData
<
DeviceDTO
>
getBoundDevicesWithDomain
(
String
workspaceId
,
String
deviceName
,
Long
page
,
Long
pageSize
,
Integer
domain
);
/**
* Unbind device base on device's sn.
* Unbind device base on device's sn.
* @param deviceSn
* @param deviceSn
*/
*/
...
...
sample/src/main/java/com/dji/sample/manage/service/ILiveStreamService.java
View file @
a0d7ec9d
...
@@ -15,6 +15,14 @@ import java.util.List;
...
@@ -15,6 +15,14 @@ import java.util.List;
public
interface
ILiveStreamService
{
public
interface
ILiveStreamService
{
/**
/**
* Get the drone data that can be broadcast live in this workspace.
* @param workspaceId
* @param deviceSn 设备sn
* @return
*/
CapacityDeviceDTO
getLiveCapacity
(
String
workspaceId
,
String
deviceSn
);
/**
* Get all the drone data that can be broadcast live in this workspace.
* Get all the drone data that can be broadcast live in this workspace.
* @param workspaceId
* @param workspaceId
* @return
* @return
...
...
sample/src/main/java/com/dji/sample/manage/service/impl/DeviceServiceImpl.java
View file @
a0d7ec9d
...
@@ -465,14 +465,24 @@ public class DeviceServiceImpl implements IDeviceService {
...
@@ -465,14 +465,24 @@ public class DeviceServiceImpl implements IDeviceService {
}
}
@Override
@Override
public
PaginationData
<
DeviceDTO
>
getBoundDevicesWithDomain
(
String
workspaceId
,
Long
page
,
public
PaginationData
<
DeviceDTO
>
getBoundDevicesWithDomain
(
String
workspaceId
,
Long
page
,
Long
pageSize
,
Integer
domain
)
{
return
getBoundDevicesWithDomain
(
workspaceId
,
null
,
page
,
pageSize
,
domain
);
}
@Override
public
PaginationData
<
DeviceDTO
>
getBoundDevicesWithDomain
(
String
workspaceId
,
String
deviceName
,
Long
page
,
Long
pageSize
,
Integer
domain
)
{
Long
pageSize
,
Integer
domain
)
{
Page
<
DeviceEntity
>
pagination
=
mapper
.
selectPage
(
new
Page
<>(
page
,
pageSize
),
LambdaQueryWrapper
<
DeviceEntity
>
wrapper
=
new
LambdaQueryWrapper
<
DeviceEntity
>()
new
LambdaQueryWrapper
<
DeviceEntity
>()
.
eq
(
DeviceEntity:
:
getDomain
,
domain
)
.
eq
(
DeviceEntity:
:
getDomain
,
domain
)
.
eq
(
DeviceEntity:
:
getWorkspaceId
,
workspaceId
)
.
eq
(
DeviceEntity:
:
getWorkspaceId
,
workspaceId
)
.
eq
(
DeviceEntity:
:
getBoundStatus
,
true
);
.
eq
(
DeviceEntity:
:
getBoundStatus
,
true
));
if
(
StringUtils
.
hasText
(
deviceName
))
{
wrapper
.
like
(
DeviceEntity:
:
getDeviceName
,
deviceName
);
}
Page
<
DeviceEntity
>
pagination
=
mapper
.
selectPage
(
new
Page
<>(
page
,
pageSize
),
wrapper
);
List
<
DeviceDTO
>
devicesList
=
pagination
.
getRecords
().
stream
().
map
(
this
::
deviceEntityConvertToDTO
)
List
<
DeviceDTO
>
devicesList
=
pagination
.
getRecords
().
stream
().
map
(
this
::
deviceEntityConvertToDTO
)
.
peek
(
device
->
{
.
peek
(
device
->
{
device
.
setStatus
(
deviceRedisService
.
checkDeviceOnline
(
device
.
getDeviceSn
()));
device
.
setStatus
(
deviceRedisService
.
checkDeviceOnline
(
device
.
getDeviceSn
()));
...
...
sample/src/main/java/com/dji/sample/manage/service/impl/LiveStreamServiceImpl.java
View file @
a0d7ec9d
...
@@ -14,6 +14,7 @@ import com.dji.sdk.mqtt.services.TopicServicesResponse;
...
@@ -14,6 +14,7 @@ import com.dji.sdk.mqtt.services.TopicServicesResponse;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Objects
;
...
@@ -45,6 +46,29 @@ public class LiveStreamServiceImpl implements ILiveStreamService {
...
@@ -45,6 +46,29 @@ public class LiveStreamServiceImpl implements ILiveStreamService {
private
AbstractLivestreamService
abstractLivestreamService
;
private
AbstractLivestreamService
abstractLivestreamService
;
@Override
@Override
public
CapacityDeviceDTO
getLiveCapacity
(
String
workspaceId
,
String
deviceSn
)
{
// Query the devices in this workspace.
List
<
DeviceDTO
>
devicesList
=
deviceService
.
getDevicesByParams
(
DeviceQueryParam
.
builder
()
.
workspaceId
(
workspaceId
)
.
domains
(
List
.
of
(
DeviceDomainEnum
.
DRONE
.
getDomain
(),
DeviceDomainEnum
.
DOCK
.
getDomain
()))
.
deviceSn
(
deviceSn
)
.
build
());
CapacityDeviceDTO
capacityDeviceDTO
=
new
CapacityDeviceDTO
();
if
(
CollectionUtils
.
isEmpty
(
devicesList
))
{
return
capacityDeviceDTO
;
}
DeviceDTO
device
=
devicesList
.
get
(
0
);
capacityDeviceDTO
.
setName
(
Objects
.
requireNonNullElse
(
device
.
getNickname
(),
device
.
getDeviceName
()));
capacityDeviceDTO
.
setSn
(
device
.
getDeviceSn
());
capacityDeviceDTO
.
setCamerasList
(
capacityCameraService
.
getCapacityCameraByDeviceSn
(
device
.
getDeviceSn
()));
return
capacityDeviceDTO
;
}
@Override
public
List
<
CapacityDeviceDTO
>
getLiveCapacity
(
String
workspaceId
)
{
public
List
<
CapacityDeviceDTO
>
getLiveCapacity
(
String
workspaceId
)
{
// Query all devices in this workspace.
// Query all devices in this workspace.
...
...
sample/src/main/java/com/dji/sample/media/controller/FileController.java
View file @
a0d7ec9d
...
@@ -31,8 +31,10 @@ public class FileController {
...
@@ -31,8 +31,10 @@ public class FileController {
@GetMapping
(
"/{workspace_id}/files"
)
@GetMapping
(
"/{workspace_id}/files"
)
public
HttpResultResponse
<
PaginationData
<
MediaFileDTO
>>
getFilesList
(
@RequestParam
(
defaultValue
=
"1"
)
Long
page
,
public
HttpResultResponse
<
PaginationData
<
MediaFileDTO
>>
getFilesList
(
@RequestParam
(
defaultValue
=
"1"
)
Long
page
,
@RequestParam
(
name
=
"page_size"
,
defaultValue
=
"10"
)
Long
pageSize
,
@RequestParam
(
name
=
"page_size"
,
defaultValue
=
"10"
)
Long
pageSize
,
@RequestParam
(
name
=
"job_id"
,
required
=
false
)
String
jobId
,
@RequestParam
(
name
=
"drone"
,
required
=
false
)
String
drone
,
@PathVariable
(
name
=
"workspace_id"
)
String
workspaceId
)
{
@PathVariable
(
name
=
"workspace_id"
)
String
workspaceId
)
{
PaginationData
<
MediaFileDTO
>
filesList
=
fileService
.
getMediaFilesPaginationByWorkspaceId
(
workspaceId
,
page
,
pageSize
);
PaginationData
<
MediaFileDTO
>
filesList
=
fileService
.
getMediaFilesPaginationByWorkspaceId
(
workspaceId
,
jobId
,
drone
,
page
,
pageSize
);
return
HttpResultResponse
.
success
(
filesList
);
return
HttpResultResponse
.
success
(
filesList
);
}
}
...
...
sample/src/main/java/com/dji/sample/media/service/IFileService.java
View file @
a0d7ec9d
...
@@ -47,6 +47,17 @@ public interface IFileService {
...
@@ -47,6 +47,17 @@ public interface IFileService {
PaginationData
<
MediaFileDTO
>
getMediaFilesPaginationByWorkspaceId
(
String
workspaceId
,
long
page
,
long
pageSize
);
PaginationData
<
MediaFileDTO
>
getMediaFilesPaginationByWorkspaceId
(
String
workspaceId
,
long
page
,
long
pageSize
);
/**
/**
* Paginate through all media files in this workspace.
* @param workspaceId
* @param jobId 任务id
* @param drone 无人机id
* @param page
* @param pageSize
* @return
*/
PaginationData
<
MediaFileDTO
>
getMediaFilesPaginationByWorkspaceId
(
String
workspaceId
,
String
jobId
,
String
drone
,
long
page
,
long
pageSize
);
/**
* Get the download address of the file.
* Get the download address of the file.
* @param workspaceId
* @param workspaceId
* @param fileId
* @param fileId
...
...
sample/src/main/java/com/dji/sample/media/service/impl/FileServiceImpl.java
View file @
a0d7ec9d
...
@@ -18,6 +18,7 @@ import com.dji.sdk.common.PaginationData;
...
@@ -18,6 +18,7 @@ import com.dji.sdk.common.PaginationData;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.StringUtils
;
import
java.net.URL
;
import
java.net.URL
;
import
java.time.Instant
;
import
java.time.Instant
;
...
@@ -84,11 +85,21 @@ public class FileServiceImpl implements IFileService {
...
@@ -84,11 +85,21 @@ public class FileServiceImpl implements IFileService {
@Override
@Override
public
PaginationData
<
MediaFileDTO
>
getMediaFilesPaginationByWorkspaceId
(
String
workspaceId
,
long
page
,
long
pageSize
)
{
public
PaginationData
<
MediaFileDTO
>
getMediaFilesPaginationByWorkspaceId
(
String
workspaceId
,
long
page
,
long
pageSize
)
{
Page
<
MediaFileEntity
>
pageData
=
mapper
.
selectPage
(
return
getMediaFilesPaginationByWorkspaceId
(
workspaceId
,
null
,
null
,
page
,
pageSize
);
new
Page
<
MediaFileEntity
>(
page
,
pageSize
),
}
new
LambdaQueryWrapper
<
MediaFileEntity
>()
.
eq
(
MediaFileEntity:
:
getWorkspaceId
,
workspaceId
)
@Override
.
orderByDesc
(
MediaFileEntity:
:
getId
));
public
PaginationData
<
MediaFileDTO
>
getMediaFilesPaginationByWorkspaceId
(
String
workspaceId
,
String
jobId
,
String
drone
,
long
page
,
long
pageSize
)
{
LambdaQueryWrapper
<
MediaFileEntity
>
mediaFileQueryWrapper
=
new
LambdaQueryWrapper
<
MediaFileEntity
>()
.
eq
(
MediaFileEntity:
:
getWorkspaceId
,
workspaceId
)
.
orderByDesc
(
MediaFileEntity:
:
getId
);
if
(
StringUtils
.
hasText
(
jobId
))
{
mediaFileQueryWrapper
.
eq
(
MediaFileEntity:
:
getJobId
,
jobId
);
}
if
(
StringUtils
.
hasText
(
drone
))
{
mediaFileQueryWrapper
.
eq
(
MediaFileEntity:
:
getDrone
,
drone
);
}
Page
<
MediaFileEntity
>
pageData
=
mapper
.
selectPage
(
new
Page
<
MediaFileEntity
>(
page
,
pageSize
),
mediaFileQueryWrapper
);
List
<
MediaFileDTO
>
records
=
pageData
.
getRecords
()
List
<
MediaFileDTO
>
records
=
pageData
.
getRecords
()
.
stream
()
.
stream
()
.
map
(
this
::
entityConvertToDto
)
.
map
(
this
::
entityConvertToDto
)
...
...
sample/src/main/java/com/dji/sample/wayline/controller/WaylineJobController.java
View file @
a0d7ec9d
...
@@ -60,8 +60,9 @@ public class WaylineJobController {
...
@@ -60,8 +60,9 @@ public class WaylineJobController {
@GetMapping
(
"/{workspace_id}/jobs"
)
@GetMapping
(
"/{workspace_id}/jobs"
)
public
HttpResultResponse
<
PaginationData
<
WaylineJobDTO
>>
getJobs
(
@RequestParam
(
defaultValue
=
"1"
)
Long
page
,
public
HttpResultResponse
<
PaginationData
<
WaylineJobDTO
>>
getJobs
(
@RequestParam
(
defaultValue
=
"1"
)
Long
page
,
@RequestParam
(
name
=
"page_size"
,
defaultValue
=
"10"
)
Long
pageSize
,
@RequestParam
(
name
=
"page_size"
,
defaultValue
=
"10"
)
Long
pageSize
,
@RequestParam
(
name
=
"dock_sns"
,
required
=
false
)
String
dockSns
,
@PathVariable
(
name
=
"workspace_id"
)
String
workspaceId
)
{
@PathVariable
(
name
=
"workspace_id"
)
String
workspaceId
)
{
PaginationData
<
WaylineJobDTO
>
data
=
waylineJobService
.
getJobsByWorkspaceId
(
workspaceId
,
page
,
pageSize
);
PaginationData
<
WaylineJobDTO
>
data
=
waylineJobService
.
getJobsByWorkspaceId
(
workspaceId
,
dockSns
,
page
,
pageSize
);
return
HttpResultResponse
.
success
(
data
);
return
HttpResultResponse
.
success
(
data
);
}
}
...
...
sample/src/main/java/com/dji/sample/wayline/service/IWaylineJobService.java
View file @
a0d7ec9d
...
@@ -69,6 +69,16 @@ public interface IWaylineJobService {
...
@@ -69,6 +69,16 @@ public interface IWaylineJobService {
PaginationData
<
WaylineJobDTO
>
getJobsByWorkspaceId
(
String
workspaceId
,
long
page
,
long
pageSize
);
PaginationData
<
WaylineJobDTO
>
getJobsByWorkspaceId
(
String
workspaceId
,
long
page
,
long
pageSize
);
/**
/**
* Paginate through all jobs in this workspace.
* @param workspaceId
* @param dockSns 机场sn
* @param page
* @param pageSize
* @return
*/
PaginationData
<
WaylineJobDTO
>
getJobsByWorkspaceId
(
String
workspaceId
,
String
dockSns
,
long
page
,
long
pageSize
);
/**
* Query the wayline execution status of the dock.
* Query the wayline execution status of the dock.
* @param dockSn
* @param dockSn
* @return
* @return
...
...
sample/src/main/java/com/dji/sample/wayline/service/impl/WaylineJobServiceImpl.java
View file @
a0d7ec9d
...
@@ -152,11 +152,21 @@ public class WaylineJobServiceImpl implements IWaylineJobService {
...
@@ -152,11 +152,21 @@ public class WaylineJobServiceImpl implements IWaylineJobService {
@Override
@Override
public
PaginationData
<
WaylineJobDTO
>
getJobsByWorkspaceId
(
String
workspaceId
,
long
page
,
long
pageSize
)
{
public
PaginationData
<
WaylineJobDTO
>
getJobsByWorkspaceId
(
String
workspaceId
,
long
page
,
long
pageSize
)
{
Page
<
WaylineJobEntity
>
pageData
=
mapper
.
selectPage
(
return
getJobsByWorkspaceId
(
workspaceId
,
null
,
page
,
pageSize
);
new
Page
<
WaylineJobEntity
>(
page
,
pageSize
),
}
new
LambdaQueryWrapper
<
WaylineJobEntity
>()
.
eq
(
WaylineJobEntity:
:
getWorkspaceId
,
workspaceId
)
@Override
.
orderByDesc
(
WaylineJobEntity:
:
getId
));
public
PaginationData
<
WaylineJobDTO
>
getJobsByWorkspaceId
(
String
workspaceId
,
String
dockSns
,
long
page
,
long
pageSize
)
{
LambdaQueryWrapper
<
WaylineJobEntity
>
waylineJobQueryWrapper
=
new
LambdaQueryWrapper
<
WaylineJobEntity
>()
.
eq
(
WaylineJobEntity:
:
getWorkspaceId
,
workspaceId
)
.
orderByDesc
(
WaylineJobEntity:
:
getId
);
if
(
StringUtils
.
hasText
(
dockSns
))
{
List
<
String
>
dockSnList
=
Arrays
.
asList
(
dockSns
.
split
(
","
));
if
(!
CollectionUtils
.
isEmpty
(
dockSnList
))
{
waylineJobQueryWrapper
.
in
(
WaylineJobEntity:
:
getDockSn
,
dockSnList
);
}
}
Page
<
WaylineJobEntity
>
pageData
=
mapper
.
selectPage
(
new
Page
<
WaylineJobEntity
>(
page
,
pageSize
),
waylineJobQueryWrapper
);
List
<
WaylineJobDTO
>
records
=
pageData
.
getRecords
()
List
<
WaylineJobDTO
>
records
=
pageData
.
getRecords
()
.
stream
()
.
stream
()
.
map
(
this
::
entity2Dto
)
.
map
(
this
::
entity2Dto
)
...
...
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