Commit c4c18807 authored by 盖献康's avatar 盖献康

企业留档文件 - 数据变活

parent f4ae4b80
......@@ -178,8 +178,13 @@ public class Task {
@ApiModelProperty("子任务指针最大值")
private int maxPointer;
// 返回当前节点的下一个节点
@ApiModelProperty("检验项目名称")
@TableField(exist = false)
private String inspectionItemName;
/**
* 返回当前节点的下一个节点
*/
public String getNextNode() {
String[] split = taskList.split(",");
if(pointer < split.length) {
......
package com.ruoyi.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 企业留档文件PDF
* @author gxk
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("企业留档文件PDF")
public class EnterpriseFilePdfVO {
@ApiModelProperty("检验中心名称")
private String inspectionCenterName;
@ApiModelProperty("检验依据")
private String inspectionBasis;
@ApiModelProperty("检验项目")
private String inspectionItem;
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private String createTime;
@ApiModelProperty("委托单位名称")
private String clientName;
}
......@@ -2,14 +2,12 @@ package com.ruoyi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.domain.Task;
import com.ruoyi.domain.TaskSampleRelation;
import com.ruoyi.domain.TaskUserRelation;
import com.ruoyi.domain.vo.EnterpriseFilePdfVO;
import com.ruoyi.web.request.TaskFindFinishRequest;
import com.ruoyi.web.request.TaskFindPendingRequest;
import com.ruoyi.web.request.TaskFindRequest;
import com.ruoyi.web.request.TaskListRequest;
import com.ruoyi.web.response.TaskFindResponse;
import com.ruoyi.web.response.TaskGetInfoResponse;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -37,4 +35,11 @@ public interface TaskMapper extends BaseMapper<Task> {
Task getBySubtaskId(@Param("subId") Long subId);
Long findTaskName(@Param("taskName") String taskName);
/**
* 通过总任务ID,获取企业文件数据
* @param taskId
* @return
*/
EnterpriseFilePdfVO selectEnterpriseFileData(@Param("taskId") Long taskId);
}
......@@ -219,6 +219,10 @@ public class BookServiceImpl extends ServiceImpl<BookMapper, Book> implements Bo
Image imgTwo = Image.getInstance("C:/Users/gxk/Pictures/Saved Pictures/123.jpg");
img.scaleToFit(100, 100);
cell.addElement(imgTwo);
cell.addElement(document.createTextInImageCell("请依次完成以下操作:\n\n1)使用电动螺丝刀拆开车机外壳,注意不要造成物理性破坏;\n\n2)肉眼观察板子上是否有明显的JTAG调试接口,需要注意CPU附近的点和引脚的各种信息;\n\n注:JTAG通常主要由以下4个针脚组成:\n\n①TCK ... Test Clock\n\n②TMS ... Test Mode Select \n\n③TDI ... Test Data In\n\n④TDO ... Test Data Out\n\n3)通过五倍光学放大镜仔细查看PCB板上的信息,找到带有JTAG、TCK、TMS、TDI、TDO等相关的信息的点位,比如下图:\n\nhttp://10.12.48.80:8089/file_server/api_v1/downloadSysFile?key=e45566a4ebf14eb299d60b180473f9c84c&ts=2024_03_05&token=7f5ac770a013f7ce74205992257f5d9b&tmp=false&inline=true\n\n4)将测试过程中的 PCB 板照片等作为测试证明材料上传至平台。\n\n<br>\n\n**请根据PCB板上是否存在明显的JTAG调试接口对节点结果进行判断。**)"));
Image imgThird = Image.getInstance("http://49.232.167.247:22038/vehicle-quality-review-oss/2023/12/19/1702891760057_20231219095525A001.jpg");
img.scaleToFit(100, 100);
cell.addElement(imgThird);
table.addCell(cell);
table.addCell(document.createCenterCell("修复建议"));
table.addCell(document.createLeftCell(pdfTestVO.getRepairSuggestion()));
......
......@@ -2,13 +2,17 @@ package com.ruoyi.service.impl;
import com.itextpdf.text.*;
import com.itextpdf.text.pdf.*;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.PdfBaseWriter;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.domain.vo.EnterpriseFilePdfVO;
import com.ruoyi.domain.vo.InspectionReportPdfVO;
import com.ruoyi.domain.vo.ReviewEnterpriseArchiveViewVO;
import com.ruoyi.mapper.TaskMapper;
import com.ruoyi.service.PdfTemplateManagementService;
import com.ruoyi.service.ReviewEnterpriseArchiveService;
import com.ruoyi.system.mapper.SysDictDataMapper;
import io.minio.MinioClient;
import io.minio.ObjectWriteArgs;
import io.minio.PutObjectArgs;
......@@ -47,6 +51,12 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
@Autowired
private ReviewEnterpriseArchiveService reviewEnterpriseArchiveService;
@Autowired
private TaskMapper taskMapper;
@Autowired
private SysDictDataMapper dictDataMapper;
/**
* 检验报告PDF下载
*
......@@ -107,6 +117,10 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
*/
@Override
public String generateRetentionFile(Long taskId) throws Exception {
// 活数据查询
EnterpriseFilePdfVO data = getEnterpriseFileData(taskId);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
// 新建
PdfBaseWriter document = new PdfBaseWriter(outputStream);
......@@ -114,23 +128,23 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
document.open();
// 内容
// 封面
document.setParagraph("检验中心名称", 12f, 0, 60,15f, 120f);
document.setParagraph(data.getInspectionCenterName(), 12f, 0, 60,15f, 120f);
document.setParagraph("企业留档文件", 30f, Element.ALIGN_CENTER, 0,15f, 180f);
PdfPTable customTable = new PdfPTable(new float[]{15, 50});
customTable.setWidthPercentage(70);
document.writeNoBorderCell("检验依据:", Element.ALIGN_LEFT, 1, 1, customTable);
document.writeBottomCell("GB xxxx-xxxx 汽车整车信息安全技术要求", Element.ALIGN_LEFT, 1, 1, customTable);
document.writeBottomCell(data.getInspectionBasis(), Element.ALIGN_LEFT, 1, 1, customTable);
document.writeNoBorderCell("检验项目:", Element.ALIGN_LEFT, 1, 1, customTable);
document.writeBottomCell("汽车信息安全管理要求、车辆信息安全一般要求、车辆信息安全技术要求", Element.ALIGN_LEFT, 1, 1, customTable);
document.writeBottomCell(data.getInspectionItem(), Element.ALIGN_LEFT, 1, 1, customTable);
document.writeNoBorderCell("创建时间:", Element.ALIGN_LEFT, 1, 1, customTable);
document.writeBottomCell("2024-07-01", Element.ALIGN_LEFT, 1, 1, customTable);
document.writeBottomCell(data.getCreateTime(), Element.ALIGN_LEFT, 1, 1, customTable);
document.writeNoBorderCell("委托单位名称:", Element.ALIGN_LEFT, 1, 1, customTable);
document.writeBottomCell("xxxxxxxxxxxxxxxxxxx", Element.ALIGN_LEFT, 1, 1, customTable);
document.writeBottomCell(data.getClientName(), Element.ALIGN_LEFT, 1, 1, customTable);
document.addContent(customTable);
document.setParagraph("检验中心名称", 20f, Element.ALIGN_CENTER, 0, 100f, 0f);
document.setParagraph(data.getInspectionCenterName(), 20f, Element.ALIGN_CENTER, 0, 100f, 0f);
// 下一页
document.newPage();
document.setParagraph("检验中心名称", 12f, 0, 30,15f, 20f);
document.setParagraph(data.getInspectionCenterName(), 12f, 0, 30,15f, 20f);
// 创建表格
List<String> list = Arrays.asList("文件名称", "文件目录", "标准章节", "标准要求", "审查要点");
float[] columnWidths = {30, 25, 25, 60, 60};
......@@ -161,6 +175,27 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
return uploadMinio(outputStream, "企业留档文件_" + taskId);
}
/**
* 获取企业留档文件数据
* @param taskId
* @return
*/
private EnterpriseFilePdfVO getEnterpriseFileData(Long taskId) {
List<SysDictData> dictDataList = dictDataMapper.selectDictDataByType("inspection_item");
EnterpriseFilePdfVO enterpriseFileData = taskMapper.selectEnterpriseFileData(taskId);
List<String> list = Arrays.asList(enterpriseFileData.getInspectionItem().split(","));
StringBuilder taskItem = new StringBuilder();
for (String item : list) {
Optional<SysDictData> first = dictDataList.stream().filter(data -> data.getDictValue().equals(item)).findFirst();
if (first.isPresent()) {
SysDictData dictData = first.get();
taskItem.append(dictData.getDictLabel()).append("、");
}
}
enterpriseFileData.setInspectionItem(taskItem.substring(0, taskItem.length() - 1));
return enterpriseFileData;
}
/**
* 上传到minio
* @param outputStream 输出流
......
......@@ -85,11 +85,11 @@ public class BookController extends BaseController {
response.setHeader("content-disposition","attachment;fileName="+"ReceiptPrinter.pdf");
try {
// demo-API渲染
bookService.generateItextPdfDocument(response.getOutputStream());
// bookService.generateItextPdfDocument(response.getOutputStream());
// demo-模板
// bookService.generateTempPDF(response);
// demo-动态表格
// bookService.testGeneratePDF(response.getOutputStream());
bookService.testGeneratePDF(response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
}
......
......@@ -282,5 +282,18 @@
where task_name = #{taskName}
</select>
<select id="selectEnterpriseFileData" resultType="com.ruoyi.domain.vo.EnterpriseFilePdfVO">
select
t.task_initiator_dept inspectionCenterName,
concat(s.standard_no, s.name) inspectionBasis,
t.task_list inspectionItem,
DATE_FORMAT(t.create_time, '%Y-%m-%d') createTime,
t.entrusted_unit clientName
from
t_task t
left join t_standard s on t.standard_id = s.id
where t.id = #{taskId}
</select>
</mapper>
......@@ -23,7 +23,7 @@ public class PdfBaseWriter extends Document{
/**
* 中文字体
*/
public final String FONT_NAME_ST_SONG_LIGHT = "STSong-Light";
public final String FONT_NAME_ST_SONG_LIGHT = "STSongStd-Light";
/**
* 中文字体编码
*/
......
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