区域报表修改

This commit is contained in:
hzj
2026-06-05 16:32:55 +08:00
parent 6089be6b4a
commit 749c1d954c
4 changed files with 27 additions and 13 deletions

View File

@@ -28,6 +28,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
@@ -132,7 +133,7 @@ public class AreaHarmonicServiceImpl implements AreaHarmonicService {
tableList.add(new ArrayList<>());
// 1. 台账表格
List<String[]> ledgerTable = buildLedgerTable(param.getDeptId());
List<String[]> ledgerTable = buildLedgerTable(param.getDeptId(),param.getScale());
if(CollUtil.isEmpty(ledgerTable)){
throw new BusinessException(CommonResponseEnum.FAIL,"当前部门不存在在运监测点");
}
@@ -145,7 +146,7 @@ public class AreaHarmonicServiceImpl implements AreaHarmonicService {
List<OverAreaLimitVO> qualityData = getPowerQualityData(param);
if (CollUtil.isNotEmpty(qualityData)) {
// 构建监控点名称映射
Map<String, String> monitorNameMap = buildMonitorNameMap(param.getDeptId());
Map<String, String> monitorNameMap = buildMonitorNameMap(param.getDeptId(),param.getScale());
// 过滤有效数据(在线监控数>0
List<OverAreaLimitVO> validData = qualityData.stream()
@@ -176,8 +177,8 @@ public class AreaHarmonicServiceImpl implements AreaHarmonicService {
/**
* 构建台账表格
*/
private List<String[]> buildLedgerTable(String deptId) {
List<MonitorCommLedgerInfoDTO> ledgerList = getLedgerInfo(deptId);
private List<String[]> buildLedgerTable(String deptId, String scale) {
List<MonitorCommLedgerInfoDTO> ledgerList = getLedgerInfo(deptId,scale);
if (CollUtil.isEmpty(ledgerList)) {
return new ArrayList<>();
}
@@ -190,7 +191,7 @@ public class AreaHarmonicServiceImpl implements AreaHarmonicService {
MonitorCommLedgerInfoDTO ledger = ledgerList.get(i);
return new String[]{
String.valueOf(i + 1),
ledger.getMonitorName(),
StringUtils.hasText(ledger.getObjName())? ledger.getObjName()+"_"+ledger.getMonitorName():ledger.getMonitorName(),
ledger.getBdName(),
ledger.getBusBarName(),
voltageLevelMap.getOrDefault(ledger.getVoltageLevel(), ""),
@@ -750,10 +751,14 @@ public class AreaHarmonicServiceImpl implements AreaHarmonicService {
/**
* 获取台账信息
*/
private List<MonitorCommLedgerInfoDTO> getLedgerInfo(String deptId) {
private List<MonitorCommLedgerInfoDTO> getLedgerInfo(String deptId, String scale) {
DeptGetLineParam param = new DeptGetLineParam();
param.setDeptId(deptId);
return commTerminalGeneralClient.deptGetLineInfo(param).getData();
List<MonitorCommLedgerInfoDTO> data = commTerminalGeneralClient.deptGetLineInfo(param).getData();
if(StringUtils.hasText(scale)){
data=data.stream().filter(temp->Objects.equals(scale,temp.getVoltageLevel())).collect(Collectors.toList());
}
return data;
}
/**
@@ -770,13 +775,14 @@ public class AreaHarmonicServiceImpl implements AreaHarmonicService {
/**
* 构建监控点名称映射
*/
private Map<String, String> buildMonitorNameMap(String deptId) {
List<MonitorCommLedgerInfoDTO> ledgerList = getLedgerInfo(deptId);
private Map<String, String> buildMonitorNameMap(String deptId, String scale) {
List<MonitorCommLedgerInfoDTO> ledgerList = getLedgerInfo(deptId, scale);
return ledgerList.stream()
.collect(Collectors.toMap(
MonitorCommLedgerInfoDTO::getMonitorId,
MonitorCommLedgerInfoDTO::getMonitorName
));
MonitorCommLedgerInfoDTO::getMonitorId,
temp-> StringUtils.hasText(temp.getObjName())? temp.getObjName()+"_"+temp.getMonitorName():temp.getMonitorName()
));
}
/**