wangyunpeng hai 2 semanas
pai
achega
1f83c56b7b

+ 15 - 1
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/CoreServiceImpl.java

@@ -1,5 +1,6 @@
 package com.tzld.piaoquan.longarticle.service.local.impl;
 
+import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
@@ -159,7 +160,20 @@ public class CoreServiceImpl implements CoreService {
         //操作计划遍历
         List<Plan> planList = planAccountService.getPlanList();
         Set<String> planIdSet = planList.stream().map(Plan::getPlanId).collect(Collectors.toSet());
-        List<LongArticleSystemPlan> allLongArticleSystemPlans = aigcService.getAllLongArticleSystemPlan();
+        List<LongArticleSystemPlan> allLongArticleSystemPlans = null;
+        int retryTimes = 3;
+        int retryCount = 0;
+        while (retryCount < retryTimes) {
+            try {
+                allLongArticleSystemPlans = aigcService.getAllLongArticleSystemPlan();
+                if (CollectionUtil.isNotEmpty(allLongArticleSystemPlans)) {
+                    break;
+                }
+            } catch (Exception e) {
+                log.error("initPlanAccount error, retryCount: {}", retryCount, e);
+            }
+            retryCount++;
+        }
         for (LongArticleSystemPlan longArticleSystemPlan : allLongArticleSystemPlans) {
             Plan plan = createPlan(longArticleSystemPlan);
             planAccountService.saveOrUpdatePlan(plan);