|
@@ -23,6 +23,7 @@ import lombok.SneakyThrows;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
@@ -43,6 +44,7 @@ public class StandardsRegulationsService {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
DictService dictService;
|
|
DictService dictService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 获取标准法规场景数据:
|
|
* 获取标准法规场景数据:
|
|
*/
|
|
*/
|
|
@@ -56,7 +58,7 @@ public class StandardsRegulationsService {
|
|
ObjectMapper objMap = new ObjectMapper();
|
|
ObjectMapper objMap = new ObjectMapper();
|
|
JsonNode root = objMap.readTree(json);
|
|
JsonNode root = objMap.readTree(json);
|
|
String sceneName = root.path("场景名称").asText();
|
|
String sceneName = root.path("场景名称").asText();
|
|
- String sceneId = standardsRegulationsMapper.queryStandardsRegulationsByName(sceneName);
|
|
|
|
|
|
+ String sceneId = standardsRegulationsMapper.queryStandardsRegulationsByName(sceneName);
|
|
|
|
|
|
StandardsRegulationsPO standardsRegulationsPO = new StandardsRegulationsPO();
|
|
StandardsRegulationsPO standardsRegulationsPO = new StandardsRegulationsPO();
|
|
standardsRegulationsPO = standardsRegulationsPO.builder()
|
|
standardsRegulationsPO = standardsRegulationsPO.builder()
|
|
@@ -93,8 +95,8 @@ public class StandardsRegulationsService {
|
|
standardsRegulationsPO.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
standardsRegulationsPO.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
standardsRegulationsMapper.saveStandardsRegulations(standardsRegulationsPO);
|
|
standardsRegulationsMapper.saveStandardsRegulations(standardsRegulationsPO);
|
|
|
|
|
|
- // return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "该场景名称" + sceneName + "已存在,请检查");
|
|
|
|
- }else{
|
|
|
|
|
|
+ // return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "该场景名称" + sceneName + "已存在,请检查");
|
|
|
|
+ } else {
|
|
// -------------------------------- 修改数据到 mysql --------------------------------
|
|
// -------------------------------- 修改数据到 mysql --------------------------------
|
|
standardsRegulationsPO.setRegulationsId(sceneId);
|
|
standardsRegulationsPO.setRegulationsId(sceneId);
|
|
standardsRegulationsPO.setModifyTime(TimeUtil.getNowForMysql());
|
|
standardsRegulationsPO.setModifyTime(TimeUtil.getNowForMysql());
|
|
@@ -106,14 +108,14 @@ public class StandardsRegulationsService {
|
|
|
|
|
|
//查看列表
|
|
//查看列表
|
|
public List<StandardsRegulationsPO> queryStandardsRegulationsList(StandardsRegulationsParam params) {
|
|
public List<StandardsRegulationsPO> queryStandardsRegulationsList(StandardsRegulationsParam params) {
|
|
- if(ObjectUtil.isNotNull(params.getSceneName()) || (params.getRegulationType()!=null&¶ms.getRegulationType().size()>0)||ObjectUtil.isNotNull(params.getStandardType())||ObjectUtil.isNotNull(params.getStandardType())
|
|
|
|
- ||(params.getIds()!=null&¶ms.getIds().length>0)){
|
|
|
|
|
|
+ if (ObjectUtil.isNotNull(params.getSceneName()) || (params.getRegulationType() != null && params.getRegulationType().size() > 0) || ObjectUtil.isNotNull(params.getStandardType()) || ObjectUtil.isNotNull(params.getStandardType())
|
|
|
|
+ || (params.getIds() != null && params.getIds().length > 0)) {
|
|
params.setXlk("1");
|
|
params.setXlk("1");
|
|
}
|
|
}
|
|
- if(params.getLabel()!=null&¶ms.getLabel().size()>0){
|
|
|
|
|
|
+ if (params.getLabel() != null && params.getLabel().size() > 0) {
|
|
params.setBq("1");
|
|
params.setBq("1");
|
|
}
|
|
}
|
|
- List<StandardsRegulationsPO> list =new ArrayList<>();
|
|
|
|
|
|
+ List<StandardsRegulationsPO> list = new ArrayList<>();
|
|
/*if((params.getXlk().equals("1")&¶ms.getBq().equals("1"))||(params.getXlk().equals("0")&¶ms.getBq().equals("0"))||(params.getXlk().equals("1")&¶ms.getBq().equals("0"))){
|
|
/*if((params.getXlk().equals("1")&¶ms.getBq().equals("1"))||(params.getXlk().equals("0")&¶ms.getBq().equals("0"))||(params.getXlk().equals("1")&¶ms.getBq().equals("0"))){
|
|
list = standardsRegulationsMapper.queryStandardsRegulationsList(params);
|
|
list = standardsRegulationsMapper.queryStandardsRegulationsList(params);
|
|
}*//*else if(params.getXlk().equals("1")&¶ms.getBq().equals("0")){
|
|
}*//*else if(params.getXlk().equals("1")&¶ms.getBq().equals("0")){
|
|
@@ -125,30 +127,30 @@ public class StandardsRegulationsService {
|
|
//添加权限
|
|
//添加权限
|
|
String roleCode = AuthUtil.getCurrentUserRoleCode();
|
|
String roleCode = AuthUtil.getCurrentUserRoleCode();
|
|
String userId = AuthUtil.getCurrentUserId();
|
|
String userId = AuthUtil.getCurrentUserId();
|
|
- if(DictConstants.ROLE_CODE_ADMIN.equals(roleCode) || DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode)){ //管理员账户
|
|
|
|
- if((params.getXlk().equals("1")&¶ms.getBq().equals("1"))||(params.getXlk().equals("0")&¶ms.getBq().equals("0"))||(params.getXlk().equals("1")&¶ms.getBq().equals("0"))){
|
|
|
|
- list = standardsRegulationsMapper.queryStandardsRegulationsList(params);
|
|
|
|
- }else if(params.getXlk().equals("0")&¶ms.getBq().equals("1")){
|
|
|
|
- list = standardsRegulationsMapper.queryStandardsRegulationsListByBq(params);
|
|
|
|
|
|
+ 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 = standardsRegulationsMapper.queryStandardsRegulationsList(params);
|
|
|
|
+ } else if (params.getXlk().equals("0") && params.getBq().equals("1")) {
|
|
|
|
+ list = standardsRegulationsMapper.queryStandardsRegulationsListByBq(params);
|
|
}
|
|
}
|
|
|
|
|
|
- }else if(DictConstants.ROLE_CODE_SUBUESR.equals(roleCode)){
|
|
|
|
|
|
+ } else if (DictConstants.ROLE_CODE_SUBUESR.equals(roleCode)) {
|
|
//查询父账户
|
|
//查询父账户
|
|
userId = AuthUtil.getCreateUserId();
|
|
userId = AuthUtil.getCreateUserId();
|
|
params.setUserId(userId);
|
|
params.setUserId(userId);
|
|
- if((params.getXlk().equals("1")&¶ms.getBq().equals("1"))||(params.getXlk().equals("0")&¶ms.getBq().equals("0"))||(params.getXlk().equals("1")&¶ms.getBq().equals("0"))){
|
|
|
|
- list = standardsRegulationsMapper.queryStandardsRegulationsListByQx(params);
|
|
|
|
- }else if(params.getXlk().equals("0")&¶ms.getBq().equals("1")){
|
|
|
|
- list = standardsRegulationsMapper.queryStandardsRegulationsListByBqAndQx(params);
|
|
|
|
|
|
+ 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 = standardsRegulationsMapper.queryStandardsRegulationsListByQx(params);
|
|
|
|
+ } else if (params.getXlk().equals("0") && params.getBq().equals("1")) {
|
|
|
|
+ list = standardsRegulationsMapper.queryStandardsRegulationsListByBqAndQx(params);
|
|
}
|
|
}
|
|
|
|
|
|
- }else if(DictConstants.ROLE_CODE_UESR.equals(roleCode)){
|
|
|
|
|
|
+ } else if (DictConstants.ROLE_CODE_UESR.equals(roleCode)) {
|
|
//查询普通账户
|
|
//查询普通账户
|
|
params.setUserId(userId);
|
|
params.setUserId(userId);
|
|
- if((params.getXlk().equals("1")&¶ms.getBq().equals("1"))||(params.getXlk().equals("0")&¶ms.getBq().equals("0"))||(params.getXlk().equals("1")&¶ms.getBq().equals("0"))){
|
|
|
|
- list = standardsRegulationsMapper.queryStandardsRegulationsListByQx(params);
|
|
|
|
- }else if(params.getXlk().equals("0")&¶ms.getBq().equals("1")){
|
|
|
|
- list = standardsRegulationsMapper.queryStandardsRegulationsListByBqAndQx(params);
|
|
|
|
|
|
+ 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 = standardsRegulationsMapper.queryStandardsRegulationsListByQx(params);
|
|
|
|
+ } else if (params.getXlk().equals("0") && params.getBq().equals("1")) {
|
|
|
|
+ list = standardsRegulationsMapper.queryStandardsRegulationsListByBqAndQx(params);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/* if(params.getLabel()!=null&¶ms.getLabel().size()>0){
|
|
/* if(params.getLabel()!=null&¶ms.getLabel().size()>0){
|
|
@@ -181,20 +183,20 @@ public class StandardsRegulationsService {
|
|
params.setModifyUserId(AuthUtil.getCurrentUserId());
|
|
params.setModifyUserId(AuthUtil.getCurrentUserId());
|
|
standardsRegulationsMapper.deleteStandardsRegulations(params);
|
|
standardsRegulationsMapper.deleteStandardsRegulations(params);
|
|
|
|
|
|
- Map map=new HashMap();
|
|
|
|
- map.put("sceneId",params.getRegulationsId());
|
|
|
|
- map.put("sceneName",params.getSceneName());
|
|
|
|
- map.put("type",DictConstants.SCENE_STANDARD);
|
|
|
|
|
|
+ Map map = new HashMap();
|
|
|
|
+ map.put("sceneId", params.getRegulationsId());
|
|
|
|
+ map.put("sceneName", params.getSceneName());
|
|
|
|
+ map.put("type", DictConstants.SCENE_STANDARD);
|
|
logService.logSceneDelete(LogConstants.SYS_LOG_SCENE_DELETE, map);
|
|
logService.logSceneDelete(LogConstants.SYS_LOG_SCENE_DELETE, map);
|
|
- // systemUserSceneService.deleteSystemUserSceneBySceneId(params.getRegulationsId());
|
|
|
|
|
|
+ // systemUserSceneService.deleteSystemUserSceneBySceneId(params.getRegulationsId());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取交通事故场景数据:
|
|
* 获取交通事故场景数据:
|
|
*/
|
|
*/
|
|
- public SceneImportPO importMiNio(SceneImportParam parms) {
|
|
|
|
- SceneImportPO sceneImportPO=new SceneImportPO();
|
|
|
|
|
|
+ public SceneImportPO importMinio(SceneImportParam parms) {
|
|
|
|
+ SceneImportPO sceneImportPO = new SceneImportPO();
|
|
sceneImportPO.setId(parms.getId());
|
|
sceneImportPO.setId(parms.getId());
|
|
try {
|
|
try {
|
|
MinioParameter MI = new MinioParameter();
|
|
MinioParameter MI = new MinioParameter();
|
|
@@ -206,14 +208,14 @@ public class StandardsRegulationsService {
|
|
int falseNum = 0;
|
|
int falseNum = 0;
|
|
String errorMessage = "";
|
|
String errorMessage = "";
|
|
for (String filePath : list) {
|
|
for (String filePath : list) {
|
|
- if (filePath.indexOf("/OSGB") != -1) {
|
|
|
|
|
|
+ if (filePath.contains("/OSGB")) {
|
|
OsgbPath = filePath;
|
|
OsgbPath = filePath;
|
|
- } else if (filePath.indexOf("/XODR") != -1) {
|
|
|
|
|
|
+ } else if (filePath.contains("/XODR")) {
|
|
XodrPath = filePath;
|
|
XodrPath = filePath;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
for (String filePath : list) {
|
|
for (String filePath : list) {
|
|
- if (filePath.indexOf("/Scenarios") != -1) {
|
|
|
|
|
|
+ if (filePath.contains("/Scenarios")) {
|
|
MI.setObjectName(filePath);
|
|
MI.setObjectName(filePath);
|
|
List<String> listScene = fileDownService.listDeepOne(MI).getInfo();
|
|
List<String> listScene = fileDownService.listDeepOne(MI).getInfo();
|
|
for (String scenePath : listScene) {
|
|
for (String scenePath : listScene) {
|
|
@@ -223,7 +225,7 @@ public class StandardsRegulationsService {
|
|
StandardsRegulationsPO standardsRegulationsPO = new StandardsRegulationsPO();
|
|
StandardsRegulationsPO standardsRegulationsPO = new StandardsRegulationsPO();
|
|
String isupdate = null;
|
|
String isupdate = null;
|
|
for (String adress : listAderss) {
|
|
for (String adress : listAderss) {
|
|
- if (adress.indexOf(".json") != -1) {
|
|
|
|
|
|
+ if (adress.contains(".json")) {
|
|
MI.setObjectName(adress);
|
|
MI.setObjectName(adress);
|
|
Response download = fileDownService.download(MI);
|
|
Response download = fileDownService.download(MI);
|
|
// -------------------------------- label.json --------------------------------
|
|
// -------------------------------- label.json --------------------------------
|
|
@@ -232,11 +234,11 @@ public class StandardsRegulationsService {
|
|
JsonNode root = objMap.readTree(json);
|
|
JsonNode root = objMap.readTree(json);
|
|
//判断场景名称唯一
|
|
//判断场景名称唯一
|
|
String sceneName = root.path("场景名称").asText();
|
|
String sceneName = root.path("场景名称").asText();
|
|
- String regulationType=root.path("法规类型").asText();
|
|
|
|
- String standardType=root.path("标准类型").asText();
|
|
|
|
- if(ObjectUtil.isNull(regulationType)&&ObjectUtil.isNull(standardType)){
|
|
|
|
|
|
+ String regulationType = root.path("法规类型").asText();
|
|
|
|
+ String standardType = root.path("标准类型").asText();
|
|
|
|
+ if (ObjectUtil.isNull(regulationType) && ObjectUtil.isNull(standardType)) {
|
|
sceneImportPO.setStatus(DictConstants.SCENE_IMPORT_STATUS_2);
|
|
sceneImportPO.setStatus(DictConstants.SCENE_IMPORT_STATUS_2);
|
|
- sceneImportPO.setErrorMessage("该文件:"+adress+"与标准法规场景类型不匹配,解析失败,请检查");
|
|
|
|
|
|
+ sceneImportPO.setErrorMessage("文件" + adress + " 与标准法规场景类型不匹配,解析失败。");
|
|
return sceneImportPO;
|
|
return sceneImportPO;
|
|
}
|
|
}
|
|
String sceneId = standardsRegulationsMapper.queryStandardsRegulationsByName(sceneName);
|
|
String sceneId = standardsRegulationsMapper.queryStandardsRegulationsByName(sceneName);
|
|
@@ -249,10 +251,10 @@ public class StandardsRegulationsService {
|
|
standardsRegulationsPO.setMaxTime(root.path("max_time").asText());
|
|
standardsRegulationsPO.setMaxTime(root.path("max_time").asText());
|
|
standardsRegulationsPO.setIsDeleted("0");
|
|
standardsRegulationsPO.setIsDeleted("0");
|
|
|
|
|
|
- if(ObjectUtil.isNull(standardsRegulationsPO.getOsgbAddress())){
|
|
|
|
|
|
+ if (ObjectUtil.isNull(standardsRegulationsPO.getOsgbAddress())) {
|
|
standardsRegulationsPO.setOsgbAddress(osgbAdress);
|
|
standardsRegulationsPO.setOsgbAddress(osgbAdress);
|
|
}
|
|
}
|
|
- if(ObjectUtil.isNull(standardsRegulationsPO.getXodrAddress())){
|
|
|
|
|
|
+ if (ObjectUtil.isNull(standardsRegulationsPO.getXodrAddress())) {
|
|
standardsRegulationsPO.setXodrAddress(xodrAdress);
|
|
standardsRegulationsPO.setXodrAddress(xodrAdress);
|
|
}
|
|
}
|
|
if (ObjectUtil.isNull(sceneId)) {
|
|
if (ObjectUtil.isNull(sceneId)) {
|
|
@@ -262,15 +264,15 @@ public class StandardsRegulationsService {
|
|
standardsRegulationsPO.setRegulationsId(sceneId);
|
|
standardsRegulationsPO.setRegulationsId(sceneId);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (adress.indexOf(".json") != -1) {
|
|
|
|
|
|
+ if (adress.contains(".json")) {
|
|
standardsRegulationsPO.setJsonAddress(adress);
|
|
standardsRegulationsPO.setJsonAddress(adress);
|
|
- } else if (adress.indexOf(".xml") != -1 || adress.indexOf(".xosc") != -1) {
|
|
|
|
|
|
+ } else if (adress.contains(".xml") || adress.contains(".xosc")) {
|
|
standardsRegulationsPO.setXmlAddress(adress);
|
|
standardsRegulationsPO.setXmlAddress(adress);
|
|
- } else if (adress.indexOf(".xodr") != -1) {
|
|
|
|
|
|
+ } else if (adress.contains(".xodr")) {
|
|
standardsRegulationsPO.setXodrAddress(adress);
|
|
standardsRegulationsPO.setXodrAddress(adress);
|
|
- } else if (adress.indexOf(".osgb") != -1) {
|
|
|
|
|
|
+ } else if (adress.contains(".osgb")) {
|
|
standardsRegulationsPO.setOsgbAddress(adress);
|
|
standardsRegulationsPO.setOsgbAddress(adress);
|
|
- } else if (adress.indexOf(".mp4") != -1) {
|
|
|
|
|
|
+ } else if (adress.contains(".mp4")) {
|
|
standardsRegulationsPO.setVideoAddress(adress);
|
|
standardsRegulationsPO.setVideoAddress(adress);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -303,9 +305,9 @@ public class StandardsRegulationsService {
|
|
sceneImportPO.setFalseNum(falseNum);
|
|
sceneImportPO.setFalseNum(falseNum);
|
|
sceneImportPO.setErrorMessage(errorMessage);
|
|
sceneImportPO.setErrorMessage(errorMessage);
|
|
return sceneImportPO;
|
|
return sceneImportPO;
|
|
- }catch (Exception e){
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
sceneImportPO.setStatus(DictConstants.SCENE_IMPORT_STATUS_2);
|
|
sceneImportPO.setStatus(DictConstants.SCENE_IMPORT_STATUS_2);
|
|
- sceneImportPO.setErrorMessage("该文件地址:"+parms.getMinioDirectory()+"解析失败,请检查");
|
|
|
|
|
|
+ sceneImportPO.setErrorMessage("该文件地址:" + parms.getMinioDirectory() + "解析失败,请检查");
|
|
return sceneImportPO;
|
|
return sceneImportPO;
|
|
}
|
|
}
|
|
}
|
|
}
|