|
@@ -2608,10 +2608,10 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
public void exportProjectReport(SimulationManualProjectParam param) {
|
|
public void exportProjectReport(SimulationManualProjectParam param) {
|
|
|
|
|
|
OutputStream os;
|
|
OutputStream os;
|
|
- HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
|
|
|
|
|
|
+ HttpServletResponse response = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getResponse();
|
|
//获取要生成的数据
|
|
//获取要生成的数据
|
|
- ResponseBodyVO bodyVO = selectProjectReportById(param);
|
|
|
|
- ProjectReportVo vo = (ProjectReportVo) bodyVO.getInfo();
|
|
|
|
|
|
+ ResponseBodyVO<ProjectReportVo> bodyVO = selectProjectReportById(param);
|
|
|
|
+ ProjectReportVo vo = bodyVO.getInfo();
|
|
//下载 or 保存本地
|
|
//下载 or 保存本地
|
|
if (param.getIsCreateLocalPdfFile() != null && param.getIsCreateLocalPdfFile()) {
|
|
if (param.getIsCreateLocalPdfFile() != null && param.getIsCreateLocalPdfFile()) {
|
|
File file = new File(param.getLocalPdfFilePath());
|
|
File file = new File(param.getLocalPdfFilePath());
|
|
@@ -2624,33 +2624,36 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
}
|
|
}
|
|
// 监听生成pdf数据
|
|
// 监听生成pdf数据
|
|
Document document = new Document(PageSize.A4);
|
|
Document document = new Document(PageSize.A4);
|
|
- PdfWriter.getInstance(document, os);
|
|
|
|
- // 以下生成PDF
|
|
|
|
- BaseFont font = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
|
|
|
|
- //标题
|
|
|
|
document.open();
|
|
document.open();
|
|
- Font titleFont = new Font(font, 20); //字体
|
|
|
|
- Paragraph titleElements = new Paragraph("评价报告", titleFont);
|
|
|
|
- titleElements.setAlignment(Element.ALIGN_CENTER); //居中
|
|
|
|
- document.add(titleElements);
|
|
|
|
|
|
+ PdfWriter.getInstance(document, os);
|
|
|
|
+ BaseFont baseFont = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
|
|
|
|
+ //* -------------------------------- 第一页 --------------------------------
|
|
|
|
+ Paragraph paragraph1 = new Paragraph("评价报告", new Font(baseFont, 20));
|
|
|
|
+ paragraph1.setAlignment(Element.ALIGN_CENTER); //居中
|
|
|
|
+ document.add(paragraph1);
|
|
|
|
+
|
|
|
|
+// // 新的一页,横向显示
|
|
|
|
+// document.setPageSize(PageSize.A4.rotate());
|
|
|
|
+// document.newPage();
|
|
|
|
+
|
|
//算法名称、算法得分、测试等级
|
|
//算法名称、算法得分、测试等级
|
|
Paragraph algorithmNanmeElements = new Paragraph(
|
|
Paragraph algorithmNanmeElements = new Paragraph(
|
|
50,
|
|
50,
|
|
" 算法名称:" + vo.getAlgorithmName()
|
|
" 算法名称:" + vo.getAlgorithmName()
|
|
+ " 算法得分:" + vo.getAlgorithmScore()
|
|
+ " 算法得分:" + vo.getAlgorithmScore()
|
|
+ " 测试等级:" + vo.getEvaluationLevel(),
|
|
+ " 测试等级:" + vo.getEvaluationLevel(),
|
|
- defaultFont(font));
|
|
|
|
|
|
+ defaultFont(baseFont));
|
|
algorithmNanmeElements.setAlignment(Element.ALIGN_LEFT); //靠左
|
|
algorithmNanmeElements.setAlignment(Element.ALIGN_LEFT); //靠左
|
|
document.add(algorithmNanmeElements);
|
|
document.add(algorithmNanmeElements);
|
|
//算法描述
|
|
//算法描述
|
|
Paragraph algorithmDescribeFontElements = new Paragraph(
|
|
Paragraph algorithmDescribeFontElements = new Paragraph(
|
|
30,
|
|
30,
|
|
" 算法描述:" + vo.getAlgorithmDescribe(),
|
|
" 算法描述:" + vo.getAlgorithmDescribe(),
|
|
- defaultFont(font));
|
|
|
|
|
|
+ defaultFont(baseFont));
|
|
algorithmDescribeFontElements.setAlignment(Element.ALIGN_LEFT); //居中
|
|
algorithmDescribeFontElements.setAlignment(Element.ALIGN_LEFT); //居中
|
|
document.add(algorithmDescribeFontElements);
|
|
document.add(algorithmDescribeFontElements);
|
|
//算法简评
|
|
//算法简评
|
|
- Font algorithmEvaluateFont = new Font(font, 14); //字体
|
|
|
|
|
|
+ Font algorithmEvaluateFont = new Font(baseFont, 14); //字体
|
|
Paragraph algorithmEvaluateElements = new Paragraph(
|
|
Paragraph algorithmEvaluateElements = new Paragraph(
|
|
30,
|
|
30,
|
|
" 算法简评:" + vo.getAlgorithmEvaluation(),
|
|
" 算法简评:" + vo.getAlgorithmEvaluation(),
|
|
@@ -2663,14 +2666,14 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
Paragraph scoreTableElements = new Paragraph(
|
|
Paragraph scoreTableElements = new Paragraph(
|
|
50,
|
|
50,
|
|
"测试得分表",
|
|
"测试得分表",
|
|
- defaultFont(font));
|
|
|
|
|
|
+ defaultFont(baseFont));
|
|
scoreTableElements.setAlignment(Element.ALIGN_CENTER); //居中
|
|
scoreTableElements.setAlignment(Element.ALIGN_CENTER); //居中
|
|
document.add(scoreTableElements);
|
|
document.add(scoreTableElements);
|
|
- setBlankLineSpacing(20, font, document);
|
|
|
|
|
|
+ setBlankLineSpacing(20, baseFont, document);
|
|
// 表头
|
|
// 表头
|
|
PdfPTable pdfPTable = new PdfPTable(5);
|
|
PdfPTable pdfPTable = new PdfPTable(5);
|
|
pdfPTable.setHeaderRows(1);//换页每页显示表头
|
|
pdfPTable.setHeaderRows(1);//换页每页显示表头
|
|
- addTitleList(pdfPTable, font, new String[]{"测试项目", "场景数量", "测试权重(%)", "测试得分", "得分率(%)"});
|
|
|
|
|
|
+ addTitleList(pdfPTable, baseFont, new String[]{"测试项目", "场景数量", "测试权重(%)", "测试得分", "得分率(%)"});
|
|
|
|
|
|
// 数据
|
|
// 数据
|
|
List<AlgorithmScoreVo> algorithmScoreList = vo.getAlgorithmScoreList();
|
|
List<AlgorithmScoreVo> algorithmScoreList = vo.getAlgorithmScoreList();
|
|
@@ -2678,25 +2681,9 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
String[] data = new String[]{
|
|
String[] data = new String[]{
|
|
asv.getProjectName(), String.valueOf(asv.getSceneNum()), asv.getWeight(), String.valueOf(asv.getScore()), String.valueOf(asv.getScoreRatio())
|
|
asv.getProjectName(), String.valueOf(asv.getSceneNum()), asv.getWeight(), String.valueOf(asv.getScore()), String.valueOf(asv.getScoreRatio())
|
|
};
|
|
};
|
|
- addDataList(pdfPTable, font, data);
|
|
|
|
|
|
+ addDataList(pdfPTable, baseFont, data);
|
|
}
|
|
}
|
|
document.add(pdfPTable);
|
|
document.add(pdfPTable);
|
|
- // 评价等级(已去掉)
|
|
|
|
-// Paragraph levelTableElements = new Paragraph(
|
|
|
|
-// 50,
|
|
|
|
-// "评价等级",
|
|
|
|
-// defaultFont(font));
|
|
|
|
-// levelTableElements.setAlignment(Element.ALIGN_CENTER); //居中
|
|
|
|
-// document.add(levelTableElements);
|
|
|
|
-//
|
|
|
|
-// setBlankLineSpacing(20, font, document);
|
|
|
|
-//
|
|
|
|
-// PdfPTable pdfPTable1 = new PdfPTable(5);
|
|
|
|
-// addTitleList(pdfPTable1, font, new String[]{"测试项目", "90<总分<100", "80<总分<90", "70<总分<80", "0<总分<70"});
|
|
|
|
-// addDataList(pdfPTable1, font, new String[]{"评价等级", "优秀(G)", "良好(A)", "一般(M)", "较差(P)",
|
|
|
|
-// "评价等级", "++++++", "+++++", "++++", "+++",});
|
|
|
|
-// document.add(pdfPTable1);
|
|
|
|
-
|
|
|
|
|
|
|
|
// 新的一页,横向显示
|
|
// 新的一页,横向显示
|
|
document.setPageSize(PageSize.A4.rotate());
|
|
document.setPageSize(PageSize.A4.rotate());
|
|
@@ -2706,10 +2693,10 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
Paragraph subListScoreElements = new Paragraph(
|
|
Paragraph subListScoreElements = new Paragraph(
|
|
50,
|
|
50,
|
|
"算法测试评分细则",
|
|
"算法测试评分细则",
|
|
- defaultFont(font));
|
|
|
|
|
|
+ defaultFont(baseFont));
|
|
subListScoreElements.setAlignment(Element.ALIGN_CENTER); //居中
|
|
subListScoreElements.setAlignment(Element.ALIGN_CENTER); //居中
|
|
document.add(subListScoreElements);
|
|
document.add(subListScoreElements);
|
|
- setBlankLineSpacing(20, font, document);
|
|
|
|
|
|
+ setBlankLineSpacing(20, baseFont, document);
|
|
List<Map> subListScoreLiTitle = vo.getSubListScoreLiTitle();
|
|
List<Map> subListScoreLiTitle = vo.getSubListScoreLiTitle();
|
|
int size = subListScoreLiTitle.size();
|
|
int size = subListScoreLiTitle.size();
|
|
PdfPTable pdfPTable2 = new PdfPTable(size);
|
|
PdfPTable pdfPTable2 = new PdfPTable(size);
|
|
@@ -2718,7 +2705,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
for (int i = 0; i < size; i++) {
|
|
for (int i = 0; i < size; i++) {
|
|
slt[i] = subListScoreLiTitle.get(i).get("label").toString();
|
|
slt[i] = subListScoreLiTitle.get(i).get("label").toString();
|
|
}
|
|
}
|
|
- addTitleList(pdfPTable2, font, slt);
|
|
|
|
|
|
+ addTitleList(pdfPTable2, baseFont, slt);
|
|
List<SubScListVo> subListScoreLi = vo.getSubListScoreLi();
|
|
List<SubScListVo> subListScoreLi = vo.getSubListScoreLi();
|
|
List<String[]> list = new ArrayList<>();
|
|
List<String[]> list = new ArrayList<>();
|
|
int fieldNumber = 7;
|
|
int fieldNumber = 7;
|
|
@@ -2782,7 +2769,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
if (contains) {
|
|
if (contains) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- PdfPCell pdfPCell = new PdfPCell(new Paragraph(strings[j], defaultFont(font)));
|
|
|
|
|
|
+ PdfPCell pdfPCell = new PdfPCell(new Paragraph(strings[j], defaultFont(baseFont)));
|
|
//是否要合并
|
|
//是否要合并
|
|
Integer n = combineCoordList.get(coord);
|
|
Integer n = combineCoordList.get(coord);
|
|
if (n != null) {
|
|
if (n != null) {
|
|
@@ -2797,11 +2784,11 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
/*
|
|
/*
|
|
场景得分列表
|
|
场景得分列表
|
|
*/
|
|
*/
|
|
- Paragraph sceneScoreElements = new Paragraph(50, "详细得分情况", defaultFont(font));
|
|
|
|
|
|
+ Paragraph sceneScoreElements = new Paragraph(50, "详细得分情况", defaultFont(baseFont));
|
|
sceneScoreElements.setAlignment(Element.ALIGN_CENTER); //居中
|
|
sceneScoreElements.setAlignment(Element.ALIGN_CENTER); //居中
|
|
document.add(sceneScoreElements);
|
|
document.add(sceneScoreElements);
|
|
|
|
|
|
- setBlankLineSpacing(20, font, document);
|
|
|
|
|
|
+ setBlankLineSpacing(20, baseFont, document);
|
|
|
|
|
|
List<Map> scoreLiTitle = vo.getSceneScoreLiTitle();
|
|
List<Map> scoreLiTitle = vo.getSceneScoreLiTitle();
|
|
int size2 = scoreLiTitle.size();
|
|
int size2 = scoreLiTitle.size();
|
|
@@ -2811,7 +2798,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
for (int i = 0; i < size2; i++) {
|
|
for (int i = 0; i < size2; i++) {
|
|
slt2[i] = scoreLiTitle.get(i).get("label").toString();
|
|
slt2[i] = scoreLiTitle.get(i).get("label").toString();
|
|
}
|
|
}
|
|
- addTitleList(pdfPTable3, font, slt2);
|
|
|
|
|
|
+ addTitleList(pdfPTable3, baseFont, slt2);
|
|
List<SceneScListVo> sceneScoreLi = vo.getSceneScoreLi();
|
|
List<SceneScListVo> sceneScoreLi = vo.getSceneScoreLi();
|
|
|
|
|
|
List<String[]> list2 = new ArrayList<>();
|
|
List<String[]> list2 = new ArrayList<>();
|
|
@@ -2863,7 +2850,6 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
|
|
|
list2.add(ssli);
|
|
list2.add(ssli);
|
|
|
|
|
|
-// addDataList(pdfPTable3, font, ssli);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
Map map2 = getSceneScListCombineCoord(sceneScoreLi, size2);
|
|
Map map2 = getSceneScListCombineCoord(sceneScoreLi, size2);
|
|
@@ -2871,8 +2857,6 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
Map<String, Integer> combineCoordList2 = (Map<String, Integer>) map2.get("combineCoordList");
|
|
Map<String, Integer> combineCoordList2 = (Map<String, Integer>) map2.get("combineCoordList");
|
|
List<String> skipCoordList2 = (List<String>) map2.get("skipCoordList");
|
|
List<String> skipCoordList2 = (List<String>) map2.get("skipCoordList");
|
|
|
|
|
|
- boolean b2 = false;
|
|
|
|
- int num2 = 0;
|
|
|
|
for (int i = 0; i < list2.size(); i++) {
|
|
for (int i = 0; i < list2.size(); i++) {
|
|
String[] strings = list2.get(i);
|
|
String[] strings = list2.get(i);
|
|
for (int j = 0; j < strings.length; j++) {
|
|
for (int j = 0; j < strings.length; j++) {
|
|
@@ -2883,7 +2867,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
if (contains) {
|
|
if (contains) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- PdfPCell pdfPCell = new PdfPCell(new Paragraph(strings[j], defaultFont(font)));
|
|
|
|
|
|
+ PdfPCell pdfPCell = new PdfPCell(new Paragraph(strings[j], defaultFont(baseFont)));
|
|
//是否要合并
|
|
//是否要合并
|
|
Integer n = combineCoordList2.get(coord);
|
|
Integer n = combineCoordList2.get(coord);
|
|
if (n != null) {
|
|
if (n != null) {
|
|
@@ -3030,12 +3014,6 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- /*List<CombineCoordVo> combineCoordVoList = new ArrayList<>();
|
|
|
|
-
|
|
|
|
- for(String k : map.keySet()){
|
|
|
|
- combineCoordVoList.add(map.get(k));
|
|
|
|
- }*/
|
|
|
|
-
|
|
|
|
for (String k : map.keySet()) {
|
|
for (String k : map.keySet()) {
|
|
CombineCoordVo combineCoordVo = map.get(k);
|
|
CombineCoordVo combineCoordVo = map.get(k);
|
|
combineCoordMap.put(combineCoordVo.getCoord(), combineCoordVo.getRepetitionNum());
|
|
combineCoordMap.put(combineCoordVo.getCoord(), combineCoordVo.getRepetitionNum());
|