Commit a6ef2369 authored by tangwei's avatar tangwei

解决冲突

parents 31dc86ce a87b3bf1
...@@ -493,10 +493,11 @@ public class MonitorFanIdxController extends BaseController { ...@@ -493,10 +493,11 @@ public class MonitorFanIdxController extends BaseController {
@GetMapping("/electricQuantity") @GetMapping("/electricQuantity")
public ResponseModel<ResultsData> getElectricQuantityList(@RequestParam(value = "current") int current, public ResponseModel<ResultsData> getElectricQuantityList(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size, @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); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getBoosterGatewayId(); String gatewayId = stationBasic.getBoosterGatewayId();
ResultsData resultsData = monitorFanIndicatorImpl.getElectricQuantityList(current, size, gatewayId); ResultsData resultsData = monitorFanIndicatorImpl.getElectricQuantityList(current, size, gatewayId,stationType);
return ResponseHelper.buildResponse(resultsData); return ResponseHelper.buildResponse(resultsData);
} }
...@@ -705,6 +706,7 @@ public class MonitorFanIdxController extends BaseController { ...@@ -705,6 +706,7 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "箱变实时开关状态") @ApiOperation(value = "箱变实时开关状态")
@GetMapping("/equipSwitchStatus") @GetMapping("/equipSwitchStatus")
@Scheduled(cron = "0/10 * * * * ? ")
public ResponseModel<Map<String,Object>> getEquipSwitchStatus() { public ResponseModel<Map<String,Object>> getEquipSwitchStatus() {
...@@ -729,4 +731,25 @@ public class MonitorFanIdxController extends BaseController { ...@@ -729,4 +731,25 @@ public class MonitorFanIdxController extends BaseController {
String gatewayId = stationBasic.getFanGatewayId(); String gatewayId = stationBasic.getFanGatewayId();
return ResponseHelper.buildResponse(monitorFanIndicatorImpl.collectingBox(gatewayId,current, size )); 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 { ...@@ -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) { 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)); 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 { ...@@ -836,9 +836,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
for (IndicatorsDto listDatum : listData) { for (IndicatorsDto listDatum : listData) {
Map<String, Object> statusMap = new HashMap<>(); Map<String, Object> statusMap = new HashMap<>();
statusMap.put("data",StringUtils.isEmpty(listDatum.getDisplayName())?listDatum.getEquipmentIndexName():listDatum.getDisplayName()); statusMap.put("data",StringUtils.isEmpty(listDatum.getDisplayName())?listDatum.getEquipmentIndexName():listDatum.getDisplayName());
statusMap.put("state",listDatum.getState().equals("true")? 1:0); statusMap.put("state",listDatum.getState().equals("false")? 1:0);
statusMap.put("status",listDatum.getState().equals("true")? 1:0); statusMap.put("status",listDatum.getState().equals("false")? 1:0);
statusMap.put("title",listDatum.getState().equals("true")?"断":"通"); statusMap.put("title",listDatum.getState().equals("false")?"断":"通");
statusMaps.add(statusMap); statusMaps.add(statusMap);
} }
return statusMaps; return statusMaps;
...@@ -852,7 +852,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -852,7 +852,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
List<Map<String,Object>> statusMaps = new ArrayList<>(); List<Map<String,Object>> statusMaps = new ArrayList<>();
for (IndicatorsDto listDatum : listData) { for (IndicatorsDto listDatum : listData) {
Map<String, Object> statusMap = new HashMap<>(); 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()); statusMap.put("title1",listDatum.getDisplayName());
statusMaps.add(statusMap); statusMaps.add(statusMap);
} }
...@@ -881,7 +881,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -881,7 +881,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
for (IndicatorsDto indicatorsDto : indicatorsDtos) { for (IndicatorsDto indicatorsDto : indicatorsDtos) {
if (indicatorsDto.getDisplayName().contains("合位")){ if (indicatorsDto.getDisplayName().contains("合位")){
statusMap.put("type",indicatorsDto.getValue()); 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]+"开关位置"); statusMap.put("position",indicatorsDto.getDisplayName().split("_")[0]+"开关位置");
} }
...@@ -1037,41 +1037,40 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -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 != '检修状态' "; String sql = " SELECT * FROM indicators_" + gatewayId + " WHERE frontModule ='电量表计' and displayName != '' and displayName != '检修状态' ";
List<IndicatorsDto> windSqlList = influxDButils.getListDataAll(sql, IndicatorsDto.class); List<IndicatorsDto> windSqlList = influxDButils.getListDataAll(sql, IndicatorsDto.class);
Map<String, List<IndicatorsDto>> maps = windSqlList.stream().collect(Collectors.groupingBy(IndicatorsDto::getSystemType)); Map<String, List<IndicatorsDto>> maps = windSqlList.stream().collect(Collectors.groupingBy(IndicatorsDto::getSystemType));
ArrayList<Map<String, String>> resultList = new ArrayList<>(); 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()) { for (Map.Entry<String, List<IndicatorsDto>> stringListEntry : maps.entrySet()) {
HashMap<String, String> stringStringHashMap = new HashMap<>(); HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("name", stringListEntry.getKey()); stringStringHashMap.put("name", stringListEntry.getKey());
for (IndicatorsDto indicatorsDto : stringListEntry.getValue()) { for (IndicatorsDto indicatorsDto : stringListEntry.getValue()) {
stringStringHashMap.put(ElectricQuantity.getCode(indicatorsDto.getDisplayName()), String.format("%.2f",ObjectUtils.isEmpty(indicatorsDto.getValue())?0.0:Double.parseDouble(indicatorsDto.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); resultList.add(stringStringHashMap);
} }
listColModels.addAll(listColModel);
//构建平台数据 //构建平台数据
DataGridMock DataGridMock = new DataGridMock(current, resultList.size(), false, current, resultList); DataGridMock DataGridMock = new DataGridMock(current, resultList.size(), false, current, resultList);
// ColModel colModelStationName = new ColModel("zxzyg", "zxzyg", "正向总有功", "正向总有功", "dataGrid", "zxzyg"); ColModel colModelEventMovement = new ColModel("name", "name", "测量点", "测量点", "dataGrid", "name");
// ColModel colModelEventDesc = new ColModel("fxzyg", "fxzyg", "反向总有功", "反向总有功", "dataGrid", "fxzyg"); ColModel colModelStationName = new ColModel("zxzyg", "zxzyg", "正向总有功", "正向总有功", "dataGrid", "zxzyg");
// ColModel colModelAlarmGroupName = new ColModel("zxzwg", "zxzwg", "正向总无功", "正向总无功", "dataGrid", "zxzwg"); ColModel colModelEventDesc = new ColModel("fxzyg", "fxzyg", "反向总有功", "反向总有功", "dataGrid", "fxzyg");
// ColModel colModelEventTime = new ColModel("fxzwg", "fxzwg", "反向总无功", "反向总无功", "dataGrid", "fxzwg"); ColModel colModelAlarmGroupName = new ColModel("zxzwg", "zxzwg", "正向总无功", "正向总无功", "dataGrid", "zxzwg");
ColModel colModelEventTime = new ColModel("fxzwg", "fxzwg", "反向总无功", "反向总无功", "dataGrid", "fxzwg");
if (null != stationType){
//List<ColModel> listColModel = Arrays.asList(colModelEventMovement, colModelStationName, colModelEventDesc, colModelAlarmGroupName, colModelEventTime); colModelEventMovement = new ColModel("name", "name", "测量点", "测量点", "dataGrid", "name");
ResultsData resultsData = new ResultsData(DataGridMock, listColModels); 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; return resultsData;
} }
public void getAnalogQuantityInfo(String gatewayId, String stationId, String routeName) { public void getAnalogQuantityInfo(String gatewayId, String stationId, String routeName) {
if (StringUtils.isNotEmpty(gatewayId)) { if (StringUtils.isNotEmpty(gatewayId)) {
Map<String, String> map = monitorFanIndicatorregionMapper.getMajorBoosterStationInfoBySort(gatewayId, routeName); Map<String, String> map = monitorFanIndicatorregionMapper.getMajorBoosterStationInfoBySort(gatewayId, routeName);
...@@ -1086,8 +1085,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1086,8 +1085,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
listData.stream().filter(t -> t.getFrontModule().contains("1主变低压侧")).forEach(item -> { listData.stream().filter(t -> t.getFrontModule().contains("1主变低压侧")).forEach(item -> {
HashMap<String, String> zbMap = new HashMap<>(); HashMap<String, String> zbMap = new HashMap<>();
zbMap.put("title", item.getDisplayName()); zbMap.put("title", item.getDisplayName());
zbMap.put("grade1", item.getValue()); zbMap.put("grade1", keepTwoDecimalPlaces(item.getValue()));
zbMap.put("grade2", zbGYC.getOrDefault(item.getDisplayName(), "0.0")); zbMap.put("grade2", keepTwoDecimalPlaces(zbGYC.getOrDefault(item.getDisplayName(), "0.0")));
if (StringUtils.isNotEmpty(item.getUnit())) { if (StringUtils.isNotEmpty(item.getUnit())) {
zbMap.put("title", String.format("%s(%s)", item.getDisplayName(), item.getUnit())); zbMap.put("title", String.format("%s(%s)", item.getDisplayName(), item.getUnit()));
} }
...@@ -1110,7 +1109,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1110,7 +1109,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
listData.forEach(item -> { listData.forEach(item -> {
HashMap<String, String> stringStringHashMap = new HashMap<>(); HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("title", item.getDisplayName()); stringStringHashMap.put("title", item.getDisplayName());
stringStringHashMap.put("value", item.getValue()); stringStringHashMap.put("value", keepTwoDecimalPlaces(item.getValue()));
if (StringUtils.isNotEmpty(item.getUnit())) { if (StringUtils.isNotEmpty(item.getUnit())) {
stringStringHashMap.put("title", String.format("%s(%s)", item.getDisplayName(), item.getUnit())); stringStringHashMap.put("title", String.format("%s(%s)", item.getDisplayName(), item.getUnit()));
} }
...@@ -1396,10 +1395,11 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1396,10 +1395,11 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
photoUrls.put(listDatum.getDisplayName().split("_")[0]+"scxurl",pictureUrl+split1[1]); photoUrls.put(listDatum.getDisplayName().split("_")[0]+"scxurl",pictureUrl+split1[1]);
} }
}else { }else {
if (listDatum.getValue().equals("true")){ if (listDatum.getValue().equals("false")){
url =pictureUrl+ listDatum.getPictureName(); url =pictureUrl+ listDatum.getPictureName().replace("green", "red");
}else { }else {
url =pictureUrl+ listDatum.getPictureName().replace("red", "green"); url =pictureUrl+ listDatum.getPictureName();
} }
photoUrls.put(listDatum.getDisplayName().split("_")[0]+"url",url); photoUrls.put(listDatum.getDisplayName().split("_")[0]+"url",url);
} }
...@@ -1436,13 +1436,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1436,13 +1436,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public HashMap<String, Object> getEquipInfoByEquipNum(String gatewayId ,String equipmentNumber){ public HashMap<String, Object> getEquipInfoByEquipNum(String gatewayId ,String equipmentNumber){
HashMap<String, Object> resultMap = new HashMap<>(); 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); List<IndicatorsDto> list = influxDButils.getListData(sql, IndicatorsDto.class);
if (!ValidationUtil.isEmpty(list)){ if (!ValidationUtil.isEmpty(list)){
resultMap.put("equipmentSpecificName",list.get(0).getEquipmentSpecificName()); resultMap.put("equipmentSpecificName",list.get(0).getEquipmentSpecificName());
resultMap.put("equipmentIndexName",list.get(0).getEquipmentSpecificName()); resultMap.put("equipmentIndexName",list.get(0).getEquipmentSpecificName());
resultMap.put("equipmentInfoName",list.get(0).getEquipmentSpecificName().substring(5).replace("/"," ")); 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; return resultMap;
} }
...@@ -1486,9 +1486,10 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1486,9 +1486,10 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public HashMap<String, Object> SpeedIndicator(String gatewayId ,String equipmentNumber,String equipmentIndexName){ public HashMap<String, Object> SpeedIndicator(String gatewayId ,String equipmentNumber,String equipmentIndexName){
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
String sql = "SELECT * FROM indicators_"+gatewayId+" WHERE equipmentNumber ='"+equipmentNumber +"' and equipmentIndexName = '"+equipmentIndexName+"'"; String sql = "SELECT * FROM indicators_"+gatewayId+" WHERE equipmentNumber ='"+equipmentNumber +"' and equipmentIndexName = '"+equipmentIndexName+"'";
log.info("执行sql"+sql);
List<IndicatorsDto> list = influxDButils.getListData(sql, IndicatorsDto.class); List<IndicatorsDto> list = influxDButils.getListData(sql, IndicatorsDto.class);
if (!ValidationUtil.isEmpty(list)){ 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; return resultMap;
} }
...@@ -1506,12 +1507,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1506,12 +1507,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
HashMap<String, Object> resultMap = new HashMap<>(); HashMap<String, Object> resultMap = new HashMap<>();
collect.get(s).stream().forEach(e->{ collect.get(s).stream().forEach(e->{
String picturl = ""; String picturl = "";
if (e.getValue().equals("true")){ if (e.getValue().equals("false")){
picturl = pictureUrl+"dlg-h-red.png"; picturl = pictureUrl+"dlg-h-red.png";
}else { }else {
picturl = pictureUrl+"dlg-h-green.png"; picturl = pictureUrl+"dlg-h-green.png";
} }
if(e.getEquipmentIndexName().contains("合闸")){ if(e.getEquipmentIndexName().endsWith("断路器合闸")){
resultMap.put(e.getEquipmentIndexName().substring(0,3),picturl); resultMap.put(e.getEquipmentIndexName().substring(0,3),picturl);
}else { }else {
resultMap.put("gy",picturl); resultMap.put("gy",picturl);
...@@ -1537,15 +1538,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1537,15 +1538,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public ResultsData collectingBox(String gatewayId ,int current,int size){ public ResultsData collectingBox(String gatewayId ,int current,int size){
HashMap<String, Object> resultMap = new HashMap<>();
ArrayList<Map<String, Object>> resultList = new ArrayList<>(); ArrayList<Map<String, Object>> resultList = new ArrayList<>();
String sql = "SELECT * FROM indicators_"+gatewayId+" WHERE equipmentIndexName =~/路电流/ "; 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> list = influxDButils.getListData(sql, IndicatorsDto.class);
List<IndicatorsDto> list1 = influxDButils.getListData(sql1, IndicatorsDto.class);
if (!ValidationUtil.isEmpty(list)){ if (!ValidationUtil.isEmpty(list)){
Map<String, List<IndicatorsDto>> collect = list.stream().collect(Collectors.groupingBy(IndicatorsDto::getEquipmentNumber)); Map<String, List<IndicatorsDto>> collect = list.stream().collect(Collectors.groupingBy(IndicatorsDto::getEquipmentNumber));
for (String s : collect.keySet()) { for (String s : collect.keySet()) {
List<IndicatorsDto> indicatorsDtos = collect.get(s); List<IndicatorsDto> indicatorsDtos = collect.get(s);
HashMap<String, Object> resultMap = new HashMap<>();
Double avageValue = 0.0; Double avageValue = 0.0;
avageValue =indicatorsDtos.stream().filter(e -> !ObjectUtils.isEmpty(e.getValue())).mapToDouble(l->Double.parseDouble((String) l.getValue())).average().getAsDouble(); 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)); avageValue = Double.valueOf(String.format("%.2f", avageValue));
...@@ -1554,7 +1557,19 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1554,7 +1557,19 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
resultMap.put("zz","#"+name[0]+"子阵"); resultMap.put("zz","#"+name[0]+"子阵");
resultMap.put("nbq","逆变器"+name[1]); resultMap.put("nbq","逆变器"+name[1]);
resultMap.put("hlx","#"+name[2]+"汇流箱"); 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); resultList.add(resultMap);
} }
} }
...@@ -1571,5 +1586,41 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -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; ...@@ -3,7 +3,6 @@ package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.MapRegion;
import com.yeejoin.amos.boot.module.jxiop.api.entity.Region; import com.yeejoin.amos.boot.module.jxiop.api.entity.Region;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic; import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
...@@ -21,8 +20,8 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -21,8 +20,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import org.unbescape.css.CssIdentifierEscapeLevel;
import java.math.BigDecimal;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
...@@ -218,7 +217,7 @@ public class MonitoringServiceImpl { ...@@ -218,7 +217,7 @@ public class MonitoringServiceImpl {
completionOfPowerIndicatorsDto.setActivePower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "有功功率"))); completionOfPowerIndicatorsDto.setActivePower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "有功功率")));
completionOfPowerIndicatorsDto.setDailyPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "日发电量"))); completionOfPowerIndicatorsDto.setDailyPower(String.valueOf(commonServiceImpl.getTotalByIndicatior(mapList, "日发电量")));
completionOfPowerIndicatorsDto.setMonthlyPower(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 { ...@@ -463,7 +462,7 @@ public class MonitoringServiceImpl {
if (!ObjectUtils.isEmpty(areaName)) { if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName); stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else { } 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())); Map<String, List<StationBasic>> listMap = stationBasicListAll.stream().collect(Collectors.groupingBy(stationBasic -> stationBasic.getStationTypeName()));
listMap.keySet().forEach(key -> { listMap.keySet().forEach(key -> {
...@@ -483,7 +482,7 @@ public class MonitoringServiceImpl { ...@@ -483,7 +482,7 @@ public class MonitoringServiceImpl {
if (!ObjectUtils.isEmpty(areaName)) { if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName); stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else { } else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("station_name")); stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
} }
stationBasicListAll.forEach(stationBasic -> { stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber())); total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber()));
...@@ -500,7 +499,7 @@ public class MonitoringServiceImpl { ...@@ -500,7 +499,7 @@ public class MonitoringServiceImpl {
if (!ObjectUtils.isEmpty(areaName)) { if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName); stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else { } else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("station_name")); stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
} }
stationBasicListAll.forEach(stationBasic -> { stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "有功功率")); total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "有功功率"));
...@@ -526,7 +525,7 @@ public class MonitoringServiceImpl { ...@@ -526,7 +525,7 @@ public class MonitoringServiceImpl {
} else if (!ObjectUtils.isEmpty(areaName)) { } else if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName); stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else { } else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("station_name")); stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
} }
stationBasicListAll.forEach(stationBasic -> { stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "年发电量")); total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "年发电量"));
...@@ -539,7 +538,7 @@ public class MonitoringServiceImpl { ...@@ -539,7 +538,7 @@ public class MonitoringServiceImpl {
if (!ObjectUtils.isEmpty(areaName)) { if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName); stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else { } 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); AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
...@@ -548,7 +547,7 @@ public class MonitoringServiceImpl { ...@@ -548,7 +547,7 @@ public class MonitoringServiceImpl {
}); });
HashMap<String, List<String>> hashMap = new HashMap<>(); HashMap<String, List<String>> hashMap = new HashMap<>();
List<String> xList = getXListofRecentOneYear(); 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("axisData", xList);
hashMap.put("seriesData", yList); hashMap.put("seriesData", yList);
return hashMap; return hashMap;
...@@ -606,7 +605,7 @@ public class MonitoringServiceImpl { ...@@ -606,7 +605,7 @@ public class MonitoringServiceImpl {
if (!ObjectUtils.isEmpty(areaName)) { if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName); stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else { } 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); AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
...@@ -615,7 +614,7 @@ public class MonitoringServiceImpl { ...@@ -615,7 +614,7 @@ public class MonitoringServiceImpl {
}); });
HashMap<String, List<String>> hashMap = new HashMap<>(); HashMap<String, List<String>> hashMap = new HashMap<>();
List<String> xList = getXListofRecentOneYear(); 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("axisData", xList);
hashMap.put("seriesData", yList); hashMap.put("seriesData", yList);
return hashMap; return hashMap;
...@@ -627,7 +626,7 @@ public class MonitoringServiceImpl { ...@@ -627,7 +626,7 @@ public class MonitoringServiceImpl {
if (!ObjectUtils.isEmpty(areaName)) { if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName); stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else { } 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<>(); HashMap<String, List<String>> hashMap = new HashMap<>();
List<String> xList = new ArrayList<>(); List<String> xList = new ArrayList<>();
...@@ -635,9 +634,9 @@ public class MonitoringServiceImpl { ...@@ -635,9 +634,9 @@ public class MonitoringServiceImpl {
//月发电量 //月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0); AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
stationBasicListAll.forEach(stationBasic -> { 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 -> { sorted.forEach(stationBasic -> {
xList.add(stationBasic.getStationName()); xList.add(stationBasic.getStationName());
yList.add(stationBasic.getAddress()); yList.add(stationBasic.getAddress());
...@@ -648,7 +647,7 @@ public class MonitoringServiceImpl { ...@@ -648,7 +647,7 @@ public class MonitoringServiceImpl {
} }
public List<String> getXListofRecentOneYear(){ public List<String> getXListofRecentOneYear() {
List<String> xList = new ArrayList<>(); List<String> xList = new ArrayList<>();
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
Date date = new Date(); Date date = new Date();
...@@ -661,60 +660,60 @@ public class MonitoringServiceImpl { ...@@ -661,60 +660,60 @@ public class MonitoringServiceImpl {
} }
public Page<HashMap<String,String>> getPowerGenerationTrendsOfCompletionTopThree(String tabValue,String areaName){ public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopThree(String tabValue, String areaName) {
Page<HashMap<String,String>> page = new Page<>(1,3); Page<HashMap<String, String>> page = new Page<>(1, 3);
List<HashMap<String,String>> mapList= new ArrayList<>(); List<HashMap<String, String>> mapList = new ArrayList<>();
List<StationBasic> stationBasicListAll = new ArrayList<>(); List<StationBasic> stationBasicListAll = new ArrayList<>();
List<StationBasic> fdzList = new ArrayList<>(); List<StationBasic> fdzList = new ArrayList<>();
List<StationBasic> gfdzlist = new ArrayList<>(); List<StationBasic> gfdzlist = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) { if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName); stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else { } else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("station_name")); stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
} }
String indicator = "日发电量"; String indicator = "日发电量";
if(tabValue.equals(1)){ if (tabValue.equals(1)) {
indicator="月发电量"; indicator = "月发电量";
}else{ } else {
indicator="年发电量"; indicator = "年发电量";
} }
//填写发电小时数 //填写发电小时数
String finalIndicator = indicator; String finalIndicator = indicator;
stationBasicListAll.forEach(stationBasic -> { stationBasicListAll.forEach(stationBasic -> {
Double install=getStationCaPACITYL(stationBasic.getStationNumber()); Double install = getStationCaPACITYL(stationBasic.getStationNumber());
Double total =commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), finalIndicator); Double total = commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), finalIndicator);
stationBasic.setAddress(String.format("%.2f",total)); stationBasic.setAddress(String.format("%.2f", total));
if(stationBasic.getStationType().equals("FDZ")){ if (stationBasic.getStationType().equals("FDZ")) {
stationBasic.setAddress(String.format("%.2f",total/100/install)); stationBasic.setAddress(String.format("%.2f", total / 100 / install));
}else { } else {
stationBasic.setAddress(String.format("%.2f",total/1000000/install)); stationBasic.setAddress(String.format("%.2f", total / 1000000 / install));
} }
if(stationBasic.getAddress().equals("NaN")){ if (stationBasic.getAddress().equals("NaN")) {
stationBasic.setAddress("0.00"); 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()); 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()); 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++) { for (int i = 0; i < 3; i++) {
HashMap<String,String> stringHashMap= new HashMap<>(); HashMap<String, String> stringHashMap = new HashMap<>();
stringHashMap.put("sortNumber",String.valueOf(i+1)); stringHashMap.put("sortNumber", String.valueOf(i + 1));
StationBasic stationBasic =new StationBasic(); StationBasic stationBasic = new StationBasic();
if(i<(fdzList.size())){ if (i < (fdzList.size())) {
stationBasic = fdzList.get(i); stationBasic = fdzList.get(i);
stringHashMap.put("stationName1",stationBasic.getStationName()); stringHashMap.put("stationName1", stationBasic.getStationName());
stringHashMap.put("hours1",stationBasic.getAddress()+"h"); stringHashMap.put("hours1", stationBasic.getAddress() + "h");
}else { } else {
stringHashMap.put("stationName1",""); stringHashMap.put("stationName1", "");
stringHashMap.put("hours1",""); stringHashMap.put("hours1", "");
} }
if(i<(gfdzlist.size())){ if (i < (gfdzlist.size())) {
stationBasic = gfdzlist.get(i); stationBasic = gfdzlist.get(i);
stringHashMap.put("stationName2",stationBasic.getStationName()); stringHashMap.put("stationName2", stationBasic.getStationName());
stringHashMap.put("hours2",stationBasic.getAddress()+"h"); stringHashMap.put("hours2", stationBasic.getAddress() + "h");
}else { } else {
stringHashMap.put("stationName2",""); stringHashMap.put("stationName2", "");
stringHashMap.put("hours2",""); stringHashMap.put("hours2", "");
} }
mapList.add(stringHashMap); mapList.add(stringHashMap);
} }
...@@ -722,4 +721,123 @@ public class MonitoringServiceImpl { ...@@ -722,4 +721,123 @@ public class MonitoringServiceImpl {
//组装数据 //组装数据
return page; 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