pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java
@@ -9,8 +9,6 @@
import com.dy.rtuMw.server.tasks.FromRtuComResultConstantTask;
import com.dy.rtuMw.server.tasks.FromRtuDataConstantTask;
import com.dy.common.mw.UnitInterface;
import com.dy.common.mw.channel.rmi.RmiConfigVo;
import com.dy.common.mw.channel.rmi.RmiUnit;
import com.dy.common.mw.channel.tcp.TcpConfigVo;
import com.dy.common.mw.channel.tcp.TcpUnit;
import com.dy.common.mw.core.CoreUnit;
@@ -19,21 +17,24 @@
import com.dy.common.mw.protocol.ProtocolUnit;
import com.dy.common.mw.support.SupportUnit;
import com.dy.common.mw.support.SupportUnitConfigVo;
import com.dy.rtuMw.server.tasks.ToRtuConstantTask;
import com.dy.rtuMw.server.tasks.SendMsConstantTask;
import com.dy.rtuMw.server.tasks.RtuDownConstantTask;
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 ;
   
@@ -44,6 +45,9 @@
   @Value("${server.servlet.context-path}")
   private String HttpSvPath ;
   @Autowired
   protected ResourceLoader resourceLoader ;
   private List<UnitInterface> units = new ArrayList<UnitInterface>() ;
   /*
@@ -52,27 +56,35 @@
      new Server().startServer();
   }
   */
   public void  startServer(){
      /**
      try {
         URL url = Server.class.getResource("/config/this.licence");
         if(!new Lnp(null).parese(url.getPath())){
            System.out.println("licence error!") ;
            return ;
         }
      } catch (Exception e) {
         System.out.println("licence error!") ;
         return ;
      }
      */
      if(this.doStartServer()){
         ServerShutDownHook.OnShutDown();
      }
   }
   /**
    * 启动服务
     */
   public void startServer(){
//      try {
//         URL url = Server.class.getResource("/config/this.licence");
//         if(!new Lnp(null).parese(url.getPath())){
//            System.out.println("zhzc licence error!") ;
//            return ;
//         }
//      } catch (Exception e) {
//         System.out.println("zhzc licence error!") ;
//         return ;
//      }
      //Server sv = new Server();
   private boolean doStartServer(){
      boolean running = false ;
      long start = System.currentTimeMillis() ;
      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) ;
@@ -119,11 +131,13 @@
            System.out.println("@@@@@@@@@@@@@@@@@@@@@@#      &@@@@@@@@       Runing in standalone mode" ) ;    
            System.out.println("@@@@@@@@@@@@@@@@@@@@@&       &@@@@@@@@       Startup in " + (System.currentTimeMillis() - start) + " MS" ) ;              
            System.out.println("@@@@@@@@@@@@@@@@@@@#         &@@@@@@@@       " + company) ;            
            System.out.println("@@@@@@@@@@@@@@@@#O           &@@@@@@@@") ;
            System.out.println("@@@@@@@@@@@@@@@@#O           &@@@@@@@@") ;
         running = true ;
      }catch(Exception e){
         e.printStackTrace();
         running = false ;
      }
      return running ;
   }
   
   private void startUnits(){
@@ -189,6 +203,9 @@
         //工作报太频繁,N次上报处理1次,取值范围是1-100
         ServerProperties.workReportDealOneByTimes =  conf.getSetAttrPlusInt(doc, "config.base", "workReportDealOneByTimes", null, 1, 100, null) ;
         //触发发送钉钉报警消息的取水口日漏损量的最小值(包括但除0.0外)
         ServerProperties.intakeAlarmLossMinValue =  conf.getSetAttrPlusDouble(doc, "config.base", "intakeAlarmLossMinValue", null, 0.0, 1000000.0, null) ;
         //有报警发生时,向钉钉发送消息的间隔时长(分钟)
         ServerProperties.sendDingDingAlarmMsInterval =  conf.getSetAttrPlusInt(doc, "config.base", "sendDingDingAlarmMsInterval", null, 1, 600, null) ;
@@ -270,7 +287,7 @@
         //RTU日志文件存储目录(相对目录)
         resVo.rtuLogDir = conf.getSetAttrTxt(doc, "config.resource", "rtuLogDir", null, false, null) ;
         //RTU日志文件最大字节数(KB)
         resVo.rtuLogFileMaxSize = conf.getSetAttrPlusInt(doc, "config.resource", "rtuLogFileMaxSize", null, 100000, 2000000, null) ;
         resVo.rtuLogFileMaxSize = conf.getSetAttrPlusInt(doc, "config.resource", "rtuLogFileMaxSize", null, 10, 2000000, null) ;
         //RTU日志文件最大文件数
         resVo.rtuLogFileMaxCount = conf.getSetAttrPlusInt(doc, "config.resource", "rtuLogFileMaxCount", null, 1, 10, null) ; 
         
@@ -294,7 +311,8 @@
         
         /////////////////
         //RMI模块
         //RMI模块 暂时不应用
         /*
         RmiConfigVo rmiVo = new RmiConfigVo();
         rmiVo.enable = conf.getSetAttrBoolean(doc, "config.rmi", "enable", null, null) ;
         if(rmiVo.enable){
@@ -310,11 +328,12 @@
            RmiSvUrl = "[ip]:" + rmiVo.port + "/" + rmiVo.context ;
            units.add(rmiUnit) ;
         }
         */
         /////////////////
         //RTU上行数据处理模块
         //RTU上行数据处理模块(任务树)
         RtuDataUnitConfigVo rducVo = new RtuDataUnitConfigVo();
         rducVo.resourceLoader = this.resourceLoader ;
         AdapterImp_RtuDataUnit rducAdap = new AdapterImp_RtuDataUnit();
         rducAdap.setConfig(rducVo);
         RtuDataUnit rducUnit = RtuDataUnit.getInstance();
@@ -337,9 +356,10 @@
         coreAdap.setConfig(coreConfVo);
         CoreUnit coreUnit = CoreUnit.getInstance();
         coreUnit.setAdapter(coreAdap);
         CoreUnit.addConstantTask(new ToRtuConstantTask());
         CoreUnit.addConstantTask(new RtuDownConstantTask());
         CoreUnit.addConstantTask(new FromRtuDataConstantTask());
         CoreUnit.addConstantTask(new FromRtuComResultConstantTask());
         CoreUnit.addConstantTask(new SendMsConstantTask());
         coreUnit.start(obj -> {
         });
         units.add(coreUnit) ;