From 2f1ae9c10a1751438d09b3d848677deb883631aa Mon Sep 17 00:00:00 2001
From: fei <791364011@qq.com>
Date: 星期三, 14 一月 2026 11:28:16 +0800
Subject: [PATCH] 修改了对应代码

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java |  388 +++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 346 insertions(+), 42 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java
index 9412e5e..096deb8 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/archive/DocumentMaterialsController.java
@@ -8,15 +8,20 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.util.*;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 import java.util.zip.ZipEntry;
 import javax.imageio.ImageIO;
 import javax.servlet.http.HttpServletResponse;
 
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
 import com.aspose.words.License;
 import com.deepoove.poi.XWPFTemplate;
 import com.drew.imaging.ImageMetadataReader;
@@ -25,17 +30,20 @@
 import com.ruoyi.common.config.RuoYiConfig;
 import com.ruoyi.common.core.text.Convert;
 import com.ruoyi.common.utils.ServletUtils;
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.file.FileUploadUtils;
 import com.ruoyi.common.utils.file.FileUtils;
 import com.ruoyi.common.utils.poi.ExcelExp;
 import com.ruoyi.common.utils.poi.ExcelUtilManySheet;
 import com.ruoyi.common.utils.poi.ExcelUtilManySheetSecond;
 import com.ruoyi.domain.ArchiveCategory;
+import com.ruoyi.domain.ArchiveProjectName;
 import com.ruoyi.domain.ArchiveRecords;
 import com.ruoyi.domain.DocumentMaterials;
 import com.ruoyi.domain.vo.*;
 import com.ruoyi.framework.config.ServerConfig;
 import com.ruoyi.framework.web.domain.server.Sys;
+import com.ruoyi.service.IArchiveProjectNameService;
 import com.ruoyi.service.IArchiveRecordsService;
 import com.ruoyi.service.IDocumentMaterialsService;
 import com.ruoyi.service.impl.BarcodeService;
@@ -61,6 +69,7 @@
 
 import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM;
 import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE;
+import static com.ruoyi.framework.datasource.DynamicDataSourceContextHolder.log;
 
 /**
  * 銆愭枃浠舵潗鏂欑患鍚堜俊鎭�慍ontroller
@@ -73,6 +82,8 @@
 public class DocumentMaterialsController extends BaseController
 {
     @Autowired
+    private IArchiveProjectNameService iArchiveProjectNameService;
+    @Autowired
     private BarcodeService barcodeService;
     @Autowired
     private ServerConfig serverConfig;
@@ -83,6 +94,11 @@
 
     @Autowired
     private IArchiveRecordsService iArchiveRecordsService;
+    
+    /**
+     * 鏂囦欢鍒嗛殧绗�
+     */
+    private static final String FILE_DELIMETER = ",";
     /**
      * 鍒ゆ柇PageNumber鏄惁杩炵画
      */
@@ -161,6 +177,8 @@
             list = documentMaterialsService.selectDocumentMaterialsList(documentMaterials);
 
         }
+
+
         ExcelUtil<DocumentMaterials> util = new ExcelUtil<DocumentMaterials>(DocumentMaterials.class);
         util.exportExcel(response, list, "鐢靛瓙鏂囦欢鐩綍");
     }
@@ -170,41 +188,47 @@
     @PostMapping("/exportDir")
     public void exportDir(HttpServletResponse response, DocumentMaterials documentMaterials, @RequestParam(value = "ids", required = false) Long[] ids)
     {
-        List<DocumentMaterials> list;
-        System.out.println(ids);
-        // 濡傛灉鎻愪緵浜唅ds鍙傛暟锛屽垯鏍规嵁ids瀵煎嚭鎸囧畾璁板綍
-        if (ids != null && ids.length > 0) {
-            list = documentMaterialsService.selectDocumentMaterialsByIds(ids);
-        } else {
-            list = documentMaterialsService.selectDocumentMaterialsList(documentMaterials);
+        ArchiveRecords archiveRecords = iArchiveRecordsService.selectArchiveRecordsById(documentMaterials.getRecordId());
+        List<DocumentMaterialsVoMid> dsvs = documentMaterialsService.findArchMInfoAll(documentMaterials.getRecordId().toString(), archiveRecords.getPageCount());
 
-        }
-        // 鏍规嵁visible瀛楁绛涢�夛紝鍙繚鐣檝isible涓�1鐨勮褰�
-        List<DocumentMaterials> filteredList = list.stream()
-                .filter(doc -> doc.getVisible() != null && doc.getVisible() == 1 && !Objects.equals(doc.getFileStyle(), "鍏朵粬鏉愭枡"))
-                .collect(Collectors.toList());
-        
-        // 浣跨敤AtomicLong瀹炵幇搴忓彿鐨勯�掑
-        AtomicLong nm = new AtomicLong(1L);
-        // 灏嗙瓫閫夊悗鐨凞ocumentMaterials杞崲涓篋ocumentMaterialsVo
-        List<DocumentMaterialsVoSmall> list1 = filteredList.stream().map(doc -> {
-            DocumentMaterialsVoSmall vo = new DocumentMaterialsVoSmall();
-            // 鎵嬪姩鏄犲皠瀛楁锛屼娇鐢╣etAndIncrement()鏂规硶鑾峰彇褰撳墠鍊煎苟閫掑
-            vo.setNum(nm.getAndIncrement());
+//        List<DocumentMaterialsVoSmall> list2 = dsvs.stream().map(res1 -> new DocumentMaterialsVoSmall(res1.getNum(), res1.getDocumentNumber(),res1.getCreator(),
+//                res1.getTitle(), res1.getDate(), res1.getPageNumberFormatted(), res1.getRemarks())).collect(Collectors.toList());
 
-            vo.setDocumentNumber(doc.getDocumentNumber());
-            vo.setCreator(doc.getCreator());
-            vo.setTitle(doc.getTitle());
-            vo.setDate(doc.getDate());
-            vo.setPageNumber(doc.getPageNumber());
-            vo.setRemarks(doc.getRemarks());
-//            vo.setRecordId(doc.getRecordId() != null ? doc.getRecordId().toString() : null);
-//            vo.setPublicity(doc.getPublicity());
-            return vo;
-        }).collect(Collectors.toList());
+//        List<DocumentMaterials> list;
+//        System.out.println(ids);
+//        // 濡傛灉鎻愪緵浜唅ds鍙傛暟锛屽垯鏍规嵁ids瀵煎嚭鎸囧畾璁板綍
+//        if (ids != null && ids.length > 0) {
+//            list = documentMaterialsService.selectDocumentMaterialsByIds(ids);
+//        } else {
+//            list = documentMaterialsService.selectDocumentMaterialsList(documentMaterials);
+//
+//        }
+//        // 鏍规嵁visible瀛楁绛涢�夛紝鍙繚鐣檝isible涓�1鐨勮褰�
+//        List<DocumentMaterials> filteredList = list.stream()
+//                .filter(doc -> doc.getVisible() != null && doc.getVisible() == 1 && !Objects.equals(doc.getFileStyle(), "鍏朵粬鏉愭枡"))
+//                .collect(Collectors.toList());
+//
+//        // 浣跨敤AtomicLong瀹炵幇搴忓彿鐨勯�掑
+//        AtomicLong nm = new AtomicLong(1L);
+//        // 灏嗙瓫閫夊悗鐨凞ocumentMaterials杞崲涓篋ocumentMaterialsVo
+//        List<DocumentMaterialsVoSmall> list1 = filteredList.stream().map(doc -> {
+//            DocumentMaterialsVoSmall vo = new DocumentMaterialsVoSmall();
+//            // 鎵嬪姩鏄犲皠瀛楁锛屼娇鐢╣etAndIncrement()鏂规硶鑾峰彇褰撳墠鍊煎苟閫掑
+//            vo.setNum(nm.getAndIncrement());
+//
+//            vo.setDocumentNumber(doc.getDocumentNumber());
+//            vo.setCreator(doc.getCreator());
+//            vo.setTitle(doc.getTitle());
+//            vo.setDate(doc.getDate());
+//            vo.setPageNumberFormatted(doc.getPageNumber().toString());
+//            vo.setRemarks(doc.getRemarks());
+////            vo.setRecordId(doc.getRecordId() != null ? doc.getRecordId().toString() : null);
+////            vo.setPublicity(doc.getPublicity());
+//            return vo;
+//        }).collect(Collectors.toList());
         
-        ExcelUtil<DocumentMaterialsVoSmall> util = new ExcelUtil<DocumentMaterialsVoSmall>(DocumentMaterialsVoSmall.class);
-        util.exportExcel(response, list1, "鍗峰唴鐩綍");
+        ExcelUtil<DocumentMaterialsVoMid> util = new ExcelUtil<DocumentMaterialsVoMid>(DocumentMaterialsVoMid.class);
+        util.exportExcel(response, dsvs, "鍗峰唴鐩綍");
     }
 
    // List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo(id.toString());
@@ -259,13 +283,13 @@
 
     public String getPageSize(double du)
     {
-        if(du <= 8699840)
+        if(du <= 8699840 * 1.5)
             return "A4";
-        else if(du <= 17403188)
+        else if(du <= 17403188 * 1.5)
             return "A3";
-        else if(du <= 34811347)
+        else if(du <= 34811347 * 1.5)
             return "A2";
-        else if(du <= 69622674)
+        else if(du <= 69622674 * 1.5)
             return "A1";
         else
             return "A0";
@@ -452,6 +476,37 @@
     {
         //09-澶囪�冭〃.pdf
         String pdf09Path = "09-澶囪�冭〃.pdf";
+
+        //鏍规嵁椤圭洰鍚嶇О鎷垮埌鍏徃鍚嶇О鍜岄」鐩礋璐d汉
+
+        String compName = "骞垮窞鐩堝妗f绠$悊鏈夐檺鍏徃";
+        String li_person = "浠囩縺";
+        String sh_person = "鏇剧憺鑾�";
+
+        ArchiveRecords archiveRecords = iArchiveRecordsService.selectArchiveRecordsById(id);
+        if(!StringUtils.isEmpty(archiveRecords.getLiPerson()))
+            li_person = archiveRecords.getLiPerson();
+        String note_remark = "";
+        if(!StringUtils.isEmpty(archiveRecords.getNoteRemark()))
+            note_remark = "锛�"+archiveRecords.getNoteRemark();
+        System.out.println(note_remark+"{{{{");
+        ArchiveProjectName tmp = new ArchiveProjectName();
+        tmp.setName(archiveRecords.getProjectName());
+        List<ArchiveProjectName> projectName = iArchiveProjectNameService.selectArchiveProjectNameList(tmp);
+        if(!projectName.isEmpty())
+        {
+            System.out.println(projectName.get(0).getCompanyName());
+            if(!StringUtils.isEmpty(projectName.get(0).getCompanyName()))
+                compName = projectName.get(0).getCompanyName();
+            if(!StringUtils.isEmpty(projectName.get(0).getCreatePerson()))
+                sh_person = projectName.get(0).getCreatePerson();
+
+            System.out.println(compName+"--+"+sh_person);
+
+        }
+
+
+        System.out.println(compName+"--+"+sh_person);
         //  pdfGenerateService.generateFileStyleInfo(pdf09Path, aIV.getRecordId(), id);
         //鎷垮埌鐩稿叧鏁版嵁
         List<DocumentMaterialFileStyle> dmfs = documentMaterialsService.findFileStyleInfo(Math.toIntExact(id));
@@ -484,6 +539,10 @@
         hs.put("picPages", picPages);
         hs.put("texPages", texPages);
         hs.put("volumeNumber", recordId);
+        hs.put("company", compName);
+        hs.put("liPerson", li_person);
+        hs.put("shPerson", sh_person);
+        hs.put("noteRemark", note_remark);
         hs.put("time", cdt);
 
         if (!getLicense()) {
@@ -494,9 +553,21 @@
         try {
 
             // 鑾峰彇 Word 妯℃澘鎵�鍦ㄨ矾寰�
-            String filepath = "09-澶囪�冭〃.docx";
+//            String filepath = "09-澶囪�冭〃.docx";
+//            // 閫氳繃 XWPFTemplate 缂栬瘧鏂囦欢骞舵覆鏌撴暟鎹埌妯℃澘涓�
+//            XWPFTemplate template = XWPFTemplate.compile(filepath).render(hs
+//            );
+            // 鑾峰彇 Word 妯℃澘鎵�鍦ㄨ矾寰�
+            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";
@@ -526,11 +597,13 @@
     @PostMapping("/exportJuan/{id}")
 
     public void exportJuanInfo(HttpServletResponse response, @PathVariable Long id) throws IOException {
-        List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo(id.toString());
+
+        ArchiveRecords archiveRecords = iArchiveRecordsService.selectArchiveRecordsById(id);
+        List<DocumentMaterialsVo> dsvs = documentMaterialsService.findArchMInfo(id.toString(), archiveRecords.getPageCount());
 
         //鎷垮埌鍗峰唴鐩綍鐨別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);
@@ -556,7 +629,7 @@
 
     //瀵煎嚭妗堝嵎灏侀潰
     @PostMapping("/exportPageInfo/{id}/{recordId}")
-    public void exportPageInfo(HttpServletResponse response, @PathVariable Long id, @PathVariable String recordId) throws IOException {
+    public void exportPageInfo(HttpServletResponse response, @PathVariable Long id, @PathVariable String recordId) throws IOException, ParseException {
 
         ArchiveInfoVo aIV = iArchiveRecordsService.selectByRecordId(id);
 
@@ -564,8 +637,31 @@
         arsi.add(aIV);
 
         String recordId1 = recordId;
+        if(aIV!=null)
+        {
+            String date = "";
+            if(arsi.get(0).getPreparationDate()!=null) {
+                System.out.println(arsi.get(0).getPreparationDate().toString() + "]]]]]]]]");
+
+                System.out.println(DateUtil.parseCST(arsi.get(0).getPreparationDate().toString()));
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                DateTime dat = DateUtil.parseCST(arsi.get(0).getPreparationDate().toString());
+                date = new SimpleDateFormat("yyyy-MM-dd").format(dat);
+            }
+
+
+            String tmp = "妗e彿:" +
+                arsi.get(0).getRecordId() +
+                ";妗f棣嗭紙瀹わ級鍙�:" + arsi.get(0).getArchiveRoomNumber()+
+                ";缂╁井鍙�:" + arsi.get(0).getMicrofilmNumber()+
+                ";鍙戞枃鍙�:" + arsi.get(0).getInquiryNumber()+
+                ";妗堝嵎棰樺悕:" + arsi.get(0).getCaseTitle() +
+                ";缂栧埗鏃ユ湡:" +  date +
+                ";缂栧埗鍗曚綅:" + arsi.get(0).getPreparationUnit() +
+                ";淇濈鏈熼檺:" + arsi.get(0).getRetentionPeriod() +
+                ";瀵嗙骇:" + arsi.get(0).getSecurityClassification();
         byte[] imgr1 = barcodeService.generateBarcodeImage(recordId1);
-        byte[] sedcode = pdfGenerateService.createQrCodeN(recordId1, 200, 200);
+        byte[] sedcode = pdfGenerateService.createQrCodeN(tmp, 210, 210);
         ExcelExp e3 = new ExcelExp("妗堝嵎灏侀潰鏁版嵁",arsi, ArchiveInfoVo.class);
         ExcelExp e4 = new ExcelExp("妗堝嵎灏侀潰",  arsi, recordId1, imgr1,sedcode, ArchiveInfoVo.class);
         List<ExcelExp> mysheet1 = new ArrayList<ExcelExp>();
@@ -578,8 +674,216 @@
 
         //  System.out.println(bos2);
         bos2.writeTo(response.getOutputStream());
+        }
 
     }
 
+    @PreAuthorize("@ss.hasPermi('system:materials:list')")
+    @GetMapping("/getFileCounts/{recordId}")
+    public AjaxResult getFileCounts(@PathVariable("recordId") Integer recordId) throws IOException {
+        //涓婁紶鐨勬椂鍊欏垽鏂渶澶氬彧鑳戒笂浼犲灏戜釜
+        // 涓婁紶鏂囦欢璺緞
+        String filePath = RuoYiConfig.getUploadPath();
+        AjaxResult ajax = AjaxResult.success();
+        String path = filePath + File.separator + recordId;
+        File desc = new File(filePath + File.separator + recordId);
+        System.out.println("44444444444444456666666666666666");
+        if (!desc.exists())
+        {
+            ajax.put("length", 0);
+//                ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
+//                ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
+//                ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
+            return ajax;
+        }
+
+
+        Map<String, String> fileMap = new HashMap<>();
+        try (Stream<Path> paths = Files.walk(Paths.get(path))) {
+            fileMap = paths
+                    .filter(Files::isRegularFile)
+                    .collect(Collectors.toMap(
+                            // Key: 鏂囦欢鍚嶅墠缂�锛堜笉甯︽墿灞曞悕锛�
+                            Path -> {
+                                String fileNam = Path.getFileName().toString();
+                                int dotIndex = fileNam.lastIndexOf('.');
+                                return dotIndex > 0 ? fileNam.substring(0, dotIndex) : fileNam;
+                            },
+                            // Value: 鏂囦欢鍏ㄨ矾寰�
+                            Path::toString,
+                            // 澶勭悊閲嶅閿殑鎯呭喌锛堝鏋滄湁鐩稿悓鍓嶇紑鐨勬枃浠讹級
+                            (existing, replacement) -> existing
+                    ));
+            System.out.println(fileMap);
+
+            ajax.put("length", fileMap.size());
+//                ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
+//                ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
+//                ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
+            return ajax;
+        }
+    }
+    @PostMapping("/uploads/{recordId}")
+    public AjaxResult uploadFiles(MultipartFile file, @PathVariable Long recordId) throws Exception {
+        try {
+
+            //涓婁紶鐨勬椂鍊欏垽鏂渶澶氬彧鑳戒笂浼犲灏戜釜
+            // 涓婁紶鏂囦欢璺緞
+            String filePath = RuoYiConfig.getUploadPath();
+
+            String path = filePath + File.separator + recordId;
+            File desc = new File(filePath + File.separator + recordId);
+            System.out.println("44444444444444456666666666666666");
+            if (!desc.exists())
+            {
+                System.out.println("4444444444444445688888666666666666666");
+                System.out.println(desc.getParentFile().exists());
+                if (!desc.exists())
+                {
+                    desc.mkdirs();
+                }
+            }
+
+            String fileName = FileUploadUtils.uploadImg(filePath + File.separator + recordId, file);
+            List<String> urls = new ArrayList<>();
+            List<String> fileNames = new ArrayList<>();
+            List<String> newFileNames = new ArrayList<>();
+            List<String> originalFilenames = new ArrayList<>();
+            Map<String, String> fileMap = new HashMap<>();
+            try (Stream<Path> paths = Files.walk(Paths.get(path))) {
+         fileMap = paths
+                        .filter(Files::isRegularFile)
+                        .collect(Collectors.toMap(
+                                // Key: 鏂囦欢鍚嶅墠缂�锛堜笉甯︽墿灞曞悕锛�
+                                Path -> {
+                                    String fileNam = Path.getFileName().toString();
+                                    int dotIndex = fileNam.lastIndexOf('.');
+                                    return dotIndex > 0 ? fileNam.substring(0, dotIndex) : fileNam;
+                                },
+                                // Value: 鏂囦欢鍏ㄨ矾寰�
+                                Path::toString,
+                                // 澶勭悊閲嶅閿殑鎯呭喌锛堝鏋滄湁鐩稿悓鍓嶇紑鐨勬枃浠讹級
+                                (existing, replacement) -> existing
+                        ));
+                System.out.println(fileMap);
+                AjaxResult ajax = AjaxResult.success();
+                ajax.put("length", file.getSize());
+//                ajax.put("fileNames", StringUtils.join(fileNames, FILE_DELIMETER));
+//                ajax.put("newFileNames", StringUtils.join(newFileNames, FILE_DELIMETER));
+//                ajax.put("originalFilenames", StringUtils.join(originalFilenames, FILE_DELIMETER));
+                return ajax;
+            }
+                //璇诲彇
+            //
+//
+//            // 鎵归噺澶勭悊鏂囦欢涓婁紶
+//            for (MultipartFile file : files) {
+//                // 鏍规嵁鏂囦欢鍚嶇О锛岀劧鍚庝慨鏀瑰搴旀暟鎹殑url
+//                String fname = file.getOriginalFilename();
+//                if (StringUtils.isBlank(fname)) {
+//                    continue;
+//                }
+//
+//                // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О
+//                String fileName = FileUploadUtils.upload(filePath, file);
+//                String url = serverConfig.getUrl() + fileName;
+//
+//                // 鍒嗗壊鏂囦欢鍚�
+//                String[] nams = fname.split("\\.");
+//                if (nams.length < 2) {
+//                    continue;
+//                }
+//
+//                Long nam = Long.parseLong(nams[0]);
+//
+//                // 鏍规嵁椤靛彿鎷垮埌妗堝嵎鐨勮缁嗕俊鎭�
+//                DocumentMaterials doc = documentMaterialsService.selectByPageNumber(nam, Math.toIntExact(recordId));
+//                if (doc != null) {
+//                    if (doc.getSecurityLevel() != null && (doc.getSecurityLevel().equals("璇ラ〉鍙﹀瓨")||
+//                            doc.getSecurityLevel().equals("绉樺瘑")||doc.getSecurityLevel().equals("鍐呴儴鐢ㄩ��")||
+//                            doc.getSecurityLevel().equals("鍐呴儴鐢ㄥ浘"))) {
+//                        // 鏇挎崲涓轰簡鍑嗗濂界殑鍥惧儚
+//                        String fp = filePath + "\\glc.jpg";
+//                        Path path = Paths.get(fp);
+//                        // 鎷垮埌鍥惧儚灞炴��
+//                        BufferedImage bufferedImage = ImageIO.read(Files.newInputStream(path));
+//                        int wid = bufferedImage.getWidth();
+//                        int hei = bufferedImage.getHeight();
+//                        double sz = Double.parseDouble(String.format("%.2f", Files.size(path) * 1.0 / 1024));
+//
+//                        // 鎷垮埌鍥惧儚鐨刣pi淇℃伅
+//                        ImageInfo info = Imaging.getImageInfo(Files.readAllBytes(path));
+//                        int wdpi = info.getPhysicalWidthDpi();
+//                        int hdpi = info.getPhysicalHeightDpi();
+//
+//                        // 璁$畻fileNumber
+//                        Long fileNumber = documentMaterialsService.getFiNum(nam, recordId);
+//                        // 璁$畻sizeType
+//                        String sizeType = getPageSize(wid * hei);
+//
+//                        Graphics2D g2d = bufferedImage.createGraphics();
+//                        g2d.setFont(new Font("Arial", Font.BOLD, 80));
+//                        g2d.setColor(Color.black);
+//                        String pageNumber = doc.getPageNumber() + "";
+//                        int fontHeight = g2d.getFontMetrics().getHeight();
+//                        int x = bufferedImage.getWidth() - g2d.getFontMetrics().stringWidth(pageNumber) - 80;
+//                        int y = bufferedImage.getHeight() - fontHeight / 2 - 100;
+//                        g2d.drawString(pageNumber, x, y);
+//                        g2d.dispose();
+//
+//                        // 灏咮ufferedImage杞崲涓篗ultipartFile
+//                        MultipartFile multipartFile = null;
+//                        ByteArrayOutputStream os = new ByteArrayOutputStream();
+//                        ImageIO.write(bufferedImage, "jpg", os);
+//                        InputStream input = new ByteArrayInputStream(os.toByteArray());
+//                        multipartFile = new MockMultipartFile(pageNumber, pageNumber + ".jpg", "text/plain", input);
+//
+//                        // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О
+//                        String fileName1 = FileUploadUtils.upload(filePath, multipartFile);
+//
+//                        // 鏇存柊鏁版嵁搴�
+//                        documentMaterialsService.updateByPageNumber(nam, sizeType, fileNumber, wid, hei, wdpi, hdpi, sz, fileName1, "jpg", recordId);
+//
+//                        urls.add(serverConfig.getUrl() + fileName1);
+//                        fileNames.add(fileName1);
+//                        newFileNames.add(FileUtils.getName(fileName1));
+//                        originalFilenames.add(pageNumber + ".jpg");
+//                    } else {
+//                        // 鏂囦欢鍚嶇О
+//                        String pname = nams[1];
+//
+//                        // 鎷垮埌鍥惧儚灞炴��
+//                        BufferedImage bufferedImage = ImageIO.read(file.getInputStream());
+//                        int wid = bufferedImage.getWidth();
+//                        int hei = bufferedImage.getHeight();
+//                        double sz = Double.parseDouble(String.format("%.2f", file.getSize() * 1.0 / 1024));
+//
+//                        // 鎷垮埌鍥惧儚鐨刣pi淇℃伅
+//                        ImageInfo info = Imaging.getImageInfo(file.getBytes());
+//                        int wdpi = info.getPhysicalWidthDpi();
+//                        int hdpi = info.getPhysicalHeightDpi();
+//                        // 璁$畻fileNumber
+//                        Long fileNumber = documentMaterialsService.getFiNum(nam, recordId);
+//                        // 璁$畻sizeType
+//                        String sizeType = getPageSize(wid * hei);
+//
+//                        // 鏇存柊鏁版嵁搴�
+//                        documentMaterialsService.updateByPageNumber(nam, sizeType, fileNumber, wid, hei, wdpi, hdpi, sz, fileName, pname, recordId);
+//
+//                        urls.add(url);
+//                        fileNames.add(fileName);
+//                        newFileNames.add(FileUtils.getName(fileName));
+//                        originalFilenames.add(fname);
+//                    }
+//                }
+//            }
+
+
+        } catch (Exception e) {
+            log.error("鎵归噺涓婁紶鏂囦欢澶辫触", e);
+            return AjaxResult.error(e.getMessage());
+        }
+    }
+
 
 }

--
Gitblit v1.9.1