From 359f1d48b1d859a23cd35a425d2cffb1e9d1c811 Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期五, 26 十二月 2025 19:58:59 +0800
Subject: [PATCH] 修改了对应代码
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java | 98 +++++++++++++++++++++++++++++++++++++++----------
1 files changed, 78 insertions(+), 20 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java
index ecf6382..56375d6 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/archiveAllExportController.java
@@ -6,11 +6,14 @@
import com.itextpdf.text.*;
import com.itextpdf.text.pdf.PdfPCell;
import com.ruoyi.common.config.RuoYiConfig;
+import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.poi.*;
+import com.ruoyi.domain.ArchiveProjectName;
import com.ruoyi.domain.ArchiveRecords;
import com.ruoyi.domain.DocumentMaterials;
import com.ruoyi.domain.vo.*;
+import com.ruoyi.service.IArchiveProjectNameService;
import com.ruoyi.service.IArchiveRecordsService;
import com.ruoyi.service.IDocumentMaterialsService;
import com.ruoyi.service.impl.BarcodeService;
@@ -53,7 +56,8 @@
private BarcodeService barcodeService;
@Autowired
private IDocumentMaterialsService documentMaterialsService;
-
+ @Autowired
+ private IArchiveProjectNameService iArchiveProjectNameService;
@Autowired
private IArchiveRecordsService iArchiveRecordsService;
@@ -330,7 +334,7 @@
String recordId = aIV.getRecordId();
byte[] imgr = barcodeService.generateBarcodeImage(recordId);
- byte[] sedcode = pdfGenerateService.createQrCodeN(recordId, 30, 30);
+ byte[] sedcode = pdfGenerateService.createQrCodeN(recordId, 100, 100);
ExcelExp e1 = new ExcelExp("妗堝嵎灏侀潰鏁版嵁",arsi, ArchiveInfoVo.class);
ExcelExp e2 = new ExcelExp("妗堝嵎灏侀潰", arsi, recordId, imgr,sedcode, ArchiveInfoVo.class);
List<ExcelExp> mysheet = new ArrayList<ExcelExp>();
@@ -561,13 +565,29 @@
{
for(DocumentMaterialFileStyle documentMaterialFileStyle:dmfs)
{
- if(documentMaterialFileStyle.getFileStyle().equals("鏂囧瓧鏉愭枡"))
+ if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("鏂囧瓧鏉愭枡"))
texPages = documentMaterialFileStyle.getCnt();
- if(documentMaterialFileStyle.getFileStyle().equals("鍥炬牱鏉愭枡"))
+ if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("鍥炬牱鏉愭枡"))
patPages = documentMaterialFileStyle.getCnt();
- if(documentMaterialFileStyle.getFileStyle().equals("鐓х墖鏉愭枡"))
+ if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("鐓х墖鏉愭枡"))
picPages = documentMaterialFileStyle.getCnt();
}
+ }
+
+
+ String compName = "骞垮窞鐩堝妗f绠$悊鏈夐檺鍏徃";
+ String li_person = "浠囩縺";
+ String sh_person = "鏇剧憺鑾�";
+ ArchiveRecords archiveRecords1 = iArchiveRecordsService.selectArchiveRecordsById(ids[i]);
+ ArchiveProjectName tmp = new ArchiveProjectName();
+ tmp.setName(archiveRecords1.getProjectName());
+ List<ArchiveProjectName> projectName = iArchiveProjectNameService.selectArchiveProjectNameList(tmp);
+ if(!projectName.isEmpty())
+ {
+ if(StringUtils.isEmpty(projectName.get(0).getCompanyName()))
+ compName = projectName.get(0).getCompanyName();
+ if(StringUtils.isEmpty(projectName.get(0).getCreatePerson()))
+ li_person = projectName.get(0).getCreatePerson();
}
allPages = texPages + picPages + patPages;
hs.put("pages", allPages);
@@ -575,6 +595,8 @@
hs.put("picPages", picPages);
hs.put("texPages", texPages);
hs.put("volumeNumber", aIV.getRecordId());
+ hs.put("company", compName);
+
hs.put("time", cdt);
if (!getLicense()) {
@@ -584,10 +606,16 @@
try {
- // 鑾峰彇 Word 妯℃澘鎵�鍦ㄨ矾寰�
- String filepath = "09-澶囪�冭〃.docx";
+ ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
+ org.springframework.core.io.Resource resource = resolver.getResource("classpath:09.docx");
+// String filepath = resource.getFile().getAbsolutePath();
+// // 閫氳繃 XWPFTemplate 缂栬瘧鏂囦欢骞舵覆鏌撴暟鎹埌妯℃澘涓�
+// XWPFTemplate template = XWPFTemplate.compile(filepath).render(hs
+// );
+
+ InputStream inputStream = resource.getInputStream();
// 閫氳繃 XWPFTemplate 缂栬瘧鏂囦欢骞舵覆鏌撴暟鎹埌妯℃澘涓�
- XWPFTemplate template = XWPFTemplate.compile(filepath).render(hs
+ XWPFTemplate template = XWPFTemplate.compile(inputStream).render(hs
);
String renderedDocPath = "rendered_output.docx";
@@ -631,7 +659,7 @@
String recordId1 = aIV.getRecordId();
byte[] imgr1 = barcodeService.generateBarcodeImage(recordId1);
- byte[] sedcode = pdfGenerateService.createQrCodeN(recordId1, 30, 30);
+ byte[] sedcode = pdfGenerateService.createQrCodeN(recordId1, 200, 200);
ExcelExp e3 = new ExcelExp("妗堝嵎灏侀潰鏁版嵁",arsi, ArchiveInfoVo.class);
ExcelExp e4 = new ExcelExp("妗堝嵎灏侀潰", arsi, recordId1, imgr1,sedcode, ArchiveInfoVo.class);
List<ExcelExp> mysheet1 = new ArrayList<ExcelExp>();
@@ -726,7 +754,7 @@
//鎷垮埌鍗峰唴鐩綍鐨別xcel
List<DocumentMaterialsVoSmall> list2 = dsvs.stream().map(res1 -> new DocumentMaterialsVoSmall(res1.getNum(), res1.getDocumentNumber(),res1.getCreator(),
- res1.getTitle(), res1.getDate(), res1.getPageNumber(), res1.getRemarks())).collect(Collectors.toList());
+ res1.getTitle(), res1.getDate(), res1.getPageNumberFormatted(), res1.getRemarks())).collect(Collectors.toList());
if(!dsvs.isEmpty()) {
String recordId = dsvs.get(0).getRecordId();
byte[] imgr = barcodeService.generateBarcodeImage(recordId);
@@ -1089,20 +1117,38 @@
{
for(DocumentMaterialFileStyle documentMaterialFileStyle:dmfs)
{
- if(documentMaterialFileStyle.getFileStyle().equals("鏂囧瓧鏉愭枡"))
+ if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("鏂囧瓧鏉愭枡"))
texPages = documentMaterialFileStyle.getCnt();
- if(documentMaterialFileStyle.getFileStyle().equals("鍥炬牱鏉愭枡"))
+ if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("鍥炬牱鏉愭枡"))
patPages = documentMaterialFileStyle.getCnt();
- if(documentMaterialFileStyle.getFileStyle().equals("鐓х墖鏉愭枡"))
+ if(documentMaterialFileStyle.getFileStyle()!=null&&documentMaterialFileStyle.getFileStyle().equals("鐓х墖鏉愭枡"))
picPages = documentMaterialFileStyle.getCnt();
}
}
+
+ String compName = "骞垮窞鐩堝妗f绠$悊鏈夐檺鍏徃";
+ String li_person = "浠囩縺";
+ String sh_person = "鏇剧憺鑾�";
+ ArchiveRecords archiveRecords = iArchiveRecordsService.selectArchiveRecordsById(id);
+ ArchiveProjectName tmp = new ArchiveProjectName();
+ tmp.setName(archiveRecords.getProjectName());
+ List<ArchiveProjectName> projectName = iArchiveProjectNameService.selectArchiveProjectNameList(tmp);
+ if(!projectName.isEmpty())
+ {
+ if(StringUtils.isEmpty(projectName.get(0).getCompanyName()))
+ compName = projectName.get(0).getCompanyName();
+ if(StringUtils.isEmpty(projectName.get(0).getCreatePerson()))
+ li_person = projectName.get(0).getCreatePerson();
+ }
+
allPages = texPages + picPages + patPages;
hs.put("pages", allPages);
hs.put("patPages", patPages);
hs.put("picPages", picPages);
hs.put("texPages", texPages);
hs.put("volumeNumber", aIV.getRecordId());
+ hs.put("company", compName);
+
hs.put("time", cdt);
if (!getLicense()) {
@@ -1113,10 +1159,22 @@
try {
// 鑾峰彇 Word 妯℃澘鎵�鍦ㄨ矾寰�
- String filepath = "09-澶囪�冭〃.docx";
- // 閫氳繃 XWPFTemplate 缂栬瘧鏂囦欢骞舵覆鏌撴暟鎹埌妯℃澘涓�
- XWPFTemplate template = XWPFTemplate.compile(filepath).render(hs
- );
+ ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
+ org.springframework.core.io.Resource resource = resolver.getResource("classpath:09.docx");
+// String filepath = resource.getFile().getAbsolutePath();
+// // 閫氳繃 XWPFTemplate 缂栬瘧鏂囦欢骞舵覆鏌撴暟鎹埌妯℃澘涓�
+// XWPFTemplate template = XWPFTemplate.compile(filepath).render(hs
+// );
+
+ InputStream inputStream = resource.getInputStream();
+ // 閫氳繃 XWPFTemplate 缂栬瘧鏂囦欢骞舵覆鏌撴暟鎹埌妯℃澘涓�
+ XWPFTemplate template = XWPFTemplate.compile(inputStream).render(hs
+ );
+
+
+
+
+
String renderedDocPath = "rendered_output.docx";
File renderedFile = new File(renderedDocPath);
@@ -1148,7 +1206,7 @@
- com.aspose.words.Document doc = new com.aspose.words.Document("09-澶囪�冭〃.docx");
+ // com.aspose.words.Document doc = new com.aspose.words.Document("09.docx");
@@ -1179,7 +1237,7 @@
String recordId1 = aIV.getRecordId();
byte[] imgr1 = barcodeService.generateBarcodeImage(recordId1);
- byte[] sedcode = pdfGenerateService.createQrCodeN(recordId1, 30, 30);
+ byte[] sedcode = pdfGenerateService.createQrCodeN(recordId1, 200, 200);
ExcelExp e3 = new ExcelExp("妗堝嵎灏侀潰鏁版嵁",arsi, ArchiveInfoVo.class);
ExcelExp e4 = new ExcelExp("妗堝嵎灏侀潰", arsi, recordId1, imgr1,sedcode, ArchiveInfoVo.class);
List<ExcelExp> mysheet1 = new ArrayList<ExcelExp>();
@@ -1271,7 +1329,7 @@
//鎷垮埌鍗峰唴鐩綍鐨別xcel
List<DocumentMaterialsVoSmall> list2 = dsvs.stream().map(res -> new DocumentMaterialsVoSmall(res.getNum(), res.getDocumentNumber(),res.getCreator(),
- res.getTitle(), res.getDate(), res.getPageNumber(), res.getRemarks())).collect(Collectors.toList());
+ res.getTitle(), res.getDate(), res.getPageNumberFormatted(), res.getRemarks())).collect(Collectors.toList());
String recordId = dsvs.get(0).getRecordId();
byte[] imgr = barcodeService.generateBarcodeImage(recordId);
--
Gitblit v1.9.1