新增接口

This commit is contained in:
wanggeng888 2021-05-23 20:21:16 +08:00
parent b3d0e1d847
commit d6d6d612f5
2 changed files with 39 additions and 6 deletions

View File

@ -125,6 +125,15 @@ public interface IGridService {
* @return * @return
* @throws SearchException * @throws SearchException
*/ */
List<GridDTO> listGridGroupByRelationIds(List<String> relationIds) throws SearchException;
/**
* 获取全部网格列表
*
* @param relationIds
* @return
* @throws SearchException
*/
List<GridDTO> listGridByRelationIds(List<String> relationIds) throws SearchException; List<GridDTO> listGridByRelationIds(List<String> relationIds) throws SearchException;
/** /**

View File

@ -181,11 +181,10 @@ public class GridServiceImpl extends AbstractService implements IGridService {
} }
@Override @Override
public List<GridDTO> listGridByRelationIds(List<String> relationIds) throws SearchException { public List<GridDTO> listGridGroupByRelationIds(List<String> relationIds) throws SearchException {
if (relationIds == null || relationIds.size() == 0) { if (relationIds == null || relationIds.size() == 0) {
return new ArrayList<>(); return new ArrayList<>();
} }
// List<GridDTO> gridDTOs = gridDao.listGridGroupByRelationIds(relationIds);
List<GridDTO> gridDTOs = gridDao.listGridByRelationIds(relationIds); List<GridDTO> gridDTOs = gridDao.listGridByRelationIds(relationIds);
if (gridDTOs.isEmpty()) { if (gridDTOs.isEmpty()) {
return gridDTOs; return gridDTOs;
@ -216,17 +215,43 @@ public class GridServiceImpl extends AbstractService implements IGridService {
continue; continue;
} }
} }
setGridPoints(gridGroupDTOs);
return gridGroupDTOs;
}
@Override
public List<GridDTO> listGridByRelationIds(List<String> relationIds) throws SearchException {
if (relationIds == null || relationIds.size() == 0) {
return new ArrayList<>();
}
List<GridDTO> gridDTOs = gridDao.listGridByRelationIds(relationIds);
if (gridDTOs.isEmpty()) {
return gridDTOs;
}
setGridPoints(gridDTOs);
return gridDTOs;
}
/**
* 设置网格点
*
* @param gridDTOs
*/
private void setGridPoints(List<GridDTO> gridDTOs) {
if (gridDTOs.isEmpty()) {
return;
}
List<String> gridIds = new ArrayList<>(); List<String> gridIds = new ArrayList<>();
for (GridDTO gridDTO : gridGroupDTOs) { for (GridDTO gridDTO : gridDTOs) {
gridIds.add(gridDTO.getGridId()); gridIds.add(gridDTO.getGridId());
} }
// 获取所有点 // 获取所有点
List<GridPointDTO> gridPointDTOs = gridDao.listPointByGridIds(gridIds); List<GridPointDTO> gridPointDTOs = gridDao.listPointByGridIds(gridIds);
if (gridPointDTOs.isEmpty()) { if (gridPointDTOs.isEmpty()) {
return gridGroupDTOs; return;
} }
// 构建所有点 // 构建所有点
for (GridDTO gridDTO : gridGroupDTOs) { for (GridDTO gridDTO : gridDTOs) {
List<GridPointDTO> pointArray = new ArrayList<>(); List<GridPointDTO> pointArray = new ArrayList<>();
for (GridPointDTO gridPointDTO : gridPointDTOs) { for (GridPointDTO gridPointDTO : gridPointDTOs) {
if (StringUtils.equals(gridDTO.getGridId(), gridPointDTO.getGridId())) { if (StringUtils.equals(gridDTO.getGridId(), gridPointDTO.getGridId())) {
@ -235,7 +260,6 @@ public class GridServiceImpl extends AbstractService implements IGridService {
} }
gridDTO.setPointArray(pointArray); gridDTO.setPointArray(pointArray);
} }
return gridGroupDTOs;
} }
/** /**