瀏覽代碼

Merge branch 'master' of http://10.15.12.70:3000/CSS/simulation-cloud

zhaoyan 3 年之前
父節點
當前提交
f63ba7467a
共有 36 個文件被更改,包括 889 次插入267 次删除
  1. 9 0
      api-common/src/main/java/api/common/pojo/constants/DictConstants.java
  2. 14 1
      api-common/src/main/java/api/common/pojo/dto/ProjectMessageDTO.java
  3. 19 6
      api-common/src/main/java/api/common/util/FileUtil.java
  4. 28 0
      api-common/src/main/java/api/common/util/LinuxUtil.java
  5. 20 0
      api-common/src/main/java/api/common/util/TimeUtil.java
  6. 8 0
      pom.xml
  7. 4 3
      simulation-oauth-server/src/main/java/com/css/simulation/oauth/server/cofiguration/oauth/OauthAuthorizationServerConfiguration.java
  8. 128 0
      simulation-resource-monitor/pom.xml
  9. 20 0
      simulation-resource-monitor/src/main/java/com/css/simulation/resource/monitor/SimulationResourceMonitorApplication.java
  10. 16 0
      simulation-resource-monitor/src/main/resources/bootstrap.yml
  11. 5 1
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/configuration/kubernetes/KubernetesConfiguration.java
  12. 227 0
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/consumer/ManualProjectConsumer.java
  13. 0 129
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/consumer/ProjectConsumer.java
  14. 8 6
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/feign/CommonService.java
  15. 5 6
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/feign/DemoController.java
  16. 2 2
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/feign/fallback/CommonServiceFallback.java
  17. 25 0
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/mapper/AlgorithmMapper.java
  18. 35 0
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/mapper/IndexMapper.java
  19. 104 0
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/mapper/SceneMapper.java
  20. 2 39
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/mapper/TaskMapper.java
  21. 51 0
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/mapper/VehicleMapper.java
  22. 1 1
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/DynamicsDTO.java
  23. 2 2
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/InfoDTO.java
  24. 1 1
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/ModelDTO.java
  25. 1 1
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/ScenarioDTO.java
  26. 1 1
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/SensorsDTO.java
  27. 1 1
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/TaskDTO.java
  28. 1 1
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/VehicleDTO.java
  29. 18 0
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/po/IndexPO.java
  30. 24 0
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/po/ScenePO.java
  31. 11 64
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/po/TaskPO.java
  32. 59 0
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/po/VehiclePO.java
  33. 4 1
      simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/service/TaskService.java
  34. 1 1
      simulation-resource-scheduler/src/main/resources/bootstrap.yml
  35. 18 0
      simulation-resource-scheduler/src/main/resources/kubernetes/config
  36. 16 0
      simulation-resource-scheduler/src/main/resources/kubernetes/template/job/job-template.yaml

+ 9 - 0
api-common/src/main/java/api/common/pojo/constants/DictConstants.java

@@ -24,6 +24,15 @@ public class DictConstants {
     public static final String SENSOR_RADAR = "4"; // 毫米波雷达表
     public static final String SENSOR_RADAR = "4"; // 毫米波雷达表
     public static final String SENSOR_GPS = "5"; // GPS 传感器表
     public static final String SENSOR_GPS = "5"; // GPS 传感器表
 
 
+    public static final String TASK_WAITING = "1"; // 任务执行状态,待执行
+
+    public static final String REGULATION_TYPE = "regulationType"; // 法规类型
+    public static final String SELF_DRIVING = "selfDriving"; // 自车驾驶行为
+    public static final String TARGET_DRIVING = "targetDriving"; // 目标驾驶行为
+    public static final String SELF_REACTION = "selfReaction"; // 自车反应行为
+    public static final String CONFLICT_BEHAVIOR = "conflictBehavior"; // 冲突行为
+    public static final String CONFLICT_TYPE = "conflictType"; // 冲突类型
+
 
 
 
 
     //算法校验状态
     //算法校验状态

+ 14 - 1
api-common/src/main/java/api/common/pojo/dto/ProjectMessageDTO.java

@@ -5,6 +5,16 @@ import lombok.Builder;
 import lombok.Data;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.NoArgsConstructor;
 
 
+/**
+ * {
+ *  "projectId": "sadfasdfs", // 项目 id
+ *  "algorithmId": "sadfasdfs", // 算法 id
+ *  "vehicleId": "sadfasdfs", // 车辆 id
+ *  "scenePackageId": "sadfasdfs", // 场景包 id
+ *  "maxSimulationTime": 11111, // 最大仿真时间
+ *  "parallelism": 30  // 并行度
+ * }
+ */
 @Data
 @Data
 @Builder
 @Builder
 @NoArgsConstructor
 @NoArgsConstructor
@@ -12,7 +22,10 @@ import lombok.NoArgsConstructor;
 public class ProjectMessageDTO {
 public class ProjectMessageDTO {
 
 
     private String projectId;// 项目 id
     private String projectId;// 项目 id
-    private String taskMaxExecuteTime;// 最大仿真时间(秒)
+    private String algorithmId;// 算法 id
+    private String vehicleId;// 车辆 id
+    private String scenePackageId;// 场景包 id
+    private int maxSimulationTime;// 最大仿真时间(秒)
     private int parallelism;// 并行度,创建 pod 时使用
     private int parallelism;// 并行度,创建 pod 时使用
 
 
 }
 }

+ 19 - 6
api-common/src/main/java/api/common/util/FileUtil.java

@@ -676,22 +676,34 @@ public class FileUtil {
     // -------------------------------- V --------------------------------
     // -------------------------------- V --------------------------------
     // -------------------------------- W --------------------------------
     // -------------------------------- W --------------------------------
 
 
+
     /**
     /**
-     * 将 web 文件保存到本地文件
+     * 将输入流保存为本地文件
      */
      */
-    public static void writeMultipartFileToLocalPath(MultipartFile multipartFile, String localPath) throws IOException {
-        writeInputStreamToLocalPath(multipartFile.getInputStream(), localPath);
+    public static void writeInputStreamToLocalFile(InputStream inputStream, String filePath) throws IOException {
+        BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
+        byte[] data = new byte[1024];
+        int dataLength;
+        File file = new File(filePath);
+        createParentDirectory(file);
+        BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(file, false));
+        while ((dataLength = bufferedInputStream.read(data)) != -1) {
+            bufferedOutputStream.write(data, 0, dataLength);
+        }
+        bufferedOutputStream.close();
+        bufferedInputStream.close();
     }
     }
 
 
     /**
     /**
      * 将输入流保存为本地文件
      * 将输入流保存为本地文件
      */
      */
-    public static void writeInputStreamToLocalPath(InputStream inputStream, String localPath) throws IOException {
+    public static void writeInputStreamToLocalDirectory(InputStream inputStream, String directoryPath, String filename) throws IOException {
         BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
         BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
         byte[] data = new byte[1024];
         byte[] data = new byte[1024];
         int dataLength;
         int dataLength;
-        File file = new File(localPath);
-        createParentDirectory(file);
+        File file = new File(directoryPath + File.separator + filename);
+        createDirectory(directoryPath);
+        createFile(file);
         BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(file, false));
         BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(file, false));
         while ((dataLength = bufferedInputStream.read(data)) != -1) {
         while ((dataLength = bufferedInputStream.read(data)) != -1) {
             bufferedOutputStream.write(data, 0, dataLength);
             bufferedOutputStream.write(data, 0, dataLength);
@@ -701,4 +713,5 @@ public class FileUtil {
     }
     }
 
 
 
 
+
 }
 }

+ 28 - 0
api-common/src/main/java/api/common/util/LinuxUtil.java

@@ -0,0 +1,28 @@
+package api.common.util;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+@Slf4j
+public class LinuxUtil {
+
+    public static String execute(String cmd) throws IOException {
+        log.info("开始执行 linux 命令:" + cmd);
+        Runtime run = Runtime.getRuntime();
+        Process process = run.exec(cmd);
+        InputStream in = new BufferedInputStream(process.getInputStream());
+        StringBuilder out = new StringBuilder();
+        byte[] b = new byte[8192];
+        for (int n; (n = in.read(b)) != -1; ) {
+            out.append(new String(b, 0, n));
+        }
+        in.close();
+        process.destroy();
+        log.info("执行结果为:" + out);
+        return out.toString();
+    }
+
+}

+ 20 - 0
api-common/src/main/java/api/common/util/TimeUtil.java

@@ -0,0 +1,20 @@
+package api.common.util;
+
+import java.sql.Timestamp;
+import java.util.TimeZone;
+
+public class TimeUtil {
+
+
+    public static long getNow() {
+        return System.currentTimeMillis();
+    }
+
+    public static Timestamp getNowForMysql() {
+        return new Timestamp(System.currentTimeMillis());
+    }
+
+    public static long zeroOfToday() {
+        return System.currentTimeMillis() / (1000 * 3600 * 24) * (1000 * 3600 * 24) - TimeZone.getDefault().getRawOffset();
+    }
+}

+ 8 - 0
pom.xml

@@ -19,6 +19,7 @@
         <module>simulation-resource-server</module>
         <module>simulation-resource-server</module>
         <module>api-common</module>
         <module>api-common</module>
         <module>simulation-resource-common</module>
         <module>simulation-resource-common</module>
+        <module>simulation-resource-monitor</module>
     </modules>
     </modules>
 
 
 
 
@@ -53,6 +54,7 @@
         <minio.version>8.3.5</minio.version>
         <minio.version>8.3.5</minio.version>
         <okhttp.version>4.9.3</okhttp.version>
         <okhttp.version>4.9.3</okhttp.version>
         <kubernetes.version>14.0.0</kubernetes.version>
         <kubernetes.version>14.0.0</kubernetes.version>
+        <ganymed-ssh2.version>262</ganymed-ssh2.version>
     </properties>
     </properties>
 
 
 
 
@@ -68,6 +70,12 @@
                 <artifactId>logback-classic</artifactId>
                 <artifactId>logback-classic</artifactId>
                 <version>${logback-classic.version}</version>
                 <version>${logback-classic.version}</version>
             </dependency>
             </dependency>
+            <!-- ssh  -->
+            <dependency>
+                <groupId>ch.ethz.ganymed</groupId>
+                <artifactId>ganymed-ssh2</artifactId>
+                <version>${ganymed-ssh2.version}</version>
+            </dependency>
 
 
             <!-- kubernetes 客户端 -->
             <!-- kubernetes 客户端 -->
             <dependency>
             <dependency>

+ 4 - 3
simulation-oauth-server/src/main/java/com/css/simulation/oauth/server/cofiguration/oauth/OauthAuthorizationServerConfiguration.java

@@ -14,6 +14,7 @@ import org.springframework.security.oauth2.config.annotation.web.configuration.A
 import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;
 import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;
 import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer;
 import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer;
 import org.springframework.security.oauth2.provider.error.DefaultWebResponseExceptionTranslator;
 import org.springframework.security.oauth2.provider.error.DefaultWebResponseExceptionTranslator;
+import org.springframework.security.oauth2.provider.token.AccessTokenConverter;
 import org.springframework.security.oauth2.provider.token.AuthorizationServerTokenServices;
 import org.springframework.security.oauth2.provider.token.AuthorizationServerTokenServices;
 import org.springframework.security.oauth2.provider.token.TokenStore;
 import org.springframework.security.oauth2.provider.token.TokenStore;
 
 
@@ -32,8 +33,8 @@ public class OauthAuthorizationServerConfiguration extends AuthorizationServerCo
     private AuthenticationManager authenticationManager;        // 认证管理器,来自 Spring Security
     private AuthenticationManager authenticationManager;        // 认证管理器,来自 Spring Security
     @Resource
     @Resource
     private UserDetailsService userDetailsService;        // 用户信息验证服务,来自 Spring Security
     private UserDetailsService userDetailsService;        // 用户信息验证服务,来自 Spring Security
-//    @Resource
-//    private AccessTokenConverter accessTokenConverter;
+    @Resource
+    private AccessTokenConverter accessTokenConverter;
     @Resource
     @Resource
     private TokenStore tokenStore;  // 令牌管理服务
     private TokenStore tokenStore;  // 令牌管理服务
     @Resource
     @Resource
@@ -78,7 +79,7 @@ public class OauthAuthorizationServerConfiguration extends AuthorizationServerCo
 
 
         endpoints.authenticationManager(authenticationManager)      // 认证管理器(密码模式)
         endpoints.authenticationManager(authenticationManager)      // 认证管理器(密码模式)
                 .userDetailsService(userDetailsService)           // 用户信息管理(密码模式)
                 .userDetailsService(userDetailsService)           // 用户信息管理(密码模式)
-//                .accessTokenConverter(accessTokenConverter)         // token 信息管理
+                .accessTokenConverter(accessTokenConverter)         // token 信息管理
                 .tokenStore(tokenStore)   // 令牌存储
                 .tokenStore(tokenStore)   // 令牌存储
                 .tokenServices(authorizationServerTokenServices)    // 令牌管理服务
                 .tokenServices(authorizationServerTokenServices)    // 令牌管理服务
                 .exceptionTranslator(defaultWebResponseExceptionTranslator)
                 .exceptionTranslator(defaultWebResponseExceptionTranslator)

+ 128 - 0
simulation-resource-monitor/pom.xml

@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>simulation-cloud</artifactId>
+        <groupId>com.css</groupId>
+        <version>1.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>simulation-resource-monitor</artifactId>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+    </properties>
+    <dependencies>
+
+        <!-- 数据库 - 开始 -->
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+        <!-- 数据库 - 结束 -->
+
+        <!-- 权限认证 - 开始 -->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-security</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-oauth2</artifactId>
+        </dependency>
+        <!-- 权限认证 - 结束 -->
+
+        <!-- nacos - 开始 -->
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-bootstrap</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+        </dependency>
+        <!-- nacos - 结束 -->
+
+        <!-- api-common -->
+        <dependency>
+            <groupId>com.css</groupId>
+            <artifactId>api-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <!-- 基础 -->
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-loadbalancer</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-validation</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-configuration-processor</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <fork>true</fork>
+                    <addResources>true</addResources>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 20 - 0
simulation-resource-monitor/src/main/java/com/css/simulation/resource/monitor/SimulationResourceMonitorApplication.java

@@ -0,0 +1,20 @@
+package com.css.simulation.resource.monitor;
+
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
+
+@SpringBootApplication
+@EnableFeignClients
+@EnableDiscoveryClient
+@EnableResourceServer
+public class SimulationResourceMonitorApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(SimulationResourceMonitorApplication.class, args);
+    }
+
+}

+ 16 - 0
simulation-resource-monitor/src/main/resources/bootstrap.yml

@@ -0,0 +1,16 @@
+spring:
+  application:
+    name: simulation-resource-scheduler
+  #* -------------------------------- 环境配置 --------------------------------
+  profiles:
+    active: dev
+  #* -------------------------------- 微服务配置 --------------------------------
+  cloud:
+    nacos:
+      discovery:
+        server-addr: 10.15.12.70:8848
+        namespace: 3698bfc2-a612-487a-b2a2-aaad16cd9d9d
+      config:
+        server-addr: 10.15.12.70:8848
+        namespace: 3698bfc2-a612-487a-b2a2-aaad16cd9d9d
+        file-extension: yaml

+ 5 - 1
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/configuration/kubernetes/KubernetesConfiguration.java

@@ -4,15 +4,19 @@ import io.kubernetes.client.openapi.ApiClient;
 import io.kubernetes.client.util.ClientBuilder;
 import io.kubernetes.client.util.ClientBuilder;
 import io.kubernetes.client.util.KubeConfig;
 import io.kubernetes.client.util.KubeConfig;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.util.ResourceUtils;
 
 
 import java.io.FileReader;
 import java.io.FileReader;
 import java.io.IOException;
 import java.io.IOException;
 
 
+@Configuration
 public class KubernetesConfiguration {
 public class KubernetesConfiguration {
 
 
     @Bean
     @Bean
     public ApiClient apiClient() throws IOException {
     public ApiClient apiClient() throws IOException {
-        return ClientBuilder.kubeconfig(KubeConfig.loadKubeConfig(new FileReader("D:\\idea-project\\kubernetes-study\\src\\main\\resources\\config"))).build();
+        FileReader fileReader = new FileReader(ResourceUtils.getFile("classpath:kubernetes/config"));
+        return ClientBuilder.kubeconfig(KubeConfig.loadKubeConfig(fileReader)).build();
     }
     }
 
 
 }
 }

+ 227 - 0
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/consumer/ManualProjectConsumer.java

@@ -0,0 +1,227 @@
+package com.css.simulation.resource.scheduler.consumer;
+
+
+import api.common.pojo.constants.DictConstants;
+import api.common.pojo.dto.ProjectMessageDTO;
+import api.common.pojo.param.KafkaParameter;
+import api.common.pojo.param.MinioParameter;
+import api.common.util.FileUtil;
+import api.common.util.JsonUtil;
+import api.common.util.LinuxUtil;
+import api.common.util.StringUtil;
+import com.css.simulation.resource.scheduler.feign.CommonService;
+import com.css.simulation.resource.scheduler.mapper.*;
+import com.css.simulation.resource.scheduler.pojo.dto.*;
+import com.css.simulation.resource.scheduler.pojo.po.*;
+import feign.Response;
+import io.kubernetes.client.openapi.ApiClient;
+import io.kubernetes.client.openapi.ApiException;
+import io.kubernetes.client.openapi.apis.BatchV1Api;
+import io.kubernetes.client.openapi.models.*;
+import io.kubernetes.client.util.Yaml;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.kafka.clients.consumer.ConsumerRecord;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.kafka.annotation.KafkaListener;
+import org.springframework.stereotype.Component;
+import org.springframework.util.ResourceUtils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+@Component
+@Slf4j
+public class ManualProjectConsumer {
+
+    @Autowired
+    ProjectMapper projectMapper;
+    @Autowired
+    IndexMapper indexMapper;
+    @Autowired
+    SceneMapper sceneMapper;
+    @Autowired
+    VehicleMapper vehicleMapper;
+    @Autowired
+    TaskMapper taskMapper;
+    @Autowired
+    SensorCameraMapper sensorCameraMapper;
+    @Autowired
+    SensorOgtMapper sensorOgtMapper;
+    @Autowired
+    private CommonService commonService;
+    @Autowired
+    private AlgorithmMapper algorithmMapper;
+    @Autowired
+    private ApiClient apiClient;
+
+    @KafkaListener(groupId = "simulation-resource-scheduler", topics = "test")
+    public void testConsumer(ConsumerRecord<String, String> projectRecord) {
+        System.out.println("------- 消费成功:" + projectRecord.value());
+    }
+
+    @KafkaListener(groupId = "simulation-resource-scheduler", topics = "manualProject")
+    public void parseProject(ConsumerRecord<String, String> projectRecord) throws IOException, ApiException {
+        //1 读取 kafka 的 project 信息
+        String projectJson = projectRecord.value();
+        ProjectMessageDTO projectMessageDTO = JsonUtil.jsonToBean(projectJson, ProjectMessageDTO.class);
+        String projectId = projectMessageDTO.getProjectId();    // 项目 id
+        projectMapper.updateProjectState(projectId, "2");   // 修改该 project 的状态为执行中
+
+
+        // -------------------------------- 1 场景 --------------------------------
+        // 根据 packageId,拿到场景 id,然后获取每个场景的文件地址。
+        String packageId = projectMessageDTO.getScenePackageId();
+        List<IndexPO> leafIndexList = indexMapper.selectLeafIndexByPackageId(packageId);
+        List<String> naturalIdList = new ArrayList<>();
+        List<String> standardIdList = new ArrayList<>();
+        List<String> accidentIdList = new ArrayList<>();
+        for (IndexPO indexPO : leafIndexList) {
+            String naturalIds = indexPO.getSceneNaturalIds();
+            String standardIds = indexPO.getSceneStatueIds();
+            String accidentIds = indexPO.getSceneTrafficIds();
+            if (StringUtil.isNotEmpty(naturalIds)) {
+                String[] naturalIdArray = naturalIds.split(",");
+                naturalIdList.addAll(Arrays.asList(naturalIdArray));
+            }
+            if (StringUtil.isNotEmpty(standardIds)) {
+                String[] standardArray = standardIds.split(",");
+                standardIdList.addAll(Arrays.asList(standardArray));
+            }
+            if (StringUtil.isNotEmpty(accidentIds)) {
+                String[] accidentIdArray = accidentIds.split(",");
+                accidentIdList.addAll(Arrays.asList(accidentIdArray));
+            }
+        }
+        List<ScenePO> sceneList = new ArrayList<>();
+        sceneList.addAll(sceneMapper.selectNaturalByIdList(naturalIdList));
+        sceneList.addAll(sceneMapper.selectStandardByIdList(standardIdList));
+        sceneList.addAll(sceneMapper.selectAccidentByIdList(accidentIdList));
+
+        // -------------------------------- 2 模型 --------------------------------
+        // 根据 vehicleId, 获取 模型信息和传感器信息
+        String vehicleId = projectMessageDTO.getVehicleId();    // 模型 id
+        VehiclePO vehiclePO = vehicleMapper.selectByVehicleId(projectId);
+        List<CameraPO> cameraPOList = sensorCameraMapper.selectCameraByVehicleId(vehicleId);
+        List<OgtPO> ogtPOList = sensorOgtMapper.selectOgtByVehicleId(vehicleId);
+
+        // -------------------------------- 3 任务消息 --------------------------------
+        // 根据场景创建任务,组装 task 消息
+        int maxSimulationTime = projectMessageDTO.getMaxSimulationTime();
+        for (ScenePO scenePO : sceneList) {
+            String taskId = StringUtil.getRandomUUID();
+            String resultPath = "/project/manual-project/" + projectId + "/" + taskId;
+            TaskPO taskPO = TaskPO.builder()
+                    .id(taskId)
+                    .pId(projectId)
+                    .sceneId(scenePO.getId())
+                    .sceneName(scenePO.getName())
+                    .sceneType(scenePO.getType())
+                    .runState(DictConstants.TASK_WAITING)
+                    .runResult(resultPath)
+                    .build();
+            //4-1 组装 task 消息
+            TaskDTO taskDTO = TaskDTO.builder()
+                    .info(InfoDTO.builder()
+                            .project_id(projectId)
+                            .task_id(taskId)
+                            .task_path(resultPath)
+                            .default_time(maxSimulationTime)
+                            .build())
+                    .scenario(ScenarioDTO.builder()
+                            .scenario_osc(scenePO.getScenarioOsc())
+                            .scenario_odr(scenePO.getScenarioOdr())
+                            .scenario_osgb(scenePO.getScenarioOsgb())
+                            .build())
+                    .vehicle(VehicleDTO.builder()
+                            .model(ModelDTO.builder()
+                                    .model_label(vehiclePO.getModelLabel())
+                                    .build())
+                            .dynamics(DynamicsDTO.builder()
+                                    .dynamics_maxspeed(vehiclePO.getMaxSpeed())
+                                    .dynamics_enginepower(vehiclePO.getEnginePower())
+                                    .dynamics_maxdecel(vehiclePO.getMaxDeceleration())
+                                    .dynamics_maxsteering(vehiclePO.getMaxSteeringAngle())
+                                    .dynamics_mass(vehiclePO.getMass())
+                                    .dynamics_frontsurfaceeffective(vehiclePO.getFrontSurfaceEffective())
+                                    .dynamics_airdragcoefficient(vehiclePO.getAirDragCoefficient())
+                                    .dynamics_rollingresistance(vehiclePO.getRollingResistanceCoefficient())
+                                    .dynamics_wheeldiameter(vehiclePO.getWheelDiameter())
+                                    .dynamics_wheeldrive(vehiclePO.getWheelDrive())
+                                    .dynamics_overallefficiency(vehiclePO.getOverallEfficiency())
+                                    .dynamics_distfront(vehiclePO.getFrontDistance())
+                                    .dynamics_distrear(vehiclePO.getRearDistance())
+                                    .dynamics_distleft(vehiclePO.getLeftDistance())
+                                    .dynamics_distright(vehiclePO.getRightDistance())
+                                    .dynamics_distheight(vehiclePO.getHeightDistance())
+                                    .dynamics_wheelbase(vehiclePO.getWheelbase())
+                                    .build())
+                            .sensors(SensorsDTO.builder()   // 根据 vehicleId 查询绑定的传感器列表
+                                    .camera(cameraPOList)
+                                    .OGT(ogtPOList)
+                                    .build())
+                            .build())
+                    .build();
+            //4-4 将对象转成 json
+            String taskJson = JsonUtil.beanToJson(taskDTO);
+            //4-5 将 projectId 作为 topic 名称,发送 task 信息到 kafka
+            commonService.send(new KafkaParameter(projectId, taskJson));
+        }
+
+        // -------------------------------- 4 算法(一期按单机版做) --------------------------------
+        // 私有仓库导入算法镜像(搭建私有仓库)
+        String algorithmId = projectMessageDTO.getAlgorithmId();    // 算法 id
+        String localPath = "/opt/module/algorithm/";
+        //4-1 根据算法 id 获取算法文件地址
+        String minioPath = algorithmMapper.selectMinioPathById(algorithmId);
+        // 下载算法文件到本地( 2 到仓库服务器)
+        Response response = commonService.download(new MinioParameter(minioPath));
+        InputStream inputStream = response.body().asInputStream();
+        FileUtil.writeInputStreamToLocalFile(inputStream,localPath);
+        //4-2 本地执行 docker load 算法文件成镜像( 2 创建 ssh 连接)
+        LinuxUtil.execute("docker load");
+
+
+
+        // -------------------------------- 5 创建 pod 开始执行 --------------------------------
+        int completions = sceneList.size();
+        int parallelism = projectMessageDTO.getParallelism();    // 并行度
+        BatchV1Api batchV1Api = new BatchV1Api(apiClient);
+        V1Job yaml = (V1Job) Yaml.load(ResourceUtils.getFile("classpath:kubernetes/template/job-template.yaml"));
+        //1 apiVersion
+        //2 kind
+        //3 metadata
+        V1ObjectMeta metadata = yaml.getMetadata();
+        metadata.setName("job2");
+        yaml.setMetadata(metadata);
+
+        //4 spec
+        V1JobSpec v1JobSpec = yaml.getSpec();
+        //4-1 job
+        v1JobSpec.setCompletions(completions);
+        v1JobSpec.setParallelism(parallelism);
+        //4-2 pod
+        V1PodTemplateSpec v1PodTemplateSpec = v1JobSpec.getTemplate();
+
+        v1PodTemplateSpec.setMetadata(metadata);
+        V1PodSpec v1PodSpec = v1PodTemplateSpec.getSpec();
+        v1PodSpec.setRestartPolicy("Never");
+        //4-3 container
+        List<V1Container> containers = new ArrayList<>();
+        V1Container v1Container = v1PodSpec.getContainers().get(0);
+        v1Container.setImage("perl");
+        v1Container.setImagePullPolicy("IfNotPresent");
+        v1Container.setName("pi");
+        v1Container.setCommand(Arrays.asList("perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"));
+        containers.add(v1Container);
+        //4-4 创建
+        v1PodSpec.setContainers(containers);
+        v1PodTemplateSpec.setSpec(v1PodSpec);
+        v1JobSpec.setTemplate(v1PodTemplateSpec);
+        yaml.setSpec(v1JobSpec);
+        batchV1Api.createNamespacedJob("test-namespace1", yaml, null, null, null);
+
+    }
+}

+ 0 - 129
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/consumer/ProjectConsumer.java

@@ -1,129 +0,0 @@
-package com.css.simulation.resource.scheduler.consumer;
-
-
-import api.common.pojo.constants.DictConstants;
-import api.common.pojo.dto.ProjectMessageDTO;
-import api.common.util.JsonUtil;
-import com.css.simulation.resource.scheduler.mapper.ProjectMapper;
-import com.css.simulation.resource.scheduler.mapper.SensorCameraMapper;
-import com.css.simulation.resource.scheduler.mapper.SensorOgtMapper;
-import com.css.simulation.resource.scheduler.mapper.TaskMapper;
-import com.css.simulation.resource.scheduler.pojo.dto.task.*;
-import com.css.simulation.resource.scheduler.pojo.po.TaskPO;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.kafka.clients.consumer.ConsumerRecord;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.kafka.annotation.KafkaListener;
-import org.springframework.kafka.core.KafkaTemplate;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-
-@Component
-@Slf4j
-public class ProjectConsumer {
-
-    @Autowired
-    ProjectMapper projectMapper;
-    @Autowired
-    TaskMapper taskMapper;
-    @Autowired
-    SensorCameraMapper sensorCameraMapper;
-    @Autowired
-    SensorOgtMapper sensorOgtMapper;
-    @Autowired
-    private KafkaTemplate<String, String> kafkaTemplate;
-
-    @KafkaListener(groupId = "simulation-resource-scheduler", topics = "test")
-    public void testConsumer(ConsumerRecord<String, String> projectRecord) {
-        System.out.println("------- 消费成功:" + projectRecord.value());
-    }
-
-    @KafkaListener(groupId = "simulation-resource-scheduler", topics = "manualProject")
-    public void parseProject(ConsumerRecord<String, String> projectRecord) throws JsonProcessingException {
-        //1 读取 kafka 的 project 信息
-        String projectJson = projectRecord.value();
-
-        ProjectMessageDTO projectMessageDTO = JsonUtil.jsonToBean(projectJson, ProjectMessageDTO.class);
-        String projectId = projectMessageDTO.getProjectId();    // 项目 id
-        String taskMaxExecuteTime = projectMessageDTO.getTaskMaxExecuteTime();  // 任务最大执行时间
-        String parallelism = projectMessageDTO.getParallelism();    // 并行度
-        //2 修改该 project 的状态为执行中
-        projectMapper.updateProjectState(projectId, "2");
-        //3 根据 project 信息获取 task 信息。task 信息包括算法、模型、场景数据包等
-        List<TaskPO> taskPOList = taskMapper.selectByProjectId(projectId);
-        //4 组装 task 消息
-        for (TaskPO taskPO : taskPOList) {
-            String resultPath = "/project/manual-project/" + projectId + "/" + taskPO.getId();
-            String scenarioOsc;
-            String scenarioOdr;
-            String scenarioOsgb;
-            if (DictConstants.SCENE_NATURAL.equals(taskPO.getSceneType())) {
-                scenarioOsc = taskPO.getSnScenarioOsc();
-                scenarioOdr = taskPO.getSnScenarioOsc();
-                scenarioOsgb = taskPO.getSnScenarioOsgb();
-            } else if (DictConstants.SCENE_STANDARD.equals(taskPO.getSceneType())) {
-                scenarioOsc = taskPO.getScrScenarioOsc();
-                scenarioOdr = taskPO.getScrScenarioOsc();
-                scenarioOsgb = taskPO.getScrScenarioOsgb();
-            } else if (DictConstants.SCENE_ACCIDENT.equals(taskPO.getSceneType())) {
-                scenarioOsc = taskPO.getSaScenarioOsc();
-                scenarioOdr = taskPO.getSaScenarioOsc();
-                scenarioOsgb = taskPO.getSaScenarioOsgb();
-            } else {
-                log.error("------- 不存在场景类型:" + taskPO.getSceneType());
-                return;
-            }
-            String vehicleId = taskPO.getVehicleId();
-
-            //4-1 组装 task 消息
-            TaskDTO taskDTO = TaskDTO.builder()
-                    .info(InfoDTO.builder()
-                            .project_id(projectId)
-                            .task_id(taskPO.getId())
-                            .task_path(resultPath)
-                            .build())
-                    .scenario(ScenarioDTO.builder()
-                            .scenario_osc(scenarioOsc)
-                            .scenario_odr(scenarioOdr)
-                            .scenario_osgb(scenarioOsgb)
-                            .build())
-                    .vehicle(VehicleDTO.builder()
-                            .model(ModelDTO.builder()
-                                    .model_label(taskPO.getModelLabel())
-                                    .build())
-                            .dynamics(DynamicsDTO.builder()
-                                    .dynamics_maxspeed(taskPO.getMaxSpeed())
-                                    .dynamics_enginepower(taskPO.getEnginePower())
-                                    .dynamics_maxdecel(taskPO.getMaxDeceleration())
-                                    .dynamics_maxsteering(taskPO.getMaxSteeringAngle())
-                                    .dynamics_mass(taskPO.getMass())
-                                    .dynamics_frontsurfaceeffective(taskPO.getFrontSurfaceEffective())
-                                    .dynamics_airdragcoefficient(taskPO.getAirDragCoefficient())
-                                    .dynamics_rollingresistance(taskPO.getRollingResistanceCoefficient())
-                                    .dynamics_wheeldiameter(taskPO.getWheelDiameter())
-                                    .dynamics_wheeldrive(taskPO.getWheelDrive())
-                                    .dynamics_overallefficiency(taskPO.getOverallEfficiency())
-                                    .dynamics_distfront(taskPO.getFrontDistance())
-                                    .dynamics_distrear(taskPO.getRearDistance())
-                                    .dynamics_distleft(taskPO.getLeftDistance())
-                                    .dynamics_distright(taskPO.getRightDistance())
-                                    .dynamics_distheight(taskPO.getHeightDistance())
-                                    .dynamics_wheelbase(taskPO.getWheelbase())
-                                    .build())
-                            .sensors(SensorsDTO.builder()   // 根据 vehicleId 查询绑定的传感器列表
-                                    .camera(sensorCameraMapper.selectCameraByVehicleId(taskPO.getVehicleId()))
-                                    .OGT(sensorOgtMapper.selectOgtByVehicleId(taskPO.getVehicleId()))
-                                    .build())
-                            .build())
-                    .build();
-            //4-4 将对象转成 json
-            String taskJson = JsonUtil.beanToJson(taskDTO);
-            //4-5 将 projectId 作为 topic 名称,发送 task 信息到 kafka
-            kafkaTemplate.send(projectId, 0, taskPO.getId(), taskJson);
-        }
-        //4 创建 pod 开始执行。
-
-    }
-}

+ 8 - 6
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/feign/DemoService.java → simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/feign/CommonService.java

@@ -4,7 +4,7 @@ import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.param.KafkaParameter;
 import api.common.pojo.param.KafkaParameter;
 import api.common.pojo.param.MinioParameter;
 import api.common.pojo.param.MinioParameter;
 import com.css.simulation.resource.scheduler.configuration.feign.OpenFeignConfiguration;
 import com.css.simulation.resource.scheduler.configuration.feign.OpenFeignConfiguration;
-import com.css.simulation.resource.scheduler.feign.fallback.DemoServiceFallback;
+import com.css.simulation.resource.scheduler.feign.fallback.CommonServiceFallback;
 import feign.Response;
 import feign.Response;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.http.MediaType;
 import org.springframework.http.MediaType;
@@ -19,20 +19,22 @@ import org.springframework.web.multipart.MultipartFile;
 @Component
 @Component
 @FeignClient(
 @FeignClient(
         value = "simulation-resource-common",
         value = "simulation-resource-common",
-        fallback = DemoServiceFallback.class,
+        contextId = "common1",
+        path = "/simulation/resource/common",
+        fallback = CommonServiceFallback.class,
         configuration = OpenFeignConfiguration.class
         configuration = OpenFeignConfiguration.class
 )
 )
-public interface DemoService {
+public interface CommonService {
 
 
-    @PostMapping(value = "/simulation/resource/common/minio/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    @PostMapping(value = "/minio/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
     ResponseBodyVO<String> upload(@RequestPart("file") MultipartFile file,
     ResponseBodyVO<String> upload(@RequestPart("file") MultipartFile file,
                                   @RequestParam("objectName") String objectName);
                                   @RequestParam("objectName") String objectName);
 
 
-    @PostMapping("/simulation/resource/common/minio/download")
+    @PostMapping("/minio/download")
     Response download(@RequestBody @Validated MinioParameter minioParameter);
     Response download(@RequestBody @Validated MinioParameter minioParameter);
 
 
 
 
-    @PostMapping(value = "/simulation/resource/common/kafka/send", consumes = MediaType.APPLICATION_JSON_VALUE)
+    @PostMapping(value = "/kafka/send", consumes = MediaType.APPLICATION_JSON_VALUE)
     ResponseBodyVO<String> send(@RequestBody @Validated KafkaParameter kafkaParameter);
     ResponseBodyVO<String> send(@RequestBody @Validated KafkaParameter kafkaParameter);
 
 
 
 

+ 5 - 6
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/feign/DemoController.java

@@ -20,13 +20,13 @@ import java.io.InputStream;
 public class DemoController {
 public class DemoController {
 
 
     @Autowired
     @Autowired
-    private DemoService demoService;
+    private CommonService commonService;
 
 
     @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
     @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
     public ResponseBodyVO<String> upload(@RequestPart("file") MultipartFile file,
     public ResponseBodyVO<String> upload(@RequestPart("file") MultipartFile file,
                                          @RequestParam("objectName") String objectName) {
                                          @RequestParam("objectName") String objectName) {
 
 
-        return demoService.upload(file, objectName);
+        return commonService.upload(file, objectName);
     }
     }
 
 
     @PostMapping("/download")
     @PostMapping("/download")
@@ -34,17 +34,16 @@ public class DemoController {
             @RequestBody @Validated MinioParameter minioParameter,
             @RequestBody @Validated MinioParameter minioParameter,
             HttpServletResponse response
             HttpServletResponse response
     ) throws IOException {
     ) throws IOException {
-        Response download = demoService.download(minioParameter);
+        Response download = commonService.download(minioParameter);
         Response.Body body = download.body();
         Response.Body body = download.body();
         InputStream inputStream = body.asInputStream();
         InputStream inputStream = body.asInputStream();
         FileUtil.downloadForHttp(minioParameter.getObjectName(), inputStream, response, 1024);
         FileUtil.downloadForHttp(minioParameter.getObjectName(), inputStream, response, 1024);
     }
     }
 
 
-    @PostMapping(value = "/send", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
     // -------------------------------- 带回调函数的发送 --------------------------------
     // -------------------------------- 带回调函数的发送 --------------------------------
-    @RequestMapping("/send")
+    @PostMapping("/send")
     public ResponseBodyVO<String> send(@RequestBody @Validated KafkaParameter kafkaParameter) {
     public ResponseBodyVO<String> send(@RequestBody @Validated KafkaParameter kafkaParameter) {
-        return demoService.send(kafkaParameter);
+        return commonService.send(kafkaParameter);
     }
     }
 
 
 }
 }

+ 2 - 2
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/feign/fallback/DemoServiceFallback.java → simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/feign/fallback/CommonServiceFallback.java

@@ -3,7 +3,7 @@ package com.css.simulation.resource.scheduler.feign.fallback;
 import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.param.KafkaParameter;
 import api.common.pojo.param.KafkaParameter;
 import api.common.pojo.param.MinioParameter;
 import api.common.pojo.param.MinioParameter;
-import com.css.simulation.resource.scheduler.feign.DemoService;
+import com.css.simulation.resource.scheduler.feign.CommonService;
 import feign.Response;
 import feign.Response;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
@@ -16,7 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 
 @Service
 @Service
 @Slf4j
 @Slf4j
-public class DemoServiceFallback implements DemoService {
+public class CommonServiceFallback implements CommonService {
 
 
     @Override
     @Override
     public ResponseBodyVO<String> upload(@RequestPart("file") MultipartFile file,
     public ResponseBodyVO<String> upload(@RequestPart("file") MultipartFile file,

+ 25 - 0
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/mapper/AlgorithmMapper.java

@@ -0,0 +1,25 @@
+package com.css.simulation.resource.scheduler.mapper;
+
+
+import com.css.simulation.resource.scheduler.pojo.po.ScenePO;
+import org.apache.ibatis.annotations.*;
+import org.apache.ibatis.type.JdbcType;
+
+import java.util.List;
+
+/**
+ * 场景查询
+ * scene_natural
+ * scene_standard
+ * scene_accident
+ */
+@Mapper
+public interface AlgorithmMapper {
+
+    @Select("select minio_path\n" +
+            "from algorithm\n" +
+            "where is_deleted = '0'\n" +
+            "  and id = #{id}")
+    String selectMinioPathById(@Param("id") String id);
+
+}

+ 35 - 0
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/mapper/IndexMapper.java

@@ -0,0 +1,35 @@
+package com.css.simulation.resource.scheduler.mapper;
+
+
+import com.css.simulation.resource.scheduler.pojo.po.IndexPO;
+import org.apache.ibatis.annotations.*;
+import org.apache.ibatis.type.JdbcType;
+
+import java.util.List;
+
+/**
+ * 指标查询
+ * simulation_package_sublist
+ */
+@Mapper
+public interface IndexMapper {
+
+
+    @Results(id = "index", value = {
+            @Result(column = "scene_natural_ids",property = "sceneNaturalIds",  jdbcType = JdbcType.VARCHAR),
+            @Result(column = "scene_traffic_ids",property = "sceneTrafficIds",  jdbcType = JdbcType.VARCHAR),
+            @Result(column = "scene_statue_ids",property = "sceneStatueIds",  jdbcType = JdbcType.VARCHAR)
+    })
+
+
+    @Select("select scene_natural_ids,\n" +
+            "       scene_traffic_ids,\n" +
+            "       scene_statue_ids\n" +
+            "from scene_package_sublist sps\n" +
+            "         left join scene_package sp on parent_id = sp.package_id\n" +
+            "where parent_id = '#{packageId}'\n" +
+            "  and ((scene_natural_ids is not null and scene_natural_ids != '')\n" +
+            "    or (scene_traffic_ids is not null and scene_traffic_ids != '')\n" +
+            "    or (scene_statue_ids is not null and scene_statue_ids != ''))")
+    List<IndexPO> selectLeafIndexByPackageId(@Param("packageId") String packageId);
+}

+ 104 - 0
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/mapper/SceneMapper.java

@@ -0,0 +1,104 @@
+package com.css.simulation.resource.scheduler.mapper;
+
+
+import com.css.simulation.resource.scheduler.pojo.po.IndexPO;
+import com.css.simulation.resource.scheduler.pojo.po.ScenePO;
+import org.apache.ibatis.annotations.*;
+import org.apache.ibatis.type.JdbcType;
+
+import java.util.List;
+
+/**
+ * 场景查询
+ * scene_natural
+ * scene_standard
+ * scene_accident
+ */
+@Mapper
+public interface SceneMapper {
+
+
+    @Results(id = "scenes", value = {
+            @Result(column = "scene_natural_ids", property = "scenarioOsc", jdbcType = JdbcType.VARCHAR),
+            @Result(column = "scene_traffic_ids", property = "scenarioOdr", jdbcType = JdbcType.VARCHAR),
+            @Result(column = "scene_statue_ids", property = "scenarioOsgb", jdbcType = JdbcType.VARCHAR)
+    })
+    @Select("select scene_natural_ids,\n" +
+            "       scene_traffic_ids,\n" +
+            "       scene_statue_ids\n" +
+            "from scene_package_sublist sps\n" +
+            "         left join scene_package sp on parent_id = sp.package_id\n" +
+            "where parent_id = '#{packageId}'\n" +
+            "  and ((scene_natural_ids is not null and scene_natural_ids != '')\n" +
+            "    or (scene_traffic_ids is not null and scene_traffic_ids != '')\n" +
+            "    or (scene_statue_ids is not null and scene_statue_ids != ''))")
+    List<IndexPO> selectLeafIndexByPackageId(@Param("packageId") String packageId);
+
+
+    @Results(id = "scene", value = {
+            @Result(column = "id", property = "id", jdbcType = JdbcType.VARCHAR),
+            @Result(column = "name", property = "name", jdbcType = JdbcType.VARCHAR),
+            @Result(column = "type", property = "type", jdbcType = JdbcType.VARCHAR),
+            @Result(column = "osc", property = "scenarioOsc", jdbcType = JdbcType.VARCHAR),
+            @Result(column = "osgb", property = "scenarioOdr", jdbcType = JdbcType.VARCHAR),
+            @Result(column = "odr", property = "scenarioOsgb", jdbcType = JdbcType.VARCHAR)
+    })
+    @Select("<script>" +
+            "select natural_id id,\n" +
+            "       natural_name name,\n" +
+            "        '1' type,\n" +
+            "       xosc_address osc,\n" +
+            "       osgb_address osgb,\n" +
+            "       xodr_address odr\n" +
+            "from scene_natural\n" +
+            "where is_deleted = '0'\n" +
+            "<if test='idList != null and idList.size() > 0'>\n" +
+            "   and natural_id in\n" +
+            "       <foreach collection='idList' index='index' item='item' open='(' close=')' separator=','>\n" +
+            "           #{item}" +
+            "       </foreach>\n" +
+            "</if>\n" +
+            "</script>")
+    List<ScenePO> selectNaturalByIdList(@Param("idList") List<String> idList);
+
+
+    @ResultMap("scene")
+    @Select("<script>" +
+            "select regulations_id id,\n" +
+            "       scene_name name,\n" +
+            "        '2'  type,\n" +
+            "       xml_address osc,\n" +
+            "       osgb_address osgb,\n" +
+            "       xodr_address odr\n" +
+            "from scene_standards_regulations\n" +
+            "where is_deleted = '0'\n" +
+            "<if test='idList != null and idList.size() > 0'>\n" +
+            "   and regulations_id in\n" +
+            "       <foreach collection='idList' index='index' item='item' open='(' close=')' separator=','>\n" +
+            "           #{item}" +
+            "       </foreach>\n" +
+            "</if>\n" +
+            "</script>")
+    List<ScenePO> selectStandardByIdList(@Param("idList") List<String> idList);
+
+    @ResultMap("scene")
+    @Select("<script>" +
+            "select accident_id id,\n" +
+            "       scene_name name,\n" +
+            "        '3'  type,\n" +
+            "       xml_address osc,\n" +
+            "       osgb_address osgb,\n" +
+            "       xodr_address odr\n" +
+            "from scene_accident\n" +
+            "where is_deleted = '0'\n" +
+            "<if test='idList != null and idList.size() > 0'>\n" +
+            "   and regulations_id in\n" +
+            "       <foreach collection='idList' index='index' item='item' open='(' close=')' separator=','>\n" +
+            "           #{item}" +
+            "       </foreach>\n" +
+            "</if>\n" +
+            "</script>")
+    List<ScenePO> selectAccidentByIdList(@Param("idList") List<String> idList);
+
+
+}

+ 2 - 39
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/mapper/TaskMapper.java

@@ -40,43 +40,6 @@ public interface TaskMapper {
             @Result(column = "height_distance", property = "heightDistance", jdbcType = JdbcType.DECIMAL),
             @Result(column = "height_distance", property = "heightDistance", jdbcType = JdbcType.DECIMAL),
             @Result(column = "wheelbase", property = "wheelbase", jdbcType = JdbcType.DECIMAL),
             @Result(column = "wheelbase", property = "wheelbase", jdbcType = JdbcType.DECIMAL),
     })
     })
-    @Select("select smpt.id,\n" +
-            "       smpt.scene_type,\n" +
-            "       sn.xosc_address sn_scenario_osc,\n" +
-            "       sn.xodr_address sn_scenario_odr,\n" +
-            "       sn.osgb_address sn_scenario_osgb,\n" +
-            "       scr.xml_address scr_scenario_osc,\n" +
-            "       scr.xodr_address scr_scenario_odr,\n" +
-            "       scr.osgb_address scr_scenario_osgb,\n" +
-            "       sa.xml_address sa_scenario_osc,\n" +
-            "       sa.xodr_address sa_scenario_odr,\n" +
-            "       sa.osgb_address sa_scenario_osgb,\n" +
-            "       mv.id vehicle_id,\n" +
-            "       mv.model_label,\n" +
-            "       mv.max_speed,\n" +
-            "       mv.engine_power,\n" +
-            "       mv.max_deceleration,\n" +
-            "       mv.max_steering_angle,\n" +
-            "       mv.mass,\n" +
-            "       mv.overall_efficiency,\n" +
-            "       mv.front_surface_effective,\n" +
-            "       mv.air_drag_coefficient,\n" +
-            "       mv.rolling_resistance_coefficient,\n" +
-            "       mv.wheel_diameter,\n" +
-            "       mv.wheel_drive,\n" +
-            "       mv.front_distance,\n" +
-            "       mv.rear_distance,\n" +
-            "       mv.left_distance,\n" +
-            "       mv.right_distance,\n" +
-            "       mv.height_distance,\n" +
-            "       mv.wheelbase\n" +
-            "from simulation_manual_project_task smpt\n" +
-            "         left join simulation_manual_project smp on smpt.p_id = smp.id\n" +
-            "         left join scene_natural sn on smpt.scene_id = sn.natural_id\n" +
-            "         left join scene_standards_regulations scr on smpt.scene_id = scr.regulations_id\n" +
-            "         left join scene_accident sa on smpt.scene_id = sa.accident_id\n" +
-            "         left join model_vehicle mv on smp.vehicle = mv.id\n" +
-            "         left join algorithm a on smp.algorithm = a.id\n" +
-            "where smpt.p_id = #{projectId}\n")
-    List<TaskPO> selectByProjectId(@Param("projectId") String projectId);
+    @Select("")
+    List<TaskPO> selectNaturalByProjectId(@Param("projectId") String projectId);
 }
 }

+ 51 - 0
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/mapper/VehicleMapper.java

@@ -0,0 +1,51 @@
+package com.css.simulation.resource.scheduler.mapper;
+
+import com.css.simulation.resource.scheduler.pojo.po.VehiclePO;
+import org.apache.ibatis.annotations.*;
+import org.apache.ibatis.type.JdbcType;
+
+@Mapper
+public interface VehicleMapper {
+
+    @Results(id = "vehicle", value = {
+            @Result(column = "model_label", property = "modelLabel", jdbcType = JdbcType.VARCHAR),
+            @Result(column = "max_speed", property = "maxSpeed", jdbcType = JdbcType.DECIMAL),
+            @Result(column = "engine_power", property = "enginePower", jdbcType = JdbcType.DECIMAL),
+            @Result(column = "max_deceleration", property = "maxDeceleration", jdbcType = JdbcType.DECIMAL),
+            @Result(column = "max_steering_angle", property = "maxSteeringAngle", jdbcType = JdbcType.DECIMAL),
+            @Result(column = "mass", property = "mass", jdbcType = JdbcType.DECIMAL),
+            @Result(column = "front_surface_effective", property = "frontSurfaceEffective", jdbcType = JdbcType.DECIMAL),
+            @Result(column = "air_drag_coefficient", property = "airDragCoefficient", jdbcType = JdbcType.DECIMAL),
+            @Result(column = "rolling_resistance_coefficient", property = "rollingResistanceCoefficient", jdbcType = JdbcType.DECIMAL),
+            @Result(column = "wheel_diameter", property = "wheelDiameter", jdbcType = JdbcType.DECIMAL),
+            @Result(column = "wheel_drive", property = "wheelDrive", jdbcType = JdbcType.VARCHAR),
+            @Result(column = "overall_efficiency", property = "overallEfficiency", jdbcType = JdbcType.DECIMAL),
+            @Result(column = "front_distance", property = "frontDistance", jdbcType = JdbcType.DECIMAL),
+            @Result(column = "rear_distance", property = "rearDistance", jdbcType = JdbcType.DECIMAL),
+            @Result(column = "left_distance", property = "leftDistance", jdbcType = JdbcType.DECIMAL),
+            @Result(column = "right_distance", property = "rightDistance", jdbcType = JdbcType.DECIMAL),
+            @Result(column = "height_distance", property = "heightDistance", jdbcType = JdbcType.DECIMAL),
+            @Result(column = "wheelbase", property = "wheelbase", jdbcType = JdbcType.DECIMAL),
+    })
+    @Select("select model_label,\n" +
+            "       max_speed,\n" +
+            "       engine_power,\n" +
+            "       max_deceleration,\n" +
+            "       max_steering_angle,\n" +
+            "       mass,\n" +
+            "       front_surface_effective,\n" +
+            "       air_drag_coefficient,\n" +
+            "       rolling_resistance_coefficient,\n" +
+            "       wheel_diameter,\n" +
+            "       wheel_drive,\n" +
+            "       overall_efficiency,\n" +
+            "       front_distance,\n" +
+            "       rear_distance,\n" +
+            "       left_distance,\n" +
+            "       right_distance,\n" +
+            "       height_distance,\n" +
+            "       wheelbase\n" +
+            "from model_vehicle\n" +
+            "where id = #{vehicleId}")
+    VehiclePO selectByVehicleId(@Param("projectId") String projectId);
+}

+ 1 - 1
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/task/DynamicsDTO.java → simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/DynamicsDTO.java

@@ -1,4 +1,4 @@
-package com.css.simulation.resource.scheduler.pojo.dto.task;
+package com.css.simulation.resource.scheduler.pojo.dto;
 
 
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Builder;

+ 2 - 2
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/task/InfoDTO.java → simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/InfoDTO.java

@@ -1,4 +1,4 @@
-package com.css.simulation.resource.scheduler.pojo.dto.task;
+package com.css.simulation.resource.scheduler.pojo.dto;
 
 
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Builder;
@@ -14,5 +14,5 @@ public class InfoDTO {
     private String project_id;
     private String project_id;
     private String task_id;
     private String task_id;
     private String task_path;
     private String task_path;
-    private String default_time;
+    private Integer default_time;
 }
 }

+ 1 - 1
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/task/ModelDTO.java → simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/ModelDTO.java

@@ -1,4 +1,4 @@
-package com.css.simulation.resource.scheduler.pojo.dto.task;
+package com.css.simulation.resource.scheduler.pojo.dto;
 
 
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Builder;

+ 1 - 1
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/task/ScenarioDTO.java → simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/ScenarioDTO.java

@@ -1,4 +1,4 @@
-package com.css.simulation.resource.scheduler.pojo.dto.task;
+package com.css.simulation.resource.scheduler.pojo.dto;
 
 
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Builder;

+ 1 - 1
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/task/SensorsDTO.java → simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/SensorsDTO.java

@@ -1,4 +1,4 @@
-package com.css.simulation.resource.scheduler.pojo.dto.task;
+package com.css.simulation.resource.scheduler.pojo.dto;
 
 
 import com.css.simulation.resource.scheduler.pojo.po.CameraPO;
 import com.css.simulation.resource.scheduler.pojo.po.CameraPO;
 import com.css.simulation.resource.scheduler.pojo.po.OgtPO;
 import com.css.simulation.resource.scheduler.pojo.po.OgtPO;

+ 1 - 1
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/task/TaskDTO.java → simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/TaskDTO.java

@@ -1,4 +1,4 @@
-package com.css.simulation.resource.scheduler.pojo.dto.task;
+package com.css.simulation.resource.scheduler.pojo.dto;
 
 
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Builder;

+ 1 - 1
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/task/VehicleDTO.java → simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/dto/VehicleDTO.java

@@ -1,4 +1,4 @@
-package com.css.simulation.resource.scheduler.pojo.dto.task;
+package com.css.simulation.resource.scheduler.pojo.dto;
 
 
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Builder;

+ 18 - 0
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/po/IndexPO.java

@@ -0,0 +1,18 @@
+package com.css.simulation.resource.scheduler.pojo.po;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class IndexPO {
+
+    private String sceneNaturalIds;
+    private String sceneTrafficIds;
+    private String sceneStatueIds;
+
+}

+ 24 - 0
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/po/ScenePO.java

@@ -0,0 +1,24 @@
+package com.css.simulation.resource.scheduler.pojo.po;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class ScenePO {
+
+
+    private String id;
+    private String name;
+    private String type;
+    /**
+     * 场景文件路径,minio 路径
+     */
+    private String scenarioOsc;
+    private String scenarioOdr;
+    private String scenarioOsgb;
+}

+ 11 - 64
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/po/TaskPO.java

@@ -1,72 +1,19 @@
 package com.css.simulation.resource.scheduler.pojo.po;
 package com.css.simulation.resource.scheduler.pojo.po;
 
 
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.math.BigDecimal;
+import api.common.pojo.common.CommonPO;
+import lombok.*;
 
 
+@EqualsAndHashCode(callSuper = true)
 @Data
 @Data
+@Builder
 @NoArgsConstructor
 @NoArgsConstructor
 @AllArgsConstructor
 @AllArgsConstructor
-public class TaskPO {
+public class TaskPO extends CommonPO {
     private String id;
     private String id;
-    private String sceneType;  // 场景类型
-    /**
-     * 场景文件路径,minio 路径
-     */
-    private String snScenarioOsc;
-    private String snScenarioOdr;
-    private String snScenarioOsgb;
-    private String scrScenarioOsc;
-    private String scrScenarioOdr;
-    private String scrScenarioOsgb;
-    private String saScenarioOsc;
-    private String saScenarioOdr;
-    private String saScenarioOsgb;
-    /**
-     * 车辆模型
-     * 		"model": {
-     * 			"model_label": "AudiA6_10"
-     *                },
-     "dynamics": {
-     "dynamics_maxspeed": 67,
-     "dynamics_enginepower": 150000,
-     "dynamics_maxdecel": 9.5,
-     "dynamics_maxsteering": 0.48,
-     "dynamics_mass": 1700,
-     "dynamics_frontsurfaceeffective": 2.2,
-     "dynamics_airdragcoefficient": 0.31,
-     "dynamics_rollingresistance": 0,
-     "dynamics_wheeldiameter": 0.684,
-     "dynamics_wheeldrive": "wheel_drive_front",
-     "dynamics_overallefficiency": 0.75,
-     "dynamics_distfront": 3.838,
-     "dynamics_distrear": 1.086,
-     "dynamics_distleft": 0.94,
-     "dynamics_distright": 0.94,
-     "dynamics_distheight": 1.444,
-     "dynamics_wheelbase": 2.91
-     },
-     */
-    private String vehicleId;
-    private String modelLabel;
-    private BigDecimal maxSpeed;
-    private BigDecimal enginePower;
-    private BigDecimal maxDeceleration;
-    private BigDecimal maxSteeringAngle;
-    private BigDecimal mass;
-    private BigDecimal frontSurfaceEffective;
-    private BigDecimal airDragCoefficient;
-    private BigDecimal rollingResistanceCoefficient;
-    private BigDecimal wheelDiameter;
-    private String wheelDrive;
-    private BigDecimal overallEfficiency;
-    private BigDecimal frontDistance;
-    private BigDecimal rearDistance;
-    private BigDecimal leftDistance;
-    private BigDecimal rightDistance;
-    private BigDecimal heightDistance;
-    private BigDecimal wheelbase;
-
+    private String pId;
+    private String sceneId;
+    private String sceneName;
+    private String sceneType;
+    private String runState;
+    private String runResult;
 }
 }

+ 59 - 0
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/pojo/po/VehiclePO.java

@@ -0,0 +1,59 @@
+package com.css.simulation.resource.scheduler.pojo.po;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class VehiclePO {
+
+    /**
+     * 车辆模型
+     * 		"model": {
+     * 			"model_label": "AudiA6_10"
+     *                },
+     "dynamics": {
+     "dynamics_maxspeed": 67,
+     "dynamics_enginepower": 150000,
+     "dynamics_maxdecel": 9.5,
+     "dynamics_maxsteering": 0.48,
+     "dynamics_mass": 1700,
+     "dynamics_frontsurfaceeffective": 2.2,
+     "dynamics_airdragcoefficient": 0.31,
+     "dynamics_rollingresistance": 0,
+     "dynamics_wheeldiameter": 0.684,
+     "dynamics_wheeldrive": "wheel_drive_front",
+     "dynamics_overallefficiency": 0.75,
+     "dynamics_distfront": 3.838,
+     "dynamics_distrear": 1.086,
+     "dynamics_distleft": 0.94,
+     "dynamics_distright": 0.94,
+     "dynamics_distheight": 1.444,
+     "dynamics_wheelbase": 2.91
+     },
+     */
+    private String modelLabel;
+    private BigDecimal maxSpeed;
+    private BigDecimal enginePower;
+    private BigDecimal maxDeceleration;
+    private BigDecimal maxSteeringAngle;
+    private BigDecimal mass;
+    private BigDecimal frontSurfaceEffective;
+    private BigDecimal airDragCoefficient;
+    private BigDecimal rollingResistanceCoefficient;
+    private BigDecimal wheelDiameter;
+    private String wheelDrive;
+    private BigDecimal overallEfficiency;
+    private BigDecimal frontDistance;
+    private BigDecimal rearDistance;
+    private BigDecimal leftDistance;
+    private BigDecimal rightDistance;
+    private BigDecimal heightDistance;
+    private BigDecimal wheelbase;
+}

+ 4 - 1
simulation-resource-scheduler/src/main/java/com/css/simulation/resource/scheduler/service/TaskService.java

@@ -24,7 +24,10 @@ public class TaskService {
      */
      */
     public ResponseBodyVO<String> taskStateModify(String taskId, String taskState) {
     public ResponseBodyVO<String> taskStateModify(String taskId, String taskState) {
         //1 根据 taskId 修改任务状态 taskState。
         //1 根据 taskId 修改任务状态 taskState。
-        //2 如果 taskState 为完成状态,调用打分算法对该任务进行打分。
+        //2 如果 taskState 为完成状态,项目的已完成任务数+1。
+        //3 如果已完成任务数等于所有任务数量,调用打分程序,对项目中每个指标进行打分,
+        //4 根据每个指标的得分和权重算出 project 的总得分。
+
         return null;
         return null;
     }
     }
 }
 }

+ 1 - 1
simulation-resource-scheduler/src/main/resources/bootstrap.yml

@@ -13,4 +13,4 @@ spring:
       config:
       config:
         server-addr: 10.15.12.70:8848
         server-addr: 10.15.12.70:8848
         namespace: 3698bfc2-a612-487a-b2a2-aaad16cd9d9d
         namespace: 3698bfc2-a612-487a-b2a2-aaad16cd9d9d
-        file-extension: yaml
+        file-extension: yaml

文件差異過大導致無法顯示
+ 18 - 0
simulation-resource-scheduler/src/main/resources/kubernetes/config


+ 16 - 0
simulation-resource-scheduler/src/main/resources/kubernetes/template/job/job-template.yaml

@@ -0,0 +1,16 @@
+---
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: pi    # job 名称
+spec:
+  completions: 1
+  parallelism: 1
+  template:
+    spec:
+      restartPolicy: Never
+      containers:
+        - image: perl
+          imagePullPolicy: IfNotPresent
+          name: pi
+          command: [ "perl", "-Mbignum=bpi","-wle","print bpi(2000)" ]

部分文件因文件數量過多而無法顯示