Commit 667152af authored by chenzhao's avatar chenzhao

增加健康指数数据排查文件

parent d31fcbc2
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import cn.hutool.http.HttpUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
......@@ -15,6 +18,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizPvPointProcessVariableCl
import com.yeejoin.amos.boot.module.jxiop.biz.entity.*;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import javafx.scene.control.Tab;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
......@@ -35,7 +39,11 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.DateTimeUtil;
import tech.tablesaw.api.DoubleColumn;
import tech.tablesaw.api.StringColumn;
import tech.tablesaw.api.Table;
import java.io.File;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -1466,6 +1474,9 @@ public class CommonServiceImpl {
if (!openHealth){
return;
}
Date time = new Date();
Calendar calendar = Calendar.getInstance();
List<IdxBizFanPointProcessVariableClassificationDto> data = idxBizFanPointProcessVariableClassificationMapper.getInfluxDBData();
......@@ -1514,6 +1525,20 @@ public class CommonServiceImpl {
ArrayList<Object> stdDevList = new ArrayList<>();
ArrayList<Object> centerValueList = new ArrayList<>();
ArrayList<Object> analysisVariableIdList = new ArrayList<>();
List<Double> analysisVariable = new ArrayList<>();
List<Double> stdDev = new ArrayList<>();
List<Double> centerValue = new ArrayList<>();
List<String> analysisVariableId = new ArrayList<>();
List<Double> ProcessPoint1= new ArrayList<>();
List<Double> ProcessPoint2 = new ArrayList<>();
List<Double> ProcessPoint3 = new ArrayList<>();
List<String> ProcessPoint1Id = new ArrayList<>();
List<String> ProcessPoint2Id = new ArrayList<>();
List<String> ProcessPoint3Id = new ArrayList<>();
List<String> analysisVariableIds = new ArrayList<>();
for (IdxBizFanPointVarCentralValue idxBizUhef : idxBizUhefs) {
double value1 = 0.00;
double value2 = 0.00;
......@@ -1540,9 +1565,25 @@ public class CommonServiceImpl {
&&(null == idxBizUhef.getProcess3Min() || idxBizUhef.getProcess3Min() <= value3 ) && (null ==idxBizUhef.getProcess3Max() || value3 <= idxBizUhef.getProcess3Max())) {
if (!analysisVariableIdList.contains(idxBizUhef.getAnalysisPointId())){
analysisVariableList.add(value4);
analysisVariable.add(value4);
ProcessPoint1Id.add(idxBizUhef.getProcessPoint1Id());
ProcessPoint2Id.add(idxBizUhef.getProcessPoint2Id());
ProcessPoint3Id.add(idxBizUhef.getProcessPoint3Id());
analysisVariableIds.add(idxBizUhef.getAnalysisPointId());
ProcessPoint1.add(value1);
ProcessPoint2.add(value2);
ProcessPoint3.add(value3);
stdDevList.add(idxBizUhef.getAnalysisStdDev());
stdDev.add(idxBizUhef.getAnalysisStdDev());
centerValueList.add(idxBizUhef.getAnalysisCenterValue());
centerValue.add(idxBizUhef.getAnalysisCenterValue());
analysisVariableIdList.add(idxBizUhef.getAnalysisPointId());
analysisVariableId.add(idxBizUhef.getAnalysisPointId());
}
}
}
......@@ -1552,6 +1593,17 @@ public class CommonServiceImpl {
requestMap.put("centerValue", centerValueList);
requestMap.put("analysisVariableId", analysisVariableIdList);
Table healthData = Table.create("healthData");
healthData.addColumns(DoubleColumn.create("analysisVariable",analysisVariable),
DoubleColumn.create("stdDev",stdDev),
DoubleColumn.create("centerValue",centerValue),
StringColumn.create("ProcessPoint1Id",ProcessPoint1Id),
DoubleColumn.create("ProcessPoint1",ProcessPoint1),
StringColumn.create("ProcessPoint2Id",ProcessPoint2Id),
DoubleColumn.create("ProcessPoint2",ProcessPoint2),
StringColumn.create("ProcessPoint3Id",ProcessPoint3Id),
DoubleColumn.create("ProcessPoint3",ProcessPoint3),
StringColumn.create("analysisVariableId",analysisVariableIds));
logger.info("------------------------------------------开始调用健康指数计算算法开始----------------------------------------");
String response = HttpUtil.createPost(baseUrlZSFX).body(JSON.toJSONString(requestMap)).execute().body();
......@@ -1562,6 +1614,19 @@ public class CommonServiceImpl {
JSONArray scoreValueArray = jsonObject.getJSONArray("scoreValue");
JSONArray analysisVariableIdArray = jsonObject.getJSONArray("analysisVariableId");
List<String> jsonArrayToStringList = JSONObject.parseArray(analysisVariableIdArray.toJSONString(),String.class);
List<Double> scoreValue = JSONObject.parseArray(scoreValueArray.toJSONString(),Double.class);
List<Double> indexValue = JSONObject.parseArray(indexValueArray.toJSONString(),Double.class);
// Table resultTable = Table.create("healthData");
healthData.addColumns( StringColumn.create("analysisVariableIdResult",jsonArrayToStringList),
DoubleColumn.create("indexValue",indexValue), DoubleColumn.create("scoreValue",scoreValue));
System.out.println(healthData.print());
try {
healthData.write().csv(new Date().getTime()+".csv");
}catch (Exception e){
e.printStackTrace();
}
LambdaQueryWrapper<IdxBizFanPointProcessVariableClassification> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(IdxBizFanPointProcessVariableClassification::getSequenceNbr, jsonArrayToStringList);
List<IdxBizFanPointProcessVariableClassification> list = idxBizFanPointProcessVariableClassificationMapper.selectList(queryWrapper);
......@@ -1674,6 +1739,20 @@ public class CommonServiceImpl {
ArrayList<Object> stdDevList = new ArrayList<>();
ArrayList<Object> centerValueList = new ArrayList<>();
ArrayList<Object> analysisVariableIdList = new ArrayList<>();
List<Double> analysisVariable = new ArrayList<>();
List<Double> stdDev = new ArrayList<>();
List<Double> centerValue = new ArrayList<>();
List<String> analysisVariableId = new ArrayList<>();
List<Double> ProcessPoint1= new ArrayList<>();
List<Double> ProcessPoint2 = new ArrayList<>();
List<Double> ProcessPoint3 = new ArrayList<>();
List<String> ProcessPoint1Id = new ArrayList<>();
List<String> ProcessPoint2Id = new ArrayList<>();
List<String> ProcessPoint3Id = new ArrayList<>();
List<String> analysisVariableIds = new ArrayList<>();
for (IdxBizPvPointVarCentralValue idxBizUhef : idxBizUhefs) {
double value1 = 0.00;
double value2 = 0.00;
......@@ -1698,9 +1777,26 @@ public class CommonServiceImpl {
&&(null == idxBizUhef.getProcess3Min() || idxBizUhef.getProcess3Min() <= value3 ) && (null ==idxBizUhef.getProcess3Max() || value3 <= idxBizUhef.getProcess3Max())) {
if (!analysisVariableIdList.contains(idxBizUhef.getAnalysisPointId())){
analysisVariableList.add(value4);
analysisVariable.add(value4);
ProcessPoint1Id.add(idxBizUhef.getProcessPoint1Id());
ProcessPoint2Id.add(idxBizUhef.getProcessPoint2Id());
ProcessPoint3Id.add(idxBizUhef.getProcessPoint3Id());
analysisVariableIds.add(idxBizUhef.getAnalysisPointId());
ProcessPoint1.add(value1);
ProcessPoint2.add(value2);
ProcessPoint3.add(value3);
stdDevList.add(idxBizUhef.getAnalysisStdDev());
stdDev.add(idxBizUhef.getAnalysisStdDev());
centerValueList.add(idxBizUhef.getAnalysisCenterValue());
centerValue.add(idxBizUhef.getAnalysisCenterValue());
analysisVariableIdList.add(idxBizUhef.getAnalysisPointId());
analysisVariableId.add(idxBizUhef.getAnalysisPointId());
}
}
}
......@@ -1708,6 +1804,18 @@ public class CommonServiceImpl {
requestMap.put("stdDev", stdDevList);
requestMap.put("centerValue", centerValueList);
requestMap.put("analysisVariableId", analysisVariableIdList);
Table healthData = Table.create("healthData");
healthData.addColumns(DoubleColumn.create("analysisVariable",analysisVariable),
DoubleColumn.create("stdDev",stdDev),
DoubleColumn.create("centerValue",centerValue),
StringColumn.create("ProcessPoint1Id",ProcessPoint1Id),
DoubleColumn.create("ProcessPoint1",ProcessPoint1),
StringColumn.create("ProcessPoint2Id",ProcessPoint2Id),
DoubleColumn.create("ProcessPoint2",ProcessPoint2),
StringColumn.create("ProcessPoint3Id",ProcessPoint3Id),
DoubleColumn.create("ProcessPoint3",ProcessPoint3),
StringColumn.create("analysisVariableId",analysisVariableIds));
logger.info("------------------------------------------开始调用健康指数计算算法开始----------------------------------------");
String response = HttpUtil.createPost(baseUrlZSFX).body(JSON.toJSONString(requestMap)).execute().body();
JSONObject jsonObject = JSON.parseObject(response);
......@@ -1716,6 +1824,19 @@ public class CommonServiceImpl {
JSONArray scoreValueArray = jsonObject.getJSONArray("scoreValue");
JSONArray analysisVariableIdArray = jsonObject.getJSONArray("analysisVariableId");
List<String> jsonArrayToStringList = JSONObject.parseArray(analysisVariableIdArray.toJSONString(),String.class);
List<Double> scoreValue = JSONObject.parseArray(scoreValueArray.toJSONString(),Double.class);
List<Double> indexValue = JSONObject.parseArray(indexValueArray.toJSONString(),Double.class);
// Table resultTable = Table.create("healthData");
healthData.addColumns( StringColumn.create("analysisVariableIdResult",jsonArrayToStringList),
DoubleColumn.create("indexValue",indexValue), DoubleColumn.create("scoreValue",scoreValue));
System.out.println(healthData.print());
try {
healthData.write().csv(new Date().getTime()+".csv");
}catch (Exception e){
e.printStackTrace();
}
LambdaQueryWrapper<IdxBizPvPointProcessVariableClassification> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(IdxBizPvPointProcessVariableClassification::getSequenceNbr, jsonArrayToStringList);
List<IdxBizPvPointProcessVariableClassification> list = idxBizPvPointProcessVariableClassificationMapper.selectList(queryWrapper);
......
......@@ -198,7 +198,7 @@
POINT_NAME ,
STATION,
CAST(HEALTH_INDEX AS UNSIGNED) as HEALTH_INDEX,
CAST(HEALTH_INDEX AS UNSIGNED) as value
CAST(HEALTH_INDEX AS UNSIGNED) as value,
HEALTH_LEVEL,
SUBARRAY,
REC_DATE,
......
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