LingxinMeng 1 năm trước cách đây
mục cha
commit
8a3ca6194f

+ 34 - 20
simulation-resource-server/src/main/java/com/css/simulation/resource/server/app/impl/SimulationProjectServiceImpl.java

@@ -974,7 +974,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         projectReportVO.setSubListScoreLi((List<SubScListVo>) stringObjectMap.get("result"));
 
         // 场景得分列表
-        Map<String, Object> maps = selectSceneScore2(projectPO.getScene(), projectPO.getId(), null, projectReportVO);
+        Map<String, Object> maps = selectSceneScore2(projectPO.getScene(), projectPO.getId(), projectReportVO);
         projectReportVO.setSceneScoreLiTitle((List<Map>) maps.get("headerList"));
         projectReportVO.setSceneScoreLi((List<SceneScListVo>) maps.get("result"));
 
@@ -2050,7 +2050,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         return hashMap;
     }
 
-    private Map<String, Object> selectSceneScore2(String scenePackageId, String projectId, String taskId, ProjectReportVO projectReportVO) {
+    private Map<String, Object> selectSceneScore2(String scenePackageId, String projectId, ProjectReportVO projectReportVO) {
 
         // 1 查询指定项目的所有指标得分结果
         SimulationManualProjectParam query = new SimulationManualProjectParam();
@@ -2060,9 +2060,6 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         // 2 查询指定项目的所有任务得分结果
         ProjectTaskParam param = new ProjectTaskParam();
         param.setPId(projectId);
-        if (!isEmpty(taskId)) {
-            param.setTaskId(taskId);
-        }
         List<ManualProjectTaskVo> taskList = simulationManualProjectTaskMapper.selectProjectTaskByProjectId(param); // 手动运行项目和自动运行项目使用同一个任务表
 
         // 2 拼接场景得分信息
@@ -2105,6 +2102,8 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             }
         }
         int size = 0;
+        int attributeNum = 7;
+        // 所有末级指标的列表
         List<List<String>> result = new ArrayList<>();
         // 新增返回状态
         ArrayList<String> runStateList = new ArrayList<>();
@@ -2130,12 +2129,24 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
              */
             // 测试得分,指标评价,得分说明 --处理
             if (isEmpty(targetEvaluate) || isEmpty(sp.getScoreExplain())) {
-                sublistName += ProjectConstants.SEPARATOR + sp.getReturnSceneId() + ProjectConstants.SEPARATOR + sp.getSceneType() + ProjectConstants.SEPARATOR + "--" + ProjectConstants.SEPARATOR + "--" + ProjectConstants.SEPARATOR + "--" + ProjectConstants.SEPARATOR + "--" + ProjectConstants.SEPARATOR + "--";
+                sublistName += ProjectConstants.SEPARATOR + sp.getReturnSceneId()
+                        + ProjectConstants.SEPARATOR + sp.getSceneType()
+                        + ProjectConstants.SEPARATOR + "--"
+                        + ProjectConstants.SEPARATOR + "--"
+                        + ProjectConstants.SEPARATOR + "--"
+                        + ProjectConstants.SEPARATOR + "--"
+                        + ProjectConstants.SEPARATOR + "--";
             } else {
-                sublistName += ProjectConstants.SEPARATOR + sp.getReturnSceneId() + ProjectConstants.SEPARATOR + sp.getSceneType() + ProjectConstants.SEPARATOR + sceneScore + ProjectConstants.SEPARATOR + targetEvaluate + ProjectConstants.SEPARATOR + sp.getScoreExplain() + ProjectConstants.SEPARATOR + sp.getTimeActual() + ProjectConstants.SEPARATOR + sp.getTimeCorrection();
-            }
-            String[] split = sublistName.split(ProjectConstants.SEPARATOR);
-            List<String> strings = new LinkedList<>(Arrays.asList(split));
+                sublistName += ProjectConstants.SEPARATOR + sp.getReturnSceneId()
+                        + ProjectConstants.SEPARATOR + sp.getSceneType()
+                        + ProjectConstants.SEPARATOR + sceneScore
+                        + ProjectConstants.SEPARATOR + targetEvaluate
+                        + ProjectConstants.SEPARATOR + sp.getScoreExplain()
+                        + ProjectConstants.SEPARATOR + sp.getTimeActual()
+                        + ProjectConstants.SEPARATOR + sp.getTimeCorrection();
+            }
+            // 将字符穿序列分割
+            List<String> strings = CollectionUtil.createArrayList(sublistName.split(ProjectConstants.SEPARATOR));
             if (size < strings.size()) {
                 size = strings.size();
             }
@@ -2145,10 +2156,13 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         List<SceneScListVo> objects = new ArrayList<>();
         // 结果补全
         int r = 0;
+        log.info("结果为:" + result);
         for (List<String> list : result) {
-            int start = list.size() - 7; // 这里需要根据字段数修改
+            int sublistStartIndex = 0; // 指标字段开始
+            int sublistStopIndex = list.size() - 1 - attributeNum + 1;    // 指标字段末尾
             SceneScListVo sceneScListVo = new SceneScListVo();
-            for (int i = 0; i < start; i++) {
+            // 填充指标
+            for (int i = sublistStartIndex; i < sublistStopIndex; i++) {
                 if (0 == i) {
                     String s0 = list.get(i);
                     if (StringUtil.isNotEmpty(s0)) {
@@ -2188,19 +2202,19 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
                     sceneScListVo.setSublistName6(list.get(i));
                 }
             }
-            sceneScListVo.setSceneId(list.get(start));
-            sceneScListVo.setSceneIdType(list.get(start + 1));
-            sceneScListVo.setSceneScore(list.get(start + 2));
-            sceneScListVo.setTargetEvaluate(list.get(start + 3));
-            sceneScListVo.setScoreExplain(list.get(start + 4));
-            sceneScListVo.setTimeActual(list.get(start + 5));
-            sceneScListVo.setTimeCorrection(list.get(start + 6));
+            sceneScListVo.setSceneId(list.get(sublistStopIndex));
+            sceneScListVo.setSceneIdType(list.get(sublistStopIndex + 1));
+            sceneScListVo.setSceneScore(list.get(sublistStopIndex + 2));
+            sceneScListVo.setTargetEvaluate(list.get(sublistStopIndex + 3));
+            sceneScListVo.setScoreExplain(list.get(sublistStopIndex + 4));
+            sceneScListVo.setTimeActual(list.get(sublistStopIndex + 5));
+            sceneScListVo.setTimeCorrection(list.get(sublistStopIndex + 6));
             sceneScListVo.setRunState(runStateList.get(r));
             objects.add(sceneScListVo);
             r++;
         }
         List<Map<Object, Object>> headerList = new ArrayList<>();
-        int maxIndex = size - 5;    // 这里的5是下面的字段
+        int maxIndex = size - attributeNum;
         projectReportVO.setMaxIndex(maxIndex);
         for (int i = 0; i < maxIndex; i++) {
             addHeaders(i, headerList);