|
@@ -41,9 +41,7 @@ import org.springblade.archive.dto.SaveApplyDTO;
|
|
|
import org.springblade.archive.entity.*;
|
|
|
import org.springblade.archive.mapper.ArchiveConclusionMapper;
|
|
|
import org.springblade.archive.service.*;
|
|
|
-import org.springblade.archive.utils.ArchiveTreeUtil;
|
|
|
-import org.springblade.archive.utils.FileTransJavaDemo;
|
|
|
-import org.springblade.archive.utils.FileUtils;
|
|
|
+import org.springblade.archive.utils.*;
|
|
|
import org.springblade.archive.vo.*;
|
|
|
import org.springblade.archive.mapper.ArchivesAutoMapper;
|
|
|
import org.springblade.business.entity.ArchiveFile;
|
|
@@ -2941,48 +2939,42 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
|
|
|
//生成验收申请PDF
|
|
|
private String createAppPdf(String projectName, List<ArchivesAutoVO2> vo2s) throws Exception {
|
|
|
- String fileUrl = "C:\\Users\\泓创研发01\\Desktop\\appPDF.pdf";
|
|
|
+ String fileUrl = "/www/wwwroot/Users/hongchuangyanfa/Desktop/archiveCheck/appPDF.pdf";
|
|
|
//新建一个pdf文档对象,前一个参数是纸张大小,后四个为边距
|
|
|
Document document = new Document(PageSize.A4, 5, 5, 30, 30);
|
|
|
+ //创建字体
|
|
|
+// BaseFont baseFont =BaseFont.createFont("C:/WINDOWS/Fonts/simsun.ttc,0", BaseFont.IDENTITY_H,BaseFont.NOT_EMBEDDED);
|
|
|
+ BaseFont baseFont =BaseFont.createFont("/usr/share/fonts/chinese/simsun.ttc,0", BaseFont.IDENTITY_H,BaseFont.NOT_EMBEDDED);
|
|
|
+ //字体对象,这里可以创建一个方法
|
|
|
+ Font size10font = new Font(baseFont, 13, Font.NORMAL); //大小为10的正常字体
|
|
|
+ Font size17font = new Font(baseFont, 17, Font.BOLD); //大小为17的正常字体
|
|
|
//建立一个书写器
|
|
|
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(fileUrl));
|
|
|
+ MyPdfPageHelper2 helper = new MyPdfPageHelper2(baseFont,size10font,size17font,projectName);
|
|
|
+ writer.setPageEvent(helper);
|
|
|
document.open();
|
|
|
- //创建字体
|
|
|
- BaseFont baseFont = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
|
|
|
- //字体对象,这里可以创建一个方法
|
|
|
- Font size10font = new Font(baseFont, 10, Font.NORMAL); //大小为10的正常字体
|
|
|
- Font size17font = new Font(baseFont, 17, Font.NORMAL); //大小为17的正常字体
|
|
|
//该数组是每个表格的宽度
|
|
|
float[] floats = new float[6];
|
|
|
- floats[0] = 0.1f;
|
|
|
- floats[1] = 0.1f;
|
|
|
- floats[2] = 0.5f;
|
|
|
- floats[3] = 0.1f;
|
|
|
- floats[4] = 0.1f;
|
|
|
- floats[5] = 0.1f;
|
|
|
- tableHeader(projectName,document,size10font,size17font,floats);
|
|
|
+ floats[0] = 0.09f;
|
|
|
+ floats[1] = 0.14f;
|
|
|
+ floats[2] = 0.48f;
|
|
|
+ floats[3] = 0.09f;
|
|
|
+ floats[4] = 0.11f;
|
|
|
+ floats[5] = 0.09f;
|
|
|
|
|
|
//将数据放入表格中
|
|
|
- int total = 0;
|
|
|
for (int i = 0; i < vo2s.size(); i++) {
|
|
|
ArchivesAutoVO2 vo2 = vo2s.get(i);
|
|
|
PdfPTable dataTable = new PdfPTable(6);
|
|
|
dataTable.setWidthPercentage(widthPercentage);
|
|
|
dataTable.setTotalWidth(floats);
|
|
|
- dataTable.addCell(pdfTableStyle(i+1+"", size10font, high, true, true));
|
|
|
- dataTable.addCell(pdfTableStyle(vo2.getFileNumber(), size10font, high, true, true));
|
|
|
- dataTable.addCell(pdfTableStyle(" "+vo2.getName(), size10font, high, false, false));
|
|
|
- dataTable.addCell(pdfTableStyle(vo2.getPageN()+"", size10font, high, true, true));
|
|
|
- dataTable.addCell(pdfTableStyle(vo2.getStorageTimeValue(), size10font, high, true, true));
|
|
|
- dataTable.addCell(pdfTableStyle(vo2.getRemark(), size10font, high, true, true));
|
|
|
- total += (int)Math.ceil(new Double(vo2.getName().length()+4) / 50);
|
|
|
- //如果出现不相同,则合并之前的
|
|
|
+ dataTable.addCell(ItextPdfUtils.pdfTableStyle11(i+1+"", size10font, 30, true, true));
|
|
|
+ dataTable.addCell(ItextPdfUtils.pdfTableStyle11(vo2.getFileNumber(), size10font, 30, true, true));
|
|
|
+ dataTable.addCell(ItextPdfUtils.pdfTableStyle12(vo2.getName(), size10font, 30, false, true));
|
|
|
+ dataTable.addCell(ItextPdfUtils.pdfTableStyle11(vo2.getPageN()+"", size10font, 30, true, true));
|
|
|
+ dataTable.addCell(ItextPdfUtils.pdfTableStyle11(vo2.getStorageTimeValue(), size10font, 30, true, true));
|
|
|
+ dataTable.addCell(ItextPdfUtils.pdfTableStyle11(vo2.getRemark(), size10font, 30, true, true));
|
|
|
document.add(dataTable);
|
|
|
- if (total >= 40 && i != (vo2s.size()-1)) {
|
|
|
- total = 0;
|
|
|
- document.newPage();
|
|
|
- tableHeader(projectName,document,size10font,size17font,floats);
|
|
|
- }
|
|
|
}
|
|
|
document.close();
|
|
|
writer.close();
|
|
@@ -2993,46 +2985,6 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
return bladeFile.getLink();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 表头
|
|
|
- * @param document 整个文档
|
|
|
- * @param size10font
|
|
|
- * @param size17font
|
|
|
- * @param floats 表头格式
|
|
|
- * @throws DocumentException
|
|
|
- */
|
|
|
- void tableHeader(String projectName,Document document,Font size10font,Font size17font,float[] floats) throws DocumentException {
|
|
|
- //添加标题
|
|
|
- //创建第一行表格
|
|
|
- PdfPTable tableName = new PdfPTable(1);
|
|
|
- tableName.setWidthPercentage(widthPercentage); //设置标题长度占纸张比例
|
|
|
- PdfPCell cell = pdfTableStyle("单位科学技术档案归档目录", size17font, 50, true, true);
|
|
|
- cell.disableBorderSide(15);
|
|
|
- //给表格赋值
|
|
|
- tableName.addCell(cell);
|
|
|
- //将表格添加到文档对象中
|
|
|
- document.add(tableName);
|
|
|
- //项目名称
|
|
|
- PdfPTable two = new PdfPTable(1);
|
|
|
- two.setWidthPercentage(widthPercentage);
|
|
|
- PdfPCell cell2 = pdfTableStyle("项目名称:"+projectName, size10font, 20, false, false);
|
|
|
- cell2.disableBorderSide(15);
|
|
|
- two.addCell(cell2);
|
|
|
- document.add(two);
|
|
|
- //表头文字
|
|
|
- String[] name = new String[]{"序号", "档号", "案卷提名", "总页数","保管期限","备注"};
|
|
|
- //创建第二行,并设置第二行中的表格数
|
|
|
- PdfPTable twoTable = new PdfPTable(name.length);
|
|
|
- twoTable.setWidthPercentage(widthPercentage);
|
|
|
- //循环将表头数据添加到第二行表格中
|
|
|
- for (int i = 0; i < name.length; i++) {
|
|
|
- PdfPCell pdfPCell = pdfTableStyle(name[i], size10font, high, true, true);
|
|
|
- twoTable.addCell(pdfPCell);
|
|
|
- }
|
|
|
- //设置表格的宽度
|
|
|
- twoTable.setTotalWidth(floats);
|
|
|
- document.add(twoTable);
|
|
|
- }
|
|
|
|
|
|
@Override
|
|
|
public R<Boolean> batchUpdateIsApply(Integer isApply, List<Long> ids) {
|
|
@@ -3094,12 +3046,16 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
@Override
|
|
|
public IPage<ArchiveInspectVO> getNodeArchives(Query query,Long nodeId,Long projectId,Integer searchType,String searchValue,Integer type) {
|
|
|
IPage<ArchiveInspectVO> page = new Page<>(query.getCurrent(),query.getSize());
|
|
|
+ ArchiveExpertConclusion one = expertConclusionService.getOne(new LambdaUpdateWrapper<ArchiveExpertConclusion>()
|
|
|
+ .eq(ArchiveExpertConclusion::getProjectId, projectId)
|
|
|
+ .orderByDesc(ArchiveExpertConclusion::getCreateTime)
|
|
|
+ .last("limit 1"));
|
|
|
if (type == 1){
|
|
|
//查询所有的,树不加id,档案状态加
|
|
|
- return baseMapper.getNodeArchives(page,nodeId,projectId,searchType,searchValue,AuthUtil.getUserId());
|
|
|
+ return baseMapper.getNodeArchives(page,nodeId,projectId,searchType,searchValue,AuthUtil.getUserId(),one.getId());
|
|
|
}else {
|
|
|
//查询专家的,树加id,档案状态加
|
|
|
- return baseMapper.getNodeArchives2(page,nodeId,projectId,searchType,searchValue,AuthUtil.getUserId());
|
|
|
+ return baseMapper.getNodeArchives2(page,nodeId,projectId,searchType,searchValue,AuthUtil.getUserId(),one.getId());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -3117,7 +3073,12 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
}
|
|
|
map.put("total",t1+"");
|
|
|
//获取用户归属档案所有已阅总数
|
|
|
- Integer t2 = baseMapper.getUserReviewedTotal(projectId, userId);
|
|
|
+ //获取最新一期抽检
|
|
|
+ ArchiveExpertConclusion one = expertConclusionService.getOne(new LambdaUpdateWrapper<ArchiveExpertConclusion>()
|
|
|
+ .eq(ArchiveExpertConclusion::getProjectId, projectId)
|
|
|
+ .orderByDesc(ArchiveExpertConclusion::getCreateTime)
|
|
|
+ .last("limit 1"));
|
|
|
+ Integer t2 = baseMapper.getUserReviewedTotal(projectId, userId,one.getId());
|
|
|
if (t2 == null){
|
|
|
t2 = 0;
|
|
|
}
|
|
@@ -3602,32 +3563,4 @@ public class ArchivesAutoServiceImpl extends BaseServiceImpl<ArchivesAutoMapper,
|
|
|
process.waitFor();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 表格的样式
|
|
|
- *
|
|
|
- * @param content 内容
|
|
|
- * @param font 字体对象
|
|
|
- * @param high 表格高度
|
|
|
- * @return
|
|
|
- * @Param isAlignCenter 是否水平居中
|
|
|
- * @Param isAlignMidde 是否垂直居中
|
|
|
- */
|
|
|
- static PdfPCell pdfTableStyle(String content, Font font, int high, boolean isAlignCenter, boolean isAlignMiddle) {
|
|
|
- Paragraph phrase = new Paragraph(content, font);
|
|
|
-// phrase.setAlignment(Paragraph.ALIGN_LEFT);
|
|
|
- PdfPCell pdfPCell = new PdfPCell(phrase);
|
|
|
- pdfPCell.setMinimumHeight(high);
|
|
|
- pdfPCell.setUseAscender(true); // 设置可以居中
|
|
|
- if (isAlignCenter) {
|
|
|
- pdfPCell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER); // 设置水平居中
|
|
|
- }else {
|
|
|
- pdfPCell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT); // 设置首行
|
|
|
- }
|
|
|
- if (isAlignMiddle) {
|
|
|
- pdfPCell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); // 设置垂直居中
|
|
|
- }else {
|
|
|
- pdfPCell.setVerticalAlignment(PdfPCell.ALIGN_LEFT); // 设置垂直居中
|
|
|
- }
|
|
|
- return pdfPCell;
|
|
|
- }
|
|
|
}
|