|
|
@ -79,8 +79,10 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
public PageData<CoverageAnalisisDataListResultDTO> analysisDataList(List<String> coverageTypes, List<String> categoryKeys, |
|
|
|
String search, Integer pageNo, Integer pageSize, Boolean isPage) { |
|
|
|
|
|
|
|
// 获取跟组织的坐标
|
|
|
|
String customerId = EpmetRequestHolder.getLoginUserCustomerId(); |
|
|
|
String staffId = EpmetRequestHolder.getLoginUserId(); |
|
|
|
CustomerAgencyEntity rootAgency = govOrgService.getRootAgencyByCustomerId(customerId); |
|
|
|
|
|
|
|
// 1.根据categoryKeys分类key列表,查询他们和图层时间的关系,映射为一个map
|
|
|
|
Map<String, List<GovOrgCoverageService.CategoryCoverageMapping>> mapping; |
|
|
@ -145,7 +147,7 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
// 检索数据
|
|
|
|
List<CoverageAnalisisDataListResultDTO> dataSegment = doDataListSearch( |
|
|
|
EpmetRequestHolder.getLoginUserCustomerId(), agencyId, staffPids, e.getPlaceType(), |
|
|
|
e.getCategoryKey(), search, null, null, isPage); |
|
|
|
e.getCategoryKey(), search, null, null, isPage, rootAgency); |
|
|
|
rls.addAll(dataSegment); |
|
|
|
continue; |
|
|
|
} |
|
|
@ -167,7 +169,7 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
// 检索数据
|
|
|
|
List<CoverageAnalisisDataListResultDTO> dataSegment = doDataListSearch( |
|
|
|
EpmetRequestHolder.getLoginUserCustomerId(), agencyId, staffPids, e.getPlaceType(), |
|
|
|
e.getCategoryKey(), search, 1, end, isPage); |
|
|
|
e.getCategoryKey(), search, 1, end, isPage, rootAgency); |
|
|
|
|
|
|
|
if (firstTimeDataAppear) { |
|
|
|
rls.addAll(dataSegment.subList(start - lastTotalCount, dataSegment.size())); |
|
|
@ -272,7 +274,8 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
*/ |
|
|
|
public List<CoverageAnalisisDataListResultDTO> doDataListSearch(String customerId, String agencyId, String staffOrgIds, |
|
|
|
String placeType, String categoryKey, String search, |
|
|
|
Integer pageNo, Integer pageSize,Boolean isPage) { |
|
|
|
Integer pageNo, Integer pageSize,Boolean isPage, |
|
|
|
CustomerAgencyEntity rootAgency) { |
|
|
|
|
|
|
|
// 根据categoryKey查询类别名称
|
|
|
|
IcCoverageCategoryDictEntity categoryDict = orgCoverageService.selectByCategoryKey(categoryKey); |
|
|
@ -284,16 +287,11 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
|
|
|
|
return resiEntities.parallelStream().map(re -> { |
|
|
|
// 使用楼栋的坐标补充居民的坐标信息
|
|
|
|
BuildingInfoCache resiBuilding = getBuildingInfo(re.getId(), re.getBuildId()); |
|
|
|
String buildingLatitude = null; |
|
|
|
String buildingLongitude = null; |
|
|
|
if (resiBuilding != null) { |
|
|
|
buildingLatitude = resiBuilding.getLatitude(); |
|
|
|
buildingLongitude = resiBuilding.getLongitude(); |
|
|
|
} |
|
|
|
String[] coordinates = getUserCoordinates(re.getId(), re.getBuildId(), rootAgency); |
|
|
|
|
|
|
|
return new CoverageAnalisisDataListResultDTO( |
|
|
|
re.getId(), categoryKey, isPage ? categoryDict.getCategoryName() : null, placeType, isPage ? re.getName() : null, |
|
|
|
buildingLatitude, buildingLongitude); |
|
|
|
coordinates[0], coordinates[1]); |
|
|
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} else if (PLACE_TYPE_SPECIAL_RESI.equals(placeType)) { |
|
|
@ -302,16 +300,11 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
customerId, agencyId, staffOrgIds, categoryKey, search, pageNo, pageSize, isPage); |
|
|
|
|
|
|
|
return resiInfos.parallelStream().map(re -> { |
|
|
|
BuildingInfoCache resiBuilding = getBuildingInfo(re.getId(), re.getBuildId()); |
|
|
|
String buildingLatitude = null; |
|
|
|
String buildingLongitude = null; |
|
|
|
if (resiBuilding != null) { |
|
|
|
buildingLatitude = resiBuilding.getLatitude(); |
|
|
|
buildingLongitude = resiBuilding.getLongitude(); |
|
|
|
} |
|
|
|
String[] coordinates = getUserCoordinates(re.getId(), re.getBuildId(), rootAgency); |
|
|
|
|
|
|
|
return new CoverageAnalisisDataListResultDTO( |
|
|
|
re.getId(), categoryKey, isPage ? categoryDict.getCategoryName() : null, placeType, |
|
|
|
isPage ? re.getName() : null, buildingLatitude, buildingLongitude); |
|
|
|
isPage ? re.getName() : null, coordinates[0], coordinates[1]); |
|
|
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} else if (PLACE_TYPE_EVENT.equals(placeType)) { |
|
|
@ -416,16 +409,29 @@ public class CoverageServiceImpl implements CoverageService { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 楼栋信息 |
|
|
|
* 获取用户的坐标信息 |
|
|
|
* @param resiId |
|
|
|
* @param buildingId |
|
|
|
* @param rootAgency 跟组织,用于备选,从其中获取坐标 |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private BuildingInfoCache getBuildingInfo(String resiId, String buildingId) { |
|
|
|
private String[] getUserCoordinates(String resiId, String buildingId, CustomerAgencyEntity rootAgency) { |
|
|
|
String longitude = null; |
|
|
|
String latitude = null; |
|
|
|
|
|
|
|
BuildingInfoCache resiBuilding = govOrgService.queryBuildingInfo(buildingId); |
|
|
|
if (resiBuilding == null) { |
|
|
|
log.warn("居民信息所属楼栋信息未找到。居民id:{},楼栋id:{}", resiId, buildingId); |
|
|
|
if (resiBuilding != null) { |
|
|
|
longitude = resiBuilding.getLongitude(); |
|
|
|
latitude = resiBuilding.getLatitude(); |
|
|
|
} else { |
|
|
|
log.error("居民信息所属楼栋信息未找到。居民id:{},楼栋id:{}", resiId, buildingId); |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isAnyBlank(longitude, latitude)) { |
|
|
|
// 楼栋没有坐标,那就取跟组织的
|
|
|
|
longitude = rootAgency.getLongitude(); |
|
|
|
latitude = rootAgency.getLatitude(); |
|
|
|
} |
|
|
|
return resiBuilding; |
|
|
|
return new String[]{longitude, latitude}; |
|
|
|
} |
|
|
|
} |