有功功率趋势
This commit is contained in:
@@ -14,11 +14,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 有功功率趋势 前端控制器
|
||||
@@ -45,11 +41,11 @@ public class RActivePowerRangeController extends BaseController {
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.QUERY)
|
||||
@PostMapping("/getDataByLineIds")
|
||||
@ApiOperation("根据监测点ID集合获取有功功率趋势信息")
|
||||
public HttpResult<List<RActivePowerRangePO>> getDataByLineIds(@RequestBody List<String> lineIds) {
|
||||
String methodDescribe = getMethodDescribe("getDataByLineIds");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rActivePowerRangeService.getDataByLineIds(lineIds), methodDescribe);
|
||||
@GetMapping("/getDataByLineId")
|
||||
@ApiOperation("根据监测点ID获取有功功率趋势信息")
|
||||
public HttpResult<RActivePowerRangePO> getDataByLineId(@RequestParam("lineId") String lineId) {
|
||||
String methodDescribe = getMethodDescribe("getDataByLineId");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rActivePowerRangeService.getDataByLineId(lineId), methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,30 @@
|
||||
package com.njcn.prepare.harmonic.service.mysql.Impl.event;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.excel.util.DateUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||
import com.njcn.device.biz.commApi.CommLineClient;
|
||||
import com.njcn.device.biz.pojo.dto.LineDTO;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.pq.api.NewStationClient;
|
||||
import com.njcn.device.pq.api.OverLimitClient;
|
||||
import com.njcn.device.pq.pojo.po.NewStation;
|
||||
import com.njcn.event.pojo.constant.Param;
|
||||
import com.njcn.influx.pojo.po.DataHarmPowerP;
|
||||
import com.njcn.influx.pojo.po.DataV;
|
||||
import com.njcn.influx.service.CommonService;
|
||||
import com.njcn.influx.service.DataHarmPowerPService;
|
||||
import com.njcn.influx.service.IDataVService;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.event.RActivePowerRangeMapper;
|
||||
import com.njcn.prepare.harmonic.pojo.po.RActivePowerRangePO;
|
||||
import com.njcn.prepare.harmonic.service.mysql.event.RActivePowerRangeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 有功功率趋势 服务实现类
|
||||
@@ -13,15 +32,98 @@ import java.util.List;
|
||||
* @since 2024-08-22
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RActivePowerRangeServiceImpl extends MppServiceImpl<RActivePowerRangeMapper, RActivePowerRangePO> implements RActivePowerRangeService {
|
||||
|
||||
private final DataHarmPowerPService dataHarmPowerPService;
|
||||
|
||||
private final CommLineClient commLineClient;
|
||||
|
||||
private final NewStationClient newStationClient;
|
||||
|
||||
private final OverLimitClient overLimitClient;
|
||||
|
||||
private final IDataVService iDataVService;
|
||||
|
||||
CommonService commonService;
|
||||
|
||||
@Override
|
||||
public void record() {
|
||||
//根据事件间隔查询 SELECT * FROM "data_harmpower_p" limit 1 得到P
|
||||
// 便利 用p / 风电场额定有功功率 * 100% 看落在那个占比
|
||||
List<RActivePowerRangePO> rActivePowerRangePOS = new ArrayList<>();
|
||||
//定义开始和结束时间
|
||||
String startTime = getTime(1,0);
|
||||
String endTime = getTime(1,1);
|
||||
//获取时间段内的有功功率集合
|
||||
List<DataHarmPowerP> dataHarmPowerPS = dataHarmPowerPService.getHarmonicPowerP("",startTime,endTime);
|
||||
//有功功率趋势表是按照监测点来划分的 所以这边需要根据监测点来分组
|
||||
Map<String,List<DataHarmPowerP>> map = dataHarmPowerPS.stream().collect(Collectors.groupingBy(DataHarmPowerP::getLineId));
|
||||
map.forEach((key,value) ->{
|
||||
RActivePowerRangePO rActivePowerRangePO = new RActivePowerRangePO();
|
||||
rActivePowerRangePO.setId(IdUtil.simpleUUID());
|
||||
rActivePowerRangePO.setLineId(key);
|
||||
rActivePowerRangePO.setTimeId(LocalDate.now());
|
||||
//获取监测点的国标限值
|
||||
List<Overlimit> overlimits = overLimitClient.getOverLimitByLineIds(Arrays.asList(key)).getData();
|
||||
//获取监测点
|
||||
LineDTO lineDTO = commLineClient.getLineDetail(key).getData();
|
||||
if(lineDTO != null && lineDTO.getNewStationId() != null){
|
||||
NewStation newStation = newStationClient.selectById(lineDTO.getNewStationId()).getData();
|
||||
//风电场
|
||||
if(newStation != null && com.njcn.device.pq.constant.Param.WINDFARM.equals(newStation.getStationType())){
|
||||
//计算各个区间个数
|
||||
for(DataHarmPowerP dataHarmPowerP : value){
|
||||
double temp = dataHarmPowerP.getP() / Double.parseDouble(newStation.getRatedPower());
|
||||
if(temp <= 0.1){
|
||||
rActivePowerRangePO.setMinsNum0(rActivePowerRangePO.getMinsNum0() + 1);
|
||||
}else if(0.1 < temp && temp <= 0.2){
|
||||
rActivePowerRangePO.setMinsNum1(rActivePowerRangePO.getMinsNum1() + 1);
|
||||
}else if(0.2 < temp && temp <= 0.3){
|
||||
rActivePowerRangePO.setMinsNum2(rActivePowerRangePO.getMinsNum2() + 1);
|
||||
}else if(0.3 < temp && temp <= 0.4){
|
||||
rActivePowerRangePO.setMinsNum3(rActivePowerRangePO.getMinsNum3() + 1);
|
||||
}else if(0.4 < temp && temp <= 0.5){
|
||||
rActivePowerRangePO.setMinsNum4(rActivePowerRangePO.getMinsNum4() + 1);
|
||||
}else if(0.5 < temp && temp <= 0.6){
|
||||
rActivePowerRangePO.setMinsNum5(rActivePowerRangePO.getMinsNum5() + 1);
|
||||
}else if(0.6 < temp && temp <= 0.7){
|
||||
rActivePowerRangePO.setMinsNum6(rActivePowerRangePO.getMinsNum6() + 1);
|
||||
}else if(0.7 < temp && temp <= 0.8){
|
||||
rActivePowerRangePO.setMinsNum7(rActivePowerRangePO.getMinsNum7() + 1);
|
||||
}else if(0.8 < temp && temp <= 0.9){
|
||||
rActivePowerRangePO.setMinsNum8(rActivePowerRangePO.getMinsNum8() + 1);
|
||||
}else if(temp > 0.9){
|
||||
rActivePowerRangePO.setMinsNum9(rActivePowerRangePO.getMinsNum9() + 1);
|
||||
}
|
||||
}
|
||||
//计算各个区间是否越限
|
||||
//电压偏差
|
||||
List<DataV> dataVS = iDataVService.getHarmonicDataV(key,startTime,endTime);
|
||||
for(DataV dataV : dataVS){
|
||||
if(dataV.getVuDev() > 0 && dataV.getVuDev() > overlimits.get(0).getVoltageDev()){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String getTime(long interval,int type){
|
||||
DateTimeFormatter sdf = DateTimeFormatter.ofPattern(DateUtils.DATE_FORMAT_10);
|
||||
LocalDate yesterday = LocalDate.now().minusDays(interval);
|
||||
if(type == 0){
|
||||
return yesterday.format(sdf)+Param.BEGIN;
|
||||
}else{
|
||||
return yesterday.format(sdf)+Param.END;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RActivePowerRangePO> getDataByLineIds(List<String> lineIds) {
|
||||
return null;
|
||||
public RActivePowerRangePO getDataByLineId(String lineId) {
|
||||
LambdaQueryWrapper<RActivePowerRangePO> lambdaQueryWrapper = new LambdaQueryWrapper();
|
||||
lambdaQueryWrapper.eq(RActivePowerRangePO::getLineId,lineId).eq(RActivePowerRangePO::getState,"1");
|
||||
return this.baseMapper.selectOne(lambdaQueryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.njcn.device.pq.api.NewStationClient;
|
||||
import com.njcn.device.pq.constant.Param;
|
||||
import com.njcn.device.pq.pojo.po.NewStation;
|
||||
import com.njcn.event.api.EventDetailFeignClient;
|
||||
import com.njcn.event.file.component.WaveFileComponent;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.event.SpThroughMapper;
|
||||
import com.njcn.prepare.harmonic.pojo.param.SpThroughParam;
|
||||
@@ -36,6 +37,8 @@ public class SpThroughServiceImpl extends MppServiceImpl<SpThroughMapper, SpThro
|
||||
|
||||
private final NewStationClient newStationClient;
|
||||
|
||||
private final WaveFileComponent waveFileComponent;
|
||||
|
||||
@Override
|
||||
public void record() {
|
||||
LocalDateTime currentTime = LocalDateTime.now();
|
||||
@@ -47,6 +50,7 @@ public class SpThroughServiceImpl extends MppServiceImpl<SpThroughMapper, SpThro
|
||||
if(lineDTO != null && lineDTO.getNewStationId() != null){
|
||||
NewStation newStation = newStationClient.selectById(lineDTO.getNewStationId()).getData();
|
||||
if(newStation != null){
|
||||
//waveFileComponent.getComtrade();
|
||||
//暂升事件
|
||||
if(Param.UPPEREVENT.equals(rmpEventDetailPO.getEventType())){
|
||||
//风电场
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.njcn.prepare.harmonic.service.mysql.event;
|
||||
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.prepare.harmonic.pojo.po.RActivePowerRangePO;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 有功功率趋势 服务类
|
||||
@@ -17,8 +16,8 @@ public interface RActivePowerRangeService extends IMppService<RActivePowerRangeP
|
||||
void record();
|
||||
|
||||
/**
|
||||
* 根据监测点ID集合获取有功功率趋势信息
|
||||
* 根据监测点ID获取有功功率趋势信息
|
||||
*/
|
||||
List<RActivePowerRangePO> getDataByLineIds(List<String> lineIds);
|
||||
RActivePowerRangePO getDataByLineId(String lineId);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user