LingxinMeng há 1 ano atrás
pai
commit
abcbead2ae

+ 9 - 9
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/app/service/ProjectApplicationService.java

@@ -149,19 +149,19 @@ public class ProjectApplicationService {
             projectStartMessageEntity.setTaskCompleted(0);
             //去重,之后发送消息的时候会补全指标,如果不去重的话会出现多个场景重复关联多个指标
             Set<SceneEntity> sceneEntitySet = new HashSet<>(sceneEntityList);
-            log.info("项目 " + projectId + " 场景包括:" + sceneEntitySet);
+            log.info("项目 {} 场景包括:{}", projectId, sceneEntitySet);
             // -------------------------------- 2 算法导入 --------------------------------
-            log.info("项目 " + projectId + " 开始算法导入。");
+            log.info("项目 {} 开始算法导入。", projectId);
             String algorithmDockerImage = handleAlgorithm(projectId, algorithmId);
-            log.info("项目 " + projectId + " 算法已导入:" + algorithmDockerImage);
+            log.info("项目 {} 算法已导入:{}", projectId, algorithmDockerImage);
             customRedisClient.set("project:" + projectId + ":docker-image", algorithmDockerImage);
             // -------------------------------- 3 查询模型 --------------------------------
-            log.info("项目 " + projectId + " 开始查询模型。");
+            log.info("项目 {} 开始查询模型。", projectId);
             //1 根据车辆配置id vehicleConfigId, 获取 模型信息和传感器信息
             com.css.simulation.resource.scheduler.infra.entity.VehicleEntity vehicleEntity = vehicleMapper.selectByVehicleConfigId(vehicleConfigId);   // 车辆
             List<CameraEntity> cameraEntityList = sensorCameraMapper.selectCameraByVehicleConfigId(vehicleConfigId);    // 摄像头
             List<OgtEntity> ogtEntityList = sensorOgtMapper.selectOgtByVehicleId(vehicleConfigId); // 完美传感器
-            log.info("项目 " + projectId + " 开始保存任务消息。");
+            log.info("项目 {} 开始保存任务消息。", projectId);
             if (DictConstants.MODEL_TYPE_VTD.equals(modelType)) {
                 // -------------------------------- 4 保存任务消息 --------------------------------
                 List<TaskEntity> taskList = new ArrayList<>();
@@ -700,7 +700,7 @@ public class ProjectApplicationService {
         String algorithmDirectoryLinuxTempPath;
         String algorithmTarLinuxTempPath = null;
         if (algorithmEntity != null) {
-            log.info("项目" + projectId + "使用仿真平台自己的算法 " + algorithmEntity);
+            log.info("项目{}使用仿真平台自己的算法 {}", projectId, algorithmEntity);
             String algorithmCode = algorithmEntity.getAlgorithmCode();
             String dockerImport = algorithmEntity.getDockerImport();
             dockerImage = dockerConfiguration.getRegistry() + "/algorithm_" + algorithmCode + ":latest";
@@ -711,14 +711,14 @@ public class ProjectApplicationService {
                 if (DictConstants.ALGORITHM_UPLOAD_MODE_FILE.equals(uploadMode)) {
                     algorithmTarLinuxTempPath = linuxTempPath + "algorithm-file/" + algorithmCode + "/" + algorithmCode + ".tar";
                     String minioPath = algorithmEntity.getMinioPath();
-                    log.info("下载 minio 算法文件 " + minioPath + " 到本地 " + algorithmTarLinuxTempPath);
+                    log.info("下载 minio 算法文件 {} 到本地 {}", minioPath, algorithmTarLinuxTempPath);
                     MinioUtil.downloadToFile(minioClient, bucketName, minioPath, algorithmTarLinuxTempPath);
                 } else if (DictConstants.ALGORITHM_UPLOAD_MODE_GIT.equals(uploadMode)) {
                     algorithmDirectoryLinuxTempPath = linuxTempPath + "algorithm-git/" + algorithmCode + "/";
                     String gitUrl = algorithmEntity.getGitUrl().replace(gitConfiguration.getName(), gitConfiguration.getUrl());
                     String gitUserName = algorithmEntity.getGitUserName();
                     String gitPassword = algorithmEntity.getGitPassword();
-                    log.info("下载 git 算法文件 " + gitUrl + " 到本地 " + algorithmDirectoryLinuxTempPath);
+                    log.info("下载 git 算法文件 {} 到本地 {}", gitUrl, algorithmDirectoryLinuxTempPath);
                     GitUtil.clone(gitUrl, gitUserName, gitPassword, algorithmDirectoryLinuxTempPath, true);
                     for (String filename : Objects.requireNonNull(new File(algorithmDirectoryLinuxTempPath).list())) {
                         if (filename.endsWith(".tar")) {
@@ -735,7 +735,7 @@ public class ProjectApplicationService {
                 OsUtil.exec("docker import " + algorithmTarLinuxTempPath + " " + dockerImage);
                 OsUtil.exec("docker push " + dockerImage);
                 FileUtil.rm(algorithmTarLinuxTempPath);
-                log.info("已删除算法临时文件:" + algorithmTarLinuxTempPath);
+                log.info("已删除算法临时文件:{}", algorithmTarLinuxTempPath);
             } else {
                 throw new RuntimeException("算法 " + algorithmId + " 的 mysql 数据有误!");
             }

+ 2 - 2
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/domain/service/ProjectDomainService.java

@@ -185,7 +185,7 @@ public class ProjectDomainService {
         } else {
             throw new RuntimeException("模型类型错误:" + modelType);
         }
-        log.info("保存项目 " + projectId + " 的 yaml 文件:" + yamlPath);
+        log.info("保存项目 {} 的 yaml 文件:{}", projectId, yamlPath);
         FileUtil.writeStringToLocalFile(finalYaml, yamlPath);
         FileUtil.writeStringToLocalFile(finalYaml, yamlPathBak); // v20240409 备份一份yaml方便定位问题
         // 保存 yaml 地址
@@ -206,7 +206,7 @@ public class ProjectDomainService {
         for (String absolutePath : absolutePathList) {
             if (absolutePath.contains(projectId)) {
                 boolean delete = new File(absolutePath).delete();
-                log.debug("删除结果:" + delete);
+                log.debug("删除结果:{}", delete);
             }
         }
     }