浙江无线报表调整

This commit is contained in:
2024-12-24 15:01:37 +08:00
parent f0ffb63cff
commit 43af977942

View File

@@ -1180,8 +1180,8 @@ public class CustomReportServiceImpl implements CustomReportService {
//组装最后监测点条件
List<WlRecord> temList = wlRecordFeignClient.getWlAssByWlId(reportSearchParam.getLineId()).getData();
List<WlRecord> wlRecordList = temList.stream().filter(it -> it.getType() == 1).collect(Collectors.toList());
if (CollUtil.isEmpty(wlRecordList)) {
//List<WlRecord> wlRecordList = temList.stream().filter(it -> it.getType() == 1).collect(Collectors.toList());
if (CollUtil.isEmpty(temList) && temList.size()==1) {
throw new BusinessException("当前测试项无测试数据");
}
@@ -1209,13 +1209,13 @@ public class CustomReportServiceImpl implements CustomReportService {
phaseMap.forEach((phaseKey, phaseVal) -> {
StringBuilder sql = new StringBuilder(InfluxDbSqlConstant.SELECT);
if (InfluxDbSqlConstant.MAX.equalsIgnoreCase(valueTypeKey)) {
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.MAX, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, wlRecordList, pqdMap);
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.MAX, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, temList, pqdMap);
} else if (InfluxDbSqlConstant.MIN.equalsIgnoreCase(valueTypeKey)) {
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.MIN, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, wlRecordList, pqdMap);
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.MIN, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, temList, pqdMap);
} else if (InfluxDbSqlConstant.AVG_WEB.equalsIgnoreCase(valueTypeKey)) {
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.AVG, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, wlRecordList, pqdMap);
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.AVG, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, temList, pqdMap);
} else if (InfluxDbSqlConstant.CP95.equalsIgnoreCase(valueTypeKey)) {
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.PERCENTILE, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, wlRecordList, pqdMap);
assSqlZhejiang(phaseVal, sql, endList, InfluxDbSqlConstant.PERCENTILE, reportSearchParam, limitTargetMapX, limitMap, assNoPassMap, temList, pqdMap);
}
});
});
@@ -1247,7 +1247,7 @@ public class CustomReportServiceImpl implements CustomReportService {
finalTerminalMap.put("pt",wlRecordMain.getCt().toString());
finalTerminalMap.put("ct",wlRecordMain.getPt().toString());
finalTerminalMap.put("Standard_Capacity",wlRecordMain.getCapacitySi().toString());
finalTerminalMap.put("Standard_Capacity",wlRecordMain.getCapacitySscb().toString());
finalTerminalMap.put("Short_Capacity",wlRecordMain.getCapacitySscmin().toString());
finalTerminalMap.put("Deal_Capacity",wlRecordMain.getCapacitySi().toString());
finalTerminalMap.put("Dev_Capacity",wlRecordMain.getCapacitySt().toString());
@@ -1336,37 +1336,45 @@ public class CustomReportServiceImpl implements CustomReportService {
.append(InfluxDbSqlConstant.QM);
List<Map<String, Object>> allList = new ArrayList<>();
for (WlRecord wlRecord : wlRecordList) {
StringBuilder temSql = new StringBuilder(sql);
String start = LocalDateTimeUtil.format(wlRecord.getStartTime(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
String end = LocalDateTimeUtil.format(wlRecord.getEndTime(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
temSql.append(" and line_id = '").append(wlRecord.getLineId()).append(InfluxDbSqlConstant.QM)
.append(InfluxDbSqlConstant.AND)
.append(InfluxDbSqlConstant.TIME).append(InfluxDbSqlConstant.GE).append(InfluxDbSqlConstant.QM).append(start).append(InfluxDbSqlConstant.QM)
.append(InfluxDbSqlConstant.AND)
.append(InfluxDbSqlConstant.TIME).append(InfluxDbSqlConstant.LT).append(InfluxDbSqlConstant.QM).append(end).append(InfluxDbSqlConstant.QM)
.append(InfluxDbSqlConstant.TZ);
List<Map<String, Object>> temMapList = influxDbUtils.getMapResult(temSql.toString());
if (CollUtil.isNotEmpty(temMapList)) {
Map<String, Object> tem = temMapList.get(0);
//需要吧测点为二次值的转换为一次值
if (wlRecord.getDataLevel().equals("Secondary")) {
for (Map.Entry<String, Object> entry : tem.entrySet()) {
if (Objects.nonNull(entry.getValue()) && !entry.getKey().equals("time")) {
String key = entry.getKey();
double val = (double) entry.getValue();
String zi = key.substring(0, key.indexOf("#"));
if (pqdMap.containsKey(zi)) {
EleEpdPqd eleEpdPqd = pqdMap.get(zi).get(0);
double vRes = DataChangeUtil.secondaryToPrimary(eleEpdPqd.getPrimaryFormula(), val / 1000, (double) wlRecord.getPt(), (double) wlRecord.getCt());
entry.setValue(vRes);
WlRecord ceShiItem = wlRecordList.stream().filter(it->it.getType()==0).collect(Collectors.toList()).get(0);
for (WlRecord wlRecord : wlRecordList) {
if(wlRecord.getType().equals(1)) {
StringBuilder temSql = new StringBuilder(sql);
String start = LocalDateTimeUtil.format(wlRecord.getStartTime(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
String end = LocalDateTimeUtil.format(wlRecord.getEndTime(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
temSql.append(" and line_id = '").append(wlRecord.getLineId()).append(InfluxDbSqlConstant.QM)
.append(InfluxDbSqlConstant.AND)
.append(InfluxDbSqlConstant.TIME).append(InfluxDbSqlConstant.GE).append(InfluxDbSqlConstant.QM).append(start).append(InfluxDbSqlConstant.QM)
.append(InfluxDbSqlConstant.AND)
.append(InfluxDbSqlConstant.TIME).append(InfluxDbSqlConstant.LT).append(InfluxDbSqlConstant.QM).append(end).append(InfluxDbSqlConstant.QM)
.append(InfluxDbSqlConstant.TZ);
List<Map<String, Object>> temMapList = influxDbUtils.getMapResult(temSql.toString());
if (CollUtil.isNotEmpty(temMapList)) {
Map<String, Object> tem = temMapList.get(0);
//需要吧测点为二次值的转换为一次值
if (wlRecord.getDataLevel().equals("Secondary")) {
for (Map.Entry<String, Object> entry : tem.entrySet()) {
if (Objects.nonNull(entry.getValue()) && !entry.getKey().equals("time")) {
String key = entry.getKey();
double val = (double) entry.getValue();
String zi = key.substring(0, key.indexOf("#"));
zi = zi.substring(0,zi.lastIndexOf("_"));
if (pqdMap.containsKey(zi)) {
EleEpdPqd eleEpdPqd = pqdMap.get(zi).get(0);
if(!eleEpdPqd.getPrimaryFormula().equals("*CT")){
val = val / 1000;
}
double vRes = DataChangeUtil.secondaryToPrimary(eleEpdPqd.getPrimaryFormula(),val, (double) ceShiItem.getPt(), (double) ceShiItem.getCt());
entry.setValue(vRes);
}
}
}
}
}
allList.add(temMapList.get(0));
allList.add(temMapList.get(0));
}
}
}