1.修改冀北日曲线bug
This commit is contained in:
@@ -363,7 +363,7 @@ public class StatationStatServiceImpl extends ServiceImpl<StatationStatMapper, S
|
||||
|
||||
@Override
|
||||
public List<StatationStat> getStatationStatList(String orgID) {
|
||||
if(StrUtil.isBlank(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();
|
||||
@@ -376,7 +376,7 @@ public class StatationStatServiceImpl extends ServiceImpl<StatationStatMapper, S
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StatationStatVO.Curve> getStatationStatCurve(String subID,String voltageLevel,Integer type) {
|
||||
public List<StatationStatVO.Curve> getStatationStatCurve(String subID, String voltageLevel, Integer type) {
|
||||
List<StatationStatVO.Curve> curves = new ArrayList<>();
|
||||
if (StrUtil.isBlank(subID)) {
|
||||
throw new BusinessException(PmsDeviceResponseEnum.NO_ID_STATION);
|
||||
@@ -384,21 +384,23 @@ public class StatationStatServiceImpl extends ServiceImpl<StatationStatMapper, S
|
||||
//获取主网信息,没有则获取配网信息
|
||||
List<Monitor> list = iMonitorService.list(new LambdaQueryWrapper<Monitor>()
|
||||
.eq(Monitor::getPowerrId, subID)
|
||||
.eq(Monitor::getVoltageLevel,voltageLevel)
|
||||
.eq(Monitor::getVoltageLevel, voltageLevel)
|
||||
);
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
// String lineId = list.get(0).getLineId();
|
||||
addCurves(null,type,curves);
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
String lineId = list.get(0).getLineId();
|
||||
addCurves(lineId, type, curves);
|
||||
|
||||
}else {
|
||||
} else {
|
||||
List<PmsMonitorBaseDTO> disMonitorAllList = distributionMonitorMapper.getDisMonitorAllList(subID, 1);
|
||||
List<PmsMonitorBaseDTO> disMonitors = disMonitorAllList.stream().filter(x -> x.equals(voltageLevel)).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(disMonitors)){
|
||||
if (CollUtil.isNotEmpty(disMonitors)) {
|
||||
String monitorId = disMonitors.get(0).getMonitorId();
|
||||
addCurves(monitorId,type,curves);
|
||||
addCurves(monitorId, type, curves);
|
||||
}
|
||||
}
|
||||
if(CollUtil.isNotEmpty(curves)){
|
||||
curves.sort(Comparator.comparing(r -> r.getTime()));
|
||||
}
|
||||
return curves;
|
||||
}
|
||||
|
||||
@@ -429,35 +431,36 @@ public class StatationStatServiceImpl extends ServiceImpl<StatationStatMapper, S
|
||||
|
||||
/**
|
||||
* 对象添加
|
||||
*
|
||||
* @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){
|
||||
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)){
|
||||
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();
|
||||
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));
|
||||
curve.setNum(BigDecimal.valueOf(value).setScale(3, RoundingMode.HALF_UP));
|
||||
curves.add(curve);
|
||||
});
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
List<DataHarmPowerP> dataHarmPowerP = dataHarmPowerPService.getHarmonicPowerP(LineID,
|
||||
DateUtil.beginOfDay(DateUtil.date()).toString()
|
||||
, DateUtil.endOfDay(DateUtil.date()).toString());
|
||||
if(CollUtil.isNotEmpty(dataHarmPowerP)){
|
||||
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();
|
||||
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));
|
||||
curve.setNum(BigDecimal.valueOf(value).setScale(3, RoundingMode.HALF_UP));
|
||||
curves.add(curve);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user