|
@@ -18,10 +18,7 @@ import com.cpp.web.domain.enums.DataSourcesEnum;
|
|
import com.cpp.web.domain.enums.ForecastTypeEnum;
|
|
import com.cpp.web.domain.enums.ForecastTypeEnum;
|
|
import com.cpp.web.domain.enums.RegulationStatusEnum;
|
|
import com.cpp.web.domain.enums.RegulationStatusEnum;
|
|
import com.cpp.web.domain.enums.UploadStatusEnum;
|
|
import com.cpp.web.domain.enums.UploadStatusEnum;
|
|
-import com.cpp.web.domain.regulation.TempShortRegulation;
|
|
|
|
-import com.cpp.web.domain.regulation.TempShortRegulationDetail;
|
|
|
|
-import com.cpp.web.domain.regulation.TempShortUsual;
|
|
|
|
-import com.cpp.web.domain.regulation.TempShortUsualDetail;
|
|
|
|
|
|
+import com.cpp.web.domain.regulation.*;
|
|
import com.cpp.web.domain.station.ElectricField;
|
|
import com.cpp.web.domain.station.ElectricField;
|
|
import com.cpp.web.domain.station.ForecastPowerShortTermRegulation;
|
|
import com.cpp.web.domain.station.ForecastPowerShortTermRegulation;
|
|
import com.cpp.web.domain.station.ForecastPowerShortTermStation;
|
|
import com.cpp.web.domain.station.ForecastPowerShortTermStation;
|
|
@@ -29,10 +26,7 @@ import com.cpp.web.domain.station.InverterStatusData;
|
|
import com.cpp.web.dto.TempShortRegulationDto;
|
|
import com.cpp.web.dto.TempShortRegulationDto;
|
|
import com.cpp.web.service.accuracy.AccuracyPassRateService;
|
|
import com.cpp.web.service.accuracy.AccuracyPassRateService;
|
|
import com.cpp.web.service.cloud.ForecastPowerShortTermCloudService;
|
|
import com.cpp.web.service.cloud.ForecastPowerShortTermCloudService;
|
|
-import com.cpp.web.service.regulation.TempShortRegulationDetailService;
|
|
|
|
-import com.cpp.web.service.regulation.TempShortRegulationService;
|
|
|
|
-import com.cpp.web.service.regulation.TempShortUsualDetailService;
|
|
|
|
-import com.cpp.web.service.regulation.TempShortUsualService;
|
|
|
|
|
|
+import com.cpp.web.service.regulation.*;
|
|
import com.cpp.web.service.station.ElectricFieldService;
|
|
import com.cpp.web.service.station.ElectricFieldService;
|
|
import com.cpp.web.service.station.ForecastPowerShortTermRegulationService;
|
|
import com.cpp.web.service.station.ForecastPowerShortTermRegulationService;
|
|
import com.cpp.web.service.station.ForecastPowerShortTermStationService;
|
|
import com.cpp.web.service.station.ForecastPowerShortTermStationService;
|
|
@@ -78,7 +72,8 @@ public class DqRegulationController {
|
|
ForecastPowerShortTermRegulationService forecastPowerShortTermRegulationService;
|
|
ForecastPowerShortTermRegulationService forecastPowerShortTermRegulationService;
|
|
@Autowired
|
|
@Autowired
|
|
ForecastPowerShortTermCloudService forecastPowerShortTermCloudService;
|
|
ForecastPowerShortTermCloudService forecastPowerShortTermCloudService;
|
|
-
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ TempShortRegulationDfService tempShortRegulationDfService;
|
|
|
|
|
|
|
|
|
|
@GetMapping("/queryData")
|
|
@GetMapping("/queryData")
|
|
@@ -150,6 +145,20 @@ public class DqRegulationController {
|
|
List<BigDecimal> refUpList = new ArrayList<>();
|
|
List<BigDecimal> refUpList = new ArrayList<>();
|
|
// 参考下限短期
|
|
// 参考下限短期
|
|
List<BigDecimal> refDownList = new ArrayList<>();
|
|
List<BigDecimal> refDownList = new ArrayList<>();
|
|
|
|
+ // 获取电力交易调控数据
|
|
|
|
+ QueryWrapper<TempShortRegulationDf> tempShortRegulationDfQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ tempShortRegulationDfQueryWrapper.eq("station_code", stationCode);
|
|
|
|
+ tempShortRegulationDfQueryWrapper.eq("tk_date", DateTimeUtil.getDayStartTime(System.currentTimeMillis()));
|
|
|
|
+ tempShortRegulationDfQueryWrapper.eq("forecast_date", new Date(time));
|
|
|
|
+ tempShortRegulationDfQueryWrapper.between("time", new Date(time), new Date(endTime));
|
|
|
|
+ List<TempShortRegulationDf> tempShortRegulationDfList = tempShortRegulationDfService.list(tempShortRegulationDfQueryWrapper);
|
|
|
|
+ Map<Long, BigDecimal> dljyTkDataMap = new HashMap<>();
|
|
|
|
+ for (TempShortRegulationDf tempShortRegulationDf:tempShortRegulationDfList) {
|
|
|
|
+ dljyTkDataMap.putIfAbsent(tempShortRegulationDf.getTime().getTime(), tempShortRegulationDf.getTkValue());
|
|
|
|
+ }
|
|
|
|
+ // 电力交易调控数据
|
|
|
|
+ List<BigDecimal> dljyTkDataList = new ArrayList<>();
|
|
|
|
+
|
|
ElectricField electricField = electricFieldService.findByStationCode(stationCode);
|
|
ElectricField electricField = electricFieldService.findByStationCode(stationCode);
|
|
Long momentTime = 15 * 60 * 1000L;
|
|
Long momentTime = 15 * 60 * 1000L;
|
|
for (Long tempTime = time; tempTime <= endTime; tempTime = tempTime + momentTime) {
|
|
for (Long tempTime = time; tempTime <= endTime; tempTime = tempTime + momentTime) {
|
|
@@ -201,6 +210,13 @@ public class DqRegulationController {
|
|
listAfter.add(null);
|
|
listAfter.add(null);
|
|
}
|
|
}
|
|
tkDataList.add(listAfter);
|
|
tkDataList.add(listAfter);
|
|
|
|
+
|
|
|
|
+ if (dljyTkDataMap.get(tempTime)!=null){
|
|
|
|
+ dljyTkDataList.add(dljyTkDataMap.get(tempTime));
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ dljyTkDataList.add(null);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
// 原始值
|
|
// 原始值
|
|
map.put("ysData",ysList);
|
|
map.put("ysData",ysList);
|
|
@@ -212,9 +228,9 @@ public class DqRegulationController {
|
|
map.put("tempShortRegulationList",tempList);
|
|
map.put("tempShortRegulationList",tempList);
|
|
// 页面调控曲线数值
|
|
// 页面调控曲线数值
|
|
map.put("tkDataList",tkDataList);
|
|
map.put("tkDataList",tkDataList);
|
|
-
|
|
|
|
-
|
|
|
|
map.put("electricField",electricField);
|
|
map.put("electricField",electricField);
|
|
|
|
+ // 电力交易曲线数值
|
|
|
|
+ map.put("dljyTkDataList",dljyTkDataList);
|
|
|
|
|
|
return R.ok(map);
|
|
return R.ok(map);
|
|
}
|
|
}
|
|
@@ -227,6 +243,31 @@ public class DqRegulationController {
|
|
public R updateDqRegulation(@RequestBody List<TempShortRegulationDto> tempShortRegulationDtoList) {
|
|
public R updateDqRegulation(@RequestBody List<TempShortRegulationDto> tempShortRegulationDtoList) {
|
|
// 先删除调控明细表中已有的数据
|
|
// 先删除调控明细表中已有的数据
|
|
TempShortRegulationDto tempShortRegulationDto = tempShortRegulationDtoList.get(0);
|
|
TempShortRegulationDto tempShortRegulationDto = tempShortRegulationDtoList.get(0);
|
|
|
|
+ // 调控主表是否存在
|
|
|
|
+ QueryWrapper<TempShortRegulation> tempShortRegulationQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ tempShortRegulationQueryWrapper.eq("station_code", tempShortRegulationDto.getStationCode());
|
|
|
|
+ tempShortRegulationQueryWrapper.eq("forecast_date", tempShortRegulationDto.getForecastDate());
|
|
|
|
+ tempShortRegulationQueryWrapper.eq("tk_date", DateTimeUtil.getDayStartTime(System.currentTimeMillis()));
|
|
|
|
+ List<TempShortRegulation> tempShortRegulationList = tempShortRegulationService.list(tempShortRegulationQueryWrapper);
|
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
|
+ TempShortRegulation tempShortRegulation = null;
|
|
|
|
+ if (tempShortRegulationList.isEmpty()) {
|
|
|
|
+ // 不存在就插入一条调控主表
|
|
|
|
+ tempShortRegulation = new TempShortRegulation();
|
|
|
|
+ tempShortRegulation.setStationCode(tempShortRegulationDto.getStationCode());
|
|
|
|
+ tempShortRegulation.setForecastDate(tempShortRegulationDto.getForecastDate());
|
|
|
|
+ tempShortRegulation.setTkDate(tempShortRegulationDto.getTkDate());
|
|
|
|
+ tempShortRegulation.setCreateBy(loginUser.getUsername());
|
|
|
|
+ // 设置未下发
|
|
|
|
+ tempShortRegulation.setRegulationStatusEnum(RegulationStatusEnum.E2.name());
|
|
|
|
+ // 设置未回传
|
|
|
|
+ tempShortRegulation.setUploadStatusEnum(UploadStatusEnum.E3.name());
|
|
|
|
+ tempShortRegulationService.save(tempShortRegulation);
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ tempShortRegulation = tempShortRegulationList.get(0);
|
|
|
|
+ }
|
|
|
|
+
|
|
// 调控的预测日期
|
|
// 调控的预测日期
|
|
Date forecastDate = tempShortRegulationDto.getForecastDate();
|
|
Date forecastDate = tempShortRegulationDto.getForecastDate();
|
|
Date startTime = DateTimeUtil.getDayStartTime(forecastDate.getTime());
|
|
Date startTime = DateTimeUtil.getDayStartTime(forecastDate.getTime());
|
|
@@ -237,26 +278,6 @@ public class DqRegulationController {
|
|
tempShortRegulationDetailQueryWrapper.eq("tk_date", DateTimeUtil.getDayStartTime(System.currentTimeMillis()));
|
|
tempShortRegulationDetailQueryWrapper.eq("tk_date", DateTimeUtil.getDayStartTime(System.currentTimeMillis()));
|
|
tempShortRegulationDetailQueryWrapper.between("time", startTime, endTime);
|
|
tempShortRegulationDetailQueryWrapper.between("time", startTime, endTime);
|
|
tempShortRegulationDetailService.remove(tempShortRegulationDetailQueryWrapper);
|
|
tempShortRegulationDetailService.remove(tempShortRegulationDetailQueryWrapper);
|
|
- // 删除调控主表
|
|
|
|
- QueryWrapper<TempShortRegulation> tempShortRegulationQueryWrapper = new QueryWrapper<>();
|
|
|
|
- tempShortRegulationQueryWrapper.eq("station_code", tempShortRegulationDto.getStationCode());
|
|
|
|
- tempShortRegulationQueryWrapper.eq("forecast_date", tempShortRegulationDto.getForecastDate());
|
|
|
|
- tempShortRegulationQueryWrapper.eq("tk_date", DateTimeUtil.getDayStartTime(System.currentTimeMillis()));
|
|
|
|
- tempShortRegulationService.remove(tempShortRegulationQueryWrapper);
|
|
|
|
-
|
|
|
|
- LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
|
- // 插入调控主表
|
|
|
|
- TempShortRegulation tempShortRegulation = new TempShortRegulation();
|
|
|
|
- tempShortRegulation.setStationCode(tempShortRegulationDto.getStationCode());
|
|
|
|
- tempShortRegulation.setForecastDate(tempShortRegulationDto.getForecastDate());
|
|
|
|
- tempShortRegulation.setTkDate(tempShortRegulationDto.getTkDate());
|
|
|
|
- tempShortRegulation.setCreateBy(loginUser.getUsername());
|
|
|
|
- // 设置未下发
|
|
|
|
- tempShortRegulation.setRegulationStatusEnum(RegulationStatusEnum.E2.name());
|
|
|
|
- // 设置未回传
|
|
|
|
- tempShortRegulation.setUploadStatusEnum(UploadStatusEnum.E3.name());
|
|
|
|
- tempShortRegulationService.save(tempShortRegulation);
|
|
|
|
-
|
|
|
|
// 封装新的调控明细插入数据
|
|
// 封装新的调控明细插入数据
|
|
List<TempShortRegulationDetail> tempShortRegulationDetailList = new ArrayList<>();
|
|
List<TempShortRegulationDetail> tempShortRegulationDetailList = new ArrayList<>();
|
|
for (TempShortRegulationDto tempShortRegulationDto1 : tempShortRegulationDtoList) {
|
|
for (TempShortRegulationDto tempShortRegulationDto1 : tempShortRegulationDtoList) {
|
|
@@ -275,8 +296,6 @@ public class DqRegulationController {
|
|
tempShortRegulationDetailList.add(tempShortRegulationDetail);
|
|
tempShortRegulationDetailList.add(tempShortRegulationDetail);
|
|
}
|
|
}
|
|
tempShortRegulationDetailService.saveBatch(tempShortRegulationDetailList);
|
|
tempShortRegulationDetailService.saveBatch(tempShortRegulationDetailList);
|
|
-
|
|
|
|
-
|
|
|
|
return R.ok();
|
|
return R.ok();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -476,11 +495,49 @@ public class DqRegulationController {
|
|
ysLineList.add(tempShortRegulationDetail.getYsValue());
|
|
ysLineList.add(tempShortRegulationDetail.getYsValue());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ boolean ysSource = false;
|
|
|
|
+ if (ysLineList.isEmpty()){
|
|
|
|
+ ysSource = true;
|
|
|
|
+ }
|
|
|
|
+ // 定义电力交易曲线数据
|
|
|
|
+ QueryWrapper<TempShortRegulationDf> tempShortRegulationDfQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ tempShortRegulationDfQueryWrapper.eq("station_code", stationCode);
|
|
|
|
+ tempShortRegulationDfQueryWrapper.eq("tk_date", DateUtil.parse(tkDate, "yyyy-MM-dd"));
|
|
|
|
+ tempShortRegulationDfQueryWrapper.eq("forecast_date", DateUtil.parse(forecastDate, "yyyy-MM-dd"));
|
|
|
|
+ List<TempShortRegulationDf> tempShortRegulationDfList = tempShortRegulationDfService.list(tempShortRegulationDfQueryWrapper);
|
|
|
|
+ List<BigDecimal> dljyLineList = new ArrayList<>();
|
|
|
|
+ if (tempShortRegulationDfList.size()>0){
|
|
|
|
+ // 先按预测时间排序
|
|
|
|
+ tempShortRegulationDfList.sort(Comparator.comparing(TempShortRegulationDf::getTime));
|
|
|
|
+ for (TempShortRegulationDf tempShortRegulationDf:tempShortRegulationDfList){
|
|
|
|
+ // 电力交易调控曲线数据封装
|
|
|
|
+ dljyLineList.add(tempShortRegulationDf.getTkValue());
|
|
|
|
+ if (ysSource){
|
|
|
|
+ // 由于电力交易进行调控,但集中侧没有调控,所以为了页面展示效果,将原始、集中侧调控的列表和曲线默认赋值
|
|
|
|
+ ysLineList.add(tempShortRegulationDf.getYsValue());
|
|
|
|
+ // 调控曲线数据封装
|
|
|
|
+ tkLineList.add(tempShortRegulationDf.getYsValue());
|
|
|
|
+ TempShortRegulationDto tempShortRegulationDto = new TempShortRegulationDto();
|
|
|
|
+ tempShortRegulationDto.setTime(DateUtils.parseDateToStr("HH:mm",tempShortRegulationDf.getTime()));
|
|
|
|
+ tempShortRegulationDto.setForecastDate(tempShortRegulationDf.getForecastDate());
|
|
|
|
+ tempShortRegulationDto.setTkDate(tempShortRegulationDf.getTkDate());
|
|
|
|
+ tempShortRegulationDto.setYsValue(tempShortRegulationDf.getYsValue());
|
|
|
|
+ tempShortRegulationDto.setTkValue(tempShortRegulationDf.getYsValue());
|
|
|
|
+ tempShortRegulationDto.setSz(new BigDecimal("0"));
|
|
|
|
+ tempShortRegulationDto.setXs(new BigDecimal("1"));
|
|
|
|
+ tempShortRegulationDto.setStationCode(stationCode);
|
|
|
|
+ detailList.add(tempShortRegulationDto);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
// 弹出框明细列表
|
|
// 弹出框明细列表
|
|
map.put("detailList",detailList);
|
|
map.put("detailList",detailList);
|
|
map.put("tkLineList",tkLineList);
|
|
map.put("tkLineList",tkLineList);
|
|
map.put("ysLineList",ysLineList);
|
|
map.put("ysLineList",ysLineList);
|
|
|
|
+ map.put("dljyLineList",dljyLineList);
|
|
// 获取上报曲线数据
|
|
// 获取上报曲线数据
|
|
long time = DateUtil.parse(forecastDate, "yyyy-MM-dd").getTime();
|
|
long time = DateUtil.parse(forecastDate, "yyyy-MM-dd").getTime();
|
|
Date startForecastTime = DateTimeUtil.getDayStartTime(time);
|
|
Date startForecastTime = DateTimeUtil.getDayStartTime(time);
|