谐波畸变bug修复&&区域统计bug修复

This commit is contained in:
zhuxinyu
2023-04-12 18:15:32 +08:00
parent f49134860b
commit 7c6a129ac0
6 changed files with 65 additions and 91 deletions

View File

@@ -84,7 +84,7 @@ public class TerminalOnlineRateDataServiceImpl implements TerminalOnlineRateData
* @return * @return
*/ */
@Override @Override
public List<TerminalOnlineRateDataVO> getOnlineRateData(TerminalOnlineRateDataParam terminalOnlineRateDataParam) { public List<TerminalOnlineRateDataVO> getOnlineRateData (TerminalOnlineRateDataParam terminalOnlineRateDataParam) {
// 获取所有数据 // 获取所有数据
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(terminalOnlineRateDataParam, Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList())); List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(terminalOnlineRateDataParam, Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));

View File

@@ -1,5 +1,7 @@
package com.njcn.event.pojo.vo; package com.njcn.event.pojo.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.influxdb.annotation.Column; import org.influxdb.annotation.Column;
@@ -15,109 +17,68 @@ import java.math.BigDecimal;
@Data @Data
public class WaveTypeVO{ public class WaveTypeVO{
@ApiModelProperty(name = "lineName", value = "监测点名称")
@ApiModelProperty(
name = "lineName",
value = "监测点名称"
)
private String lineName; private String lineName;
@ApiModelProperty(
name = "subId", @ApiModelProperty(name = "subId", value = "变电站id")
value = "变电站id"
)
private String subId; private String subId;
@ApiModelProperty(
name = "subName", @ApiModelProperty(name = "subName", value = "变电站名称")
value = "变电站名称"
)
private String subName; private String subName;
@ApiModelProperty(
name = "gdId", @ApiModelProperty(name = "gdId", value = "供电公司id")
value = "供电公司id"
)
private String gdId; private String gdId;
@ApiModelProperty(
name = "gdName", @ApiModelProperty(name = "gdName", value = "供电公司名称")
value = "供电公司名称"
)
private String gdName; private String gdName;
@ApiModelProperty(
name = "voltageId", @ApiModelProperty(name = "voltageId", value = "母线id")
value = "母线id"
)
private String voltageId; private String voltageId;
@ApiModelProperty(
name = "voltageName", @ApiModelProperty(name = "voltageName", value = "母线名称")
value = "母线名称"
)
private String voltageName; private String voltageName;
@ApiModelProperty(
name = "voltageScale", @ApiModelProperty(name = "voltageScale", value = "监测点电压等级")
value = "监测点电压等级"
)
private String voltageScale; private String voltageScale;
@ApiModelProperty(
name = "noDealCount", @ApiModelProperty(name = "noDealCount", value = "未处理暂降事件")
value = "未处理暂降事件"
)
private Integer noDealCount; private Integer noDealCount;
@ApiModelProperty(
name = "ct1", @ApiModelProperty(name = "ct1", value = "ct1")
value = "ct1"
)
private Integer ct1; private Integer ct1;
@ApiModelProperty(
name = "ct2", @ApiModelProperty(name = "ct2", value = "ct2")
value = "ct2"
)
private Integer ct2; private Integer ct2;
@ApiModelProperty(
name = "pt1", @ApiModelProperty(name = "pt1", value = "pt1")
value = "pt1"
)
private Integer pt1; private Integer pt1;
@ApiModelProperty(
name = "pt2", @ApiModelProperty(name = "pt2", value = "pt2")
value = "pt2"
)
private Integer pt2; private Integer pt2;
@ApiModelProperty(
name = "runFlag", @ApiModelProperty(name = "runFlag", value = "运行状态")
value = "运行状态"
)
private Integer runFlag; private Integer runFlag;
@ApiModelProperty(
name = "comFlag", @ApiModelProperty(name = "comFlag", value = "通讯状态")
value = "通讯状态"
)
private Integer comFlag; private Integer comFlag;
@ApiModelProperty(
name = "ip", @ApiModelProperty(name = "ip", value = "装置ip")
value = "装置ip"
)
private String ip; private String ip;
@ApiModelProperty(
name = "lat", @ApiModelProperty(name = "lat", value = "维度")
value = "维度"
)
private BigDecimal lat; private BigDecimal lat;
@ApiModelProperty(
name = "lng", @ApiModelProperty(name = "lng", value = "经度")
value = "经度"
)
private BigDecimal lng; private BigDecimal lng;
@ApiModelProperty(
name = "manufacturer", @ApiModelProperty(name = "manufacturer", value = "供应商名称")
value = "供应商名称"
)
private String manufacturer; private String manufacturer;
@ApiModelProperty(
name = "loadType", @ApiModelProperty(name = "loadType", value = "干扰源类型")
value = "干扰源类型"
)
private String loadType; private String loadType;
@ApiModelProperty(value = "暂时事件ID")
private String eventId;
@Column(name = "line_id") @Column(name = "line_id")
private String lineId; private String lineId;

View File

@@ -87,7 +87,7 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService {
List<String> dicIdsDouble = dicTypeList.stream().filter(item->item.getName().contains("双相接地")).map(DictData::getId).collect(Collectors.toList()); List<String> dicIdsDouble = dicTypeList.stream().filter(item->item.getName().contains("双相接地")).map(DictData::getId).collect(Collectors.toList());
Map<String, List<String>> stringListMap = new HashMap<>(); Map<String, List<String>> stringListMap = new HashMap<>();
stringListMap.put("单相接地",dicIdsOne); stringListMap.put("单相接地",dicIdsOne);
stringListMap.put("相接地",dicIdsDouble); stringListMap.put("相接地",dicIdsDouble);
stringListMap.put("三相短路",dicIdsThree); stringListMap.put("三相短路",dicIdsThree);
stringListMap.put("相间故障",dicIdsXi); stringListMap.put("相间故障",dicIdsXi);
stringListMap.put("未知",dicIdsOther); stringListMap.put("未知",dicIdsOther);
@@ -217,7 +217,7 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService {
Integer allCount = 0; Integer allCount = 0;
for (Map.Entry<String, List<String>> stringListEntry : stringListMap.entrySet()) { for (Map.Entry<String, List<String>> stringListEntry : stringListMap.entrySet()) {
List<String> value = stringListEntry.getValue(); List<String> value = stringListEntry.getValue();
Integer count = Math.toIntExact(reasons.stream().filter(x -> value.contains(x)).count()); Integer count = Math.toIntExact(reasons.stream().filter(x -> value.contains(x.getAdvanceType())).count());
AreaAnalysisVO.Children allType = new AreaAnalysisVO.Children(); AreaAnalysisVO.Children allType = new AreaAnalysisVO.Children();
allType.setName(stringListEntry.getKey()); allType.setName(stringListEntry.getKey());
allType.setValue(count); allType.setValue(count);

View File

@@ -78,7 +78,7 @@ public class THDistortionServiceImpl implements THDistortionService {
//查找畸变率 //查找畸变率
List<PublicDTO> condition = getCondition(lineIndexes, thDistortionParam.getSearchBeginTime(), thDistortionParam.getSearchEndTime()); List<PublicDTO> condition = getCondition(lineIndexes, thDistortionParam.getSearchBeginTime(), thDistortionParam.getSearchEndTime());
thDistortionVO.setDistortion(condition.stream().mapToDouble(PublicDTO::getData).average().orElse(3.14159)); thDistortionVO.setDistortion(roundHalfUp(condition.stream().mapToDouble(PublicDTO::getData).average().orElse(3.14159)));
//组装父级数据树 //组装父级数据树
List<THDistortionVO> treeList = getTreeData(lineIndexes, thDistortionParam); List<THDistortionVO> treeList = getTreeData(lineIndexes, thDistortionParam);
thDistortionVO.setChildren(treeList); thDistortionVO.setChildren(treeList);
@@ -162,7 +162,7 @@ public class THDistortionServiceImpl implements THDistortionService {
List<THDistortionVO> children = thDistortionVO.getChildren(); List<THDistortionVO> children = thDistortionVO.getChildren();
List<THDistortionVO> tempList = children.stream().filter(child -> !Objects.equals(child.getDistortion(), 3.14159)).collect(Collectors.toList()); List<THDistortionVO> tempList = children.stream().filter(child -> !Objects.equals(child.getDistortion(), 3.14159)).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(tempList)) { if (!CollectionUtils.isEmpty(tempList)) {
thDistortionVO.setDistortion(tempList.stream().mapToDouble(THDistortionVO::getDistortion).average().orElse(3.14159)); thDistortionVO.setDistortion(roundHalfUp(tempList.stream().mapToDouble(THDistortionVO::getDistortion).average().orElse(3.14159)));
} else { } else {
thDistortionVO.setDistortion(3.14159); thDistortionVO.setDistortion(3.14159);
} }
@@ -210,7 +210,7 @@ public class THDistortionServiceImpl implements THDistortionService {
if (!CollectionUtils.isEmpty(monitorList)) { if (!CollectionUtils.isEmpty(monitorList)) {
//根据监测点集合组装谐波畸变率 //根据监测点集合组装谐波畸变率
monitorList.stream().map(list1 -> condition.stream().filter(list2 -> Objects.equals(list1.getId(), list2.getId())).findAny().map(m -> { monitorList.stream().map(list1 -> condition.stream().filter(list2 -> Objects.equals(list1.getId(), list2.getId())).findAny().map(m -> {
list1.setDistortion(m.getData()); list1.setDistortion(roundHalfUp(m.getData()));
return list1; return list1;
})).collect(Collectors.toList()); })).collect(Collectors.toList());
@@ -226,6 +226,18 @@ public class THDistortionServiceImpl implements THDistortionService {
return powerCompanyList; return powerCompanyList;
} }
/**
* 四舍五入保留两位小数
*/
private Double roundHalfUp (double num) {
if (num == 3.14159) {
return num;
}
BigDecimal b = new BigDecimal(num);
//保留2位小数
return b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
}
/** /**
* influxDB查询畸变率 * influxDB查询畸变率
@@ -246,7 +258,8 @@ public class THDistortionServiceImpl implements THDistortionService {
.ge(StrUtil.isNotBlank(startTime), RStatDataVD::getTime, DateUtil.beginOfDay(DateUtil.parse(startTime))) .ge(StrUtil.isNotBlank(startTime), RStatDataVD::getTime, DateUtil.beginOfDay(DateUtil.parse(startTime)))
.le(StrUtil.isNotBlank(endTime), RStatDataVD::getTime, DateUtil.endOfDay(DateUtil.parse(endTime))) .le(StrUtil.isNotBlank(endTime), RStatDataVD::getTime, DateUtil.endOfDay(DateUtil.parse(endTime)))
.eq(RStatDataVD::getQualityFlag, 1) // .eq(RStatDataVD::getQualityFlag, 1)
.eq(RStatDataVD::getQualityFlag, 0)
.in(RStatDataVD::getPhasicType, phasicType) .in(RStatDataVD::getPhasicType, phasicType)
.eq(RStatDataVD::getValueType, Param.VALUE_TYPEAVG) .eq(RStatDataVD::getValueType, Param.VALUE_TYPEAVG)
); );

View File

@@ -24,6 +24,6 @@ public class DistortionRateJob {
lineParam.setDataDate(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); lineParam.setDataDate(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
log.info(lineParam.toString()); log.info(lineParam.toString());
distortionRateFeignClient.distortionRate(lineParam); distortionRateFeignClient.distortionRate(lineParam);
log.info("===================DistortionRateJob End==================="); log.info("===================DistortionRateJob End=====================");
} }
} }

View File

@@ -52,7 +52,7 @@ xxl:
accessToken: accessToken:
executor: executor:
#执行器AppName [选填]:执行器心跳注册分组依据;为空则关闭自动注册 #执行器AppName [选填]:执行器心跳注册分组依据;为空则关闭自动注册
appname: xuyang appname: zxylocaltest
#执行器注册 [选填]:优先使用该配置作为注册地址,为空时使用内嵌服务 ”IP:PORT“ 作为注册地址。从而更灵活的支持容器类型执行器动态IP和动态映射端口问题。 #执行器注册 [选填]:优先使用该配置作为注册地址,为空时使用内嵌服务 ”IP:PORT“ 作为注册地址。从而更灵活的支持容器类型执行器动态IP和动态映射端口问题。
address: address:
#执行器IP [选填]默认为空表示自动获取IP多网卡时可手动设置指定IP该IP不会绑定Host仅作为通讯实用地址信息用于 "执行器注册" 和 "调度中心请求并触发任务" #执行器IP [选填]默认为空表示自动获取IP多网卡时可手动设置指定IP该IP不会绑定Host仅作为通讯实用地址信息用于 "执行器注册" 和 "调度中心请求并触发任务"