Commit dc62d3c0 authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_tzs_register' of…

Merge branch 'develop_tzs_register' of http://39.100.92.250:5000/moa/amos-boot-biz into develop_tzs_register
parents 8238a720 a0102dd8
......@@ -17,9 +17,9 @@ public enum DataQualityScoreEnum {
* *设备等级
*/
I("一级(只有设备名称其他使用登记证上信息无)", "3"),
II("二级(只有设备名称和使用登记证编号其他使用登记证上信息无)", "2"),
III("三级(使用登记证信息齐全)", "1");
I("一级(只有设备名称)", "3"),
II("二级(只有设备名称和使用登记证编号)", "2"),
III("三级(使用登记证信息齐全)", "1");
private String name;
private String code;
......
......@@ -17,7 +17,7 @@ public enum UnitTypeNewEnum {
* *注册单位类型
*/
sydw("使用单位", "1232", "use"),
sydw("企业", "1232", "use"),
czdw("充装单位", "1231", "license"),
jydw("检验单位", "1233", "license"),
jcdw("检测单位", "1233", "license"),
......
......@@ -40,6 +40,8 @@ import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.core.CountRequest;
import org.elasticsearch.client.core.CountResponse;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.NestedQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
......@@ -83,8 +85,6 @@ import static org.elasticsearch.index.query.QueryBuilders.existsQuery;
@RequiredArgsConstructor
public class ComprehensiveStatisticalAnalysisServiceImpl {
final static String EQU_LIST = "EQU_LIST";
@Value("classpath:/json/equipCategory.json")
private Resource equipCategory;
......@@ -258,7 +258,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
List<String> list = unitTypeByType.stream().map(e -> JSONObject.parseObject(JSONObject.toJSONString(e)).get("value").toString()).collect(Collectors.toList());
list.forEach(item -> boolMust.should(QueryBuilders.wildcardQuery("unitType.keyword", "*" + item + "*")).minimumShouldMatch(1));
}
} else if (k.equals("newPost") || k.equals("subPost")) {
} else if (k.equals("newPost") || k.equals("subPost") || k.equals("unitType")) {
((JSONArray) v).forEach(item -> {
boolMust.must(QueryBuilders.wildcardQuery(field + ".keyword", "*" + item + "*"));
});
......@@ -683,7 +683,9 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
String condition = paramRangeJson.getString("condition");
Object value = paramRangeJson.getString("value");
String fieldType = paramRangeJson.getString("fieldType");
getParamQuery(paramKey, condition, value, fieldType, false, boolMust, null, null);
if (!ObjectUtils.isEmpty(condition) && !ObjectUtils.isEmpty(value) && !ObjectUtils.isEmpty(fieldType)) {
getParamQuery(paramKey, condition, value, fieldType, false, boolMust, null, null);
}
}
} else if (!k.equals("paramRange")) {
if (v instanceof JSONArray) {
......@@ -771,7 +773,9 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
queryBuilder.minimumShouldMatch(1);
boolMust.must(queryBuilder);
} else if (k.equals("WHETHER_VEHICLE_CYLINDER")) {
boolMust.must(QueryBuilders.matchQuery(k, v.toString()));
if (!"".equals(v)) {
boolMust.must(QueryBuilders.matchQuery(k, v.toString()));
}
}
}
}
......@@ -822,15 +826,6 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
builder.query(boolMust);
List<Map<String, Object>> statics = new ArrayList<>();
JSONArray equList = (JSONArray) filterParams.get("EQU_LIST");
if (ObjectUtils.isEmpty(equList) || equList.contains("8000") || equList.contains("all")) {
// 获取压力管道长度
BigDecimal pipeLength = getPipeLength(boolMust, builder);
Map<String, Object> pipeMap = new HashMap<>();
pipeMap.put("name", "压力管道(千米)");
pipeMap.put("value", pipeLength.divide(new BigDecimal(1000)));
statics.add(pipeMap);
}
builder.from((current - 1) * size);
builder.size(size);
......@@ -873,16 +868,37 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
filterParams.put("EQU_LIST", jsonArray);
}
JSONArray equList = (JSONArray) filterParams.get("EQU_LIST");
if (ObjectUtils.isEmpty(equList) || equList.contains("8000") || equList.contains("all")) {
// 获取压力管道长度
// 压力管道长度
Map<String, Object> pipeMaps = new HashMap<>();
stCommonService.staticsCenterMapCountDataForPipeline(pipeMaps, orgCode, true, false);
// 获取压力管道长度
// BigDecimal pipeLength = getPipeLength(boolMust, builder);
Map<String, Object> pipeMap = new HashMap<>();
pipeMap.put("name", "压力管道(千米)");
pipeMap.put("value", pipeMaps.get("pressurePipelines"));
statics.add(pipeMap);
}
if (ObjectUtils.isEmpty(equList) || equList.contains("2000") || equList.contains("all")) {
// 气瓶数量
Map<String, Object> gasMap = new HashMap<>();
gasMap.put("name", "气瓶(个)");
Map<String, Object> gas = new HashMap<>();
gas.put(DPMapStatisticsItemEnum.GAS.getCode(), 0);
long cylinderNum = stCommonService.staticsCenterMapCountDataForCylinder(gas, orgCode, true, true, false);
// 1. 8大类设备数量统计,压力容器里包括气瓶所以需要特殊处理,在统计压力容器时去掉气瓶的数量
stCommonService.staticsCenterMapCountDataForEquip(gas, cylinderNum, orgCode, true, true, false);
gasMap.put("value", gas.get(DPMapStatisticsItemEnum.GAS.getCode()));
CountRequest countRequest = new CountRequest();
countRequest.indices(StatisticalAnalysisEnum.equip.getKey());
boolMust.must(QueryBuilders.termQuery("EQU_CATEGORY_CODE", "2300"));
countRequest.query(boolMust);
CountResponse response = null;
try {
response = restHighLevelClient.count(countRequest, RequestOptions.DEFAULT);
} catch (IOException e) {
throw new RuntimeException(e);
}
gasMap.put("value", response.getCount());
statics.add(gasMap);
}
result.put("statics", statics);
......@@ -891,10 +907,11 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
private BigDecimal getPipeLength(BoolQueryBuilder boolMust, SearchSourceBuilder builder) {
SearchRequest request = new SearchRequest();
request.indices(StatisticalAnalysisEnum.equip.getKey());
BigDecimal pipeLong = BigDecimal.ZERO;
builder.query(boolMust);
builder.from(0);
builder.size(10000000);
builder.size(1000000);
request.source(builder);
try {
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
......
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