1.bug调整
This commit is contained in:
@@ -64,7 +64,7 @@ public class PowerStatisticsController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getTargetByTime")
|
||||
@ApiOperation("点击越限列表时间查询指标的详细数据")
|
||||
public HttpResult<List<ThdDataVO>> getTargetByTime(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam) {
|
||||
public HttpResult<List<ThdDataVO>> getTargetByTime(@RequestBody PowerStatisticsParam powerStatisticsParam) {
|
||||
String methodDescribe = getMethodDescribe("getTargetByTime");
|
||||
List<ThdDataVO> targetByTime = powerStatisticsService.getTargetByTimeDetail(powerStatisticsParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, targetByTime, methodDescribe);
|
||||
@@ -73,14 +73,14 @@ public class PowerStatisticsController extends BaseController {
|
||||
@ResponseBody
|
||||
@ApiOperation("导出区间数据")
|
||||
@PostMapping(value = "exportExcelRangTemplate")
|
||||
public void exportExcelRangTemplate(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam,HttpServletResponse response) {
|
||||
public void exportExcelRangTemplate(@RequestBody PowerStatisticsParam powerStatisticsParam,HttpServletResponse response) {
|
||||
powerStatisticsService.exportExcelRangTemplate(powerStatisticsParam,response);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@ApiOperation("导出指标越限列表数据")
|
||||
@PostMapping(value = "exportExcelListTemplate")
|
||||
public void exportExcelListTemplate(@RequestBody @Validated PowerStatisticsParam powerStatisticsParam,HttpServletResponse response) {
|
||||
public void exportExcelListTemplate(@RequestBody PowerStatisticsParam powerStatisticsParam,HttpServletResponse response) {
|
||||
powerStatisticsService.exportExcelListTemplate(powerStatisticsParam,response);
|
||||
}
|
||||
|
||||
|
||||
@@ -167,12 +167,16 @@ public class RMpTargetWarnDServiceImpl extends ServiceImpl<RMpTargetWarnDMapper,
|
||||
List<GridDiagramVO.StatisticsData> statisticsData = new ArrayList<>();
|
||||
List<GridDiagramVO.StatisticsData> gwStatisticsData = new ArrayList<>();
|
||||
|
||||
List<String> idsList = new ArrayList<>();
|
||||
int allNum = 0;
|
||||
for(String voltage:voltageIds){
|
||||
GridDiagramVO.StatisticsData voltageItem = new GridDiagramVO.StatisticsData();
|
||||
voltageItem.setColumnName(voltage);
|
||||
if(voltageMonitorMap.containsKey(voltage)){
|
||||
List<String> ids = voltageMonitorMap.get(voltage).stream().map(LineDevGetDTO::getObjId).distinct().collect(Collectors.toList());
|
||||
voltageItem.setNumOne((long)ids.size());
|
||||
allNum+=ids.size();
|
||||
idsList.addAll(ids);
|
||||
voltageItem.setNumOneList(ids);
|
||||
}else {
|
||||
voltageItem.setNumOne(0L);
|
||||
@@ -180,6 +184,10 @@ public class RMpTargetWarnDServiceImpl extends ServiceImpl<RMpTargetWarnDMapper,
|
||||
}
|
||||
statisticsData.add(voltageItem);
|
||||
}
|
||||
GridDiagramVO.StatisticsData dataSum = new GridDiagramVO.StatisticsData();
|
||||
dataSum.setNumOneList(idsList);
|
||||
dataSum.setNumOne((long)allNum);
|
||||
statisticsData.add(dataSum);
|
||||
lineStatistics.setData(statisticsData);
|
||||
gwLineStatistics.setData(gwStatisticsData);
|
||||
|
||||
|
||||
@@ -115,6 +115,9 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
private final String STR_FOUR = "%";
|
||||
private final String UVOLTAGE_DEV = "UVOLTAGE_DEV";
|
||||
private final String VOLTAGE_DEV = "VOLTAGE_DEV";
|
||||
private final String PT = "PT";
|
||||
private final String CT = "CT";
|
||||
|
||||
|
||||
@Override
|
||||
public void getCustomReport(ReportSearchParam reportSearchParam, HttpServletResponse response) {
|
||||
@@ -126,6 +129,8 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
DeviceUnitCommDTO deviceUnitCommDTO = BeanUtil.copyProperties(deviceUnit, DeviceUnitCommDTO.class);
|
||||
|
||||
Map<String,String> finalTerminalMap = convertKeysToUpperCase(commTerminalGeneralClient.getCustomDetailByLineId(reportSearchParam.getLineId()).getData());
|
||||
finalTerminalMap.put(PT,formatSciNumber(finalTerminalMap.getOrDefault(PT,"N/A")));
|
||||
finalTerminalMap.put(CT,formatSciNumber(finalTerminalMap.getOrDefault(CT,"N/A")));
|
||||
customReportTableService.getCustomReport(reportSearchParam,finalTerminalMap,deviceUnitCommDTO, response);
|
||||
} else {
|
||||
//浙江无线报表
|
||||
@@ -1462,6 +1467,28 @@ public class CustomReportServiceImpl implements CustomReportService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 解析科学计数字符串,转为完整数字文本,原有小数原样保留
|
||||
* @param numStr 数据库返回字符串:123.00 / 1.234E+08 / N/A
|
||||
* @return 标准数字字符串
|
||||
*/
|
||||
public String formatSciNumber(String numStr) {
|
||||
// 空值或占位符直接返回
|
||||
if (numStr == null || "N/A".equals(numStr.trim())) {
|
||||
return numStr;
|
||||
}
|
||||
// 判断是否为科学计数格式
|
||||
if (numStr.toLowerCase().contains("e")) {
|
||||
// BigDecimal 可完美解析科学计数,输出完整数字,保留全部小数位
|
||||
String [] split =numStr.split(":");
|
||||
BigDecimal one = new BigDecimal(split[0]);
|
||||
BigDecimal two = new BigDecimal(split[1]);
|
||||
return (one.toPlainString().concat(":").concat(two.toPlainString()));
|
||||
}
|
||||
return numStr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user