1.变压器bug修改。
2.冀北首页变压器统计相关业务代码提交
This commit is contained in:
@@ -257,7 +257,9 @@ public class SubstationExpendServiceImpl extends ServiceImpl<SubstationExpendMap
|
||||
List<CommunicateVO.PVCommunicateVO> info =new ArrayList<>();
|
||||
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class);
|
||||
influxQueryWrapper.between(InfluxDBTableConstant.TIME,DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())),DateUtil.beginOfDay(DateUtil.parse(param.getEndTime())));
|
||||
influxQueryWrapper.between(InfluxDBTableConstant.TIME,
|
||||
DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())).toString(),
|
||||
DateUtil.beginOfDay(DateUtil.parse(param.getEndTime()))).toString();
|
||||
if(CollUtil.isNotEmpty(terminalIds)){
|
||||
influxQueryWrapper.or(PqsCommunicate::getDevId,terminalIds);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.device.pms.enums.PmsDeviceResponseEnum;
|
||||
import com.njcn.device.pms.mapper.majornetwork.*;
|
||||
import com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO;
|
||||
@@ -23,7 +22,9 @@ import com.njcn.device.pms.service.majornetwork.*;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.event.pojo.vo.DeptLevelVO;
|
||||
import com.njcn.event.utils.DeptUtil;
|
||||
import com.njcn.influx.pojo.po.DataHarmPowerP;
|
||||
import com.njcn.influx.pojo.po.DataV;
|
||||
import com.njcn.influx.service.DataHarmPowerPService;
|
||||
import com.njcn.influx.service.IDataVService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
@@ -40,7 +41,12 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.security.Key;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.BinaryOperator;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -71,6 +77,7 @@ public class StatationStatServiceImpl extends ServiceImpl<StatationStatMapper, S
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final DistributionMonitorMapper distributionMonitorMapper;
|
||||
private final IDataVService iDataVService;
|
||||
private final DataHarmPowerPService dataHarmPowerPService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -356,6 +363,9 @@ public class StatationStatServiceImpl extends ServiceImpl<StatationStatMapper, S
|
||||
|
||||
@Override
|
||||
public List<StatationStat> getStatationStatList(String orgID) {
|
||||
if(StrUtil.isBlank(orgID)){
|
||||
throw new BusinessException(PmsDeviceResponseEnum.NO_ID_ORG);
|
||||
}
|
||||
List<DeptDTO> deptInfos = deptFeignClient.getDeptDescendantIndexes(orgID, Stream.of(0, 1).collect(Collectors.toList())).getData();
|
||||
List<String> orgIDs = deptInfos.stream().map(DeptDTO::getCode).collect(Collectors.toList());
|
||||
|
||||
@@ -374,32 +384,21 @@ public class StatationStatServiceImpl extends ServiceImpl<StatationStatMapper, S
|
||||
//获取主网信息,没有则获取配网信息
|
||||
List<Monitor> list = iMonitorService.list(new LambdaQueryWrapper<Monitor>()
|
||||
.eq(Monitor::getPowerrId, subID)
|
||||
.eq(Monitor::getPowerrId,voltageLevel)
|
||||
.eq(Monitor::getVoltageLevel,voltageLevel)
|
||||
);
|
||||
List<DataV> dataV = iDataVService.getDataV("ff2d9674c1f1ecce7f33a5bf17fc4f2d",
|
||||
DateUtil.beginOfDay(DateUtil.date()).toString()
|
||||
, DateUtil.endOfDay(DateUtil.date()).toString());
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
String lineId = list.get(0).getLineId();
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
// String lineId = list.get(0).getLineId();
|
||||
addCurves(null,type,curves);
|
||||
|
||||
|
||||
dataV.stream().filter(x->!x.getPhasicType().equals("T")
|
||||
&&x.getValueType().equals("CP95")
|
||||
).peek(x->{
|
||||
StatationStatVO.Curve curve =new StatationStatVO.Curve();
|
||||
curve.setTime(PubUtils.instantToDate(x.getTime()));
|
||||
curve.setNum( BigDecimal.valueOf(x.getVThd()).setScale(2, RoundingMode.HALF_UP));
|
||||
curves.add(curve);
|
||||
}
|
||||
);
|
||||
}else {
|
||||
List<PmsMonitorBaseDTO> disMonitorAllList = distributionMonitorMapper.getDisMonitorAllList(subID, type);
|
||||
List<PmsMonitorBaseDTO> disMonitorAllList = distributionMonitorMapper.getDisMonitorAllList(subID, 1);
|
||||
List<PmsMonitorBaseDTO> disMonitors = disMonitorAllList.stream().filter(x -> x.equals(voltageLevel)).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(disMonitors)){
|
||||
// curves = pvDataFeignClient.getPVDailyCurve(disMonitors.get(0).getMonitorId(), 0).getData();
|
||||
|
||||
String monitorId = disMonitors.get(0).getMonitorId();
|
||||
addCurves(monitorId,type,curves);
|
||||
}
|
||||
}
|
||||
curves.sort(Comparator.comparing(r -> r.getTime()));
|
||||
return curves;
|
||||
}
|
||||
|
||||
@@ -427,4 +426,42 @@ public class StatationStatServiceImpl extends ServiceImpl<StatationStatMapper, S
|
||||
});
|
||||
return voltageIDs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对象添加
|
||||
* @param LineID 监测点id ff2d9674c1f1ecce7f33a5bf17fc4f2d
|
||||
* @param type 0=谐波 1=总有功
|
||||
* @param curves 初始集合
|
||||
* @return
|
||||
*/
|
||||
private List<StatationStatVO.Curve> addCurves(String LineID,Integer type,List<StatationStatVO.Curve> curves){
|
||||
if(type==0){
|
||||
List<DataV> dataV = iDataVService.getHarmonicDataV(LineID,
|
||||
DateUtil.beginOfDay(DateUtil.date()).toString()
|
||||
, DateUtil.endOfDay(DateUtil.date()).toString());
|
||||
if(CollUtil.isNotEmpty(dataV)){
|
||||
Map<Instant, Double> collect = dataV.stream().collect(Collectors.toMap(DataV::getTime, DataV::getVThd, (c1, c2) -> c1 > c2 ? c1 : c2));
|
||||
collect.forEach((key,value)->{
|
||||
StatationStatVO.Curve curve =new StatationStatVO.Curve();
|
||||
curve.setTime(Date.from(key));
|
||||
curve.setNum( BigDecimal.valueOf(value).setScale(3, RoundingMode.HALF_UP));
|
||||
curves.add(curve);
|
||||
});
|
||||
}
|
||||
}else{
|
||||
List<DataHarmPowerP> dataHarmPowerP = dataHarmPowerPService.getHarmonicPowerP(LineID,
|
||||
DateUtil.beginOfDay(DateUtil.date()).toString()
|
||||
, DateUtil.endOfDay(DateUtil.date()).toString());
|
||||
if(CollUtil.isNotEmpty(dataHarmPowerP)){
|
||||
Map<Instant, Double> dataHarmPowerPMap = dataHarmPowerP.stream().collect(Collectors.toMap(DataHarmPowerP::getTime, DataHarmPowerP::getP, (c1, c2) -> c1 > c2 ? c1 : c2));
|
||||
dataHarmPowerPMap.forEach((key,value)->{
|
||||
StatationStatVO.Curve curve =new StatationStatVO.Curve();
|
||||
curve.setTime(Date.from(key));
|
||||
curve.setNum( BigDecimal.valueOf(value).setScale(3, RoundingMode.HALF_UP));
|
||||
curves.add(curve);
|
||||
});
|
||||
}
|
||||
}
|
||||
return curves;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user