Commit 070c8ee1 authored by tianyiming's avatar tianyiming

refactor: 修改安全追溯中屏企业总览和人员总量的计算方式

parent 63e167ed
...@@ -19,6 +19,7 @@ import com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemStatusEnum; ...@@ -19,6 +19,7 @@ import com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemStatusEnum;
import com.yeejoin.amos.boot.module.statistics.api.dto.EquipQuestionNumCountDto; import com.yeejoin.amos.boot.module.statistics.api.dto.EquipQuestionNumCountDto;
import com.yeejoin.amos.boot.module.statistics.api.dto.SafetyProblemTracingDto; import com.yeejoin.amos.boot.module.statistics.api.dto.SafetyProblemTracingDto;
import com.yeejoin.amos.boot.module.statistics.api.dto.SecurityIndexCountItemDto; import com.yeejoin.amos.boot.module.statistics.api.dto.SecurityIndexCountItemDto;
import com.yeejoin.amos.boot.module.statistics.api.enums.StatisticalAnalysisEnum;
import com.yeejoin.amos.boot.module.statistics.api.mapper.AQZSDPStatisticsMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.AQZSDPStatisticsMapper;
import com.yeejoin.amos.boot.module.statistics.api.mapper.CylinderStatisticsMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.CylinderStatisticsMapper;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
...@@ -32,6 +33,7 @@ import org.elasticsearch.client.core.CountRequest; ...@@ -32,6 +33,7 @@ import org.elasticsearch.client.core.CountRequest;
import org.elasticsearch.client.core.CountResponse; import org.elasticsearch.client.core.CountResponse;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
...@@ -101,6 +103,9 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -101,6 +103,9 @@ public class AQZSDPStatisticsServiceImpl {
private DataDictionaryMapper dataDictionaryMapper; private DataDictionaryMapper dataDictionaryMapper;
@Autowired
private ComprehensiveStatisticalAnalysisServiceImpl statisticalAnalysisService;
public AQZSDPStatisticsServiceImpl(RestHighLevelClient restHighLevelClient, AQZSDPStatisticsMapper statisticsMapper, TzBaseEnterpriseInfoMapper enterpriseInfoMapper, TzsUserInfoMapper userInfoMapper, CylinderStatisticsMapper cylinderStatisticsMapper, StCommonServiceImpl stCommonService, DataDictionaryMapper dataDictionaryMapper) { public AQZSDPStatisticsServiceImpl(RestHighLevelClient restHighLevelClient, AQZSDPStatisticsMapper statisticsMapper, TzBaseEnterpriseInfoMapper enterpriseInfoMapper, TzsUserInfoMapper userInfoMapper, CylinderStatisticsMapper cylinderStatisticsMapper, StCommonServiceImpl stCommonService, DataDictionaryMapper dataDictionaryMapper) {
this.restHighLevelClient = restHighLevelClient; this.restHighLevelClient = restHighLevelClient;
...@@ -903,14 +908,32 @@ public class AQZSDPStatisticsServiceImpl { ...@@ -903,14 +908,32 @@ public class AQZSDPStatisticsServiceImpl {
//2.压力管道长度统计 //2.压力管道长度统计
stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true, false); stCommonService.staticsCenterMapCountDataForPipeline(result, orgCode,true, false);
//3.单位数量统计 //3.单位数量统计
this.staticsCenterMapCountDataForCompany(result, orgCode, dpFilterParamDto.getCityCode()); // 单位统计修改为查询es
//4.人员数量统计 // this.staticsCenterMapCountDataForCompany(result, orgCode, dpFilterParamDto.getCityCode());
this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode); this.staticsCenterMapCompanyCountToEs(result, orgCode);
//4.人员数量统计
// 人员统计改为查询es,修改之前查询的是作业人员的总数,修改为所有人员的总数
// this.staticsCenterMapCountDataForPerson(result, dpFilterParamDto, orgCode);
this.staticsCenterMapPersonCountToEs(result, orgCode);
//5.问题数统计 //5.问题数统计
this.staticsCenterMapCountDataForIssue(result, orgCode); this.staticsCenterMapCountDataForIssue(result, orgCode);
return result; return result;
} }
private void staticsCenterMapPersonCountToEs(Map<String, Object> result, String orgCode) {
BoolQueryBuilder personBoolMust = QueryBuilders.boolQuery();
personBoolMust.must(QueryBuilders.prefixQuery("superviseOrgCode", orgCode));
Long personCount = statisticalAnalysisService.getStatisticCount(personBoolMust, StatisticalAnalysisEnum.person.getKey());
result.put(DPMapStatisticsItemEnum.OPERATORS.getCode(), personCount);
}
private void staticsCenterMapCompanyCountToEs(Map<String, Object> result, String orgCode) {
BoolQueryBuilder companyBoolMust = QueryBuilders.boolQuery();
companyBoolMust.must(QueryBuilders.prefixQuery("superviseOrgCode.keyword", orgCode));
Long companyCount = statisticalAnalysisService.getStatisticCount(companyBoolMust, StatisticalAnalysisEnum.company.getKey());
result.put("companyCount", companyCount);
}
private void staticsCenterMapCountDataForIssue(Map<String, Object> result, String orgCode) { private void staticsCenterMapCountDataForIssue(Map<String, Object> result, String orgCode) {
List<Map<String, Object>> list = statisticsMapper.selectByOrg(orgCode); List<Map<String, Object>> list = statisticsMapper.selectByOrg(orgCode);
Map<String, Object> dataMap = new HashMap<>(); Map<String, Object> dataMap = new HashMap<>();
......
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