From 56c552e2d196cda3290394caccc93755e3a768f2 Mon Sep 17 00:00:00 2001 From: YXY <932687738@qq.com> Date: Tue, 5 Sep 2023 21:28:12 +0800 Subject: [PATCH] =?UTF-8?q?odoo=E5=A2=9E=E5=8A=A0=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E9=87=8D=E8=AF=95=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/quartz/task/odoo/OdooAbstrackob.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/odoo/OdooAbstrackob.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/odoo/OdooAbstrackob.java index b69931a..7ed0ddf 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/odoo/OdooAbstrackob.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/odoo/OdooAbstrackob.java @@ -105,7 +105,7 @@ public abstract class OdooAbstrackob { LarkTableRelation tableRelation = context.getTableRelation(); LarkTableRequest larkRequest = new LarkTableRequest(companyRelation.getAppId(), companyRelation.getSecret(), tableRelation.getToAppToken(), tableRelation.getToTableId()); List errorList = new ArrayList<>(); - batchCreate(context, pageMap, larkRequest, errorList); + batchCreate(context, pageMap, larkRequest, errorList,1); if (!CollectionUtils.isEmpty(errorList)) { String errorKey = String.join(",", errorList); throw new RuntimeException(String.format("存在同步失败的记录 %s", errorKey)); @@ -113,7 +113,7 @@ public abstract class OdooAbstrackob { } - private void batchCreate(OdooContext context, Map pageMap, LarkTableRequest larkRequest, List errorList) { + private void batchCreate(OdooContext context, Map pageMap, LarkTableRequest larkRequest, List errorList,Integer retryCount) { //查询结果 List dateList = new ArrayList<>(); List retryPageList = new ArrayList<>(); @@ -134,9 +134,9 @@ public abstract class OdooAbstrackob { } pageMap.put(PAGE_OFFSET_KEY, pageMap.get(PAGE_OFFSET_KEY) + PAGE_SIZE); } while (dateList == null || (CollectionUtils.isNotEmpty(dateList) && dateList.size() == PAGE_SIZE)); - if (retryPageList.size() > 0) { + if (retryPageList.size() > 0 && retryCount <= 3) { pageMap.put(PAGE_OFFSET_KEY, retryPageList.get(0) + PAGE_SIZE); - batchCreate(context, pageMap, larkRequest, errorList); + batchCreate(context, pageMap, larkRequest, errorList,retryCount + 1); } }