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