报表优化

This commit is contained in:
xy
2026-02-06 09:57:15 +08:00
parent 99ab77dcf0
commit 140ed85108
5 changed files with 85 additions and 33 deletions

View File

@@ -125,6 +125,6 @@ public class ExportModelController extends BaseController {
monitorHarmonicReportService.exportWorld(response,startTime,endTime,type,lineIndex,name,reportNumber,crmName,isUrl,file, harmLineDetailDataCommDTO,overLimitInfoCommDTO,deviceUnitCommDTO);
monitorHarmonicReportService.exportWorld(response,startTime,endTime,type,lineIndex,name,reportNumber,crmName,isUrl,file, harmLineDetailDataCommDTO,overLimitInfoCommDTO,deviceUnitCommDTO,null);
}
}

View File

@@ -25,5 +25,5 @@ public interface MonitorHarmonicReportService {
String crmName,
Boolean isUrl,
MultipartFile file,
HarmLineDetailDataCommDTO lineDto, OverLimitInfoCommDTO overLimitData, DeviceUnitCommDTO deviceUnit);
HarmLineDetailDataCommDTO lineDto, OverLimitInfoCommDTO overLimitData, DeviceUnitCommDTO deviceUnit, String dataLevel);
}

View File

@@ -14,6 +14,7 @@ import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONTokener;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.toolkit.SqlRunner;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
@@ -157,7 +158,13 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
} else {
phase = PHASE_MAPPING.get(item.getPhase());
}
tMap.put((item.getOtherName() + phase + item.getResourcesId()).toUpperCase(), item.getPrimaryFormula());
if (ObjectUtils.isNotNull(item.getHarmStart()) && ObjectUtils.isNotNull(item.getHarmEnd())) {
for (int i = item.getHarmStart(); i <= item.getHarmEnd() + 1; i++) {
tMap.put((item.getOtherName() + "_" + i + phase + item.getResourcesId()).toUpperCase(), item.getPrimaryFormula());
}
} else {
tMap.put((item.getOtherName() + phase + item.getResourcesId()).toUpperCase(), item.getPrimaryFormula());
}
});
eleEpdPqdList = eleEpdPqdList.stream().filter(it->"T".equals(it.getPhase())||"M".equals(it.getPhase())).collect(Collectors.toList());

View File

@@ -14,15 +14,15 @@ import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pq.api.DeviceUnitClient;
import com.njcn.harmonic.common.pojo.dto.DeviceUnitCommDTO;
import com.njcn.harmonic.common.pojo.dto.HarmLineDetailDataCommDTO;
import com.njcn.harmonic.common.pojo.dto.OverLimitInfoCommDTO;
import com.njcn.harmonic.common.service.MonitorCommReportService;
import com.njcn.harmonic.common.service.MonitorHarmonicReportService;
import com.njcn.harmonic.pojo.param.ReportQueryParam;
import com.njcn.harmonic.pojo.po.report.EnumPass;
import com.njcn.harmonic.pojo.po.report.Pass;
import com.njcn.harmonic.pojo.po.report.ReportTarget;
import com.njcn.harmonic.pojo.vo.ReportValue;
import com.njcn.harmonic.common.pojo.dto.HarmLineDetailDataCommDTO;
import com.njcn.harmonic.common.pojo.dto.OverLimitInfoCommDTO;
import com.njcn.harmonic.common.service.MonitorCommReportService;
import com.njcn.harmonic.common.service.MonitorHarmonicReportService;
import com.njcn.harmonic.utils.WordUtil2;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.api.ThemeFeignClient;
@@ -114,7 +114,7 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
String crmName,
Boolean isUrl,
MultipartFile file,
HarmLineDetailDataCommDTO lineDto, OverLimitInfoCommDTO overLimit, DeviceUnitCommDTO deviceUnit) {
HarmLineDetailDataCommDTO lineDto, OverLimitInfoCommDTO overLimit, DeviceUnitCommDTO deviceUnit, String dataLevel) {
//获取监测点信息
String bdname;
Integer pttype;
@@ -122,6 +122,12 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
String atype = "";
String btype = "";
String ctype = "";
//pt
Double pt = getData(lineDto.getPt());
//ct
Double ct = getData(lineDto.getCt());
if (type == 0) {
if (ObjectUtil.isNull(lineDto)) {
throw new BusinessException(CommonResponseEnum.NO_DATA);
@@ -263,14 +269,13 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
// 基波电压最大值
reportmap.put("$B" + "V0" + "X" + "_A$", judgeNull(voltage1.getFmaxValue()));
reportmap.put("$B" + "V0" + "X" + "_B$", judgeNull(voltage2.getFmaxValue()));
reportmap.put("$B" + "V0" + "X" + "_C$", judgeNull(voltage3.getFmaxValue()));
// 基波电流最大值
reportmap.put("$B" + "I0" + "X" + "_A$", judgeNull(current1.getFmaxValue()));
reportmap.put("$B" + "I0" + "X" + "_B$", judgeNull(current2.getFmaxValue()));
reportmap.put("$B" + "I0" + "X" + "_C$", judgeNull(current3.getFmaxValue()));
reportmap.put("$B" + "I0" + "X" + "_A$", dataConversion(current1.getFmaxValue(),dataLevel,ct,true));
reportmap.put("$B" + "I0" + "X" + "_B$", dataConversion(current2.getFmaxValue(),dataLevel,ct,true));
reportmap.put("$B" + "I0" + "X" + "_C$", dataConversion(current3.getFmaxValue(),dataLevel,ct,true));
/**************************************************************
**** 三张大表基础数据幅值
@@ -291,9 +296,9 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
reportmap.put("$B" + "V0" + "N" + "_C$", judgeNull(voltage3.getMinValue()));
// 基波电流最小值
reportmap.put("$B" + "I0" + "N" + "_A$", judgeNull(current1.getMinValue()));
reportmap.put("$B" + "I0" + "N" + "_B$", judgeNull(current2.getMinValue()));
reportmap.put("$B" + "I0" + "N" + "_C$", judgeNull(current3.getMinValue()));
reportmap.put("$B" + "I0" + "N" + "_A$", dataConversion(current1.getMinValue(),dataLevel,ct,true));
reportmap.put("$B" + "I0" + "N" + "_B$", dataConversion(current2.getMinValue(),dataLevel,ct,true));
reportmap.put("$B" + "I0" + "N" + "_C$", dataConversion(current3.getMinValue(),dataLevel,ct,true));
/**************************************************************
**** 三张大表基础数据幅值
@@ -314,9 +319,9 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
reportmap.put("$B" + "V0" + "E" + "_C$", judgeNull(voltage3.getMeanValue()));
// 基波电流平均值
reportmap.put("$B" + "I0" + "E" + "_A$", judgeNull(current1.getMeanValue()));
reportmap.put("$B" + "I0" + "E" + "_B$", judgeNull(current2.getMeanValue()));
reportmap.put("$B" + "I0" + "E" + "_C$", judgeNull(current3.getMeanValue()));
reportmap.put("$B" + "I0" + "E" + "_A$", dataConversion(current1.getMeanValue(),dataLevel,ct,true));
reportmap.put("$B" + "I0" + "E" + "_B$", dataConversion(current2.getMeanValue(),dataLevel,ct,true));
reportmap.put("$B" + "I0" + "E" + "_C$", dataConversion(current3.getMeanValue(),dataLevel,ct,true));
/**************************************************************
**** 三张大表基础数据幅值
@@ -337,9 +342,9 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
reportmap.put("$B" + "V0" + "%" + "_C$", judgeNull(voltage3.getCp95Value()));
// 基波电流cp95值
reportmap.put("$B" + "I0" + "%" + "_A$", judgeNull(current1.getCp95Value()));
reportmap.put("$B" + "I0" + "%" + "_B$", judgeNull(current2.getCp95Value()));
reportmap.put("$B" + "I0" + "%" + "_C$", judgeNull(current3.getCp95Value()));
reportmap.put("$B" + "I0" + "%" + "_A$", dataConversion(current1.getCp95Value(),dataLevel,ct,true));
reportmap.put("$B" + "I0" + "%" + "_B$", dataConversion(current2.getCp95Value(),dataLevel,ct,true));
reportmap.put("$B" + "I0" + "%" + "_C$", dataConversion(current3.getCp95Value(),dataLevel,ct,true));
/**************************************************************
**** 三张大表基础数据幅值
@@ -387,10 +392,10 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
Double vaveValue = Double.parseDouble(reportmap.get("$BV0E_" + tmpstrMap + "$").toString());
Double vcp95Value = Double.parseDouble(reportmap.get("$BV0%_" + tmpstrMap + "$").toString());
// 基波电流
Double imaxValue = Double.parseDouble(reportmap.get("$BI0X_" + tmpstrMap + "$").toString());
Double iminValue = Double.parseDouble(reportmap.get("$BI0N_" + tmpstrMap + "$").toString());
Double iaveValue = Double.parseDouble(reportmap.get("$BI0E_" + tmpstrMap + "$").toString());
Double icp95Value = Double.parseDouble(reportmap.get("$BI0%_" + tmpstrMap + "$").toString());
Double imaxValue = !Objects.equals("Secondary",dataLevel) ? Double.parseDouble(reportmap.get("$BI0X_" + tmpstrMap + "$").toString()):Double.parseDouble(reportmap.get("$BI0X_" + tmpstrMap + "$").toString())*ct;
Double iminValue = !Objects.equals("Secondary",dataLevel) ? Double.parseDouble(reportmap.get("$BI0N_" + tmpstrMap + "$").toString()):Double.parseDouble(reportmap.get("$BI0N_" + tmpstrMap + "$").toString())*ct;
Double iaveValue = !Objects.equals("Secondary",dataLevel) ? Double.parseDouble(reportmap.get("$BI0E_" + tmpstrMap + "$").toString()):Double.parseDouble(reportmap.get("$BI0E_" + tmpstrMap + "$").toString())*ct;
Double icp95Value = !Objects.equals("Secondary",dataLevel) ? Double.parseDouble(reportmap.get("$BI0%_" + tmpstrMap + "$").toString()):Double.parseDouble(reportmap.get("$BI0%_" + tmpstrMap + "$").toString())*ct;
if (!(vmaxValue >= vminValue && vmaxValue >= vaveValue && vmaxValue >= vcp95Value)) {
strBaseVIResult += "注意:从上表中可以看出" + strLineBaseName
@@ -1222,9 +1227,12 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
String strCurrent = strMap + (i + 1) + "%";
// 谐波电流幅值
strCurrentA = judgeNull(this.listICurrent.get(i).getList().get(0).getCp95Value());
strCurrentB = judgeNull(this.listICurrent.get(i).getList().get(1).getCp95Value());
strCurrentC = judgeNull(this.listICurrent.get(i).getList().get(2).getCp95Value());
// strCurrentA = judgeNull(this.listICurrent.get(i).getList().get(0).getCp95Value());
// strCurrentB = judgeNull(this.listICurrent.get(i).getList().get(1).getCp95Value());
// strCurrentC = judgeNull(this.listICurrent.get(i).getList().get(2).getCp95Value());
strCurrentA = dataConversion(this.listICurrent.get(i).getList().get(0).getCp95Value(),dataLevel,ct,true);
strCurrentB = dataConversion(this.listICurrent.get(i).getList().get(1).getCp95Value(),dataLevel,ct,true);
strCurrentC = dataConversion(this.listICurrent.get(i).getList().get(2).getCp95Value(),dataLevel,ct,true);
strLimit = judgeNull(this.listICurrent.get(i).getOverLimit());
reportmap.put(strCurrent + "_A$", strCurrentA);
@@ -1253,9 +1261,9 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
reportmap.put("$CI" + (i + 1) + "L$", strLimit);
try {
maxValue = Double.parseDouble(strCurrentA);
minValue = Double.parseDouble(strCurrentB);
aveValue = Double.parseDouble(strCurrentC);
maxValue = Objects.equals("Secondary",dataLevel) ? Double.parseDouble(strCurrentA)*ct : Double.parseDouble(strCurrentA);
minValue = Objects.equals("Secondary",dataLevel) ? Double.parseDouble(strCurrentB)*ct : Double.parseDouble(strCurrentB);
aveValue = Objects.equals("Secondary",dataLevel) ? Double.parseDouble(strCurrentC)*ct : Double.parseDouble(strCurrentC);;
limit = Double.parseDouble(strLimit);
} catch (Exception e) {
strResultCurrentValue += "注意:从上表中可以看出" + strLineBaseName +(i + 1)+ "次谐波电流幅值95%概率值数据存在异常(不是数值类型)。\r\n";
@@ -1380,6 +1388,26 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
}
}
public Double getData(String data) {
double ratio = 1.0;
if (Objects.isNull(data) || data.isEmpty()) {
return ratio;
}
String[] parts = data.split("/");
if (parts.length == 2) {
try {
Double num1 = Double.parseDouble(parts[0]);
Double num2 = Double.parseDouble(parts[1]);
ratio = num1 / num2;
} catch (NumberFormatException var7) {
System.out.println("字符串格式错误");
}
} else {
ratio = Double.parseDouble(parts[0]);
}
return ratio;
}
/**
* 数据单位信息 重组
*
@@ -1722,6 +1750,22 @@ public class MonitorHarmonicReportServiceImpl implements MonitorHarmonicReportSe
return (result == null) ? "/" : result.toString();
}
public String dataConversion(Float result, String dataLevel, Double ratio, Boolean isI) {
if (result == null) {
return "/";
}
if (!"Secondary".equals(dataLevel)) {
return String.valueOf(result);
}
double conversionRatio = (ratio != null) ? ratio : 1.0;
double convertedValue = result * conversionRatio;
if (isI != null && Boolean.TRUE.equals(isI)) {
return String.format("%.2f", convertedValue);
} else {
return String.format("%.2f", convertedValue / 1000.0);
}
}
/**
* 谐波电流限值
*