From 0bd3125739c0d8bded4f7bd405fd99f1723df964 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期五, 30 五月 2025 15:51:49 +0800
Subject: [PATCH] 不同服务器配置文件备份

---
 pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/util/PrivilegeListener.java |   49 ++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 42 insertions(+), 7 deletions(-)

diff --git a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/util/PrivilegeListener.java b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/util/PrivilegeListener.java
index 9fdd527..e261390 100644
--- a/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/util/PrivilegeListener.java
+++ b/pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/util/PrivilegeListener.java
@@ -1,13 +1,10 @@
 package com.dy.pmsBase.util;
 
 import com.dy.common.util.ConfigXml;
-import com.dy.common.util.MD5;
 import com.dy.common.util.NumUtil;
 import com.dy.common.webListener.ConfigListener;
 import com.dy.pmsGlobal.daoBa.BaPrivilegeMapper;
-import com.dy.pmsGlobal.daoBa.BaPrivilegeMapper;
 import com.dy.pmsGlobal.pojoBa.BaPrivilege;
-import com.dy.pmsGlobal.pojoBa.BaUser;
 import org.jdom2.Document;
 import org.jdom2.Element;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -51,6 +48,7 @@
             if(!this.existPrivileges()){
                 this.init(event);
             }
+            //this.init(event);
         }
     }
 
@@ -65,7 +63,7 @@
             Document doc = configXml.createDom(configFileURL) ;
             this.doInit(configXml, doc);
         } catch (Exception e) {
-            System.out.println("绯荤粺鍚姩鏃讹紝鍒濆鍖栭厤缃嚭閿� !");
+            System.out.println("绯荤粺鍚姩鏃讹紝鍒濆鍖栨潈闄愰厤缃嚭閿� !");
             System.out.println(e.getMessage());
             e.printStackTrace();
         }
@@ -80,17 +78,39 @@
                         String num = ele.getAttributeValue("num") ;
                         String name = ele.getAttributeValue("name") ;
                         String type = ele.getAttributeValue("type") ;
-                        String typeName = ele.getAttributeValue("type_name") ;
+                        String typeName = ele.getAttributeValue("typeName") ;
                         this.savePrivilege(num, name, type,typeName);
                     }
                 }
             }
         }
     }
-
+    /*
+    private void doInit(ConfigXml configXml, Document doc) throws Exception{
+        if(configXml != null && doc != null){
+            Element prs = configXml.getElement(doc, "config.privileges") ;
+            if(prs != null){
+                List<Element> list = prs.getChildren() ;
+                if(list != null){
+                    Long totalInDb = this.countTotalPrivileges() ;
+                    if(list.size() != totalInDb){
+                        this.deleteAllPrivilegesInDb();
+                        for(Element ele : list){
+                            String num = ele.getAttributeValue("num") ;
+                            String name = ele.getAttributeValue("name") ;
+                            String type = ele.getAttributeValue("type") ;
+                            String typeName = ele.getAttributeValue("typeName") ;
+                            this.savePrivilege(num, name, type,typeName);
+                        }
+                    }
+                }
+            }
+        }
+    }
+    *
 
     /**
-     * 鏁版嵁搴撲腑鏄惁瀛樺湪琛屾斂鍖哄垝鏁版嵁
+     * 鏁版嵁搴撲腑鏄惁瀛樺湪鐩稿叧鏁版嵁
      * @return 瀛樺湪鍚�
      */
     private boolean existPrivileges(){
@@ -98,7 +118,22 @@
         return (total != null && total > 0) ;
     }
 
+    /**
+     * 鏁版嵁搴撲腑鏄惁瀛樺湪鐩稿叧鏁版嵁
+     * @return 瀛樺湪鍚�
+     */
+    private Long countTotalPrivileges(){
+        return this.privilegeDao.selectCount() ;
+    }
 
+
+    /**
+     * 鏁版嵁搴撲腑鏄惁瀛樺湪鐩稿叧鏁版嵁
+     * @return 瀛樺湪鍚�
+     */
+    private void deleteAllPrivilegesInDb(){
+        this.privilegeDao.deleteAll() ;
+    }
     /**
      * 淇濆瓨鏉冮檺
      * @param name 缂栫爜

--
Gitblit v1.8.0