From 63211c7592b9c7b814de2756d338ffd33ac0c58f Mon Sep 17 00:00:00 2001
From: zhai <1528081232@qq.com>
Date: 星期一, 19 一月 2026 16:37:38 +0800
Subject: [PATCH] 1、提交验收按钮新增判断是否关联附件 2、借阅暂存添加不可外借新增提醒 3、成果表单借阅管理修改为借阅记录 4、合格资料模块,导出文件按钮需要添加日志 5、装盒按钮调整:需要一个确认按钮并且可以更改盒号,调整盒号时能同步展示盒号容量 6、对接斑马打印机 7、利用用户修改

---
 src/main/java/com/zbooksoft/gdmis/common/XmlUtil.java |  173 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 151 insertions(+), 22 deletions(-)

diff --git a/src/main/java/com/zbooksoft/gdmis/common/XmlUtil.java b/src/main/java/com/zbooksoft/gdmis/common/XmlUtil.java
index 77ce0e6..7eff310 100644
--- a/src/main/java/com/zbooksoft/gdmis/common/XmlUtil.java
+++ b/src/main/java/com/zbooksoft/gdmis/common/XmlUtil.java
@@ -1,20 +1,20 @@
 package com.zbooksoft.gdmis.common;
 
 
-import org.dom4j.*;
+import com.zbooksoft.gdmis.controller.ArchivesCustomConfigController;
+import org.dom4j.Document;
+import org.dom4j.Element;
+import org.dom4j.Node;
+import org.dom4j.XPath;
 import org.dom4j.io.SAXReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.multipart.MultipartFile;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
+import java.io.*;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
-
-import static gnu.cajo.utils.extra.TransparentItemProxy.handler;
 
 /**
  * @Description: 瑙f瀽xml宸ュ叿绫�
@@ -22,7 +22,21 @@
  * @Date: 2024/8/6
  **/
 public class XmlUtil {
+    private static final Logger logger = LoggerFactory.getLogger(XmlUtil.class);
 
+
+    /**
+     * 閫氳繃 Node 鏌ユ壘瀛愯妭鐐�
+     *
+     * @param node Node
+     * @param path xpath琛ㄨ揪寮�
+     * @return Node鍏冪礌
+     * @throws Exception
+     */
+    public static Node getNode(Node node, String path) {
+        XPath xPath = node.createXPath(path);
+        return xPath.selectSingleNode(node);
+    }
 
     public static Document getDocument(String path) throws Exception {
         FileInputStream xmlStream = null;
@@ -33,7 +47,26 @@
             Document document = saxReader.read(xmlStream);
             return document;
         } catch (Exception e) {
+            throw new Exception("瑙f瀽xml鏂囦欢澶辫触");
+        } finally {
             xmlStream.close();
+        }
+    }
+
+    public static Document getDocument(MultipartFile file) throws Exception {
+        FileInputStream xmlStream = null;
+        try {
+            // 1. 鍒涘缓涓存椂鏂囦欢
+            File tempFile = File.createTempFile("temp_", ".tmp", new File(System.getProperty("java.io.tmpdir")));
+            file.transferTo(tempFile);
+            xmlStream = new FileInputStream(tempFile);
+            SAXReader saxReader = new SAXReader();
+            Document document = saxReader.read(xmlStream);
+            if (tempFile.exists()) {
+                tempFile.delete();
+            }
+            return document;
+        } catch (Exception e) {
             throw new Exception("瑙f瀽xml鏂囦欢澶辫触");
         } finally {
             xmlStream.close();
@@ -81,21 +114,117 @@
         }
     }
 
+    public static Integer stringToInteger(String str) throws Exception {
+        try {
+            return Integer.valueOf(str);
+        } catch (NumberFormatException e) {
+            logger.info("瀛楃涓茶浆Integer寮傚父:{}", str);
+            return 0;
+        }
+    }
+
+    public static Double stringToDouble(String str) {
+        try {
+            return Double.valueOf(str);
+        } catch (NumberFormatException e) {
+            logger.info("瀛楃涓茶浆Double寮傚父:{}", str);
+            return 0.0;
+        }
+    }
+
+    public static Date stringToDate(String str) throws Exception {
+        try {
+
+            if (str == null || "".equals(str)) {
+                return null;
+            }
+            if (str.contains("/")) {
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
+                return sdf.parse(str);
+            }
+            if (str.contains("-")) {
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                return sdf.parse(str);
+            }
+            return null;
+        } catch (NumberFormatException e) {
+            logger.info("瀛楃涓茶浆鏃ユ湡寮傚父:{}", str);
+            return null;
+        }
+    }
+
+    public static String getFileType(String name) {
+
+        name = name.toUpperCase();
+        String newName = name;
+        switch (name) {
+            case "ZW":
+                newName = "姝f枃";
+                break;
+            case "SP":
+                newName = "瀹℃壒";
+                break;
+            case "FT":
+                newName = "闄勫浘";
+                break;
+            case "FB":
+                newName = "闄勮〃";
+                break;
+            case "FJ":
+                newName = "闄勪欢";
+                break;
+            case "DMT":
+                newName = "澶氬獟浣�";
+                break;
+            case "SJK":
+                newName = "鏁版嵁搴�";
+                break;
+            case "RJ":
+                newName = "杞欢";
+                break;
+            case "QT":
+                newName = "鍏朵粬";
+                break;
+        }
+        return newName;
+    }
+
+
+    public static Integer getSecurityCode(String security) {
+        Integer code = null;
+        switch (security) {
+            case "缁濆瘑":
+                code = 4;
+                break;
+            case "鏈哄瘑":
+                code = 3;
+                break;
+            case "绉樺瘑":
+                code = 2;
+                break;
+            case "鍐呴儴":
+                code = 1;
+                break;
+            case "涓嶆秹瀵�":
+                code = 0;
+                break;
+        }
+        return code;
+    }
+
+
     public static void main(String[] args) {
         try {
-            System.out.println(new Date());
-//            String path = "E:\\Desktop\\鏂板缓鏂囦欢澶� (4)\\鍦拌川璧勬枡鏂囦欢鐩綍.xml";
-            String path = "E:\\Desktop\\鏂板缓鏂囦欢澶� (4)\\2023\\鍦拌川璧勬枡鏂�.xml";
-            Document document = getDocument(path);
-            Node wjjxxNode = getNode(document, "WJJXX");
-            List<Node> cgwjjxxNodeList = getNodeList(wjjxxNode, "CGWJJXX/CGWJXX");
-            for (Node cgwjjxxNode : cgwjjxxNodeList){
-                String cgwjmc = getNodeText(cgwjjxxNode, "WJLB");
-                System.out.println(cgwjmc);
+            String filePath = "E:\\Desktop\\鏂板缓鏂囦欢澶� (5)\\b01_0095.ml";
+            try (BufferedReader br = new BufferedReader(new FileReader(filePath))) {
+                String line;
+                while ((line = br.readLine()) != null) {
+                    // 澶勭悊姣忎竴琛�
+                    System.out.println(line);
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
             }
-            System.out.println(new Date());
-
-
         } catch (Exception e) {
             System.out.println(e.getMessage());
         }

--
Gitblit v1.9.1