Преглед на файлове

Merge remote-tracking branch 'origin/master'

martin преди 3 години
родител
ревизия
d93bde2c85
променени са 25 файла, в които са добавени 682 реда и са изтрити 24 реда
  1. 13 0
      api-common/pom.xml
  2. 3 0
      api-common/src/main/java/api/common/pojo/param/scene/SceneNaturalNewParam.java
  3. 1 0
      api-common/src/main/java/api/common/pojo/po/scene/ScenePackagePO.java
  4. 1 0
      api-common/src/main/java/api/common/pojo/po/scene/ScenePackageSublistPO.java
  5. 1 0
      api-common/src/main/java/api/common/pojo/vo/scene/ScenePackageNewVO.java
  6. 1 0
      api-common/src/main/java/api/common/pojo/vo/scene/ScenePackageSublistVO.java
  7. 60 0
      api-common/src/main/java/api/common/util/JgitUtil.java
  8. 25 0
      simulation-resource-common/src/main/java/com/css/simulation/resource/common/controller/MinioController.java
  9. 26 0
      simulation-resource-common/src/main/java/com/css/simulation/resource/common/util/MinioUtil.java
  10. 88 0
      simulation-resource-common/src/main/java/com/css/simulation/resource/common/util/processbar/ProgressBar.java
  11. 62 0
      simulation-resource-common/src/main/java/com/css/simulation/resource/common/util/processbar/ProgressState.java
  12. 103 0
      simulation-resource-common/src/main/java/com/css/simulation/resource/common/util/processbar/ProgressStream.java
  13. 88 0
      simulation-resource-common/src/main/java/com/css/simulation/resource/common/util/processbar/ProgressThread.java
  14. 0 2
      simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/ctrl/AlgorithmCtrl.java
  15. 2 1
      simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/service/AlgorithmService.java
  16. 10 8
      simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/serviceImpl/AlgorithmServiceImpl.java
  17. 4 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/feign/FileDownService.java
  18. 8 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/feign/fallback/FileDownServiceFallback.java
  19. 7 2
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/FileController.java
  20. 129 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/HomePageController.java
  21. 30 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/SceneAccidentService.java
  22. 4 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/ScenePackageService.java
  23. 3 0
      simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/StandardsRegulationsService.java
  24. 8 6
      simulation-resource-server/src/main/resources/mapper/scene/ScenePackageMapper.xml
  25. 5 5
      simulation-resource-server/src/main/resources/mapper/scene/ScenePackageSublistMapper.xml

+ 13 - 0
api-common/pom.xml

@@ -59,7 +59,20 @@
             <artifactId>spring-boot-starter-web</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.eclipse.jgit</groupId>
+            <artifactId>org.eclipse.jgit</artifactId>
+        </dependency>
 
+        <dependency>
+            <groupId>me.tongfei</groupId>
+            <artifactId>progressbar</artifactId>
+            <version>0.5.3</version>
+        </dependency>
+        <dependency>
+            <groupId>io.minio</groupId>
+            <artifactId>minio</artifactId>
+        </dependency>
 
 
     </dependencies>

+ 3 - 0
api-common/src/main/java/api/common/pojo/param/scene/SceneNaturalNewParam.java

@@ -25,4 +25,7 @@ public class SceneNaturalNewParam extends PageVO implements Serializable {
     private String[][] selfBehavior  ;//自车行为
     private String[][] targetBehavior ; //目标行为
     private String[] ids ; //回显数组
+
+
+
 }

+ 1 - 0
api-common/src/main/java/api/common/pojo/po/scene/ScenePackagePO.java

@@ -24,6 +24,7 @@ public class ScenePackagePO implements Serializable {
     private Integer sceneNum;//场景数量
     private String remarks;//备注
     private String share ; //是否分析  1为分享
+    private String treeNode;//模板预览node节点
     /**
      * 记录创建时间
      */

+ 1 - 0
api-common/src/main/java/api/common/pojo/po/scene/ScenePackageSublistPO.java

@@ -32,6 +32,7 @@ public class ScenePackageSublistPO implements Serializable {
     private int packageLevel;//级别
     private String remarks;//备注
     private String share ; //是否分析  1为分享
+    private String treeNode;//模板预览node节点
     /**
      * 记录创建时间
      */

+ 1 - 0
api-common/src/main/java/api/common/pojo/vo/scene/ScenePackageNewVO.java

@@ -24,5 +24,6 @@ public class ScenePackageNewVO  implements Serializable {
     private Integer sceneNum;//场景数量
     private String remarks;//备注
     private List<ScenePackageSublistVO> list;
+    private String treeNode;//模板预览node节点
 
 }

+ 1 - 0
api-common/src/main/java/api/common/pojo/vo/scene/ScenePackageSublistVO.java

@@ -31,4 +31,5 @@ public class ScenePackageSublistVO implements Serializable {
     private String remarks;//备注
     private int seq;//在当前层级下的顺序,由小到大
     private List<ScenePackageSublistVO>  children;
+    private String treeNode;//模板预览node节点
 }

+ 60 - 0
api-common/src/main/java/api/common/util/JgitUtil.java

@@ -0,0 +1,60 @@
+package api.common.util;
+
+import io.minio.MinioClient;
+import io.minio.PutObjectArgs;
+import io.minio.errors.MinioException;
+import org.eclipse.jgit.api.Git;
+import org.eclipse.jgit.api.errors.GitAPIException;
+import org.eclipse.jgit.lib.Ref;
+import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;
+
+import java.io.*;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.util.Date;
+import java.util.Map;
+
+
+
+/**
+ <dependency>
+ <groupId>org.eclipse.jgit</groupId>
+ <artifactId>org.eclipse.jgit</artifactId>
+ </dependency>
+ */
+public class JgitUtil {
+
+
+   public static Map<String, Ref> testConnection(String remoteUrl, String username, String password) throws GitAPIException {
+       UsernamePasswordCredentialsProvider provider = new UsernamePasswordCredentialsProvider(username,password);
+       Map<String, Ref> asMap = Git.lsRemoteRepository().setRemote(remoteUrl).setCredentialsProvider(provider).callAsMap();
+       return asMap;
+   }
+
+    public static Map<String, Ref> testConnectionByToken(String remoteUrl, String gitToken) throws GitAPIException {
+        UsernamePasswordCredentialsProvider provider = new UsernamePasswordCredentialsProvider("PRIVATE-TOKEN", gitToken);
+        Map<String, Ref> asMap = Git.lsRemoteRepository().setRemote(remoteUrl).setCredentialsProvider(provider).callAsMap();
+        return asMap;
+    }
+
+    public static Git clone(String remoteUrl, String directory, String username, String password) throws GitAPIException, IOException {
+        UsernamePasswordCredentialsProvider provider = new UsernamePasswordCredentialsProvider(username,password);
+        File localPath = new File(directory);
+        Git result = Git.cloneRepository().setURI(remoteUrl).setDirectory(localPath).setCredentialsProvider(provider).call();
+        return result;
+    }
+
+    public static void main(String[] args) throws GitAPIException, IOException {
+       try {
+           Map<String, Ref> asMap = testConnection("http://10.15.12.70:3000/CSS/simulation-cloud.git","zhaoyan","111112111");
+           System.out.println("slfasjkfasfksd:");
+           System.out.println(asMap);
+       }catch (Exception e){
+           System.out.println("failllll:");
+       }
+    }
+
+
+
+
+}

+ 25 - 0
simulation-resource-common/src/main/java/com/css/simulation/resource/common/controller/MinioController.java

@@ -7,6 +7,7 @@ import com.css.simulation.resource.common.util.MinioUtil;
 import io.minio.MinioClient;
 import io.minio.errors.*;
 import io.minio.http.Method;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.MediaType;
 import org.springframework.validation.annotation.Validated;
@@ -30,6 +31,9 @@ public class MinioController {
     @Value("${minio.bucket-name}")
     private String bucketName;
 
+    @Autowired
+    RedisController redisController;
+
 
     @PostMapping("/hello")
     public String hello() {
@@ -52,6 +56,27 @@ public class MinioController {
         return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, "请求成功!", previewUrl);
     }
 
+
+    @PostMapping(value = "/uploadProcessBar", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    public ResponseBodyVO<String> uploadProcessBar(
+            @RequestPart("file") MultipartFile file,
+            @RequestParam("objectName") String objectName,//  "/xx/xxx/x/xx"
+            @RequestParam("objectPath") String objectPath
+    ) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
+
+        MinioUtil.uploadProcessBar(
+                minioClient,
+                file,
+                bucketName,
+                objectName,
+                objectPath,
+                redisController
+        );
+        String previewUrl = MinioUtil.getPreviewUrl(minioClient, Method.GET, bucketName, objectName);
+
+        return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, "请求成功!", previewUrl);
+    }
+
 //    @PostMapping("/download")
 //    public ResponseBodyVO<String> download(
 //            @RequestBody @Validated MinioParameter minioParameter,

+ 26 - 0
simulation-resource-common/src/main/java/com/css/simulation/resource/common/util/MinioUtil.java

@@ -1,5 +1,7 @@
 package com.css.simulation.resource.common.util;
 
+import com.css.simulation.resource.common.controller.RedisController;
+import com.css.simulation.resource.common.util.processbar.ProgressStream;
 import io.minio.*;
 import io.minio.errors.ErrorResponseException;
 import io.minio.errors.InsufficientDataException;
@@ -9,6 +11,8 @@ import io.minio.http.Method;
 import jdk.nashorn.internal.runtime.regexp.joni.exception.InternalException;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.security.InvalidKeyException;
@@ -116,6 +120,28 @@ public class MinioUtil {
                 .build());
     }
 
+    /**
+     * 文件上传,保存进度
+     */
+    public static void uploadProcessBar(
+            MinioClient minioClient,
+            MultipartFile multipartFile,
+            String bucketName,
+            String objectName,
+            String objectPath,
+            RedisController redisController
+    ) throws IOException, InsufficientDataException, ErrorResponseException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException, io.minio.errors.ServerException, io.minio.errors.InternalException {
+        InputStream inputStream = multipartFile.getInputStream();
+        InputStream pis =
+                new BufferedInputStream(
+                        new ProgressStream(redisController, objectPath, inputStream));
+        minioClient.putObject(
+                PutObjectArgs.builder().bucket(bucketName).object(objectName).stream(
+                        pis, pis.available(), -1)
+                        .build());
+        pis.close();
+    }
+
     /**
      * 下载文件
      */

+ 88 - 0
simulation-resource-common/src/main/java/com/css/simulation/resource/common/util/processbar/ProgressBar.java

@@ -0,0 +1,88 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.css.simulation.resource.common.util.processbar;
+
+import com.css.simulation.resource.common.controller.RedisController;
+
+import java.io.PrintStream;
+import java.time.LocalDateTime;
+
+public class ProgressBar {
+    private ProgressState progress;
+    private ProgressThread target;
+    private Thread thread;
+
+    public ProgressBar(RedisController redisController, String task, long initialMax) {
+        this(redisController, task, initialMax, 1000, System.err);
+    }
+
+
+    public ProgressBar(RedisController redisController, String task, long initialMax, int updateIntervalMillis, PrintStream os) {
+        this.progress = new ProgressState(task, initialMax);
+        this.target = new ProgressThread(this.progress, (long)updateIntervalMillis, os, redisController);
+        this.thread = new Thread(this.target);
+    }
+
+    public ProgressBar start() {
+        this.progress.startTime = LocalDateTime.now();
+        this.thread.start();
+        return this;
+    }
+
+    public ProgressBar stepBy(long n) {
+        this.progress.stepBy(n);
+        return this;
+    }
+
+    public ProgressBar stepTo(long n) {
+        this.progress.stepTo(n);
+        return this;
+    }
+
+    public ProgressBar step() {
+        this.progress.stepBy(1L);
+        return this;
+    }
+
+    public ProgressBar maxHint(long n) {
+        this.progress.maxHint(n);
+        return this;
+    }
+
+    public ProgressBar stop() {
+        this.target.kill();
+
+        try {
+            this.thread.join();
+            this.target.consoleStream.print("\n");
+            this.target.consoleStream.flush();
+        } catch (InterruptedException var2) {
+        }
+
+        return this;
+    }
+
+    public ProgressBar setExtraMessage(String msg) {
+        this.progress.setExtraMessage(msg);
+        return this;
+    }
+
+    public long getCurrent() {
+        return this.progress.getCurrent();
+    }
+
+    public long getMax() {
+        return this.progress.getMax();
+    }
+
+    public String getTask() {
+        return this.progress.getTask();
+    }
+
+    public String getExtraMessage() {
+        return this.progress.getExtraMessage();
+    }
+}

+ 62 - 0
simulation-resource-common/src/main/java/com/css/simulation/resource/common/util/processbar/ProgressState.java

@@ -0,0 +1,62 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.css.simulation.resource.common.util.processbar;
+
+import java.time.LocalDateTime;
+
+class ProgressState {
+    String task;
+    long current = 0L;
+    long max = 0L;
+    LocalDateTime startTime = null;
+    String extraMessage = "";
+
+    ProgressState(String task, long initialMax) {
+        this.task = task;
+        this.max = initialMax;
+    }
+
+    synchronized void maxHint(long n) {
+        this.max = n;
+    }
+
+    synchronized void stepBy(long n) {
+        this.current += n;
+        if (this.current > this.max) {
+            this.max = this.current;
+        }
+
+    }
+
+    synchronized void stepTo(long n) {
+        this.current = n;
+        if (this.current > this.max) {
+            this.max = this.current;
+        }
+
+    }
+
+    synchronized void setExtraMessage(String msg) {
+        this.extraMessage = msg;
+    }
+
+    String getTask() {
+        return this.task;
+    }
+
+    synchronized String getExtraMessage() {
+        return this.extraMessage;
+    }
+
+    synchronized long getCurrent() {
+        return this.current;
+    }
+
+    synchronized long getMax() {
+        return this.max;
+    }
+}
+

+ 103 - 0
simulation-resource-common/src/main/java/com/css/simulation/resource/common/util/processbar/ProgressStream.java

@@ -0,0 +1,103 @@
+package com.css.simulation.resource.common.util.processbar;/*
+ * MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 2017 MinIO, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import com.css.simulation.resource.common.controller.RedisController;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+public class ProgressStream extends InputStream {
+    private InputStream in;
+    private ProgressBar pb;
+
+    /**
+     * ProgressStream implements an extends InputStream while also writing out the read progress on
+     * console. ProgressStream can be used as a direct replacement for any InputStream compatible
+     * input.
+     *
+     * @param msg Custom message string.
+     * @param stream InputStream to be wrapped.
+     * @throws IOException For any exception generated by the InputStream.
+     */
+    public ProgressStream(RedisController redisController, String msg, InputStream stream) throws IOException {
+        this(redisController, msg, (long) stream.available(), stream);
+    }
+
+    /**
+     * ProgressStream implements an extends InputStream while also writing out the read progress on
+     * console. ProgressStream can be used as a direct replacement for any InputStream compatible
+     * input.
+     *
+     * @param msg Custom message string.
+     * @param size Size of the progress bar.
+     * @param stream InputStream to be wrapped.
+     * @throws IOException For any exception generated by the InputStream.
+     */
+    public ProgressStream(RedisController redisController, String msg, long size, InputStream stream)
+            throws IOException {
+        super();
+
+        // Allocate the reader.
+        this.in = stream;
+
+        // Initialize progress bar.
+        this.pb = new ProgressBar(redisController, msg, size);
+        this.pb.start();
+    }
+
+    @Override
+    public int available() throws IOException {
+        return this.in.available();
+    }
+
+    @Override
+    public void close() throws IOException {
+        this.pb.stop();
+        this.in.close();
+        return;
+    }
+
+    @Override
+    public int read() throws IOException {
+        this.pb.step();
+        return this.in.read();
+    }
+
+    @Override
+    public int read(byte[] toStore) throws IOException {
+        int readBytes = this.in.read(toStore);
+        this.pb.stepBy(readBytes); // Update progress bar.
+        return readBytes;
+    }
+
+    @Override
+    public int read(byte[] toStore, int off, int len) throws IOException {
+        int readBytes = this.in.read(toStore, off, len);
+        this.pb.stepBy(readBytes);
+        return readBytes;
+    }
+
+    @Override
+    public long skip(long n) throws IOException {
+        this.pb.stepTo(n);
+        return this.in.skip(n);
+    }
+
+    @Override
+    public boolean markSupported() {
+        return false;
+    }
+}

+ 88 - 0
simulation-resource-common/src/main/java/com/css/simulation/resource/common/util/processbar/ProgressThread.java

@@ -0,0 +1,88 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by Fernflower decompiler)
+//
+
+package com.css.simulation.resource.common.util.processbar;
+
+import api.common.pojo.param.RedisParameter;
+import com.css.simulation.resource.common.controller.RedisController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.stereotype.Component;
+
+import java.io.PrintStream;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.Duration;
+
+
+public class ProgressThread implements Runnable {
+    private final RedisController redisController;
+    volatile boolean running;
+    ProgressState progress;
+    long updateInterval;
+    PrintStream consoleStream;
+
+//    @Autowired
+//    RedisController redisController;
+
+//    @Autowired
+//    StringRedisTemplate redisTemplate;
+
+
+    ProgressThread(ProgressState progress, long updateInterval, PrintStream consoleStream,RedisController redisController) {
+        this.progress = progress;
+        this.updateInterval = updateInterval;
+        this.consoleStream = consoleStream;
+        this.redisController = redisController;
+    }
+
+    double progress() {
+        return this.progress.max == 0L ? 0.0D : (double)this.progress.current / (double)this.progress.max;
+    }
+
+
+    /**
+     * 保存文件进度
+     */
+    void refresh() {
+
+        //保存进度
+        Long progressMax = this.progress.max;
+        Long progressCurrent = this.progress.current;
+        String task = this.progress.task;
+//        System.out.println("上传进度:"+task);
+        Double radio = new BigDecimal(Double.valueOf(progressCurrent)/Double.valueOf(progressMax)).setScale(2, RoundingMode.UP).doubleValue();
+//        System.out.println("上传进度:"+radio);
+        RedisParameter redisParameter = new RedisParameter();
+        redisParameter.setKey(task);
+        redisParameter.setValue(radio.toString());
+        redisParameter.setMinutes(1440);//24小时清除
+
+        this.redisController.set(redisParameter);
+//        redisTemplate.opsForValue().set(redisParameter.getKey(), redisParameter.getValue(), Duration.ofMinutes(redisParameter.getMinutes()));
+
+
+    }
+
+    void kill() {
+        this.running = false;
+    }
+
+    public void run() {
+        this.running = true;
+
+        try {
+            while(this.running) {
+                this.refresh();
+                Thread.sleep(this.updateInterval);
+            }
+
+            this.refresh();
+        } catch (InterruptedException var2) {
+        }
+
+    }
+}

+ 0 - 2
simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/ctrl/AlgorithmCtrl.java

@@ -5,10 +5,8 @@ import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.param.algorithm.AlgorithmParameter;
 import com.css.simulation.resource.algorithm.service.AlgorithmService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.MediaType;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
 

+ 2 - 1
simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/service/AlgorithmService.java

@@ -5,6 +5,7 @@ import api.common.pojo.param.algorithm.AlgorithmParameter;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
+import java.util.Map;
 
 
 public interface AlgorithmService {
@@ -25,5 +26,5 @@ public interface AlgorithmService {
 
     ResponseBodyVO testConnection(AlgorithmParameter param);
 
-    ResponseBodyVO selectDetailsBySy();
+    Map selectDetailsBySy();
 }

+ 10 - 8
simulation-resource-server/src/main/java/com/css/simulation/resource/algorithm/serviceImpl/AlgorithmServiceImpl.java

@@ -4,6 +4,7 @@ import api.common.pojo.param.algorithm.AlgorithmParameter;
 import api.common.pojo.param.system.DictParam;
 import api.common.pojo.po.algorithm.AlgorithmPO;
 import api.common.pojo.constants.DictConstants;
+import api.common.util.JgitUtil;
 import api.common.util.StringUtil;
 import api.common.pojo.vo.algorithm.AlgorithmVO;
 import api.common.pojo.vo.algorithm.RunningProjectVO;
@@ -12,13 +13,12 @@ import com.css.simulation.resource.common.utils.AuthUtil;
 import com.css.simulation.resource.common.utils.PageUtil;
 import com.css.simulation.resource.algorithm.mapper.AlgorithmMapper;
 import com.css.simulation.resource.algorithm.service.AlgorithmService;
-import com.css.simulation.resource.feign.FileDownService;
 import com.css.simulation.resource.system.service.DictService;
 import com.github.pagehelper.PageInfo;
+import org.eclipse.jgit.lib.Ref;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import javax.annotation.Resource;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -31,9 +31,6 @@ public class AlgorithmServiceImpl implements AlgorithmService {
 
     @Autowired
     DictService dictService;
-
-    @Resource
-    FileDownService fileDownService;
     
     @Override
     public ResponseBodyVO addOrUpdate(AlgorithmParameter param) {
@@ -117,7 +114,12 @@ public class AlgorithmServiceImpl implements AlgorithmService {
 
     @Override
     public ResponseBodyVO testConnection(AlgorithmParameter param) {
-        return null;
+        try{
+            Map<String, Ref> asMap = JgitUtil.testConnectionByToken(param.getGitUrl(),param.getGitToken());
+        } catch (Exception e){
+            return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE,"连接失败!");
+        }
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,"连接成功");
     }
 
     @Override
@@ -232,7 +234,7 @@ public class AlgorithmServiceImpl implements AlgorithmService {
     }
 
     @Override
-    public ResponseBodyVO selectDetailsBySy() {
+    public Map selectDetailsBySy() {
         AlgorithmParameter param=new AlgorithmParameter();
         param.setUploadMode("1");
         param.setShare("0");
@@ -243,7 +245,7 @@ public class AlgorithmServiceImpl implements AlgorithmService {
         Map map=new HashMap();
         map.put("fileNum",fileNum);
         map.put("pathNum",pathNum);
-        return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS,map);
+        return map;
     }
 
 }

+ 4 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/feign/FileDownService.java

@@ -29,6 +29,10 @@ public interface FileDownService {
     ResponseBodyVO<String> upload(@RequestPart("file") MultipartFile file,
                                   @RequestParam("objectName") String objectName);
 
+    @PostMapping(value = "/minio/uploadProcessBar", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    ResponseBodyVO<String> uploadProcessBar(@RequestPart("file") MultipartFile file,
+                                  @RequestParam("objectName") String objectName,  @RequestParam("objectName") String objectPath);
+
     @PostMapping("/minio/download")
     Response download(@RequestBody @Validated MinioParameter minioParameter);
 }

+ 8 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/feign/fallback/FileDownServiceFallback.java

@@ -24,6 +24,14 @@ public class FileDownServiceFallback implements FileDownService {
         return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE);
     }
 
+    @Override
+    public ResponseBodyVO<String> uploadProcessBar(@RequestPart("file") MultipartFile file,
+                                                   @RequestParam("objectName") String objectName,
+                                                   @RequestParam("objectPath") String objectPath) {
+        return null;
+    }
+
+
     @Override
     public Response download(@RequestBody @Validated MinioParameter minioParameter) {
         log.error("------- 下载错误:" + minioParameter.getObjectName());

+ 7 - 2
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/FileController.java

@@ -48,11 +48,16 @@ public class FileController {
             } else if (type.equals(DictConstants.SCENE_GENERAL)) {
                 fileName = "泛化场景/" + nowTime + "/" + objectPath + "/" + multipartFile.getOriginalFilename();
             } else if (type.equals(DictConstants.ALGORITHM_FILE)) {
-                fileName = "algorithm/" + nowTime + "/" + multipartFile.getOriginalFilename();
+                fileName = "algorithm/" + nowTime + "/"  + objectPath + "/" + multipartFile.getOriginalFilename();
             } else {
                 fileName = multipartFile.getOriginalFilename();
             }
-            ResponseBodyVO<String> respon = fileDownService.upload(multipartFile, fileName);
+            ResponseBodyVO<String> respon;
+            if (type.equals(DictConstants.ALGORITHM_FILE)) {
+                respon = fileDownService.uploadProcessBar(multipartFile, fileName, objectPath);
+            }else {
+                respon = fileDownService.upload(multipartFile, fileName);
+            }
             String videoPreview = respon.getMessage();
             Map map = new HashMap();
            // map.put("videoPreview", videoPreview);

+ 129 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/HomePageController.java

@@ -0,0 +1,129 @@
+package com.css.simulation.resource.scene.ctrl;
+
+import api.common.pojo.common.ResponseBodyVO;
+import com.css.simulation.resource.algorithm.service.AlgorithmService;
+import com.css.simulation.resource.model.service.ConfigService;
+import com.css.simulation.resource.project.service.SimulationProjectService;
+import com.css.simulation.resource.scene.service.SceneNaturalService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.Map;
+
+//首页系统概览
+@Slf4j
+@RestController
+@RequestMapping("/homePage")
+public class HomePageController {
+    @Resource
+    SceneNaturalService sceneNaturalService;
+    @Resource
+    private AlgorithmService algorithmService;
+    @Autowired
+    private SimulationProjectService simulationProjectService;
+    @Autowired
+    private com.css.simulation.resource.model.service.ConfigService ConfigService;
+
+    //首页概况汇总方法
+    @PostMapping("/queryAllNum")
+    @ResponseBody
+    public ResponseBodyVO<Integer> queryAllNum() {
+
+        Map map=algorithmService.selectDetailsBySy();
+        map.put("ConfigTotal",ConfigService.getConfigTotal());
+        map.put("SceneNum", sceneNaturalService.querySceneNumBySy());
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, map);
+    }
+
+
+    //首页查询场景数量
+    @PostMapping("/querySceneNumBySy")
+    @ResponseBody
+    public ResponseBodyVO<Integer> querySceneNumBySy() {
+        Integer SceneNum = sceneNaturalService.querySceneNumBySy();
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, SceneNum);
+    }
+
+    //首页车辆配置数量
+    @PostMapping("/queryCarDisposeNumBySy")
+    @ResponseBody
+    public ResponseBodyVO<Integer> queryCarDisposeNumBySy() {
+        Integer ConfigTotal = ConfigService.getConfigTotal();
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, ConfigTotal);
+    }
+
+    /**
+     * 首页文件数量
+     *
+     * @param
+     * @return
+     */
+    @RequestMapping("selectDetailsBySy")
+    @ResponseBody
+    public ResponseBodyVO selectDetailsBySy() {
+
+        return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, algorithmService.selectDetailsBySy());
+    }
+
+    /**
+     * 近一周运行运行项目数量
+     *
+     * @param
+     * @return
+     */
+    @RequestMapping("selectRunProjectBySy")
+    @ResponseBody
+    public ResponseBodyVO selectRunProjectBySy() {
+        return simulationProjectService.selectRunProjectBySy();
+    }
+
+    /**
+     * 近一周运行任务数量
+     *
+     * @param
+     * @return
+     */
+    @RequestMapping("selectRunTaskBySy")
+    @ResponseBody
+    public ResponseBodyVO selectRunTaskBySy() {
+        return simulationProjectService.selectRunTaskBySy();
+    }
+
+    /**
+     * 任务运行状态统计-饼图
+     *
+     * @param
+     * @return
+     */
+    @RequestMapping("selectRunTaskByState")
+    @ResponseBody
+    public ResponseBodyVO selectRunTaskByState() {
+        return simulationProjectService.selectRunTaskByState();
+    }
+
+    /**
+     * 项目运行状态统计-饼图
+     *
+     * @param
+     * @return
+     */
+    @RequestMapping("selectRunProjectByState")
+    @ResponseBody
+    public ResponseBodyVO selectRunProjectByState() {
+        return simulationProjectService.selectRunProjectByState();
+    }
+
+    /**
+     * 评测等级分布-饼图
+     *
+     * @param
+     * @return
+     */
+    @RequestMapping("selectEvaluationLevel")
+    @ResponseBody
+    public ResponseBodyVO selectEvaluationLevel() {
+        return simulationProjectService.selectEvaluationLevel();
+    }
+}

+ 30 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/SceneAccidentService.java

@@ -5,6 +5,7 @@ import api.common.pojo.param.MinioParameter;
 import api.common.pojo.param.scene.SceneAccidentParam;
 import api.common.pojo.po.scene.SceneAccidentPO;
 import api.common.util.FileUtil;
+import api.common.util.ObjectUtil;
 import api.common.util.StringUtil;
 import api.common.util.TimeUtil;
 import com.css.simulation.resource.common.utils.AuthUtil;
@@ -164,6 +165,35 @@ public class SceneAccidentService {
     public List<SceneAccidentPO> querySceneAccidentList(SceneAccidentParam params) {
 
         List<SceneAccidentPO> list = SceneAccidentMapper.querySceneAccidentList(params);
+        for (SceneAccidentPO po: list) {
+            if(po.getConflictBehavior().indexOf("追尾")>0){
+                po.setLabel("追尾");
+            }
+            if(po.getTargetDriving().indexOf("切入")>0){
+                if(ObjectUtil.isNull(po.getLabel())){
+                    po.setLabel("目标车切入");
+                }else{
+                    po.setLabel(po.getLabel()+",目标车切入");
+                }
+
+            }
+            if(po.getTargetDriving().indexOf("沿弯道行驶")>0){
+                if(ObjectUtil.isNull(po.getLabel())){
+                    po.setLabel("目标车沿弯道行驶");
+                }else{
+                    po.setLabel(po.getLabel()+",目标车沿弯道行驶");
+                }
+
+            }
+            if(po.getConflictType().indexOf("机动车-机动车冲突")>0){
+                if(ObjectUtil.isNull(po.getLabel())){
+                    po.setLabel("机动车-机动车冲突");
+                }else{
+                    po.setLabel(po.getLabel()+",机动车-机动车冲突");
+                }
+            }
+        }
+
         return list;
     }
 

+ 4 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/ScenePackageService.java

@@ -47,6 +47,7 @@ public class ScenePackageService {
             po.setWeight(vo.getWeight());
             po.setRemarks(vo.getRemarks());
             po.setSceneNum(vo.getSceneNum());
+            po.setTreeNode(vo.getTreeNode());
             listSublictTree = vo.getChildren();
         }
         po.setCreateTime(TimeUtil.getNowForMysql());
@@ -92,6 +93,7 @@ public class ScenePackageService {
             po.setWeight(vo.getWeight());
             po.setRemarks(vo.getRemarks());
             po.setSceneNum(vo.getSceneNum());
+            po.setTreeNode(vo.getTreeNode());
             listSublictTree = vo.getChildren();
         }
 
@@ -137,6 +139,7 @@ public class ScenePackageService {
         root.setWeight(vo.getWeight());
         root.setSceneNum(vo.getSceneNum());
         root.setRemarks(vo.getRemarks());
+        root.setTreeNode(vo.getTreeNode());
         scenePackageSublistVOS.add(0, root);
         //list转tree
         List<ScenePackageSublistVO> tree = listToTree(scenePackageSublistVOS);
@@ -261,6 +264,7 @@ public class ScenePackageService {
                 params.setIsDeleted("0");
                 params.setShare(share);
                 params.setPackageLevel(level);
+                params.setTreeNode(parentVoList.get(i).getTreeNode());
                 List<ScenePackageSublistVO> cvoList = parentVoList.get(i).getChildren();
                 poList.add(params);
                 if (cvoList != null && cvoList.size() > 0) {

+ 3 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/StandardsRegulationsService.java

@@ -3,6 +3,7 @@ package com.css.simulation.resource.scene.service;
 import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.param.MinioParameter;
 import api.common.pojo.param.scene.StandardsRegulationsParam;
+import api.common.pojo.po.scene.SceneAccidentPO;
 import api.common.pojo.po.scene.StandardsRegulationsPO;
 import api.common.util.StringUtil;
 import api.common.util.TimeUtil;
@@ -16,6 +17,8 @@ import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 @Slf4j

+ 8 - 6
simulation-resource-server/src/main/resources/mapper/scene/ScenePackageMapper.xml

@@ -8,11 +8,11 @@
         (package_id,package_code,package_name,weight,
         package_and_rules,scene_num,remarks,
         create_user_id,create_time,modify_user_id,modify_time,
-         is_deleted,share)
+         is_deleted,share,tree_node)
         values (#{packageId,jdbcType=VARCHAR},#{packageCode,jdbcType=VARCHAR},#{packageName,jdbcType=VARCHAR},#{weight,jdbcType=VARCHAR},
         #{packageAndRules,jdbcType=VARCHAR},#{sceneNum},#{remarks,jdbcType=VARCHAR},
          #{createUserId,jdbcType=VARCHAR},#{createTime},#{modifyUserId,jdbcType=VARCHAR},#{modifyTime},
-        #{isDeleted,jdbcType=VARCHAR}, #{share,jdbcType=VARCHAR})
+        #{isDeleted,jdbcType=VARCHAR}, #{share,jdbcType=VARCHAR}, #{treeNode,jdbcType=VARCHAR})
     </insert>
 
 
@@ -22,7 +22,7 @@
         a.package_id,a.package_name,a.weight,a.package_code,
         a.package_and_rules,a.scene_num,a.remarks,
         a.create_user_id,a.create_time,a.modify_user_id,a.modify_time,
-        a.is_deleted,a.share
+        a.is_deleted,a.share,a.tree_node
         from simulation.scene_package as a
         <where>
             a.is_deleted = '0'
@@ -56,7 +56,7 @@
         a.package_id,a.package_name,a.package_code,a.weight,
         a.package_and_rules,a.scene_num,a.remarks,
         a.create_user_id,a.create_time,a.modify_user_id,a.modify_time,
-        a.is_deleted,a.share
+        a.is_deleted,a.share,a.tree_node
         from simulation.scene_package as a
         <where>
             a.is_deleted = '0'
@@ -86,7 +86,7 @@
             resultType="api.common.pojo.vo.scene.ScenePackageNewVO">
         select
         a.package_id ,a.package_name ,a.weight,a.package_code,
-        a.scene_num,a.remarks
+        a.scene_num,a.remarks,a.tree_node
         from simulation.scene_package as a
         <where>
             a.is_deleted = '0'
@@ -123,7 +123,9 @@
             <if test="modifyTime != null ">
                 modify_time = #{modifyTime},
             </if>
-
+            <if test="treeNode != null and treeNode!=''">
+                tree_node = #{treeNode},
+            </if>
         </set>
         where package_id = #{packageId,jdbcType=VARCHAR}
     </update>

+ 5 - 5
simulation-resource-server/src/main/resources/mapper/scene/ScenePackageSublistMapper.xml

@@ -8,14 +8,14 @@
         scene_natural_ids,scene_traffic_ids,scene_statue_ids,scene_generalization_ids,
         scene_num,parent_id,root_id,seq,package_level,remarks,
         create_user_id,create_time,modify_user_id,modify_time,
-         is_deleted,share)
+         is_deleted,share,tree_node)
         values (#{id,jdbcType=VARCHAR},#{sublistName,jdbcType=VARCHAR},#{weight,jdbcType=VARCHAR},#{ruleName,jdbcType=VARCHAR},
         #{packageAndRules,jdbcType=VARCHAR},
         #{sceneNaturalIds}, #{sceneTrafficIds}, #{sceneStatueIds}, #{sceneGeneralizationIds},
         #{sceneNum},#{parentId,jdbcType=VARCHAR},#{rootId,jdbcType=VARCHAR},#{seq},
          #{packageLevel},#{remarks},
          #{createUserId,jdbcType=VARCHAR},#{createTime},#{modifyUserId,jdbcType=VARCHAR},#{modifyTime},
-        #{isDeleted,jdbcType=VARCHAR}, #{share,jdbcType=VARCHAR})
+        #{isDeleted,jdbcType=VARCHAR}, #{share,jdbcType=VARCHAR}, #{treeNode,jdbcType=VARCHAR})
     </insert>
 
 
@@ -26,7 +26,7 @@
         scene_natural_ids,scene_traffic_ids,scene_statue_ids,scene_generalization_ids,
         scene_num,parent_id,root_id,seq,package_level,remarks,
         create_user_id,create_time,modify_user_id,modify_time,
-        is_deleted,share) values
+        is_deleted,share,tree_node) values
         <foreach collection="list" index="index" item="item" separator=",">
             (#{item.id,jdbcType=VARCHAR},#{item.sublistName,jdbcType=VARCHAR},#{item.weight,jdbcType=VARCHAR},#{item.ruleName,jdbcType=VARCHAR},
             #{item.packageAndRules,jdbcType=VARCHAR},
@@ -34,7 +34,7 @@
             #{item.sceneNum},#{item.parentId,jdbcType=VARCHAR},#{item.rootId,jdbcType=VARCHAR},#{index}+1,
             #{item.packageLevel},#{item.remarks},
             #{item.createUserId,jdbcType=VARCHAR},#{item.createTime},#{item.modifyUserId,jdbcType=VARCHAR},#{item.modifyTime},
-            #{item.isDeleted,jdbcType=VARCHAR}, #{item.share,jdbcType=VARCHAR})
+            #{item.isDeleted,jdbcType=VARCHAR}, #{item.share,jdbcType=VARCHAR}, #{item.treeNode,jdbcType=VARCHAR})
         </foreach>
     </insert>
 
@@ -43,7 +43,7 @@
         select
         a.sublist_id id,a.sublist_name,a.weight,b.rule_name,
         a.scene_num,a.parent_id,a.root_id,a.package_level,a.remarks,a.seq,a.package_and_rules,
-        a.scene_natural_ids,a.scene_traffic_ids,a.scene_statue_ids,a.scene_generalization_ids
+        a.scene_natural_ids,a.scene_traffic_ids,a.scene_statue_ids,a.scene_generalization_ids,a.tree_node
         from simulation.scene_package_sublist as a left join simulation.scoring_rules as b on
         a.package_and_rules=b.rules_id
         <where>