1、完善代码和application.yml配置文件,去掉不用的引入文件;
2、init-config.xml配置中增加属性 enable,相应解析类也增加了解析与判断;
3、凡是有Server的应用,加载资源方式改为用springboot的工具类加载;
4、通信协议相关的扫描注解功能实现改为采用reflections-0.10.2,以实现可以在jar包情况下能够扫描类(.class)注解。
29个文件已修改
4个文件已添加
1个文件已删除
1811 ■■■■ 已修改文件
pipIrr-platform/pipIrr-common/pom.xml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/AnnotationScan.java 253 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Driver.java 109 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DriverV1_0_1.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/DriverV202404.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ClassScan.java 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ConfigXml.java 979 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ConfigXml4Springboot.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ConfigXmlNoSpringboot.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/OrgListenerSupport.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/init-config.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/pom.xml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/RtuDataUnit.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/RtuDataUnitConfigVo.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/TreeParse.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/Server.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/说明.txt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/Server.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/说明.txt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-mwTest-rtu/src/main/java/com/dy/pipIrrMwTestRtu/Server.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java 132 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/util/SsoListener.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/util/OrgListener.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/pom.xml
@@ -148,6 +148,13 @@
            <artifactId>jna-platform</artifactId>
            <version>5.12.1</version>
        </dependency>
        <!-- ç±»åå°„ -->
        <dependency>
            <groupId>org.reflections</groupId>
            <artifactId>reflections</artifactId>
            <version>0.10.2</version>
        </dependency>
        <!-- Hutool是一个小而全的Java工具类库(https://github.com/dromara/hutool)  -->
        <dependency>
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/AnnotationScan.java
@@ -1,13 +1,13 @@
package com.dy.common.mw.protocol;
import java.net.URI;
import java.net.URL;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import com.dy.common.util.ClassScan;
import com.dy.common.util.NumUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.reflections.Reflections;
/**
 * æ‰«æï¼š
@@ -19,14 +19,16 @@
 */
@SuppressWarnings("unused")
public class AnnotationScan {
    private static String scanRootPackage = "com.dy.common.mw.protocol." ;
    private static final Logger log = LogManager.getLogger(AnnotationScan.class);
    private static String scanRootPackage = "com.dy.common.mw.protocol" ;
    private static AnnotationScan instance ;
    private AnnotationScan(){
    }
    /**
     * å¾—到唯一实例,
     * å¹¶åœ¨ç”Ÿæˆå”¯ä¸€å®žä¾‹æ—¶ï¼Œæ‰«ææ³¨è§£ç±»
@@ -40,148 +42,135 @@
        }
        return instance ;
    }
    /**
     * æ‰«æå‡ºæ³¨è§£çš„ç±»
     * @throws ClassNotFoundException å¼‚常
     * @throws Exception å¼‚常
     */
    private void scanEndpointAnnotations() throws Exception{
        ClassLoader load = this.getClass().getClassLoader() ;
        if(!scanRootPackage.endsWith(".")){
            scanRootPackage += "." ;
        }
        URL url = AnnotationScan.class.getResource("/" + scanRootPackage.replace('.', '/'));
        if(url != null){
            String urlStr = url.toString() ;
            if(urlStr != null){
                URI uri = new URI(url.toString());
    private void scanEndpointAnnotations() throws Exception {
        Reflections reflections = new Reflections(scanRootPackage); // æŒ‡å®šåŒ…名
        Set<Class<?>> driverClasses = reflections.getTypesAnnotatedWith(AnnotationDriver.class);
        if (driverClasses != null && driverClasses.size() > 0) {
            String protocolName;
            int priority;
            int onLineDataMinLength;
            int headMinLength;
                List<String> classNames = new ClassScan().searchClassFromUrl(new URI[]{uri}, scanRootPackage) ;
                if(classNames != null && classNames.size() > 0){
                    String protocolName ;
                    int priority;
                    int onLineDataMinLength;
                    int headMinLength ;
            HashMap<String, AnnotationDriverVo> driverMap = ProtocolCache.getDriverMap();
            HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCache.getPrefixedDataAvailableMap();
            HashMap<String, AnnotationOnLineVo> onLineMap = ProtocolCache.getOnLineMap();
                    HashMap<String, AnnotationDriverVo> driverMap = ProtocolCache.getDriverMap() ;
                    HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCache.getPrefixedDataAvailableMap() ;
                    HashMap<String, AnnotationOnLineVo> onLineMap = ProtocolCache.getOnLineMap() ;
                    for(String cName : classNames){
                        String className = cName.substring(0,  cName.lastIndexOf('.')) ;
                        Class<?> clazz = load.loadClass(className) ;
                        if(clazz.isAnnotationPresent(AnnotationDriver.class)){
                            AnnotationDriver ann = clazz.getAnnotation(AnnotationDriver.class) ;
                            if(ann != null){
                                if(ann.enable()){
                                    protocolName = ann.name() ;
                                    if(!(protocolName.trim().equals(""))){
                                        if(driverMap.containsKey(protocolName)){
                                            throw new Exception("严重错误,协议驱动名称" + protocolName + "出现了重复注解!") ;
                                        }
                                        driverMap.put(protocolName, new AnnotationDriverVo(clazz)) ;
                                    }else{
                                        throw new Exception("严重错误,协议驱动名称注解值为空字符串") ;
                                    }
                                }
            for (Class<?> clazz : driverClasses) {
                AnnotationDriver ann = clazz.getAnnotation(AnnotationDriver.class);
                if (ann != null) {
                    if (ann.enable()) {
                        protocolName = ann.name();
                        if (!(protocolName.trim().equals(""))) {
                            if (driverMap.containsKey(protocolName)) {
                                throw new Exception("严重错误,协议驱动(名称)" + protocolName + "出现了重复注解!");
                            }
                            driverMap.put(protocolName, new AnnotationDriverVo(clazz));
                        } else {
                            throw new Exception("严重错误,协议驱动名称注解值为空字符串");
                        }
                    }
                }
            }
            Set<Class<?>> prefixedClass = reflections.getTypesAnnotatedWith(AnnotationPrefixedDataAvailable.class);
            for (Class<?> clazz : prefixedClass) {
                AnnotationPrefixedDataAvailable ann = clazz.getAnnotation(AnnotationPrefixedDataAvailable.class);
                if (ann != null) {
                    if (ann.enable()) {
                        protocolName = ann.protocolName();
                        if (!(protocolName.trim().equals(""))) {
                            if (prefixedDataAvailableMap.containsKey(protocolName)) {
                                throw new Exception("严重错误, ä¸Šè¡Œæ•°æ®å®Œæ•´æ€§æ£€æŸ¥æ‰€é…åè®®é©±åЍ" + protocolName + "出现了重复注解!");
                            }
                        } else {
                            throw new Exception("严重错误,上行数据完整性检查所配协议驱动注解值为空字符串");
                        }
                        priority = ann.priority();
                        if (priority == 0) {
                            throw new Exception("严重错误, ä¸Šè¡Œæ•°æ®å®Œæ•´æ€§æ£€æŸ¥æ‰€é…ä¼˜å…ˆçº§æ³¨è§£ä¸èƒ½ä¸º0");
                        }
                        if (isRepeatPrefixedDataAvailablePriority(priority, prefixedDataAvailableMap)) {
                            throw new Exception("严重错误, ä¸Šè¡Œæ•°æ®å®Œæ•´æ€§æ£€æŸ¥æ‰€é…ä¼˜å…ˆçº§æ³¨è§£(priority)数值" + priority + "重复");
                        }
                        if(clazz.isAnnotationPresent(AnnotationPrefixedDataAvailable.class)){
                            AnnotationPrefixedDataAvailable ann = clazz.getAnnotation(AnnotationPrefixedDataAvailable.class) ;
                            if(ann != null){
                                if(ann.enable()){
                                    protocolName = ann.protocolName() ;
                                    if(!(protocolName.trim().equals(""))){
                                        if(prefixedDataAvailableMap.containsKey(protocolName)){
                                            throw new Exception("严重错误, ä¸Šè¡Œæ•°æ®å®Œæ•´æ€§æ£€æŸ¥æ‰€é…åè®®é©±åЍ" + protocolName + "出现了重复注解!") ;
                                        }
                                    }else{
                                        throw new Exception("严重错误,上行数据完整性检查所配协议驱动注解值为空字符串") ;
                                    }
                                    priority = ann.priority() ;
                                    if(priority == 0){
                                        throw new Exception("严重错误, ä¸Šè¡Œæ•°æ®å®Œæ•´æ€§æ£€æŸ¥æ‰€é…ä¼˜å…ˆçº§æ³¨è§£ä¸èƒ½ä¸º0") ;
                                    }
                                    if(isRepeatPrefixedDataAvailablePriority(priority, prefixedDataAvailableMap)){
                                        throw new Exception("严重错误, ä¸Šè¡Œæ•°æ®å®Œæ•´æ€§æ£€æŸ¥æ‰€é…ä¼˜å…ˆçº§æ³¨è§£(priority)数值" + priority + "重复") ;
                                    }
                                    onLineDataMinLength = ann.onLineDataMinLength() ;
                        onLineDataMinLength = ann.onLineDataMinLength();
                                    /*气象协议为0
                                    if(onLineDataMinLength == 0){
                                        throw new Exception("严重错误, ä¸Šè¡Œæ•°æ®å®Œæ•´æ€§æ£€æŸ¥æ‰€é…ä¸Šçº¿æ•°æ®æœ€å°é•¿åº¦æ³¨è§£ä¸èƒ½ä¸º0") ;
                                    }
                                    */
                                                headMinLength = ann.headMinLength() ;
                        headMinLength = ann.headMinLength();
                                    /*气象协议为0
                                    if(headMinLength == 0){
                                        throw new Exception("严重错误, ä¸Šè¡Œæ•°æ®å®Œæ•´æ€§æ£€æŸ¥æ‰€é…ä¸ŠæŠ¥æ•°æ®çš„头部最小长度注解不能为0") ;
                                    }
                                    */
                                    prefixedDataAvailableMap.put(protocolName, new AnnotationPrefixedDataAvailableVo(clazz, protocolName, priority, onLineDataMinLength, headMinLength, ProtocolConstant.errorMaxLength)) ;
                                }
                            }
                        }
                        if(clazz.isAnnotationPresent(AnnotationOnLine.class)){
                            AnnotationOnLine ann = clazz.getAnnotation(AnnotationOnLine.class) ;
                            if(ann != null){
                                if(ann.enable()){
                                    protocolName = ann.protocolName() ;
                                    if(!(protocolName.trim().equals(""))){
                                        if(onLineMap.containsKey(protocolName)){
                                            throw new Exception("严重错误, ä¸Šçº¿æ•°æ®åˆ†æžæ‰€é…åè®®é©±åЍ" + protocolName + "出现了重复注解!") ;
                                        }
                                    }else{
                                        throw new Exception("严重错误,上线数据分析所配协议驱动注解值为空字符串") ;
                                    }
                                    priority = ann.priority() ;
                                    if(priority == 0){
                                        throw new Exception("严重错误, ä¸Šçº¿æ•°æ®åˆ†æžæ‰€é…ä¼˜å…ˆçº§æ³¨è§£ä¸èƒ½ä¸º0") ;
                                    }
                                    if(isRepeatOnLinePriority(priority, onLineMap)){
                                        throw new Exception("严重错误, ä¸Šçº¿æ•°æ®åˆ†æžæ‰€é…ä¼˜å…ˆçº§æ³¨è§£(priority)数值" + priority + "重复") ;
                                    }
                                    onLineMap.put(protocolName, new AnnotationOnLineVo(clazz, protocolName, priority)) ;
                                }
                            }
                        }
                        prefixedDataAvailableMap.put(protocolName, new AnnotationPrefixedDataAvailableVo(clazz, protocolName, priority, onLineDataMinLength, headMinLength, ProtocolConstant.errorMaxLength));
                    }
                    String error = this.hasErrorInDriver(driverMap) ;
                    if(error != null){
                        throw new Exception(error) ;
                    }else{
                        error = this.hasErrorInPrefixedDataAvailable(driverMap, prefixedDataAvailableMap) ;
                        if(error != null){
                            throw new Exception(error) ;
                        }else{
                            error = this.hasErrorInOnLine(driverMap, onLineMap) ;
                            if(error != null){
                                throw new Exception(error) ;
                            }
                        }
                    }
                }else{
                    throw new Exception("严重错误, æ‰«æåè®®ç›¸å…³æ³¨è§£æ‰€å¾—到类型集合为空,扫描根路径是" + scanRootPackage) ;
                }
            }
            Set<Class<?>> onLineClass = reflections.getTypesAnnotatedWith(AnnotationOnLine.class);
            for (Class<?> clazz : onLineClass) {
                AnnotationOnLine ann = clazz.getAnnotation(AnnotationOnLine.class);
                if (ann != null) {
                    if (ann.enable()) {
                        protocolName = ann.protocolName();
                        if (!(protocolName.trim().equals(""))) {
                            if (onLineMap.containsKey(protocolName)) {
                                throw new Exception("严重错误, ä¸Šçº¿æ•°æ®åˆ†æžæ‰€é…åè®®é©±åЍ" + protocolName + "出现了重复注解!");
                            }
                        } else {
                            throw new Exception("严重错误,上线数据分析所配协议驱动注解值为空字符串");
                        }
                        priority = ann.priority();
                        if (priority == 0) {
                            throw new Exception("严重错误, ä¸Šçº¿æ•°æ®åˆ†æžæ‰€é…ä¼˜å…ˆçº§æ³¨è§£ä¸èƒ½ä¸º0");
                        }
                        if (isRepeatOnLinePriority(priority, onLineMap)) {
                            throw new Exception("严重错误, ä¸Šçº¿æ•°æ®åˆ†æžæ‰€é…ä¼˜å…ˆçº§æ³¨è§£(priority)数值" + priority + "重复");
                        }
                        onLineMap.put(protocolName, new AnnotationOnLineVo(clazz, protocolName, priority));
                    }
                }
            }
            //进行验证
            String error = this.hasErrorInDriver(driverMap);
            if (error != null) {
                throw new Exception(error);
            } else {
                error = this.hasErrorInPrefixedDataAvailable(driverMap, prefixedDataAvailableMap);
                if (error != null) {
                    throw new Exception(error);
                } else {
                    error = this.hasErrorInOnLine(driverMap, onLineMap);
                    if (error != null) {
                        throw new Exception(error);
                    }
                }
            }
        } else {
            throw new Exception("严重错误, æ‰«æåè®®ç›¸å…³æ³¨è§£æ‰€å¾—到类型集合为空,扫描根路径是" + scanRootPackage);
        }
    }
    /**
     * æ£€æŸ¥ä¼˜å…ˆçº§é‡å¤
     * @param priority ä¼˜å…ˆçº§
     * @return ç»“æžœ
     */
    private boolean isRepeatPrefixedDataAvailablePriority(int priority, HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap){
        Collection<AnnotationPrefixedDataAvailableVo> col = prefixedDataAvailableMap.values();
        Collection<AnnotationPrefixedDataAvailableVo> col = prefixedDataAvailableMap.values();
        for(AnnotationPrefixedDataAvailableVo vo : col){
            if(vo.priority == priority){
                return true ;
@@ -195,7 +184,7 @@
     * @return ç»“æžœ
     */
    private boolean isRepeatOnLinePriority(int priority, HashMap<String, AnnotationOnLineVo> onLineMap){
        Collection<AnnotationOnLineVo> col = onLineMap.values();
        Collection<AnnotationOnLineVo> col = onLineMap.values();
        for(AnnotationOnLineVo vo : col){
            if(vo.priority == priority){
                return true ;
@@ -203,7 +192,7 @@
        }
        return false ;
    }
    private String hasErrorInDriver(HashMap<String, AnnotationDriverVo> driverMap){
        if(driverMap.size() == 0){
            return "严重错误,未注解任何协议驱动" ;
@@ -211,23 +200,23 @@
        return null ;
    }
    private String hasErrorInPrefixedDataAvailable(HashMap<String, AnnotationDriverVo> driverMap,
            HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap){
        Collection<AnnotationPrefixedDataAvailableVo> col = prefixedDataAvailableMap.values();
    private String hasErrorInPrefixedDataAvailable(HashMap<String, AnnotationDriverVo> driverMap,
                                                   HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap){
        Collection<AnnotationPrefixedDataAvailableVo> col = prefixedDataAvailableMap.values();
        for(AnnotationPrefixedDataAvailableVo vo : col){
            if(!driverMap.containsKey(vo.protocolName)){
                return "严重错误,上行数据完整性检查所配驱动名称(" + vo.protocolName + ")在协议驱动中未配置" ;
            }
        }
        int[] prioritys = new int[prefixedDataAvailableMap.size()] ;
        int count = 0 ;
        col = prefixedDataAvailableMap.values();
        col = prefixedDataAvailableMap.values();
        for(AnnotationPrefixedDataAvailableVo vo : col){
            prioritys[count++] = vo.priority ;
        }
        NumUtil.sort(prioritys, true) ;
        int firstPriority = prioritys[0] ;
        if(ProtocolConstant.firstPriority != firstPriority){
            return "严重错误,上行数据完整性检查所配优先级必须从 " + ProtocolConstant.firstPriority + " å¼€å§‹" ;
@@ -246,24 +235,24 @@
        }
        return null ;
    }
    private String hasErrorInOnLine(HashMap<String, AnnotationDriverVo> driverMap,
            HashMap<String, AnnotationOnLineVo> onLineMap){
        Collection<AnnotationOnLineVo> col = onLineMap.values();
                                    HashMap<String, AnnotationOnLineVo> onLineMap){
        Collection<AnnotationOnLineVo> col = onLineMap.values();
        for(AnnotationOnLineVo vo : col){
            if(!driverMap.containsKey(vo.protocolName)){
                return "严重错误,上线数据分析所配驱动名称(" + vo.protocolName + ")在协议驱动中未配置" ;
            }
        }
        int[] prioritys = new int[onLineMap.size()] ;
        int count = 0 ;
        col = onLineMap.values();
        col = onLineMap.values();
        for(AnnotationOnLineVo vo : col){
            prioritys[count++] = vo.priority ;
        }
        NumUtil.sort(prioritys, true) ;
        int firstPriority = prioritys[0] ;
        if(ProtocolConstant.firstPriority != firstPriority){
            return "严重错误,上线数据分析所配优先级必须从 " + ProtocolConstant.firstPriority + " å¼€å§‹" ;
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Driver.java
@@ -1,10 +1,9 @@
package com.dy.common.mw.protocol;
import java.net.URI;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import com.dy.common.util.ClassScan;
import org.reflections.Reflections;
public abstract class Driver {
@@ -21,7 +20,6 @@
     * @throws Exception å¼‚常
     */
    public abstract void scanAnnotationCode() throws Exception ;
    /**
     * æ‰«æè¯†åˆ«åŠŸèƒ½ç æ³¨è§£ç±»
     * @param driver é©±åЍ
@@ -31,72 +29,73 @@
     * @throws Exception å¼‚常
     */
    @SuppressWarnings("unchecked")
    protected void doScanAnnotationCode(Driver driver, String protocolName, URI uri, String scanRootPackage) throws Exception{
        ClassLoader load = driver.getClass().getClassLoader() ;
        List<String> classNames = new ClassScan().searchClassFromUrl(new URI[]{uri}, scanRootPackage) ;
        if(classNames != null && classNames.size() > 0){
            String code ;
            String[] codes ;
            for(String cName : classNames){
                String className = cName.substring(0,  cName.lastIndexOf('.')) ;
                Class<?> clazz = load.loadClass(className) ;
                Class<CodeParse> codeParseClazz ;
                if(clazz.isAnnotationPresent(AnnotationCodeUp.class)){
                    AnnotationCodeUp ann = clazz.getAnnotation(AnnotationCodeUp.class) ;
                    if(ann != null){
                        codeParseClazz = (Class<CodeParse>)clazz ;
                        codes = ann.ifAny() ;
                        if(codes.length > 0){
                            for(String cd: codes){
                                cd = cd.trim() ;
                                if(!(cd.trim().equals(""))){
                                    if(driver.upCode2Classes.containsKey(cd)){
                                        throw new Exception("严重错误,协议" + protocolName + "的上行数据功能码" + cd + "出现了重复注解!") ;
                                    }
                                    driver.upCode2Classes.put(cd, codeParseClazz) ;
    protected void doScanAnnotationCode(Driver driver, String protocolName, String scanRootPackage) throws Exception{
        Reflections reflections = new Reflections(scanRootPackage); // æŒ‡å®šåŒ…名
        String code ;
        String[] codes ;
        Class<CodeParse> codeParseClazz ;
        Set<Class<?>> codeUpClasses = reflections.getTypesAnnotatedWith(AnnotationCodeUp.class);
        if (codeUpClasses != null && codeUpClasses.size() > 0) {
            for (Class<?> clazz : codeUpClasses) {
                AnnotationCodeUp ann = clazz.getAnnotation(AnnotationCodeUp.class) ;
                if(ann != null){
                    codeParseClazz = (Class<CodeParse>)clazz ;
                    codes = ann.ifAny() ;
                    if(codes.length > 0){
                        for(String cd: codes){
                            cd = cd.trim() ;
                            if(!(cd.trim().equals(""))){
                                if(driver.upCode2Classes.containsKey(cd)){
                                    throw new Exception("严重错误,协议" + protocolName + "的上行数据功能码" + cd + "出现了重复注解!") ;
                                }
                                driver.upCode2Classes.put(cd, codeParseClazz) ;
                            }
                        }else{
                            code = ann.value().trim() ;
                            if(!(code.equals(""))){
                                if(driver.upCode2Classes.containsKey(code)){
                                    throw new Exception("严重错误,协议" + protocolName + "的上行数据功能码" + code + "出现了重复注解!") ;
                                }
                                driver.upCode2Classes.put(code, codeParseClazz) ;
                        }
                    }else{
                        code = ann.value().trim() ;
                        if(!(code.equals(""))){
                            if(driver.upCode2Classes.containsKey(code)){
                                throw new Exception("严重错误,协议" + protocolName + "的上行数据功能码" + code + "出现了重复注解!") ;
                            }
                            driver.upCode2Classes.put(code, codeParseClazz) ;
                        }
                    }
                }
                if(clazz.isAnnotationPresent(AnnotationCodeDown.class)){
                    AnnotationCodeDown ann = clazz.getAnnotation(AnnotationCodeDown.class) ;
                    if(ann != null){
                        codeParseClazz = (Class<CodeParse>)clazz ;
                        codes = ann.ifAny() ;
                        if(codes.length > 0){
                            for(String cd: codes){
                                cd = cd.trim() ;
                                if(!(cd.trim().equals(""))){
                                    if(driver.downCode2Class.containsKey(cd)){
                                        throw new Exception("严重错误,协议驱动" + protocolName + "的下行数据功能码" + cd + "出现了重复注解!") ;
                                    }
                                    driver.downCode2Class.put(cd, codeParseClazz) ;
            }
        }
        Set<Class<?>> codeDownClasses = reflections.getTypesAnnotatedWith(AnnotationCodeDown.class);
        if (codeDownClasses != null && codeDownClasses.size() > 0) {
            for (Class<?> clazz : codeDownClasses) {
                AnnotationCodeDown ann = clazz.getAnnotation(AnnotationCodeDown.class) ;
                if(ann != null){
                    codeParseClazz = (Class<CodeParse>)clazz ;
                    codes = ann.ifAny() ;
                    if(codes.length > 0){
                        for(String cd: codes){
                            cd = cd.trim() ;
                            if(!(cd.trim().equals(""))){
                                if(driver.downCode2Class.containsKey(cd)){
                                    throw new Exception("严重错误,协议驱动" + protocolName + "的下行数据功能码" + cd + "出现了重复注解!") ;
                                }
                                driver.downCode2Class.put(cd, codeParseClazz) ;
                            }
                        }else{
                            code = ann.value() ;
                            if(!(code.trim().equals(""))){
                                if(driver.downCode2Class.containsKey(code)){
                                    throw new Exception("严重错误,协议驱动" + protocolName + "的下行数据功能码" + code + "出现了重复注解!") ;
                                }
                                driver.downCode2Class.put(code, codeParseClazz) ;
                        }
                    }else{
                        code = ann.value() ;
                        if(!(code.trim().equals(""))){
                            if(driver.downCode2Class.containsKey(code)){
                                throw new Exception("严重错误,协议驱动" + protocolName + "的下行数据功能码" + code + "出现了重复注解!") ;
                            }
                            driver.downCode2Class.put(code, codeParseClazz) ;
                        }
                    }
                }
            }
        }
    }
    /**
     * å•线程单例Driver模式下运行
     * å¾—到上行数据功能码处理类CodeParse对象
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DriverV1_0_1.java
@@ -9,7 +9,7 @@
@AnnotationDriver(enable = true, name= ProtocolConstantV206V1_0_0.protocolName)
public class DriverV1_0_1 extends Driver {
    
    private static String scanRootPackage = "com.dy.common.mw.protocol.p206V1_0_0." ;
    private static String scanRootPackage = "com.dy.common.mw.protocol.p206V1_0_0" ;
    
    //在Driver中是单例,随Driver的单例对象在单线程中运行
    private ParseParamsForUpV1_0_1 upCpParams ;
@@ -29,12 +29,7 @@
     */
    @Override
    public void scanAnnotationCode() throws Exception{
        if(!scanRootPackage.endsWith(".")){
            scanRootPackage += "." ;
        }
        URL url = this.getClass().getResource("/" + scanRootPackage.replace('.', '/'));
        URI uri = new URI(url.toString());
        super.doScanAnnotationCode(this, ProtocolConstantV206V1_0_0.protocolName, uri, scanRootPackage) ;
        super.doScanAnnotationCode(this, ProtocolConstantV206V1_0_0.protocolName, scanRootPackage) ;
    }
    /**
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V202404/DriverV202404.java
@@ -1,6 +1,7 @@
package com.dy.common.mw.protocol.p206V202404;
import com.dy.common.mw.protocol.*;
import com.dy.common.mw.protocol.p206V1_0_0.ProtocolConstantV206V1_0_0;
import com.dy.common.util.DateTime;
import java.net.URI;
@@ -9,7 +10,7 @@
@AnnotationDriver(name= ProtocolConstantV206V202404.protocolName)
public class DriverV202404 extends Driver {
    
    private static String scanRootPackage = "com.dy.common.mw.protocol.p206V202404." ;
    private static String scanRootPackage = "com.dy.common.mw.protocol.p206V202404" ;
    
    //在Driver中是单例,随Driver的单例对象在单线程中运行
    private ParseParamsForUpV202404 upCpParams ;
@@ -29,12 +30,7 @@
     */
    @Override
    public void scanAnnotationCode() throws Exception{
        if(!scanRootPackage.endsWith(".")){
            scanRootPackage += "." ;
        }
        URL url = this.getClass().getResource("/" + scanRootPackage.replace('.', '/'));
        URI uri = new URI(url.toString());
        super.doScanAnnotationCode(this, ProtocolConstantV206V202404.protocolName, uri, scanRootPackage) ;
        super.doScanAnnotationCode(this, ProtocolConstantV206V1_0_0.protocolName, scanRootPackage) ;
    }
    /**
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ClassScan.java
File was deleted
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ConfigXml.java
@@ -1,516 +1,495 @@
package com.dy.common.util;
import java.io.FileWriter;
import java.net.URL;
import java.util.List;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.input.SAXBuilder;
import org.jdom2.output.Format;
import org.jdom2.output.XMLOutputter;
@SuppressWarnings("unused")
import java.io.FileWriter;
import java.net.URL;
import java.util.List;
/**
 * @Author: liurunyu
 * @Date: 2024/8/21 15:27
 * @Description
 */
public class ConfigXml {
    /**
     * åˆ›å»ºDocument对象
     * @param clazz å‚考类
     * @param filePath é…ç½®æ–‡ä»¶è·¯å¾„
     * @return è¿”回结果  è¿”回结果返回 doc对象
     * @throws Exception  æŠ›å‡ºå¼‚常 æŠ›å‡ºå¼‚常
     */
    public Document createDom(Class<?> clazz, String filePath) throws Exception {
        if(clazz == null){
            throw new Exception("class对象为空!");
        }
        if(filePath == null || filePath.equals("")){
            throw new Exception("配置文件路径名称为空!");
        }
        if(!filePath.startsWith("/")){
            filePath = "/" + filePath ;
        }
        URL configFileURL = clazz.getResource(filePath);
        if (configFileURL == null) {
            throw new Exception("没有得到" + filePath + "配置!");
        }
        return this.createDom(configFileURL) ;
    }
    /**
     * åˆ›å»ºDocument对象
     * @param configFileURL  é…ç½®æ–‡ä»¶è·¯å¾„
     * @return è¿”回结果  è¿”回结果返回 doc对象
     * @throws Exception  æŠ›å‡ºå¼‚常 æŠ›å‡ºå¼‚常
     */
    public Document createDom(URL configFileURL) throws Exception {
        if (configFileURL == null) {
            throw new Exception("没有得到配置文件!", null);
        }
        Document doc;
        try {
            SAXBuilder sb = new SAXBuilder();
            doc = sb.build(configFileURL);
            if (doc == null) {
                throw new Exception("没有生成配置文件的DOM对象!", null);
            }
        } catch (Exception e) {
            throw new Exception("生成配置文件的DOM对象失败!", e);
        }
        return doc;
    }
    /**
     * ä¿å­˜xml文件
     * @param clazz å‚考类
     * @param doc doc对象 doc对象
     * @param filePath é…ç½®æ–‡ä»¶è·¯å¾„
     * @throws Exception  æŠ›å‡ºå¼‚常 æŠ›å‡ºå¼‚常
     */
    public void saveXML(Class<?> clazz, Document doc, String filePath) throws Exception {
        if(doc == null){
            throw new Exception("Document对象为空!");
        }
        if(filePath == null || filePath.equals("")){
            throw new Exception("配置文件路径名称为空!");
        }
        if(!filePath.startsWith("/")){
            filePath = "/" + filePath ;
        }
        // å°†doc对象输出到文件
        FileWriter writer = null ;
        try {
            // åˆ›å»ºxml文件输出流
            XMLOutputter xmlopt = new XMLOutputter();
            // åˆ›å»ºæ–‡ä»¶è¾“出流
            URL configFileURL = clazz.getResource(filePath);
            if (configFileURL == null) {
                throw new Exception("没有得到" + filePath + "配置!");
            }
            writer = new FileWriter(configFileURL.getPath());
            // æŒ‡å®šæ–‡æ¡£æ ¼å¼
            Format fm = Format.getPrettyFormat();
            fm.setEncoding("UTF-8");
            xmlopt.setFormat(fm);
            // å°†doc写入到指定的文件中
            xmlopt.output(doc, writer);
        } catch (Exception e) {
            throw new Exception("保存xml文件失败!", e);
        } finally {
            if(writer != null){
                writer.close();
            }
        }
    }
    /**
     * æ£€æŸ¥å…ƒç´ æ˜¯å¦å­˜åœ¨
     * @param doc doc对象
     * @param elementName å…ƒç´ åç§°
     * @return è¿”回结果  è¿”回结果
     */
    public Element getElement(Document doc, String elementName){
        if(doc == null){
            return null ;
        }
        if(elementName == null){
            return null ;
        }
        elementName = elementName.trim() ;
        if(elementName.equals("")){
            return null ;
        }
        return this.get_element(doc, elementName) ;
    }
    /**
     * æ£€æŸ¥å…ƒç´ æ˜¯å¦å­˜åœ¨
     * @param doc doc对象
     * @param elementName å…ƒç´ åç§°
     * @return è¿”回结果  è¿”回结果
     */
    public boolean existElement(Document doc, String elementName){
        if(doc == null){
            return false ;
        }
        if(elementName == null){
            return false ;
        }
        elementName = elementName.trim() ;
        if(elementName.equals("")){
            return false ;
        }
        Element e = this.get_element(doc, elementName) ;
        return e != null;
    }
    /**
     * åˆ›å»ºDocument对象
     * @param configFileURL  é…ç½®æ–‡ä»¶è·¯å¾„
     * @return è¿”回结果  è¿”回结果返回 doc对象
     * @throws Exception  æŠ›å‡ºå¼‚常 æŠ›å‡ºå¼‚常
     */
    protected Document doCreateDom(URL configFileURL) throws Exception {
        if (configFileURL == null) {
            throw new Exception("没有得到配置文件!", null);
        }
        Document doc;
        try {
            SAXBuilder sb = new SAXBuilder();
            doc = sb.build(configFileURL);
            if (doc == null) {
                throw new Exception("没有生成配置文件的DOM对象!", null);
            }
        } catch (Exception e) {
            throw new Exception("生成配置文件的DOM对象失败!", e);
        }
        return doc;
    }
    /**
     * å¾—到并设置元素的属性的布尔值
     * @param doc doc对象
     * @param elementName å…ƒç´ åç§°
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public boolean getSetAttrBoolean(Document doc, String elementName, String attrName, String attPropertyNameFix, String setValue) throws Exception{
        String txt = this.getSetAttrTxt(doc, elementName, attrName, attPropertyNameFix, false, setValue) ;
        return txt.equalsIgnoreCase("true");
    }
    /**
     * ä¿å­˜xml文件
     * @param clazz å‚考类
     * @param doc doc对象 doc对象
     * @param filePath é…ç½®æ–‡ä»¶è·¯å¾„
     * @throws Exception  æŠ›å‡ºå¼‚常 æŠ›å‡ºå¼‚常
     */
    public void saveXML(Class<?> clazz, Document doc, String filePath) throws Exception {
        if(doc == null){
            throw new Exception("Document对象为空!");
        }
        if(filePath == null || filePath.equals("")){
            throw new Exception("配置文件路径名称为空!");
        }
        if(!filePath.startsWith("/")){
            filePath = "/" + filePath ;
        }
        // å°†doc对象输出到文件
        FileWriter writer = null ;
        try {
            // åˆ›å»ºxml文件输出流
            XMLOutputter xmlopt = new XMLOutputter();
            // åˆ›å»ºæ–‡ä»¶è¾“出流
            URL configFileURL = clazz.getResource(filePath);
            if (configFileURL == null) {
                throw new Exception("没有得到" + filePath + "配置!");
            }
            writer = new FileWriter(configFileURL.getPath());
            // æŒ‡å®šæ–‡æ¡£æ ¼å¼
            Format fm = Format.getPrettyFormat();
            fm.setEncoding("UTF-8");
            xmlopt.setFormat(fm);
            // å°†doc写入到指定的文件中
            xmlopt.output(doc, writer);
        } catch (Exception e) {
            throw new Exception("保存xml文件失败!", e);
        } finally {
            if(writer != null){
                writer.close();
            }
        }
    }
    /**
     * å¾—到并设置元素的属性的布尔值
     * @param e å…ƒç´ å¯¹è±¡
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public boolean getSetAttrBoolean(Element e, String attrName, String attPropertyNameFix, String setValue) throws Exception{
        String txt = this.getSetAttrTxt(e, attrName, attPropertyNameFix, false, setValue) ;
        return txt.equalsIgnoreCase("true");
    }
    /**
     * æ£€æŸ¥å…ƒç´ æ˜¯å¦å­˜åœ¨
     * @param doc doc对象
     * @param elementName å…ƒç´ åç§°
     * @return è¿”回结果  è¿”回结果
     */
    public Element getElement(Document doc, String elementName){
        if(doc == null){
            return null ;
        }
        if(elementName == null){
            return null ;
        }
        elementName = elementName.trim() ;
        if(elementName.equals("")){
            return null ;
        }
        return this.get_element(doc, elementName) ;
    }
    /**
     * å¾—到并设置元素的属性的字符串值
     * @param doc doc对象
     * @param elementName å…ƒç´ åç§°
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param canBlank æ˜¯å¦å¯ä¸ºç©º
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public String getSetAttrTxt(Document doc, String elementName, String attrName, String attPropertyNameFix, Boolean canBlank, String setValue) throws Exception{
        Element e = this.check_and_get_element(doc, elementName);
        return this.getSetAttrTxt(e, attrName, attPropertyNameFix, canBlank, setValue) ;
    }
    /**
     * å¾—到并设置元素的属性的字符串值
     * @param e å…ƒç´ å¯¹è±¡
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param canBlank æ˜¯å¦å¯ä¸ºç©º
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public String getSetAttrTxt(Element e, String attrName, String attPropertyNameFix, Boolean canBlank, String setValue) throws Exception{
        String txt = this.check_get_set_Attribute(e, e.getName(), attrName, attPropertyNameFix, setValue) ;
        if(!canBlank){
            if(txt.trim().equals("")){
                throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值为空字符串!");
            }
        }
        return txt.trim() ;
    }
    /**
     * å¾—到并设置元素的属性的正整数值
     * @param doc doc对象
     * @param elementName å…ƒç´ åç§°
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param min æœ€å°å€¼
     * @param max æœ€å¤§å€¼
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public Integer getSetAttrPlusInt(Document doc, String elementName, String attrName, String attPropertyNameFix, Integer min, Integer max, String setValue) throws Exception{
        Element e = this.check_and_get_element(doc, elementName);
        return this.getSetAttrPlusInt(e, attrName, attPropertyNameFix, min, max, setValue) ;
    }
    /**
     * æ£€æŸ¥å…ƒç´ æ˜¯å¦å­˜åœ¨
     * @param doc doc对象
     * @param elementName å…ƒç´ åç§°
     * @return è¿”回结果  è¿”回结果
     */
    public boolean existElement(Document doc, String elementName){
        if(doc == null){
            return false ;
        }
        if(elementName == null){
            return false ;
        }
        elementName = elementName.trim() ;
        if(elementName.equals("")){
            return false ;
        }
        Element e = this.get_element(doc, elementName) ;
        return e != null;
    }
    /**
     * å¾—到并设置元素的属性的正整数值
     * @param e å…ƒç´ å¯¹è±¡
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param min æœ€å°å€¼
     * @param max æœ€å¤§å€¼
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public Integer getSetAttrPlusInt(Element e, String attrName, String attPropertyNameFix, Integer min, Integer max, String setValue) throws Exception{
        int v ;
        String txt = this.check_get_set_Attribute(e, e.getName(), attrName, attPropertyNameFix, setValue) ;
        if(!NumUtil.isPlusIntNumber(txt)){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值不是正整数!");
        }
        v = Integer.parseInt(txt);
        if(min != null && v < min){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值小于" + min + "!");
        }
        if(max != null && v > max){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值大于" + max + "!");
        }
        return v ;
    }
    /**
     * å¾—到并设置元素的属性的整数值
     * @param doc doc对象
     * @param elementName å…ƒç´ åç§°
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param min æœ€å°å€¼
     * @param max æœ€å¤§å€¼
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public Integer getSetAttrInt(Document doc, String elementName, String attrName, String attPropertyNameFix, Integer min, Integer max, String setValue) throws Exception{
        Element e = this.check_and_get_element(doc, elementName);
        return this.getSetAttrInt(e, attrName, attPropertyNameFix, min, max, setValue) ;
    }
    /**
     * å¾—到并设置元素的属性的整数值
     * @param e å…ƒç´ å¯¹è±¡
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param min æœ€å°å€¼
     * @param max æœ€å¤§å€¼
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public Integer getSetAttrInt(Element e, String attrName, String attPropertyNameFix, Integer min, Integer max, String setValue) throws Exception{
        int v ;
        String txt = this.check_get_set_Attribute(e, e.getName(), attrName, attPropertyNameFix, setValue) ;
        if(!NumUtil.isIntNumber(txt)){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值不是正整数!");
        }
        v = Integer.parseInt(txt) ;
        if(min != null && v < min){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值小于" + min + "!");
        }
        if(max != null && v > max){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值大于" + max + "!");
        }
        return v ;
    }
    /**
     * å¾—到并设置元素的属性的浮点数值
     * @param doc doc对象
     * @param elementName å…ƒç´ åç§°
     * @param attrName å±žæ€§åç§°
     * @param min æœ€å°å€¼
     * @param max æœ€å¤§å€¼
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public Double getSetAttrPlusDouble(Document doc, String elementName, String attrName, String attPropertyNameFix, Double min, Double max, String setValue) throws Exception{
        Element e = this.check_and_get_element(doc, elementName);
        return this.getSetAttrPlusDouble(e, attrName, attPropertyNameFix, min, max, setValue) ;
    }
    /**
     * å¾—到并设置元素的属性的正浮点数值
     * @param e å…ƒç´ å¯¹è±¡
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param min æœ€å°å€¼
     * @param max æœ€å¤§å€¼
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public Double getSetAttrPlusDouble(Element e, String attrName, String attPropertyNameFix, Double min, Double max, String setValue) throws Exception{
        double v ;
        String txt = this.check_get_set_Attribute(e, e.getName(), attrName, attPropertyNameFix, setValue) ;
        if(!NumUtil.isPlusDoubleNumber(txt)){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值不是正浮点数!");
        }
        v = Double.parseDouble(txt) ;
        if(min != null && v < min){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值小于" + min + "!");
        }
        if(max != null && v > max){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值大于" + max + "!");
        }
        return v ;
    }
    /**
     * å¾—到并设置元素的属性的浮点数值
     * @param doc doc对象
     * @param elementName å…ƒç´ åç§°
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param min æœ€å°å€¼
     * @param max æœ€å¤§å€¼
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public Double getSetAttrDouble(Document doc, String elementName, String attrName, String attPropertyNameFix, Double min, Double max, String setValue) throws Exception{
        Element e = this.check_and_get_element(doc, elementName);
        return this.getSetAttrDouble(e, attrName, attPropertyNameFix, min, max, setValue) ;
    }
    /**
     * å¾—到并设置元素的属性的浮点数值
     * @param e å…ƒç´ å¯¹è±¡
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param min æœ€å°å€¼
     * @param max æœ€å¤§å€¼
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public Double getSetAttrDouble(Element e, String attrName, String attPropertyNameFix, Double min, Double max, String setValue) throws Exception{
        double v ;
        String txt = this.check_get_set_Attribute(e, e.getName(), attrName, attPropertyNameFix, setValue) ;
        if(!NumUtil.isDoubleNumber(txt)){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值不是正浮点数!");
        }
        v = Double.parseDouble(txt) ;
        if(min != null && v < min){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值小于" + min + "!");
        }
        if(max != null && v > max){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值大于" + max + "!");
        }
        return v ;
    }
    /**
     * å¾—到元素
     * @param doc doc对象
     * @param elementName å…ƒç´ åç§° å…ƒç´ åï¼Œå½¢å¦‚"config.base.test"
     * @return è¿”回结果
     */
    private Element get_element(Document doc, String elementName){
        Element e = null ;
        Element root ;
        String nm ;
        String[] eNames = elementName.split("\\.") ;
        if(eNames.length > 0){
            root = doc.getRootElement() ;
            nm = root.getName() ;
            if(nm.equals(eNames[0].trim())){
                if(eNames.length == 1){
                    e = root ;
                }else{
                    e = this.get_next_element(root, eNames, 1) ;
                }
            }
        }
        return e ;
    }
    /**
     * å¾—到子元素
     * @param base ä¸Šçº§å…ƒç´ å¯¹è±¡
     * @param eNames å…ƒç´ åç§°
     * @param index æ•°ç»„下标
     * @return è¿”回结果
     */
    private Element get_next_element(Element base, String[] eNames, int index){
        Element e = null ;
        String nm ;
        List<Element> list = base.getChildren() ;
        if(list != null && list.size() >0){
            for(Element el: list){
                nm = el.getName() ;
                if(nm.equals(eNames[index].trim())){
                    if(eNames.length == index + 1){
                        e = el ;
                    }else{
                        e = this.get_next_element(el, eNames, index + 1) ;
                    }
                    break ;
                }
            }
        }
        return e ;
    }
    /**
     * æ£€æŸ¥å¹¶èŽ·å…ƒç´ 
     * @param doc doc对象
     * @param elementName å…ƒç´ åç§°
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    private Element check_and_get_element(Document doc, String elementName)throws Exception{
        if(doc == null){
            throw new Exception("配置文件的DOM对象为空!");
        }
        if(elementName == null){
            throw new Exception("元素名为空!");
        }
        elementName = elementName.trim() ;
        if(elementName.equals("")){
            throw new Exception("元素名为空!");
        }
        Element e = this.get_element(doc, elementName) ;
        if(e == null){
            throw new Exception("未得到名称为" + elementName + "的元素!");
        }
        return e ;
    }
    /**
     * æ£€æŸ¥å¹¶èŽ·å¾—å¹¶è®¾ç½®å±žæ€§å€¼
     * @param e å…ƒç´ å¯¹è±¡
     * @param elementName å…ƒç´ åç§°
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    private String check_get_set_Attribute(Element e, String elementName, String attrName, String attPropertyNameFix, String setValue)throws Exception{
        if(attrName == null){
            throw new Exception("属性名为空!");
        }
        attrName = attrName.trim() ;
        if(attrName.equals("")){
            throw new Exception("属性名为空!");
        }
        String txt = this.get_set_AttributTxt(e, attrName, attPropertyNameFix, setValue) ;
        if(txt == null){
            throw new Exception("未得到元素" + elementName + "的属性" + attrName + "的值!");
        }
        return txt ;
    }
    /**
     * å¾—到并设置属性配置值
     * @param e å…ƒç´ å¯¹è±¡
     * @param attName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     */
    private String get_set_AttributTxt(Element e, String attName, String attPropertyNameFix, String setValue){
        String txt = null ;
        if(e != null && attName != null){
            attName = attName.trim() ;
            if(!attName.equals("")){
                txt = e.getAttributeValue(attName) ;
                if(setValue != null){
                    e.setAttribute(attName, setValue) ;
                }
            }
        }
        if(txt != null && txt.startsWith("${") && txt.endsWith("}")){
            txt = txt.substring(2, txt.length() - 1) ;
            if(attPropertyNameFix != null){
                txt = txt + attPropertyNameFix ;
            }
            txt = ConfigProperties.getConfig(txt) ;
        }
        return txt ;
    }
    /**
     * å¾—到并设置元素的属性的布尔值
     * @param doc doc对象
     * @param elementName å…ƒç´ åç§°
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public boolean getSetAttrBoolean(Document doc, String elementName, String attrName, String attPropertyNameFix, String setValue) throws Exception{
        String txt = this.getSetAttrTxt(doc, elementName, attrName, attPropertyNameFix, false, setValue) ;
        return txt.equalsIgnoreCase("true");
    }
    /**
     * å¾—到并设置元素的属性的布尔值
     * @param e å…ƒç´ å¯¹è±¡
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public boolean getSetAttrBoolean(Element e, String attrName, String attPropertyNameFix, String setValue) throws Exception{
        String txt = this.getSetAttrTxt(e, attrName, attPropertyNameFix, false, setValue) ;
        return txt.equalsIgnoreCase("true");
    }
    /**
     * å¾—到并设置元素的属性的字符串值
     * @param doc doc对象
     * @param elementName å…ƒç´ åç§°
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param canBlank æ˜¯å¦å¯ä¸ºç©º
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public String getSetAttrTxt(Document doc, String elementName, String attrName, String attPropertyNameFix, Boolean canBlank, String setValue) throws Exception{
        Element e = this.check_and_get_element(doc, elementName);
        return this.getSetAttrTxt(e, attrName, attPropertyNameFix, canBlank, setValue) ;
    }
    /**
     * å¾—到并设置元素的属性的字符串值
     * @param e å…ƒç´ å¯¹è±¡
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param canBlank æ˜¯å¦å¯ä¸ºç©º
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public String getSetAttrTxt(Element e, String attrName, String attPropertyNameFix, Boolean canBlank, String setValue) throws Exception{
        String txt = this.check_get_set_Attribute(e, e.getName(), attrName, attPropertyNameFix, setValue) ;
        if(!canBlank){
            if(txt.trim().equals("")){
                throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值为空字符串!");
            }
        }
        return txt.trim() ;
    }
    /**
     * å¾—到并设置元素的属性的正整数值
     * @param doc doc对象
     * @param elementName å…ƒç´ åç§°
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param min æœ€å°å€¼
     * @param max æœ€å¤§å€¼
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public Integer getSetAttrPlusInt(Document doc, String elementName, String attrName, String attPropertyNameFix, Integer min, Integer max, String setValue) throws Exception{
        Element e = this.check_and_get_element(doc, elementName);
        return this.getSetAttrPlusInt(e, attrName, attPropertyNameFix, min, max, setValue) ;
    }
    /**
     * å¾—到并设置元素的属性的正整数值
     * @param e å…ƒç´ å¯¹è±¡
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param min æœ€å°å€¼
     * @param max æœ€å¤§å€¼
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public Integer getSetAttrPlusInt(Element e, String attrName, String attPropertyNameFix, Integer min, Integer max, String setValue) throws Exception{
        int v ;
        String txt = this.check_get_set_Attribute(e, e.getName(), attrName, attPropertyNameFix, setValue) ;
        if(!NumUtil.isPlusIntNumber(txt)){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值不是正整数!");
        }
        v = Integer.parseInt(txt);
        if(min != null && v < min){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值小于" + min + "!");
        }
        if(max != null && v > max){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值大于" + max + "!");
        }
        return v ;
    }
    /**
     * å¾—到并设置元素的属性的整数值
     * @param doc doc对象
     * @param elementName å…ƒç´ åç§°
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param min æœ€å°å€¼
     * @param max æœ€å¤§å€¼
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public Integer getSetAttrInt(Document doc, String elementName, String attrName, String attPropertyNameFix, Integer min, Integer max, String setValue) throws Exception{
        Element e = this.check_and_get_element(doc, elementName);
        return this.getSetAttrInt(e, attrName, attPropertyNameFix, min, max, setValue) ;
    }
    /**
     * å¾—到并设置元素的属性的整数值
     * @param e å…ƒç´ å¯¹è±¡
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param min æœ€å°å€¼
     * @param max æœ€å¤§å€¼
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public Integer getSetAttrInt(Element e, String attrName, String attPropertyNameFix, Integer min, Integer max, String setValue) throws Exception{
        int v ;
        String txt = this.check_get_set_Attribute(e, e.getName(), attrName, attPropertyNameFix, setValue) ;
        if(!NumUtil.isIntNumber(txt)){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值不是正整数!");
        }
        v = Integer.parseInt(txt) ;
        if(min != null && v < min){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值小于" + min + "!");
        }
        if(max != null && v > max){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值大于" + max + "!");
        }
        return v ;
    }
    /**
     * å¾—到并设置元素的属性的浮点数值
     * @param doc doc对象
     * @param elementName å…ƒç´ åç§°
     * @param attrName å±žæ€§åç§°
     * @param min æœ€å°å€¼
     * @param max æœ€å¤§å€¼
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public Double getSetAttrPlusDouble(Document doc, String elementName, String attrName, String attPropertyNameFix, Double min, Double max, String setValue) throws Exception{
        Element e = this.check_and_get_element(doc, elementName);
        return this.getSetAttrPlusDouble(e, attrName, attPropertyNameFix, min, max, setValue) ;
    }
    /**
     * å¾—到并设置元素的属性的正浮点数值
     * @param e å…ƒç´ å¯¹è±¡
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param min æœ€å°å€¼
     * @param max æœ€å¤§å€¼
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public Double getSetAttrPlusDouble(Element e, String attrName, String attPropertyNameFix, Double min, Double max, String setValue) throws Exception{
        double v ;
        String txt = this.check_get_set_Attribute(e, e.getName(), attrName, attPropertyNameFix, setValue) ;
        if(!NumUtil.isPlusDoubleNumber(txt)){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值不是正浮点数!");
        }
        v = Double.parseDouble(txt) ;
        if(min != null && v < min){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值小于" + min + "!");
        }
        if(max != null && v > max){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值大于" + max + "!");
        }
        return v ;
    }
    /**
     * å¾—到并设置元素的属性的浮点数值
     * @param doc doc对象
     * @param elementName å…ƒç´ åç§°
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param min æœ€å°å€¼
     * @param max æœ€å¤§å€¼
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public Double getSetAttrDouble(Document doc, String elementName, String attrName, String attPropertyNameFix, Double min, Double max, String setValue) throws Exception{
        Element e = this.check_and_get_element(doc, elementName);
        return this.getSetAttrDouble(e, attrName, attPropertyNameFix, min, max, setValue) ;
    }
    /**
     * å¾—到并设置元素的属性的浮点数值
     * @param e å…ƒç´ å¯¹è±¡
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param min æœ€å°å€¼
     * @param max æœ€å¤§å€¼
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    public Double getSetAttrDouble(Element e, String attrName, String attPropertyNameFix, Double min, Double max, String setValue) throws Exception{
        double v ;
        String txt = this.check_get_set_Attribute(e, e.getName(), attrName, attPropertyNameFix, setValue) ;
        if(!NumUtil.isDoubleNumber(txt)){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值不是正浮点数!");
        }
        v = Double.parseDouble(txt) ;
        if(min != null && v < min){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值小于" + min + "!");
        }
        if(max != null && v > max){
            throw new Exception("元素" + e.getName() + "的属性" + attrName + "的值大于" + max + "!");
        }
        return v ;
    }
    /**
     * å¾—到元素
     * @param doc doc对象
     * @param elementName å…ƒç´ åç§° å…ƒç´ åï¼Œå½¢å¦‚"config.base.test"
     * @return è¿”回结果
     */
    private Element get_element(Document doc, String elementName){
        Element e = null ;
        Element root ;
        String nm ;
        String[] eNames = elementName.split("\\.") ;
        if(eNames.length > 0){
            root = doc.getRootElement() ;
            nm = root.getName() ;
            if(nm.equals(eNames[0].trim())){
                if(eNames.length == 1){
                    e = root ;
                }else{
                    e = this.get_next_element(root, eNames, 1) ;
                }
            }
        }
        return e ;
    }
    /**
     * å¾—到子元素
     * @param base ä¸Šçº§å…ƒç´ å¯¹è±¡
     * @param eNames å…ƒç´ åç§°
     * @param index æ•°ç»„下标
     * @return è¿”回结果
     */
    private Element get_next_element(Element base, String[] eNames, int index){
        Element e = null ;
        String nm ;
        List<Element> list = base.getChildren() ;
        if(list != null && list.size() >0){
            for(Element el: list){
                nm = el.getName() ;
                if(nm.equals(eNames[index].trim())){
                    if(eNames.length == index + 1){
                        e = el ;
                    }else{
                        e = this.get_next_element(el, eNames, index + 1) ;
                    }
                    break ;
                }
            }
        }
        return e ;
    }
    /**
     * æ£€æŸ¥å¹¶èŽ·å…ƒç´ 
     * @param doc doc对象
     * @param elementName å…ƒç´ åç§°
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    private Element check_and_get_element(Document doc, String elementName)throws Exception{
        if(doc == null){
            throw new Exception("配置文件的DOM对象为空!");
        }
        if(elementName == null){
            throw new Exception("元素名为空!");
        }
        elementName = elementName.trim() ;
        if(elementName.equals("")){
            throw new Exception("元素名为空!");
        }
        Element e = this.get_element(doc, elementName) ;
        if(e == null){
            throw new Exception("未得到名称为" + elementName + "的元素!");
        }
        return e ;
    }
    /**
     * æ£€æŸ¥å¹¶èŽ·å¾—å¹¶è®¾ç½®å±žæ€§å€¼
     * @param e å…ƒç´ å¯¹è±¡
     * @param elementName å…ƒç´ åç§°
     * @param attrName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @return è¿”回结果
     * @throws Exception  æŠ›å‡ºå¼‚常
     */
    private String check_get_set_Attribute(Element e, String elementName, String attrName, String attPropertyNameFix, String setValue)throws Exception{
        if(attrName == null){
            throw new Exception("属性名为空!");
        }
        attrName = attrName.trim() ;
        if(attrName.equals("")){
            throw new Exception("属性名为空!");
        }
        String txt = this.get_set_AttributTxt(e, attrName, attPropertyNameFix, setValue) ;
        if(txt == null){
            throw new Exception("未得到元素" + elementName + "的属性" + attrName + "的值!");
        }
        return txt ;
    }
    /**
     * å¾—到并设置属性配置值
     * @param e å…ƒç´ å¯¹è±¡
     * @param attName å±žæ€§åç§°
     * @param attPropertyNameFix å±žæ€§åç§°å‰ç¼€
     * @param setValue åŒæ—¶è®¾ç½®å€¼
     * @return è¿”回结果
     */
    private String get_set_AttributTxt(Element e, String attName, String attPropertyNameFix, String setValue){
        String txt = null ;
        if(e != null && attName != null){
            attName = attName.trim() ;
            if(!attName.equals("")){
                txt = e.getAttributeValue(attName) ;
                if(setValue != null){
                    e.setAttribute(attName, setValue) ;
                }
            }
        }
        if(txt != null && txt.startsWith("${") && txt.endsWith("}")){
            txt = txt.substring(2, txt.length() - 1) ;
            if(attPropertyNameFix != null){
                txt = txt + attPropertyNameFix ;
            }
            txt = ConfigProperties.getConfig(txt) ;
        }
        return txt ;
    }
}
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ConfigXml4Springboot.java
New file
@@ -0,0 +1,36 @@
package com.dy.common.util;
import java.net.URL;
import org.jdom2.Document;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
@SuppressWarnings("unused")
public class ConfigXml4Springboot extends ConfigXml {
    /**
     * åœ¨SpringBoot环境中应用
     * @param resourceLoader
     * @param fileName
     * @return
     * @throws Exception
     */
    public Document createDom(ResourceLoader resourceLoader, String fileName) throws Exception {
        if(resourceLoader == null){
            throw new Exception("resourceLoader对象为空!");
        }
        if(fileName == null || fileName.equals("")){
            throw new Exception("配置文件路径名称为空!");
        }
        while(fileName.startsWith("/") || fileName.startsWith("\\")){
            fileName = fileName.substring(1) ;
        }
        Resource resource = resourceLoader.getResource("classpath:" + fileName);
        URL configFileURL = resource.getURL() ;
        if (configFileURL == null) {
            throw new Exception("没有得到" + fileName + "配置!");
        }
        return super.doCreateDom(configFileURL) ;
    }
}
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ConfigXmlNoSpringboot.java
New file
@@ -0,0 +1,33 @@
package com.dy.common.util;
import java.net.URL;
import org.jdom2.Document;
@SuppressWarnings("unused")
public class ConfigXmlNoSpringboot extends ConfigXml {
    /**
     * åœ¨éžSpringBoot环境中应用
     * åˆ›å»ºDocument对象
     * @param clazz å‚考类
     * @param filePath é…ç½®æ–‡ä»¶è·¯å¾„
     * @return è¿”回结果  è¿”回结果返回 doc对象
     * @throws Exception  æŠ›å‡ºå¼‚常 æŠ›å‡ºå¼‚常
     */
    public Document createDom(Class<?> clazz, String filePath) throws Exception {
        if(clazz == null){
            throw new Exception("class对象为空!");
        }
        if(filePath == null || filePath.equals("")){
            throw new Exception("配置文件路径名称为空!");
        }
        if(!filePath.startsWith("/")){
            filePath = "/" + filePath ;
        }
        URL configFileURL = clazz.getResource(filePath);
        if (configFileURL == null) {
            throw new Exception("没有得到" + filePath + "配置!");
        }
        return super.doCreateDom(configFileURL) ;
    }
}
pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/OrgListenerSupport.java
@@ -1,10 +1,8 @@
package com.dy.pipIrrGlobal.util;
import com.dy.common.util.ConfigXml;
import com.dy.common.util.ConfigXml4Springboot;
import org.jdom2.Document;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import java.net.URL;
import org.springframework.core.io.ResourceLoader;
/**
 * @Author: liurunyu
@@ -17,18 +15,17 @@
     * å®žå§‹åŒ–
     */
    @SuppressWarnings("unused ")
    protected void init() {
        this.init(null);
    protected void init(ResourceLoader resourceLoader) {
        this.doInit(resourceLoader);
    }
    /**
     * å®žå§‹åŒ–
     */
    @SuppressWarnings("unused ")
    protected void init(ApplicationReadyEvent event) {
    protected void doInit(ResourceLoader resourceLoader) {
        try {
            URL configFileURL = OrgListenerSupport.class.getResource("/init-config.xml");
            ConfigXml configXml = new ConfigXml();
            Document doc = configXml.createDom(configFileURL);
            ConfigXml4Springboot configXml = new ConfigXml4Springboot() ;
            Document doc = configXml.createDom(resourceLoader, "init-config.xml") ;
            this.doInit(configXml, doc);
        } catch (Exception e) {
            System.out.println("系统启动时,初始化配置出错 !");
@@ -36,16 +33,19 @@
            e.printStackTrace();
        }
    }
    private void doInit(ConfigXml configXml, Document doc) throws Exception {
    private void doInit(ConfigXml4Springboot configXml, Document doc) throws Exception {
        if (configXml != null && doc != null) {
            for (int num = 1; num <= 10000; num++) {
                if (configXml.existElement(doc, "config.orgs.org" + num)) {
                    String orgTag = configXml.getSetAttrTxt(doc, "config.orgs.org" + num, "tag", null, false, null);
                    String orgName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num, "name", null, false, null);
                    Org.OrgVo vo = new Org().new OrgVo() ;
                    vo.tag = orgTag ;
                    vo.name = orgName ;
                    Org.OrgList.add(vo) ;
                    Boolean enable = configXml.getSetAttrBoolean(doc, "config.orgs.org" + num, "enable", null, null);
                    if(enable != null && enable.booleanValue()){
                        Org.OrgVo vo = new Org().new OrgVo() ;
                        vo.tag = orgTag ;
                        vo.name = orgName ;
                        Org.OrgList.add(vo) ;
                    }
                }else{
                    break ;
                }
pipIrr-platform/pipIrr-global/src/main/resources/init-config.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<config>
    <orgs>
        <!-- å¤šä¸ªç»„织,用编号区分,编号从1开始 -->
        <org1 tag="ym" name="元谋">
        <!-- å¤šä¸ªç»„织,用编号区分,编号从1开始,enable表示是否启用 -->
        <org1 tag="ym" name="元谋" enable="true">
            <districts>
                <province name="云南省" num="53" level="0">
                    <city name="楚雄彝族自治州" num="23" level="1">
@@ -29,7 +29,7 @@
                <item5 typeName="绿化用水"/>
            </waterTypes>
        </org1>
        <org2 tag="pj" name="片角">
        <org2 tag="pj" name="片角" enable="false">
            <districts>
                <province name="云南省" num="53" level="0">
                    <city name="丽江市" num="23" level="1">
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/pom.xml
@@ -159,6 +159,14 @@
            <artifactId>jna-platform</artifactId>
            <version>5.12.1</version>
        </dependency>
        <!-- ç±»åå°„ -->
        <dependency>
            <groupId>org.reflections</groupId>
            <artifactId>reflections</artifactId>
            <version>0.10.2</version>
        </dependency>
        <!-- æµ‹è¯• -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java
@@ -22,17 +22,19 @@
import com.dy.rtuMw.resource.ResourceUnit;
import com.dy.rtuMw.resource.ResourceUnitConfigVo;
import com.dy.common.springUtil.SpringContextUtil;
import com.dy.common.util.ConfigXml;
import com.dy.common.util.ConfigXml4Springboot;
import com.dy.common.util.IDLongGenerator;
import org.jdom2.Document;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Component;
@Component
public class Server {
    private ConfigXml conf = null ;
    private ConfigXml4Springboot conf = null ;
    private Document doc = null ;
    private boolean showStartInfo = false ;
    
@@ -42,6 +44,9 @@
    private String HttpSvPort ;
    @Value("${server.servlet.context-path}")
    private String HttpSvPath ;
    @Autowired
    protected ResourceLoader resourceLoader ;
    private List<UnitInterface> units = new ArrayList<UnitInterface>() ;
@@ -78,8 +83,8 @@
        try {
            //ConfigProperties.init(this.getClass().getResourceAsStream("/config/config.properties"), false);
            
            this.conf = new ConfigXml() ;
            this.doc = this.conf.createDom(this.getClass(), "config.xml") ;
            this.conf = new ConfigXml4Springboot() ;
            this.doc = this.conf.createDom(this.resourceLoader, "config.xml") ;
            ////////////////
            //服务 é…ç½®
            this.showStartInfo = this.conf.getSetAttrBoolean(this.doc, "config.server", "showStartInfo", null, null) ;
@@ -325,6 +330,7 @@
            /////////////////
            //RTU上行数据处理模块
            RtuDataUnitConfigVo rducVo = new RtuDataUnitConfigVo();
            rducVo.resourceLoader = this.resourceLoader ;
            AdapterImp_RtuDataUnit rducAdap = new AdapterImp_RtuDataUnit();
            rducAdap.setConfig(rducVo);
            RtuDataUnit rducUnit = RtuDataUnit.getInstance();
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/RtuDataUnit.java
@@ -34,7 +34,7 @@
     */
    @Override
    public void start(UnitStartedCallbackInterface callback) throws Exception {
        TaskPool.setTaskTreeCofig(new TreeParse().parseConfig());
        TaskPool.setTaskTreeCofig(new TreeParse().parseConfig(confVo.resourceLoader));
        callback.call(null) ;
        System.out.println("RTU数据处理模块成功启动");
    }
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/RtuDataUnitConfigVo.java
@@ -1,5 +1,7 @@
package com.dy.rtuMw.server.rtuData;
public class RtuDataUnitConfigVo {
import org.springframework.core.io.ResourceLoader;
public class RtuDataUnitConfigVo {
    public ResourceLoader resourceLoader ;
}
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/server/rtuData/TreeParse.java
@@ -7,7 +7,8 @@
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.input.SAXBuilder;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
public class TreeParse {
    public List<String> ids ;
@@ -26,7 +27,6 @@
    /**
     * è§£æžå¤„理器配置
     * @return
     */
    protected TreeConfig parseConfig() {
        try {
            ClassLoader classLoader = ClassLoader.getSystemClassLoader();
@@ -39,6 +39,24 @@
            return null;
        }
    }
     */
    /**
     * è§£æžå¤„理器配置
     * @return
     */
    protected TreeConfig parseConfig(ResourceLoader resourceLoader) {
        try {
            Resource resource = resourceLoader.getResource("classpath:RtuDataDealTree.xml");
            URL configFileURL = resource.getURL() ;
            return this.parse(this.createDom(configFileURL)) ;
        } catch (Exception e) {
            System.out.println("系统启动时,初始上行数据处理任务配置出错 !");
            System.out.println(e.getMessage());
            e.printStackTrace();
            return null;
        }
    }
    
    /**
     * 
pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.xml
@@ -9,7 +9,7 @@
        onlyOneProtocol:在支持多通信协议时,只有RTU上线了,才能识别出该RTU实际用的通信协议,进而用此协议解析上行数据及构造下行命令。
                         å¦‚æžœRTU未曾上线(通信中间件启动后该RTU未曾上线),那么在向它发送下行命令时,不能判断出其采用的协议,也不能构造命令,尤其是低功耗情况下,不上线是正常现象。
                         å½“只有一个协议情况下,在RTU未曾上线时,也能用此协议构造命令并缓存下来,尤其适合低功耗情况。
                      onlyOneProtocol=true: é€šä¿¡ä¸­é—´ä»¶å½“前只有一个协议
        onlyOneProtocol=true: é€šä¿¡ä¸­é—´ä»¶å½“前只有一个协议
        downComandMaxResendTimes: ä¸‹è¡Œå‘½ä»¤å…è®¸å‘送的最大次数X,即允许重发X-1
        commandSendInterval: é’ˆå¯¹ä¸€ä¸ªRTU,下发命令的时间间隔(秒)
        cachWaitResultTimeout: å‘½ä»¤å·²ç»å‘送达最大次数,仍未收到命令结果,需要在缓存继续等待,其等待最大时长(秒),本系统RTU,对于开关泵命令,其先执行开关泵报,然后再进行命令应答,所以此值 è¦å¤§ä¸€äº›
@@ -40,7 +40,8 @@
            sendDingDingAlarmMsInterval="60"
        />
        
        <!--
        <!--
        2024-08-22 æš‚时不用
        centerAddr: ä¸­å¿ƒåœ°å€ï¼Œå½“前,centerAddr未用到
        synchroRtuClock: æ˜¯å¦å¯¹RTU校时
        synchroRtuClockTimepieces:当RTU与服务器时钟相差一定毫秒(配置文件是秒钟)后,进行校时
@@ -107,7 +108,8 @@
        />
        
            
        <!--
        <!--
        2024-08-22 æš‚时不用
        port:rmi服务端口号
        context:rmi服务上下文
         -->
pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/Server.java
@@ -11,10 +11,11 @@
import com.dy.common.mw.UnitInterface;
import com.dy.common.mw.support.SupportUnit;
import com.dy.common.mw.support.SupportUnitConfigVo;
import com.dy.common.util.ConfigXml;
import com.dy.common.util.ConfigXmlNoSpringboot;
public class Server {
    private ConfigXml conf = null ;
    private ConfigXmlNoSpringboot conf = null ;
    private Document doc = null ;
    private boolean showStartInfo = false ;
@@ -27,7 +28,7 @@
        Server sv = new Server();
        Long start = System.currentTimeMillis() ;
        try {
            sv.conf = new ConfigXml() ;
            sv.conf = new ConfigXmlNoSpringboot() ;
            sv.doc = sv.conf.createDom(sv.getClass(), "/config.xml") ;
            ////////////////
            //服务 é…ç½®
pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/˵Ã÷.txt
New file
@@ -0,0 +1 @@
本模块是批量压力测试的客户端,模拟多个测控器上报数据,受服务端(pipIrr-mwTest-server)控制。
pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/Server.java
@@ -12,12 +12,12 @@
import com.dy.common.mw.UnitStartedCallbackInterface;
import com.dy.common.mw.channel.rmi.RmiConfigVo;
import com.dy.common.mw.channel.rmi.RmiUnit;
import com.dy.common.util.ConfigXml;
import com.dy.common.util.NumUtil;
import com.dy.common.util.ConfigXmlNoSpringboot;
public class Server{
    private ConfigXml conf = null ;
    private ConfigXmlNoSpringboot conf = null ;
    private Document doc = null ;
    private boolean showStartInfo = false ;
    
@@ -39,7 +39,7 @@
        Server sv = new Server();
        long start = System.currentTimeMillis() ;
        try {
            sv.conf = new ConfigXml() ;
            sv.conf = new ConfigXmlNoSpringboot() ;
            sv.doc = sv.conf.createDom(sv.getClass(), "config.xml") ;
            ////////////////
            //服务 é…ç½®
pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/˵Ã÷.txt
New file
@@ -0,0 +1 @@
本模块是批量压力测试的服务端,为客户端(pipIrr-mwTest-client)分配测控器(RTU)数量及测控器(RTU)地址,并控制客户启动,接收客户端数据。
pipIrr-platform/pipIrr-web/pipIrr-mwTest-rtu/src/main/java/com/dy/pipIrrMwTestRtu/Server.java
@@ -1,10 +1,12 @@
package com.dy.pipIrrMwTestRtu;
import com.dy.common.mw.UnitInterface;
import com.dy.common.util.ConfigXml;
import com.dy.common.util.ConfigXml4Springboot;
import com.dy.pipIrrMwTestRtu.tcpClient.TcpClUnit;
import com.dy.pipIrrMwTestRtu.tcpClient.TcpClUnitConfigVo;
import org.jdom2.Document;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
@@ -18,8 +20,10 @@
@Component
public class Server {
    @Autowired
    protected ResourceLoader resourceLoader ;
    private ConfigXml conf = null ;
    private ConfigXml4Springboot conf = null ;
    private Document doc = null ;
    private boolean showStartInfo = false ;
@@ -41,8 +45,8 @@
        try {
            //ConfigProperties.init(this.getClass().getResourceAsStream("/config/config.properties"), false);
            this.conf = new ConfigXml() ;
            this.doc = this.conf.createDom(this.getClass(), "config.xml") ;
            this.conf = new ConfigXml4Springboot() ;
            this.doc = this.conf.createDom(resourceLoader, "config.xml") ;
            ////////////////
            //服务 é…ç½®
            this.showStartInfo = this.conf.getSetAttrBoolean(this.doc, "config.server", "showStartInfo", null, null) ;
pipIrr-platform/pipIrr-web/pipIrr-web-app/src/main/resources/application.yml
@@ -1,6 +1,6 @@
spring:
    profiles:
        include: global, database, database-ym, database-pj, database-sp
        include: global, database, database-ym, database-pj
#actutor的web端口
management:
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java
@@ -3,7 +3,7 @@
import com.dy.common.multiDataSource.DataSourceContext;
import com.dy.common.mybatis.envm.Deleted;
import com.dy.common.mybatis.envm.Disabled;
import com.dy.common.util.ConfigXml;
import com.dy.common.util.ConfigXml4Springboot;
import com.dy.common.util.MD5;
import com.dy.pipIrrGlobal.daoBa.BaDistrictMapper;
import com.dy.pipIrrGlobal.daoBa.BaSettingsMapper;
@@ -20,10 +20,9 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.io.ResourceLoader;
import org.springframework.lang.NonNull;
import org.springframework.stereotype.Component;
import java.net.URL;
/**
 * ç›‘听器,实现功能:在系统启动时初始化,向数据库中插入数据
@@ -34,11 +33,18 @@
@Component
public class InitListener implements ApplicationListener<ApplicationReadyEvent> {
    protected ResourceLoader resourceLoader ;
    private BaDistrictMapper distriDao ;
    private BaUserMapper userDao ;
    private SePaymentMethodMapper paymentMethodDao ;
    private BaSettingsMapper settingsDao ;
    private SeWaterTypeMapper waterTypeDao ;
    @Autowired
    public void setResourceLoader(ResourceLoader resourceLoader){
        this.resourceLoader = resourceLoader ;
    }
    @Autowired
    public void setDistriDao(BaDistrictMapper distriDao){
@@ -88,9 +94,8 @@
    @SuppressWarnings("unused ")
    private void init(ApplicationReadyEvent event){
        try {
            URL configFileURL = InitListener.class.getResource("/init-config.xml" );
            ConfigXml configXml = new ConfigXml() ;
            Document doc = configXml.createDom(configFileURL) ;
            ConfigXml4Springboot configXml = new ConfigXml4Springboot() ;
            Document doc = configXml.createDom(this.resourceLoader, "init-config.xml") ;
            this.doInit(configXml, doc);
        } catch (Exception e) {
            System.out.println("系统启动时,初始化配置出错 !");
@@ -98,76 +103,79 @@
            e.printStackTrace();
        }
    }
    private void doInit(ConfigXml configXml, Document doc) throws Exception{
    private void doInit(ConfigXml4Springboot configXml, Document doc) throws Exception{
        if(configXml != null && doc != null){
            for(int num = 1; num <= 10000; num++){
                if(configXml.existElement(doc, "config.orgs.org" + num)){
                    String orgTag = configXml.getSetAttrTxt(doc, "config.orgs.org" + num,"tag", null, false, null) ;
                    //设置数据源
                    DataSourceContext.set(orgTag);
                    if(!this.existDistricts()){
                        if(configXml.existElement(doc, "config.orgs.org" + num + ".districts.province")){
                            String distriName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province","name", null, false, null) ;
                            String distriNum = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province","num", null, false, null) ;
                            Integer distriLevel = configXml.getSetAttrPlusInt(doc, "config.orgs.org" + num + ".districts.province","level", null, 0, 99,null) ;
                            Long supperId = this.saveDistrict(null, distriName, distriNum, distriLevel);
                            if(supperId != null && configXml.existElement(doc, "config.orgs.org" + num + ".districts.province.city")){
                                distriName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province.city","name", null, false, null) ;
                                distriNum = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province.city","num", null, false, null) ;
                                distriLevel = configXml.getSetAttrPlusInt(doc, "config.orgs.org" + num + ".districts.province.city","level", null, 1, 99,null) ;
                                supperId = this.saveDistrict(supperId, distriName, distriNum, distriLevel);
                                if(supperId != null && configXml.existElement(doc, "config.orgs.org" + num + ".districts.province.city.country")) {
                                    distriName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province.city.country", "name", null, false, null);
                                    distriNum = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province.city.country", "num", null, false, null);
                                    distriLevel = configXml.getSetAttrPlusInt(doc, "config.orgs.org" + num + ".districts.province.city.country", "level", null, 1, 99, null);
                                    this.saveDistrict(supperId, distriName, distriNum, distriLevel);
                    Boolean enable = configXml.getSetAttrBoolean(doc, "config.orgs.org" + num, "enable", null, null);
                    if(enable != null && enable.booleanValue()){
                        //设置数据源
                        DataSourceContext.set(orgTag);
                        if(!this.existDistricts()){
                            if(configXml.existElement(doc, "config.orgs.org" + num + ".districts.province")){
                                String distriName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province","name", null, false, null) ;
                                String distriNum = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province","num", null, false, null) ;
                                Integer distriLevel = configXml.getSetAttrPlusInt(doc, "config.orgs.org" + num + ".districts.province","level", null, 0, 99,null) ;
                                Long supperId = this.saveDistrict(null, distriName, distriNum, distriLevel);
                                if(supperId != null && configXml.existElement(doc, "config.orgs.org" + num + ".districts.province.city")){
                                    distriName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province.city","name", null, false, null) ;
                                    distriNum = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province.city","num", null, false, null) ;
                                    distriLevel = configXml.getSetAttrPlusInt(doc, "config.orgs.org" + num + ".districts.province.city","level", null, 1, 99,null) ;
                                    supperId = this.saveDistrict(supperId, distriName, distriNum, distriLevel);
                                    if(supperId != null && configXml.existElement(doc, "config.orgs.org" + num + ".districts.province.city.country")) {
                                        distriName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province.city.country", "name", null, false, null);
                                        distriNum = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province.city.country", "num", null, false, null);
                                        distriLevel = configXml.getSetAttrPlusInt(doc, "config.orgs.org" + num + ".districts.province.city.country", "level", null, 1, 99, null);
                                        this.saveDistrict(supperId, distriName, distriNum, distriLevel);
                                    }
                                }
                            }
                        }
                    }
                    if(!this.existUsers()){
                        if(configXml.existElement(doc, "config.orgs.org" + num + ".user")){
                            String name = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".user","name", null, false, null) ;
                            String phone = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".user","phone", null, false, null) ;
                            String password = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".user","password", null, false, null) ;
                            Integer supperAdmin = configXml.getSetAttrPlusInt(doc, "config.orgs.org" + num + ".user","supperAdmin", null, 0, 1,null) ;
                            this.saveUser(orgTag, name, phone, password, supperAdmin);
                        if(!this.existUsers()){
                            if(configXml.existElement(doc, "config.orgs.org" + num + ".user")){
                                String name = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".user","name", null, false, null) ;
                                String phone = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".user","phone", null, false, null) ;
                                String password = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".user","password", null, false, null) ;
                                Integer supperAdmin = configXml.getSetAttrPlusInt(doc, "config.orgs.org" + num + ".user","supperAdmin", null, 0, 1,null) ;
                                this.saveUser(orgTag, name, phone, password, supperAdmin);
                            }
                        }
                    }
                    if(!this.existPayments()){
                        if(configXml.existElement(doc, "config.orgs.org" + num + ".payments")){
                            for(int i = 1 ; i < 10000; i++){
                                if(configXml.existElement(doc, "config.orgs.org" + num + ".payments.item" + i)){
                                    String name = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".payments.item" + i,"name", null, false, null) ;
                                    this.savePayment(orgTag, name);
                                }else{
                                    break ;
                        if(!this.existPayments()){
                            if(configXml.existElement(doc, "config.orgs.org" + num + ".payments")){
                                for(int i = 1 ; i < 10000; i++){
                                    if(configXml.existElement(doc, "config.orgs.org" + num + ".payments.item" + i)){
                                        String name = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".payments.item" + i,"name", null, false, null) ;
                                        this.savePayment(orgTag, name);
                                    }else{
                                        break ;
                                    }
                                }
                            }
                        }
                    }
                    if(!this.existSettings()){
                        if(configXml.existElement(doc, "config.orgs.org" + num + ".settings")){
                            for(int i = 1 ; i < 10000; i++){
                                if(configXml.existElement(doc, "config.orgs.org" + num + ".settings.item" + i)){
                                    String item_name = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".settings.item" + i,"item_name", null, false, null) ;
                                    String item_value = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".settings.item" + i,"item_value", null, false, null) ;
                                    String remarks = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".settings.item" + i,"remarks", null, false, null) ;
                                    this.saveSettings(orgTag, item_name, item_value, remarks);
                                }else{
                                    break ;
                        if(!this.existSettings()){
                            if(configXml.existElement(doc, "config.orgs.org" + num + ".settings")){
                                for(int i = 1 ; i < 10000; i++){
                                    if(configXml.existElement(doc, "config.orgs.org" + num + ".settings.item" + i)){
                                        String item_name = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".settings.item" + i,"item_name", null, false, null) ;
                                        String item_value = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".settings.item" + i,"item_value", null, false, null) ;
                                        String remarks = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".settings.item" + i,"remarks", null, false, null) ;
                                        this.saveSettings(orgTag, item_name, item_value, remarks);
                                    }else{
                                        break ;
                                    }
                                }
                            }
                        }
                    }
                    if(!this.existWaterTypes()){
                        if(configXml.existElement(doc, "config.orgs.org" + num + ".waterTypes")){
                            for(int i = 1 ; i < 10000; i++){
                                if(configXml.existElement(doc, "config.orgs.org" + num + ".waterTypes.item" + i)){
                                    String typeName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".waterTypes.item" + i,"typeName", null, false, null) ;
                                    this.saveWaterType(orgTag, typeName);
                                }else{
                                    break ;
                        if(!this.existWaterTypes()){
                            if(configXml.existElement(doc, "config.orgs.org" + num + ".waterTypes")){
                                for(int i = 1 ; i < 10000; i++){
                                    if(configXml.existElement(doc, "config.orgs.org" + num + ".waterTypes.item" + i)){
                                        String typeName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".waterTypes.item" + i,"typeName", null, false, null) ;
                                        this.saveWaterType(orgTag, typeName);
                                    }else{
                                        break ;
                                    }
                                }
                            }
                        }
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/resources/application.yml
@@ -1,6 +1,6 @@
spring:
  profiles:
    include: global, database, database-ym, database-pj, database-sp
    include: global, database, database-ym, database-pj
#actutor的web端口
management:
pipIrr-platform/pipIrr-web/pipIrr-web-operation/src/main/resources/application.yml
@@ -1,6 +1,6 @@
spring:
    profiles:
        include: global, database, database-ym, database-pj, database-sp
        include: global, database, database-ym, database-pj
#actutor的web端口
management:
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/resources/application.yml
@@ -1,6 +1,6 @@
spring:
  profiles:
    include: global, database, database-ym, database-pj, database-sp
    include: global, database, database-ym, database-pj
#actutor的web端口
management:
pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/resources/application.yml
@@ -1,6 +1,6 @@
spring:
    profiles:
        include: global, database, database-ym, database-pj, database-sp
        include: global, database, database-ym, database-pj
#actutor的web端口
management:
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/resources/application.yml
@@ -1,6 +1,6 @@
spring:
  profiles:
    include: global, database, database-ym, database-pj, database-sp
    include: global, database, database-ym, database-pj
#actutor的web端口
management:
pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/util/SsoListener.java
@@ -1,12 +1,17 @@
package com.dy.sso.util;
import com.dy.pipIrrGlobal.util.OrgListenerSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Component;
@Component
public class SsoListener extends OrgListenerSupport implements ApplicationListener<ApplicationReadyEvent> {
    @Autowired
    protected ResourceLoader resourceLoader ;
    @Override
@@ -18,7 +23,7 @@
            e.printStackTrace();
        } finally {
            //初始化机构
            super.init();
            super.init(resourceLoader);
        }
    }
pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/resources/application.yml
@@ -1,6 +1,6 @@
spring:
    profiles:
        include: global, database, database-ym, database-pj, database-sp
        include: global, database, database-ym, database-pj
#actutor的web端口
management:
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/util/OrgListener.java
@@ -1,12 +1,17 @@
package com.dy.pipIrrStatistics.util;
import com.dy.pipIrrGlobal.util.OrgListenerSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Component;
@Component
public class OrgListener extends OrgListenerSupport implements ApplicationListener<ApplicationReadyEvent> {
    @Autowired
    protected ResourceLoader resourceLoader ;
    @Override
    public void onApplicationEvent(ApplicationReadyEvent event) {
@@ -16,7 +21,7 @@
        } catch (InterruptedException e) {
            e.printStackTrace();
        } finally {
            super.init();
            super.init(resourceLoader);
        }
    }
}
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/resources/application.yml
@@ -1,6 +1,6 @@
spring:
    profiles:
        include: global, database, database-ym, database-pj, database-sp
        include: global, database, database-ym, database-pj
#actutor的web端口
management:
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/resources/application.yml
@@ -1,6 +1,6 @@
spring:
    profiles:
        include: global, database, database-ym, database-pj, database-sp
        include: global, database, database-ym, database-pj
#actutor的web端口
management: