Commit 2e3b739d authored by 盖献康's avatar 盖献康

Merge branch 'gaixiankang' into 'dev'

原始记录PDF - 剩余字段

See merge request !299
parents 6d11cada b52bff1c
package com.ruoyi.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 总任务 - 检验人员VO
* @author gxk
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("检验人员VO")
public class InspectionPersonnelVO {
@ApiModelProperty("负责人")
private String principal;
@ApiModelProperty("检验人员")
private String inspectionPersonnel;
@ApiModelProperty("检验日期")
private String inspectionDate;
}
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.Task; import com.ruoyi.domain.Task;
import com.ruoyi.domain.TaskUserRelation; import com.ruoyi.domain.TaskUserRelation;
import com.ruoyi.domain.vo.EnterpriseFilePdfVO; import com.ruoyi.domain.vo.EnterpriseFilePdfVO;
import com.ruoyi.domain.vo.InspectionPersonnelVO;
import com.ruoyi.domain.vo.InspectionReportPdfVO; import com.ruoyi.domain.vo.InspectionReportPdfVO;
import com.ruoyi.domain.vo.TestConclusionVO; import com.ruoyi.domain.vo.TestConclusionVO;
import com.ruoyi.web.request.TaskFindFinishRequest; import com.ruoyi.web.request.TaskFindFinishRequest;
...@@ -74,4 +75,11 @@ public interface TaskMapper extends BaseMapper<Task> { ...@@ -74,4 +75,11 @@ public interface TaskMapper extends BaseMapper<Task> {
* @return * @return
*/ */
TestConclusionVO selectTestConclusion(Long taskId); TestConclusionVO selectTestConclusion(Long taskId);
/**
* 通过总任务ID查询当前任务的小组成员
* @param taskId
* @return
*/
InspectionPersonnelVO selectInspectionPersonnelById(Long taskId);
} }
...@@ -277,13 +277,15 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe ...@@ -277,13 +277,15 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
List<TestRecords> recordsList = testRecordsMapper.selectListByGeneralTaskId(taskId); List<TestRecords> recordsList = testRecordsMapper.selectListByGeneralTaskId(taskId);
// 查询本任务对应的所有样品编号、样品照片 // 查询本任务对应的所有样品编号、样品照片
InspectionReportPdfVO reportData = taskMapper.selectInspectionReportData(taskId); InspectionReportPdfVO reportData = taskMapper.selectInspectionReportData(taskId);
// 查询检验负责人
InspectionPersonnelVO inspectionPersonnel = taskMapper.selectInspectionPersonnelById(taskId);
// 创建临时文档 // 创建临时文档
String templateName = temporaryDocument(sample, recordsList, reportData); String templateName = temporaryDocument(sample, recordsList, reportData, inspectionPersonnel);
PdfReader pdfReader = new PdfReader(minioUrl() + templateName); PdfReader pdfReader = new PdfReader(minioUrl() + templateName);
totalNum = pdfReader.getNumberOfPages() - 1; totalNum = pdfReader.getNumberOfPages() - 1;
// 真正文档 // 真正文档
String currentName = temporaryDocument(sample, recordsList, reportData); String currentName = temporaryDocument(sample, recordsList, reportData, inspectionPersonnel);
// copy - 分割 // copy - 分割
Document currentDoc = new Document(); Document currentDoc = new Document();
ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream(); ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
...@@ -306,11 +308,12 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe ...@@ -306,11 +308,12 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
* @param sample 样品信息 * @param sample 样品信息
* @param recordsList 定时任务接收数据List * @param recordsList 定时任务接收数据List
* @param reportData * @param reportData
* @param inspectionPersonnel 检验人员信息
* @return * @return
* @throws Exception * @throws Exception
*/ */
@SneakyThrows @SneakyThrows
private String temporaryDocument(Sample sample, List<TestRecords> recordsList, InspectionReportPdfVO reportData) throws Exception { private String temporaryDocument(Sample sample, List<TestRecords> recordsList, InspectionReportPdfVO reportData, InspectionPersonnelVO inspectionPersonnel) throws Exception {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
...@@ -331,9 +334,9 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe ...@@ -331,9 +334,9 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
// 3.仪器设备信息 // 3.仪器设备信息
instrumentInformationSection(document); instrumentInformationSection(document);
// 第一页下方信息 // 第一页下方信息
bottomOfTheFirstPage(document, writer); bottomOfTheFirstPage(document, writer,reportData, inspectionPersonnel);
// 4.检验结果(循环遍历用例) // 4.检验结果(循环遍历用例)
testResultSection(document, recordsList, reportData); testResultSection(document, recordsList, reportData, inspectionPersonnel);
// 5.附录 // 5.附录
document.setParagraph("5.附录", 10f, Element.ALIGN_LEFT, 0,2f, 0f); document.setParagraph("5.附录", 10f, Element.ALIGN_LEFT, 0,2f, 0f);
// 样品照片 // 样品照片
...@@ -445,20 +448,22 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe ...@@ -445,20 +448,22 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
* 车型试验原始记录 - 第一页下方固定内容 * 车型试验原始记录 - 第一页下方固定内容
* @param document * @param document
* @param writer * @param writer
* @param reportData
* @param inspectionPersonnel
*/ */
private void bottomOfTheFirstPage(PdfBaseWriter document, PdfWriter writer) { private void bottomOfTheFirstPage(PdfBaseWriter document, PdfWriter writer,InspectionReportPdfVO reportData, InspectionPersonnelVO inspectionPersonnel) {
PdfPTable inspectorTable = new PdfPTable(new float[]{20, 20, 10, 40}); PdfPTable inspectorTable = new PdfPTable(new float[]{12, 28, 10, 40});
inspectorTable.setWidthPercentage(100); inspectorTable.setWidthPercentage(100);
inspectorTable.setTotalWidth(PageSize.A4.getWidth() - 80); inspectorTable.setTotalWidth(PageSize.A4.getWidth() - 80);
document.writeNoBorderCell("检验人员:", Element.ALIGN_LEFT, 1, 1, inspectorTable); document.writeNoBorderCell("检验人员:", Element.ALIGN_LEFT, 1, 1, inspectorTable);
document.writeNoBorderCell("", Element.ALIGN_LEFT, 1, 1, inspectorTable); document.writeNoBorderCell(inspectionPersonnel.getInspectionPersonnel(), Element.ALIGN_LEFT, 1, 1, inspectorTable);
document.writeNoBorderCell("检验日期:", Element.ALIGN_LEFT, 1, 1, inspectorTable); document.writeNoBorderCell("检验日期:", Element.ALIGN_LEFT, 1, 1, inspectorTable);
document.writeNoBorderCell("", Element.ALIGN_LEFT, 1, 1, inspectorTable); document.writeNoBorderCell(inspectionPersonnel.getInspectionDate(), Element.ALIGN_LEFT, 1, 1, inspectorTable);
document.writeBottomCell("检验负责人:", Element.ALIGN_LEFT, 1, 1, inspectorTable); document.writeBottomCell("检验负责人:", Element.ALIGN_LEFT, 1, 1, inspectorTable);
document.writeBottomCell("", Element.ALIGN_LEFT, 1, 1, inspectorTable); document.writeBottomCell(inspectionPersonnel.getPrincipal(), Element.ALIGN_LEFT, 1, 1, inspectorTable);
document.writeBottomCell("检验地点:", Element.ALIGN_LEFT, 1, 1, inspectorTable); document.writeBottomCell("检验地点:", Element.ALIGN_LEFT, 1, 1, inspectorTable);
document.writeBottomCell("口中汽研软件测评有限公司 口其他:", Element.ALIGN_LEFT, 1, 1, inspectorTable); document.writeBottomCell("口" + reportData.getInspectionCenterAddress() + " 口其他:", Element.ALIGN_LEFT, 1, 1, inspectorTable);
inspectorTable.writeSelectedRows(0, -1, document.left(), document.bottom() + 60, writer.getDirectContent()); inspectorTable.writeSelectedRows(0, -1, document.left(), document.bottom() + 80, writer.getDirectContent());
// 开启下一页 // 开启下一页
document.newPage(); document.newPage();
} }
...@@ -468,8 +473,9 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe ...@@ -468,8 +473,9 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
* @param document * @param document
* @param recordsList * @param recordsList
* @param reportData * @param reportData
* @param inspectionPersonnel
*/ */
private void testResultSection(PdfBaseWriter document, List<TestRecords> recordsList, InspectionReportPdfVO reportData) { private void testResultSection(PdfBaseWriter document, List<TestRecords> recordsList, InspectionReportPdfVO reportData, InspectionPersonnelVO inspectionPersonnel) {
document.setParagraph("4.检验结果", 10f, Element.ALIGN_LEFT, 0,10f, 0f); document.setParagraph("4.检验结果", 10f, Element.ALIGN_LEFT, 0,10f, 0f);
// 获取数据 - 渲染 // 获取数据 - 渲染
if (CollUtil.isNotEmpty(recordsList)) { if (CollUtil.isNotEmpty(recordsList)) {
...@@ -480,13 +486,13 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe ...@@ -480,13 +486,13 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
PdfPTable useCaseTable = new PdfPTable(new float[]{15, 35, 15, 35}); PdfPTable useCaseTable = new PdfPTable(new float[]{15, 35, 15, 35});
useCaseTable.setWidthPercentage(100); useCaseTable.setWidthPercentage(100);
document.writeCell("测试编号", Element.ALIGN_LEFT, 1, 1, useCaseTable); document.writeCell("测试编号", Element.ALIGN_LEFT, 1, 1, useCaseTable);
document.writeCell("xxxxxxx", Element.ALIGN_LEFT, 1, 1, useCaseTable); document.writeCell(record.getUsecaseNo(), Element.ALIGN_LEFT, 1, 1, useCaseTable);
document.writeCell("测试时间", Element.ALIGN_LEFT, 1, 1, useCaseTable); document.writeCell("测试时间", Element.ALIGN_LEFT, 1, 1, useCaseTable);
document.writeCell(String.valueOf(record.getTestTime()), Element.ALIGN_LEFT, 1, 1, useCaseTable); document.writeCell(String.valueOf(record.getTestTime()), Element.ALIGN_LEFT, 1, 1, useCaseTable);
document.writeCell("样品编号", Element.ALIGN_LEFT, 1, 1, useCaseTable); document.writeCell("样品编号", Element.ALIGN_LEFT, 1, 1, useCaseTable);
document.writeCell(reportData.getSampleNumberSummary(), Element.ALIGN_LEFT, 1, 1, useCaseTable); document.writeCell(reportData.getSampleNumberSummary(), Element.ALIGN_LEFT, 1, 1, useCaseTable);
document.writeCell("测试人员", Element.ALIGN_LEFT, 1, 1, useCaseTable); document.writeCell("测试人员", Element.ALIGN_LEFT, 1, 1, useCaseTable);
document.writeCell("", Element.ALIGN_LEFT, 1, 1, useCaseTable); document.writeCell(inspectionPersonnel.getInspectionPersonnel(), Element.ALIGN_LEFT, 1, 1, useCaseTable);
document.writeCell("简述", Element.ALIGN_LEFT, 1, 1, useCaseTable); document.writeCell("简述", Element.ALIGN_LEFT, 1, 1, useCaseTable);
document.writeCell(record.getDescription(), Element.ALIGN_LEFT, 3, 1, useCaseTable); document.writeCell(record.getDescription(), Element.ALIGN_LEFT, 3, 1, useCaseTable);
document.writeCell("风险等级", Element.ALIGN_LEFT, 1, 1, useCaseTable); document.writeCell("风险等级", Element.ALIGN_LEFT, 1, 1, useCaseTable);
......
...@@ -407,5 +407,21 @@ ...@@ -407,5 +407,21 @@
t.id = #{taskId} t.id = #{taskId}
</select> </select>
<select id="selectInspectionPersonnelById" parameterType="java.lang.Long" resultType="com.ruoyi.domain.vo.InspectionPersonnelVO">
select
su.nick_name AS principal,
GROUP_CONCAT(distinct u.nick_name) AS inspectionPersonnel,
DATE_FORMAT(mtt.task_begin_time, '%Y-%m-%d') AS inspectionDate
from
t_task t
left join t_task_user_relation tur on t.id = tur.task_id
left join sys_user u on tur.user_id = u.user_id
left join sys_user su on t.leader_id = su.user_id
left join t_model_test_task mtt on t.model_test_task_id = mtt.id
where
t.id = #{taskId}
group by t.id
</select>
</mapper> </mapper>
...@@ -40,7 +40,8 @@ ...@@ -40,7 +40,8 @@
tr.test_method, tr.test_method,
tr.test_result, tr.test_result,
tr.remediation, tr.remediation,
tr.test_details tr.test_details,
tr.usecase_no
from from
t_test_records tr t_test_records tr
left join t_task t on tr.task_id = t.model_test_task_id left join t_task t on tr.task_id = t.model_test_task_id
......
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