1.bug调整

This commit is contained in:
2026-06-25 18:27:44 +08:00
parent 5a0e990f90
commit 83907cd3ee
9 changed files with 151 additions and 336 deletions

View File

@@ -92,7 +92,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
}};
@Override
public void getCustomReport(ReportSearchParam reportSearchParam, Map<String, String> newMap, DeviceUnitCommDTO deviceUnitCommDTO, HttpServletResponse response) {
public void getCustomReport(ReportSearchParam reportSearchParam, Map<String, String> ledgerMap, DeviceUnitCommDTO deviceUnitCommDTO, HttpServletResponse response) {
TimeInterval timeInterval = new TimeInterval();
ExcelRptTemp excelRptTemp = excelRptTempMapper.selectById(reportSearchParam.getTempId());
if (Objects.isNull(excelRptTemp)) {
@@ -100,7 +100,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
}
if (Objects.isNull(reportSearchParam.getCustomType())) {
//通用报表
analyzeReport(reportSearchParam, excelRptTemp, newMap, deviceUnitCommDTO, response);
analyzeReport(reportSearchParam, excelRptTemp, ledgerMap, deviceUnitCommDTO, response);
log.info("报表执行时间{}秒", timeInterval.intervalSecond());
}
@@ -565,7 +565,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
* @date 2023/10/8
*/
private void analyzeReport(ReportSearchParam reportSearchParam, ExcelRptTemp excelRptTemp, Map<String, String> newMap, DeviceUnitCommDTO deviceUnitCommDTO, HttpServletResponse response) {
private void analyzeReport(ReportSearchParam reportSearchParam, ExcelRptTemp excelRptTemp, Map<String, String> ledgerMap, DeviceUnitCommDTO deviceUnitCommDTO, HttpServletResponse response) {
//定义一个线程集合
List<Future<?>> futures = new ArrayList<>();
//指标
@@ -651,13 +651,13 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
phaseMap.forEach((phaseKey, phaseVal) -> {
StringBuilder sql = new StringBuilder(InfluxDbSqlConstant.SELECT);
if (InfluxDbSqlConstant.MAX.equalsIgnoreCase(valueTypeKey)) {
assembleSqlAndQuery(tMap, newMap.get("LEVEL"), newMap.get("PT"), newMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.MAX, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList, tableMap);
assembleSqlAndQuery(tMap, ledgerMap.get("LEVEL"), ledgerMap.get("PT"), ledgerMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.MAX, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList, tableMap);
} else if (InfluxDbSqlConstant.MIN.equalsIgnoreCase(valueTypeKey)) {
assembleSqlAndQuery(tMap, newMap.get("LEVEL"), newMap.get("PT"), newMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.MIN, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList, tableMap);
assembleSqlAndQuery(tMap, ledgerMap.get("LEVEL"), ledgerMap.get("PT"), ledgerMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.MIN, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList, tableMap);
} else if (InfluxDbSqlConstant.AVG_WEB.equalsIgnoreCase(valueTypeKey)) {
assembleSqlAndQuery(tMap, newMap.get("LEVEL"), newMap.get("PT"), newMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.AVG_WEB, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList,tableMap);
assembleSqlAndQuery(tMap, ledgerMap.get("LEVEL"), ledgerMap.get("PT"), ledgerMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.AVG_WEB, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList,tableMap);
} else if (InfluxDbSqlConstant.CP95.equalsIgnoreCase(valueTypeKey)) {
assembleSqlAndQuery(tMap, newMap.get("LEVEL"), newMap.get("PT"), newMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.CP95, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList,tableMap);
assembleSqlAndQuery(tMap, ledgerMap.get("LEVEL"), ledgerMap.get("PT"), ledgerMap.get("CT"), phaseVal, sql, endList, InfluxDbSqlConstant.CP95, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, noPhaseList,tableMap);
}
});
@@ -681,7 +681,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
//处理指标最终判定合格还是不合格
dealTargetResult(assNoPassMap, limitTargetMapX, endList);
}
resultAssemble(endList, reportSearchParam, newMap, deviceUnitCommDTO, jsonArray);
resultAssemble(endList, reportSearchParam, ledgerMap, deviceUnitCommDTO, jsonArray);
//导出自定义报表
downReport(jsonArray, response);
}
@@ -1305,68 +1305,70 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
data = data.stream().peek(item -> item.setValue("/")).collect(Collectors.toList());
} else {
// 兼容达梦数据库方法
Map<String, Object> map = convertKeysToUpperCase(mapList.get(0));
for (ReportTemplateDTO item : data) {
if (map.containsKey(item.getItemName())) {
double v = Double.parseDouble(map.get(item.getItemName()).toString());
item.setValue(String.format("%.3f", v));
if(Objects.nonNull(mapList.get(0))) {
Map<String, Object> map = convertKeysToUpperCase(mapList.get(0));
for (ReportTemplateDTO item : data) {
if (map.containsKey(item.getItemName())) {
double v = Double.parseDouble(map.get(item.getItemName()).toString());
item.setValue(String.format("%.3f", v));
// 处理overLimitMap越限判断
if (overLimitMap != null && overLimitMap.containsKey(item.getLimitName())) {
Float tagVal = overLimitMap.get(item.getLimitName());
// 处理overLimitMap越限判断
if (overLimitMap != null && overLimitMap.containsKey(item.getLimitName())) {
Float tagVal = overLimitMap.get(item.getLimitName());
if (item.getLimitName() != null && item.getLimitName().equalsIgnoreCase(UVOLTAGE_DEV)) {
// 对电压偏差特殊处理
Float tagVal_U = overLimitMap.get(UVOLTAGE_DEV);
if (v > tagVal || v < tagVal_U) {
item.setOverLimitFlag(1);
} else {
item.setOverLimitFlag(0);
}
} else {
if (v > tagVal) {
item.setOverLimitFlag(1);
} else {
item.setOverLimitFlag(0);
}
}
}
// 判断是否越限limitMap处理
if (limitMap != null && !limitMap.isEmpty()) {
String key = item.getLimitName() + STR_ONE + item.getStatMethod() + "#PQ_OVERLIMIT";
if (limitMap.containsKey(key)) {
ReportTemplateDTO tem = limitMap.get(key);
double limitVal = Double.parseDouble(tem.getValue());
if (VOLTAGE_DEV.equalsIgnoreCase(tem.getLimitName())) {
// 针对电压偏差特殊处理
double limitLowVal = Double.parseDouble(tem.getLowValue());
if (v > limitVal || v < limitLowVal) {
tem.setOverLimitFlag(1);
if (assNoPassMap != null) {
assNoPassMap.put(key, tem);
}
} else if (assNoPassMap != null && !assNoPassMap.containsKey(key)) {
tem.setOverLimitFlag(0);
assNoPassMap.put(key, tem);
if (item.getLimitName() != null && item.getLimitName().equalsIgnoreCase(UVOLTAGE_DEV)) {
// 对电压偏差特殊处理
Float tagVal_U = overLimitMap.get(UVOLTAGE_DEV);
if (v > tagVal || v < tagVal_U) {
item.setOverLimitFlag(1);
} else {
item.setOverLimitFlag(0);
}
} else {
// 其他指标
if (v > limitVal) {
tem.setOverLimitFlag(1);
if (assNoPassMap != null) {
assNoPassMap.put(key, tem);
}
} else if (assNoPassMap != null && !assNoPassMap.containsKey(key)) {
tem.setOverLimitFlag(0);
assNoPassMap.put(key, tem);
if (v > tagVal) {
item.setOverLimitFlag(1);
} else {
item.setOverLimitFlag(0);
}
}
}
// 判断是否越限limitMap处理
if (limitMap != null && !limitMap.isEmpty()) {
String key = item.getLimitName() + STR_ONE + item.getStatMethod() + "#PQ_OVERLIMIT";
if (limitMap.containsKey(key)) {
ReportTemplateDTO tem = limitMap.get(key);
double limitVal = Double.parseDouble(tem.getValue());
if (VOLTAGE_DEV.equalsIgnoreCase(tem.getLimitName())) {
// 针对电压偏差特殊处理
double limitLowVal = Double.parseDouble(tem.getLowValue());
if (v > limitVal || v < limitLowVal) {
tem.setOverLimitFlag(1);
if (assNoPassMap != null) {
assNoPassMap.put(key, tem);
}
} else if (assNoPassMap != null && !assNoPassMap.containsKey(key)) {
tem.setOverLimitFlag(0);
assNoPassMap.put(key, tem);
}
} else {
// 其他指标
if (v > limitVal) {
tem.setOverLimitFlag(1);
if (assNoPassMap != null) {
assNoPassMap.put(key, tem);
}
} else if (assNoPassMap != null && !assNoPassMap.containsKey(key)) {
tem.setOverLimitFlag(0);
assNoPassMap.put(key, tem);
}
}
}
}
} else {
item.setValue("/");
}
} else {
item.setValue("/");
}
}
}
@@ -1486,7 +1488,7 @@ public class CustomReportTableServiceImpl implements CustomReportTableService {
} else if (v.charAt(0) == '&') {
//结论
String tem = v.replace(STR_THREE, "").toUpperCase();
if (finalTerminalMap.size() > 0) {
if (!finalTerminalMap.isEmpty()) {
if ("STATIS_TIME".equals(tem)) {
//如何时间是大于当前时间则用当前时间
String localTime = InfluxDbSqlConstant.END_TIME;