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
0488ba69
Commit
0488ba69
authored
Feb 07, 2026
by
gdj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查询设备统计信息
parent
b8e2b919
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
133 additions
and
3 deletions
+133
-3
sample/src/main/java/com/dji/sample/manage/controller/DeviceController.java
+14
-3
sample/src/main/java/com/dji/sample/manage/service/IDeviceService.java
+7
-0
sample/src/main/java/com/dji/sample/manage/service/impl/DeviceDetailServiceImpl.java
+3
-0
sample/src/main/java/com/dji/sample/manage/service/impl/DeviceServiceImpl.java
+109
-0
No files found.
sample/src/main/java/com/dji/sample/manage/controller/DeviceController.java
View file @
0488ba69
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.model.dto.*
;
import
com.dji.sample.manage.model.param.DeviceSearchParam
;
import
com.dji.sample.manage.service.IDeviceDictionaryService
;
import
com.dji.sample.manage.service.IDeviceService
;
...
...
@@ -336,4 +334,16 @@ public class DeviceController {
return
HttpResultResponse
.
success
();
}
/**
* 查询设备统计信息
* @param workspaceId
* @return
*/
@GetMapping
(
"/{workspace_id}/devices/deviceInfoTotal"
)
public
HttpResultResponse
<
DeviceDetailCountDTO
>
getDeviceInfoTotal
(
@PathVariable
(
"workspace_id"
)
String
workspaceId
)
{
DeviceDetailCountDTO
deviceInfoTotal
=
deviceService
.
getDeviceInfoTotal
(
workspaceId
);
return
HttpResultResponse
.
success
(
deviceInfoTotal
);
}
}
\ No newline at end of file
sample/src/main/java/com/dji/sample/manage/service/IDeviceService.java
View file @
0488ba69
...
...
@@ -3,6 +3,7 @@ package com.dji.sample.manage.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.dji.sample.component.websocket.model.BizCodeEnum
;
import
com.dji.sample.manage.model.dto.DeviceDTO
;
import
com.dji.sample.manage.model.dto.DeviceDetailCountDTO
;
import
com.dji.sample.manage.model.dto.DeviceFirmwareUpgradeDTO
;
import
com.dji.sample.manage.model.dto.TopologyDeviceDTO
;
import
com.dji.sample.manage.model.entity.DeviceEntity
;
...
...
@@ -167,6 +168,8 @@ public interface IDeviceService extends IService<DeviceEntity> {
*/
PaginationData
<
DeviceDTO
>
getDevicesByParam
(
DeviceSearchParam
param
,
String
workspaceId
,
Long
page
,
Long
pageSize
);
List
<
DeviceDTO
>
getDeviceListByParam
(
DeviceSearchParam
param
,
String
workspaceId
);
/**
* Get the devices list no workspace.
...
...
@@ -288,4 +291,7 @@ public interface IDeviceService extends IService<DeviceEntity> {
void
recoverDeviceOnline
(
String
deviceSn
);
void
recoverGatewayOnline
(
String
gatewaySn
);
void
recoverDroneOnline
(
String
droneSn
);
DeviceDetailCountDTO
getDeviceInfoTotal
(
String
workspaceId
);
}
\ No newline at end of file
sample/src/main/java/com/dji/sample/manage/service/impl/DeviceDetailServiceImpl.java
View file @
0488ba69
...
...
@@ -75,6 +75,9 @@ public class DeviceDetailServiceImpl extends ServiceImpl<IDeviceDetailMapper, De
deviceDetailCountDTO
.
setTotalFlightDistance
(
BigDecimal
.
ZERO
);
deviceDetailCountDTO
.
setTotalFlightTime
(
BigDecimal
.
ZERO
);
if
(
CollectionUtils
.
isEmpty
(
deviceSnList
))
{
return
deviceDetailCountDTO
;
}
// 查询数据
LambdaQueryWrapper
<
DeviceDetailEntity
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
in
(
DeviceDetailEntity:
:
getDeviceSn
,
deviceSnList
);
...
...
sample/src/main/java/com/dji/sample/manage/service/impl/DeviceServiceImpl.java
View file @
0488ba69
...
...
@@ -141,6 +141,9 @@ public class DeviceServiceImpl extends ServiceImpl<IDeviceMapper, DeviceEntity>
@Autowired
private
IUserOrgService
userOrgService
;
@Autowired
private
IDeviceDetailService
deviceDetailService
;
@Override
public
void
subDeviceOffline
(
String
deviceSn
)
{
// If no information about this device exists in the cache, the drone is considered to be offline.
...
...
@@ -659,6 +662,97 @@ public class DeviceServiceImpl extends ServiceImpl<IDeviceMapper, DeviceEntity>
return
new
PaginationData
<>(
devicesList
,
new
Pagination
(
pagination
.
getCurrent
(),
pagination
.
getSize
(),
pagination
.
getTotal
()));
}
@Override
public
List
<
DeviceDTO
>
getDeviceListByParam
(
DeviceSearchParam
param
,
String
workspaceId
)
{
LambdaQueryWrapper
<
DeviceEntity
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
DeviceEntity:
:
getDomain
,
param
.
getDomain
());
wrapper
.
eq
(
DeviceEntity:
:
getWorkspaceId
,
workspaceId
);
// 设备名称
if
(
StringUtils
.
hasText
(
param
.
getDeviceName
()))
{
wrapper
.
like
(
DeviceEntity:
:
getDeviceName
,
param
.
getDeviceName
());
}
// 昵称
if
(
StringUtils
.
hasText
(
param
.
getNickname
()))
{
wrapper
.
like
(
DeviceEntity:
:
getNickname
,
param
.
getNickname
());
}
// 绑定状态
if
(
param
.
getBoundStatus
()
!=
null
)
{
wrapper
.
like
(
DeviceEntity:
:
getBoundStatus
,
param
.
getBoundStatus
());
}
if
(
StringUtils
.
hasText
(
param
.
getOrgId
()))
{
// 查询 指定团队的设备
LambdaQueryWrapper
<
DeviceOrgEntity
>
deviceOrgQueryWrapper
=
new
LambdaQueryWrapper
<>();
deviceOrgQueryWrapper
.
eq
(
DeviceOrgEntity:
:
getWorkspaceId
,
workspaceId
);
deviceOrgQueryWrapper
.
eq
(
DeviceOrgEntity:
:
getOrgId
,
param
.
getOrgId
());
List
<
DeviceOrgEntity
>
deviceOrgEntities
=
deviceOrgService
.
list
(
deviceOrgQueryWrapper
);
if
(
CollectionUtils
.
isEmpty
(
deviceOrgEntities
))
{
return
new
ArrayList
<>();
}
List
<
String
>
deviceSnList
=
deviceOrgEntities
.
stream
().
map
(
DeviceOrgEntity:
:
getDeviceSn
).
distinct
().
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
deviceSnList
))
{
return
new
ArrayList
<>();
}
wrapper
.
in
(
DeviceEntity:
:
getDeviceSn
,
deviceSnList
);
}
else
{
// 假如不是超级管理员 只能查询自己所属团队的设备
if
(
aboveSysAdminRole
())
{
}
else
{
// 查询自己团队
LambdaQueryWrapper
<
UserOrgEntity
>
userOrgQueryWrapper
=
new
LambdaQueryWrapper
<>();
userOrgQueryWrapper
.
eq
(
UserOrgEntity:
:
getUserId
,
getUserId
());
userOrgQueryWrapper
.
eq
(
UserOrgEntity:
:
getWorkspaceId
,
workspaceId
);
List
<
UserOrgEntity
>
userOrgEntities
=
userOrgService
.
list
(
userOrgQueryWrapper
);
if
(
CollectionUtils
.
isEmpty
(
userOrgEntities
))
{
return
new
ArrayList
<>();
}
List
<
String
>
userOrgIdList
=
userOrgEntities
.
stream
().
map
(
UserOrgEntity:
:
getOrgId
).
distinct
().
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
userOrgIdList
))
{
return
new
ArrayList
<>();
}
// 查询 团队的设备
LambdaQueryWrapper
<
DeviceOrgEntity
>
deviceOrgQueryWrapper
=
new
LambdaQueryWrapper
<>();
deviceOrgQueryWrapper
.
eq
(
DeviceOrgEntity:
:
getWorkspaceId
,
workspaceId
);
deviceOrgQueryWrapper
.
in
(
DeviceOrgEntity:
:
getOrgId
,
userOrgIdList
);
List
<
DeviceOrgEntity
>
deviceOrgEntities
=
deviceOrgService
.
list
(
deviceOrgQueryWrapper
);
if
(
CollectionUtils
.
isEmpty
(
deviceOrgEntities
))
{
return
new
ArrayList
<>();
}
List
<
String
>
deviceSnList
=
deviceOrgEntities
.
stream
().
map
(
DeviceOrgEntity:
:
getDeviceSn
).
distinct
().
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
deviceSnList
))
{
return
new
ArrayList
<>();
}
wrapper
.
in
(
DeviceEntity:
:
getDeviceSn
,
deviceSnList
);
}
}
List
<
DeviceEntity
>
deviceEntityList
=
this
.
list
(
wrapper
);
List
<
DeviceDTO
>
devicesList
=
deviceEntityList
.
stream
().
map
(
this
::
deviceEntityConvertToDTO
)
.
peek
(
device
->
{
if
(
StringUtils
.
hasText
(
device
.
getDeviceSn
()))
{
device
.
setStatus
(
deviceRedisService
.
checkDeviceOnline
(
device
.
getDeviceSn
()));
}
if
(
StringUtils
.
hasText
(
device
.
getChildDeviceSn
()))
{
Optional
<
DeviceDTO
>
childOpt
=
this
.
getDeviceBySn
(
device
.
getChildDeviceSn
());
childOpt
.
ifPresent
(
child
->
{
child
.
setStatus
(
deviceRedisService
.
checkDeviceOnline
(
child
.
getDeviceSn
()));
child
.
setWorkspaceName
(
device
.
getWorkspaceName
());
device
.
setChildren
(
child
);
});
}
})
.
collect
(
Collectors
.
toList
());
return
devicesList
;
}
/**
* Get the devices list no workspace.
* @param workspaceId
...
...
@@ -1633,4 +1727,18 @@ public class DeviceServiceImpl extends ServiceImpl<IDeviceMapper, DeviceEntity>
}
@Override
public
DeviceDetailCountDTO
getDeviceInfoTotal
(
String
workspaceId
)
{
// 查询 当前组织的设备 查询设备数据
List
<
String
>
deviceSnList
=
new
ArrayList
<>();
List
<
DeviceDTO
>
deviceDTOList
=
this
.
getDeviceListByParam
(
new
DeviceSearchParam
(),
workspaceId
);
deviceSnList
=
deviceDTOList
.
stream
().
map
(
DeviceDTO:
:
getDeviceSn
).
distinct
().
collect
(
Collectors
.
toList
());
DeviceDetailCountDTO
deviceDetailCountDTO
=
deviceDetailService
.
searchList
(
deviceSnList
);
return
deviceDetailCountDTO
;
}
}
\ No newline at end of file
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