Commit c52dc06b authored by tangwei's avatar tangwei

解决冲突

parents 34b7fa08 b01b710b
...@@ -20,11 +20,10 @@ ...@@ -20,11 +20,10 @@
idx_biz_fan_point_var_central_value ibfpvcv idx_biz_fan_point_var_central_value ibfpvcv
WHERE WHERE
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT1_ID 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 GROUP BY
b.SEQUENCE_NBR UNION ALL b.SEQUENCE_NBR
UNION ALL
SELECT SELECT
b.*, b.*,
ibfpvcv.PROCESS_POINT1_ID AS pointOneId, ibfpvcv.PROCESS_POINT1_ID AS pointOneId,
...@@ -42,10 +41,7 @@ ...@@ -42,10 +41,7 @@
) AS b, ) AS b,
idx_biz_fan_point_var_central_value ibfpvcv idx_biz_fan_point_var_central_value ibfpvcv
WHERE WHERE
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT1_ID b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT2_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 GROUP BY
b.SEQUENCE_NBR UNION ALL b.SEQUENCE_NBR UNION ALL
SELECT SELECT
...@@ -65,10 +61,7 @@ ...@@ -65,10 +61,7 @@
) AS b, ) AS b,
idx_biz_fan_point_var_central_value ibfpvcv idx_biz_fan_point_var_central_value ibfpvcv
WHERE WHERE
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT1_ID b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT3_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 GROUP BY
b.SEQUENCE_NBR UNION ALL b.SEQUENCE_NBR UNION ALL
SELECT SELECT
...@@ -88,10 +81,7 @@ ...@@ -88,10 +81,7 @@
) AS b, ) AS b,
idx_biz_fan_point_var_central_value ibfpvcv idx_biz_fan_point_var_central_value ibfpvcv
WHERE WHERE
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT1_ID b.SEQUENCE_NBR = ibfpvcv.ANALYSIS_POINT_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 GROUP BY
b.SEQUENCE_NBR b.SEQUENCE_NBR
</select> </select>
......
...@@ -258,14 +258,17 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -258,14 +258,17 @@ public class BigScreenAnalyseController extends BaseController {
public ResponseModel<Map<String, Object>> getHealthInfoByArea(@RequestParam(required = false) String areaCode) { public ResponseModel<Map<String, Object>> getHealthInfoByArea(@RequestParam(required = false) String areaCode) {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoByStation(areaCode); List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthInfoByStation(areaCode);
Map<String, BigDecimal> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("station").toString(), t -> new BigDecimal(t.get("healthIndex").toString()))); // Map<String, BigDecimal> collect = healthListInfo.stream().collect(Collectors.toMap(t -> t.get("station").toString(), t -> new BigDecimal(t.get("healthIndex").toString())));
// List<StationBasic> stationBasics = stationBasicMapper.selectList(new LambdaQueryWrapper<StationBasic>().like(StationBasic::getAreaName, areaCode));
// List<String> list = stationBasics.stream().map(StationBasic::getStationName).collect(Collectors.toList());
// List<Object> seriesData = new ArrayList<>();
List<StationBasic> stationBasics = stationBasicMapper.selectList(new LambdaQueryWrapper<StationBasic>().like(StationBasic::getAreaName, areaCode)); // list.forEach(item -> seriesData.add(collect.getOrDefault(item, new BigDecimal("100"))));
List<String> list = stationBasics.stream().map(StationBasic::getStationName).collect(Collectors.toList()); List<String> list = new ArrayList<>();
List<Object> seriesData = new ArrayList<>(); List<Object> seriesData = new ArrayList<>();
list.forEach(item -> seriesData.add(collect.getOrDefault(item, new BigDecimal("100")))); healthListInfo.forEach(item -> {
list.add(item.get("station").toString());
seriesData.add(new BigDecimal(item.get("healthIndex").toString()));
});
resultMap.put("axisData", list); resultMap.put("axisData", list);
resultMap.put("seriesData", seriesData); resultMap.put("seriesData", seriesData);
return ResponseHelper.buildResponse(resultMap); return ResponseHelper.buildResponse(resultMap);
......
...@@ -88,6 +88,8 @@ public class KafkaAnalyseController { ...@@ -88,6 +88,8 @@ public class KafkaAnalyseController {
@ApiOperation(httpMethod = "POST", value = "中心值 - 风电 - 新", notes = "中心值 - 风电 - 新") @ApiOperation(httpMethod = "POST", value = "中心值 - 风电 - 新", notes = "中心值 - 风电 - 新")
public ResponseModel<Object> getFanConditionVariablesZXZ() { public ResponseModel<Object> getFanConditionVariablesZXZ() {
if (redisUtils.hasKey(kafkaTopicConsumerZXZFan)) { if (redisUtils.hasKey(kafkaTopicConsumerZXZFan)) {
// redisUtils.del(kafkaTopicConsumerZXZFan);
// redisUtils.getExpire(kafkaTopicConsumerZXZFan);
return ResponseHelper.buildResponse("计算中"); return ResponseHelper.buildResponse("计算中");
} }
fanConditionVariablesMessage.getFanConditionVariablesZXZ(); fanConditionVariablesMessage.getFanConditionVariablesZXZ();
...@@ -100,6 +102,7 @@ public class KafkaAnalyseController { ...@@ -100,6 +102,7 @@ public class KafkaAnalyseController {
@ApiOperation(httpMethod = "POST", value = "中心值 - 光伏 - 新", notes = "工况划分 - 光伏 - 新") @ApiOperation(httpMethod = "POST", value = "中心值 - 光伏 - 新", notes = "工况划分 - 光伏 - 新")
public ResponseModel<Object> getPvConditionVariablesZXZ() { public ResponseModel<Object> getPvConditionVariablesZXZ() {
if (redisUtils.hasKey(kafkaTopicConsumerZXZPv)) { if (redisUtils.hasKey(kafkaTopicConsumerZXZPv)) {
// redisUtils.del(kafkaTopicConsumerZXZPv);
return ResponseHelper.buildResponse("计算中"); return ResponseHelper.buildResponse("计算中");
} }
fanConditionVariablesMessage.getPvConditionVariablesZXZ(); fanConditionVariablesMessage.getPvConditionVariablesZXZ();
......
...@@ -159,4 +159,7 @@ public class IdxBizFanHealthIndex { ...@@ -159,4 +159,7 @@ public class IdxBizFanHealthIndex {
@TableField("POINT_NAME") @TableField("POINT_NAME")
private String pointName; private String pointName;
@TableField("ANALYSIS_TIME")
private String ANALYSISTIME;
} }
...@@ -169,4 +169,7 @@ public class IdxBizPvHealthIndex{ ...@@ -169,4 +169,7 @@ public class IdxBizPvHealthIndex{
@TableField("POINT_NAME") @TableField("POINT_NAME")
private String pointName; private String pointName;
@TableField("ANALYSIS_TIME")
private String ANALYSISTIME;
} }
...@@ -85,6 +85,6 @@ public class FanConditionVariablesMessage { ...@@ -85,6 +85,6 @@ public class FanConditionVariablesMessage {
@Async @Async
public void getPvConditionVariablesZXZ() { public void getPvConditionVariablesZXZ() {
List<IdxBizPvPointProcessVariableClassification> fenxiList = idxBizPvPointProcessVariableClassificationMapper.selectList(new QueryWrapper<IdxBizPvPointProcessVariableClassification>().isNotNull("SEQUENCE_NBR").eq("TAG_CODE", "分析变量")); List<IdxBizPvPointProcessVariableClassification> fenxiList = idxBizPvPointProcessVariableClassificationMapper.selectList(new QueryWrapper<IdxBizPvPointProcessVariableClassification>().isNotNull("SEQUENCE_NBR").eq("TAG_CODE", "分析变量"));
fenxiList.forEach(item -> kafkaProducerService.sendMessageAsync(kafkaTopicConsumerZXZFan, JSON.toJSONString(item))); fenxiList.forEach(item -> kafkaProducerService.sendMessageAsync(kafkaTopicConsumerZXZPv, JSON.toJSONString(item)));
} }
} }
...@@ -157,11 +157,7 @@ public class KafkaConsumerService { ...@@ -157,11 +157,7 @@ public class KafkaConsumerService {
minRow = minRow > values.size() ? values.size() : minRow; minRow = minRow > values.size() ? values.size() : minRow;
} }
values.setName("processVariable" + index); values.setName("processVariable" + index);
if (!dataTable.isEmpty() && dataTable.rowCount() < values.size()) { dataTable = getDataTable(dataTable, values);
dataTable.addColumns(values.inRange(0, dataTable.rowCount()));
} else {
dataTable.addColumns(values);
}
data1.put("processVariable" + index + "Id", processVariable.getSequenceNbr()); data1.put("processVariable" + index + "Id", processVariable.getSequenceNbr());
...@@ -171,6 +167,7 @@ public class KafkaConsumerService { ...@@ -171,6 +167,7 @@ public class KafkaConsumerService {
IntervalValues.add(processVariable.getIntervalValue2()); IntervalValues.add(processVariable.getIntervalValue2());
IntervalValues.add(processVariable.getIntervalValue3()); IntervalValues.add(processVariable.getIntervalValue3());
IntervalValues.add(processVariable.getIntervalValue4()); IntervalValues.add(processVariable.getIntervalValue4());
IntervalValues.add(processVariable.getIntervalValue5());
data2.put("processVariable" + index, IntervalValues); data2.put("processVariable" + index, IntervalValues);
index++; index++;
...@@ -178,15 +175,11 @@ public class KafkaConsumerService { ...@@ -178,15 +175,11 @@ public class KafkaConsumerService {
Selection selection = table.stringColumn("id").isEqualTo(analysisVariable.getIndexAddress() + "_" + analysisVariable.getGatewayId()); Selection selection = table.stringColumn("id").isEqualTo(analysisVariable.getIndexAddress() + "_" + analysisVariable.getGatewayId());
DoubleColumn values = table.where(selection).doubleColumn("value"); DoubleColumn values = table.where(selection).doubleColumn("value");
values.setName("analysisVariable"); values.setName("analysisVariable");
if (!dataTable.isEmpty() && dataTable.rowCount() < values.size()) { dataTable = getDataTable(dataTable, values);
dataTable.addColumns(values.inRange(0, dataTable.rowCount()));
} else {
dataTable.addColumns(values);
}
data1.put("analysisVariableId", analysisVariable.getSequenceNbr()); data1.put("analysisVariableId", analysisVariable.getSequenceNbr());
// 获取相同长度的数据 // 获取相同长度的数据
dataTable = dataTable.inRange(0, minRow); // dataTable = dataTable.inRange(0, minRow);
List<String> list = dataTable.columnNames(); List<String> list = dataTable.columnNames();
for (String column : list) { for (String column : list) {
data1.put(column, dataTable.doubleColumn(column).asDoubleArray()); data1.put(column, dataTable.doubleColumn(column).asDoubleArray());
...@@ -201,7 +194,7 @@ public class KafkaConsumerService { ...@@ -201,7 +194,7 @@ public class KafkaConsumerService {
idxBizFanPointVarCentralValueMapper.delete(new QueryWrapper<IdxBizFanPointVarCentralValue>().eq("ANALYSIS_POINT_ID", analysisVariableId)); idxBizFanPointVarCentralValueMapper.delete(new QueryWrapper<IdxBizFanPointVarCentralValue>().eq("ANALYSIS_POINT_ID", analysisVariableId));
JSONObject jsonObject = JSON.parseObject(response); JSONObject jsonObject = JSON.parseObject(response);
int length = jsonObject.getJSONArray("stdDev").size(); int length = jsonObject.getJSONArray("stdDev").size() > 64 ? 64 : jsonObject.getJSONArray("stdDev").size();
List<IdxBizFanPointVarCentralValue> insertList = new ArrayList<>(); List<IdxBizFanPointVarCentralValue> insertList = new ArrayList<>();
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
IdxBizFanPointVarCentralValue idxBizFanPointVarCentralValue = new IdxBizFanPointVarCentralValue(); IdxBizFanPointVarCentralValue idxBizFanPointVarCentralValue = new IdxBizFanPointVarCentralValue();
...@@ -236,6 +229,19 @@ public class KafkaConsumerService { ...@@ -236,6 +229,19 @@ public class KafkaConsumerService {
} }
} }
private Table getDataTable(Table dataTable, DoubleColumn values) {
if (!dataTable.isEmpty() && dataTable.rowCount() < values.size()) {
dataTable.addColumns(values.inRange(0, dataTable.rowCount()));
} else if (!dataTable.isEmpty() && dataTable.rowCount() > values.size()){
dataTable = dataTable.inRange(0, values.size());
dataTable.addColumns(values);
} else {
dataTable.addColumns(values);
}
return dataTable;
}
private void execPvCorrelation(List<ConsumerRecord<String, String>> consumerRecords, Table table) { private void execPvCorrelation(List<ConsumerRecord<String, String>> consumerRecords, Table table) {
consumerRecords.parallelStream().forEach(record -> { consumerRecords.parallelStream().forEach(record -> {
Optional<?> kafkaMessage = Optional.ofNullable(record.value()); Optional<?> kafkaMessage = Optional.ofNullable(record.value());
...@@ -709,7 +715,7 @@ public class KafkaConsumerService { ...@@ -709,7 +715,7 @@ public class KafkaConsumerService {
if (kafkaMessage.isPresent()) { if (kafkaMessage.isPresent()) {
IdxBizPvPointProcessVariableClassification pvPointProcessVariable = JSON.parseObject(kafkaMessage.get().toString(), IdxBizPvPointProcessVariableClassification.class); IdxBizPvPointProcessVariableClassification pvPointProcessVariable = JSON.parseObject(kafkaMessage.get().toString(), IdxBizPvPointProcessVariableClassification.class);
List<IdxBizFanPointVarCorrelation> gongkuangList = idxBizFanPointVarCorrelationService.list(new QueryWrapper<IdxBizFanPointVarCorrelation>().eq("ANALYSIS_GATEWAY_ID", pvPointProcessVariable.getGatewayId()).eq("ANALYSIS_POINT_ID", pvPointProcessVariable.getSequenceNbr()).orderByDesc("CORRELATION_COEFFICIENT").last("limit 3")); List<IdxBizPvPointVarCorrelation> gongkuangList = idxBizPvPointVarCorrelationService.list(new QueryWrapper<IdxBizPvPointVarCorrelation>().eq("ANALYSIS_GATEWAY_ID", pvPointProcessVariable.getGatewayId()).eq("ANALYSIS_POINT_ID", pvPointProcessVariable.getSequenceNbr()).orderByDesc("CORRELATION_COEFFICIENT").last("limit 3"));
List<String> processPointIds = gongkuangList.stream().map(idxBizFanPointVarCorrelation -> idxBizFanPointVarCorrelation.getProcessPointId().toString()).collect(Collectors.toList()); List<String> processPointIds = gongkuangList.stream().map(idxBizFanPointVarCorrelation -> idxBizFanPointVarCorrelation.getProcessPointId().toString()).collect(Collectors.toList());
List<IdxBizPvPointProcessVariableClassification> idxBizPvPointProcessVariableClassificationList = idxBizPvPointProcessVariableClassificationService.list(new QueryWrapper<IdxBizPvPointProcessVariableClassification>().in("SEQUENCE_NBR", processPointIds)); List<IdxBizPvPointProcessVariableClassification> idxBizPvPointProcessVariableClassificationList = idxBizPvPointProcessVariableClassificationService.list(new QueryWrapper<IdxBizPvPointProcessVariableClassification>().in("SEQUENCE_NBR", processPointIds));
...@@ -730,7 +736,7 @@ public class KafkaConsumerService { ...@@ -730,7 +736,7 @@ public class KafkaConsumerService {
} }
}); });
buildZXZPvExecData(consumerRecords, gatewayPoints, zxzIds, "ZXZFanConsumer"); buildZXZPvExecData(consumerRecords, gatewayPoints, zxzIds, "ZXZPvConsumer");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -788,11 +794,7 @@ public class KafkaConsumerService { ...@@ -788,11 +794,7 @@ public class KafkaConsumerService {
minRow = minRow > values.size() ? values.size() : minRow; minRow = minRow > values.size() ? values.size() : minRow;
} }
values.setName("processVariable" + index); values.setName("processVariable" + index);
if (!dataTable.isEmpty() && dataTable.rowCount() < values.size()) { dataTable = getDataTable(dataTable, values);
dataTable.addColumns(values.inRange(0, dataTable.rowCount()));
} else {
dataTable.addColumns(values);
}
data1.put("processVariable" + index + "Id", processVariable.getSequenceNbr()); data1.put("processVariable" + index + "Id", processVariable.getSequenceNbr());
// 构建工况区间数组 // 构建工况区间数组
...@@ -801,6 +803,7 @@ public class KafkaConsumerService { ...@@ -801,6 +803,7 @@ public class KafkaConsumerService {
IntervalValues.add(processVariable.getIntervalValue2()); IntervalValues.add(processVariable.getIntervalValue2());
IntervalValues.add(processVariable.getIntervalValue3()); IntervalValues.add(processVariable.getIntervalValue3());
IntervalValues.add(processVariable.getIntervalValue4()); IntervalValues.add(processVariable.getIntervalValue4());
IntervalValues.add(processVariable.getIntervalValue5());
data2.put("processVariable" + index, IntervalValues); data2.put("processVariable" + index, IntervalValues);
index++; index++;
...@@ -808,15 +811,12 @@ public class KafkaConsumerService { ...@@ -808,15 +811,12 @@ public class KafkaConsumerService {
Selection selection = table.stringColumn("id").isEqualTo(analysisVariable.getIndexAddress() + "_" + analysisVariable.getGatewayId()); Selection selection = table.stringColumn("id").isEqualTo(analysisVariable.getIndexAddress() + "_" + analysisVariable.getGatewayId());
DoubleColumn values = table.where(selection).doubleColumn("value"); DoubleColumn values = table.where(selection).doubleColumn("value");
values.setName("analysisVariable"); values.setName("analysisVariable");
if (!dataTable.isEmpty() && dataTable.rowCount() < values.size()) { dataTable = getDataTable(dataTable, values);
dataTable.addColumns(values.inRange(0, dataTable.rowCount()));
} else {
dataTable.addColumns(values);
}
data1.put("analysisVariableId", analysisVariable.getSequenceNbr()); data1.put("analysisVariableId", analysisVariable.getSequenceNbr());
// 获取相同长度的数据 // 获取相同长度的数据
dataTable = dataTable.inRange(0, minRow); // dataTable = dataTable.inRange(0, minRow);
List<String> list = dataTable.columnNames(); List<String> list = dataTable.columnNames();
for (String column : list) { for (String column : list) {
data1.put(column, dataTable.doubleColumn(column).asDoubleArray()); data1.put(column, dataTable.doubleColumn(column).asDoubleArray());
...@@ -831,7 +831,7 @@ public class KafkaConsumerService { ...@@ -831,7 +831,7 @@ public class KafkaConsumerService {
idxBizPvPointVarCentralValueMapper.delete(new QueryWrapper<IdxBizPvPointVarCentralValue>().eq("ANALYSIS_POINT_ID", analysisVariable.getSequenceNbr())); idxBizPvPointVarCentralValueMapper.delete(new QueryWrapper<IdxBizPvPointVarCentralValue>().eq("ANALYSIS_POINT_ID", analysisVariable.getSequenceNbr()));
JSONObject jsonObject = JSON.parseObject(response); JSONObject jsonObject = JSON.parseObject(response);
int length = jsonObject.getJSONArray("stdDev").size(); int length = jsonObject.getJSONArray("stdDev").size() > 64 ? 64 : jsonObject.getJSONArray("stdDev").size();
List<IdxBizPvPointVarCentralValue> insertList = new ArrayList<>(); List<IdxBizPvPointVarCentralValue> insertList = new ArrayList<>();
for (int i = 0; i < length; i++) { for (int i = 0; i < length; i++) {
IdxBizPvPointVarCentralValue idxBizPvPointVarCentralValue = new IdxBizPvPointVarCentralValue(); IdxBizPvPointVarCentralValue idxBizPvPointVarCentralValue = new IdxBizPvPointVarCentralValue();
......
...@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray; ...@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.ESDto.ESEquipments;
import com.yeejoin.amos.boot.module.jxiop.biz.Enum.SmartAnalyseEnum; import com.yeejoin.amos.boot.module.jxiop.biz.Enum.SmartAnalyseEnum;
import com.yeejoin.amos.boot.module.jxiop.biz.Thread.MyServiceThread; import com.yeejoin.amos.boot.module.jxiop.biz.Thread.MyServiceThread;
...@@ -18,6 +19,7 @@ import com.yeejoin.amos.component.influxdb.InfluxdbUtil; ...@@ -18,6 +19,7 @@ import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.joda.time.DateTimeUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -32,6 +34,7 @@ import org.springframework.data.elasticsearch.core.query.Query; ...@@ -32,6 +34,7 @@ import org.springframework.data.elasticsearch.core.query.Query;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.DateTimeUtil;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -1454,7 +1457,7 @@ public class CommonServiceImpl { ...@@ -1454,7 +1457,7 @@ public class CommonServiceImpl {
} }
@Scheduled(cron = "0 0/5 * * * ?") @Scheduled(cron = "0/5 * * * * ?")
public void healthWarningMinuteByFan() { public void healthWarningMinuteByFan() {
Date time = new Date(); Date time = new Date();
List<IdxBizFanPointProcessVariableClassificationDto> data = idxBizFanPointProcessVariableClassificationMapper.getInfluxDBData(); List<IdxBizFanPointProcessVariableClassificationDto> data = idxBizFanPointProcessVariableClassificationMapper.getInfluxDBData();
...@@ -1552,22 +1555,24 @@ public class CommonServiceImpl { ...@@ -1552,22 +1555,24 @@ public class CommonServiceImpl {
for (int i = 0; i < analysisVariableIdArray.size(); i++) { for (int i = 0; i < analysisVariableIdArray.size(); i++) {
IdxBizFanHealthIndex idxBizFanHealthIndex = new IdxBizFanHealthIndex(); IdxBizFanHealthIndex idxBizFanHealthIndex = new IdxBizFanHealthIndex();
BeanUtils.copyProperties(obj, 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.setAnalysisObjSeq(obj.getSequenceNbr());
idxBizFanHealthIndex.setRecDate(time); idxBizFanHealthIndex.setRecDate(time);
idxBizFanHealthIndex.setSequenceNbr(null); idxBizFanHealthIndex.setSequenceNbr(null);
idxBizFanHealthIndex.setRecDate(new Date()); idxBizFanHealthIndex.setRecDate(new Date());
idxBizFanHealthIndex.setWeigth(1.0);
//获取健康指数对应等级 //获取健康指数对应等级
LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizFanHealthLevel> query = new LambdaQueryWrapper<>();
query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "设备"); query.eq(IdxBizFanHealthLevel::getAnalysisObjType, "测点");
query.eq(IdxBizFanHealthLevel::getStatus, obj.getStation()); query.eq(IdxBizFanHealthLevel::getStatus, obj.getStation());
query.le(IdxBizFanHealthLevel::getGroupLowerLimit, indexValueArray.getDoubleValue(i)); query.le(IdxBizFanHealthLevel::getGroupLowerLimit, indexValueArray.getDoubleValue(i)< 0 ? 0 : indexValueArray.getDoubleValue(i));
query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, indexValueArray.getDoubleValue(i)); query.ge(IdxBizFanHealthLevel::getGroupUpperLimit, indexValueArray.getDoubleValue(i)< 0 ? 0 : indexValueArray.getDoubleValue(i));
IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query); IdxBizFanHealthLevel idxBizFanHealthLevel = idxBizFanHealthLevelMapper.selectOne(query);
idxBizFanHealthIndex.setHealthLevel(idxBizFanHealthLevel.getHealthLevel()); idxBizFanHealthIndex.setHealthLevel(idxBizFanHealthLevel.getHealthLevel());
idxBizFanHealthIndex.setAnalysisType("按时刻"); idxBizFanHealthIndex.setAnalysisType("按时刻");
idxBizFanHealthIndex.setAnalysisObjType("测点"); idxBizFanHealthIndex.setAnalysisObjType("测点");
idxBizFanHealthIndex.setANOMALY(scoreValueArray.getDoubleValue(i)); idxBizFanHealthIndex.setANOMALY(scoreValueArray.getDoubleValue(i));
idxBizFanHealthIndex.setANALYSISTIME(DateUtils.getDateNowString());
idxBizFanHealthIndexs.add(idxBizFanHealthIndex); idxBizFanHealthIndexs.add(idxBizFanHealthIndex);
} }
} }
...@@ -1674,20 +1679,22 @@ public class CommonServiceImpl { ...@@ -1674,20 +1679,22 @@ public class CommonServiceImpl {
for (int i = 0; i < analysisVariableIdArray.size(); i++) { for (int i = 0; i < analysisVariableIdArray.size(); i++) {
IdxBizPvHealthIndex idxBizPvHealthIndex = new IdxBizPvHealthIndex(); IdxBizPvHealthIndex idxBizPvHealthIndex = new IdxBizPvHealthIndex();
BeanUtils.copyProperties(obj, 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.setAnalysisObjSeq(obj.getSequenceNbr());
idxBizPvHealthIndex.setRecDate(time); idxBizPvHealthIndex.setRecDate(time);
idxBizPvHealthIndex.setWeigth(1.0);
//获取健康指数对应等级 //获取健康指数对应等级
LambdaQueryWrapper<IdxBizPvHealthLevel> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IdxBizPvHealthLevel> query = new LambdaQueryWrapper<>();
query.eq(IdxBizPvHealthLevel::getAnalysisObjType, "设备"); query.eq(IdxBizPvHealthLevel::getAnalysisObjType, "测点");
query.eq(IdxBizPvHealthLevel::getStatus, obj.getStation()); query.eq(IdxBizPvHealthLevel::getStatus, obj.getStation());
query.le(IdxBizPvHealthLevel::getGroupLowerLimit, indexValueArray.getDoubleValue(i)); query.le(IdxBizPvHealthLevel::getGroupLowerLimit, indexValueArray.getDoubleValue(i) < 0 ? 0 : indexValueArray.getDoubleValue(i));
query.ge(IdxBizPvHealthLevel::getGroupUpperLimit, indexValueArray.getDoubleValue(i)); query.ge(IdxBizPvHealthLevel::getGroupUpperLimit, indexValueArray.getDoubleValue(i) < 0 ? 0 : indexValueArray.getDoubleValue(i) );
IdxBizPvHealthLevel idxBizFanHealthLevel = idxBizPvHealthLevelMapper.selectOne(query); IdxBizPvHealthLevel idxBizFanHealthLevel = idxBizPvHealthLevelMapper.selectOne(query);
idxBizPvHealthIndex.setHealthLevel(idxBizFanHealthLevel.getHealthLevel()); idxBizPvHealthIndex.setHealthLevel(idxBizFanHealthLevel.getHealthLevel());
idxBizPvHealthIndex.setAnalysisType("按时刻"); idxBizPvHealthIndex.setAnalysisType("按时刻");
idxBizPvHealthIndex.setAnalysisObjType("测点"); idxBizPvHealthIndex.setAnalysisObjType("测点");
idxBizPvHealthIndex.setANOMALY(scoreValueArray.getDoubleValue(i)); idxBizPvHealthIndex.setANOMALY(scoreValueArray.getDoubleValue(i));
idxBizPvHealthIndex.setANALYSISTIME(DateUtils.getDateNowString());
idxBizPvHealthIndexs.add(idxBizPvHealthIndex); idxBizPvHealthIndexs.add(idxBizPvHealthIndex);
} }
} }
......
...@@ -11,18 +11,22 @@ ...@@ -11,18 +11,22 @@
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex
FROM FROM
idx_biz_fan_health_index idx_biz_fan_health_index
<where>ANALYSIS_TYPE = '按天' <where>
AND ANALYSIS_TYPE = '按天'
DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%') AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND STATION = #{stationCode} AND STATION = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</if> </if>
<if test="stationCode == null or stationCode == ''">
AND ( STATION IS NULL OR STATION = '' ) <if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
</where> </where>
UNION ALL UNION ALL
( (
...@@ -35,12 +39,14 @@ ...@@ -35,12 +39,14 @@
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%') AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND STATION = #{stationCode} AND STATION = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</if> </if>
<if test="stationCode == null or stationCode == ''"> <if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND ( STATION IS NULL OR STATION = '' ) AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
</where> </where>
) )
...@@ -72,12 +78,14 @@ ...@@ -72,12 +78,14 @@
ANALYSIS_TYPE = '按天' ANALYSIS_TYPE = '按天'
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%') AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND STATION = #{stationCode} AND STATION = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</if> </if>
<if test="stationCode == null or stationCode == ''"> <if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND ( STATION IS NULL OR STATION = '' ) AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
</where> </where>
UNION ALL UNION ALL
...@@ -91,12 +99,14 @@ ...@@ -91,12 +99,14 @@
ANALYSIS_TYPE = '按天' ANALYSIS_TYPE = '按天'
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%') AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
<if test="stationCode != null and stationCode != ''"> <if test="stationCode != null and stationCode != ''">
AND STATION = #{stationCode} AND STATION = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</if> </if>
<if test="stationCode == null or stationCode == ''"> <if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND ( STATION IS NULL OR STATION = '' ) AND ANALYSIS_OBJ_TYPE = '片区'
</if> </if>
</where> </where>
) )
...@@ -128,7 +138,7 @@ ...@@ -128,7 +138,7 @@
FROM FROM
idx_biz_fan_health_index idx_biz_fan_health_index
WHERE WHERE
( STATION IS NULL OR STATION = '' ) ANALYSIS_OBJ_TYPE = '片区'
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
GROUP BY GROUP BY
...@@ -140,7 +150,7 @@ ...@@ -140,7 +150,7 @@
FROM FROM
idx_biz_pv_health_index idx_biz_pv_health_index
WHERE WHERE
( STATION IS NULL OR STATION = '' ) ANALYSIS_OBJ_TYPE = '片区'
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
GROUP BY GROUP BY
...@@ -185,8 +195,7 @@ ...@@ -185,8 +195,7 @@
FROM FROM
idx_biz_fan_health_index idx_biz_fan_health_index
<where> <where>
STATION IS NOT NULL ANALYSIS_OBJ_TYPE = '场站'
AND STATION != ''
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
...@@ -202,8 +211,7 @@ ...@@ -202,8 +211,7 @@
FROM FROM
idx_biz_pv_health_index idx_biz_pv_health_index
<where> <where>
STATION IS NOT NULL ANALYSIS_OBJ_TYPE = '场站'
AND STATION != ''
AND ANALYSIS_TYPE = '按天' AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="areaCode != null and areaCode != ''"> <if test="areaCode != null and areaCode != ''">
......
...@@ -20,9 +20,6 @@ ...@@ -20,9 +20,6 @@
idx_biz_fan_point_var_central_value ibfpvcv idx_biz_fan_point_var_central_value ibfpvcv
WHERE WHERE
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT1_ID 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 GROUP BY
b.SEQUENCE_NBR UNION ALL b.SEQUENCE_NBR UNION ALL
SELECT SELECT
...@@ -42,10 +39,7 @@ ...@@ -42,10 +39,7 @@
) AS b, ) AS b,
idx_biz_fan_point_var_central_value ibfpvcv idx_biz_fan_point_var_central_value ibfpvcv
WHERE WHERE
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT1_ID b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT2_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 GROUP BY
b.SEQUENCE_NBR UNION ALL b.SEQUENCE_NBR UNION ALL
SELECT SELECT
...@@ -65,10 +59,7 @@ ...@@ -65,10 +59,7 @@
) AS b, ) AS b,
idx_biz_fan_point_var_central_value ibfpvcv idx_biz_fan_point_var_central_value ibfpvcv
WHERE WHERE
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT1_ID b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT3_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 GROUP BY
b.SEQUENCE_NBR UNION ALL b.SEQUENCE_NBR UNION ALL
SELECT SELECT
...@@ -88,10 +79,7 @@ ...@@ -88,10 +79,7 @@
) AS b, ) AS b,
idx_biz_fan_point_var_central_value ibfpvcv idx_biz_fan_point_var_central_value ibfpvcv
WHERE WHERE
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT1_ID b.SEQUENCE_NBR = ibfpvcv.ANALYSIS_POINT_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 GROUP BY
b.SEQUENCE_NBR b.SEQUENCE_NBR
</select> </select>
......
...@@ -24,9 +24,6 @@ ...@@ -24,9 +24,6 @@
idx_biz_pv_point_var_central_value ibfpvcv idx_biz_pv_point_var_central_value ibfpvcv
WHERE WHERE
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT1_ID 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 GROUP BY
b.SEQUENCE_NBR UNION ALL b.SEQUENCE_NBR UNION ALL
SELECT SELECT
...@@ -46,10 +43,7 @@ ...@@ -46,10 +43,7 @@
) AS b, ) AS b,
idx_biz_pv_point_var_central_value ibfpvcv idx_biz_pv_point_var_central_value ibfpvcv
WHERE WHERE
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT1_ID b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT2_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 GROUP BY
b.SEQUENCE_NBR UNION ALL b.SEQUENCE_NBR UNION ALL
SELECT SELECT
...@@ -69,10 +63,8 @@ ...@@ -69,10 +63,8 @@
) AS b, ) AS b,
idx_biz_pv_point_var_central_value ibfpvcv idx_biz_pv_point_var_central_value ibfpvcv
WHERE WHERE
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT1_ID b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT3_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 GROUP BY
b.SEQUENCE_NBR UNION ALL b.SEQUENCE_NBR UNION ALL
SELECT SELECT
...@@ -92,10 +84,7 @@ ...@@ -92,10 +84,7 @@
) AS b, ) AS b,
idx_biz_pv_point_var_central_value ibfpvcv idx_biz_pv_point_var_central_value ibfpvcv
WHERE WHERE
b.SEQUENCE_NBR = ibfpvcv.PROCESS_POINT1_ID b.SEQUENCE_NBR = ibfpvcv.ANALYSIS_POINT_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 GROUP BY
b.SEQUENCE_NBR b.SEQUENCE_NBR
</select> </select>
......
...@@ -491,9 +491,9 @@ public class MonitorFanIdxController extends BaseController { ...@@ -491,9 +491,9 @@ public class MonitorFanIdxController extends BaseController {
public ResponseModel getMajorAnalogQuantityByPage(@RequestParam(required = false) String stationId) { public ResponseModel getMajorAnalogQuantityByPage(@RequestParam(required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getBoosterGatewayId(); String gatewayId = stationBasic.getBoosterGatewayId();
if ("夏造风电站".equals(stationBasic.getStationName())) { if (stationBasic.getStationName().contains("夏造")) {
monitorFanIndicator.getMajorAnalogQuantityByPage(gatewayId, stationBasic.getSequenceNbr().toString()); monitorFanIndicator.getMajorAnalogQuantityByPage(gatewayId, stationBasic.getSequenceNbr().toString());
} else if ("泰和前进光伏站".equals(stationBasic.getStationName())) { } else if (stationBasic.getStationName().contains("泰和")) {
monitorFanIndicator.getMajorAnalogQuantityByPageByTHGF(gatewayId, stationBasic.getSequenceNbr().toString()); monitorFanIndicator.getMajorAnalogQuantityByPageByTHGF(gatewayId, stationBasic.getSequenceNbr().toString());
} }
return CommonResponseUtil.success(); return CommonResponseUtil.success();
......
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