Commit bf2cdc70 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 e260441a b7e8e230
......@@ -59,6 +59,7 @@ import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.io.IOException;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
......@@ -814,6 +815,16 @@ 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);
......@@ -833,17 +844,6 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
dto.put("WHETHER_VEHICLE_CYLINDER", ObjectUtils.isEmpty(dto.get("WHETHER_VEHICLE_CYLINDER")) ? "" : "1".equals(dto.get("WHETHER_VEHICLE_CYLINDER")) ? "是" : "否");
dto.put("WHETHER_SKID_MOUNTED_PRESSURE_VESSEL", ObjectUtils.isEmpty(dto.get("WHETHER_SKID_MOUNTED_PRESSURE_VESSEL")) ? "" : "1".equals(dto.get("WHETHER_SKID_MOUNTED_PRESSURE_VESSEL")) ? "是" : "否");
dto.put("whetherSphericalTank", ObjectUtils.isEmpty(dto.get("whetherSphericalTank")) ? "" : "1".equals(dto.get("whetherSphericalTank")) ? "是" : "否");
// if (dto.get("EQU_LIST_CODE").equals("8000")) {
// JSONArray techParams = (JSONArray) dto.get("techParams");
// if (!ObjectUtils.isEmpty(techParams)) {
// Object obj = techParams.stream().filter(item -> JSONObject.parseObject(JSONObject.toJSONString(item)).get("paramKey").equals("pipeLength")).findFirst().get();
// JSONObject jsonParam = JSONObject.parseObject(JSONObject.toJSONString(obj));
// if (jsonParam.containsKey("doubleValue")) {
// String pipeLength = JSONObject.parseObject(JSONObject.toJSONString(obj)).get("doubleValue").toString();
// pipeLong += Double.parseDouble(pipeLength);
// }
// }
// }
list.add(dto);
}
totle = Objects.requireNonNull(response.getInternalResponse().hits().getTotalHits()).value;
......@@ -854,7 +854,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
throw new RuntimeException(e);
}
List<Map<String, Object>> statics = new ArrayList<>();
Map<String, Object> sum = new HashMap<>();
sum.put("name", "设备总数(台套)");
sum.put("value", totle);
......@@ -867,19 +867,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
filterParams.put("EQU_LIST", jsonArray);
}
JSONArray equList = (JSONArray) filterParams.get("EQU_LIST");
if (equList.contains("8000") || equList.contains("all") || ObjectUtils.isEmpty(equList)) {
// 压力管道长度
Map<String, Object> pipeMaps = new HashMap<>();
stCommonService.staticsCenterMapCountDataForPipeline(pipeMaps, orgCode, true, false);
// 获取压力管道长度
// getPipeLength(pipeMaps, boolMust, builder, filterParams);
Map<String, Object> pipeMap = new HashMap<>();
pipeMap.put("name", "压力管道(千米)");
pipeMap.put("value", pipeMaps.get("pressurePipelines"));
statics.add(pipeMap);
}
if (equList.contains("2000") || equList.contains("all") || ObjectUtils.isEmpty(equList)) {
if (ObjectUtils.isEmpty(equList) || equList.contains("2000") || equList.contains("all")) {
// 气瓶数量
Map<String, Object> gasMap = new HashMap<>();
gasMap.put("name", "气瓶(个)");
......@@ -895,10 +883,12 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
return result;
}
private double getPipeLength(BoolQueryBuilder boolMust, SearchSourceBuilder builder, SearchSourceBuilder searchSourceBuilder) {
private BigDecimal getPipeLength(BoolQueryBuilder boolMust, SearchSourceBuilder builder) {
SearchRequest request = new SearchRequest();
double pipeLong = 0L;
BigDecimal pipeLong = BigDecimal.ZERO;
builder.query(boolMust);
builder.from(0);
builder.size(10000000);
request.source(builder);
try {
SearchResponse response = restHighLevelClient.search(request, RequestOptions.DEFAULT);
......@@ -911,8 +901,8 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
Object obj = techParams.stream().filter(item -> JSONObject.parseObject(JSONObject.toJSONString(item)).get("paramKey").equals("pipeLength")).findFirst().get();
JSONObject jsonParam = JSONObject.parseObject(JSONObject.toJSONString(obj));
if (jsonParam.containsKey("doubleValue")) {
String pipeLength = JSONObject.parseObject(JSONObject.toJSONString(obj)).get("doubleValue").toString();
pipeLong += Double.parseDouble(pipeLength);
String pipeLength = jsonParam.get("doubleValue").toString();
pipeLong = pipeLong.add(new BigDecimal(pipeLength));
}
}
}
......
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