|
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.io.file.FileReader;
|
|
import cn.hutool.core.io.file.FileReader;
|
|
import cn.hutool.core.thread.ThreadUtil;
|
|
import cn.hutool.core.thread.ThreadUtil;
|
|
|
|
+import cn.hutool.core.util.IdUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
@@ -20,6 +21,7 @@ import com.fdkk.sxz.util.*;
|
|
import com.fdkk.sxz.webApi.service.*;
|
|
import com.fdkk.sxz.webApi.service.*;
|
|
import com.fdkk.sxz.webApi.service.custom.ICustomComponentService;
|
|
import com.fdkk.sxz.webApi.service.custom.ICustomComponentService;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.slf4j.MDC;
|
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -110,7 +112,10 @@ public class RunBuild {
|
|
@RabbitListener(queues = TopicRabbitConfig.MODEL)
|
|
@RabbitListener(queues = TopicRabbitConfig.MODEL)
|
|
public void model(String str) {
|
|
public void model(String str) {
|
|
RunBuild.log.info("模型转换:" + str);
|
|
RunBuild.log.info("模型转换:" + str);
|
|
|
|
+ String traceId = IdUtil.getSnowflake().nextIdStr();
|
|
|
|
+ MDC.put("TRACE_ID", traceId);
|
|
modelBuild(str);
|
|
modelBuild(str);
|
|
|
|
+ MDC.clear();
|
|
}
|
|
}
|
|
|
|
|
|
@RabbitHandler
|
|
@RabbitHandler
|
|
@@ -800,7 +805,7 @@ public class RunBuild {
|
|
//上锁保证只有一个在消费,加锁一个钟,成功消费就解锁了
|
|
//上锁保证只有一个在消费,加锁一个钟,成功消费就解锁了
|
|
String token = RedisUtil.tryLock(fileId, 60 * 60 * 1000);
|
|
String token = RedisUtil.tryLock(fileId, 60 * 60 * 1000);
|
|
if (token != null) {
|
|
if (token != null) {
|
|
- RunBuild.log.info("暂无的fileId:" + fileId + "消费,继续执行处理逻辑");
|
|
|
|
|
|
+ RunBuild.log.info("暂无的fileId:" + fileId + "消费,继续执行处理逻辑模型上传逻辑");
|
|
try {
|
|
try {
|
|
String path = buildPath + "upload";
|
|
String path = buildPath + "upload";
|
|
String filePath = path + File.separator + fileId + File.separator;
|
|
String filePath = path + File.separator + fileId + File.separator;
|
|
@@ -1190,6 +1195,7 @@ public class RunBuild {
|
|
|
|
|
|
|
|
|
|
} finally {
|
|
} finally {
|
|
|
|
+ MDC.clear();
|
|
if (token != null) {
|
|
if (token != null) {
|
|
RedisUtil.unlock(fileId, token);
|
|
RedisUtil.unlock(fileId, token);
|
|
}
|
|
}
|