Bladeren bron

修改导出报告pdf

wangyaodong 2 jaren geleden
bovenliggende
commit
3df6c82db3

+ 88 - 18
simulation-resource-server/src/main/java/com/css/simulation/resource/project/impl/SimulationProjectServiceImpl.java

@@ -2808,13 +2808,13 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             document.add(elm3);
             document.add(elm3);
 
 
 
 
-            //下一页
-            document.setPageSize(PageSize.A4);
+            //下一页(横板)
+            document.setPageSize(PageSize.A4.rotate());
             document.newPage();
             document.newPage();
 
 
 //            lineFeed(document, 2, 2);
 //            lineFeed(document, 2, 2);
 
 
-            BaseFont bf3 = BaseFont.createFont("fonts/STSONG.TTF", BaseFont.IDENTITY_H,
+            BaseFont bf3 = BaseFont.createFont("fonts/simsun.ttc,1", BaseFont.IDENTITY_H,
                     BaseFont.NOT_EMBEDDED);
                     BaseFont.NOT_EMBEDDED);
             addElement(document, "算法名称:", vo.getAlgorithmName(), bf3, 15, true, 0, false);
             addElement(document, "算法名称:", vo.getAlgorithmName(), bf3, 15, true, 0, false);
             addElement(document, "算法得分:", vo.getAlgorithmScore().toString(), bf3, 15, true, 30, false);
             addElement(document, "算法得分:", vo.getAlgorithmScore().toString(), bf3, 15, true, 30, false);
@@ -2839,14 +2839,14 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
                             ",依据图1-1的标准,该算法获得" + vo.getEvaluationLevel() + "级评价," + s, null, bf3,
                             ",依据图1-1的标准,该算法获得" + vo.getEvaluationLevel() + "级评价," + s, null, bf3,
                     15, false, 30, false);
                     15, false, 30, false);
 
 
-            Image image = Image.getInstance("classpath:icon/pjdj.png");
+            Image image = Image.getInstance("classpath:icon/pjdj_new.png");
             image.scaleAbsolute(500, 150);
             image.scaleAbsolute(500, 150);
             image.setAlignment(Element.ALIGN_CENTER);
             image.setAlignment(Element.ALIGN_CENTER);
             document.add(image);
             document.add(image);
 
 
             addElement(document, "图1-1 评价标准", null, bf3, 15, false, 30, true);
             addElement(document, "图1-1 评价标准", null, bf3, 15, false, 30, true);
 
 
-            addElement(document, "2. 测试得分说明", null, bf4, 16, false, 70, false);
+            addElement(document, "2. 测试得分说明", null, bf4, 16, false, 40, false);
 
 
             List<AlgorithmScoreVo> algorithmScoreList = vo.getAlgorithmScoreList();
             List<AlgorithmScoreVo> algorithmScoreList = vo.getAlgorithmScoreList();
 
 
@@ -2885,7 +2885,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             }
             }
             document.add(pdfPTable);
             document.add(pdfPTable);
 
 
-            addElement(document, "3. 算法测试评分情况", null, bf4, 16, false, 70, false);
+            addElement(document, "3. 算法测试评分情况", null, bf4, 16, false, 40, false);
             addElement(document, "       为排除其他因素的干扰,科学评价算法效果,本报告将测试场景分为仿真异常场景、未参与评分场景、未达标场景和达标场景4类:", null, bf3, 15, false, 30, false);
             addElement(document, "       为排除其他因素的干扰,科学评价算法效果,本报告将测试场景分为仿真异常场景、未参与评分场景、未达标场景和达标场景4类:", null, bf3, 15, false, 30, false);
             addElement(document, "       1. 仿真异常场景指的是在仿真过程中报aborted错误的场景,参与得分权重,测试结果均赋0分;", null, bf3, 15, false, 30, false);
             addElement(document, "       1. 仿真异常场景指的是在仿真过程中报aborted错误的场景,参与得分权重,测试结果均赋0分;", null, bf3, 15, false, 30, false);
             addElement(document, "       2. 评分失败场景是指因为场景与评分规则不匹配导致程序报错无法对仿真结果进行打分的场景,参与得分权重,测试结果均赋0分;", null, bf3, 15, false, 30, false);
             addElement(document, "       2. 评分失败场景是指因为场景与评分规则不匹配导致程序报错无法对仿真结果进行打分的场景,参与得分权重,测试结果均赋0分;", null, bf3, 15, false, 30, false);
@@ -2997,15 +2997,15 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
 
 
             document.add(pdfPTable2);
             document.add(pdfPTable2);
 
 
-            //新的一页,横向显示
+/*            //新的一页,横向显示
             document.setPageSize(PageSize.A4.rotate());
             document.setPageSize(PageSize.A4.rotate());
-            document.newPage();
+            document.newPage();*/
 //            lineFeed(document, 2, 2);
 //            lineFeed(document, 2, 2);
-
+            List<Map> scoreLiTitle = vo.getSceneScoreLiTitle();
             List<SceneScListVo> sceneScoreLi = vo.getSceneScoreLi();
             List<SceneScListVo> sceneScoreLi = vo.getSceneScoreLi();
-            addElement(document, "4. 详细场景得分说明", null, bf4, 16, false, 0, false);
+            addElement(document, "4. 详细场景得分说明", null, bf4, 16, false, 40, false);
             StringBuffer s1 = new StringBuffer("       " + vo.getAlgorithmName());
             StringBuffer s1 = new StringBuffer("       " + vo.getAlgorithmName());
-            boolean b = true;
+/*            boolean b = true;
             for (int i = 0; i < size1; i++) {
             for (int i = 0; i < size1; i++) {
                 AlgorithmScoreVo v = algorithmScoreList.get(i);
                 AlgorithmScoreVo v = algorithmScoreList.get(i);
                 Double score = v.getScore();
                 Double score = v.getScore();
@@ -3013,11 +3013,81 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
                     b = false;
                     b = false;
                     break;
                     break;
                 }
                 }
-            }
+            }*/
             String substring1 = "";
             String substring1 = "";
-            StringBuffer stringBuffer2 = new StringBuffer("       ");
-            if (b) {
-                //得分都为100
+//            StringBuffer stringBuffer2 = new StringBuffer("       ");
+            //末级指标
+            //先对末级指标进行分组
+            LinkedHashMap<String, List<SceneScListVo>> map1 = new LinkedHashMap<>();
+            for(SceneScListVo sc : sceneScoreLi){
+                String lastZbName = "";
+                //最多支持到6级指标
+                lastZbName = sc.getSublistName1();
+                if(StringUtil.isNotEmpty(sc.getSublistName2())){
+                    lastZbName = sc.getSublistName2();
+                }
+                if(StringUtil.isNotEmpty(sc.getSublistName3())){
+                    lastZbName = sc.getSublistName3();
+                }
+                if(StringUtil.isNotEmpty(sc.getSublistName4())){
+                    lastZbName = sc.getSublistName4();
+                }
+                if(StringUtil.isNotEmpty(sc.getSublistName5())){
+                    lastZbName = sc.getSublistName5();
+                }
+                if(StringUtil.isNotEmpty(sc.getSublistName6())){
+                    lastZbName = sc.getSublistName6();
+                }
+
+                List<SceneScListVo> listVos = map1.get(lastZbName);
+                if(listVos == null){
+                    listVos = new ArrayList<>();
+                    listVos.add(sc);
+                    map1.put(lastZbName, listVos);
+                }else{
+                    listVos.add(sc);
+                }
+            }
+            StringBuffer deFenShuoMing = new StringBuffer("       "+vo.getAlgorithmName());
+            for(String m : map1.keySet()){
+                List<SceneScListVo> sceneScListVos = map1.get(m);
+                int size2 = sceneScListVos.size();
+                int xy100b = 0;
+                for(SceneScListVo sc1 : sceneScListVos){
+                    String sceneScore = sc1.getSceneScore();
+                    BigDecimal score = new BigDecimal("0");
+                    if (sceneScore != null && !"".equals(sceneScore)) {
+                        try {
+                            score = new BigDecimal(sceneScore);
+                        } catch (Exception e) {
+                            score = new BigDecimal("0");
+                        }
+
+                    }
+                    int r = score.compareTo(new BigDecimal("100"));
+                    //小于100
+                    if (r == -1) {
+                        xy100b++;
+                        deFenShuoMing.append("在"+m+"指标中的"+sc1.getSceneId()+"中,测试得分为"+sceneScore+";");
+                    }
+
+                }
+                if(xy100b == 0){
+                    deFenShuoMing.append("在"+m+"指标中的"+sceneScListVos.size()+"个场景均表现优秀,测试得分100分。");
+                }else{
+                    int num = size2-xy100b;
+                    if(num != 0){
+                        deFenShuoMing.append("其他"+num+"个场景表现良好,测试得分100分。");
+                    }else{
+                        deFenShuoMing = new StringBuffer(deFenShuoMing.substring(0, deFenShuoMing.lastIndexOf(";"))+"。");
+                    }
+                }
+            }
+            substring1 = deFenShuoMing.append("详见表4-1。").toString();
+
+
+/*            if (b) {
+                //得分都为100,取末级指标
                 for (int i = 0; i < size1; i++) {
                 for (int i = 0; i < size1; i++) {
                     AlgorithmScoreVo v = algorithmScoreList.get(i);
                     AlgorithmScoreVo v = algorithmScoreList.get(i);
                     if ("汇总".equals(v.getProjectName())) {
                     if ("汇总".equals(v.getProjectName())) {
@@ -3030,7 +3100,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
                 substring1 += "。详见表4-1。";
                 substring1 += "。详见表4-1。";
 
 
             } else {
             } else {
-                //得分有小于100的
+                //得分有小于100的,取末级指标
                 for (int i = 0; i < size1; i++) {
                 for (int i = 0; i < size1; i++) {
                     AlgorithmScoreVo v = algorithmScoreList.get(i);
                     AlgorithmScoreVo v = algorithmScoreList.get(i);
                     if ("汇总".equals(v.getProjectName())) {
                     if ("汇总".equals(v.getProjectName())) {
@@ -3068,7 +3138,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
 
 
                 }
                 }
 
 
-            }
+            }*/
 
 
             addElement(document, substring1, null, bf3, 15, false, 30, false);
             addElement(document, substring1, null, bf3, 15, false, 30, false);
             addElement(document, "表4-1 详细得分情况", null, bf3, 15, false, 30, true);
             addElement(document, "表4-1 详细得分情况", null, bf3, 15, false, 30, true);
@@ -3086,7 +3156,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
 
 
             setBlankLineSpacing(20, font, document);
             setBlankLineSpacing(20, font, document);
 
 
-            List<Map> scoreLiTitle = vo.getSceneScoreLiTitle();
+//            List<Map> scoreLiTitle = vo.getSceneScoreLiTitle();
             int size2 = scoreLiTitle.size();
             int size2 = scoreLiTitle.size();
             PdfPTable pdfPTable3 = new PdfPTable(size2);
             PdfPTable pdfPTable3 = new PdfPTable(size2);
             pdfPTable3.setHeaderRows(1);
             pdfPTable3.setHeaderRows(1);

BIN
simulation-resource-server/src/main/resources/icon/pjdj_new.png