Commit 8aa291c4 authored by chenzhao's avatar chenzhao

修改代码 健康指数相关

parent b6147d66
......@@ -20,11 +20,10 @@
idx_biz_fan_point_var_central_value ibfpvcv
WHERE
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT1_ID
OR b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT2_ID
OR b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT3_ID
OR b.SEQUENCE_NBR = ibfpvcv.ANALYSIS_POINT_ID
GROUP BY
b.SEQUENCE_NBR UNION ALL
b.SEQUENCE_NBR
UNION ALL
SELECT
b.*,
ibfpvcv.PROCESS_POINT1_ID AS pointOneId,
......@@ -42,10 +41,7 @@
) AS b,
idx_biz_fan_point_var_central_value ibfpvcv
WHERE
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT1_ID
OR b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT2_ID
OR b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT3_ID
OR b.SEQUENCE_NBR = ibfpvcv.ANALYSIS_POINT_ID
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT2_ID
GROUP BY
b.SEQUENCE_NBR UNION ALL
SELECT
......@@ -65,10 +61,7 @@
) AS b,
idx_biz_fan_point_var_central_value ibfpvcv
WHERE
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT1_ID
OR b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT2_ID
OR b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT3_ID
OR b.SEQUENCE_NBR = ibfpvcv.ANALYSIS_POINT_ID
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT3_ID
GROUP BY
b.SEQUENCE_NBR UNION ALL
SELECT
......@@ -88,10 +81,7 @@
) AS b,
idx_biz_fan_point_var_central_value ibfpvcv
WHERE
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT1_ID
OR b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT2_ID
OR b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT3_ID
OR b.SEQUENCE_NBR = ibfpvcv.ANALYSIS_POINT_ID
b.SEQUENCE_NBR = ibfpvcv.ANALYSIS_POINT_ID
GROUP BY
b.SEQUENCE_NBR
</select>
......
......@@ -159,4 +159,7 @@ public class IdxBizFanHealthIndex {
@TableField("POINT_NAME")
private String pointName;
@TableField("ANALYSIS_TIME")
private String ANALYSISTIME;
}
......@@ -169,4 +169,7 @@ public class IdxBizPvHealthIndex{
@TableField("POINT_NAME")
private String pointName;
@TableField("ANALYSIS_TIME")
private String ANALYSISTIME;
}
......@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments;
import com.yeejoin.amos.boot.module.jxiop.biz.Enum.SmartAnalyseEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.Thread.MyServiceThread;
......@@ -18,6 +19,7 @@ import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.joda.time.DateTimeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
......@@ -32,6 +34,7 @@ import org.springframework.data.elasticsearch.core.query.Query;
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 java.text.ParseException;
import java.text.SimpleDateFormat;
......@@ -1552,22 +1555,24 @@ public class CommonServiceImpl {
for (int i = 0; i < analysisVariableIdArray.size(); i++) {
IdxBizFanHealthIndex idxBizFanHealthIndex = new IdxBizFanHealthIndex();
BeanUtils.copyProperties(obj, idxBizFanHealthIndex);
idxBizFanHealthIndex.setHealthIndex(indexValueArray.getDoubleValue(i));
idxBizFanHealthIndex.setHealthIndex(indexValueArray.getDoubleValue(i)< 0 ? 0 : indexValueArray.getDoubleValue(i));
idxBizFanHealthIndex.setAnalysisObjSeq(obj.getSequenceNbr());
idxBizFanHealthIndex.setRecDate(time);
idxBizFanHealthIndex.setSequenceNbr(null);
idxBizFanHealthIndex.setRecDate(new Date());
idxBizFanHealthIndex.setWeigth(1.0);
//获取健康指数对应等级
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>();
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "设备");
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "测点");
query.eq(IdxBizFanHealthLevel::getStatus, obj.getStation());
query.le(IdxBizFanHealthLevel::getGroupLowerLimit, indexValueArray.getDoubleValue(i));
query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, indexValueArray.getDoubleValue(i));
query.le(IdxBizFanHealthLevel::getGroupLowerLimit, indexValueArray.getDoubleValue(i)< 0 ? 0 : indexValueArray.getDoubleValue(i));
query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, indexValueArray.getDoubleValue(i)< 0 ? 0 : indexValueArray.getDoubleValue(i));
IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query);
idxBizFanHealthIndex.setHealthLevel(idxBizFanHealthLevel.getHealthLevel());
idxBizFanHealthIndex.setAnalysisType("按时刻");
idxBizFanHealthIndex.setAnalysisObjType("测点");
idxBizFanHealthIndex.setANOMALY(scoreValueArray.getDoubleValue(i));
idxBizFanHealthIndex.setANALYSISTIME(DateUtils.getDateNowString());
idxBizFanHealthIndexs.add(idxBizFanHealthIndex);
}
}
......@@ -1674,20 +1679,22 @@ public class CommonServiceImpl {
for (int i = 0; i < analysisVariableIdArray.size(); i++) {
IdxBizPvHealthIndex idxBizPvHealthIndex = new IdxBizPvHealthIndex();
BeanUtils.copyProperties(obj, idxBizPvHealthIndex);
idxBizPvHealthIndex.setHealthIndex(indexValueArray.getDoubleValue(i));
idxBizPvHealthIndex.setHealthIndex(indexValueArray.getDoubleValue(i)< 0 ? 0 : indexValueArray.getDoubleValue(i));
idxBizPvHealthIndex.setAnalysisObjSeq(obj.getSequenceNbr());
idxBizPvHealthIndex.setRecDate(time);
idxBizPvHealthIndex.setWeigth(1.0);
//获取健康指数对应等级
LambdaQueryWrapper<IdxBizPvHealthLevel> query = new LambdaQueryWrapper<>();
query.eq(IdxBizPvHealthLevel::getAnalysisObjType, "设备");
query.eq(IdxBizPvHealthLevel::getAnalysisObjType, "测点");
query.eq(IdxBizPvHealthLevel::getStatus, obj.getStation());
query.le(IdxBizPvHealthLevel::getGroupLowerLimit, indexValueArray.getDoubleValue(i));
query.ge(IdxBizPvHealthLevel::getGroupUpperLimit, indexValueArray.getDoubleValue(i));
query.le(IdxBizPvHealthLevel::getGroupLowerLimit, indexValueArray.getDoubleValue(i) < 0 ? 0 : indexValueArray.getDoubleValue(i));
query.ge(IdxBizPvHealthLevel::getGroupUpperLimit, indexValueArray.getDoubleValue(i) < 0 ? 0 : indexValueArray.getDoubleValue(i) );
IdxBizPvHealthLevel idxBizFanHealthLevel = idxBizPvHealthLevelMapper.selectOne(query);
idxBizPvHealthIndex.setHealthLevel(idxBizFanHealthLevel.getHealthLevel());
idxBizPvHealthIndex.setAnalysisType("按时刻");
idxBizPvHealthIndex.setAnalysisObjType("测点");
idxBizPvHealthIndex.setANOMALY(scoreValueArray.getDoubleValue(i));
idxBizPvHealthIndex.setANALYSISTIME(DateUtils.getDateNowString());
idxBizPvHealthIndexs.add(idxBizPvHealthIndex);
}
}
......
......@@ -20,9 +20,6 @@
idx_biz_fan_point_var_central_value ibfpvcv
WHERE
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT1_ID
OR b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT2_ID
OR b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT3_ID
OR b.SEQUENCE_NBR = ibfpvcv.ANALYSIS_POINT_ID
GROUP BY
b.SEQUENCE_NBR UNION ALL
SELECT
......@@ -42,10 +39,7 @@
) AS b,
idx_biz_fan_point_var_central_value ibfpvcv
WHERE
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT1_ID
OR b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT2_ID
OR b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT3_ID
OR b.SEQUENCE_NBR = ibfpvcv.ANALYSIS_POINT_ID
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT2_ID
GROUP BY
b.SEQUENCE_NBR UNION ALL
SELECT
......@@ -65,10 +59,7 @@
) AS b,
idx_biz_fan_point_var_central_value ibfpvcv
WHERE
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT1_ID
OR b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT2_ID
OR b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT3_ID
OR b.SEQUENCE_NBR = ibfpvcv.ANALYSIS_POINT_ID
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT3_ID
GROUP BY
b.SEQUENCE_NBR UNION ALL
SELECT
......@@ -88,10 +79,7 @@
) AS b,
idx_biz_fan_point_var_central_value ibfpvcv
WHERE
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT1_ID
OR b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT2_ID
OR b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT3_ID
OR b.SEQUENCE_NBR = ibfpvcv.ANALYSIS_POINT_ID
b.SEQUENCE_NBR = ibfpvcv.ANALYSIS_POINT_ID
GROUP BY
b.SEQUENCE_NBR
</select>
......
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