Commit 9cba1ab3 authored by 盖献康's avatar 盖献康

Merge branch 'gaixiankang' into 'dev'

原始记录PDF

See merge request !282
parents 2c624f7c 9587d7ba
......@@ -22,4 +22,12 @@ public interface PdfTemplateManagementService {
* @throws Exception
*/
String generateRetentionFile(Long taskId) throws Exception;
/**
* 原始记录PDF下载
* @param taskId
* @return
*/
String generateOriginalRecord(Long taskId);
}
......@@ -259,6 +259,39 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
return uploadMinio(outputStream, "企业留档文件-" + getReportName());
}
/**
* 原始记录PDF下载
* @param taskId
* @return
*/
@Override
public String generateOriginalRecord(Long taskId) {
return null;
}
public static class OriginalRecordHeaderFooter extends PdfPageEventHelper {
// 一页加载完成触发,写入页眉和页脚
@Override
public void onEndPage(PdfWriter writer, Document document) {
PdfPTable table = new PdfPTable(2);
try {
table.setTotalWidth(PageSize.A4.getWidth() - 80);
table.setWidths(new int[] { 40, 40 });
table.setLockedWidth(true);
table.getDefaultCell().setFixedHeight(-10);
table.getDefaultCell().setBorder(Rectangle.BOTTOM);
table.getDefaultCell().setBorderWidth(0.6f);
BaseFont font = BaseFont.createFont("/fonts/STSong.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
table.addCell(new Paragraph(headerText, new Font(font)));// 可以直接使用addCell(str),不过不能指定字体,中文无法显示
// 将页眉写到document中,位置可以指定,指定到下面就是页脚
table.writeSelectedRows(0, -1, 40, PageSize.A4.getHeight() - 20, writer.getDirectContent());
} catch (Exception de) {
throw new ExceptionConverter(de);
}
}
}
private static String headerText;
public static class MyHeaderFooter extends PdfPageEventHelper {
......
......@@ -100,6 +100,8 @@ public class PdfTemplateManagementController {
url = task.getModelTestUrl();
if (StrUtil.isBlank(url)) {
// TODO 生成车型
url = pdfTemplateManagementService.generateOriginalRecord(request.getTaskId());
taskService.update(new UpdateWrapper<Task>().lambda().eq(Task::getId, request.getTaskId()).set(Task::getModelTestTaskId, url));
}
break;
default:
......@@ -136,7 +138,8 @@ public class PdfTemplateManagementController {
break;
case 2:
// 更新
// TODO 更新车型
url = pdfTemplateManagementService.generateOriginalRecord(request.getTaskId());
taskService.update(new UpdateWrapper<Task>().lambda().eq(Task::getId, request.getTaskId()).set(Task::getModelTestTaskId, url));
break;
default:
break;
......
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