|
@@ -22,13 +22,14 @@ import feign.Response;
|
|
|
import lombok.SneakyThrows;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-
|
|
|
-import java.util.*;
|
|
|
-
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.File;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@Slf4j
|
|
|
@Service
|
|
@@ -45,6 +46,7 @@ public class SceneAccidentService {
|
|
|
LogService logService;
|
|
|
@Autowired
|
|
|
DictService dictService;
|
|
|
+
|
|
|
/**
|
|
|
* 获取交通事故场景数据:
|
|
|
*/
|
|
@@ -115,7 +117,9 @@ public class SceneAccidentService {
|
|
|
|
|
|
}
|
|
|
|
|
|
- /* *//**
|
|
|
+ /* */
|
|
|
+
|
|
|
+ /**
|
|
|
* 获取交通事故场景数据:
|
|
|
*//*
|
|
|
@SneakyThrows
|
|
@@ -198,7 +202,7 @@ public class SceneAccidentService {
|
|
|
|
|
|
String roleCode = AuthUtil.getCurrentUserRoleCode();
|
|
|
String userId = AuthUtil.getCurrentUserId();
|
|
|
- if(DictConstants.ROLE_CODE_ADMIN.equals(roleCode) || DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode)){ //管理员账户
|
|
|
+ if (DictConstants.ROLE_CODE_ADMIN.equals(roleCode) || DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode)) { //管理员账户
|
|
|
|
|
|
if ((params.getXlk().equals("1") && params.getBq().equals(1)) || (params.getXlk().equals("0") && params.getBq().equals(0)) || (params.getXlk().equals("1") && params.getBq().equals(0))) {
|
|
|
list = SceneAccidentMapper.querySceneAccidentList(params);
|
|
@@ -207,7 +211,7 @@ public class SceneAccidentService {
|
|
|
}*/ else if (params.getXlk().equals("0") && params.getBq().equals(1)) {
|
|
|
list = SceneAccidentMapper.querySceneAccidentListByBq(params);
|
|
|
}
|
|
|
- }else if(DictConstants.ROLE_CODE_SUBUESR.equals(roleCode)){
|
|
|
+ } else if (DictConstants.ROLE_CODE_SUBUESR.equals(roleCode)) {
|
|
|
//查询父账户
|
|
|
userId = AuthUtil.getCreateUserId();
|
|
|
params.setUserId(userId);
|
|
@@ -216,7 +220,7 @@ public class SceneAccidentService {
|
|
|
} else if (params.getXlk().equals("0") && params.getBq().equals(1)) {
|
|
|
list = SceneAccidentMapper.querySceneAccidentListByBqAndQx(params);
|
|
|
}
|
|
|
- }else if(DictConstants.ROLE_CODE_UESR.equals(roleCode)){
|
|
|
+ } else if (DictConstants.ROLE_CODE_UESR.equals(roleCode)) {
|
|
|
//查询普通账户
|
|
|
params.setUserId(userId);
|
|
|
if ((params.getXlk().equals("1") && params.getBq().equals(1)) || (params.getXlk().equals("0") && params.getBq().equals(0)) || (params.getXlk().equals("1") && params.getBq().equals(0))) {
|
|
@@ -323,7 +327,6 @@ public class SceneAccidentService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
public List<SceneAccidentPO> querySceneAccidentListByQx(SceneAccidentParam params) {
|
|
|
if (ObjectUtil.isNotNull(params.getSceneName()) || (params.getSelfDriving() != null && params.getSelfDriving().size() > 0) || (params.getTargetDriving() != null && params.getTargetDriving().size() > 0)
|
|
|
|| (params.getSelfReaction() != null && params.getSelfReaction().size() > 0) || (params.getConflictType() != null && params.getConflictType().size() > 0) || (params.getConflictBehavior() != null && params.getConflictBehavior().size() > 0) || (params.getIds() != null && params.getIds().length > 0)) {
|
|
@@ -377,10 +380,10 @@ public class SceneAccidentService {
|
|
|
params.setModifyTime(TimeUtil.getNowForMysql());
|
|
|
params.setModifyUserId(AuthUtil.getCurrentUserId());
|
|
|
SceneAccidentMapper.deleteSceneAccidentList(params);
|
|
|
- Map map=new HashMap();
|
|
|
- map.put("sceneId",params.getAccidentId());
|
|
|
- map.put("sceneName",params.getSceneName());
|
|
|
- map.put("type",DictConstants.SCENE_ACCIDENT);
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("sceneId", params.getAccidentId());
|
|
|
+ map.put("sceneName", params.getSceneName());
|
|
|
+ map.put("type", DictConstants.SCENE_ACCIDENT);
|
|
|
logService.logSceneDelete(LogConstants.SYS_LOG_SCENE_DELETE, map);
|
|
|
//systemUserSceneService.deleteSystemUserSceneBySceneId(params.getAccidentId());
|
|
|
}
|
|
@@ -642,7 +645,7 @@ public class SceneAccidentService {
|
|
|
* 获取交通事故场景数据:
|
|
|
*/
|
|
|
public SceneImportPO importMiNio(SceneImportParam parms) {
|
|
|
- SceneImportPO sceneImportPO=new SceneImportPO();
|
|
|
+ SceneImportPO sceneImportPO = new SceneImportPO();
|
|
|
sceneImportPO.setId(parms.getId());
|
|
|
try {
|
|
|
MinioParameter MI = new MinioParameter();
|
|
@@ -678,15 +681,20 @@ public class SceneAccidentService {
|
|
|
String json = download.body().toString();
|
|
|
ObjectMapper objMap = new ObjectMapper();
|
|
|
JsonNode root = objMap.readTree(json);
|
|
|
- //判断场景名称唯一
|
|
|
+ // 判断场景名称唯一
|
|
|
String sceneName = root.path("场景名称").asText();
|
|
|
- String selfDriving = root.path("自车驾驶行为").asText();
|
|
|
- String conflictType = root.path("冲突类型").asText();
|
|
|
- String conflictBehavior = root.path("冲突行为").asText();
|
|
|
- String selfReaction=root.path("自车反应行为").asText();
|
|
|
- if(ObjectUtil.isNull(selfDriving)&&ObjectUtil.isNull(conflictType)&&ObjectUtil.isNull(conflictBehavior)&&ObjectUtil.isNull(selfReaction)){
|
|
|
+ String selfDriving = root.path("自车驾驶行为").asText();
|
|
|
+ String conflictType = root.path("冲突类型").asText();
|
|
|
+ String conflictBehavior = root.path("冲突行为").asText();
|
|
|
+ String selfReaction = root.path("自车反应行为").asText();
|
|
|
+ if (ObjectUtil.isNull(selfDriving)
|
|
|
+ && ObjectUtil.isNull(conflictType)
|
|
|
+ && ObjectUtil.isNull(conflictBehavior)
|
|
|
+ && ObjectUtil.isNull(selfReaction))
|
|
|
+ {
|
|
|
sceneImportPO.setStatus(DictConstants.SCENE_IMPORT_STATUS_2);
|
|
|
- sceneImportPO.setErrorMessage("该文件:"+adress+"与交通事故场景类型不匹配,解析失败,请检查");
|
|
|
+ sceneImportPO.setErrorMessage("文件 " + adress + " 内容不符合标准格式,解析失败。");
|
|
|
+// sceneImportPO.setErrorMessage("文件 " + adress + " 与交通事故场景类型不匹配,解析失败,请检查");
|
|
|
return sceneImportPO;
|
|
|
}
|
|
|
String sceneId = SceneAccidentMapper.querySceneAccidentByNmae(sceneName);
|
|
@@ -704,10 +712,10 @@ public class SceneAccidentService {
|
|
|
sceneAccidentPO.setSceneWeather(root.path("天气").asText());
|
|
|
sceneAccidentPO.setMaxTime(root.path("max_time").asText());
|
|
|
sceneAccidentPO.setIsDeleted("0");
|
|
|
- if(ObjectUtil.isNull(sceneAccidentPO.getOsgbAddress())){
|
|
|
+ if (ObjectUtil.isNull(sceneAccidentPO.getOsgbAddress())) {
|
|
|
sceneAccidentPO.setOsgbAddress(osgbAdress);
|
|
|
}
|
|
|
- if(ObjectUtil.isNull(sceneAccidentPO.getXodrAddress())){
|
|
|
+ if (ObjectUtil.isNull(sceneAccidentPO.getXodrAddress())) {
|
|
|
sceneAccidentPO.setXodrAddress(xodrAdress);
|
|
|
}
|
|
|
if (ObjectUtil.isNull(sceneId)) {
|
|
@@ -757,13 +765,13 @@ public class SceneAccidentService {
|
|
|
sceneImportPO.setSuccessNum(successNum);
|
|
|
sceneImportPO.setFalseNum(falseNum);
|
|
|
sceneImportPO.setErrorMessage(errorMessage);
|
|
|
- // sceneImportTaskService.updateSceneImportTask(sceneImportTaskPO);
|
|
|
+ // sceneImportTaskService.updateSceneImportTask(sceneImportTaskPO);
|
|
|
|
|
|
return sceneImportPO;
|
|
|
- }catch (Exception e){
|
|
|
- sceneImportPO.setErrorMessage("该文件地址:"+parms.getMinioDirectory()+"解析失败,请检查");
|
|
|
+ } catch (Exception e) {
|
|
|
+ sceneImportPO.setErrorMessage("该文件地址:" + parms.getMinioDirectory() + "解析失败,请检查");
|
|
|
sceneImportPO.setStatus(DictConstants.SCENE_IMPORT_STATUS_2);
|
|
|
- // sceneImportTaskService.updateSceneImportTask(sceneImportTaskPO);
|
|
|
+ // sceneImportTaskService.updateSceneImportTask(sceneImportTaskPO);
|
|
|
return sceneImportPO;
|
|
|
}
|
|
|
}
|