Commit d7045f76 authored by suhuiguang's avatar suhuiguang

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

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