Commit c52dc06b authored by tangwei's avatar tangwei

解决冲突

parents 34b7fa08 b01b710b
......@@ -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>
......
......@@ -258,14 +258,17 @@ public class BigScreenAnalyseController extends BaseController {
public ResponseModel<Map<String, Object>> getHealthInfoByArea(@RequestParam(required = false) String areaCode) {
Map<String, Object> resultMap = new HashMap<>();
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())));
List<StationBasic> stationBasics = stationBasicMapper.selectList(new LambdaQueryWrapper<StationBasic>().like(StationBasic::getAreaName, areaCode));
List<String> list = stationBasics.stream().map(StationBasic::getStationName).collect(Collectors.toList());
// 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.forEach(item -> seriesData.add(collect.getOrDefault(item, new BigDecimal("100"))));
List<String> list = 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("seriesData", seriesData);
return ResponseHelper.buildResponse(resultMap);
......
......@@ -88,6 +88,8 @@ public class KafkaAnalyseController {
@ApiOperation(httpMethod = "POST", value = "中心值 - 风电 - 新", notes = "中心值 - 风电 - 新")
public ResponseModel<Object> getFanConditionVariablesZXZ() {
if (redisUtils.hasKey(kafkaTopicConsumerZXZFan)) {
// redisUtils.del(kafkaTopicConsumerZXZFan);
// redisUtils.getExpire(kafkaTopicConsumerZXZFan);
return ResponseHelper.buildResponse("计算中");
}
fanConditionVariablesMessage.getFanConditionVariablesZXZ();
......@@ -100,6 +102,7 @@ public class KafkaAnalyseController {
@ApiOperation(httpMethod = "POST", value = "中心值 - 光伏 - 新", notes = "工况划分 - 光伏 - 新")
public ResponseModel<Object> getPvConditionVariablesZXZ() {
if (redisUtils.hasKey(kafkaTopicConsumerZXZPv)) {
// redisUtils.del(kafkaTopicConsumerZXZPv);
return ResponseHelper.buildResponse("计算中");
}
fanConditionVariablesMessage.getPvConditionVariablesZXZ();
......
......@@ -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;
}
......@@ -85,6 +85,6 @@ public class FanConditionVariablesMessage {
@Async
public void getPvConditionVariablesZXZ() {
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 {
minRow = minRow > values.size() ? values.size() : minRow;
}
values.setName("processVariable" + index);
if (!dataTable.isEmpty() && dataTable.rowCount() < values.size()) {
dataTable.addColumns(values.inRange(0, dataTable.rowCount()));
} else {
dataTable.addColumns(values);
}
dataTable = getDataTable(dataTable, values);
data1.put("processVariable" + index + "Id", processVariable.getSequenceNbr());
......@@ -171,6 +167,7 @@ public class KafkaConsumerService {
IntervalValues.add(processVariable.getIntervalValue2());
IntervalValues.add(processVariable.getIntervalValue3());
IntervalValues.add(processVariable.getIntervalValue4());
IntervalValues.add(processVariable.getIntervalValue5());
data2.put("processVariable" + index, IntervalValues);
index++;
......@@ -178,15 +175,11 @@ public class KafkaConsumerService {
Selection selection = table.stringColumn("id").isEqualTo(analysisVariable.getIndexAddress() + "_" + analysisVariable.getGatewayId());
DoubleColumn values = table.where(selection).doubleColumn("value");
values.setName("analysisVariable");
if (!dataTable.isEmpty() && dataTable.rowCount() < values.size()) {
dataTable.addColumns(values.inRange(0, dataTable.rowCount()));
} else {
dataTable.addColumns(values);
}
dataTable = getDataTable(dataTable, values);
data1.put("analysisVariableId", analysisVariable.getSequenceNbr());
// 获取相同长度的数据
dataTable = dataTable.inRange(0, minRow);
// dataTable = dataTable.inRange(0, minRow);
List<String> list = dataTable.columnNames();
for (String column : list) {
data1.put(column, dataTable.doubleColumn(column).asDoubleArray());
......@@ -201,7 +194,7 @@ public class KafkaConsumerService {
idxBizFanPointVarCentralValueMapper.delete(new QueryWrapper<IdxBizFanPointVarCentralValue>().eq("ANALYSIS_POINT_ID", analysisVariableId));
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<>();
for (int i = 0; i < length; i++) {
IdxBizFanPointVarCentralValue idxBizFanPointVarCentralValue = new IdxBizFanPointVarCentralValue();
......@@ -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) {
consumerRecords.parallelStream().forEach(record -> {
Optional<?> kafkaMessage = Optional.ofNullable(record.value());
......@@ -709,7 +715,7 @@ public class KafkaConsumerService {
if (kafkaMessage.isPresent()) {
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<IdxBizPvPointProcessVariableClassification> idxBizPvPointProcessVariableClassificationList = idxBizPvPointProcessVariableClassificationService.list(new QueryWrapper<IdxBizPvPointProcessVariableClassification>().in("SEQUENCE_NBR", processPointIds));
......@@ -730,7 +736,7 @@ public class KafkaConsumerService {
}
});
buildZXZPvExecData(consumerRecords, gatewayPoints, zxzIds, "ZXZFanConsumer");
buildZXZPvExecData(consumerRecords, gatewayPoints, zxzIds, "ZXZPvConsumer");
} catch (Exception e) {
e.printStackTrace();
}
......@@ -788,11 +794,7 @@ public class KafkaConsumerService {
minRow = minRow > values.size() ? values.size() : minRow;
}
values.setName("processVariable" + index);
if (!dataTable.isEmpty() && dataTable.rowCount() < values.size()) {
dataTable.addColumns(values.inRange(0, dataTable.rowCount()));
} else {
dataTable.addColumns(values);
}
dataTable = getDataTable(dataTable, values);
data1.put("processVariable" + index + "Id", processVariable.getSequenceNbr());
// 构建工况区间数组
......@@ -801,6 +803,7 @@ public class KafkaConsumerService {
IntervalValues.add(processVariable.getIntervalValue2());
IntervalValues.add(processVariable.getIntervalValue3());
IntervalValues.add(processVariable.getIntervalValue4());
IntervalValues.add(processVariable.getIntervalValue5());
data2.put("processVariable" + index, IntervalValues);
index++;
......@@ -808,15 +811,12 @@ public class KafkaConsumerService {
Selection selection = table.stringColumn("id").isEqualTo(analysisVariable.getIndexAddress() + "_" + analysisVariable.getGatewayId());
DoubleColumn values = table.where(selection).doubleColumn("value");
values.setName("analysisVariable");
if (!dataTable.isEmpty() && dataTable.rowCount() < values.size()) {
dataTable.addColumns(values.inRange(0, dataTable.rowCount()));
} else {
dataTable.addColumns(values);
}
dataTable = getDataTable(dataTable, values);
data1.put("analysisVariableId", analysisVariable.getSequenceNbr());
// 获取相同长度的数据
dataTable = dataTable.inRange(0, minRow);
// dataTable = dataTable.inRange(0, minRow);
List<String> list = dataTable.columnNames();
for (String column : list) {
data1.put(column, dataTable.doubleColumn(column).asDoubleArray());
......@@ -831,7 +831,7 @@ public class KafkaConsumerService {
idxBizPvPointVarCentralValueMapper.delete(new QueryWrapper<IdxBizPvPointVarCentralValue>().eq("ANALYSIS_POINT_ID", analysisVariable.getSequenceNbr()));
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<>();
for (int i = 0; i < length; i++) {
IdxBizPvPointVarCentralValue idxBizPvPointVarCentralValue = new IdxBizPvPointVarCentralValue();
......
......@@ -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;
......@@ -1454,7 +1457,7 @@ public class CommonServiceImpl {
}
@Scheduled(cron = "0 0/5 * * * ?")
@Scheduled(cron = "0/5 * * * * ?")
public void healthWarningMinuteByFan() {
Date time = new Date();
List<IdxBizFanPointProcessVariableClassificationDto> data = idxBizFanPointProcessVariableClassificationMapper.getInfluxDBData();
......@@ -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);
}
}
......
......@@ -11,18 +11,22 @@
IFNULL( AVG( HEALTH_INDEX ), 100 ) AS avgHealthIndex
FROM
idx_biz_fan_health_index
<where>ANALYSIS_TYPE = '按天'
AND
DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<where>
ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if test="stationCode != null and stationCode != ''">
AND STATION = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</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>
</where>
UNION ALL
(
......@@ -35,12 +39,14 @@
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if test="stationCode != null and stationCode != ''">
AND STATION = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</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>
</where>
)
......@@ -72,12 +78,14 @@
ANALYSIS_TYPE = '按天'
<if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if test="stationCode != null and stationCode != ''">
AND STATION = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</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>
</where>
UNION ALL
......@@ -91,12 +99,14 @@
ANALYSIS_TYPE = '按天'
<if test="areaCode != null and areaCode != ''">
AND ARAE like concat('%', #{areaCode}, '%')
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if test="stationCode != null and stationCode != ''">
AND STATION = #{stationCode}
AND ANALYSIS_OBJ_TYPE = '场站'
</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>
</where>
)
......@@ -128,7 +138,7 @@
FROM
idx_biz_fan_health_index
WHERE
( STATION IS NULL OR STATION = '' )
ANALYSIS_OBJ_TYPE = '片区'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
GROUP BY
......@@ -140,7 +150,7 @@
FROM
idx_biz_pv_health_index
WHERE
( STATION IS NULL OR STATION = '' )
ANALYSIS_OBJ_TYPE = '片区'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
GROUP BY
......@@ -185,8 +195,7 @@
FROM
idx_biz_fan_health_index
<where>
STATION IS NOT NULL
AND STATION != ''
ANALYSIS_OBJ_TYPE = '场站'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="areaCode != null and areaCode != ''">
......@@ -202,8 +211,7 @@
FROM
idx_biz_pv_health_index
<where>
STATION IS NOT NULL
AND STATION != ''
ANALYSIS_OBJ_TYPE = '场站'
AND ANALYSIS_TYPE = '按天'
AND DATE_FORMAT( REC_DATE, "%Y-%m-%d" ) = CURRENT_DATE
<if test="areaCode != null and areaCode != ''">
......
......@@ -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>
......
......@@ -24,9 +24,6 @@
idx_biz_pv_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
......@@ -46,10 +43,7 @@
) AS b,
idx_biz_pv_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
......@@ -69,10 +63,8 @@
) AS b,
idx_biz_pv_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
......@@ -92,10 +84,7 @@
) AS b,
idx_biz_pv_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>
......
......@@ -491,9 +491,9 @@ public class MonitorFanIdxController extends BaseController {
public ResponseModel getMajorAnalogQuantityByPage(@RequestParam(required = false) String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getBoosterGatewayId();
if ("夏造风电站".equals(stationBasic.getStationName())) {
if (stationBasic.getStationName().contains("夏造")) {
monitorFanIndicator.getMajorAnalogQuantityByPage(gatewayId, stationBasic.getSequenceNbr().toString());
} else if ("泰和前进光伏站".equals(stationBasic.getStationName())) {
} else if (stationBasic.getStationName().contains("泰和")) {
monitorFanIndicator.getMajorAnalogQuantityByPageByTHGF(gatewayId, stationBasic.getSequenceNbr().toString());
}
return CommonResponseUtil.success();
......
......@@ -219,13 +219,19 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
likeMap.put("systemType", systemType);
}
List<ESEquipments> result = commonServiceImpl.getListDataByCondtionsAndLike(queryCondtion, null, ESEquipments.class, likeMap);
List<String> needDisplayDisplayNameFrontModule = Arrays.asList("箱变");
List<String> needDisplayDisplayNameSystemType = Arrays.asList("实时运行数据");
result.stream().forEach(e -> {
e.setValue(String.format(CommonConstans.Twodecimalplaces, e.getValueF()));
});
Collator instance = Collator.getInstance(Locale.CHINA);
if (needDisplayDisplayNameSystemType.contains(systemType) && needDisplayDisplayNameFrontModule.contains(frontModule)) {
result.sort(Comparator.comparing(ESEquipments::getTraceId,Comparator.comparingInt(Integer::parseInt)));
} else {
Collections.sort(result, (e1, e2) -> {
return instance.compare(e1.getEquipmentIndexName(), e2.getEquipmentIndexName());
});
}
List<ESEquipments> collect = result.stream()
.skip((long) (current - 1) * size)
.limit(size)
......@@ -1033,7 +1039,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public List<Map<String, String>> getBoosterStationInfo(String stationId) {
StationBasic stationBasic = getOneByStationNumber(stationId);
List<Map<String, String>> boosterStationInfo = new ArrayList<>();
if ("夏造风电站".equals(stationBasic.getStationName())) {
if (stationBasic.getStationName().contains("夏造风电站")) {
boosterStationInfo = monitorFanIndicatorregionMapper.getBoosterStationInfo2(stationBasic.getBoosterGatewayId());
} else {
boosterStationInfo = monitorFanIndicatorregionMapper.getBoosterStationInfoNormal(stationBasic.getBoosterGatewayId());
......@@ -1146,37 +1152,37 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
ArrayList<Map<String, String>> resultList1 = new ArrayList<>();
List<String> nameList = new ArrayList<>();
Map<String, String> handleData = new HashMap<>();
Map<String,List<String>> originalData = new HashMap<>();
Map<String, List<String>> originalData = new HashMap<>();
if ("FDZ".equals(stationBasic.getStationType())) {
handleData = windSqlList.stream().collect(Collectors.toMap(ESEquipments::getEquipmentIndexName, esEquipments -> String.format(CommonConstans.Threedecimalplaces, esEquipments.getValueF())));
nameList = CommonConstans.xiazaoElectricityMeter;
originalData = CommonConstans.xiazaoElectricityMeterPointSort;
} else {
handleData=windSqlList.stream().collect(Collectors.toMap(ESEquipments::getEquipmentIndexName, esEquipments -> String.format(CommonConstans.Twodecimalplaces, esEquipments.getValueF()*0.01)));
handleData = windSqlList.stream().collect(Collectors.toMap(ESEquipments::getEquipmentIndexName, esEquipments -> String.format(CommonConstans.Twodecimalplaces, esEquipments.getValueF() * 0.01)));
nameList = CommonConstans.taiheElectricityMeter;
originalData= CommonConstans.taiheElectricityMeterPointSort;
originalData = CommonConstans.taiheElectricityMeterPointSort;
}
for (int i = 0; i < nameList.size(); i++) {
HashMap<String, String> stringStringHashMap = new HashMap<>();
String name = nameList.get(i);
stringStringHashMap.put("name",name);
stringStringHashMap.put("name", name);
Double electricityIndicator = 1.0;
List<String> dataList = originalData.get(name);
stringStringHashMap.put("zxzyg",handleData.get(dataList.get(0)));
stringStringHashMap.put("fxzyg",handleData.get(dataList.get(1)));
stringStringHashMap.put("zxzwg",handleData.get(dataList.get(2)));
stringStringHashMap.put("fxzwg",handleData.get(dataList.get(3)));
if(name.equals("夏雩线212主表")){
stringStringHashMap.put("zxzyg",String.format(CommonConstans.Threedecimalplaces,Double.valueOf(handleData.get(dataList.get(0)))*0.001));
stringStringHashMap.put("fxzyg",String.format(CommonConstans.Threedecimalplaces,Double.valueOf(handleData.get(dataList.get(1)))*0.001));
stringStringHashMap.put("zxzwg",String.format(CommonConstans.Threedecimalplaces,Double.valueOf(handleData.get(dataList.get(2)))*0.001));
stringStringHashMap.put("fxzwg",String.format(CommonConstans.Threedecimalplaces,Double.valueOf(handleData.get(dataList.get(3)))*0.001));
}
if(name.equals("夏雩线212副表")){
stringStringHashMap.put("zxzyg",String.format(CommonConstans.Threedecimalplaces,Double.valueOf(handleData.get(dataList.get(0)))*0.01));
stringStringHashMap.put("fxzyg",String.format(CommonConstans.Threedecimalplaces,Double.valueOf(handleData.get(dataList.get(1)))*0.01));
stringStringHashMap.put("zxzwg",String.format(CommonConstans.Threedecimalplaces,Double.valueOf(handleData.get(dataList.get(2)))*0.01));
stringStringHashMap.put("fxzwg",String.format(CommonConstans.Threedecimalplaces,Double.valueOf(handleData.get(dataList.get(3)))*0.01));
stringStringHashMap.put("zxzyg", handleData.get(dataList.get(0)));
stringStringHashMap.put("fxzyg", handleData.get(dataList.get(1)));
stringStringHashMap.put("zxzwg", handleData.get(dataList.get(2)));
stringStringHashMap.put("fxzwg", handleData.get(dataList.get(3)));
if (name.equals("夏雩线212主表")) {
stringStringHashMap.put("zxzyg", String.format(CommonConstans.Threedecimalplaces, Double.valueOf(handleData.get(dataList.get(0))) * 0.001));
stringStringHashMap.put("fxzyg", String.format(CommonConstans.Threedecimalplaces, Double.valueOf(handleData.get(dataList.get(1))) * 0.001));
stringStringHashMap.put("zxzwg", String.format(CommonConstans.Threedecimalplaces, Double.valueOf(handleData.get(dataList.get(2))) * 0.001));
stringStringHashMap.put("fxzwg", String.format(CommonConstans.Threedecimalplaces, Double.valueOf(handleData.get(dataList.get(3))) * 0.001));
}
if (name.equals("夏雩线212副表")) {
stringStringHashMap.put("zxzyg", String.format(CommonConstans.Threedecimalplaces, Double.valueOf(handleData.get(dataList.get(0))) * 0.01));
stringStringHashMap.put("fxzyg", String.format(CommonConstans.Threedecimalplaces, Double.valueOf(handleData.get(dataList.get(1))) * 0.01));
stringStringHashMap.put("zxzwg", String.format(CommonConstans.Threedecimalplaces, Double.valueOf(handleData.get(dataList.get(2))) * 0.01));
stringStringHashMap.put("fxzwg", String.format(CommonConstans.Threedecimalplaces, Double.valueOf(handleData.get(dataList.get(3))) * 0.01));
}
resultList.add(stringStringHashMap);
}
......@@ -1387,12 +1393,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
queryCondition.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
queryCondition.put(CommonConstans.QueryStringSystemTypeKeyword, Arrays.asList("模拟量"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondition, null, ESEquipments.class);
List<String> displayName = Arrays.asList("Ua","Ub","Uc");
List<String> displayName = Arrays.asList("Ua", "Ub", "Uc");
// 10kVⅡ段母线数据
List<ESEquipments> xianData = esEquipmentsList.stream().filter(esEquipments -> esEquipments.getFrontModule().contains("35kVⅠ母PT")&&!displayName.contains(esEquipments.getDisplayName())).collect(Collectors.toList());
List<ESEquipments> xianData = esEquipmentsList.stream().filter(esEquipments -> esEquipments.getFrontModule().contains("35kVⅠ母PT") && !displayName.contains(esEquipments.getDisplayName())).collect(Collectors.toList());
HashMap<String, Object> resultMap = new HashMap<>();
xianData.forEach(item -> resultMap.put(item.getDisplayName(), keepTwoDecimalPlaces(item.getValueF().toString())));
List<ESEquipments> xianData1 = esEquipmentsList.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().contains("南瑞光差保护_313")&&displayName.contains(esEquipments.getDisplayName())).collect(Collectors.toList());
List<ESEquipments> xianData1 = esEquipmentsList.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().contains("南瑞光差保护_313") && displayName.contains(esEquipments.getDisplayName())).collect(Collectors.toList());
xianData1.forEach(item -> resultMap.put(item.getDisplayName(), keepTwoDecimalPlaces(item.getValueF().toString())));
List<String> xyxDisplayNameList = Arrays.asList("Ia", "P", "Q");
List<ESEquipments> xyxSqlData = esEquipmentsList.stream().filter(esEquipments -> esEquipments.getFrontModule().equals("35kV前万线") && xyxDisplayNameList.contains(esEquipments.getDisplayName())).collect(Collectors.toList());
......@@ -1964,7 +1970,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
});
}
statusMaps.sort(Comparator.comparingInt(o->Integer.parseInt(o.get("titie").toString())));
statusMaps.sort(Comparator.comparingInt(o -> Integer.parseInt(o.get("titie").toString())));
IPage<Map<String, String>> result = new Page<>();
result.setRecords(statusMaps);
result.setCurrent(1);
......
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