Commit 4b03e7bc authored by tianyiming's avatar tianyiming

refactor: 调整中屏查询

parent 9c62d23e
......@@ -31,11 +31,13 @@ public enum DPMapStatisticsItemEnum {
MANUFACTURING_UNITS("制造单位 (家)", "manufacturingUnits", ""),
CONSTRUCTION_UNITS("安改维单位 (家)", "constructionUnits", ""),
COMPANY_TOTAL("企业总量 (家)", "companyTotal", ""),
INSPECTION_AGENCY_COUNT("检验检测机构总数 (家)", "inspectionAgencyCount", ""),
USERS_UNITS("使用单位 (家)", "usersUnits", ""),
PERMIT_UNITS("许可单位 (家)", "permitUnits", ""),
GAS_UNITS("充装单位 (家)", "gasUnits", ""),
DESIGN_UNITS("设计单位 (家)", "designUnits", ""),
PERSON_TOTAL("人员总数 (人)", "personTotal", ""),
PERSON_TOTAL("企业人员总数 (人)", "personTotal", ""),
INSPECTION_PERSON_TOTAL("检验检测人员总数 (人)", "jyjcryzl", ""),
OPERATORS("作业人员 (人)", "operators", ""),
DEVICE_COUNT("已纳管设备数", "deviceCount", ""),
PERSON_ISSUES_COUNT("个人问题数", "个人", ""),
......
......@@ -458,13 +458,21 @@ public class JGDPStatisticsServiceImpl {
private void staticsCenterMapCountDataForPerson(Map<String, Object> result, DPFilterParamDto dpFilterParamDto, String orgCode) {
if (orgCode == null) {
result.put(DPMapStatisticsItemEnum.OPERATORS.getCode(), 0);
result.put(DPMapStatisticsItemEnum.INSPECTION_PERSON_TOTAL.getCode(), 0);
result.put(DPMapStatisticsItemEnum.PERSON_TOTAL.getCode(), 0);
return;
}
Long num = userInfoMapper.countUserByPostAndAreaCode(orgCode, "6552", dpFilterParamDto.getCityCode());
result.put(DPMapStatisticsItemEnum.OPERATORS.getCode(), num);
staticsPersonCountByEs(orgCode, StatisticalAnalysisEnum.person.getKey(), result);
BoolQueryBuilder companyBoolMust = QueryBuilders.boolQuery();
companyBoolMust.must(QueryBuilders.prefixQuery("superviseOrgCode", orgCode));
statisticalAnalysisService.companyBoolMust(companyBoolMust, "company");
Long companySum = statisticalAnalysisService.getStatisticCount(companyBoolMust, StatisticalAnalysisEnum.person.getKey());
BoolQueryBuilder inspectionBoolMust = QueryBuilders.boolQuery();
inspectionBoolMust.must(QueryBuilders.prefixQuery("superviseOrgCode", orgCode));
inspectionBoolMust.mustNot(QueryBuilders.wildcardQuery("unitType.keyword", "*检验检测机构*"));
statisticalAnalysisService.companyBoolMust(inspectionBoolMust, "inspection");
Long inspectionSum = statisticalAnalysisService.getStatisticCount(inspectionBoolMust, StatisticalAnalysisEnum.person.getKey());
result.put(DPMapStatisticsItemEnum.PERSON_TOTAL.getCode(), companySum);
result.put(DPMapStatisticsItemEnum.INSPECTION_PERSON_TOTAL.getCode(), inspectionSum);
}
private void staticsPersonCountByEs(String orgCode, String key, Map<String, Object> result) {
......@@ -513,14 +521,25 @@ public class JGDPStatisticsServiceImpl {
setDefaultCompanyCountData(result);
return;
}
List<CountDto> countDtos = enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode, cityCode, false);
// 企业根据类型统计
staticsUnitTypeCountByEs(orgCode, StatisticalAnalysisEnum.company.getKey(), result);
result.put(DPMapStatisticsItemEnum.CONSTRUCTION_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE)).mapToInt(CountDto::getIntValue).sum());
result.put(DPMapStatisticsItemEnum.MANUFACTURING_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MANUFACTURE)).mapToInt(CountDto::getIntValue).sum());
result.put(DPMapStatisticsItemEnum.GAS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_FILLING)).mapToInt(CountDto::getIntValue).sum());
result.put(DPMapStatisticsItemEnum.DESIGN_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_DESIGN)).mapToInt(CountDto::getIntValue).sum());
BoolQueryBuilder companyBoolMust = QueryBuilders.boolQuery();
companyBoolMust.must(QueryBuilders.prefixQuery("superviseOrgCode.keyword", orgCode));
statisticalAnalysisService.companyBoolMust(companyBoolMust, "company");
Long companySum = statisticalAnalysisService.getStatisticCount(companyBoolMust, StatisticalAnalysisEnum.company.getKey());
BoolQueryBuilder inspectionBoolMust = QueryBuilders.boolQuery();
inspectionBoolMust.must(QueryBuilders.prefixQuery("superviseOrgCode.keyword", orgCode));
inspectionBoolMust.mustNot(QueryBuilders.wildcardQuery("unitType.keyword", "*检验检测机构*"));
statisticalAnalysisService.companyBoolMust(inspectionBoolMust, "inspection");
Long inspectionSum = statisticalAnalysisService.getStatisticCount(inspectionBoolMust, StatisticalAnalysisEnum.company.getKey());
result.put(DPMapStatisticsItemEnum.COMPANY_TOTAL.getCode(), companySum);
result.put(DPMapStatisticsItemEnum.INSPECTION_AGENCY_COUNT.getCode(), inspectionSum);
// List<CountDto> countDtos = enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode, cityCode, false);
// // 企业根据类型统计
// staticsUnitTypeCountByEs(orgCode, StatisticalAnalysisEnum.company.getKey(), result);
// result.put(DPMapStatisticsItemEnum.CONSTRUCTION_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE)).mapToInt(CountDto::getIntValue).sum());
// result.put(DPMapStatisticsItemEnum.MANUFACTURING_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MANUFACTURE)).mapToInt(CountDto::getIntValue).sum());
// result.put(DPMapStatisticsItemEnum.GAS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_FILLING)).mapToInt(CountDto::getIntValue).sum());
// result.put(DPMapStatisticsItemEnum.DESIGN_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_DESIGN)).mapToInt(CountDto::getIntValue).sum());
}
private void staticsUnitTypeCountByEs(String orgCode, String index, Map<String, Object> result) {
......@@ -651,7 +670,7 @@ public class JGDPStatisticsServiceImpl {
String orgCode = StCommonServiceImpl.getRegionCodeOrgCodeMap().get(cityCode);
if (StringUtils.isNotEmpty(orgCode)) {
// m.put(DPMapStatisticsItemEnum.USERS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE) && c.getLabel().contains(orgCode)).mapToInt(CountDto::getIntValue).sum());
staticsUnitTypeCountByEs(orgCode, StatisticalAnalysisEnum.company.getKey(), m);
staticsCenterMapCountDataForCompany(m, orgCode, cityCode);
m.put(DPMapStatisticsItemEnum.CONSTRUCTION_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE) && c.getLabel().contains(orgCode)).mapToInt(CountDto::getIntValue).sum());
m.put(DPMapStatisticsItemEnum.MANUFACTURING_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MANUFACTURE) && c.getLabel().contains(orgCode)).mapToInt(CountDto::getIntValue).sum());
m.put(DPMapStatisticsItemEnum.GAS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_FILLING) && c.getLabel().contains(orgCode)).mapToInt(CountDto::getIntValue).sum());
......@@ -665,7 +684,7 @@ public class JGDPStatisticsServiceImpl {
private void setDefaultCompanyCountData(Map<String, Object> m) {
m.put(DPMapStatisticsItemEnum.USERS_UNITS.getCode(), 0);
m.put(DPMapStatisticsItemEnum.COMPANY_TOTAL.getCode(), 0);
m.put(DPMapStatisticsItemEnum.PERMIT_UNITS.getCode(), 0);
m.put(DPMapStatisticsItemEnum.INSPECTION_AGENCY_COUNT.getCode(), 0);
m.put(DPMapStatisticsItemEnum.CONSTRUCTION_UNITS.getCode(), 0);
m.put(DPMapStatisticsItemEnum.MANUFACTURING_UNITS.getCode(), 0);
m.put(DPMapStatisticsItemEnum.GAS_UNITS.getCode(), 0);
......
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