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
......
......@@ -53,6 +53,7 @@ import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.text.DecimalFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import static com.alibaba.fastjson.JSON.parseArray;
......@@ -218,26 +219,56 @@ public class MonitorFanIdxController extends BaseController {
public ResponseModel<IPage<Map>> getData(@RequestParam(value = "stationId")String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
String [] columnList = new String[]{"日发电量","月发电量","年发电量"};
String [] columnLists = new String[]{"有功功率","瞬时风速"};
String[] columnList = new String[]{"日发电量", "月发电量", "年发电量"};
String[] columnLists = new String[]{"瞬时风速"};
Map<String, Object> columnMap = new HashMap<>();
for (String column : columnList) {
Double result = commonServiceImpl.getTotalByIndicatior(gatewayId, column);
columnMap.put(column, String.format("%.2f",result));
columnMap.put(column, String.format("%.2f", result));
}
for (String column : columnLists) {
Double result = commonServiceImpl.getAvgvalueByIndicatior(gatewayId, column);
columnMap.put(column, String.format("%.2f",result));
columnMap.put(column, String.format("%.2f", result));
}
Map<String, List<String>> queryCondtion1 = new HashMap<>();
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
columnMap.put("有功功率", String.format("%.2f", result1.get(0).getValueF() / 1000));
String num = monitorFanIndicator.getFJCount(gatewayId);
columnMap.put("风机台数",Double.valueOf(num).intValue());
Double capacityl = commonServiceImpl.getStationCapactityByStationWerks(stationBasic.getStationNumber());
columnMap.put("装机容量",String.format("%.2f",capacityl));
columnMap.put("装机容量", String.format("%.2f", capacityl));
// StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// String gatewayId = stationBasic.getFanGatewayId();
// String [] columnList = new String[]{"日发电量","月发电量","年发电量"};
// String [] columnLists = new String[]{"有功功率","瞬时风速"};
// Map<String, Object> columnMap = new HashMap<>();
//
// for (String column : columnList) {
// Double result = commonServiceImpl.getTotalByIndicatior(gatewayId, column);
// columnMap.put(column, String.format("%.2f",result));
// }
// for (String column : columnLists) {
// Double result = commonServiceImpl.getAvgvalueByIndicatior(gatewayId, column);
// columnMap.put(column, String.format("%.2f",result));
// }
//
// String num = monitorFanIndicator.getFJCount(gatewayId);
//
//
// Double capacityl = commonServiceImpl.getStationCapactityByStationWerks(stationBasic.getStationNumber());
// columnMap.put("装机容量",String.format("%.2f",capacityl));
String json = null;
try {
......@@ -252,7 +283,7 @@ public class MonitorFanIdxController extends BaseController {
map.put("title2",map.get("title"));
if (map.containsKey("action")){
if (key.equals("日利用小时")){
String format = String.format("%.2f", ((Double.parseDouble(columnMap.get("日发电量").toString())*10)/ (Double.parseDouble(columnMap.get("装机容量").toString()))));
String format = String.format("%.2f", ((Double.parseDouble(columnMap.get("日发电量").toString()) * 10) / (Double.parseDouble(columnMap.get("装机容量").toString()))));
map.put("title", format);
map.put("title2",map.get("title"));
}else {
......@@ -279,10 +310,13 @@ public class MonitorFanIdxController extends BaseController {
public ResponseModel<Map<String, Object>> getOverviewWindSpeed(@RequestParam(value = "stationId", required = false)String stationId,@RequestParam(value = "type", required = false)String type
,@RequestParam(value = "areaCode", required = false)String areaCode) {
String gatewayId = "";
String paramId = "";
List<String> ids = new ArrayList<>();
List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
double installedCapacity = listStationCacheInfoDto.stream().mapToDouble(t -> Double.parseDouble(t.getInstalledCapacity())).sum();
if (null != areaCode){
List<String> collect = listStationCacheInfoDto.stream().filter(e -> e.getAreaCode().equals(areaCode)).map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList());
ids = listStationCacheInfoDto.stream().filter(e -> e.getAreaCode().equals(areaCode)).map(StationCacheInfoDto::getBoosterGatewayId).collect(Collectors.toList());
installedCapacity = listStationCacheInfoDto.stream().filter(e -> e.getAreaCode().equals(areaCode)).mapToDouble(t -> Double.parseDouble(t.getInstalledCapacity())).sum();
gatewayId = String.join(",", collect);
}
......@@ -294,7 +328,7 @@ public class MonitorFanIdxController extends BaseController {
}
installedCapacity = listStationCacheInfoDto.stream().filter(e -> e.getStationId().equals(stationId)).mapToDouble(t -> Double.parseDouble(t.getInstalledCapacity())).sum();
}
Map<String, Object> detailsWindSpeed = monitorFanIndicator.getDetailsWindSpeedAll(gatewayId, installedCapacity);
Map<String, Object> detailsWindSpeed = monitorFanIndicator.getDetailsWindSpeedAll(gatewayId, installedCapacity,ids);
return ResponseHelper.buildResponse(detailsWindSpeed);
}
......@@ -610,31 +644,32 @@ public class MonitorFanIdxController extends BaseController {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
String boosterGatewayId = stationBasic.getBoosterGatewayId();
String [] columnList = new String[]{"日发电量","月发电量","年发电量"};
String [] columnLists = new String[]{"有功功率"};
String [] syLists = new String[]{"总辐射累计","总辐射","日照时数"};
String[] columnList = new String[]{"日发电量", "月发电量", "年发电量"};
String[] columnLists = new String[]{"有功功率"};
Map<String, Object> columnMap = new HashMap<>();
//日 月 年发电量同仅统计逆变器数据
List<Map<String, Object>> mapList;
for (String column : columnList) {
Double result = commonServiceImpl.getTotalByIndicatior(gatewayId, column);
columnMap.put(column, String.format("%.4f",result * CommonConstans.pvGenPoweActor));
Double result = commonServiceImpl.getTotalByIndicatiorByGF(gatewayId, column);
if (column.equals("日发电量")) {
columnMap.put(column, String.format(CommonConstans.Fourdecimalplaces, result * CommonConstans.pvGenPoweActorDay));
} else {
columnMap.put(column, result);
}
for (String column : syLists) {
Double result = commonServiceImpl.getNumByIndicatior(boosterGatewayId, column);
columnMap.put(column, String.format("%.2f",result));
}
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("南瑞光差保护_313P", "WTX-801_25_WTX-801_总辐射累计", "WTX-801_25_WTX-801_总辐射", "313光差保护_总反向有功电度"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
columnMap.put("有功功率", String.format("%.2f", commonServiceImpl.getSumByEquipmentIndxName(result1, "南瑞光差保护_313P") * CommonConstans.kwToMv));
for (String column : columnLists) {
Double result = commonServiceImpl.getAvgvalueByIndicatior(gatewayId, column);
columnMap.put(column, String.format("%.2f",result));
}
String num = monitorFanIndicator.getFJCount(gatewayId);
columnMap.put("逆变器台数",num);
String num = monitorFanIndicator.getEquipCount(gatewayId, "GF");
columnMap.put("逆变器台数", num);
Double capacityl = commonServiceImpl.getStationCapactityByStationWerks(stationBasic.getStationNumber());
columnMap.put("装机容量",String.format("%.2f",capacityl));
columnMap.put("装机容量", String.format("%.2f", capacityl));
columnMap.put("辐照强度", String.format("%.2f", commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射")));
String json = null;
try {
......@@ -646,8 +681,9 @@ public class MonitorFanIdxController extends BaseController {
for (Map map : list) {
String key = map.get("title").toString();
if (map.containsKey("action")){
if (key.equals("年利用小时")){
map.put("title", map.get("action").toString().replace("*","年发电量").replace("-","装机容量"));
if (key.equals("日利用小时")){
map.put("title", String.format("%.2f", ((Double.parseDouble(columnMap.get("日发电量").toString()) * CommonConstans.wkwhToMv) / (Double.parseDouble(columnMap.get("装机容量").toString())))));
columnMap.put("日利用小时", map.get("title"));
map.put("title2",map.get("title"));
}else {
map.put("title", map.get("action").toString().replace("*",columnMap.get(key).toString()));
......@@ -957,32 +993,68 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "社会贡献 ")
@GetMapping("/SocialContribution")
public ResponseModel<Page<SocialContributionDto> > socialContribution(String areaCode ) {
public ResponseModel< Page<HashMap<String, String>>> socialContribution(String areaCode ) {
Page<HashMap<String, String>> page3 = new Page<>(1, 10);
List<String> value=new ArrayList<>();
value.add(NFDL);
Map<String,List<String>> map=new HashMap<>();
map.put("equipmentIndexName.keyword",value);
List<StationCacheInfoDto> stationBasicListAll = new ArrayList<>();
if (null != areaCode){
List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
List<String> collect = listStationCacheInfoDto.stream().filter(e -> e.getAreaCode().equals(areaCode)).map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList());
stationBasicListAll = commonServiceImpl.getListStationCacheInfoDto();
List<String> collect = stationBasicListAll.stream().filter(e -> e.getAreaCode().equals(areaCode)).map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList());
map.put("gatewayId.keyword",collect);
}
List<? extends Terms.Bucket> lidate= commonServiceImpl.getgroupsum(map,"valueDouble" ,"equipmentIndexName.keyword", ESEquipments.class);
DecimalFormat format2 = new DecimalFormat("#.0000");
Double num = 0.00;
for (Terms.Bucket bucket : lidate) {
Aggregations aggregation= bucket.getAggregations();
List<Aggregation> listdata= Objects.nonNull(aggregation)?aggregation.asList():null;
for (Aggregation agg : listdata) {
ParsedSum parsedSum =(ParsedSum)agg;
num = Double.valueOf(format2.format(parsedSum.getValue()));
}
}
return ResponseHelper.buildResponse(commonServiceImpl.getSocialContributionDtoList(num));
List<StationCacheInfoDto> fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationCacheInfoDto> gfList = stationBasicListAll.stream().filter(stationBasic -> !stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
List<HashMap<String, String>> list1 = new ArrayList<>();
List<HashMap<String, String>> list2 = new ArrayList<>();
List<HashMap<String, String>> list3 = new ArrayList<>();
AtomicReference<Double> powerOfDayFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfAnnualFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfDayGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfAnnualGF = new AtomicReference<>(new Double(0.00));
fdzList.forEach(stationBasic -> {
Map<String,List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName,Arrays.asList("日发电量","月发电量","年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId,Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion,null,ESEquipments.class);
powerOfDayFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
powerOfMonthFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
powerOfAnnualFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
});
gfList.forEach(stationBasic -> {
Map<String,List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName,Arrays.asList("日发电量","月发电量","年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId,Arrays.asList(stationBasic.getFanGatewayId()));
Map<String,String> shouldQueryCondtion = new HashMap<>();
shouldQueryCondtion.put("frontModule","逆变器");
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion,shouldQueryCondtion,ESEquipments.class);
powerOfDayGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
powerOfMonthGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
powerOfAnnualGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
});
Double totalAnnual = (powerOfAnnualFD.get() + powerOfAnnualGF.get() * CommonConstans.pvGenPoweActor);
HashMap<String, String> stringHashMap13 = new HashMap<>();
stringHashMap13.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.carbonDioxide)));
stringHashMap13.put("unit", "二氧化碳减排量(万t)");
list3.add(stringHashMap13);
HashMap<String, String> stringHashMap14 = new HashMap<>();
stringHashMap14.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.standardCoal)));
stringHashMap14.put("unit", "节约标准煤(万t)");
list3.add(stringHashMap14);
HashMap<String, String> stringHashMap15 = new HashMap<>();
stringHashMap15.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.toner * CommonConstans.tToWT)));
stringHashMap15.put("unit", "碳粉尘减排量(万t)");
list3.add(stringHashMap15);
HashMap<String, String> stringHashMap16 = new HashMap<>();
stringHashMap16.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.sulfurDioxide * CommonConstans.tToWT)));
stringHashMap16.put("unit", "二氧化硫减排量(万t)");
list3.add(stringHashMap16);
page3.setRecords(list3);
return ResponseHelper.buildResponse(page3);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
......
......@@ -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