|
@@ -1,6 +1,7 @@
|
|
|
package com.gis.service.impl;
|
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
+import cn.hutool.core.thread.ThreadUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.core.util.XmlUtil;
|
|
|
import com.gis.constant.CmdConstant;
|
|
@@ -100,15 +101,15 @@ public class FodderServiceImpl implements FodderService {
|
|
|
|
|
|
log.info("切图流程开始 : " + id);
|
|
|
long start = System.currentTimeMillis();
|
|
|
- FodderEntity entity = fodderMapper.findById(id);
|
|
|
- //重复三次查询每次睡一秒
|
|
|
- for (int i = 0; i < 3 && entity == null; i++) {
|
|
|
- try {
|
|
|
- Thread.sleep(1000);
|
|
|
- } catch (InterruptedException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
+ FodderEntity entity = null;
|
|
|
+ int maxAttempts = 3; // 定义尝试次数
|
|
|
+ int attempts = 0; // 尝试次数计数器
|
|
|
+ while (entity == null && attempts < maxAttempts) {
|
|
|
entity = fodderMapper.findById(id);
|
|
|
+ if (entity == null) {
|
|
|
+ ThreadUtil.safeSleep(1000); // 暂停1000毫秒(1秒)
|
|
|
+ attempts++;
|
|
|
+ }
|
|
|
}
|
|
|
if (entity == null) {
|
|
|
log.error("场景不存在: " + id);
|