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 0efd38db..067e7444 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 @@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.exception.ServiceException; +import com.zc.business.domain.DcGantryMetricsStatisticsData; import com.zc.business.domain.DcGantryStatisticsData; import com.zc.business.domain.OdsTollEtctuData; import com.zc.business.enums.TrafficDataPeriodTypeEnum; @@ -144,7 +145,13 @@ public class DcGantryStatisticsDataImpl extends ServiceImpl batchList = dcGantryStatisticsDataList.subList(i, end); + dcGantryStatisticsDataMapper.insertOrUpdateBatch(batchList); + } } /** 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 f845fd79..14688a76 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 @@ -409,7 +409,14 @@ public class IDcGantryMetricsStatisticsDataServiceImpl if (gantryMetricsStatisticsDataList == null || gantryMetricsStatisticsDataList.isEmpty()) { return; } - gantryMetricsStatisticsDataMapper.insertOrUpdateBatch(gantryMetricsStatisticsDataList); + + //防止数据量太大,每次一万条分批执行 + for (int i = 0; i < gantryMetricsStatisticsDataList.size(); i+=10000) { + int end = Math.min(i + 10000, gantryMetricsStatisticsDataList.size()); + + List batchList = gantryMetricsStatisticsDataList.subList(i, end); + gantryMetricsStatisticsDataMapper.insertOrUpdateBatch(batchList); + } } /**