Commit d7045f76 authored by suhuiguang's avatar suhuiguang

1.业务全过程增加单位过滤

parent 331af1fa
...@@ -100,7 +100,6 @@ public class DPStatisticsServiceImpl { ...@@ -100,7 +100,6 @@ public class DPStatisticsServiceImpl {
private final static String REGION_NAME = "regionName"; private final static String REGION_NAME = "regionName";
@Autowired @Autowired
private EquipmentCategoryMapper equipmentCategoryMapper; private EquipmentCategoryMapper equipmentCategoryMapper;
...@@ -239,55 +238,47 @@ public class DPStatisticsServiceImpl { ...@@ -239,55 +238,47 @@ public class DPStatisticsServiceImpl {
public Map<String, Object> getCenterMapCountDataForGlobal(DPFilterParamDto dpFilterParamDto) { public Map<String, Object> getCenterMapCountDataForGlobal(DPFilterParamDto dpFilterParamDto) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
String orgCode = this.getAndSetOrgCode(dpFilterParamDto.getCityCode());
// 1.气瓶数量统计 // 1.气瓶数量统计
long cylinderNum = this.staticsCenterMapCountDataForCylinder(result, dpFilterParamDto); long cylinderNum = this.staticsCenterMapCountDataForCylinder(result, orgCode);
//1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量 //1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
this.staticsCenterMapCountDataForEquip(result, dpFilterParamDto, cylinderNum); this.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode);
//2.压力管道长度统计 //2.压力管道长度统计
this.staticsCenterMapCountDataForPipeline(result, dpFilterParamDto); this.staticsCenterMapCountDataForPipeline(result, orgCode);
//3.单位数量统计 //3.单位数量统计
this.staticsCenterMapCountDataForCompany(result, dpFilterParamDto); this.staticsCenterMapCountDataForCompany(result, orgCode);
//4.人员数量统计 //4.人员数量统计
this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto); this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode);
return result; return result;
} }
public Map<String, Object> getCenterMapOverviewData(DPFilterParamDto dpFilterParamDto) { private Map<String, Object> getCenterMapOverviewData(DPFilterParamDto dpFilterParamDto) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
// 1.气瓶数量统计 String orgCode = this.getAndSetOrgCode(dpFilterParamDto.getCityCode());
long cylinderNum = this.staticsCenterMapCountDataForCylinder(result, dpFilterParamDto); // 0. 气瓶数量统计
//1.8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量 long cylinderNum = this.staticsCenterMapCountDataForCylinder(result, orgCode);
this.staticsCenterMapCountDataForEquip(result, dpFilterParamDto, cylinderNum); // 1. 8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
//2.压力管道长度统计 this.staticsCenterMapCountDataForEquip(result, cylinderNum, orgCode);
this.staticsCenterMapCountDataForPipeline(result, dpFilterParamDto); // 2. 压力管道长度统计
//3.人员数量统计 this.staticsCenterMapCountDataForPipeline(result, orgCode);
this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto); // 3. 人员数量统计
this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode);
return result; return result;
} }
private void staticsCenterMapCountDataForPerson(Map<String, Object> result, DPFilterParamDto dpFilterParamDto) { private void staticsCenterMapCountDataForPerson(Map<String, Object> result, DPFilterParamDto dpFilterParamDto, String orgCode) {
String orgCode = regionCodeOrgCodeMap.get(dpFilterParamDto.getCityCode());
if (orgCode == null) { if (orgCode == null) {
orgCode = commonMapper.getOrgCodeByCompanyCode(dpFilterParamDto.getCityCode()); result.put(DPMapStatisticsItemEnum.OPERATORS.getCode(), 0);
if (orgCode == null) { return;
result.put(DPMapStatisticsItemEnum.OPERATORS.getCode(), 0);
return;
}
regionCodeOrgCodeMap.put(dpFilterParamDto.getCityCode(), orgCode);
} }
Long num = userInfoMapper.countUserByPostAndAreaCode(orgCode, "6552", dpFilterParamDto.getCityCode()); Long num = userInfoMapper.countUserByPostAndAreaCode(orgCode, "6552", dpFilterParamDto.getCityCode());
result.put(DPMapStatisticsItemEnum.OPERATORS.getCode(), num); result.put(DPMapStatisticsItemEnum.OPERATORS.getCode(), num);
} }
private void staticsCenterMapCountDataForCompany(Map<String, Object> result, DPFilterParamDto dpFilterParamDto) { private void staticsCenterMapCountDataForCompany(Map<String, Object> result, String orgCode) {
String orgCode = regionCodeOrgCodeMap.get(dpFilterParamDto.getCityCode());
if (orgCode == null) { if (orgCode == null) {
orgCode = commonMapper.getOrgCodeByCompanyCode(dpFilterParamDto.getCityCode()); setDefaultCompanyCountData(result);
if (orgCode == null) { return;
setDefaultCompanyCountData(result);
return;
}
regionCodeOrgCodeMap.put(dpFilterParamDto.getCityCode(), orgCode);
} }
List<CountDto> countDtos = enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode); List<CountDto> countDtos = enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode);
result.put(DPMapStatisticsItemEnum.USERS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE)).mapToInt(CountDto::getIntValue).sum()); result.put(DPMapStatisticsItemEnum.USERS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_USE)).mapToInt(CountDto::getIntValue).sum());
...@@ -296,13 +287,13 @@ public class DPStatisticsServiceImpl { ...@@ -296,13 +287,13 @@ public class DPStatisticsServiceImpl {
result.put(DPMapStatisticsItemEnum.GAS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_FILLING)).mapToInt(CountDto::getIntValue).sum()); result.put(DPMapStatisticsItemEnum.GAS_UNITS.getCode(), countDtos.stream().filter(c -> c.getKeyStr().contains(COMPANY_TYPE_FILLING)).mapToInt(CountDto::getIntValue).sum());
} }
private long staticsCenterMapCountDataForCylinder(Map<String, Object> result, DPFilterParamDto dpFilterParamDto) { private long staticsCenterMapCountDataForCylinder(Map<String, Object> result, String orgCode) {
long num = 0; long num = 0;
CountRequest request = new CountRequest(); CountRequest request = new CountRequest();
request.indices("idx_biz_view_jg_all"); request.indices("idx_biz_view_jg_all");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
// 区域信息模糊查询 // 按照管辖机构区域信息模糊查询
boolMust.must(QueryBuilders.wildcardQuery("USE_PLACE_CODE", "*" + dpFilterParamDto.getCityCode() + "*")); boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", orgCode + "*"));
// 设备类别精确查询气瓶 // 设备类别精确查询气瓶
boolMust.must(QueryBuilders.termsQuery("EQU_CATEGORY_CODE", EQU_CATEGORY_CYLINDER)); boolMust.must(QueryBuilders.termsQuery("EQU_CATEGORY_CODE", EQU_CATEGORY_CYLINDER));
// 纳管状态为已纳管 // 纳管状态为已纳管
...@@ -318,8 +309,8 @@ public class DPStatisticsServiceImpl { ...@@ -318,8 +309,8 @@ public class DPStatisticsServiceImpl {
return num; return num;
} }
private void staticsCenterMapCountDataForPipeline(Map<String, Object> result, DPFilterParamDto dpFilterParamDto) { private void staticsCenterMapCountDataForPipeline(Map<String, Object> result, String orgCode) {
String length = techParamsPipelineMapper.sumPipeLengthByArea(dpFilterParamDto.getCityCode()); String length = techParamsPipelineMapper.sumPipeLengthByOrgCode(orgCode);
BigDecimal lengthDecimal = new BigDecimal(length); BigDecimal lengthDecimal = new BigDecimal(length);
if (lengthDecimal.compareTo(BigDecimal.ZERO) > 0) { if (lengthDecimal.compareTo(BigDecimal.ZERO) > 0) {
length = lengthDecimal.divide(new BigDecimal("1000"), 3, RoundingMode.HALF_UP).toPlainString(); length = lengthDecimal.divide(new BigDecimal("1000"), 3, RoundingMode.HALF_UP).toPlainString();
...@@ -328,12 +319,12 @@ public class DPStatisticsServiceImpl { ...@@ -328,12 +319,12 @@ public class DPStatisticsServiceImpl {
} }
private void staticsCenterMapCountDataForEquip(Map<String, Object> result, DPFilterParamDto dpFilterParamDto, long cylinderNum) { private void staticsCenterMapCountDataForEquip(Map<String, Object> result, long cylinderNum, String orgCode) {
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices("idx_biz_view_jg_all"); request.indices("idx_biz_view_jg_all");
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
// 区域信息模糊查询 // 按照管辖机构区域信息模糊查询
boolMust.must(QueryBuilders.wildcardQuery("USE_PLACE_CODE", "*" + dpFilterParamDto.getCityCode() + "*")); boolMust.must(QueryBuilders.wildcardQuery("ORG_BRANCH_CODE.keyword", orgCode + "*"));
// 纳管状态为已纳管 // 纳管状态为已纳管
boolMust.must(QueryBuilders.termQuery("IS_INTO_MANAGEMENT", true)); boolMust.must(QueryBuilders.termQuery("IS_INTO_MANAGEMENT", true));
SearchSourceBuilder builder = new SearchSourceBuilder(); SearchSourceBuilder builder = new SearchSourceBuilder();
......
...@@ -16,8 +16,8 @@ public interface EquipTechParamPipelineMapper extends BaseMapper<EquipTechParamP ...@@ -16,8 +16,8 @@ public interface EquipTechParamPipelineMapper extends BaseMapper<EquipTechParamP
/** /**
* 统计压力管道长度 * 统计压力管道长度
* *
* @param cityCode 区域code * @param orgCode 区域code对应的管辖机构
* @return 数量 * @return 数量
*/ */
String sumPipeLengthByArea(String cityCode); String sumPipeLengthByOrgCode(String orgCode);
} }
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
WHERE WHERE
RECORD = #{record} RECORD = #{record}
</select> </select>
<select id="sumPipeLengthByArea" resultType="java.lang.String"> <select id="sumPipeLengthByOrgCode" resultType="java.lang.String">
select select
COALESCE(round(sum(p."PIPE_LENGTH"), 2),0) as PIPE_LENGTH COALESCE(round(sum(p."PIPE_LENGTH"), 2),0) as PIPE_LENGTH
from from
...@@ -33,18 +33,18 @@ ...@@ -33,18 +33,18 @@
( (
SELECT SELECT
ri."RECORD", ri."RECORD",
concat(ui.PROVINCE,'#', ui.CITY,'#', ui.COUNTY) as areaCode si."ORG_BRANCH_CODE" as orgBranchCode
FROM "idx_biz_jg_register_info" ri, FROM
idx_biz_jg_use_info ui "idx_biz_jg_register_info" ri,
idx_biz_jg_use_info ui,
idx_biz_jg_supervision_info si
where where
ri."EQU_LIST" = '8000' ri."EQU_LIST" = '8000'
and ri."RECORD" = ui."RECORD" and ri."RECORD" = ui."RECORD"
and ui."PROVINCE" <![CDATA[<>]]> '' and ui.IS_INTO_MANAGEMENT =true
and ui."CITY" <![CDATA[<>]]>'' and ri."RECORD" = si."RECORD"
and ui."COUNTY" <![CDATA[<>]]> ''
and ui.IS_INTO_MANAGEMENT =true
) a ) a
where where
p."RECORD" = a."RECORD" and a.areaCode like concat('%',#{cityCode}, '%') p."RECORD" = a."RECORD" and a.orgBranchCode like concat(#{orgCode}, '%')
</select> </select>
</mapper> </mapper>
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