处理问题
This commit is contained in:
parent
8d8dd5918c
commit
6916bde96d
@ -90,7 +90,7 @@ public class GridUserServiceImpl extends BaseService implements IGridUserService
|
||||
public List<GridUserDTO> list(String gridId, Map<String, Object> params) {
|
||||
List<GridRelationDTO> gridRelationDTOs = gridRelationService.listByGridId(gridId);
|
||||
if (gridRelationDTOs.isEmpty()) {
|
||||
return new ArrayList();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Set<String> userIdSet = new HashSet<>();
|
||||
for (GridRelationDTO gridRelationDTO : gridRelationDTOs) {
|
||||
@ -102,6 +102,40 @@ public class GridUserServiceImpl extends BaseService implements IGridUserService
|
||||
if (maps.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return listUserMap2GridUser(maps, gridId, gridRelationDTOs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<GridUserDTO>> listPage(String gridId, ListPage page) {
|
||||
List<GridRelationDTO> gridRelationDTOs = gridRelationService.listByGridId(gridId);
|
||||
if (gridRelationDTOs.isEmpty()) {
|
||||
return new SuccessResultList<>(new ArrayList<>(), 1, 0L);
|
||||
}
|
||||
Set<String> userIdSet = new HashSet<>();
|
||||
for (GridRelationDTO gridRelationDTO : gridRelationDTOs) {
|
||||
userIdSet.add(gridRelationDTO.getRelationId());
|
||||
}
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
Map<String, Object> query = getHashMap(2);
|
||||
query.put("userIds", new ArrayList<>(userIdSet));
|
||||
List<Map<String, Object>> maps = bindingDepartmentDao.listAllSysUser(query);
|
||||
PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(maps);
|
||||
if (maps.isEmpty()) {
|
||||
return new SuccessResultList<>(new ArrayList<>(), 1, 0L);
|
||||
}
|
||||
List<GridUserDTO> gridUserDTOs = listUserMap2GridUser(maps, gridId, gridRelationDTOs);
|
||||
return new SuccessResultList<>(gridUserDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户列表转网格用户
|
||||
*
|
||||
* @param maps
|
||||
* @param gridId
|
||||
* @param gridRelationDTOs
|
||||
* @return
|
||||
*/
|
||||
private List<GridUserDTO> listUserMap2GridUser(List<Map<String, Object>> maps, String gridId, List<GridRelationDTO> gridRelationDTOs) {
|
||||
List<UserDTO> userDTOs = maps.stream().map(kv -> {
|
||||
UserDTO userDTO = new UserDTO();
|
||||
userDTO.setUserId(kv.get("user_id").toString());
|
||||
@ -110,7 +144,6 @@ public class GridUserServiceImpl extends BaseService implements IGridUserService
|
||||
userDTO.setPhone(kv.get("user_phone") == null ? "-" : kv.get("user_phone").toString());
|
||||
return userDTO;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
List<GridUserDTO> gridUserDTOs = new ArrayList<>();
|
||||
for (UserDTO userDTO : userDTOs) {
|
||||
GridUserDTO gridUserDTO = new GridUserDTO();
|
||||
@ -127,12 +160,4 @@ public class GridUserServiceImpl extends BaseService implements IGridUserService
|
||||
return gridUserDTOs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<GridUserDTO>> listPage(String gridId, ListPage page) {
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
List<GridUserDTO> gridUserDTOs = list(gridId, page.getParams());
|
||||
PageInfo<GridUserDTO> pageInfo = new PageInfo<>(gridUserDTOs);
|
||||
return new SuccessResultList<>(gridUserDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user