From c322d3be15f48adbc8b64ac9168b525744977128 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期五, 11 十月 2024 08:50:18 +0800 Subject: [PATCH] 1、RTU日志信息中增加功能码名称; 2、得不到RTU日志文件时,输出一些信息。 --- pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java | 61 +++++++++++++++++++----------- 1 files changed, 39 insertions(+), 22 deletions(-) diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java index 777c277..43d9acd 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/java/com/dy/rtuMw/Server.java +++ b/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; @@ -24,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 ; @@ -45,6 +45,9 @@ @Value("${server.servlet.context-path}") private String HttpSvPath ; + @Autowired + protected ResourceLoader resourceLoader ; + private List<UnitInterface> units = new ArrayList<UnitInterface>() ; /* @@ -53,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("licence error!") ; -// return ; -// } -// } catch (Exception e) { -// System.out.println("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) ; @@ -120,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(){ @@ -190,6 +203,9 @@ //宸ヤ綔鎶ュお棰戠箒锛孨娆′笂鎶ュ鐞�1娆★紝鍙栧�艰寖鍥存槸1-100 ServerProperties.workReportDealOneByTimes = conf.getSetAttrPlusInt(doc, "config.base", "workReportDealOneByTimes", null, 1, 100, null) ; + + //瑙﹀彂鍙戦�侀拤閽夋姤璀︽秷鎭殑鍙栨按鍙f棩婕忔崯閲忕殑鏈�灏忓�硷紙鍖呮嫭浣嗛櫎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) ; @@ -271,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) ; @@ -315,8 +331,9 @@ */ ///////////////// - //RTU涓婅鏁版嵁澶勭悊妯″潡 + //RTU涓婅鏁版嵁澶勭悊妯″潡锛堜换鍔℃爲锛� RtuDataUnitConfigVo rducVo = new RtuDataUnitConfigVo(); + rducVo.resourceLoader = this.resourceLoader ; AdapterImp_RtuDataUnit rducAdap = new AdapterImp_RtuDataUnit(); rducAdap.setConfig(rducVo); RtuDataUnit rducUnit = RtuDataUnit.getInstance(); -- Gitblit v1.8.0