From ebae0c1137ba96d38e5b2323577129d2c9ff2e6e Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期四, 22 五月 2025 09:45:59 +0800 Subject: [PATCH] 1、优化配置文件; 2、优化ID生成器代码; 3、修改注释; 4、修改权限初始化时算法; 5、导出Excel文件功能归为一个新类; 6、工站数据库存入验空修改; --- pms-parent/pms-web-base/src/main/java/com/dy/pmsBase/util/PrivilegeListener.java | 39 +++++++++++++++++++++++++++++---------- 1 files changed, 29 insertions(+), 10 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 3cb8c22..b12e7f1 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; @@ -48,9 +45,12 @@ } catch (InterruptedException e) { e.printStackTrace(); }finally { + /* if(!this.existPrivileges()){ this.init(event); } + */ + this.init(event); } } @@ -76,12 +76,16 @@ if(prs != null){ List<Element> list = prs.getChildren() ; if(list != null){ - 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); + 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); + } } } } @@ -90,7 +94,7 @@ /** - * 鏁版嵁搴撲腑鏄惁瀛樺湪琛屾斂鍖哄垝鏁版嵁 + * 鏁版嵁搴撲腑鏄惁瀛樺湪鐩稿叧鏁版嵁 * @return 瀛樺湪鍚� */ private boolean existPrivileges(){ @@ -98,7 +102,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