feat(harmonic): 新增移动端线路详情功能并优化波形数据处理

- 添加 AppLineDetailVo 数据传输对象,支持移动端线路详情展示
- 增加 report 服务中的 buildHarmonic 相关方法重构,支持移动端线路详情查询
- 优化波形数据处理逻辑,新增波形数据抽点和裁剪功能,减少移动端数据传输量
- 修改 CommonStatisticalQueryParam 参数类,增加数据模型字段和电度事件类型支持
- 调整统计查询相关接口,支持全量和增量查询模式
- 移除 CredentialReqDTO 类,清理相关依赖
- 优化 CsAppReportServiceImpl 中的越限描述构建逻辑,使用时间转换工具
- 更新数据查询相关 Mapper XML 文件,调整数据过滤条件
- 修改设备用户服务实现,完善当前工程数据显示逻辑
- 优化 CsEquipmentDeliveryServiceImpl 中的数据集添加逻辑,支持电度数据类型
- 重构 CsEventController 和相关服务类,支持移动端波形数据分析
- 添加 Nacos 配置参数控制波形数据抽点和间隔区域处理行为
This commit is contained in:
xy
2026-06-03 10:22:18 +08:00
parent a6f424025a
commit cf691db0a6
39 changed files with 1393 additions and 900 deletions

View File

@@ -99,6 +99,12 @@
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.njcn</groupId>
<artifactId>cs-system-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.njcn</groupId>

View File

@@ -24,14 +24,13 @@ import com.njcn.csharmonic.api.SysExcelRelationFeignClient;
import com.njcn.csharmonic.enums.CsHarmonicResponseEnum;
import com.njcn.csharmonic.pojo.param.StatSubstationBizBaseParam;
import com.njcn.csharmonic.pojo.po.CsEventPO;
import com.njcn.csharmonic.pojo.po.CsHarmonic;
import com.njcn.csharmonic.pojo.po.RStatLimitRateDPO;
import com.njcn.csharmonic.pojo.vo.HarmonicVO;
import com.njcn.csreport.mapper.CsAppReportMapper;
import com.njcn.csreport.pojo.po.CsAppReport;
import com.njcn.csreport.pojo.vo.ReportEventVO;
import com.njcn.csreport.pojo.vo.ReportHarmonicVO;
import com.njcn.csreport.service.ICsAppReportService;
import com.njcn.cssystem.utils.TimeUtil;
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
import com.njcn.event.common.service.CommMonitorEventReportService;
@@ -113,7 +112,7 @@ public class CsAppReportServiceImpl extends ServiceImpl<CsAppReportMapper, CsApp
rStatLimitQueryParam.setStartTime(queryStartTime);
rStatLimitQueryParam.setEndTime(queryEndTime);
List<RStatLimitRateDPO> limitRates = rStatLimitRateDClient.getLinesRate(rStatLimitQueryParam).getData();
CsLinePO po = csLineFeignClient.getById(param.getLineId()).getData();
return timeRanges.stream().map(weekRange -> {
List<RStatLimitRateDPO> weekData = limitRates.stream()
.filter(rate -> !rate.getTime().isBefore(weekRange.start) && !rate.getTime().isAfter(weekRange.end))
@@ -121,10 +120,10 @@ public class CsAppReportServiceImpl extends ServiceImpl<CsAppReportMapper, CsApp
ReportHarmonicVO vo = new ReportHarmonicVO();
vo.setLineId(param.getLineId());
vo.setLineName(csLineFeignClient.getById(param.getLineId()).getData().getName());
vo.setLineName(po.getName());
vo.setStartTime(weekRange.start.format(DateTimeFormatter.ISO_LOCAL_DATE));
vo.setEndTime(weekRange.end.format(DateTimeFormatter.ISO_LOCAL_DATE));
vo.setOverLimitDesc(buildOverLimitDesc(weekData));
vo.setOverLimitDesc(buildOverLimitDesc(weekData,po.getLineInterval()));
return vo;
}).collect(Collectors.toList());
}
@@ -398,12 +397,15 @@ public class CsAppReportServiceImpl extends ServiceImpl<CsAppReportMapper, CsApp
return ranges;
}
private List<TimeRange> splitIntoMonthsForCurrentYear(LocalDate endDate) {
private List<TimeRange> splitIntoMonthsForCurrentYear(LocalDate now) {
List<TimeRange> timeRanges = new ArrayList<>();
LocalDate now = LocalDate.now();
int currentYear = now.getYear();
for (int month = now.getMonthValue(); month >= 1; month--) {
int nowYear = LocalDate.now().getYear();
int num = LocalDate.now().getMonthValue();
if (currentYear < nowYear) {
num = 12;
}
for (int month = num; month >= 1; month--) {
LocalDate monthStart = LocalDate.of(currentYear, month, 1);
LocalDate monthEnd;
@@ -420,8 +422,12 @@ public class CsAppReportServiceImpl extends ServiceImpl<CsAppReportMapper, CsApp
//fixme 代码较为冗余,后期可以采用反射的方式进行优化
private String buildOverLimitDesc(List<RStatLimitRateDPO> dataList) {
private String buildOverLimitDesc(List<RStatLimitRateDPO> dataList,Integer lineInterval) {
String tag = "";
if (Objects.isNull(lineInterval)) {
lineInterval = 1;
}
int maxData = dataList.size() * 24 * 60;
RStatLimitRateDPO result = new RStatLimitRateDPO();
if (CollectionUtil.isNotEmpty(dataList)) {
int data1 = 0,data2 = 0,data3 = 0,data4 = 0,data5 = 0,data6 = 0,data7 = 0,data8 = 0,data9 = 0,data10 = 0
@@ -651,42 +657,42 @@ public class CsAppReportServiceImpl extends ServiceImpl<CsAppReportMapper, CsApp
// 基础越限项
Integer freqDevOvertime = result.getFreqDevOvertime();
if (freqDevOvertime > 0) {
tag = tag + "频率偏差越限" + freqDevOvertime + "";
tag = tag + "频率偏差越限" + TimeUtil.convertMinutes(Math.min(freqDevOvertime * lineInterval,maxData)) + "";
}
Integer voltageDevOvertime = result.getVoltageDevOvertime();
if (voltageDevOvertime > 0) {
tag = tag + "电压偏差越限" + voltageDevOvertime + "";
tag = tag + "电压偏差越限" + TimeUtil.convertMinutes(Math.min(voltageDevOvertime * lineInterval,maxData)) + "";
}
Integer ubalanceOvertime = result.getUbalanceOvertime();
if (ubalanceOvertime > 0) {
tag = tag + "三相电压不平衡度越限" + ubalanceOvertime + "";
tag = tag + "三相电压不平衡度越限" + TimeUtil.convertMinutes(Math.min(ubalanceOvertime * lineInterval,maxData)) + "";
}
Integer flickerOvertime = result.getFlickerOvertime();
if (flickerOvertime > 0) {
tag = tag + "闪变越限" + flickerOvertime + "";
tag = tag + "闪变越限" + TimeUtil.convertMinutes(Math.min(flickerOvertime * lineInterval,maxData)) + "";
}
Integer uaberranceOvertime = result.getUaberranceOvertime();
if (uaberranceOvertime > 0) {
tag = tag + "电压总谐波畸变率越限" + uaberranceOvertime + "";
tag = tag + "电压总谐波畸变率越限" + TimeUtil.convertMinutes(Math.min(uaberranceOvertime * lineInterval,maxData)) + "";
}
Integer iNegOvertime = result.getINegOvertime();
if (iNegOvertime > 0) {
tag = tag + "负序电流越限" + iNegOvertime + "";
tag = tag + "负序电流越限" + TimeUtil.convertMinutes(Math.min(iNegOvertime * lineInterval,maxData)) + "";
}
// 谐波电压含有率2-25 次)
tag = buildHarmonicVoltageTags(result, tag);
tag = buildHarmonicVoltageTags(result, tag, lineInterval, maxData);
// 谐波电流有效值2-25 次)
tag = buildHarmonicCurrentTags(result, tag);
tag = buildHarmonicCurrentTags(result, tag, lineInterval, maxData);
// 间谐波电压含有率0.5-15.5 次)
tag = buildInterharmonicVoltageTags(result, tag);
tag = buildInterharmonicVoltageTags(result, tag, lineInterval, maxData);
// 去除末尾逗号
return trimTrailingComma(tag);
@@ -709,13 +715,13 @@ public class CsAppReportServiceImpl extends ServiceImpl<CsAppReportMapper, CsApp
* @param originalTag 原始 tag
* @return 组装后的 tag
*/
public static String buildHarmonicVoltageTags(Object item, String originalTag) {
public static String buildHarmonicVoltageTags(Object item, String originalTag, Integer lineInterval, Integer maxData) {
String tag = originalTag;
for (int i = 2; i <= 25; i++) {
String fieldName = "uharm" + i + "Overtime";
Integer value = (Integer) ReflectUtil.getFieldValue(item, fieldName);
if (value != null && value > 0) {
tag = tag + i + "次谐波电压含有率越限" + value + "";
tag = tag + i + "次谐波电压含有率越限" + TimeUtil.convertMinutes(Math.min(value*lineInterval,maxData)) + "";
}
}
return tag;
@@ -728,13 +734,13 @@ public class CsAppReportServiceImpl extends ServiceImpl<CsAppReportMapper, CsApp
* @param originalTag 原始 tag
* @return 组装后的 tag
*/
public static String buildHarmonicCurrentTags(Object item, String originalTag) {
public static String buildHarmonicCurrentTags(Object item, String originalTag, Integer lineInterval, Integer maxData) {
String tag = originalTag;
for (int i = 2; i <= 25; i++) {
String fieldName = "iharm" + i + "Overtime";
Integer value = (Integer) ReflectUtil.getFieldValue(item, fieldName);
if (value != null && value > 0) {
tag = tag + i + "次谐波电流有效值越限" + value + "";
tag = tag + i + "次谐波电流有效值越限" + TimeUtil.convertMinutes(Math.min(value*lineInterval,maxData)) + "";
}
}
return tag;
@@ -747,14 +753,14 @@ public class CsAppReportServiceImpl extends ServiceImpl<CsAppReportMapper, CsApp
* @param originalTag 原始 tag
* @return 组装后的 tag
*/
public static String buildInterharmonicVoltageTags(Object item, String originalTag) {
public static String buildInterharmonicVoltageTags(Object item, String originalTag, Integer lineInterval, Integer maxData) {
String tag = originalTag;
for (int i = 1; i <= 16; i++) {
String fieldName = "inuharm" + i + "Overtime";
Integer value = (Integer) ReflectUtil.getFieldValue(item, fieldName);
if (value != null && value > 0) {
double harmonicOrder = i * 1.0 - 0.5;
tag = tag + harmonicOrder + "次间谐波电压含有率越限" + value + "";
tag = tag + harmonicOrder + "次间谐波电压含有率越限" + TimeUtil.convertMinutes(Math.min(value*lineInterval,maxData)) + "";
}
}
return tag;