Commit 67d3f1ae authored by suhuiguang's avatar suhuiguang

1.大屏地图图列统计接口开发空指针处理

parent 8909826c
......@@ -12,7 +12,7 @@ import lombok.Data;
public class CountDto {
@ApiModelProperty(value = "数据标识")
private String key;
private String keyStr;
@ApiModelProperty(value = "描述")
private String label;
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.date.DateUtil;
import com.yeejoin.amos.boot.biz.common.dto.CountDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.common.api.dto.LegendDataDto;
import com.yeejoin.amos.boot.module.jg.api.dto.EquipBizCountDto;
......@@ -31,7 +32,6 @@ import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.stereotype.Service;
import org.springframework.util.StopWatch;
import java.io.IOException;
import java.time.LocalDate;
......@@ -222,15 +222,12 @@ public class DPStatisticsServiceImpl {
//3.单位数量统计
this.staticsCenterMapCountDataForCompany(result, dpFilterParamDto);
//4.人员数量统计
StopWatch stopWatch5 = new StopWatch();
stopWatch5.start();
this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto);
stopWatch5.stop();
log.info("------人员查询>:{}", stopWatch5.getTotalTimeSeconds());
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());
......@@ -250,10 +247,11 @@ public class DPStatisticsServiceImpl {
}
regionCodeOrgCodeMap.put(dpFilterParamDto.getCityCode(), orgCode);
}
result.put(DPMapStatisticsItemEnum.USERS_UNITS.getCode(), enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode, COMPANY_TYPE_USE));
result.put(DPMapStatisticsItemEnum.CONSTRUCTION_UNITS.getCode(), enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode, COMPANY_TYPE_MAINTENANCE));
result.put(DPMapStatisticsItemEnum.MANUFACTURING_UNITS.getCode(), enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode, COMPANY_TYPE_MANUFACTURE));
result.put(DPMapStatisticsItemEnum.GAS_UNITS.getCode(), enterpriseInfoMapper.countByUnitTypeAndOrgCode(orgCode, COMPANY_TYPE_FILLING));
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());
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());
}
private long staticsCenterMapCountDataForCylinder(Map<String, Object> result, DPFilterParamDto dpFilterParamDto) {
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.ymt.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.dto.CountDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquEnterDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.TzBaseEnterpriseInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseEnterpriseInfo;
......@@ -65,5 +66,5 @@ public interface TzBaseEnterpriseInfoMapper extends BaseMapper<TzBaseEnterpriseI
*/
TzBaseEnterpriseInfo selectBySeq(Long sequenceNbr);
Long countByUnitTypeAndOrgCode(@Param("orgCode") String orgCode,@Param("unitType") String unitType);
List<CountDto> countByUnitTypeAndOrgCode(@Param("orgCode") String orgCode);
}
......@@ -196,13 +196,14 @@
<select id="selectBySeq" resultType="com.yeejoin.amos.boot.module.ymt.api.entity.TzBaseEnterpriseInfo">
select * from tz_base_enterprise_info where sequence_nbr = #{sequenceNbr}
</select>
<select id="countByUnitTypeAndOrgCode" resultType="java.lang.Long">
<select id="countByUnitTypeAndOrgCode" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto">
SELECT
count(1)
count(1) as intValue,
a.unit_type as keyStr
FROM
"tz_base_enterprise_info" a
where
a.supervise_org_code like concat(#{orgCode},'%')
and a.unit_type like concat('%', #{unitType},'%')
group by a.unit_type
</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