fix(service): 修复设备名称获取和统计计算问题

- 修正设备名称字段从 getName() 改为 getDeviceName()
- 修正完整性计算逻辑从 Math.max 改为 Math.min
- 修正在线率计算逻辑从 Math.max 改为 Math.min
- 确保统计数据不会超过100%的最大限制
This commit is contained in:
xy
2026-06-15 14:52:16 +08:00
parent ad7835f0db
commit d44b4f3576
2 changed files with 3 additions and 3 deletions

View File

@@ -736,7 +736,7 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
vo.setLineName(lineMap.get(item.getLineId()).getName());
}
if (!Objects.isNull(item.getDeviceId())) {
vo.setDeviceName(devMap.get(item.getDeviceId()).get(0).getName());
vo.setDeviceName(devMap.get(item.getDeviceId()).get(0).getDeviceName());
}
vo.setEvent(item.getTag());
voRecords.add(vo);

View File

@@ -154,7 +154,7 @@ public class StatisticsDataDataServiceImpl implements IStatisticsDataDataService
BigDecimal.valueOf(l1.stream().mapToDouble(RStatIntegrityD::getDueTime).sum()),
2, RoundingMode.HALF_UP
).doubleValue();
vo.setIntegrity(Math.max(ratio,100.0));
vo.setIntegrity(Math.min(ratio,100.0));
} else {
vo.setIntegrity(0.0);
}
@@ -163,7 +163,7 @@ public class StatisticsDataDataServiceImpl implements IStatisticsDataDataService
if (CollectionUtil.isNotEmpty(l2)) {
int onlineMin = l2.stream().mapToInt(RStatOnlineRateD::getOnlineMin).sum();
double ratio = new BigDecimal(onlineMin * 100.0 / (1440 * l2.size())).setScale(2,RoundingMode.HALF_UP).doubleValue();
vo.setOnlineRate(Math.max(ratio,100.0));
vo.setOnlineRate(Math.min(ratio,100.0));
} else {
vo.setOnlineRate(0.0);
}