|
@@ -1,5 +1,6 @@
|
|
|
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.SceneAccidentParam;
|
|
|
import api.common.pojo.po.scene.SceneAccidentPO;
|
|
@@ -34,10 +35,8 @@ public class SceneAccidentService {
|
|
|
* 获取交通事故场景数据:
|
|
|
*/
|
|
|
@SneakyThrows
|
|
|
- public void importJtSg(SceneAccidentParam param) {
|
|
|
+ public ResponseBodyVO<String> importJtSg(SceneAccidentParam param) {
|
|
|
|
|
|
- String fileName = null;
|
|
|
- try {
|
|
|
MinioParameter MI=new MinioParameter();
|
|
|
MI.setObjectName(param.getJsonAddress());
|
|
|
Response download = fileDownService.download(MI);
|
|
@@ -45,11 +44,18 @@ public class SceneAccidentService {
|
|
|
String json = download.body().toString();;
|
|
|
ObjectMapper objMap = new ObjectMapper();
|
|
|
JsonNode root = objMap.readTree(json);
|
|
|
+ //判断场景名称唯一
|
|
|
+ String sceneName= root.path("场景名称").asText();
|
|
|
+ param.setSceneName(sceneName);
|
|
|
+ List<SceneAccidentPO> list= SceneAccidentMapper.querySceneAccidentByNmae(param);
|
|
|
+ if(list!=null && list.size()>0){
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE,"该场景名称"+ sceneName+"已存在,请检查");
|
|
|
+ }
|
|
|
|
|
|
SceneAccidentPO sceneAccidentPO = null;
|
|
|
sceneAccidentPO = sceneAccidentPO.builder()
|
|
|
.accidentId(StringUtil.getRandomUUID())
|
|
|
- .sceneName(root.path("场景名称").asText())
|
|
|
+ .sceneName(sceneName)
|
|
|
.selfDriving(root.path("自车驾驶行为").asText())
|
|
|
.targetDriving(root.path("目标驾驶行为").asText())
|
|
|
.selfReaction(root.path("自车反应行为").asText())
|
|
@@ -84,11 +90,7 @@ public class SceneAccidentService {
|
|
|
SceneAccidentMapper.saveSceneAccident(sceneAccidentPO);
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("标准法规场景" + fileName + " 解析出错:", e);
|
|
|
- }
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
|
|
|
|
|
|
|
|
|
}
|