wuweihao 3 лет назад
Родитель
Сommit
f86d619b08

+ 5 - 1
720yun_fd_manage/gis_common/src/main/java/com/gis/common/util/FileUtils.java

@@ -11,6 +11,7 @@ import lombok.extern.log4j.Log4j2;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.junit.Test;
+import org.slf4j.MDC;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.stereotype.Component;
@@ -786,10 +787,13 @@ public class FileUtils {
         if (StrUtil.isNotBlank(path)){
             String delPath = configConstant.serverBasePath + path;
             // 异步执行
+            String traceId = MDC.get("TRACE_ID");
             ThreadUtil.execAsync(() -> {
+                MDC.put("TRACE_ID", traceId);
                 FileUtil.del(delPath);
-                log.info("真删除文件: {}", delPath);
+                log.info("异步删除完成: {}", delPath);
             });
+            log.info("真删除文件: {}", delPath);
 
 
         }