From 65edd3e7264625b6a121b27d328c7fa3ac1d75a1 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 12 Jul 2021 17:07:14 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E6=A0=BC=E5=91=98=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=B8=8A=E6=8A=A5bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/impl/StatsUserServiceImpl.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java index 041fcf74d4..4117b32b7b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java @@ -34,6 +34,7 @@ import org.springframework.util.CollectionUtils; import java.util.Calendar; import java.util.Date; +import java.util.Iterator; import java.util.List; import java.util.concurrent.atomic.AtomicReference; @@ -170,9 +171,12 @@ public class StatsUserServiceImpl implements StatsUserService { //3.分批处理上传数据 List> partition = ListUtils.partition(formDTO.getDataList(), NumConstant.ONE_HUNDRED); - partition.forEach(p -> { + for (int i = 0; i < partition.size(); i++) { + List p = partition.get(i); //4.封装数据并执行 - p.forEach(m -> { + Iterator iterator = p.iterator(); + while (iterator.hasNext()) { + GmUploadEventFormDTO.DataList m = iterator.next(); AtomicReference bl = new AtomicReference<>(false); StringBuffer gridPids = new StringBuffer(""); agencyList.forEach(ag -> { @@ -190,13 +194,14 @@ public class StatsUserServiceImpl implements StatsUserService { m.setLatestPatrolStatus("end"); } else { log.warn(String.format("网格员事件总数上报,数据错误,根据agencyId未查询到组织信息,客户Id->%s,组织Id->%s", m.getCustomerId(), m.getAgencyId())); + iterator.remove(); } - }); + } //批量新增或修改数据 if (!CollectionUtils.isEmpty(p)) { userService.saveOrUpGmUploadEvent(p); } - }); + } }