root 2 年之前
父节点
当前提交
91bbb12556

+ 12 - 1
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/manager/TaskManager.java

@@ -32,7 +32,9 @@ import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
+import java.io.BufferedReader;
 import java.io.File;
+import java.io.InputStreamReader;
 import java.util.*;
 import java.util.concurrent.FutureTask;
 import java.util.concurrent.TimeUnit;
@@ -263,7 +265,16 @@ public class TaskManager {
                     MinioUtil.downloadToFile(minioClient, bucketName, result1OfMinio, result1OfLinux);  // 也可改成下载到指定ip的服务器上,需要保证和打分脚本在一台机器上。
                     MinioUtil.downloadToFile(minioClient, bucketName, result2OfMinio, result2OfLinux);  // 也可改成下载到指定ip的服务器上,需要保证和打分脚本在一台机器上。
                     log.info("TaskService--state 开始执行打分命令:" + scoreCommand);
-                    scoreResult = SshUtil.execute(session, scoreCommand);
+                    Runtime r = Runtime.getRuntime();
+                    Process p = r.exec(scoreCommand, null, new File(scoreDirectoryOfUser));
+                    BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
+                    StringBuilder sb = new StringBuilder();
+                    String inline;
+                    while (null != (inline = br.readLine())) {
+                        sb.append(inline).append("\n");
+                    }
+                    scoreResult = sb.toString();
+//                    scoreResult = SshUtil.execute(session, scoreCommand);
                     log.info("TaskService--state 项目" + projectId + " 的任务 " + task2Id + " 打分结束,结果为:" + scoreResult);
                     String replace = StringUtil.replace(scoreResult, "'", "\"");
                     try {

+ 2 - 1
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/util/MinioUtil.java

@@ -169,9 +169,10 @@ public class MinioUtil {
                     .filename(targetFilePath)
                     .build());
         } else {
-            throw new RuntimeException("downloadToFile() minio 文件不存在。");
+            throw new RuntimeException("downloadToFile() minio 文件" + object + "不存在。");
         }
     }
+
     /**
      * 下载文件
      */

+ 3 - 1
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/util/ProjectUtil.java

@@ -162,7 +162,9 @@ public class ProjectUtil {
     @SneakyThrows
     public void createNextPod2(String projectId, String nodeName, String lastPodName) {
         //1 删除上一个 pod 和 redis 键值对 和 旧的 yaml 文件
-        new Thread(() -> deletePod(lastPodName), "delete-" + lastPodName).start();
+//        new Thread(() -> deletePod(lastPodName), "delete-" + lastPodName).start();
+        //
+        deletePod(lastPodName);
         List<String> list = FileUtil.listAbsolutePath(podYamlDirectory);
         Iterator<String> iterator1 = list.iterator();
         while (iterator1.hasNext()) {

+ 6 - 7
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/SceneAccidentService.java

@@ -214,7 +214,6 @@ public class SceneAccidentService {
             } else {
                 list = sceneAccidentMapper.querySceneAccidentListByQx(params);
             }
-
         } else if (DictConstants.ROLE_CODE_UESR.equals(roleCode)) {
             //查询普通账户
             params.setUserId(userId);
@@ -291,10 +290,10 @@ public class SceneAccidentService {
         }*/
 
         for (SceneAccidentPO po : list) {
-            if (po.getConflictBehavior().indexOf("追尾") > -1) {
+            if (po.getConflictBehavior().contains("追尾")) {
                 po.setLabel("追尾");
             }
-            if (po.getTargetDriving().indexOf("切入") > -1) {
+            if (po.getTargetDriving().contains("切入")) {
                 if (ObjectUtil.isNull(po.getLabel())) {
                     po.setLabel("目标车切入");
                 } else {
@@ -302,7 +301,7 @@ public class SceneAccidentService {
                 }
 
             }
-            if (po.getTargetDriving().indexOf("沿弯道行驶") > -1) {
+            if (po.getTargetDriving().contains("沿弯道行驶")) {
                 if (ObjectUtil.isNull(po.getLabel())) {
                     po.setLabel("目标车沿弯道行驶");
                 } else {
@@ -310,7 +309,7 @@ public class SceneAccidentService {
                 }
 
             }
-            if (po.getConflictType().indexOf("机动车-机动车") > -1) {
+            if (po.getConflictType().contains("机动车-机动车")) {
                 if (ObjectUtil.isNull(po.getLabel())) {
                     po.setLabel("机动车-机动车冲突");
                 } else {
@@ -340,10 +339,10 @@ public class SceneAccidentService {
 
 
         for (SceneAccidentPO po : list) {
-            if (po.getConflictBehavior().indexOf("追尾") > -1) {
+            if (po.getConflictBehavior().contains("追尾")) {
                 po.setLabel("追尾");
             }
-            if (po.getTargetDriving().indexOf("切入") > -1) {
+            if (po.getTargetDriving().contains("切入")) {
                 if (ObjectUtil.isNull(po.getLabel())) {
                     po.setLabel("目标车切入");
                 } else {

+ 2 - 2
simulation-resource-server/src/main/resources/mapper/scene/SceneAccidentMapper.xml

@@ -120,7 +120,7 @@
                 </foreach>
             </if>
         </where>
-        order by modify_time desc
+        order by modify_time, scene_name desc
     </select>
     <select id="querySceneAccidentListByBq" parameterType="api.common.pojo.param.scene.SceneAccidentParam"
             resultType="api.common.pojo.po.scene.SceneAccidentPO">
@@ -403,7 +403,7 @@
                 </foreach>
             </if>
         </where>
-        order by cc.modify_time desc
+        order by cc.modify_time,cc.scene_name desc
     </select>
 
     <select id="querySceneAccidentListByBqAndQx" parameterType="api.common.pojo.param.scene.SceneAccidentParam"

+ 2 - 2
simulation-resource-server/src/main/resources/mapper/scene/SceneNaturalMapper.xml

@@ -390,7 +390,7 @@
             <if test="userId != null and userId != ''">
                 and create_user_id =#{userId}
             </if>
-            order by modify_time desc
+            order by modify_time,natural_name desc
         </where>
     </select>
 
@@ -1757,7 +1757,7 @@
             <if test="share != null and share!= '' and share!=0">
                 and share !='0'
             </if>
-            order by modify_time desc
+            order by modify_time,natural_name desc
         </where>
     </select>
 

+ 2 - 2
simulation-resource-server/src/main/resources/mapper/scene/StandardsRegulationsMapper.xml

@@ -92,7 +92,7 @@
                 and create_user_id =#{userId}
             </if>
         </where>
-        order by modify_time desc
+        order by modify_time,scene_name desc
 
     </select>
 
@@ -245,7 +245,7 @@
                 and share !='0'
             </if>
         </where>
-        order by modify_time desc
+        order by modify_time,scene_name desc
 
     </select>