|
@@ -1,14 +1,20 @@
|
|
|
package com.css.simulation.resource.scene.service;
|
|
|
|
|
|
+import api.common.pojo.param.MinioParameter;
|
|
|
+import api.common.pojo.param.scene.SceneNaturalNewParam;
|
|
|
import api.common.pojo.param.scene.SceneNaturalParam;
|
|
|
import api.common.pojo.po.scene.SceneNaturalPO;
|
|
|
import api.common.util.FileUtil;
|
|
|
+import api.common.util.ObjectUtil;
|
|
|
+import api.common.util.ParamUtil;
|
|
|
import api.common.util.TimeUtil;
|
|
|
import com.css.simulation.resource.common.utils.AuthUtil;
|
|
|
+import com.css.simulation.resource.feign.FileDownService;
|
|
|
import com.css.simulation.resource.scene.mapper.SceneNaturalMapper;
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.github.pagehelper.util.StringUtil;
|
|
|
+import feign.Response;
|
|
|
import lombok.SneakyThrows;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -28,35 +34,20 @@ public class SceneNaturalService {
|
|
|
private SceneNaturalMapper sceneNaturalMapper;
|
|
|
|
|
|
|
|
|
-
|
|
|
+ @Resource
|
|
|
+ private FileDownService fileDownService;
|
|
|
|
|
|
* 获取自然驾驶场景数据:包括切分数据和标注数据
|
|
|
*/
|
|
|
@SneakyThrows
|
|
|
public void importZrjsSceneCicv(SceneNaturalParam param) {
|
|
|
-
|
|
|
-
|
|
|
- String dataUrl0 = param.getPath();
|
|
|
-
|
|
|
- File[] scenes = FileUtil.getDirectory(dataUrl0).listFiles();
|
|
|
- if (scenes == null) {
|
|
|
- throw new RuntimeException("目录:" + dataUrl0 + " 下没有文件!");
|
|
|
- }
|
|
|
-
|
|
|
- String fileName = null;
|
|
|
- try {
|
|
|
-
|
|
|
- for (File scene : scenes) {
|
|
|
- String dataUrl = scene.getAbsolutePath();
|
|
|
- if(dataUrl.indexOf(".json")!=-1){
|
|
|
-
|
|
|
- File tempFile =new File( dataUrl.trim());
|
|
|
- fileName = tempFile.getName();
|
|
|
- fileName= fileName.substring(0,fileName.lastIndexOf("."));
|
|
|
-
|
|
|
- List<String> exceptionList = new ArrayList<>();
|
|
|
-
|
|
|
- String json = FileUtil.readFile(dataUrl);
|
|
|
+ MinioParameter MI=new MinioParameter();
|
|
|
+ MI.setObjectName(param.getJsonAddress());
|
|
|
+ int idx=param.getJsonAddress().lastIndexOf("/");
|
|
|
+ int end=param.getJsonAddress().lastIndexOf(".");
|
|
|
+ String fileName=param.getJsonAddress().substring(idx+1,end);
|
|
|
+ Response download = fileDownService.download(MI);
|
|
|
+ String json =download.body().toString();
|
|
|
ObjectMapper objMap = new ObjectMapper();
|
|
|
JsonNode root = objMap.readTree(json);
|
|
|
|
|
@@ -134,17 +125,12 @@ public class SceneNaturalService {
|
|
|
if(null!=param.getVideoAddress()&&!param.getVideoAddress().equals("")){
|
|
|
sceneNaturalPO.setVideoAddress(param.getVideoAddress());
|
|
|
}
|
|
|
+ if(null!=param.getVideoPreview()&&!param.getVideoPreview().equals("")){
|
|
|
+ sceneNaturalPO.setVideoPreview(param.getVideoPreview());
|
|
|
+ }
|
|
|
|
|
|
sceneNaturalMapper.saveSceneNatural(sceneNaturalPO);
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("场景" + fileName + " 解析出错:", e);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public String getSequenceNew(JsonNode jsonObject, String field) throws Exception {
|
|
@@ -193,8 +179,41 @@ public class SceneNaturalService {
|
|
|
else
|
|
|
return s;
|
|
|
}
|
|
|
- public List<SceneNaturalPO> querySceneNaturalList(SceneNaturalParam params) {
|
|
|
- List<SceneNaturalPO> list = sceneNaturalMapper.querySceneNaturalList(params);
|
|
|
+ public List<SceneNaturalPO> querySceneNaturalList(SceneNaturalNewParam params) {
|
|
|
+ SceneNaturalParam po=new SceneNaturalParam();
|
|
|
+ String naturalName=params.getNaturalName();
|
|
|
+ String[][] naturalEnvironment=params.getNaturalEnvironment() ;
|
|
|
+ String[][] road =params.getRoad();
|
|
|
+ String[][] infrastructure =params.getInfrastructure();
|
|
|
+ String[][] temporaryOperation =params.getTemporaryOperation();
|
|
|
+ String[][] trafficCondition =params.getTrafficCondition();
|
|
|
+ String[][] selfBehavior =params.getSelfBehavior() ;
|
|
|
+ String[][] targetBehavior =params.getTargetBehavior();
|
|
|
+ if(ObjectUtil.isNotNull(naturalName)) {
|
|
|
+ po.setNaturalName(naturalName);
|
|
|
+ }
|
|
|
+ if(naturalEnvironment!=null&&naturalEnvironment.length>0) {
|
|
|
+ ParamUtil.arrConvertObj(naturalEnvironment, po);
|
|
|
+ }
|
|
|
+ if(road!=null&&road.length>0) {
|
|
|
+ ParamUtil.arrConvertObj(road, po);
|
|
|
+ }
|
|
|
+ if(infrastructure!=null&&infrastructure.length>0) {
|
|
|
+ ParamUtil.arrConvertObj(infrastructure, po);
|
|
|
+ }
|
|
|
+ if(temporaryOperation!=null&&temporaryOperation.length>0) {
|
|
|
+ ParamUtil.arrConvertObj(temporaryOperation, po);
|
|
|
+ }
|
|
|
+ if(trafficCondition!=null&&trafficCondition.length>0) {
|
|
|
+ ParamUtil.arrConvertObj(trafficCondition, po);
|
|
|
+ }
|
|
|
+ if(selfBehavior!=null&&selfBehavior.length>0) {
|
|
|
+ ParamUtil.arrConvertObj(selfBehavior, po);
|
|
|
+ }
|
|
|
+ if(targetBehavior!=null&&targetBehavior.length>0) {
|
|
|
+ ParamUtil.arrConvertObj(targetBehavior, po);
|
|
|
+ }
|
|
|
+ List<SceneNaturalPO> list = sceneNaturalMapper.querySceneNaturalList(po);
|
|
|
return list;
|
|
|
}
|
|
|
}
|