Browse Source

【五大图层】居民相关的查询,获取不到楼栋坐标,就是用跟组织坐标

dev
wangxianzhang 3 years ago
parent
commit
64420ea040
  1. 10
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govorg/CustomerAgencyEntity.java
  2. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
  3. 9
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  4. 54
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/CoverageServiceImpl.java

10
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govorg/CustomerAgencyEntity.java

@ -123,4 +123,14 @@ public class CustomerAgencyEntity extends BaseEpmetEntity {
* 联系电话
*/
private String mobile;
/**
* 中心位置经度
*/
private String longitude;
/**
* 中心位置纬度
*/
private String latitude;
}

8
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java

@ -9,6 +9,7 @@ import com.epmet.dataaggre.dto.govorg.CustomerGridDTO;
import com.epmet.dataaggre.dto.govorg.form.*;
import com.epmet.dataaggre.dto.govorg.result.*;
import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@ -204,4 +205,11 @@ public interface GovOrgService {
* @return
*/
List<StaffSelectResDTO> staffSelectList(String customerId, String agencyId);
/**
* 查询跟组织信息
* @param customerId
* @return
*/
CustomerAgencyEntity getRootAgencyByCustomerId(String customerId);
}

9
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java

@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.dingtalk.api.request.OapiRobotSendRequest;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.Constant;
@ -1071,5 +1072,11 @@ public class GovOrgServiceImpl implements GovOrgService {
return resultDTOList;
}
@Override
public CustomerAgencyEntity getRootAgencyByCustomerId(String customerId) {
LambdaQueryWrapper<CustomerAgencyEntity> query = new LambdaQueryWrapper<>();
query.eq(CustomerAgencyEntity::getCustomerId, customerId);
query.eq(CustomerAgencyEntity::getPid, "0"); // 跟组织的pid为"0"
return customerAgencyDao.selectOne(query);
}
}

54
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/CoverageServiceImpl.java

@ -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};
}
}
Loading…
Cancel
Save