diff --git a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/init/HandleTransInit.java b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/init/HandleTransInit.java index 913e0ba..6fae111 100644 --- a/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/init/HandleTransInit.java +++ b/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/ocr/init/HandleTransInit.java @@ -130,7 +130,19 @@ public class HandleTransInit implements ApplicationRunner { //nohup python app.py & tail -f nohup.out & //更新主任务,正在识别中. conda activate ai ocrIdentifyService.updateMasterTaskStartTime(task_id.split("_")[0]); - JSONObject semanticResponseJson = RestUtil.post(OcrConstant.api_test2_identify_url, requestBody); + boolean flag=false; + JSONObject semanticResponseJson =null; + while (!flag){ + try { + semanticResponseJson = RestUtil.post(OcrConstant.api_test2_identify_url, requestBody); + if (semanticResponseJson!=null) { + flag=true; + } + }catch (org.springframework.web.client.ResourceAccessException e){ + log.error(e.getMessage()); + log.error("正在重试..."); + } + } semanticResponseJson.put("identifyId", masterTaskId); log.info("ocr识别返回数据:"); log.info(semanticResponseJson.toJSONString());