Commit a6ef2369 authored by tangwei's avatar tangwei

解决冲突

parents 31dc86ce a87b3bf1
......@@ -493,10 +493,11 @@ public class MonitorFanIdxController extends BaseController {
@GetMapping("/electricQuantity")
public ResponseModel<ResultsData> getElectricQuantityList(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "stationId") String stationId) {
@RequestParam(value = "stationId") String stationId,
@RequestParam(value = "stationType",required = false) String stationType) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getBoosterGatewayId();
ResultsData resultsData = monitorFanIndicatorImpl.getElectricQuantityList(current, size, gatewayId);
ResultsData resultsData = monitorFanIndicatorImpl.getElectricQuantityList(current, size, gatewayId,stationType);
return ResponseHelper.buildResponse(resultsData);
}
......@@ -705,6 +706,7 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "箱变实时开关状态")
@GetMapping("/equipSwitchStatus")
@Scheduled(cron = "0/10 * * * * ? ")
public ResponseModel<Map<String,Object>> getEquipSwitchStatus() {
......@@ -729,4 +731,25 @@ public class MonitorFanIdxController extends BaseController {
String gatewayId = stationBasic.getFanGatewayId();
return ResponseHelper.buildResponse(monitorFanIndicatorImpl.collectingBox(gatewayId,current, size ));
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "光伏 运行列表")
@GetMapping("/solarPowerOperation")
public ResponseModel<IPage<Map<String, Object>>> solarPowerOperation(@RequestParam(value = "stationId")String stationId,@RequestParam(value = "current") int current, int size) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
List<Map<String, Object>> statusMonitoring = monitorFanIndicator.solarPowerOperation(gatewayId);
List<Map<String, Object>> collect = statusMonitoring.stream()
.skip((long) (current - 1) * size)
.limit(size)
.collect(Collectors.toList());
IPage<Map<String,Object>> result = new Page<>();
result.setRecords(collect);
result.setCurrent(current);
result.setTotal(statusMonitoring.size());
return ResponseHelper.buildResponse(result);
}
}
......@@ -137,4 +137,11 @@ public class MonitoringMapController extends BaseController {
public ResponseModel<Page<HashMap<String, String>>> getPowerGenerationTrendsOfCompletionTopThree(@RequestParam(required = false)String areaName,@RequestParam(required = false,defaultValue = "0")String tabValue) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getPowerGenerationTrendsOfCompletionTopThree(tabValue,areaName));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "运行监盘-获取全国数据")
@GetMapping("/getTotalData")
public void getTotalData() {
monitoringServiceImpl.getTotalData();
}
}
......@@ -836,9 +836,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
for (IndicatorsDto listDatum : listData) {
Map<String, Object> statusMap = new HashMap<>();
statusMap.put("data",StringUtils.isEmpty(listDatum.getDisplayName())?listDatum.getEquipmentIndexName():listDatum.getDisplayName());
statusMap.put("state",listDatum.getState().equals("true")? 1:0);
statusMap.put("status",listDatum.getState().equals("true")? 1:0);
statusMap.put("title",listDatum.getState().equals("true")?"断":"通");
statusMap.put("state",listDatum.getState().equals("false")? 1:0);
statusMap.put("status",listDatum.getState().equals("false")? 1:0);
statusMap.put("title",listDatum.getState().equals("false")?"断":"通");
statusMaps.add(statusMap);
}
return statusMaps;
......@@ -852,7 +852,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
List<Map<String,Object>> statusMaps = new ArrayList<>();
for (IndicatorsDto listDatum : listData) {
Map<String, Object> statusMap = new HashMap<>();
statusMap.put("title",listDatum.getValue().equals("")? 0: keepTwoDecimalPlaces(listDatum.getValue())+" "+listDatum.getUnit());
statusMap.put("title",listDatum.getValue().equals("")? 0: keepTwoDecimalPlaces(listDatum.getValue())+" "+listDatum.getUnit() == null?"":listDatum.getUnit());
statusMap.put("title1",listDatum.getDisplayName());
statusMaps.add(statusMap);
}
......@@ -881,7 +881,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
for (IndicatorsDto indicatorsDto : indicatorsDtos) {
if (indicatorsDto.getDisplayName().contains("合位")){
statusMap.put("type",indicatorsDto.getValue());
statusMap.put("status",indicatorsDto.getValue().equals("true")?"1":"0");
statusMap.put("status",indicatorsDto.getValue().equals("false")?"0":"1");
statusMap.put("position",indicatorsDto.getDisplayName().split("_")[0]+"开关位置");
}
......@@ -1037,41 +1037,40 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
public ResultsData getElectricQuantityList(int current, int size,String gatewayId) {
public ResultsData getElectricQuantityList(int current, int size,String gatewayId,String stationType) {
String sql = " SELECT * FROM indicators_" + gatewayId + " WHERE frontModule ='电量表计' and displayName != '' and displayName != '检修状态' ";
List<IndicatorsDto> windSqlList = influxDButils.getListDataAll(sql, IndicatorsDto.class);
Map<String, List<IndicatorsDto>> maps = windSqlList.stream().collect(Collectors.groupingBy(IndicatorsDto::getSystemType));
ArrayList<Map<String, String>> resultList = new ArrayList<>();
Set<ColModel> listColModel = new LinkedHashSet<>();
List<ColModel> listColModels = new ArrayList<>();
ColModel name = new ColModel("name", "name", "测量点", "测量点", "dataGrid", "name");
listColModel.add(name);
for (Map.Entry<String, List<IndicatorsDto>> stringListEntry : maps.entrySet()) {
HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("name", stringListEntry.getKey());
for (IndicatorsDto indicatorsDto : stringListEntry.getValue()) {
stringStringHashMap.put(ElectricQuantity.getCode(indicatorsDto.getDisplayName()), String.format("%.2f",ObjectUtils.isEmpty(indicatorsDto.getValue())?0.0:Double.parseDouble(indicatorsDto.getValue())));
String key = ElectricQuantity.getCode(indicatorsDto.getDisplayName());
ColModel keyName = new ColModel(key, key, indicatorsDto.getDisplayName(),indicatorsDto.getDisplayName(), "dataGrid", key);
listColModel.add(keyName);
}
resultList.add(stringStringHashMap);
}
listColModels.addAll(listColModel);
//构建平台数据
DataGridMock DataGridMock = new DataGridMock(current, resultList.size(), false, current, resultList);
// ColModel colModelStationName = new ColModel("zxzyg", "zxzyg", "正向总有功", "正向总有功", "dataGrid", "zxzyg");
// ColModel colModelEventDesc = new ColModel("fxzyg", "fxzyg", "反向总有功", "反向总有功", "dataGrid", "fxzyg");
// ColModel colModelAlarmGroupName = new ColModel("zxzwg", "zxzwg", "正向总无功", "正向总无功", "dataGrid", "zxzwg");
// ColModel colModelEventTime = new ColModel("fxzwg", "fxzwg", "反向总无功", "反向总无功", "dataGrid", "fxzwg");
//List<ColModel> listColModel = Arrays.asList(colModelEventMovement, colModelStationName, colModelEventDesc, colModelAlarmGroupName, colModelEventTime);
ResultsData resultsData = new ResultsData(DataGridMock, listColModels);
ColModel colModelEventMovement = new ColModel("name", "name", "测量点", "测量点", "dataGrid", "name");
ColModel colModelStationName = new ColModel("zxzyg", "zxzyg", "正向总有功", "正向总有功", "dataGrid", "zxzyg");
ColModel colModelEventDesc = new ColModel("fxzyg", "fxzyg", "反向总有功", "反向总有功", "dataGrid", "fxzyg");
ColModel colModelAlarmGroupName = new ColModel("zxzwg", "zxzwg", "正向总无功", "正向总无功", "dataGrid", "zxzwg");
ColModel colModelEventTime = new ColModel("fxzwg", "fxzwg", "反向总无功", "反向总无功", "dataGrid", "fxzwg");
if (null != stationType){
colModelEventMovement = new ColModel("name", "name", "测量点", "测量点", "dataGrid", "name");
colModelStationName = new ColModel("zgxwg", "zgxwg", "总感性无功", "总感性无功", "dataGrid", "zgxwg");
colModelEventDesc = new ColModel("zzxwg", "zzxwg", "总正向有功", "总正向有功", "dataGrid", "zzxwg");
colModelAlarmGroupName = new ColModel("zrxwg", "zrxwg", "总容性无功", "总容性无功", "dataGrid", "zrxwg");
colModelEventTime = new ColModel("zfxyg", "zfxyg", "总反向有功", "总反向有功", "dataGrid", "zfxyg");
}
List<ColModel> listColModel = Arrays.asList(colModelEventMovement, colModelStationName, colModelEventDesc, colModelAlarmGroupName, colModelEventTime);
ResultsData resultsData = new ResultsData(DataGridMock, listColModel);
return resultsData;
}
public void getAnalogQuantityInfo(String gatewayId, String stationId, String routeName) {
if (StringUtils.isNotEmpty(gatewayId)) {
Map<String, String> map = monitorFanIndicatorregionMapper.getMajorBoosterStationInfoBySort(gatewayId, routeName);
......@@ -1086,8 +1085,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
listData.stream().filter(t -> t.getFrontModule().contains("1主变低压侧")).forEach(item -> {
HashMap<String, String> zbMap = new HashMap<>();
zbMap.put("title", item.getDisplayName());
zbMap.put("grade1", item.getValue());
zbMap.put("grade2", zbGYC.getOrDefault(item.getDisplayName(), "0.0"));
zbMap.put("grade1", keepTwoDecimalPlaces(item.getValue()));
zbMap.put("grade2", keepTwoDecimalPlaces(zbGYC.getOrDefault(item.getDisplayName(), "0.0")));
if (StringUtils.isNotEmpty(item.getUnit())) {
zbMap.put("title", String.format("%s(%s)", item.getDisplayName(), item.getUnit()));
}
......@@ -1110,7 +1109,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
listData.forEach(item -> {
HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("title", item.getDisplayName());
stringStringHashMap.put("value", item.getValue());
stringStringHashMap.put("value", keepTwoDecimalPlaces(item.getValue()));
if (StringUtils.isNotEmpty(item.getUnit())) {
stringStringHashMap.put("title", String.format("%s(%s)", item.getDisplayName(), item.getUnit()));
}
......@@ -1396,10 +1395,11 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
photoUrls.put(listDatum.getDisplayName().split("_")[0]+"scxurl",pictureUrl+split1[1]);
}
}else {
if (listDatum.getValue().equals("true")){
url =pictureUrl+ listDatum.getPictureName();
if (listDatum.getValue().equals("false")){
url =pictureUrl+ listDatum.getPictureName().replace("green", "red");
}else {
url =pictureUrl+ listDatum.getPictureName().replace("red", "green");
url =pictureUrl+ listDatum.getPictureName();
}
photoUrls.put(listDatum.getDisplayName().split("_")[0]+"url",url);
}
......@@ -1436,13 +1436,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public HashMap<String, Object> getEquipInfoByEquipNum(String gatewayId ,String equipmentNumber){
HashMap<String, Object> resultMap = new HashMap<>();
String sql = "SELECT * FROM indicators_"+gatewayId+" WHERE equipmentNumber ='"+equipmentNumber +"'and equipmentIndexName = '运行' limit 1 ";
String sql = "SELECT * FROM indicators_"+gatewayId+" WHERE equipmentNumber ='"+equipmentNumber +"' limit 1 ";
List<IndicatorsDto> list = influxDButils.getListData(sql, IndicatorsDto.class);
if (!ValidationUtil.isEmpty(list)){
resultMap.put("equipmentSpecificName",list.get(0).getEquipmentSpecificName());
resultMap.put("equipmentIndexName",list.get(0).getEquipmentSpecificName());
resultMap.put("equipmentInfoName",list.get(0).getEquipmentSpecificName().substring(5).replace("/"," "));
resultMap.put("status",list.get(0).getValue().equals("true")?"异常":"正常运行");
resultMap.put("status",list.get(0).getValue().equals("false")?"异常":"正常运行");
}
return resultMap;
}
......@@ -1486,9 +1486,10 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public HashMap<String, Object> SpeedIndicator(String gatewayId ,String equipmentNumber,String equipmentIndexName){
HashMap<String, Object> resultMap = new HashMap<>();
String sql = "SELECT * FROM indicators_"+gatewayId+" WHERE equipmentNumber ='"+equipmentNumber +"' and equipmentIndexName = '"+equipmentIndexName+"'";
log.info("执行sql"+sql);
List<IndicatorsDto> list = influxDButils.getListData(sql, IndicatorsDto.class);
if (!ValidationUtil.isEmpty(list)){
resultMap.put("value",list.get(0).getValue());
resultMap.put("value",String.format("%.2f",Double.parseDouble(list.get(0).getValue())));
}
return resultMap;
}
......@@ -1506,12 +1507,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
HashMap<String, Object> resultMap = new HashMap<>();
collect.get(s).stream().forEach(e->{
String picturl = "";
if (e.getValue().equals("true")){
if (e.getValue().equals("false")){
picturl = pictureUrl+"dlg-h-red.png";
}else {
picturl = pictureUrl+"dlg-h-green.png";
}
if(e.getEquipmentIndexName().contains("合闸")){
if(e.getEquipmentIndexName().endsWith("断路器合闸")){
resultMap.put(e.getEquipmentIndexName().substring(0,3),picturl);
}else {
resultMap.put("gy",picturl);
......@@ -1537,15 +1538,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public ResultsData collectingBox(String gatewayId ,int current,int size){
HashMap<String, Object> resultMap = new HashMap<>();
ArrayList<Map<String, Object>> resultList = new ArrayList<>();
String sql = "SELECT * FROM indicators_"+gatewayId+" WHERE equipmentIndexName =~/路电流/ ";
String sql1 = "SELECT * FROM indicators_"+gatewayId+" WHERE equipmentIndexName =~/平均电流/ ";
List<IndicatorsDto> list = influxDButils.getListData(sql, IndicatorsDto.class);
List<IndicatorsDto> list1 = influxDButils.getListData(sql1, IndicatorsDto.class);
if (!ValidationUtil.isEmpty(list)){
Map<String, List<IndicatorsDto>> collect = list.stream().collect(Collectors.groupingBy(IndicatorsDto::getEquipmentNumber));
for (String s : collect.keySet()) {
List<IndicatorsDto> indicatorsDtos = collect.get(s);
HashMap<String, Object> resultMap = new HashMap<>();
Double avageValue = 0.0;
avageValue =indicatorsDtos.stream().filter(e -> !ObjectUtils.isEmpty(e.getValue())).mapToDouble(l->Double.parseDouble((String) l.getValue())).average().getAsDouble();
avageValue = Double.valueOf(String.format("%.2f", avageValue));
......@@ -1554,7 +1557,19 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
resultMap.put("zz","#"+name[0]+"子阵");
resultMap.put("nbq","逆变器"+name[1]);
resultMap.put("hlx","#"+name[2]+"汇流箱");
resultMap.put("lsv","1.7840");
double lsv = 0.00;
if(!ValidationUtil.isEmpty(list1)){
List<IndicatorsDto> dtos = list1.stream().filter(e -> e.getEquipmentNumber().equals(s)).collect(Collectors.toList());
if (!ValidationUtil.isEmpty(dtos)){
for (IndicatorsDto indicatorsDto : indicatorsDtos) {
lsv= lsv + Math.pow(Double.parseDouble(indicatorsDto.getValue()) - Double.parseDouble(dtos.get(0).getValue()), 2);
}
}
lsv= Math.sqrt(lsv)/Double.parseDouble(dtos.get(0).getValue());
}
resultMap.put("lsv",String.format("%.2f", lsv));
resultList.add(resultMap);
}
}
......@@ -1571,5 +1586,41 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
public List<Map<String, Object>> solarPowerOperation(String gatewayId) {
String sql = "SELECT * FROM indicators_"+gatewayId+" WHERE equipmentIndexName = '有功功率' or equipmentIndexName = '逆变器效率' or equipmentIndexName ='总直流功率' or equipmentIndexName ='日发电量' or equipmentIndexName ='总发电量' ";
List<IndicatorsDto> list = influxDButils.getListData(sql, IndicatorsDto.class);
List<IndicatorsDto> collect = list.stream().filter(e -> StringUtils.isNotEmpty(e.getEquipmentNumber())).collect(Collectors.toList());
Map<String, List<IndicatorsDto>> collects = collect.stream().collect(Collectors.groupingBy(IndicatorsDto::getEquipmentNumber));
List<Map<String, Object>> result = new ArrayList();
for (String s : collects.keySet()){
List<IndicatorsDto> indicatorsDtos = collects.get(s);
Map<String, Object> map = new HashMap<>();
map.put("name",s);
map.put("type","兆能");//此处暂时未提供数据 待定 暂写死值
map.put("status","1");//此处暂时未提供数据 待定 暂写死值
indicatorsDtos.forEach(e->{
switch (e.getEquipmentIndexName()){
case "总直流功率":
map.put("sr",keepTwoDecimalPlaces(e.getValue()));
break;
case "有功功率":
map.put("sc",keepTwoDecimalPlaces(e.getValue()));
break;
case "逆变器效率":
map.put("efficiency",keepTwoDecimalPlaces(e.getValue()));
break;
case "日发电量":
map.put("dayNum",keepTwoDecimalPlaces(e.getValue()));
break;
case "总发电量":
map.put("yearNum",keepTwoDecimalPlaces(e.getValue()));
break;
}
});
result.add(map);
}
return result;
}
}
......@@ -3,7 +3,6 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sun.org.apache.bcel.internal.generic.NEW;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MapRegion;
import com.yeejoin.amos.boot.module.jxiop.api.entity.Region;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
......@@ -21,8 +20,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.unbescape.css.CssIdentifierEscapeLevel;
import java.math.BigDecimal;
import java.net.URLDecoder;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
......@@ -218,7 +217,7 @@ public class MonitoringServiceImpl {
completionOfPowerIndicatorsDto.setActivePower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "有功功率")));
completionOfPowerIndicatorsDto.setDailyPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "日发电量")));
completionOfPowerIndicatorsDto.setMonthlyPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "月发电量")));
completionOfPowerIndicatorsDto.setAnnualPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "年发电量")));
completionOfPowerIndicatorsDto.setAnnualPower(String.format("%.2f",new BigDecimal(commonServiceImpl.getTotalByIndicatior(mapList, "年发电量"))));
}
......@@ -463,7 +462,7 @@ public class MonitoringServiceImpl {
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("station_name"));
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
Map<String, List<StationBasic>> listMap = stationBasicListAll.stream().collect(Collectors.groupingBy(stationBasic -> stationBasic.getStationTypeName()));
listMap.keySet().forEach(key -> {
......@@ -483,7 +482,7 @@ public class MonitoringServiceImpl {
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("station_name"));
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber()));
......@@ -500,7 +499,7 @@ public class MonitoringServiceImpl {
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("station_name"));
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "有功功率"));
......@@ -526,7 +525,7 @@ public class MonitoringServiceImpl {
} else if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("station_name"));
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "年发电量"));
......@@ -539,7 +538,7 @@ public class MonitoringServiceImpl {
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("station_name"));
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
//月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
......@@ -548,7 +547,7 @@ public class MonitoringServiceImpl {
});
HashMap<String, List<String>> hashMap = new HashMap<>();
List<String> xList = getXListofRecentOneYear();
List<String> yList = Arrays.asList("0","0","0","0","0","0","0","0","0","0","12000",String.format("%.2f", monthlyPower.get()/1000));
List<String> yList = Arrays.asList("0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "12000", String.format("%.2f", monthlyPower.get() / 1000));
hashMap.put("axisData", xList);
hashMap.put("seriesData", yList);
return hashMap;
......@@ -606,7 +605,7 @@ public class MonitoringServiceImpl {
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("station_name"));
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
//月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
......@@ -615,7 +614,7 @@ public class MonitoringServiceImpl {
});
HashMap<String, List<String>> hashMap = new HashMap<>();
List<String> xList = getXListofRecentOneYear();
List<String> yList = Arrays.asList("0","0","0","0","0","0","0","0","0","0","120",String.format("%.2f", monthlyPower.get()%200));
List<String> yList = Arrays.asList("0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "120", String.format("%.2f", monthlyPower.get() % 200));
hashMap.put("axisData", xList);
hashMap.put("seriesData", yList);
return hashMap;
......@@ -627,7 +626,7 @@ public class MonitoringServiceImpl {
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("station_name"));
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
HashMap<String, List<String>> hashMap = new HashMap<>();
List<String> xList = new ArrayList<>();
......@@ -635,9 +634,9 @@ public class MonitoringServiceImpl {
//月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
stationBasicListAll.forEach(stationBasic -> {
stationBasic.setAddress(String.format("%.2f",commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(),"月发电量")%100));
stationBasic.setAddress(String.format("%.2f", commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "月发电量") % 100));
});
List<StationBasic> sorted = stationBasicListAll.stream().sorted(Comparator.comparing(StationBasic::getAddress,Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
List<StationBasic> sorted = stationBasicListAll.stream().sorted(Comparator.comparing(StationBasic::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
sorted.forEach(stationBasic -> {
xList.add(stationBasic.getStationName());
yList.add(stationBasic.getAddress());
......@@ -648,7 +647,7 @@ public class MonitoringServiceImpl {
}
public List<String> getXListofRecentOneYear(){
public List<String> getXListofRecentOneYear() {
List<String> xList = new ArrayList<>();
Calendar calendar = Calendar.getInstance();
Date date = new Date();
......@@ -661,60 +660,60 @@ public class MonitoringServiceImpl {
}
public Page<HashMap<String,String>> getPowerGenerationTrendsOfCompletionTopThree(String tabValue,String areaName){
Page<HashMap<String,String>> page = new Page<>(1,3);
List<HashMap<String,String>> mapList= new ArrayList<>();
public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopThree(String tabValue, String areaName) {
Page<HashMap<String, String>> page = new Page<>(1, 3);
List<HashMap<String, String>> mapList = new ArrayList<>();
List<StationBasic> stationBasicListAll = new ArrayList<>();
List<StationBasic> fdzList = new ArrayList<>();
List<StationBasic> gfdzlist = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("station_name"));
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
String indicator = "日发电量";
if(tabValue.equals(1)){
indicator="月发电量";
}else{
indicator="年发电量";
if (tabValue.equals(1)) {
indicator = "月发电量";
} else {
indicator = "年发电量";
}
//填写发电小时数
String finalIndicator = indicator;
stationBasicListAll.forEach(stationBasic -> {
Double install=getStationCaPACITYL(stationBasic.getStationNumber());
Double total =commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), finalIndicator);
stationBasic.setAddress(String.format("%.2f",total));
if(stationBasic.getStationType().equals("FDZ")){
stationBasic.setAddress(String.format("%.2f",total/100/install));
}else {
stationBasic.setAddress(String.format("%.2f",total/1000000/install));
}
if(stationBasic.getAddress().equals("NaN")){
Double install = getStationCaPACITYL(stationBasic.getStationNumber());
Double total = commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), finalIndicator);
stationBasic.setAddress(String.format("%.2f", total));
if (stationBasic.getStationType().equals("FDZ")) {
stationBasic.setAddress(String.format("%.2f", total / 100 / install));
} else {
stationBasic.setAddress(String.format("%.2f", total / 1000000 / install));
}
if (stationBasic.getAddress().equals("NaN")) {
stationBasic.setAddress("0.00");
}
});
//分组并排序
fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList()).stream().sorted(Comparator.comparing(StationBasic::getAddress,Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
gfdzlist = stationBasicListAll.stream().filter(stationBasic -> !stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList()).stream().sorted(Comparator.comparing(StationBasic::getAddress,Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
for (int i = 0; i <3 ; i++) {
HashMap<String,String> stringHashMap= new HashMap<>();
stringHashMap.put("sortNumber",String.valueOf(i+1));
StationBasic stationBasic =new StationBasic();
if(i<(fdzList.size())){
fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList()).stream().sorted(Comparator.comparing(StationBasic::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
gfdzlist = stationBasicListAll.stream().filter(stationBasic -> !stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList()).stream().sorted(Comparator.comparing(StationBasic::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
for (int i = 0; i < 3; i++) {
HashMap<String, String> stringHashMap = new HashMap<>();
stringHashMap.put("sortNumber", String.valueOf(i + 1));
StationBasic stationBasic = new StationBasic();
if (i < (fdzList.size())) {
stationBasic = fdzList.get(i);
stringHashMap.put("stationName1",stationBasic.getStationName());
stringHashMap.put("hours1",stationBasic.getAddress()+"h");
}else {
stringHashMap.put("stationName1","");
stringHashMap.put("hours1","");
stringHashMap.put("stationName1", stationBasic.getStationName());
stringHashMap.put("hours1", stationBasic.getAddress() + "h");
} else {
stringHashMap.put("stationName1", "");
stringHashMap.put("hours1", "");
}
if(i<(gfdzlist.size())){
if (i < (gfdzlist.size())) {
stationBasic = gfdzlist.get(i);
stringHashMap.put("stationName2",stationBasic.getStationName());
stringHashMap.put("hours2",stationBasic.getAddress()+"h");
}else {
stringHashMap.put("stationName2","");
stringHashMap.put("hours2","");
stringHashMap.put("stationName2", stationBasic.getStationName());
stringHashMap.put("hours2", stationBasic.getAddress() + "h");
} else {
stringHashMap.put("stationName2", "");
stringHashMap.put("hours2", "");
}
mapList.add(stringHashMap);
}
......@@ -722,4 +721,123 @@ public class MonitoringServiceImpl {
//组装数据
return page;
}
public void getTotalData() {
List<StationBasic> stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
List<StationBasic> fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationBasic> jzsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).collect(Collectors.toList());
List<StationBasic> fbsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).collect(Collectors.toList());
List<StationBasic> gfList = stationBasicListAll.stream().filter(stationBasic -> !stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
Page<HashMap<String, String>> page = new Page<>(1, 10);
Page<HashMap<String, String>> page1 = new Page<>(1, 10);
Page<HashMap<String, String>> page2 = new Page<>(1, 10);
Page<HashMap<String, String>> page3 = new Page<>(1, 10);
// ----------------装机容量开始-----------------------
List<HashMap<String, String>> list = new ArrayList<>();
//装机容量
HashMap<String, String> stringHashMap = new HashMap<>();
BigDecimal totalInstall = new BigDecimal(getInstallCapity(stationBasicListAll));
stringHashMap.put("title", totalInstall.toString());
stringHashMap.put("data", "");
list.add(stringHashMap);
//风电站
HashMap<String, String> stringHashMap1 = new HashMap<>();
BigDecimal fdzInstall = new BigDecimal(getInstallCapity(fdzList));
stringHashMap1.put("title", fdzInstall.toString());
stringHashMap1.put("data", String.valueOf(fdzList.size()));
list.add(stringHashMap1);
//集中式光伏电站
HashMap<String, String> stringHashMap2 = new HashMap<>();
BigDecimal jzsInstall = new BigDecimal(getInstallCapity(jzsgfdzList));
stringHashMap2.put("title", jzsInstall.toString());
stringHashMap2.put("data", String.valueOf(jzsgfdzList.size()));
list.add(stringHashMap2);
//分布式光伏电站
HashMap<String, String> stringHashMap3 = new HashMap<>();
BigDecimal fbsInstall = new BigDecimal(getInstallCapity(fbsgfdzList));
stringHashMap3.put("title", fbsInstall.toString());
stringHashMap3.put("data", String.valueOf(fbsgfdzList.size()));
list.add(stringHashMap3);
page.setRecords(list);
BigDecimal gfInstall = new BigDecimal(getInstallCapity(gfList));
//----------------------装机容量结束----------------------------------------
// ----------------装机容量开始-----------------------
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 -> {
List<Map<String, Object>> mapList;
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' or equipmentIndexName='有功功率' or equipmentIndexName='30秒平均风速' )");
powerOfDayFD.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "日发电量"));
powerOfMonthFD.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "月发电量"));
powerOfAnnualFD.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "年发电量"));
});
gfList.forEach(stationBasic -> {
List<Map<String, Object>> mapList;
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' or equipmentIndexName='有功功率' or equipmentIndexName='30秒平均风速' )");
powerOfDayGF.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "日发电量"));
powerOfMonthGF.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "月发电量"));
powerOfAnnualGF.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "年发电量"));
});
HashMap<String, String> stringHashMap4 = new HashMap<>();
stringHashMap4.put("title", String.format("%.2f", powerOfDayFD.get()) + "/" + String.format("%.2f", powerOfDayGF.get()));
list1.add(stringHashMap4);
HashMap<String, String> stringHashMap5 = new HashMap<>();
stringHashMap5.put("title", String.format("%.2f", powerOfMonthFD.get()) + "/" + String.format("%.2f", powerOfMonthGF.get()));
list1.add(stringHashMap5);
HashMap<String, String> stringHashMap6 = new HashMap<>();
stringHashMap6.put("title", String.format("%.2f", powerOfAnnualFD.get()) + "/" + String.format("%.2f", powerOfAnnualGF.get()));
list1.add(stringHashMap6);
HashMap<String, String> stringHashMap7 = new HashMap<>();
stringHashMap7.put("title", String.format("%.2f", powerOfAnnualFD.get() % 200) + "/" + String.format("%.2f", powerOfAnnualGF.get() % 200));
list1.add(stringHashMap7);
HashMap<String, String> stringHashMap8 = new HashMap<>();
stringHashMap8.put("title", String.format("%.2f", powerOfAnnualFD.get() / fdzInstall.doubleValue()) + "/" + String.format("%.2f", powerOfAnnualGF.get() / gfInstall.doubleValue()));
list1.add(stringHashMap8);
page1.setRecords(list1);
HashMap<String, String> stringHashMap9 = new HashMap<>();
stringHashMap9.put("title", String.format("%.2f", powerOfDayFD.get() + powerOfDayGF.get()));
list2.add(stringHashMap9);
HashMap<String, String> stringHashMap10 = new HashMap<>();
stringHashMap10.put("title", String.format("%.2f", powerOfMonthFD.get() + powerOfMonthGF.get()));
list2.add(stringHashMap10);
HashMap<String, String> stringHashMap11 = new HashMap<>();
stringHashMap11.put("title", String.format("%.2f",powerOfAnnualFD .get() + powerOfAnnualGF.get()));
list2.add(stringHashMap11);
HashMap<String, String> stringHashMap12 = new HashMap<>();
stringHashMap12.put("title", String.format("%.2f", (powerOfAnnualFD.get()%200 + powerOfAnnualGF.get()%200)/2 ));
list2.add(stringHashMap12);
page2.setRecords(list2);
HashMap<String, String> stringHashMap13 = new HashMap<>();
stringHashMap13.put("title1", String.format("%.2f", (powerOfAnnualFD.get() + powerOfAnnualGF.get()) * 0.000832));
stringHashMap13.put("title2", "二氧化碳减排量(万t)");
list3.add(stringHashMap13);
HashMap<String, String> stringHashMap14 = new HashMap<>();
stringHashMap14.put("title1", String.format("%.2f", (powerOfAnnualFD.get() + powerOfAnnualGF.get()) * 0.0003049));
stringHashMap14.put("title2", "节约标准煤(万t)");
list3.add(stringHashMap14);
HashMap<String, String> stringHashMap15 = new HashMap<>();
stringHashMap15.put("title1", String.format("%.2f", (powerOfAnnualFD.get() + powerOfAnnualGF.get()) * 0.00032));
stringHashMap15.put("title2", "碳粉尘减排量(万t)");
list3.add(stringHashMap15);
HashMap<String, String> stringHashMap16 = new HashMap<>();
stringHashMap16.put("title1", String.format("%.2f", (powerOfAnnualFD.get() + powerOfAnnualGF.get()) * 0.0016));
stringHashMap16.put("title2", "二氧化硫减排量(万t)");
list3.add(stringHashMap16);
page3.setRecords(list3);
try {
emqKeeper.getMqttClient().publish("total_zjrl_topic",JSON.toJSON(page).toString().getBytes("UTF-8"),1,true);
emqKeeper.getMqttClient().publish("total_ssscsj_topic",JSON.toJSON(page1).toString().getBytes("UTF-8"),1,true);
emqKeeper.getMqttClient().publish("total_zssscsj_topic",JSON.toJSON(page2).toString().getBytes("UTF-8"),1,true);
emqKeeper.getMqttClient().publish("total_zshgx_topic",JSON.toJSON(page3).toString().getBytes("UTF-8"),1,true);
} catch (Exception ex) {
}
}
}
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