Commit 2b08a284 authored by 李成龙's avatar 李成龙

Merge remote-tracking branch 'origin/develop_tzs_bugfix' into develop_tzs_bugfix

parents f1d8391a e03c2eb6
...@@ -23,7 +23,7 @@ public enum PersonAdvanceSearchEnum { ...@@ -23,7 +23,7 @@ public enum PersonAdvanceSearchEnum {
JOB_ITEM("作业项目", "jobItem",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryZYXM?type={type}",null,"certType"), JOB_ITEM("作业项目", "jobItem",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryZYXM?type={type}",null,"certType"),
PERMISSION_ITEM("项目", "permissionItem",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryZYXM?type={type}",null,"permissionLevel"), PERMISSION_ITEM("项目", "permissionItem",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryZYXM?type={type}",null,"permissionLevel"),
ISSUE_DATE("发证日期", "issueDate",TechnicalParameter.ParamType.DATE,"",null,null), ISSUE_DATE("发证日期", "issueDate",TechnicalParameter.ParamType.DATE,"",null,null),
EDUCATION("学历", "education",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryDicData","QYRYXL",null), EDUCATION("学历", "education",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryDicData?type={type}","QYRYXL",null),
ADDRESS("住址", "address",TechnicalParameter.ParamType.STRING,"",null,null), ADDRESS("住址", "address",TechnicalParameter.ParamType.STRING,"",null,null),
UNITCODE("所属企业", "unitCode", TechnicalParameter.ParamType.STRING,"",null,null), UNITCODE("所属企业", "unitCode", TechnicalParameter.ParamType.STRING,"",null,null),
SUPERVISEORGCODE("管辖机构", "superviseOrgCode",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryUnitByOrgCode?type={type}",null,"orgTreeId"), SUPERVISEORGCODE("管辖机构", "superviseOrgCode",null,"/statistics/comprehensiveStatisticalAnalysis/select/queryUnitByOrgCode?type={type}",null,"orgTreeId"),
......
...@@ -975,6 +975,8 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -975,6 +975,8 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
sum.put("value", totle); sum.put("value", totle);
statics.add(sum); statics.add(sum);
BoolQueryBuilder pipeQuery = QueryBuilderUtils.copyBoolQuery(boolMust);
List<Map<String, Object>> equipStatusMap = new ArrayList<>(); List<Map<String, Object>> equipStatusMap = new ArrayList<>();
getEquipStatusStatic(boolMust, builder, equipStatusMap); getEquipStatusStatic(boolMust, builder, equipStatusMap);
result.put("keyIndicator", equipStatusMap); result.put("keyIndicator", equipStatusMap);
...@@ -989,7 +991,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -989,7 +991,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
JSONArray equList = (JSONArray) filterParams.get("EQU_LIST"); JSONArray equList = (JSONArray) filterParams.get("EQU_LIST");
if (ObjectUtils.isEmpty(equList) || equList.contains("8000") || equList.contains("all")) { if (ObjectUtils.isEmpty(equList) || equList.contains("8000") || equList.contains("all")) {
// 获取压力管道长度 // 获取压力管道长度
BigDecimal pipeLength = getPipeLength(boolMust, builder, "pipeLength"); BigDecimal pipeLength = getPipeLength(pipeQuery, "pipeLength");
Map<String, Object> pipeMap = new HashMap<>(); Map<String, Object> pipeMap = new HashMap<>();
pipeMap.put("name", "压力管道(千米)"); pipeMap.put("name", "压力管道(千米)");
pipeMap.put("value", pipeLength.divide(new BigDecimal(1000), 2, BigDecimal.ROUND_HALF_UP)); pipeMap.put("value", pipeLength.divide(new BigDecimal(1000), 2, BigDecimal.ROUND_HALF_UP));
...@@ -1293,16 +1295,13 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -1293,16 +1295,13 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
return ObjectUtils.isEmpty(response) ? 0 : response.getCount(); return ObjectUtils.isEmpty(response) ? 0 : response.getCount();
} }
private BigDecimal getPipeLength(BoolQueryBuilder boolMust, SearchSourceBuilder builder, String countField) { private BigDecimal getPipeLength(BoolQueryBuilder boolMust, String countField) {
SearchRequest request = new SearchRequest(); SearchRequest request = new SearchRequest();
request.indices(StatisticalAnalysisEnum.equip.getKey()); request.indices(StatisticalAnalysisEnum.equip.getKey());
SearchSourceBuilder builder = new SearchSourceBuilder();
BigDecimal pipeLong; BigDecimal pipeLong;
BoolQueryBuilder pipeLengthQuery = QueryBuilderUtils.copyBoolQuery(boolMust);
pipeLengthQuery.must(QueryBuilders.existsQuery("pipeLength"));
pipeLengthQuery.must(existsQuery("SUPERVISORY_CODE"));
pipeLengthQuery.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE",""));
SumAggregationBuilder pipeLengthAgg = AggregationBuilders.sum(countField).field("pipeLength").missing(0); SumAggregationBuilder pipeLengthAgg = AggregationBuilders.sum(countField).field("pipeLength").missing(0);
builder.query(pipeLengthQuery); builder.query(boolMust);
builder.aggregation(pipeLengthAgg).size(0); builder.aggregation(pipeLengthAgg).size(0);
request.source(builder); request.source(builder);
try { try {
...@@ -3047,6 +3046,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -3047,6 +3046,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
if (groupField.equals("EQU_LIST_CODE")) { if (groupField.equals("EQU_LIST_CODE")) {
gasBoolQueryBuilder = QueryBuilderUtils.copyBoolQuery(boolMust); gasBoolQueryBuilder = QueryBuilderUtils.copyBoolQuery(boolMust);
} }
BoolQueryBuilder pipeBoolMust = QueryBuilderUtils.copyBoolQuery(boolMust);
if (!"2300".equals(equipCode)) { if (!"2300".equals(equipCode)) {
boolMust.mustNot(QueryBuilders.matchQuery("EQU_CATEGORY_CODE", "2300")); boolMust.mustNot(QueryBuilders.matchQuery("EQU_CATEGORY_CODE", "2300"));
} }
...@@ -3061,9 +3061,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -3061,9 +3061,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
tabTotalMap.put(StatisticalAnalysisEnum.equip.getCode(), otherCount.toString()); tabTotalMap.put(StatisticalAnalysisEnum.equip.getCode(), otherCount.toString());
List<String> codes = new ArrayList<>(); List<String> codes = new ArrayList<>();
BoolQueryBuilder pipeBoolMust = QueryBuilderUtils.copyBoolQuery(boolMust);
for (Map<String, Object> categoryMap : staticCountByGroupMap) { for (Map<String, Object> categoryMap : staticCountByGroupMap) {
BoolQueryBuilder queryBuilder = QueryBuilderUtils.copyBoolQuery(pipeBoolMust);
String code = categoryMap.get("value").toString(); String code = categoryMap.get("value").toString();
codes.add(code); codes.add(code);
// 去除类别中的气瓶 // 去除类别中的气瓶
...@@ -3078,8 +3076,11 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -3078,8 +3076,11 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
map.put("fieldKey", groupField.replace("_CODE", "")); map.put("fieldKey", groupField.replace("_CODE", ""));
Object value = staticCountByGroup.containsKey(code) ? staticCountByGroup.get(code) : 0L; Object value = staticCountByGroup.containsKey(code) ? staticCountByGroup.get(code) : 0L;
if (code.startsWith("8")) { if (code.startsWith("8")) {
queryBuilder.must(QueryBuilders.matchQuery(groupField, code)); pipeBoolMust.must(QueryBuilders.termQuery(groupField, code));
BigDecimal pipeLength = getPipeLength(queryBuilder, builder, code); pipeBoolMust.must(QueryBuilders.existsQuery("pipeLength"));
pipeBoolMust.must(existsQuery("SUPERVISORY_CODE"));
pipeBoolMust.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE",""));
BigDecimal pipeLength = getPipeLength(pipeBoolMust, code);
value = pipeLength.divide(new BigDecimal(1000), 4, BigDecimal.ROUND_HALF_UP); value = pipeLength.divide(new BigDecimal(1000), 4, BigDecimal.ROUND_HALF_UP);
} }
map.put("value", value); map.put("value", value);
...@@ -3155,7 +3156,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl { ...@@ -3155,7 +3156,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
if (groupField.equals("EQU_DEFINE_CODE")) { if (groupField.equals("EQU_DEFINE_CODE")) {
pipeBoolMust.mustNot(QueryBuilders.termsQuery("EQU_DEFINE_CODE", codes)); pipeBoolMust.mustNot(QueryBuilders.termsQuery("EQU_DEFINE_CODE", codes));
} }
BigDecimal pipeLength = getPipeLength(pipeBoolMust, builder, "other"); BigDecimal pipeLength = getPipeLength(pipeBoolMust, "other");
BigDecimal divide = pipeLength.divide(new BigDecimal(1000), 4, BigDecimal.ROUND_HALF_UP); BigDecimal divide = pipeLength.divide(new BigDecimal(1000), 4, BigDecimal.ROUND_HALF_UP);
otherPipeLength = otherPipeLength.add(divide); otherPipeLength = otherPipeLength.add(divide);
staticCountByGroup.put("N/A", otherPipeLength); staticCountByGroup.put("N/A", otherPipeLength);
......
...@@ -22,7 +22,6 @@ import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto; ...@@ -22,7 +22,6 @@ import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue; import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.dto.LegendDataDto; import com.yeejoin.amos.boot.module.common.api.dto.LegendDataDto;
import com.yeejoin.amos.boot.module.common.api.enums.BusinessTypeEnum; import com.yeejoin.amos.boot.module.common.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.common.api.enums.CylinderTypeEnum;
import com.yeejoin.amos.boot.module.common.api.enums.*; import com.yeejoin.amos.boot.module.common.api.enums.*;
import com.yeejoin.amos.boot.module.jg.api.dto.EquipBizCountDto; import com.yeejoin.amos.boot.module.jg.api.dto.EquipBizCountDto;
import com.yeejoin.amos.boot.module.jg.api.dto.FourColorCountDataDto; import com.yeejoin.amos.boot.module.jg.api.dto.FourColorCountDataDto;
...@@ -483,6 +482,7 @@ public class JGDPStatisticsServiceImpl { ...@@ -483,6 +482,7 @@ public class JGDPStatisticsServiceImpl {
BigDecimal pipeLong; BigDecimal pipeLong;
BoolQueryBuilder pipeLengthQuery = new BoolQueryBuilder(); BoolQueryBuilder pipeLengthQuery = new BoolQueryBuilder();
pipeLengthQuery.must(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", orgCode)); pipeLengthQuery.must(QueryBuilders.prefixQuery("ORG_BRANCH_CODE", orgCode));
pipeLengthQuery.must(QueryBuilders.termQuery("EQU_LIST_CODE","8000"));
pipeLengthQuery.must(QueryBuilders.existsQuery("pipeLength")); pipeLengthQuery.must(QueryBuilders.existsQuery("pipeLength"));
pipeLengthQuery.must(existsQuery("SUPERVISORY_CODE")); pipeLengthQuery.must(existsQuery("SUPERVISORY_CODE"));
pipeLengthQuery.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE", "")); pipeLengthQuery.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE", ""));
......
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