Commit 773b3d7e authored by 高滢's avatar 高滢
parents b8d6121e cbf37545
...@@ -50,4 +50,7 @@ public class TestRecords { ...@@ -50,4 +50,7 @@ public class TestRecords {
@ApiModelProperty("修复建议") @ApiModelProperty("修复建议")
private String remediation; private String remediation;
@ApiModelProperty("测试详情")
private String testDetails;
} }
...@@ -71,21 +71,19 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe ...@@ -71,21 +71,19 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
ByteArrayOutputStream bos = null; ByteArrayOutputStream bos = null;
try { try {
// 模板绝对路径--服务器 // 模板绝对路径--服务器
String fileName = "/template/receipt_template_02_27.pdf"; String fileName = "/template/receipt_template_03_27.pdf";
// 读取现有模板内容 // 读取现有模板内容
reader = new PdfReader(fileName); reader = new PdfReader(fileName);
// 创建输出流 // 创建输出流
bos = new ByteArrayOutputStream(); bos = new ByteArrayOutputStream();
// 实例化PdfStamper准备编辑pdf内容 // 实例化PdfStamper准备编辑pdf内容
ps = new PdfStamper(reader, bos); ps = new PdfStamper(reader, bos);
// 获取表单所有元素 // 获取表单所有元素
AcroFields fields = ps.getAcroFields(); AcroFields fields = ps.getAcroFields();
// 设置具体字体格式的编码, 不设置的话中文可能不会显示 // 设置具体字体格式的编码, 不设置的话中文可能不会显示
BaseFont bf = BaseFont.createFont("STSongStd-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); BaseFont bf = BaseFont.createFont("STSongStd-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
fields.addSubstitutionFont(bf); fields.addSubstitutionFont(bf);
// 测试数据 // 测试数据
InspectionReportPdfVO inspectionReportPdfVO = requireData(taskId); InspectionReportPdfVO inspectionReportPdfVO = requireData(taskId);
...@@ -178,7 +176,7 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe ...@@ -178,7 +176,7 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
document.close(); document.close();
// 上传到Minio // 上传到Minio
return uploadMinio(outputStream, "企业留档文件_" + taskId); return uploadMinio(outputStream, "企业留档文件-" + getReportName());
} }
/** /**
......
...@@ -59,6 +59,12 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR ...@@ -59,6 +59,12 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
for (TestRecords records : recordsList) { for (TestRecords records : recordsList) {
if (Objects.equals(caseResultVO.getId(), records.getUsecaseId())) { if (Objects.equals(caseResultVO.getId(), records.getUsecaseId())) {
exists = true; exists = true;
if (!Objects.equals(caseResultVO.getStatus(), records.getTestResult())) {
records.setTestResult(caseResultVO.getStatus());
records.setRemediation(caseResultVO.getRemediation());
testRecordsService.updateById(records);
}
break; break;
} }
} }
...@@ -80,12 +86,24 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR ...@@ -80,12 +86,24 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
if (stepResultVOS != null && stepResultVOS.size() != 0) { if (stepResultVOS != null && stepResultVOS.size() != 0) {
List<String> stepList = new ArrayList<>(); List<String> stepList = new ArrayList<>();
List<String> testDetailsList = new ArrayList<>();
int index = 1; // 序号从1开始
for (StepResultVO stepResultVO :stepResultVOS) { for (StepResultVO stepResultVO :stepResultVOS) {
// 测试方法
String stepName = stepResultVO.getName(); String stepName = stepResultVO.getName();
stepList.add(stepName); // 给每个元素加上序号
String stepWithIndex = index + "." + stepName;
stepList.add(stepWithIndex);
index++;
// 测试详情
String testDetails = stepResultVO.getDescription();
testDetailsList.add(testDetails);
} }
testRecords.setTestMethod(StringUtils.join(stepList,",")); testRecords.setTestMethod(StringUtils.join(stepList,"`"));
testRecords.setTestDetails(StringUtils.join(testDetailsList,"\n"));
} }
list.add(testRecords); list.add(testRecords);
...@@ -141,12 +159,24 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR ...@@ -141,12 +159,24 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
if (stepResultVOS != null && stepResultVOS.size() != 0) { if (stepResultVOS != null && stepResultVOS.size() != 0) {
List<String> stepList = new ArrayList<>(); List<String> stepList = new ArrayList<>();
List<String> testDetailsList = new ArrayList<>();
int index = 1; // 序号从1开始
for (StepResultVO stepResultVO :stepResultVOS) { for (StepResultVO stepResultVO :stepResultVOS) {
// 测试方法
String stepName = stepResultVO.getName(); String stepName = stepResultVO.getName();
stepList.add(stepName); // 给每个元素加上序号
String stepWithIndex = index + "." + stepName;
stepList.add(stepWithIndex);
index++;
// 测试详情
String testDetails = stepResultVO.getDescription();
testDetailsList.add(testDetails);
} }
testRecords.setTestMethod(StringUtils.join(stepList,",")); testRecords.setTestMethod(StringUtils.join(stepList,"`"));
testRecords.setTestDetails(StringUtils.join(testDetailsList,"\n"));
} }
list.add(testRecords); list.add(testRecords);
......
...@@ -16,9 +16,10 @@ ...@@ -16,9 +16,10 @@
<result property="testMethod" column="test_method" jdbcType="LONGNVARCHAR"/> <result property="testMethod" column="test_method" jdbcType="LONGNVARCHAR"/>
<result property="testResult" column="test_result" jdbcType="VARCHAR"/> <result property="testResult" column="test_result" jdbcType="VARCHAR"/>
<result property="remediation" column="remediation" jdbcType="VARCHAR"/> <result property="remediation" column="remediation" jdbcType="VARCHAR"/>
<result property="testDetails" column="test_details" jdbcType="LONGNVARCHAR"/>
</resultMap> </resultMap>
<select id="findByTaskId" resultType="com.ruoyi.domain.TestRecords"> <select id="findByTaskId" resultType="com.ruoyi.domain.TestRecords">
SELECT id, project_id, task_id, usecase, usecase_id, test_time, description, risk_level, test_method, test_result, remediation SELECT id, project_id, task_id, usecase, usecase_id, test_time, description, risk_level, test_method, test_result, remediation, test_details
FROM t_test_records FROM t_test_records
WHERE project_id = #{id} WHERE project_id = #{id}
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment