Commit 991d4dad authored by chenzhao's avatar chenzhao

监盘 大屏问题修复

parent a942806d
......@@ -32,6 +32,9 @@ public class CommonConstans {
public static final Double tToWT = 0.0001;
//万Kwh转MV
public static final Integer wkwhToMv = 10;
//kw转MV
public static final Double kwToMv =0.0001 ;
// 正常运行 发电状态=1
// 告警运行 报警状态=1
// 正常停机 停机状态=1
......
......@@ -10,6 +10,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.mapper.MapRegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.RegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments;
import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.QueryDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.SocialContributionDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto;
......@@ -44,10 +45,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
@Service
......@@ -83,11 +81,19 @@ public class CommonServiceImpl {
* @return 指标值总和
*/
public Double getTotalByIndicatior(String gatewayId,String indicator){
String sql = "SELECT * FROM indicators_"+gatewayId+" where equipmentIndexName='"+indicator+"'";
Double totalvalue = 0.0;
List<Map<String,Object>> mapList = influxdbUtil.query(sql);
totalvalue =mapList.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l->Double.parseDouble((String) l.get("value"))).sum();
return Double.valueOf(String.format("%.2f",totalvalue));
//用于组装-es查询条件
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(indicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
List<ESEquipments> result = getListDataByCondtions(queryCondtion, null, ESEquipments.class);
Double totalvalue = 0.00;
try {
totalvalue = result.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.getValueF())).mapToDouble(l -> Double.parseDouble(l.getValueF().toString())).sum();
} catch (Exception e) {
return totalvalue;
}
return Double.valueOf(String.format("%.2f", totalvalue));
}
public Double getNumByIndicatior(String gatewayId,String indicator){
......@@ -105,14 +111,15 @@ public class CommonServiceImpl {
* @return 指标值总和
*/
public Double getAvgvalueByIndicatior(String gatewayId,String indicator){
String sql = "SELECT * FROM indicators_"+gatewayId+" where equipmentIndexName='"+indicator+"'";
Double avageValue = 0.0;
List<Map<String,Object>> mapList = influxdbUtil.query(sql);
if (mapList.size() < 1){
String sql = "SELECT * FROM indicators_" + gatewayId + " where equipmentIndexName='" + indicator + "'";
Double avageValue = 0.00;
try {
List<Map<String, Object>> mapList = influxdbUtil.query(sql);
avageValue = mapList.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).average().getAsDouble();
} catch (Exception e) {
return avageValue;
}
avageValue =mapList.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l->Double.parseDouble((String) l.get("value"))).average().getAsDouble();
return Double.valueOf(String.format("%.2f",avageValue));
return Double.valueOf(String.format("%.2f", avageValue));
}
public Double getTotalByIndicatior(List<Map<String,Object>> mapList,String indicator){
Double totalvalue = 0.0;
......@@ -172,8 +179,6 @@ public class CommonServiceImpl {
public List<StationCacheInfoDto> getListStationCacheInfoDto() {
List<StationCacheInfoDto> stationCacheInfoDtos = new ArrayList<>();
stationCacheInfoDtos = redisTemplate.opsForList().range("station_info_cache_bigscreen", 0, -1);
if (ObjectUtils.isEmpty(stationCacheInfoDtos)) {
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1));
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
......@@ -186,22 +191,12 @@ public class CommonServiceImpl {
stationCacheInfoDto.setBelongProvince(regionList.stream().filter(region -> region.getRegionCode().toString().equals(stationBasic.getBelongArea().replace("[", "").split(",")[0])).map(region -> region.getRegionName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBelongArea(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setInstalledCapacity(String.format("%.2f", sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber())));
try {
List<QueryDto> queryDtoList = new ArrayList<>();
queryDtoList.add(new QueryDto("gatewayId", stationBasic.getFanGatewayId()));
queryDtoList.add(new QueryDto("equipmentIndexName.keyword", "有功功率"));
if (!stationBasic.getStationType().equals("FDZ")) {
queryDtoList.add(new QueryDto("frontModule", "逆变器"));
}
stationCacheInfoDto.setEquipmentNumbers(getCount(queryDtoList, "equipmentNumber.Keyword", ESEquipments.class).toString());
} catch (Exception exception) {
}
stationCacheInfoDto.setFanGatewayId(stationBasic.getFanGatewayId());
stationCacheInfoDto.setAreaCode(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getAreaCode()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBoosterGatewayId(stationBasic.getBoosterGatewayId());
stationCacheInfoDtos.add(stationCacheInfoDto);
}
redisTemplate.opsForList().leftPushAll("station_info_cache_bigscreen", stationCacheInfoDtos);
}
return stationCacheInfoDtos;
}
......@@ -330,6 +325,55 @@ public class CommonServiceImpl {
return null;
}
public <T> List<T> getListDataByCondtions(Map<String, List<String>> mustQuerCondtion, Map<String, String> shouldQuerCondtion, Class<T> tClass, Map<String, String> likeQuerCondtion) {
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
if (!ObjectUtils.isEmpty(mustQuerCondtion)) {
for (String key : mustQuerCondtion.keySet()) {
List<String> va = mustQuerCondtion.get(key);
queryBuilder.must(QueryBuilders.termsQuery(key, va));
}
}
if (!ObjectUtils.isEmpty(shouldQuerCondtion)) {
for (String key : shouldQuerCondtion.keySet()) {
queryBuilder.should(QueryBuilders.wildcardQuery(key, shouldQuerCondtion.get(key)));
}
}
if (!ObjectUtils.isEmpty(likeQuerCondtion)) {
for (String key : likeQuerCondtion.keySet()) {
queryBuilder.must(QueryBuilders.wildcardQuery(key, "*" + likeQuerCondtion.get(key) + "*"));
}
}
Query query = new NativeSearchQueryBuilder()
.withQuery(queryBuilder)
.build();
query.setTrackTotalHits(true);
SearchHits search = elasticsearchTemplate.search(query, tClass);
if (search.hasSearchHits()) {
List<SearchHit<T>> searchHitList = search.getSearchHits();
List<T> list = searchHitList.stream().map(hit -> hit.getContent()).collect(Collectors.toList());
return list;
}
return null;
}
public Double getTotalByIndicatiorByGF(String gatewayId, String indicator) {
//用于组装-es查询条件
Map<String, List<String>> queryCondtion = new HashMap<>();
Map<String, String> likeQuerCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(indicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
likeQuerCondtion.put(CommonConstans.QueryStringFrontMoudle, "逆变器");
List<ESEquipments> result = getListDataByCondtions(queryCondtion, null, ESEquipments.class, likeQuerCondtion);
Double totalvalue = 0.00;
try {
totalvalue = result.stream().filter(stringObjectMap -> !ObjectUtils.isEmpty(stringObjectMap.getValueF())).mapToDouble(l -> Double.parseDouble(l.getValueF().toString())).sum();
} catch (Exception e) {
return totalvalue;
}
return Double.valueOf(String.format("%.4f", totalvalue * CommonConstans.pvGenPoweActor));
}
}
......@@ -602,14 +602,15 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
public Map<String,Object> getDetailsWindSpeedAll(String gatewayId, double installedCapacity){
public Map<String,Object> getDetailsWindSpeedAll(String gatewayId, double installedCapacity,List<String> ids){
Map<String, List<String>> queryCondtion = new HashMap<>();
if (StringUtils.isNotEmpty(gatewayId)) {
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
if (CollectionUtils.isNotEmpty(ids)) {
queryCondtion.put(CommonConstans.QueryStringGateWayId, ids);
}
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值", "南瑞光差保护_313P"));
List<ESEquipments> indicatorsDtoList = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
double sum = indicatorsDtoList.stream().mapToDouble(t -> Double.parseDouble(t.getValueF().toString())).sum();
double sum = null == indicatorsDtoList?0.0: indicatorsDtoList.stream().mapToDouble(t -> Double.parseDouble(t.getValueF().toString())).sum();
Double format = Double.parseDouble(String.format("%.2f", sum / installedCapacity));
List<Map<String, Object>> list = temporaryDataMapper.timingTemporarysSorageData(gatewayId);
Map<String,Object> map = new HashMap<>();
......@@ -1936,5 +1937,21 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return hashMap;
}
public String getEquipCount(String gatewayId, String stationType) {
Map<String, List<String>> queryCondtion1 = new HashMap<>();
if (stationType.equals("FDZ")) {
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("有功功率"));
} else {
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("运行"));
}
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
List<ESEquipments> equipNumList = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
if (!CollectionUtils.isEmpty(equipNumList)) {
return equipNumList.size() + "";
}
return "0";
}
}
......@@ -821,7 +821,7 @@ public class MonitoringServiceImpl {
BigDecimal totalInstall = new BigDecimal(getInstallCapity(stationBasicListAll));
stringHashMap.put("title", totalInstall.toString());
stringHashMap.put("data", "");
list.add(stringHashMap);
// list.add(stringHashMap);
//风电站
HashMap<String, String> stringHashMap1 = new HashMap<>();
BigDecimal fdzInstall = new BigDecimal(getInstallCapity(fdzList));
......
......@@ -12,7 +12,6 @@
{
"title": "风机台数",
"title1": "风机台数(台)",
"action": "*.replace(\".0\",\"\")",
"url": "upload/jxiop/amos_studio/EA3572E1BD31DC1E7D8DA162F09ECB.png"
},
{
......
......@@ -2,7 +2,6 @@
{
"title": "逆变器台数",
"title1": "逆变器台数(台)",
"action": "*.replace(\".0\",\"\")",
"url": "upload/jxiop/amos_studio/EA3572E1BD31DC1E7D8DA162F09ECB.png"
},
{
......@@ -24,7 +23,7 @@
{
"url": "upload/jxiop/amos_studio/DD1CE8BAF5A7C3AC5E6E2C0D46C3EEC.png",
"title1": "辐照强度(W/㎡)",
"title": "总辐射"
"title": "辐照强度"
},
{
"url": "upload/jxiop/amos_studio/22639FDFF29B20B681DF55F1252876B3.png",
......@@ -52,8 +51,8 @@
"url": "upload/jxiop/amos_studio/1660C5DDA22ACFADC89A60DEDB82FA39.png"
},
{
"title": "利用小时",
"title1": "利用小时",
"title": "利用小时",
"title1": "利用小时",
"action":"String.format(\"%.2f\",Double.parseDouble(columnMap.get(\"*\").toString())/ (Double.parseDouble(columnMap.get(\"-\").toString())*1000))",
"url": "upload/jxiop/amos_studio/C46B483E51ACAC137CBEB5156F6F377.png"
}
......
......@@ -401,6 +401,7 @@ public class CommonServiceImpl {
stationCacheInfoDto.setBelongArea(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setInstalledCapacity(String.format("%.2f", sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber())));
stationCacheInfoDto.setFanGatewayId(stationBasic.getFanGatewayId());
stationCacheInfoDto.setAreaCode(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getAreaCode()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBoosterGatewayId(stationBasic.getBoosterGatewayId());
stationCacheInfoDtos.add(stationCacheInfoDto);
}
......
......@@ -206,7 +206,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
});
Collator instance = Collator.getInstance(Locale.CHINA);
Collections.sort(result, (e1, e2) -> {
return instance.compare(e1.getSystemType(), e2.getSystemType());
return instance.compare(e1.getEquipmentIndexName(), e2.getEquipmentIndexName());
});
List<ESEquipments> collect = result.stream()
.skip((long) (current - 1) * size)
......@@ -801,6 +801,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
statusMap.put("title", listDatum.getValue().equals("false") ? "通" : "断");
statusMaps.add(statusMap);
}
Collator instance = Collator.getInstance(Locale.CHINA);
Collections.sort(statusMaps, (e1, e2) -> {
return instance.compare(e1.get("data"), e2.get("data"));
});
return statusMaps;
}
......
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