Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zh-baseversion-project
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王浩
zh-baseversion-project
Commits
04ea5dcf
Commit
04ea5dcf
authored
Sep 05, 2024
by
wanghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1 基础信息维护-用户管理-燃气用户 大屏展示数据结构 接口重新调整封装。
2 基础信息维护-用户管理-燃气用户 大屏展示时 居民用户 按照分页展示接口功能开发。
parent
8f42cb1c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
16 deletions
+64
-16
TDetectorUserServiceImpl.java
.../zehong/system/service/impl/TDetectorUserServiceImpl.java
+64
-16
No files found.
zh-baseversion-system/src/main/java/com/zehong/system/service/impl/TDetectorUserServiceImpl.java
View file @
04ea5dcf
...
...
@@ -176,13 +176,11 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
List
<
TDetectorUserVillageSafetyDeviceInfoVo
>
tDetectorUserVillageSafetyDeviceInfoVos
=
tDetectorUserMapper
.
queryDuserVilSafDevInfo
(
tDetectorUser
);
List
<
Map
<
String
,
Object
>>
maps
=
residentsUserInit
(
tDetectorUserVillageSafetyDeviceInfoVos
);
// 数据封装
List
<
Map
<
String
,
Object
>>
maps
=
residentsUserInitForPage
(
tDetectorUserVillageSafetyDeviceInfoVos
);
if
(
maps
.
size
()
>
0
)
{
Object
userMapList
=
maps
.
get
(
0
).
get
(
"userMapList"
);
if
(
userMapList
!=
null
)
{
return
(
List
<
Map
<
String
,
Object
>>)
userMapList
;
}
return
maps
;
}
return
new
ArrayList
<>();
...
...
@@ -327,14 +325,15 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
}
/**
* 居民用户 处理方式封装
* 居民用户 处理方式封装
提供分压查询功能了。
* @param residentsUsers r
* @return m
*/
private
List
<
Map
<
String
,
Object
>>
residentsUserInit
(
List
<
TDetectorUserVillageSafetyDeviceInfoVo
>
residentsUsers
)
{
private
List
<
Map
<
String
,
Object
>>
residentsUserInitForPage
(
List
<
TDetectorUserVillageSafetyDeviceInfoVo
>
residentsUsers
)
{
//返回 userlist
List
<
Map
<
String
,
Object
>>
userMapList
=
new
ArrayList
<>();
//遍历 村 集合
List
<
Map
<
String
,
Object
>>
villageMapList
=
new
ArrayList
<>();
if
(
residentsUsers
.
size
()
>
0
)
{
// 如果没关联村的就不展示了
...
...
@@ -345,19 +344,12 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
for
(
Map
.
Entry
<
Long
,
List
<
TDetectorUserVillageSafetyDeviceInfoVo
>>
longListEntry
:
collect1
.
entrySet
())
{
List
<
TDetectorUserVillageSafetyDeviceInfoVo
>
villageList
=
longListEntry
.
getValue
();
Long
key1
=
longListEntry
.
getKey
();
// 封装 村数据
Map
<
String
,
Object
>
villageMapListItem
=
new
HashMap
<>();
villageMapListItem
.
put
(
"villageId"
,
key1
);
villageMapListItem
.
put
(
"villageName"
,
villageList
.
get
(
0
).
getVillageName
());
villageMapListItem
.
put
(
"address"
,
villageList
.
get
(
0
).
getRegionName
());
int
userNum
=
0
;
int
deviceNum
=
0
;
// 按照 用户 分组
Map
<
Long
,
List
<
TDetectorUserVillageSafetyDeviceInfoVo
>>
collect2
=
villageList
.
stream
().
collect
(
Collectors
.
groupingBy
(
TDetectorUserVillageSafetyDeviceInfoVo:
:
getUserId
));
List
<
Map
<
String
,
Object
>>
userMapList
=
new
ArrayList
<>();
if
(
collect2
.
size
()
>
0
)
{
// 拿到用户数,并组装用户数据
userNum
=
collect2
.
size
();
...
...
@@ -409,6 +401,62 @@ public class TDetectorUserServiceImpl implements ITDetectorUserService
userMapList
.
add
(
userMapListItme
);
}
}
}
}
return
userMapList
;
}
/**
* 居民用户 处理方式封装
* @param residentsUsers r
* @return m
*/
private
List
<
Map
<
String
,
Object
>>
residentsUserInit
(
List
<
TDetectorUserVillageSafetyDeviceInfoVo
>
residentsUsers
)
{
//遍历 村 集合
List
<
Map
<
String
,
Object
>>
villageMapList
=
new
ArrayList
<>();
if
(
residentsUsers
.
size
()
>
0
)
{
// 如果没关联村的就不展示了
List
<
TDetectorUserVillageSafetyDeviceInfoVo
>
collect
=
residentsUsers
.
stream
().
filter
(
item
->
item
.
getVillageId
()
!=
null
).
collect
(
Collectors
.
toList
());
//按照 村id 分组
Map
<
Long
,
List
<
TDetectorUserVillageSafetyDeviceInfoVo
>>
collect1
=
collect
.
stream
().
collect
(
Collectors
.
groupingBy
(
TDetectorUserVillageSafetyDeviceInfoVo:
:
getVillageId
));
for
(
Map
.
Entry
<
Long
,
List
<
TDetectorUserVillageSafetyDeviceInfoVo
>>
longListEntry
:
collect1
.
entrySet
())
{
List
<
TDetectorUserVillageSafetyDeviceInfoVo
>
villageList
=
longListEntry
.
getValue
();
Long
key1
=
longListEntry
.
getKey
();
// 封装 村数据
Map
<
String
,
Object
>
villageMapListItem
=
new
HashMap
<>();
villageMapListItem
.
put
(
"villageId"
,
key1
);
villageMapListItem
.
put
(
"villageName"
,
villageList
.
get
(
0
).
getVillageName
());
villageMapListItem
.
put
(
"address"
,
villageList
.
get
(
0
).
getRegionName
());
int
userNum
=
0
;
int
deviceNum
=
0
;
// 按照 用户 分组
Map
<
Long
,
List
<
TDetectorUserVillageSafetyDeviceInfoVo
>>
collect2
=
villageList
.
stream
().
collect
(
Collectors
.
groupingBy
(
TDetectorUserVillageSafetyDeviceInfoVo:
:
getUserId
));
List
<
Map
<
String
,
Object
>>
userMapList
=
new
ArrayList
<>();
if
(
collect2
.
size
()
>
0
)
{
// 拿到用户数,并组装用户数据
userNum
=
collect2
.
size
();
for
(
Map
.
Entry
<
Long
,
List
<
TDetectorUserVillageSafetyDeviceInfoVo
>>
listEntry
:
collect2
.
entrySet
())
{
List
<
TDetectorUserVillageSafetyDeviceInfoVo
>
userList
=
listEntry
.
getValue
();
// 过滤掉 没有 安全装置的
List
<
TDetectorUserVillageSafetyDeviceInfoVo
>
collect4
=
userList
.
stream
().
filter
(
item
->
item
.
getGasUserSafetyDeviceId
()
!=
null
).
collect
(
Collectors
.
toList
());
// 按照 安全装置 分组
Map
<
Long
,
List
<
TDetectorUserVillageSafetyDeviceInfoVo
>>
collect3
=
collect4
.
stream
().
collect
(
Collectors
.
groupingBy
(
TDetectorUserVillageSafetyDeviceInfoVo:
:
getGasUserSafetyDeviceId
));
if
(
collect3
.
size
()
>
0
)
{
// 拿到每个 用户下 安全装置 数 相加。
deviceNum
+=
collect3
.
size
();
}
}
}
villageMapListItem
.
put
(
"userNum"
,
userNum
);
villageMapListItem
.
put
(
"deviceNum"
,
deviceNum
);
...
...
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