From 9150c5b67bef891eaaab49495989c9ae84b28c3e Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Mon, 22 Jul 2024 17:39:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A4=E9=80=9A=E6=B5=81=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=98=B2=E6=AD=A2=E6=95=B0=E6=8D=AE=E9=87=8F=E5=A4=AA=E5=A4=A7?= =?UTF-8?q?,=E6=AF=8F=E6=AC=A1=E4=B8=80=E4=B8=87=E6=9D=A1=E5=88=86?= =?UTF-8?q?=E6=89=B9=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DcGantryStatisticsDataImpl.java | 9 ++++++++- .../impl/IDcGantryMetricsStatisticsDataServiceImpl.java | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) 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); + } } /**