李春阳 1 năm trước cách đây
mục cha
commit
b7ec0577ca

+ 5 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/server/adapter/controller/job_manage/JobManageController.java

@@ -251,6 +251,11 @@ public class JobManageController {
     simulationProjectService.exportProjectReportAndTaskFileById(param);
   }
 
+  @RequestMapping("exportProjectEvaluationReportAndTaskFileById")
+  public void exportProjectEvaluationReportAndTaskFileById(@RequestBody SimulationManualProjectParam param) {
+    simulationProjectService.exportProjectEvaluationReportAndTaskFileById(param);
+  }
+
   /**
    * 添加编辑自动项目
    */

+ 63 - 55
simulation-resource-server/src/main/java/com/css/simulation/resource/server/app/impl/SimulationProjectServiceImpl.java

@@ -37,6 +37,7 @@ import com.css.simulation.resource.server.app.service.job_manage.SimulationProje
 import com.css.simulation.resource.server.app.service.DictService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.google.common.base.Joiner;
 import com.google.common.collect.ImmutableMap;
 import com.itextpdf.text.*;
 import com.itextpdf.text.pdf.BaseFont;
@@ -5188,7 +5189,6 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         SimulationManualProjectParam sp = new SimulationManualProjectParam();
         sp.setId(id);
         SimulationManualProjectPO spo = simulationManualProjectMapper.selectProjectBaseById(sp);
-        String rootPath = spo.getProjectName();
 
         int len;
         byte[] buffer = new byte[1024];
@@ -5256,7 +5256,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
 
 
             if (CollectionUtil.isNotEmpty(naturalData)) {
-                String tempPath = rootPath + File.separator + "自然驾驶场景.csv";
+                String tempPath = "自然驾驶场景.csv";
                 FileWriter naturalWriter = new FileWriter(tempPath);
                 // 写入 CSV 头部信息
                 naturalWriter.write("场景名称,自车行为,目标行为,交通情况,道路,基础设施,自然环境,临时性操纵,标签,复杂度,复杂度等级,危险度,危险度等级,算法得分\n");
@@ -5265,21 +5265,21 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
                     String[] tempNatural = new String[14];
                     SceneComplexityPO sceneComplexityPO = firstComplexityPOMap.get(sceneNaturalPO.getNaturalId());
                     SceneRiskPO sceneRiskPO = firstRiskPOMap.get(sceneNaturalPO.getNaturalId());
-                    tempNatural[0] = sceneNaturalPO.getNaturalName();
-                    tempNatural[1] = sceneNaturalPO.getSelfBehavior();
-                    tempNatural[2] = sceneNaturalPO.getTargetBehavior();
-                    tempNatural[3] = sceneNaturalPO.getPatency();
-                    tempNatural[4] = sceneNaturalPO.getRoadType();
-                    tempNatural[5] = sceneNaturalPO.getRoadSafetySigns();
-                    tempNatural[6] = sceneNaturalPO.getNaturalDisaster();
+                    tempNatural[0] = sceneNaturalPO.getNaturalName() == null ? "" : handleDelimiter(sceneNaturalPO.getNaturalName());
+                    tempNatural[1] = sceneNaturalPO.getSelfBehavior() == null ? "" : handleDelimiter(sceneNaturalPO.getSelfBehavior());
+                    tempNatural[2] = sceneNaturalPO.getTargetBehavior() == null ? "" : handleDelimiter(sceneNaturalPO.getTargetBehavior());
+                    tempNatural[3] = sceneNaturalPO.getPatency() == null ? "" : handleDelimiter(sceneNaturalPO.getPatency());
+                    tempNatural[4] = sceneNaturalPO.getRoadType() == null ? "" : handleDelimiter(sceneNaturalPO.getRoadType());
+                    tempNatural[5] = sceneNaturalPO.getRoadSafetySigns() == null ? "" : handleDelimiter(sceneNaturalPO.getRoadSafetySigns());
+                    tempNatural[6] = sceneNaturalPO.getNaturalDisaster() == null ? "" : handleDelimiter(sceneNaturalPO.getNaturalDisaster());
                     tempNatural[7] = "临时性操纵";
-                    tempNatural[8] = sceneNaturalPO.getLabel();
-                    tempNatural[9] = sceneComplexityPO == null ? null : sceneComplexityPO.getComplexity();
-                    tempNatural[10] = sceneComplexityPO == null ? null : sceneComplexityPO.getComplexityLevel();
-                    tempNatural[11] = sceneRiskPO == null ? null : sceneRiskPO.getRisk();
-                    tempNatural[12] = sceneRiskPO == null ? null : sceneRiskPO.getRiskLevel();
+                    tempNatural[8] = sceneNaturalPO.getLabel() == null ? "" : handleDelimiter(sceneNaturalPO.getLabel());
+                    tempNatural[9] = sceneComplexityPO == null ? "" : sceneComplexityPO.getComplexity();
+                    tempNatural[10] = sceneComplexityPO == null ? "" : sceneComplexityPO.getComplexityLevel();
+                    tempNatural[11] = sceneRiskPO == null ? "" : sceneRiskPO.getRisk();
+                    tempNatural[12] = sceneRiskPO == null ? "" : sceneRiskPO.getRiskLevel();
                     tempNatural[13] = String.valueOf(scoreMap.get(sceneNaturalPO.getNaturalId()));
-                    naturalWriter.write(Arrays.toString(tempNatural));
+                    naturalWriter.write(Joiner.on(",").join(tempNatural) + "\n");
                 }
                 naturalWriter.close();
                 ZipEntry naturalEntry = new ZipEntry(tempPath);
@@ -5292,7 +5292,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             }
 
             if (CollectionUtil.isNotEmpty(regulationData)) {
-                String tempPath = rootPath + File.separator + "标准法规场景.csv";
+                String tempPath = "标准法规场景.csv";
                 FileWriter regulationWriter = new FileWriter(tempPath);
                 // 写入 CSV 头部信息
                 regulationWriter.write("场景名称,法规类型,标准类型,标签,复杂度,复杂度等级,危险度,危险度等级,算法得分\n");
@@ -5300,16 +5300,16 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
                     String[] tempStr = new String[9];
                     SceneComplexityPO sceneComplexityPO = firstComplexityPOMap.get(tempPo.getRegulationsId());
                     SceneRiskPO sceneRiskPO = firstRiskPOMap.get(tempPo.getRegulationsId());
-                    tempStr[0] = tempPo.getSceneName();
-                    tempStr[1] = tempPo.getRegulationType();
-                    tempStr[2] = tempPo.getStandardType();
-                    tempStr[3] = tempPo.getLabel();
-                    tempStr[4] = sceneComplexityPO == null ? null : sceneComplexityPO.getComplexity();
-                    tempStr[5] = sceneComplexityPO == null ? null : sceneComplexityPO.getComplexityLevel();
-                    tempStr[6] = sceneRiskPO == null ? null : sceneRiskPO.getRisk();
-                    tempStr[7] = sceneRiskPO == null ? null : sceneRiskPO.getRiskLevel();
+                    tempStr[0] = tempPo.getSceneName() == null ? "" : handleDelimiter(tempPo.getSceneName());
+                    tempStr[1] = tempPo.getRegulationType() == null ? "" : handleDelimiter(tempPo.getRegulationType());
+                    tempStr[2] = tempPo.getStandardType() == null ? "" : handleDelimiter(tempPo.getStandardType());
+                    tempStr[3] = tempPo.getLabel() == null ? "" : handleDelimiter(tempPo.getLabel());
+                    tempStr[4] = sceneComplexityPO == null ? "" : sceneComplexityPO.getComplexity();
+                    tempStr[5] = sceneComplexityPO == null ? "" : sceneComplexityPO.getComplexityLevel();
+                    tempStr[6] = sceneRiskPO == null ? "" : sceneRiskPO.getRisk();
+                    tempStr[7] = sceneRiskPO == null ? "" : sceneRiskPO.getRiskLevel();
                     tempStr[8] = String.valueOf(scoreMap.get(tempPo.getRegulationsId()));
-                    regulationWriter.write(Arrays.toString(tempStr));
+                    regulationWriter.write(Joiner.on(",").join(tempStr) + "\n");
                 }
                 regulationWriter.close();
                 ZipEntry entry = new ZipEntry(tempPath);
@@ -5322,7 +5322,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             }
 
             if (CollectionUtil.isNotEmpty(accidentData)) {
-                String tempPath = rootPath + File.separator + "交通事故场景.csv";
+                String tempPath = "交通事故场景.csv";
                 FileWriter accidentWriter = new FileWriter(tempPath);
                 // 写入 CSV 头部信息
                 accidentWriter.write("场景名称,自车驾驶行为,目标驾驶行为,自车反应行为,冲突行为,冲突类型,标签,复杂度,复杂度等级,危险度,危险度等级,算法得分\n");
@@ -5331,19 +5331,19 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
                     String[] tempStr = new String[12];
                     SceneComplexityPO sceneComplexityPO = firstComplexityPOMap.get(tempPo.getAccidentId());
                     SceneRiskPO sceneRiskPO = firstRiskPOMap.get(tempPo.getAccidentId());
-                    tempStr[0] = tempPo.getSceneName();
-                    tempStr[1] = tempPo.getSelfDriving();
-                    tempStr[2] = tempPo.getTargetDriving();
-                    tempStr[3] = tempPo.getSelfReaction();
-                    tempStr[4] = tempPo.getConflictBehavior();
-                    tempStr[5] = tempPo.getConflictType();
-                    tempStr[6] = tempPo.getLabel();
-                    tempStr[7] = sceneComplexityPO == null ? null : sceneComplexityPO.getComplexity();
-                    tempStr[8] = sceneComplexityPO == null ? null : sceneComplexityPO.getComplexityLevel();
-                    tempStr[9] = sceneRiskPO == null ? null : sceneRiskPO.getRisk();
-                    tempStr[10] = sceneRiskPO == null ? null : sceneRiskPO.getRiskLevel();
+                    tempStr[0] = tempPo.getSceneName() == null ? "" : handleDelimiter(tempPo.getSceneName());
+                    tempStr[1] = tempPo.getSelfDriving() == null ? "" : handleDelimiter(tempPo.getSelfDriving());
+                    tempStr[2] = tempPo.getTargetDriving() == null ? "" : handleDelimiter(tempPo.getTargetDriving());
+                    tempStr[3] = tempPo.getSelfReaction() == null ? "" : handleDelimiter(tempPo.getSelfReaction());
+                    tempStr[4] = tempPo.getConflictBehavior() == null ? "" : handleDelimiter(tempPo.getConflictBehavior());
+                    tempStr[5] = tempPo.getConflictType() == null ? "" : handleDelimiter(tempPo.getConflictType());
+                    tempStr[6] = tempPo.getLabel() == null ? "" : handleDelimiter(tempPo.getLabel());
+                    tempStr[7] = sceneComplexityPO == null ? "" : sceneComplexityPO.getComplexity();
+                    tempStr[8] = sceneComplexityPO == null ? "" : sceneComplexityPO.getComplexityLevel();
+                    tempStr[9] = sceneRiskPO == null ? "" : sceneRiskPO.getRisk();
+                    tempStr[10] = sceneRiskPO == null ? "" : sceneRiskPO.getRiskLevel();
                     tempStr[11] = String.valueOf(scoreMap.get(tempPo.getAccidentId()));
-                    accidentWriter.write(Arrays.toString(tempStr));
+                    accidentWriter.write(Joiner.on(",").join(tempStr) + "\n");
                 }
                 accidentWriter.close();
                 ZipEntry entry = new ZipEntry(tempPath);
@@ -5357,7 +5357,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
 
 
             if (CollectionUtil.isNotEmpty(referenceLibData)) {
-                String tempPath = rootPath + File.separator + "基准场景库.csv";
+                String tempPath = "基准场景库.csv";
                 FileWriter referenceLibWriter = new FileWriter(tempPath);
                 referenceLibWriter.write("场景名称,主车动作,他车动作,天气,道路类型,道路几何-平面,道路几何-纵断面,支持智驾功能,运行区域,场景描述,标签,复杂度,复杂度等级,危险度,危险度等级,算法得分\n");
                 for (SceneReferenceLibPO tempPo : referenceLibData) {
@@ -5365,23 +5365,23 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
                     String[] tempStr = new String[16];
                     SceneComplexityPO sceneComplexityPO = firstComplexityPOMap.get(tempPo.getSceneId());
                     SceneRiskPO sceneRiskPO = firstRiskPOMap.get(tempPo.getSceneId());
-                    tempStr[0] = tempPo.getSceneName();
-                    tempStr[1] = tempPo.getMainBehavior();
-                    tempStr[2] = tempPo.getOtherBehavior();
-                    tempStr[3] = tempPo.getWeather();
-                    tempStr[4] = tempPo.getRoadType();
-                    tempStr[5] = tempPo.getRoadGeometryPlane();
-                    tempStr[6] = tempPo.getRoadGeometryVertical();
-                    tempStr[7] = tempPo.getAutoDriveFunction();
-                    tempStr[8] = tempPo.getOperationArea();
-                    tempStr[9] = tempPo.getSceneDescription();
-                    tempStr[10] = tempPo.getLabel();
-                    tempStr[11] = sceneComplexityPO == null ? null : sceneComplexityPO.getComplexity();
-                    tempStr[12] = sceneComplexityPO == null ? null : sceneComplexityPO.getComplexityLevel();
-                    tempStr[13] = sceneRiskPO == null ? null : sceneRiskPO.getRisk();
-                    tempStr[14] = sceneRiskPO == null ? null : sceneRiskPO.getRiskLevel();
+                    tempStr[0] = tempPo.getSceneName() == null ? "" : handleDelimiter(tempPo.getSceneName());
+                    tempStr[1] = tempPo.getMainBehavior() == null ? "" : handleDelimiter(tempPo.getMainBehavior());
+                    tempStr[2] = tempPo.getOtherBehavior() == null ? "" : handleDelimiter(tempPo.getOtherBehavior());
+                    tempStr[3] = tempPo.getWeather() == null ? "" : handleDelimiter(tempPo.getWeather());
+                    tempStr[4] = tempPo.getRoadType() == null ? "" : handleDelimiter(tempPo.getRoadType());
+                    tempStr[5] = tempPo.getRoadGeometryPlane() == null ? "" : handleDelimiter(tempPo.getRoadGeometryPlane());
+                    tempStr[6] = tempPo.getRoadGeometryVertical() == null ? "" : handleDelimiter(tempPo.getRoadGeometryVertical());
+                    tempStr[7] = tempPo.getAutoDriveFunction() == null ? "" : handleDelimiter(tempPo.getAutoDriveFunction());
+                    tempStr[8] = tempPo.getOperationArea() == null ? "" : handleDelimiter(tempPo.getOperationArea());
+                    tempStr[9] = tempPo.getSceneDescription() == null ? "" : handleDelimiter(tempPo.getSceneDescription());
+                    tempStr[10] = tempPo.getLabel() == null ? "" : handleDelimiter(tempPo.getLabel());
+                    tempStr[11] = sceneComplexityPO == null ? "" : sceneComplexityPO.getComplexity();
+                    tempStr[12] = sceneComplexityPO == null ? "" : sceneComplexityPO.getComplexityLevel();
+                    tempStr[13] = sceneRiskPO == null ? "" : sceneRiskPO.getRisk();
+                    tempStr[14] = sceneRiskPO == null ? "" : sceneRiskPO.getRiskLevel();
                     tempStr[15] = String.valueOf(scoreMap.get(tempPo.getSceneId()));
-                    referenceLibWriter.write(Arrays.toString(tempStr));
+                    referenceLibWriter.write(Joiner.on(",").join(tempStr) + "\n");
                 }
                 referenceLibWriter.close();
                 ZipEntry entry = new ZipEntry(tempPath);
@@ -5398,6 +5398,14 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         }
     }
 
+    private String handleDelimiter(String temp) {
+        String delimiter = ",";
+        if (temp.contains(delimiter)) {
+            return "\"" + temp + "\"";
+        }
+        return temp;
+    }
+
     private void getAccidentLabel(SceneAccidentPO po) {
         if (po.getConflictBehavior().contains("追尾")) {
             po.setLabel("追尾");