Commit 572a7608 authored by caotao's avatar caotao

监盘接口调整

parent 6077209c
...@@ -158,4 +158,11 @@ public class MonitoringMapController extends BaseController { ...@@ -158,4 +158,11 @@ public class MonitoringMapController extends BaseController {
public void getTotalData() { public void getTotalData() {
monitoringServiceImpl.getTotalData(); monitoringServiceImpl.getTotalData();
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(value = "运行监盘-功率曲线")
@GetMapping("/getTheStationPowerCurve")
public ResponseModel<HashMap<String, Object>> getTheStationPowerCurve(@RequestParam(required = false)String stationId,@RequestParam(required = false)String date) {
return ResponseHelper.buildResponse(monitoringServiceImpl.getTheStationPowerCurve(stationId,date));
}
} }
...@@ -13,6 +13,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper; ...@@ -13,6 +13,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationCoordinateMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationCoordinateMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.*; import com.yeejoin.amos.boot.module.jxiop.biz.dto.*;
import com.yeejoin.amos.component.influxdb.InfluxdbUtil; import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import lombok.Data;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -300,7 +301,7 @@ public class MonitoringServiceImpl { ...@@ -300,7 +301,7 @@ public class MonitoringServiceImpl {
} }
completionRatioDto.setUnit("%"); completionRatioDto.setUnit("%");
SocialContributionDto useHoursDto = new SocialContributionDto(); SocialContributionDto useHoursDto = new SocialContributionDto();
useHoursDto.setTitle(String.format("%.2f", annualPower.get()/installCapacity.get())); useHoursDto.setTitle(String.format("%.2f", annualPower.get() / installCapacity.get()));
useHoursDto.setUnit("h"); useHoursDto.setUnit("h");
socialContributionDtoList.add(dailyPowerdto); socialContributionDtoList.add(dailyPowerdto);
socialContributionDtoList.add(monthlyPowerdto); socialContributionDtoList.add(monthlyPowerdto);
...@@ -956,4 +957,95 @@ public class MonitoringServiceImpl { ...@@ -956,4 +957,95 @@ public class MonitoringServiceImpl {
}); });
return hashMapList; return hashMapList;
} }
// const data = {
// xData: [],
// 实时有功: {
// title: '实时有功 2023-06-14 29.3',
// yData: []
// },
// footerList: [
// {
// title: '谷值:',
// value1: '-010',
// value2: '2.14',
// value3: '2.14'
// }
// ]
// };
public HashMap<String, Object> getTheStationPowerCurve(String stationId,String date) {
HashMap<String, Object> result = new HashMap<>();
List<HashMap<String, Object>> hashMapList = new ArrayList<>();
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
//x轴数据
List<String> xdata = new ArrayList<>();
//实时有功功率
List<String> currentPowerYdata = new ArrayList<>();
//短期功率预测
List<String> shortPowerYdata = new ArrayList<>();
//超短期功率预测
List<String> superPowerShortYdata = new ArrayList<>();
for (int i = 0; i < 25; i++) {
xdata.add(String.format("%02d", i) + ":00");
currentPowerYdata.add(String.format("%.2f", Math.random() * 30.0));
shortPowerYdata.add(String.format("%.2f", Math.random() * 40.0));
superPowerShortYdata.add(String.format("%.2f", Math.random() * 35.0));
}
result.put("xData", xdata);
HashMap<String, Object> currentPowerHashMap = new HashMap<>();
currentPowerHashMap.put("title", "实时有功 " +date);
currentPowerHashMap.put("yData", currentPowerYdata);
result.put("currentPower", currentPowerHashMap);
HashMap<String, Object> shortPowerHashMap = new HashMap<>();
shortPowerHashMap.put("title", "短期功率预测 "+date);
shortPowerHashMap.put("yData", currentPowerYdata);
result.put("shortPower", shortPowerHashMap);
HashMap<String, Object> superShortPowerHashMap = new HashMap<>();
superShortPowerHashMap.put("title", "超短期功率预测 "+ date);
superShortPowerHashMap.put("yData", currentPowerYdata);
result.put("superShortPower", superShortPowerHashMap);
HashMap<String, Object> footerList = new HashMap<>();
String currentMin = String.format("%.2f",currentPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String shortMin = String.format("%.2f",shortPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String supreMin = String.format("%.2f",superPowerShortYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
List<String> gz = new ArrayList<>();
List<String> sj1 = new ArrayList<>();
gz.add(currentMin);
sj1.add(xdata.get(currentPowerYdata.indexOf(currentMin)));
gz.add(shortMin);
sj1.add(xdata.get(shortPowerYdata.indexOf(shortMin)));
gz.add(supreMin);
sj1.add(xdata.get(superPowerShortYdata.indexOf(supreMin)));
String currentMax = String.format("%.2f",currentPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String shortMax = String.format("%.2f",shortPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String supreMax = String.format("%.2f",superPowerShortYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
List<String> zdz = new ArrayList<>();
List<String> sj2 = new ArrayList<>();
zdz.add(currentMax);
zdz.add(shortMax);
zdz.add(supreMax);
sj2.add(xdata.get(currentPowerYdata.indexOf(currentMax)));
sj2.add(xdata.get(shortPowerYdata.indexOf(shortMax)));
sj2.add(xdata.get(superPowerShortYdata.indexOf(supreMax)));
String currentAvg = currentPowerYdata.stream().mapToDouble(Double::parseDouble).average().toString();
String shortAvg = shortPowerYdata.stream().mapToDouble(Double::parseDouble).average().toString();
String supreAvg = superPowerShortYdata.stream().mapToDouble(Double::parseDouble).average().toString();
List<String> pjz = new ArrayList<>();
List<String> fjl = new ArrayList<>();
pjz.add(currentAvg);
pjz.add(shortAvg);
pjz.add(supreAvg);
fjl = Arrays.asList("0.68", "0.89", "0.56");
footerList.put("gz", gz);
footerList.put("sj1", sj1);
footerList.put("zdz", zdz);
footerList.put("sj2", sj2);
footerList.put("pjz", pjz);
footerList.put("fjl", fjl);
result.put("footerList", footerList);
return result;
}
} }
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