root 2 anos atrás
pai
commit
da68b7c53e

+ 18 - 0
simulation-resource-monitor/src/main/java/com/css/simulation/resource/monitor/mappper/ScenePackageSublistMapper.java

@@ -0,0 +1,18 @@
+package com.css.simulation.resource.monitor.mappper;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+
+@Mapper
+public interface ScenePackageSublistMapper {
+
+
+    @Select("select scene_generalization_ids\n" +
+            "from scene_package_sublist\n" +
+            "where scene_generalization_ids is not null\n" +
+            "  and scene_generalization_ids != ''")
+    List<String> selectSceneGeneralizationIds();
+}

+ 15 - 3
simulation-resource-monitor/src/main/java/com/css/simulation/resource/monitor/scheduler/MyScheduler.java

@@ -6,6 +6,7 @@ import api.common.util.SshUtil;
 import api.common.util.StringUtil;
 import api.common.util.TimeUtil;
 import com.css.simulation.resource.monitor.manager.SystemServerManager;
+import com.css.simulation.resource.monitor.mappper.ScenePackageSublistMapper;
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.sshd.client.SshClient;
@@ -18,6 +19,7 @@ import org.springframework.stereotype.Component;
 import javax.annotation.Resource;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 @Component
@@ -31,7 +33,9 @@ public class MyScheduler {
 
 
     @Resource
-    SystemServerManager systemServerManager;
+    private SystemServerManager systemServerManager;
+    @Resource
+    private ScenePackageSublistMapper scenePackageSublistMapper;
 
 
     @Scheduled(fixedDelay = 60 * 1000)
@@ -95,8 +99,16 @@ public class MyScheduler {
     @Scheduled(fixedDelay = 60 * 1000)
     public void deleteGeneral() {
         try {
-            //1 查询泛化场景表所有id
-            //2 查询泛化文件表
+            //1 查询泛化场景测试包包括的所有泛化场景id序列(保留已删除的测试包)
+            List<String> sceneGeneralizationIdsList = scenePackageSublistMapper.selectSceneGeneralizationIds();
+            //2 将所有序列拆开
+            List<String> sceneGeneralizationIdList = new ArrayList<>();
+            sceneGeneralizationIdsList.forEach(ids -> {
+                String[] split = ids.split(",");
+                sceneGeneralizationIdList.addAll(Arrays.asList(split));
+            });
+            //3 查询不在id列表中的所有泛化数据
+//            scenePackageSublistMapper.selectGeneralDataNotIn(sceneGeneralizationIdList);
         } catch (Exception e) {
             e.printStackTrace();
             throw new RuntimeException(e);