Commit a8d29d1b authored by tianyiming's avatar tianyiming

Merge branch 'develop_tzs_bugfix' into develop_tzs_register

parents 8183b5b6 4b03e7bc
...@@ -31,11 +31,13 @@ public enum DPMapStatisticsItemEnum { ...@@ -31,11 +31,13 @@ public enum DPMapStatisticsItemEnum {
MANUFACTURING_UNITS("制造单位 (家)", "manufacturingUnits", ""), MANUFACTURING_UNITS("制造单位 (家)", "manufacturingUnits", ""),
CONSTRUCTION_UNITS("安改维单位 (家)", "constructionUnits", ""), CONSTRUCTION_UNITS("安改维单位 (家)", "constructionUnits", ""),
COMPANY_TOTAL("企业总量 (家)", "companyTotal", ""), COMPANY_TOTAL("企业总量 (家)", "companyTotal", ""),
INSPECTION_AGENCY_COUNT("检验检测机构总数 (家)", "inspectionAgencyCount", ""),
USERS_UNITS("使用单位 (家)", "usersUnits", ""), USERS_UNITS("使用单位 (家)", "usersUnits", ""),
PERMIT_UNITS("许可单位 (家)", "permitUnits", ""), PERMIT_UNITS("许可单位 (家)", "permitUnits", ""),
GAS_UNITS("充装单位 (家)", "gasUnits", ""), GAS_UNITS("充装单位 (家)", "gasUnits", ""),
DESIGN_UNITS("设计单位 (家)", "designUnits", ""), DESIGN_UNITS("设计单位 (家)", "designUnits", ""),
PERSON_TOTAL("人员总数 (人)", "personTotal", ""), PERSON_TOTAL("企业人员总数 (人)", "personTotal", ""),
INSPECTION_PERSON_TOTAL("检验检测人员总数 (人)", "jyjcryzl", ""),
OPERATORS("作业人员 (人)", "operators", ""), OPERATORS("作业人员 (人)", "operators", ""),
DEVICE_COUNT("已纳管设备数", "deviceCount", ""), DEVICE_COUNT("已纳管设备数", "deviceCount", ""),
PERSON_ISSUES_COUNT("个人问题数", "个人", ""), PERSON_ISSUES_COUNT("个人问题数", "个人", ""),
......
...@@ -15,9 +15,9 @@ public enum StatisticalAnalysisEnum { ...@@ -15,9 +15,9 @@ public enum StatisticalAnalysisEnum {
*/ */
company("企业", "company", "idx_biz_enterprise_info"), company("企业", "company", "idx_biz_enterprise_info"),
inspectionCompany("检验检测机构", "inspectionCompany", "idx_biz_enterprise_info"),
person("人员", "person", "idx_biz_user_info"), person("人员", "person", "idx_biz_user_info"),
inspectionPerson("检验检测人员", "inspectionPerson", "idx_biz_user_info"),
equip("设备", "equip", "idx_biz_equipment_info"); equip("设备", "equip", "idx_biz_equipment_info");
private String name; private String name;
......
...@@ -6,8 +6,13 @@ import lombok.Getter; ...@@ -6,8 +6,13 @@ import lombok.Getter;
@AllArgsConstructor @AllArgsConstructor
@Getter @Getter
public enum UnitCategoryEnum { public enum UnitCategoryEnum {
use("使用单位", "use"),
license("许可单位", "license"); use("使用单位", "use","use"), // 企业和个人主体
produce("生产单位", "produce","license"), // 设计单位、制造单位、安装改造维修单位
filling("充装单位", "filling","license"), // 充装单位
inspection("检验机构", "inspection","license"), // 检验机构
detection("检测机构", "detection","license"); // 检测机构
private final String name; private final String name;
private final String code; private final String code;
private final String type;
} }
...@@ -19,7 +19,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest; ...@@ -19,7 +19,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.LinkedHashMap; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -189,4 +189,10 @@ public class ZLDPStatisticsController { ...@@ -189,4 +189,10 @@ public class ZLDPStatisticsController {
public ResponseModel<Object> getRegulatorUnitTree(){ public ResponseModel<Object> getRegulatorUnitTree(){
return ResponseHelper.buildResponse(statisticsService.getRegulatorUnitTree()); return ResponseHelper.buildResponse(statisticsService.getRegulatorUnitTree());
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getTree")
@ApiOperation(httpMethod = "GET", value = "查询监管部门树", notes = "查询监管部门树")
public ResponseModel<Object> getTree(){
return ResponseHelper.buildResponse(Collections.singletonList(statisticsService.getRegulatorUnitTree()));
}
} }
...@@ -458,13 +458,21 @@ public class JGDPStatisticsServiceImpl { ...@@ -458,13 +458,21 @@ public class JGDPStatisticsServiceImpl {
private void staticsCenterMapCountDataForPerson(Map<String, Object> result, DPFilterParamDto dpFilterParamDto, String orgCode) { private void staticsCenterMapCountDataForPerson(Map<String, Object> result, DPFilterParamDto dpFilterParamDto, String orgCode) {
if (orgCode == null) { if (orgCode == null) {
result.put(DPMapStatisticsItemEnum.OPERATORS.getCode(), 0); result.put(DPMapStatisticsItemEnum.INSPECTION_PERSON_TOTAL.getCode(), 0);
result.put(DPMapStatisticsItemEnum.PERSON_TOTAL.getCode(), 0); result.put(DPMapStatisticsItemEnum.PERSON_TOTAL.getCode(), 0);
return; return;
} }
Long num = userInfoMapper.countUserByPostAndAreaCode(orgCode, "6552", dpFilterParamDto.getCityCode()); BoolQueryBuilder companyBoolMust = QueryBuilders.boolQuery();
result.put(DPMapStatisticsItemEnum.OPERATORS.getCode(), num); companyBoolMust.must(QueryBuilders.prefixQuery("superviseOrgCode", orgCode));
staticsPersonCountByEs(orgCode, StatisticalAnalysisEnum.person.getKey(), result); 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) { private void staticsPersonCountByEs(String orgCode, String key, Map<String, Object> result) {
...@@ -513,14 +521,25 @@ public class JGDPStatisticsServiceImpl { ...@@ -513,14 +521,25 @@ public class JGDPStatisticsServiceImpl {
setDefaultCompanyCountData(result); setDefaultCompanyCountData(result);
return; return;
} }
List<CountDto> countDtos = enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode, cityCode, false); BoolQueryBuilder companyBoolMust = QueryBuilders.boolQuery();
// 企业根据类型统计 companyBoolMust.must(QueryBuilders.prefixQuery("superviseOrgCode.keyword", orgCode));
staticsUnitTypeCountByEs(orgCode, StatisticalAnalysisEnum.company.getKey(), result); statisticalAnalysisService.companyBoolMust(companyBoolMust, "company");
result.put(DPMapStatisticsItemEnum.CONSTRUCTION_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MAINTENANCE)).mapToInt(CountDto::getIntValue).sum()); Long companySum = statisticalAnalysisService.getStatisticCount(companyBoolMust, StatisticalAnalysisEnum.company.getKey());
result.put(DPMapStatisticsItemEnum.MANUFACTURING_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_MANUFACTURE)).mapToInt(CountDto::getIntValue).sum()); BoolQueryBuilder inspectionBoolMust = QueryBuilders.boolQuery();
result.put(DPMapStatisticsItemEnum.GAS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_FILLING)).mapToInt(CountDto::getIntValue).sum()); inspectionBoolMust.must(QueryBuilders.prefixQuery("superviseOrgCode.keyword", orgCode));
result.put(DPMapStatisticsItemEnum.DESIGN_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_DESIGN)).mapToInt(CountDto::getIntValue).sum()); 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) { private void staticsUnitTypeCountByEs(String orgCode, String index, Map<String, Object> result) {
...@@ -651,7 +670,7 @@ public class JGDPStatisticsServiceImpl { ...@@ -651,7 +670,7 @@ public class JGDPStatisticsServiceImpl {
String orgCode = StCommonServiceImpl.getRegionCodeOrgCodeMap().get(cityCode); String orgCode = StCommonServiceImpl.getRegionCodeOrgCodeMap().get(cityCode);
if (StringUtils.isNotEmpty(orgCode)) { 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()); // 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.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.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()); 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 { ...@@ -665,7 +684,7 @@ public class JGDPStatisticsServiceImpl {
private void setDefaultCompanyCountData(Map<String, Object> m) { private void setDefaultCompanyCountData(Map<String, Object> m) {
m.put(DPMapStatisticsItemEnum.USERS_UNITS.getCode(), 0); m.put(DPMapStatisticsItemEnum.USERS_UNITS.getCode(), 0);
m.put(DPMapStatisticsItemEnum.COMPANY_TOTAL.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.CONSTRUCTION_UNITS.getCode(), 0);
m.put(DPMapStatisticsItemEnum.MANUFACTURING_UNITS.getCode(), 0); m.put(DPMapStatisticsItemEnum.MANUFACTURING_UNITS.getCode(), 0);
m.put(DPMapStatisticsItemEnum.GAS_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