Commit 04ea5dcf authored by wanghao's avatar wanghao

1 基础信息维护-用户管理-燃气用户 大屏展示数据结构 接口重新调整封装。

2 基础信息维护-用户管理-燃气用户 大屏展示时 居民用户 按照分页展示接口功能开发。
parent 8f42cb1c
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment