diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcGantryStatisticsDataImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcGantryStatisticsDataImpl.java index 91095202..d40b9185 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcGantryStatisticsDataImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcGantryStatisticsDataImpl.java @@ -141,6 +141,9 @@ public class DcGantryStatisticsDataImpl extends ServiceImpl dcGantryStatisticsDataList) { + if (dcGantryStatisticsDataList == null || dcGantryStatisticsDataList.isEmpty()) { + return; + } dcGantryStatisticsDataMapper.insertOrUpdateBatch(dcGantryStatisticsDataList); } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/IDcGantryMetricsStatisticsDataServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/IDcGantryMetricsStatisticsDataServiceImpl.java index 3c5e1a8c..4df08393 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/IDcGantryMetricsStatisticsDataServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/IDcGantryMetricsStatisticsDataServiceImpl.java @@ -168,6 +168,9 @@ public class IDcGantryMetricsStatisticsDataServiceImpl * 然后分别计算每个门架的统计信息,并将这些统计信息添加到每日交通门架指标统计缓存中。 */ private void recoveryHourlyCache(List gantryMetricsStatisticsDataList) { + if (gantryMetricsStatisticsDataList == null || gantryMetricsStatisticsDataList.isEmpty()) { + return; + } gantryMetricsStatisticsDataMapper.insertOrUpdateBatch(gantryMetricsStatisticsDataList); } diff --git a/zc-business/src/main/java/com/zc/business/statistics/handler/TrafficGantryMetricsStatistics.java b/zc-business/src/main/java/com/zc/business/statistics/handler/TrafficGantryMetricsStatistics.java index 866c5c99..b66ace17 100644 --- a/zc-business/src/main/java/com/zc/business/statistics/handler/TrafficGantryMetricsStatistics.java +++ b/zc-business/src/main/java/com/zc/business/statistics/handler/TrafficGantryMetricsStatistics.java @@ -46,6 +46,11 @@ public class TrafficGantryMetricsStatistics { public void performHourlyCleanupAndPersist() { List lastHourData = dcGantryMetricsStatisticsDataService.lastHourData(); + + if (lastHourData == null || lastHourData.isEmpty()) { + return; + } + // 数据库批量插入最近一小时的数据 dcGantryMetricsStatisticsDataMapper.insertOrUpdateBatch(lastHourData); diff --git a/zc-business/src/main/java/com/zc/business/statistics/handler/TrafficGantryStatistics.java b/zc-business/src/main/java/com/zc/business/statistics/handler/TrafficGantryStatistics.java index f309afa6..fd73854c 100644 --- a/zc-business/src/main/java/com/zc/business/statistics/handler/TrafficGantryStatistics.java +++ b/zc-business/src/main/java/com/zc/business/statistics/handler/TrafficGantryStatistics.java @@ -45,6 +45,11 @@ public class TrafficGantryStatistics { public void performHourlyCleanupAndPersist() { List lastHourData = dcGantryStatisticsDataService.lastHourData(); + + if (lastHourData == null || lastHourData.isEmpty()) { + return; + } + // 数据库批量插入最近一小时的数据 dcGantryStatisticsDataMapper.insertOrUpdateBatch(lastHourData);