From c40d049233f2706dd23aadf327dbf86ba0008a12 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期五, 01 十二月 2023 15:04:16 +0800 Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV --- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/global/GlParse.java | 4 pipIrr-platform/pipIrr-web/pipIrr-web-sso/.gitignore | 1 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CommonV1_0_1.java | 52 - pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_C0_Down.java | 6 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_84_Down.java | 6 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/threadPool/ThreadPoolImp.java | 3 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/resources/log4j2.xml | 39 + pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/LocalDecoder.java | 37 + pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpConnect.java | 71 ++ pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/resources/RtuDataDealTree.xml | 16 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/MwTestClientStatus.java | 6 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TkReceive.java | 2 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/ServerProperties.java | 8 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/resources/Tree_.xml | 95 +++ pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_02_Down.java | 6 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TreeConfig.java | 2 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/pom.xml | 120 ++++ pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/RmiRequestVo.java | 13 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/dbSv/RtuSv.java | 2 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/console/CommandConsole.java | 2 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/AdapterImp_RtuDataUnit.java | 19 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/PipIrrMwAcceptApplication.java | 2 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/console/Command.java | 5 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/pom.xml | 15 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TaskPool.java | 5 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/AdapterImp_TcpClUnit.java | 0 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/resources/Config.xml | 8 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/ResConfigVo.java | 42 + pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/resources/Config.xml | 4 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ProtocolConstantV206V1_0_0.java | 5 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpClUnit.java | 181 +++++ pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/resources/log4j2.xml | 31 + pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/Task.java | 2 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TaskConfig.java | 2 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/Code.java | 8 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_71_Down.java | 6 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/RmiRequestVo.java | 6 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/LocalCodecFactory.java | 8 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Data.java | 4 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DriverV1_0_1.java | 2 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/RtuDataNode.java | 10 pipIrr-platform/pipIrr-mw/pom.xml | 8 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/RmiClUnit.java | 33 pipIrr-platform/文档/文件加入了 .gitignore,但还是被 git 跟踪.docx | 0 pipIrr-platform/pipIrr-web/.gitignore | 2 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/ServerProperties.java | 4 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Command.java | 11 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/PrefixedDataAvailableV1_0_1.java | 2 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataV1_0_1.java | 15 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/MyThreadJob.java | 224 +++++++ pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/MwConfigVo.java | 21 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/Server.java | 6 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/FromRtuConstantTask.java | 30 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/pom.xml | 15 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TkRtuData.java | 2 pipIrr-platform/pipIrr-global/.gitignore | 2 pipIrr-platform/pipIrr-mw/.gitignore | 32 + pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/dbSv/说明.txt | 0 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/RtuDataCache.java | 12 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpClUnitConfigVo.java | 2 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/p206V1_0_0/TkPreGenObjs.java | 15 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/MidResultActionFromRtu.java | 6 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TaskSurpport.java | 2 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/RtuDataUnit.java | 47 + pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCdC0Vo.java | 12 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/LocalEncoder.java | 22 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/Server.java | 60 - pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/Manager.java | 19 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TreeParse.java | 7 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpHandler.java | 77 ++ pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/RtuDataUnitConfigVo.java | 5 /dev/null | 15 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/Server.java | 28 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_83_Down.java | 6 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/global/GlCreate.java | 21 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/RtuDataUnitAdapter.java | 10 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/Code.java | 5 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/DataDecoder.java | 14 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/RmiResponseVo.java | 12 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/p206V1_0_0/TkFindP206V1_0_0.java | 4 80 files changed, 1,371 insertions(+), 293 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/DataDecoder.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/DataDecoder.java index 28720a5..b359815 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/DataDecoder.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/DataDecoder.java @@ -28,15 +28,15 @@ * org.apache.mina.filter.codec.ProtocolDecoderOutput) */ protected boolean doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) { - String meterNo = (String)session.getAttribute(TcpIoSessionAttrIdIsRtuAddr.sessionArrIdKey) ; - if(meterNo == null){ + String rtuAddr = (String)session.getAttribute(TcpIoSessionAttrIdIsRtuAddr.sessionArrIdKey) ; + if(rtuAddr == null){ //浼氳瘽鏈绠$悊 //浼氳瘽绠$悊鍣ㄤ腑涓嶅瓨鍦ㄦ浼氳瘽锛岃鏄庡垰寤虹珛缃戠粶杩炴帴锛� return this.doDecode_onLineData(session, in, out) ; }else{ //浼氳瘽宸茶绠$悊 //浼氳瘽绠$悊鍣ㄤ腑瀛樺湪姝や細璇濓紝璇存槑宸茬粡涓婄嚎浜嗭紝 - return this.doDecode_data(session, in, out, meterNo) ; + return this.doDecode_data(session, in, out, rtuAddr) ; } } @@ -73,16 +73,16 @@ * @param session IO浼氳瘽 * @param in 杈撳叆Buffer * @param out 鍗忚杈撳嚭缂栫爜 - * @param meterNo 鎺у埗鍣ㄧ紪鍙� + * @param rtuAddr 鎺у埗鍣ㄥ湴鍧� * @return 鏄惁姝eソ鎴栫矘鍖� */ @SuppressWarnings("unused") - private boolean doDecode_data(IoSession session, IoBuffer in, ProtocolDecoderOutput out, String meterNo) { + private boolean doDecode_data(IoSession session, IoBuffer in, ProtocolDecoderOutput out, String rtuAddr) { //闈炰笂绾挎暟鎹紝鍙兘浼氬嚭鐜版柇鍖呮垨绮樺寘鐜拌薄 PrefixedDataAvailableStatus dataStatus = this.pdaHandle.forUpData(in) ; if(dataStatus == null){ //涓嶅彲鑳藉彂鐢� - log.error("涓ラ噸閿欒锛孯tu (姘磋〃鍙蜂负" + meterNo + ")涓婅鏁版嵁瀹屾暣鎬ф鏌ユ椂锛岃繑鍥炵殑瀵硅薄涓虹┖銆�") ; + log.error("涓ラ噸閿欒锛孯tu (RTU" + rtuAddr + ")涓婅鏁版嵁瀹屾暣鎬ф鏌ユ椂锛岃繑鍥炵殑瀵硅薄涓虹┖銆�") ; this.nextDeal(in, null, out) ; return true; }else{ @@ -94,7 +94,7 @@ this.nextDeal(in, dataStatus.getDataLen(), out) ; if(dataStatus.isAdjoined()){ //璇存槑绮樺寘浜嗭紝杩樻湁鏁版嵁锛岄渶瑕佸杩欎簺鏁版嵁鍐嶆鎵цdoDecode_鏂规硶. - return this.doDecode_data(session, in, out, meterNo) ;//鍔犱笂閫掑綊 + return this.doDecode_data(session, in, out, rtuAddr) ;//鍔犱笂閫掑綊 }else if(dataStatus.isCompleted()){ //鏁版嵁涓嶆柇涓嶇矘 return true; diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Command.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Command.java index 7bb4162..2449b3b 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Command.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Command.java @@ -152,17 +152,6 @@ return this ; } - /* - public static void main(String[] args){ - String json = "{\"attachment\":null,\"code\":\"03\",\"deviceId\":\"d8c9601f214747d98d47a4736e5\",\"id\":\"999999999\",\"meterNo\":\"23040600377\",\"productId\":16873252,\"param\":\"0002\",\"protocol\":\"HAC_NBhV2_5\",\"rtuAddr\":\"863318060168996\",\"type\":\"outerCommand\"}" ; - try { - Command com = jsonToObject(json) ; - System.out.println(com.param); - } catch (Exception e) { - e.printStackTrace(); - } - } - */ public String getId() { return id; diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Data.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Data.java index 58b5ede..3402f09 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Data.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Data.java @@ -57,12 +57,10 @@ Data d = new Data() ; d.code = "01" ; d.rtuAddr = "123234" ; - d.meterNo = "1234567890123456" ; DataV1_0_1 subD = new DataV1_0_1() ; subD.rtuAddr = "2342345" ; - subD.meterNo = "1234567890123456" ; - + d.subData = subD ; diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CommonV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CommonV1_0_1.java index 9ab7b11..c1b8d7f 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CommonV1_0_1.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CommonV1_0_1.java @@ -2,6 +2,7 @@ import com.dy.common.util.ByteUtil; import com.dy.common.util.ByteUtilUnsigned; +import com.dy.common.util.CRC8_for_2_0; public class CommonV1_0_1 { @@ -49,13 +50,26 @@ /** - * 鍒嗘瀽鏁版嵁瀛楄妭鏁� + * 鍒嗘瀽甯ч暱搴� + * @param bs 涓婅瀛楄妭鏁扮粍 + * @return 鏁版嵁闀垮害 + * @throws Exception 寮傚父 + */ + public int parseFrameLen(byte[] bs)throws Exception{ + int len = ByteUtilUnsigned.byte2Byte(bs, ProtocolConstantV206V1_0_0.dataLenIndex) ; + return len + ProtocolConstantV206V1_0_0.lenHead2ctrl + ProtocolConstantV206V1_0_0.lenTail ; + } + + + /** + * 鍒嗘瀽鐢ㄦ埛鏁版嵁鍩熷瓧鑺傛暟 * @param bs 涓婅瀛楄妭鏁扮粍 * @return 鏁版嵁闀垮害 * @throws Exception 寮傚父 */ public int parseDataLen(byte[] bs)throws Exception{ - return ByteUtilUnsigned.bytes2Short_BE(bs, ProtocolConstantV206V1_0_0.dataLenIndex) ; + int len = ByteUtilUnsigned.byte2Byte(bs, ProtocolConstantV206V1_0_0.dataLenIndex) ; + return len + ProtocolConstantV206V1_0_0.lenHead2ctrl + ProtocolConstantV206V1_0_0.lenTail ; } @@ -68,7 +82,7 @@ public String parseRtuAddr(byte[] bs)throws Exception{ String rtuAddrBCD = "" + ByteUtil.BCD2Long_BE(bs, ProtocolConstantV206V1_0_0.rtuAddr1Index_start, ProtocolConstantV206V1_0_0.rtuAddr1Index_end) ; String rtuAddrStr = "" + ByteUtilUnsigned.bytes2Short_BE(bs, ProtocolConstantV206V1_0_0.rtuAddr2Index_start) ; - while(rtuAddrStr.length() < 6){ + while(rtuAddrStr.length() < 4){ rtuAddrStr = "0" + rtuAddrStr ; } return rtuAddrBCD + rtuAddrStr ; @@ -83,20 +97,6 @@ return ByteUtil.bytes2Hex(bs, false, ProtocolConstantV206V1_0_0.codeIndex, 1) ; } - - /** - * 鏍¢獙鍜屾鏌� - * @param bs 涓婅瀛楄妭鏁扮粍 - * @return 閫氳繃true,鏈�氳繃false - */ - public boolean checkCrc(byte[] bs) { - byte he = 0 ; - for(int i = 0 ; i <= bs.length - 3 ; i++){ - he = (byte)(he + bs[i]) ; - } - return bs[bs.length - 2] == he ; - } - /** * 鏍¢獙鍜屾鏌� * @param bs 涓婅瀛楄妭鏁扮粍 @@ -104,16 +104,12 @@ * @throws Exception 寮傚父 */ public String checkCrc_str(byte[] bs) throws Exception { - byte[] he = new byte[1] ; - for(int i = 0 ; i <= bs.length - 3 ; i++){ - he[0] = (byte)(he[0] + bs[i]) ; - } - short hes = ByteUtilUnsigned.byte2Byte(he, 0); - short heOrg = ByteUtilUnsigned.byte2Byte(bs, bs.length - 2); - if(hes == heOrg){ + byte crcCompute = (byte)new CRC8_for_2_0().CRC8(bs, ProtocolConstantV206V1_0_0.ctrlIndex, bs.length - 3) ; + byte crcInBs = bs[bs.length - 2] ; + if(crcCompute == crcInBs){ return null ; }else{ - return "璁$畻鏍¢獙鍜屾槸:" + hes + "锛屼笂浼犳牎楠屽拰鏄�" + heOrg ; + return "璁$畻CRC鏄�:" + crcCompute + "锛屼笂浼燙RC鏄�" + crcInBs ; } } @@ -123,11 +119,11 @@ D7 D6 D5锝濪4 D3锝濪0 浼犺緭鏂瑰悜浣� DIR 鎷嗗垎鏍囧織浣� DIV 甯ц鏁颁綅 FCB 鍔熻兘鐮� */ - public byte createCtrl(byte funcCode){ - byte b = 0 ; + public byte createCtrl(byte dir, byte funcCode){ + byte b = dir;//(byte)0x80//鎺у埗鍩燂細DIR=1锛岃〃绀烘甯ф姤鏂囨槸鐢辩粓绔彂鍑虹殑涓婅鎶ユ枃锛� b = (byte)(b | funcCode) ; //FCB == 3 - b = (byte)(b | (byte)60) ; + b = (byte)(b | (byte)0x18) ; //DIV = 0 //DIR = 0 return b ; diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCdC0Vo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCdC0Vo.java index 997792e..79a731d 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCdC0Vo.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCdC0Vo.java @@ -41,10 +41,14 @@ sb.append(" 鎺у埗鍣ㄦ椂閽燂細"); sb.append(rtuDt==null?"":rtuDt); sb.append("\n"); - sb.append(alarmVo==null?"":alarmVo.toString()); - sb.append("\n"); - sb.append(stateVo==null?"":stateVo.toString()); - sb.append("\n"); + if(alarmVo != null){ + sb.append(alarmVo.toString()); + sb.append("\n"); + } + if(stateVo != null){ + sb.append(stateVo.toString()); + sb.append("\n"); + } return sb.toString() ; } diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataV1_0_1.java index 78675d2..c8c3116 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataV1_0_1.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataV1_0_1.java @@ -25,6 +25,21 @@ if(dataCd02Vo != null){ sb.append(dataCd02Vo.toString()) ; } + if(dataCdC0Vo != null){ + sb.append(dataCdC0Vo.toString()) ; + } + if(dataCd83OpenVo != null){ + sb.append(dataCd83OpenVo.toString()) ; + } + if(dataCd83CloseVo != null){ + sb.append(dataCd83CloseVo.toString()) ; + } + if(dataCd84Vo != null){ + sb.append(dataCd84Vo.toString()) ; + } + if(dataCd71Vo != null){ + sb.append(dataCd71Vo.toString()) ; + } return sb.toString() ; } } diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DriverV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DriverV1_0_1.java index 6ddc78e..38aac6a 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DriverV1_0_1.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DriverV1_0_1.java @@ -9,7 +9,7 @@ @AnnotationDriver(name= ProtocolConstantV206V1_0_0.protocolName) public class DriverV1_0_1 extends Driver { - private static String scanRootPackage = "" ; + private static String scanRootPackage = "com.dy.common.mw.protocol.p206V1_0_0." ; //鍦―river涓槸鍗曚緥锛岄殢Driver鐨勫崟渚嬪璞″湪鍗曠嚎绋嬩腑杩愯 private ParseParamsForUpV1_0_1 upCpParams ; diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/PrefixedDataAvailableV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/PrefixedDataAvailableV1_0_1.java index e53f268..b991de9 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/PrefixedDataAvailableV1_0_1.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/PrefixedDataAvailableV1_0_1.java @@ -100,7 +100,7 @@ return null ; } - Integer dataLen = parseCommon.parseDataLen(preByte) ; + Integer dataLen = parseCommon.parseFrameLen(preByte) ; if(dataLen == null){ String headHex = ByteUtil.bytes2Hex(preByte, true) ; diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ProtocolConstantV206V1_0_0.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ProtocolConstantV206V1_0_0.java index e520aee..3ff2c20 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ProtocolConstantV206V1_0_0.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ProtocolConstantV206V1_0_0.java @@ -14,7 +14,7 @@ * RTU涓婄嚎鏁版嵁锛堜笂绾垮悗绗竴鍖呮暟鎹級鏈�灏忛暱搴︼紝璁剧疆璇ュ睘鎬т互澶囪繘琛屽畬鏁存�ф鏌ワ紝 * 鍗虫柇鍖呮鏌ワ紝浣垮敖鍙兘鏀跺叏涓婄嚎鏁版嵁锛堝彇鍊艰寖鍥�1-100锛� */ - public static final int onLineDataMinLength = 30 ;//閲囩敤闃�鎺у洖鎵э紙鍏堕暱搴︽渶鐭級鐨勫瓧鑺傛暟 + public static final int onLineDataMinLength = 13 ;//閲囩敤蹇冭烦涓婅鏁版嵁闀垮害 /** * RTU涓婃姤鏁版嵁鐨勫ご閮ㄦ渶灏忛暱搴︼紝涓婃姤鏁版嵁涓紝鍙栬繖涓渶灏忛暱搴︾殑閮ㄥ垎鏁版嵁涓紝 @@ -33,7 +33,8 @@ public static final String P_Head_Hex = "68" ; public static final String P_Tail_Hex = "16" ; - public static final byte lenHead2Code = 10 ; //浠庡ご鍒板姛鑳界爜瀛楄妭鏁扮粍闀垮害 + public static final byte lenHead2ctrl = 3 ; //浠庡ご鍒版帶鍒跺煙锛堜笉鍖呮嫭锛夊瓧鑺傛暟缁勯暱搴� + public static final byte lenHead2Code = 10 ; //浠庡ご鍒板姛鑳界爜锛堝寘鎷級瀛楄妭鏁扮粍闀垮害 public static final byte lenTail = 2 ; //甯у熬閮ㄥ瓧鑺傛暟缁勯暱搴� /** * 鎵�鍦ㄥ瓧鑺傛暟缁勭殑浣嶇疆锛堜笅鏍囷級 diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_02_Down.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_02_Down.java index 5a6cb09..a045719 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_02_Down.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_02_Down.java @@ -56,7 +56,7 @@ bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; index++ ; - bsHead[index] = commonV1_0_1.createCtrl((byte)0) ; + bsHead[index] = commonV1_0_1.createCtrl((byte)0, (byte)0) ; index++ ; GlCreate.createRtuAddr(para.rtuAddr, bsHead, index); @@ -72,7 +72,9 @@ GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑 - bytes = GlCreate.createCrcTail(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓� + byte[] bsTail = GlCreate.createCrcTail(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓� + + bytes = ByteUtil.bytesMerge(bytes, bsTail) ; return bytes ; } diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_71_Down.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_71_Down.java index dc4a95a..4b269b6 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_71_Down.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_71_Down.java @@ -59,7 +59,7 @@ bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; index++ ; - bsHead[index] = commonV1_0_1.createCtrl((byte)0) ; + bsHead[index] = commonV1_0_1.createCtrl((byte)0, (byte)0) ; index++ ; GlCreate.createRtuAddr(para.rtuAddr, bsHead, index); @@ -77,7 +77,9 @@ GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑 - bytes = GlCreate.createCrcTail(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓� + byte[] bsTail = GlCreate.createCrcTail(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓� + + bytes = ByteUtil.bytesMerge(bytes, bsTail) ; return bytes ; } diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_83_Down.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_83_Down.java index 600aedb..57be9e7 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_83_Down.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_83_Down.java @@ -60,7 +60,7 @@ bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; index++ ; - bsHead[index] = commonV1_0_1.createCtrl((byte)0) ; + bsHead[index] = commonV1_0_1.createCtrl((byte)0, (byte)0) ; index++ ; GlCreate.createRtuAddr(para.rtuAddr, bsHead, index); @@ -79,7 +79,9 @@ GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑 - bytes = GlCreate.createCrcTail(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓� + byte[] bsTail = GlCreate.createCrcTail(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓� + + bytes = ByteUtil.bytesMerge(bytes, bsTail) ; return bytes ; } diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_84_Down.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_84_Down.java index 9aa0f96..394c7e7 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_84_Down.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_84_Down.java @@ -60,7 +60,7 @@ bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; index++ ; - bsHead[index] = commonV1_0_1.createCtrl((byte)0) ; + bsHead[index] = commonV1_0_1.createCtrl((byte)0, (byte)0) ; index++ ; GlCreate.createRtuAddr(para.rtuAddr, bsHead, index); @@ -79,7 +79,9 @@ GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑 - bytes = GlCreate.createCrcTail(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓� + byte[] bsTail = GlCreate.createCrcTail(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓� + + bytes = ByteUtil.bytesMerge(bytes, bsTail) ; return bytes ; } diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_C0_Down.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_C0_Down.java index f4926b9..f324ea9 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_C0_Down.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_C0_Down.java @@ -60,7 +60,7 @@ bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; index++ ; - bsHead[index] = commonV1_0_1.createCtrl((byte)0) ; + bsHead[index] = commonV1_0_1.createCtrl((byte)0, (byte)0) ; index++ ; GlCreate.createRtuAddr(para.rtuAddr, bsHead, index); @@ -79,7 +79,9 @@ GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑 - bytes = GlCreate.createCrcTail(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓� + byte[] bsTail = GlCreate.createCrcTail(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓� + + bytes = ByteUtil.bytesMerge(bytes, bsTail) ; return bytes ; } diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/global/GlCreate.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/global/GlCreate.java index 4f13733..2567d99 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/global/GlCreate.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/global/GlCreate.java @@ -12,7 +12,6 @@ String rtuAddr1 = rtuAddr.substring(0, 6) ; String rtuAddr2 = rtuAddr.substring(6) ; - index++ ; ByteUtil.string2BCD_BE(bs, rtuAddr1, index) ; index += 3 ; @@ -21,19 +20,19 @@ } public static void createTp(byte[] bs, int index) throws Exception { - ByteUtil.string2BCD_BE(bs, DateTime.yyMMddhhmmss(), index) ; + ByteUtil.string2BCD_LE(bs, DateTime.yyMMddhhmmss(), index) ; } - public static void createLen(byte[] bs) throws Exception { - int len = bs.length + ProtocolConstantV206V1_0_0.lenTail; - bs[ProtocolConstantV206V1_0_0.dataLenIndex] = (byte)len ; + public static void createLen(byte[] bsNoTail) throws Exception { + int len = bsNoTail.length - ProtocolConstantV206V1_0_0.lenHead2ctrl; + bsNoTail[ProtocolConstantV206V1_0_0.dataLenIndex] = (byte)len ; } - public static byte[] createCrcTail(byte[] bs) throws Exception { - int crc = new CRC8_for_2_0().CRC8(bs, ProtocolConstantV206V1_0_0.ctrlIndex, bs.length -1) ; - bs = new byte[ProtocolConstantV206V1_0_0.lenTail] ; - bs[0] = (byte)crc ; - bs[1] = ProtocolConstantV206V1_0_0.P_Tail_Byte ; - return ByteUtil.bytesMerge(bs, bs) ; + public static byte[] createCrcTail(byte[] bsNoTail) throws Exception { + int crc = new CRC8_for_2_0().CRC8(bsNoTail, ProtocolConstantV206V1_0_0.ctrlIndex, bsNoTail.length -1) ; + byte[] bytes = new byte[ProtocolConstantV206V1_0_0.lenTail] ; + bytes[0] = (byte)crc ; + bytes[1] = ProtocolConstantV206V1_0_0.P_Tail_Byte ; + return bytes ; } } diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/global/GlParse.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/global/GlParse.java index 43785ec..a41e004 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/global/GlParse.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/global/GlParse.java @@ -40,9 +40,9 @@ index++ ; dt = ByteUtil.BCD2String_BE(bs, index, index) + ":" + dt ;//鍒� index++ ; - dt = ByteUtil.BCD2String_BE(bs, index, index) + " " + dt ;//鏃� + dt = ByteUtil.BCD2String_BE(bs, index, index) + ":" + dt ;//鏃� index++ ; - dt = ByteUtil.BCD2String_BE(bs, index, index) + "-" + dt ;//鏃� + dt = ByteUtil.BCD2String_BE(bs, index, index) + " " + dt ;//鏃� index++ ; bs[index] = (byte)(bs[index] & 0x10); dt = ByteUtil.BCD2String_BE(bs, index, index) + "-" + dt ;//鏈� diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/threadPool/ThreadPoolImp.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/threadPool/ThreadPoolImp.java index 8ec40ae..15cb864 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/threadPool/ThreadPoolImp.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/threadPool/ThreadPoolImp.java @@ -73,8 +73,7 @@ /** * 鏃ュ織 */ - private Logger log = LogManager.getLogger(MonitorThread.class.getName()); - + private static final Logger log = LogManager.getLogger(MonitorThread.class) ; /** * 绾跨▼姹犳瀯閫犳柟娉� diff --git a/pipIrr-platform/pipIrr-global/.gitignore b/pipIrr-platform/pipIrr-global/.gitignore index 586e5b4..bc1fdd3 100644 --- a/pipIrr-platform/pipIrr-global/.gitignore +++ b/pipIrr-platform/pipIrr-global/.gitignore @@ -1,2 +1,2 @@ target/ -/pipIrr-global.iml +/pipIrr-global.iml \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-mw/.gitignore b/pipIrr-platform/pipIrr-mw/.gitignore index a23b84b..95a2783 100644 --- a/pipIrr-platform/pipIrr-mw/.gitignore +++ b/pipIrr-platform/pipIrr-mw/.gitignore @@ -1,2 +1,34 @@ +HELP.md target/ /pipIrr-mw.iml +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/pom.xml b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/pom.xml index bcbec20..acf0fa5 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/pom.xml +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/pom.xml @@ -132,4 +132,124 @@ <scope>test</scope> </dependency> </dependencies> + + <build> + <plugins> + <!-- 鐢熸垚涓嶅寘鍚緷璧杍ar鐨勫彲鎵цjar鍖� + <plugin> + !- spring boot鎻愪緵鐨刴aven鎵撳寘鎻掍欢 - + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <executions> + <execution> + !- + <goals> + <goal>repackage</goal> + </goals> + - + <configuration> + !- 涓嶅姞鐨勮瘽鏈�缁堝寘鍚嶄负: ${artifactId}-${version}.jar, 鍔犱簡鐨勮瘽鏈�缁堝寘鍚�: ${artifactId}-${version}-${classifier}.jar - + <classifier>execute</classifier> + !- 涓嶆寚瀹氱敓鎴愯矾寰勭殑璇�, 榛樿淇濆瓨鍦� ${build.directory} 涓� - + <outputDirectory>${project.build.directory}/execute</outputDirectory> + <finalName>${artifactId}-${version}</finalName> + <layout>ZIP</layout> + <mainClass>com.dy.pipIrrBase.PipIrrBaseApplication</mainClass> + <includes> + <include> + <groupId>com.dy</groupId> + <artifactId>pipIrr-common</artifactId> + </include> + <include> + <groupId>com.dy</groupId> + <artifactId>pipIrr-global</artifactId> + </include> + </includes> + <excludes> + <exclude> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + </exclude> + </excludes> + </configuration> + </execution> + </executions> + + </plugin> + --> + <!-- 鎷疯礉渚濊禆鐨刯ar鍖呭埌lib鐩綍--> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <executions> + <execution> + <configuration> + <!-- 涓嶅姞鐨勮瘽鏈�缁堝寘鍚嶄负: ${artifactId}-${version}.jar, 鍔犱簡鐨勮瘽鏈�缁堝寘鍚�: ${artifactId}-${version}-${classifier}.jar + <classifier>execute</classifier> + --> + <!-- ${project.build.directory}鏄痬aven鍙橀噺锛屽唴缃殑锛岃〃绀簍arget鐩綍,濡傛灉涓嶅啓锛屽皢鍦ㄦ牴鐩綍涓嬪垱寤�/lib --> + <outputDirectory>${project.build.directory}/lib</outputDirectory> + <!-- excludeTransitive:鏄惁涓嶅寘鍚棿鎺ヤ緷璧栧寘锛屾瘮濡傛垜浠緷璧朅锛屼絾鏄疉鍙堜緷璧栦簡B锛屾垜浠槸鍚︿篃瑕佹妸B鎵撹繘鍘� 榛樿涓嶆墦--> + <excludeTransitive>false</excludeTransitive> + <!-- 澶嶅埗鐨刯ar鏂囦欢鍘绘帀鐗堟湰淇℃伅 --> + <stripVersion>false</stripVersion> + <finalName>${project.artifactId}-${project.version}</finalName> + <layout>ZIP</layout> + <mainClass>com.dy.aceMw.PipIrrMwAcceptApplication</mainClass> + <includes> + <include> + <groupId>com.dy</groupId> + <artifactId>pipIrr-common</artifactId> + </include> + <include> + <groupId>com.dy</groupId> + <artifactId>pipIrr-global</artifactId> + </include> + </includes> + <excludes> + <exclude> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + </exclude> + </excludes> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> + <!-- 璁剧疆java缂栬瘧鐗堟湰锛岃繍琛岀幆澧冪増鏈� --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <!-- source锛� 婧愪唬鐮佺紪璇戠増鏈紱target锛� 鐩爣骞冲彴缂栬瘧鐗堟湰锛沞ncoding锛� 瀛楃闆嗙紪鐮併�� --> + <configuration> + <source>${java.version}</source> + <target>${java.version}</target> + <encoding>${encoding}</encoding> + </configuration> + </plugin> + <plugin> + <!-- 瑙e喅璧勬簮鏂囦欢鐨勭紪鐮侀棶棰� --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <configuration> + <encoding>${encoding}</encoding> + </configuration> + </plugin> + <plugin> + <!-- maven閲屾墽琛屾祴璇曠敤渚嬬殑鎻掍欢 --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <skipTests>true</skipTests> + </configuration> + </plugin> + <plugin> + <!-- 涓嬮潰瑙e喅锛氬綋杩涜Maven Lifecycle package鏃舵姤閿欙細Could not find artifact org.apache.mina:mina-core:bundle:2.2.1 in maven (https://repo1.maven.org/maven2/)--> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + </plugin> + </plugins> + </build> </project> diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/PipIrrMwAcceptApplication.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/PipIrrMwAcceptApplication.java index f69af6f..4b4ec0c 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/PipIrrMwAcceptApplication.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/PipIrrMwAcceptApplication.java @@ -13,7 +13,7 @@ @EnableAspectJAutoProxy @EnableMultiDataSource @ComponentScan(basePackages = {"com.dy.common", "com.dy.pipIrrGlobal", "com.dy.aceMw"}) -@MapperScan(basePackages={"com.dy.pipIrrGlobal.daoBa"}) +@MapperScan(basePackages={"com.dy.pipIrrGlobal.daoRm"}) public class PipIrrMwAcceptApplication implements CommandLineRunner { public static void main(String[] args) { diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/Server.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/Server.java index 6829b00..a368845 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/Server.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/Server.java @@ -3,7 +3,10 @@ import java.util.ArrayList; import java.util.List; -import com.dy.aceMw.server.tasks.BusiConstantTask; +import com.dy.aceMw.server.*; +import com.dy.aceMw.server.rtuData.RtuDataUnit; +import com.dy.aceMw.server.rtuData.RtuDataUnitConfigVo; +import com.dy.aceMw.server.tasks.FromRtuConstantTask; import com.dy.common.mw.UnitInterface; import com.dy.common.mw.UnitStartedCallbackInterface; import com.dy.common.mw.channel.rmi.RmiConfigVo; @@ -16,16 +19,9 @@ import com.dy.common.mw.protocol.ProtocolUnit; import com.dy.common.mw.support.SupportUnit; import com.dy.common.mw.support.SupportUnitConfigVo; -import com.dy.aceMw.server.AdapterImp_CoreUnit; -import com.dy.aceMw.server.AdapterImp_ProtocolUnit; -import com.dy.aceMw.server.AdapterImp_RmiUnit; -import com.dy.aceMw.server.AdapterImp_TcpUnit; -import com.dy.aceMw.server.ServerProperties; import com.dy.aceMw.server.tasks.ToRtuConstantTask; -import com.dy.aceMw.server.AdapterImp_SupportUnit; import com.dy.aceMw.resource.ResourceUnit; import com.dy.aceMw.resource.ResourceUnitConfigVo; -import com.dy.aceMw.server.AdapterImp_ResourceUnit; import com.dy.common.springUtil.SpringContextUtil; import com.dy.common.util.ConfigXml; import com.dy.common.util.IDLongGenerator; @@ -147,7 +143,7 @@ //TCP涓婅鏁版嵁鏃跺埢缂撳瓨鏃堕暱锛屽綋杈惧埌鏃堕暱鏃讹紝TCP涓婅鏁版嵁鏃跺埢琚竻绌猴紝閲囩敤TCP涓婅鏁版嵁鏃跺埢鐩殑鏄紝闃绘涓婃暟鎹悓鏃朵笅鍙戞暟鎹紝鍥犱负RTU澶勭悊涓嶈繃鏉� ServerProperties.lastUpDataTimeLive = conf.getSetAttrPlusInt(doc, "config.base", "lastUpDataTimeLive", null, 0, 5, null) * 1000L ; //鏁版嵁搴撴暟鎹甶d鐢熸垚鍣ㄧ殑id鍚庣紑锛�0鏄粯璁ょ殑鍚庣紑锛屼竴鑸瑆eb绯荤粺搴旂敤锛屾暟鎹腑闂翠欢id鍚庣紑澶т簬绛変簬1 - ServerProperties.dbDataIdSuffix = conf.getSetAttrInt(doc, "config.base", "dbDataIdSuffix", null, 1, 9, null); + ServerProperties.dbDataIdSuffix = conf.getSetAttrInt(doc, "config.base", "dbDataIdSuffix", null, 0, 99, null); //涓婁笅琛屾暟鎹紦瀛橀槦鍒椾腑缂撳瓨鏁版嵁涓暟鐨勬姤璀﹂噺锛岃繖涓笌鐜板疄椤圭洰鎵�鎺ユ按琛ㄦ暟鐩稿叧 ServerProperties.cacheUpDownDataWarnCount = conf.getSetAttrPlusInt(doc, "config.base", "cacheUpDownDataWarnCount", null, 1, null, null) ; //涓婁笅琛屾暟鎹紦瀛橀槦鍒椾腑缂撳瓨鏁版嵁涓暟鐨勬渶澶у�硷紝杩欎釜涓庣幇瀹為」鐩墍鎺ユ按琛ㄦ暟鐩稿叧 @@ -172,10 +168,7 @@ protoAdap.setConfig(protoVo); ProtocolUnit protoUnit = ProtocolUnit.getInstance(); protoUnit.setAdapter(protoAdap); - protoUnit.start(new UnitStartedCallbackInterface(){ - @Override - public void call(Object obj) { - } + protoUnit.start(obj -> { }); units.add(protoUnit) ; @@ -225,10 +218,7 @@ supAdap.setConfig(supVo); SupportUnit supUnit = SupportUnit.getInstance() ; supUnit.setAdapter(supAdap); - supUnit.start(new UnitStartedCallbackInterface(){ - @Override - public void call(Object obj) { - } + supUnit.start(obj -> { }); units.add(supUnit) ; @@ -257,10 +247,7 @@ //褰撳墠鏀寔spring + hibernate resUnit.setSpringContext(SpringContextUtil.getApplicationContext()); - resUnit.start(new UnitStartedCallbackInterface(){ - @Override - public void call(Object obj) { - } + resUnit.start(obj -> { }); units.add(resUnit) ; @@ -277,14 +264,25 @@ rmiAdap.setConfig(rmiVo); RmiUnit rmiUnit = RmiUnit.getInstance(); rmiUnit.setAdapter(rmiAdap); - rmiUnit.start(new UnitStartedCallbackInterface(){ - @Override - public void call(Object obj) { - } + rmiUnit.start(obj -> { }); RmiSvUrl = "[ip]:" + rmiVo.port + "/" + rmiVo.context ; units.add(rmiUnit) ; } + + + ///////////////// + //RTU涓婅鏁版嵁澶勭悊妯″潡 + RtuDataUnitConfigVo rducVo = new RtuDataUnitConfigVo(); + AdapterImp_RtuDataUnit rducAdap = new AdapterImp_RtuDataUnit(); + rducAdap.setConfig(rducVo); + RtuDataUnit rducUnit = RtuDataUnit.getInstance(); + rducUnit.setAdapter(rducAdap); + rducUnit.start(obj -> { + }); + units.add(rducUnit) ; + + // /////////////// // 鏍稿績 @@ -299,11 +297,8 @@ CoreUnit coreUnit = CoreUnit.getInstance(); coreUnit.setAdapter(coreAdap); CoreUnit.addConstantTask(new ToRtuConstantTask()); - CoreUnit.addConstantTask(new BusiConstantTask()); - coreUnit.start(new UnitStartedCallbackInterface(){ - @Override - public void call(Object obj) { - } + CoreUnit.addConstantTask(new FromRtuConstantTask()); + coreUnit.start(obj -> { }); units.add(coreUnit) ; @@ -321,10 +316,7 @@ tcpAdap.setConfig(tcpVo); TcpUnit tcpUnit = TcpUnit.getInstance(); tcpUnit.setAdapter(tcpAdap); - tcpUnit.start(new UnitStartedCallbackInterface(){ - @Override - public void call(Object obj) { - } + tcpUnit.start(obj -> { }); TcpSvUrl = "[ip]:" + tcpVo.port ; units.add(tcpUnit) ; diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/AdapterImp_RtuDataUnit.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/AdapterImp_RtuDataUnit.java new file mode 100644 index 0000000..ec4fe82 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/AdapterImp_RtuDataUnit.java @@ -0,0 +1,19 @@ +package com.dy.aceMw.server; + + +import com.dy.aceMw.server.rtuData.RtuDataUnitAdapter; +import com.dy.aceMw.server.rtuData.RtuDataUnitConfigVo; + +public class AdapterImp_RtuDataUnit implements RtuDataUnitAdapter { + + private RtuDataUnitConfigVo configVo ; + + public RtuDataUnitConfigVo getConfig() { + return configVo; + } + + public void setConfig(RtuDataUnitConfigVo configVo){ + this.configVo = configVo ; + } + +} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/Tree.xml b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/Tree.xml deleted file mode 100644 index 51172bc..0000000 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/Tree.xml +++ /dev/null @@ -1,95 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE project> -<config> - <!-- - id:涓庡搴旂被涓殑闈欐�佹垚鍛樺彉閲弔askId涓�鑷� - enable:鏍囪瘑鏈妭鐐规槸鍚︽墽琛岋紝鑻ユ湰鑺傜偣涓嶆墽琛岋紝鍒欑洿鎺ヨ繘鍏ュ叾瀛愯妭鐐� - --> - <task id="TkReceive" name="鎺ユ敹鏁版嵁" enable="true" class="com.dy.aceMw.server.busi.deal.TkReceive"> - <task id="TkRtuData" name="鎺ユ敹RTU鏁版嵁" enable="true" class="com.dy.aceMw.server.busi.deal.TkRtuData"> - <task id="TkFindP206V1_0_0" name="璇嗗埆P206V1_0_0鏁版嵁" enable="true" class="com.dy.aceMw.server.busi.deal.p206V1_0_0.TkFindP206V1_0_0"> - <task id="TkPreGenObjs" name="棰勫厛鍑嗗鍚勫璞�" enable="true" class="com.dy.aceMw.server.busi.deal.p206V1_0_0.TkPreGenObjs"> - <!-- 璇嗗埆娴佹氮鑰匯TU锛屾暟鎹簱涓病鏈夋垨鏁版嵁搴撳瓨鍦ㄤ絾鏈垎閰嶇疆渚涙按鏈烘瀯 --> - <task id="TkDealRtuTramp" name="璇嗗埆娴佹氮鑰匯TU" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.TkDealRtuTramp" /> - <!-- 闈炴祦娴�匯TU锛屽繀椤绘斁鍦═kDealRtuTramp鍚庨潰 --> - <task id="TkDealNoRtuTramp" name="闈炴祦娴�匯TU" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.TkDealNoRtuTramp"> - <!-- 璇嗗埆涓诲姩涓婃姤鏁版嵁 --> - <task id="TkFindAutoReport" name="璇嗗埆涓诲姩涓婃姤鍙婅Е鍙戜笂鎶ユ暟鎹�" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.TkFindAutoReport"> - <!-- 妫�鏌ユ椂闂寸瓑涓嶆纭殑涓婃姤鏁版嵁 --> - <task id="TkCheckAutoReport" name="妫�鏌ユ椂闂寸瓑涓嶆纭殑涓婃姤鏁版嵁" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.autoReport.TkCheckAutoReport"> - <!-- 妫�鏌ラ噸澶嶄笂鎶ユ暟鎹� --> - <task id="TkCheckRepeatReport" name="妫�鏌ラ噸澶嶄笂鎶ユ暟鎹�" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.autoReport.TkCheckRepeatReport"> - <!-- Mn杩愮淮绯荤粺 --> - <task id="TkMnRtuDealAutoReportLastAlarm" name="杩愮淮RTU涓婃姤鏈�鏂版姤璀�" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.autoReport.TkMnRtuDealAutoReportLastAlarm" /> - <!-- RTU涓诲姩涓婃姤鏁版嵁蹇呴』鍦≧TU涓诲姩涓婃姤鎶ヨ浠诲姟鐨勪笅闈紝浠ュ涓诲姩涓婃姤鏁版嵁涓褰曟槸鍚︽湁鎶ヨ--> - <task id="TkMnRtuDealAutoReportLastData" name="杩愮淮RTU涓诲姩涓婃姤鏈�鏂版暟鎹�" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.autoReport.TkMnRtuDealAutoReportLastData" /> - <!-- RTU瀹炴椂锛堣Е鍙戯級涓婃姤鏁版嵁蹇呴』鍦≧TU涓诲姩涓婃姤鎶ヨ浠诲姟鐨勪笅闈紝浠ュ涓诲姩涓婃姤鏁版嵁涓褰曟槸鍚︽湁鎶ヨ--> - <task id="TkMnRtuDealRealReportLastData" name="杩愮淮RTU瀹炴椂锛堣Е鍙戯級涓婃姤鏈�鏂版暟鎹�" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.autoReport.TkMnRtuDealRealReportLastData" /> - <!-- Org渚涙按鏈烘瀯绯荤粺 --> - <task id="TkOrgRtuDealAutoReportLastAlarm" name="渚涙按鏈烘瀯RTU涓诲姩涓婃姤鏈�鏂版姤璀�" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.autoReport.TkOrgRtuDealAutoReportLastAlarm"> - <task id="TkOrgRtuDealAutoReportAlarm" name="渚涙按鏈烘瀯RTU涓诲姩涓婃姤鎶ヨ" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.autoReport.TkOrgRtuDealAutoReportAlarm" /> - <task id="TkOrgRtuDealReportValveOpResult" name="渚涙按鏈烘瀯RTU涓诲姩涓婃姤寮�鍏抽榾缁撴灉" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.autoReport.TkOrgRtuDealReportValveOpResult" /> - </task> - <!-- RTU涓诲姩涓婃姤鏁版嵁蹇呴』鍦≧TU涓诲姩涓婃姤鎶ヨ浠诲姟鐨勪笅闈紝浠ュ涓诲姩涓婃姤鏁版嵁涓褰曟槸鍚︽湁鎶ヨ--> - <task id="TkOrgRtuDealDayAmountAlarm" name="渚涙按鏈烘瀯RTU鏃ョ粨绱娴侀噺鎶ヨ" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.autoReport.TkOrgRtuDealDayAmountAlarm" > - <task id="TkOrgRtuDeal48HourNoAmount" name="渚涙按鏈烘瀯RTU48灏忔椂鏈敤姘�" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.autoReport.TkOrgRtuDeal48HourNoAmount" > - <task id="TkOrgRtuDealAutoReportLastData" name="渚涙按鏈烘瀯RTU涓诲姩涓婃姤鏈�鏂版暟鎹�" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.autoReport.TkOrgRtuDealAutoReportLastData"> - <task id="TkOrgRtuDealAutoReportData" name="渚涙按鏈烘瀯RTU涓诲姩涓婃姤鏁版嵁" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.autoReport.TkOrgRtuDealAutoReportData" /> - <task id="TkOrgRtuDealCycleData" name="渚涙按鏈烘瀯RTU涓诲姩涓婃姤鍛ㄦ湡閲囬泦鏁版嵁" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.autoReport.TkOrgRtuDealCycleData"> - <task id="TkOrgRtuDealCycleLongSmallAmountAlarm" name="渚涙按鏈烘瀯RTU涓诲姩涓婃姤鍛ㄦ湡閲囬泦鏁版嵁闀挎祦姘村垎鏋�" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.autoReport.TkOrgRtuDealCycleLongSmallAmountAlarm" /> - </task> - <task id="TkOrgRtuDealAmountCost" name="渚涙按鏈烘瀯RTU涓诲姩涓婃姤璁$畻鏃ユ按閲忋�佹湀姘撮噺銆佸強姘磋垂" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.autoReport.TkOrgRtuDealAmountCost" > - <task id="TkOrgRtuDealPayCost" name="渚涙按鏈烘瀯鐢ㄦ按鎴锋按琛ㄧ數瀛愰挶鍖呮敮浠樻按璐�" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.autoReport.TkOrgRtuDealPayCost" /> - </task> - </task> - </task> - </task> - <!-- RTU瀹炴椂锛堣Е鍙戯級涓婃姤鏁版嵁蹇呴』鍦≧TU涓诲姩涓婃姤鎶ヨ浠诲姟鐨勪笅闈紝浠ュ涓诲姩涓婃姤鏁版嵁涓褰曟槸鍚︽湁鎶ヨ--> - <task id="TkOrgRtuDealRealReportLastData" name="渚涙按鏈烘瀯RTU瀹炴椂锛堣Е鍙戯級涓婃姤鏈�鏂版暟鎹�" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.autoReport.TkOrgRtuDealRealReportLastData"> - <task id="TkOrgRtuDealRealReportData" name="渚涙按鏈烘瀯RTU瀹炴椂锛堣Е鍙戯級涓婃姤鏁版嵁" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.autoReport.TkOrgRtuDealRealReportData" /> - </task> - </task> - </task> - </task> - <!-- 璇嗗埆鍛戒护鍝嶅簲鏁版嵁 --> - <task id="TkFindComResponse" name="璇嗗埆鍝嶅簲鍛戒护鏁版嵁" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.TkFindComResponse"> - <task id="TkRtuDealCommandResponse" name="RTU鍝嶅簲鍛戒护鏁版嵁" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.comResponse.TkRtuDealCommandResponse" > - <task id="TkRtuDealSetParamComResponse" name="RTU鍝嶅簲璁剧疆鍙傛暟鍛戒护鏁版嵁" enable="true" class="com.dy.busi.server.rtuData.meterV1_0.comResponse.TkRtuDealSetParamComResponse" /> - </task> - </task> - </task> - </task> - </task> - <task id="TkFindHAC_NBhV2_5" name="璇嗗埆HAC_NBhV2_5鏁版嵁" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.TkFindHAC_NBhV2_5"> - <task id="TkPipPreGenObjs" name="棰勫厛鍑嗗鍚勫璞�" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.TkPipPreGenObjs"> - <!-- 璇嗗埆娴佹氮鑰呯缃戞按琛紝鏁版嵁搴撲腑娌℃湁鎴栨暟鎹簱瀛樺湪浣嗘湭鍒嗛厤缃緵姘存満鏋� --> - <task id="TkPipDealRtuTramp" name="璇嗗埆娴佹氮鑰呯缃戞按琛�" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.TkPipDealRtuTramp" /> - <!-- 闈炴祦娴�呯缃戞按琛紝蹇呴』鏀惧湪TkDealRtuTramp鍚庨潰 --> - <task id="TkPipDealNoRtuTramp" name="闈炴祦娴�呯缃戞按琛�" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.TkPipDealNoRtuTramp"> - <!-- 璇嗗埆涓诲姩涓婃姤鏁版嵁 --> - <task id="TkPipFindAutoReport" name="璇嗗埆涓诲姩涓婃姤鍙婅Е鍙戜笂鎶ユ暟鎹�" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.TkPipFindAutoReport"> - <!-- 妫�鏌ユ椂闂寸瓑涓嶆纭殑涓婃姤鏁版嵁 --> - <task id="TkPipCheckAutoReport" name="妫�鏌ユ椂闂寸瓑涓嶆纭殑涓婃姤鏁版嵁" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.autoReport.TkPipCheckAutoReport"> - <task id="TkPipCheckRepeatAutoReport" name="妫�鏌ラ噸澶嶄笂鎶ユ暟鎹�" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.autoReport.TkPipCheckRepeatAutoReport"> - <!-- Mn杩愮淮绯荤粺 --> - <task id="TkPipMnRtuDealAutoReportLastAlarm" name="杩愮淮绠$綉姘磋〃涓婃姤鏈�鏂版姤璀�" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.autoReport.TkPipMnRtuDealAutoReportLastAlarm" /> - <!-- RTU涓诲姩涓婃姤鏁版嵁蹇呴』鍦≧TU涓诲姩涓婃姤鎶ヨ浠诲姟鐨勪笅闈紝浠ュ涓诲姩涓婃姤鏁版嵁涓褰曟槸鍚︽湁鎶ヨ--> - <task id="TkPipMnRtuDealAutoReportLastData" name="杩愮淮绠$綉姘磋〃涓诲姩涓婃姤鏈�鏂版暟鎹�" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.autoReport.TkPipMnRtuDealAutoReportLastData" /> - <!-- Org渚涙按鏈烘瀯绯荤粺 --> - <task id="TkPipOrgRtuDealAutoReportLastAlarm" name="渚涙按鏈烘瀯绠$綉姘磋〃涓诲姩涓婃姤鏈�鏂版姤璀�" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.autoReport.TkPipOrgRtuDealAutoReportLastAlarm"> - <task id="TkPipOrgRtuDealAutoReportAlarm" name="渚涙按鏈烘瀯绠$綉姘磋〃涓诲姩涓婃姤鎶ヨ" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.autoReport.TkPipOrgRtuDealAutoReportAlarm" /> - </task> - <!-- RTU涓诲姩涓婃姤鏁版嵁蹇呴』鍦≧TU涓诲姩涓婃姤鎶ヨ浠诲姟鐨勪笅闈紝浠ュ涓诲姩涓婃姤鏁版嵁涓褰曟槸鍚︽湁鎶ヨ--> - <task id="TkPipOrgRtuDealAutoReportLastData" name="渚涙按鏈烘瀯绠$綉姘磋〃涓诲姩涓婃姤鏈�鏂版暟鎹�" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.autoReport.TkPipOrgRtuDealAutoReportLastData"> - <task id="TkPipOrgRtuDealAutoReportData" name="渚涙按鏈烘瀯绠$綉姘磋〃涓诲姩涓婃姤鏁版嵁" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.autoReport.TkPipOrgRtuDealAutoReportData" /> - <task id="TkPipOrgRtuDealAmount" name="渚涙按鏈烘瀯绠$綉姘磋〃鏈堟祦閲忕粺璁�" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.autoReport.TkPipOrgRtuDealAmount" /> - </task> - </task> - </task> - </task> - </task> - </task> - </task> - </task> - </task> -</config> diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/MidResultActionFromRtu.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/MidResultActionFromRtu.java index fa580b0..40747c2 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/MidResultActionFromRtu.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/MidResultActionFromRtu.java @@ -1,7 +1,7 @@ package com.dy.aceMw.server.forTcp; -import com.dy.aceMw.server.busi.AboutRtuNode; -import com.dy.aceMw.server.busi.TcpUpDataCache; +import com.dy.aceMw.server.rtuData.RtuDataNode; +import com.dy.aceMw.server.rtuData.RtuDataCache; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -49,7 +49,7 @@ */ private void nextDeal(boolean reportOrResponse_trueOrFalse, MidResultFromRtu resFromRtu){ try{ - TcpUpDataCache.cacheRtuUpData(reportOrResponse_trueOrFalse, new AboutRtuNode(resFromRtu.data)); + RtuDataCache.cacheRtuUpData(reportOrResponse_trueOrFalse, new RtuDataNode(resFromRtu.data)); }catch(Exception e){ log.error(e.getMessage(), e); } diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/TcpUpDataCache.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/RtuDataCache.java similarity index 84% rename from pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/TcpUpDataCache.java rename to pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/RtuDataCache.java index 3da1fb8..a6de4e1 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/TcpUpDataCache.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/RtuDataCache.java @@ -1,21 +1,21 @@ -package com.dy.aceMw.server.busi; +package com.dy.aceMw.server.rtuData; import com.dy.aceMw.server.ServerProperties; import com.dy.common.queue.Node; import com.dy.common.queue.Queue; -public class TcpUpDataCache { +public class RtuDataCache { //TCP涓嬭鍛戒护缂撳瓨闃熷垪 private static Queue cacheQueue = new Queue("tcpUpDataQueue") ; - private static TcpUpDataCache instance = new TcpUpDataCache() ; + private static RtuDataCache instance = new RtuDataCache() ; - private TcpUpDataCache(){ + private RtuDataCache(){ cacheQueue.setLimit(ServerProperties.cacheUpDownDataWarnCount, ServerProperties.cacheUpDownDataMaxCount); } - public static TcpUpDataCache getInstance(){ + public static RtuDataCache getInstance(){ return instance ; } @@ -25,7 +25,7 @@ * @param node node * @throws Exception 寮傚父 */ - public static void cacheRtuUpData(boolean reportOrResponse_trueOrFalse, AboutRtuNode node) throws Exception{ + public static void cacheRtuUpData(boolean reportOrResponse_trueOrFalse, RtuDataNode node) throws Exception{ if(node != null && node.obj != null){ if(reportOrResponse_trueOrFalse){ cacheQueue.pushHead(node); diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/AboutRtuNode.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/RtuDataNode.java similarity index 84% rename from pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/AboutRtuNode.java rename to pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/RtuDataNode.java index 6bcf088..d007230 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/AboutRtuNode.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/RtuDataNode.java @@ -1,20 +1,18 @@ -package com.dy.aceMw.server.busi; +package com.dy.aceMw.server.rtuData; -import com.dy.aceMw.server.busi.deal.TaskPool; -import com.dy.aceMw.server.busi.deal.TaskSurpport; import com.dy.common.queue.NodeObj; import com.dy.common.threadPool.ThreadPool; import com.dy.common.threadPool.TreadPoolFactory; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -public class AboutRtuNode implements NodeObj { +public class RtuDataNode implements NodeObj { - private static final Logger log = LogManager.getLogger(AboutRtuNode.class.getName()); + private static final Logger log = LogManager.getLogger(RtuDataNode.class.getName()); public Object obj ;//鏁版嵁 - public AboutRtuNode(Object obj){ + public RtuDataNode(Object obj){ this.obj = obj ; } /** diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/RtuDataUnit.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/RtuDataUnit.java new file mode 100644 index 0000000..269b85c --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/RtuDataUnit.java @@ -0,0 +1,47 @@ +package com.dy.aceMw.server.rtuData; + +import com.dy.common.mw.UnitAdapterInterface; +import com.dy.common.mw.UnitInterface; +import com.dy.common.mw.UnitStartedCallbackInterface; + +public class RtuDataUnit implements UnitInterface { + + private static RtuDataUnit instance = new RtuDataUnit() ; + + public static RtuDataUnitAdapter adapter ; + public static RtuDataUnitConfigVo confVo ; + + private RtuDataUnit(){} ; + + public static RtuDataUnit getInstance(){ + return instance ; + } + + @Override + public void setAdapter(UnitAdapterInterface adapter) throws Exception { + if(adapter == null){ + throw new Exception("RTU鏁版嵁澶勭悊妯″潡閫傞厤鍣ㄥ璞′笉鑳戒负绌猴紒") ; + } + RtuDataUnit.adapter = (RtuDataUnitAdapter)adapter ; + RtuDataUnit.confVo = RtuDataUnit.adapter.getConfig() ; + if(RtuDataUnit.confVo == null){ + throw new Exception("RTU鏁版嵁澶勭悊妯″潡閰嶇疆瀵硅薄涓嶈兘涓虹┖锛�") ; + } + } + + /** + * 鍒濆鍖栦笂琛屾暟鎹鐞嗕换鍔℃睜 + */ + @Override + public void start(UnitStartedCallbackInterface callback) throws Exception { + TaskPool.setTaskTreeCofig(new TreeParse().parseConfig()); + callback.call(null) ; + System.out.println("RTU鏁版嵁澶勭悊妯″潡鎴愬姛鍚姩"); + } + + @Override + public void stop(UnitStartedCallbackInterface callback) throws Exception { + } + +} + diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/RtuDataUnitAdapter.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/RtuDataUnitAdapter.java new file mode 100644 index 0000000..a9b756f --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/RtuDataUnitAdapter.java @@ -0,0 +1,10 @@ +package com.dy.aceMw.server.rtuData; + + +import com.dy.common.mw.UnitAdapterInterface; + +public interface RtuDataUnitAdapter extends UnitAdapterInterface { + + public RtuDataUnitConfigVo getConfig() ; + +} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/RtuDataUnitConfigVo.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/RtuDataUnitConfigVo.java new file mode 100644 index 0000000..89b0ddd --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/RtuDataUnitConfigVo.java @@ -0,0 +1,5 @@ +package com.dy.aceMw.server.rtuData; + +public class RtuDataUnitConfigVo { + +} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/Task.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/Task.java similarity index 96% rename from pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/Task.java rename to pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/Task.java index 9c615ee..66f221b 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/Task.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/Task.java @@ -1,4 +1,4 @@ -package com.dy.aceMw.server.busi.deal; +package com.dy.aceMw.server.rtuData; public interface Task { diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TaskConfig.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TaskConfig.java similarity index 80% rename from pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TaskConfig.java rename to pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TaskConfig.java index 7817954..b80df4f 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TaskConfig.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TaskConfig.java @@ -1,4 +1,4 @@ -package com.dy.aceMw.server.busi.deal; +package com.dy.aceMw.server.rtuData; public class TaskConfig { diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TaskPool.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TaskPool.java similarity index 94% rename from pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TaskPool.java rename to pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TaskPool.java index 8dcd7fc..78ec7a6 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TaskPool.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TaskPool.java @@ -1,4 +1,4 @@ -package com.dy.aceMw.server.busi.deal; +package com.dy.aceMw.server.rtuData; import java.util.ArrayList; import java.util.List; @@ -108,7 +108,8 @@ if (c == null) { throw new Exception("瀹炰緥鍖栦笂琛屾暟鎹鐞嗕换鍔″璞℃爲澶辫触锛佷换鍔$被涓�" + clazz + "锛�"); }else{ - return (TaskSurpport)c.newInstance(); + return (TaskSurpport)c.getDeclaredConstructor().newInstance(); + //return (TaskSurpport)c.newInstance(); } } diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TaskSurpport.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TaskSurpport.java similarity index 98% rename from pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TaskSurpport.java rename to pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TaskSurpport.java index c120db6..f1e5b28 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TaskSurpport.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TaskSurpport.java @@ -1,4 +1,4 @@ -package com.dy.aceMw.server.busi.deal; +package com.dy.aceMw.server.rtuData; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TkReceive.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TkReceive.java similarity index 94% rename from pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TkReceive.java rename to pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TkReceive.java index f932998..80604c5 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TkReceive.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TkReceive.java @@ -1,4 +1,4 @@ -package com.dy.aceMw.server.busi.deal; +package com.dy.aceMw.server.rtuData; import com.dy.common.mw.protocol.Data; import org.apache.logging.log4j.LogManager; diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TkRtuData.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TkRtuData.java similarity index 94% rename from pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TkRtuData.java rename to pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TkRtuData.java index 1b403ca..23f334c 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TkRtuData.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TkRtuData.java @@ -1,4 +1,4 @@ -package com.dy.aceMw.server.busi.deal; +package com.dy.aceMw.server.rtuData; import com.dy.common.mw.protocol.Data; import org.apache.logging.log4j.LogManager; diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TreeConfig.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TreeConfig.java similarity index 74% rename from pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TreeConfig.java rename to pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TreeConfig.java index ce4bf6a..06bc2cc 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TreeConfig.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TreeConfig.java @@ -1,4 +1,4 @@ -package com.dy.aceMw.server.busi.deal; +package com.dy.aceMw.server.rtuData; public class TreeConfig { public TaskConfig taskConf ; diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TreeParse.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TreeParse.java similarity index 95% rename from pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TreeParse.java rename to pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TreeParse.java index fb4e224..c9182f1 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TreeParse.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/TreeParse.java @@ -1,4 +1,4 @@ -package com.dy.aceMw.server.busi.deal; +package com.dy.aceMw.server.rtuData; import java.net.URL; @@ -29,7 +29,8 @@ */ protected TreeConfig parseConfig() { try { - URL configFileURL = TreeParse.class.getResource("Tree.xml"); + ClassLoader classLoader = ClassLoader.getSystemClassLoader(); + URL configFileURL = classLoader.getResource("RtuDataDealTree.xml"); return this.parse(this.createDom(configFileURL)) ; } catch (Exception e) { System.out.println("绯荤粺鍚姩鏃讹紝鍒濆涓婅鏁版嵁澶勭悊浠诲姟閰嶇疆鍑洪敊 !"); @@ -68,7 +69,7 @@ private TreeConfig parse(Document doc) throws Exception { Element root = doc.getRootElement(); if (root == null) { - throw new Exception("鏈緱鍒颁笂琛屾暟鎹鐞嗕换鍔¢厤缃枃浠舵牴鍏冪礌config!"); + throw new Exception("鏈緱鍒颁笂琛屾暟鎹鐞嗕换鍔¢厤缃枃浠舵牴鍏冪礌project!"); } List<Element> rootTasks = root.getChildren("task") ; diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/dbSv/RtuSv.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/dbSv/RtuSv.java similarity index 64% rename from pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/dbSv/RtuSv.java rename to pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/dbSv/RtuSv.java index ddd1aec..271001a 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/dbSv/RtuSv.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/dbSv/RtuSv.java @@ -1,4 +1,4 @@ -package com.dy.aceMw.server.busi.deal.dbSv; +package com.dy.aceMw.server.rtuData.dbSv; import org.springframework.stereotype.Service; diff --git "a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/dbSv/\350\257\264\346\230\216.txt" "b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/dbSv/\350\257\264\346\230\216.txt" similarity index 100% rename from "pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/dbSv/\350\257\264\346\230\216.txt" rename to "pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/dbSv/\350\257\264\346\230\216.txt" diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/p206V1_0_0/TkFindP206V1_0_0.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/p206V1_0_0/TkFindP206V1_0_0.java similarity index 85% rename from pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/p206V1_0_0/TkFindP206V1_0_0.java rename to pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/p206V1_0_0/TkFindP206V1_0_0.java index 62f9780..91fda1b 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/p206V1_0_0/TkFindP206V1_0_0.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/p206V1_0_0/TkFindP206V1_0_0.java @@ -1,7 +1,7 @@ -package com.dy.aceMw.server.busi.deal.p206V1_0_0; +package com.dy.aceMw.server.rtuData.p206V1_0_0; -import com.dy.aceMw.server.busi.deal.TaskSurpport; +import com.dy.aceMw.server.rtuData.TaskSurpport; import com.dy.common.mw.protocol.Data; import com.dy.common.mw.protocol.p206V1_0_0.ProtocolConstantV206V1_0_0; diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/p206V1_0_0/TkPreGenObjs.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/p206V1_0_0/TkPreGenObjs.java similarity index 85% rename from pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/p206V1_0_0/TkPreGenObjs.java rename to pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/p206V1_0_0/TkPreGenObjs.java index 11ad57a..4e13d52 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/p206V1_0_0/TkPreGenObjs.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/rtuData/p206V1_0_0/TkPreGenObjs.java @@ -1,6 +1,6 @@ -package com.dy.aceMw.server.busi.deal.p206V1_0_0; +package com.dy.aceMw.server.rtuData.p206V1_0_0; -import com.dy.aceMw.server.busi.deal.TaskSurpport; +import com.dy.aceMw.server.rtuData.TaskSurpport; import com.dy.common.mw.protocol.Data; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -20,6 +20,7 @@ public void execute(Object data) { Data d = (Data)data ; String rtuAddr = d.getRtuAddr() ; + log.info("RTU" + rtuAddr + "鏁版嵁鍒版锛岃繕鏈疄鐜板鐞�:" + data.toString()); //寰楀埌鏈湴RTU 鏁版嵁锛屼互澶囧悗闈㈣妭鐐瑰簲鐢� /* BuziInterface baseBusi = BuziGeter.getBaseBusi() ; @@ -35,7 +36,7 @@ if(orgBusi == null){ log.error("涓ラ噸閿欒锛屾湭鑳藉緱鍒版爣绛句负" + nbRtu.orgTag + "鐨勪緵姘存満鏋勬暟鎹簱涓氬姟Busi"); }else{ - BaMeter meter = DbOrgBuzi.getMeterByImeiAndNo(orgBusi, imei, meterNo) ; + BaMeter meter = DbOrgBuzi.getMeterByImeiAndNo(orgBusi, imei, rtuAddr) ; //鍙兘鏈煡璇㈠埌meter锛屽嵆浠嶆槸娴佹氮鑰匯TU锛屼絾浠嶈鍚庣画澶勭悊锛氾紙1锛夈�佷粛鑳借瘑鍒嚭娴佹氮鑰匯TU锛岋紙2锛夈�佷粛瑕佽褰曞叾涓婃姤鏁版嵁 if(meter != null){ String protocol = d.getProtocol() ; @@ -57,9 +58,9 @@ }else{ //NB浜у搧锛圧TU瀹炰綋锛夋湭鍒嗛厤缁欏叿浣撶殑渚涙按鏈烘瀯 //娴佹氮鑰匯TU - rtuTramp = DbSyBuzi.getSyRtuTramp(baseBusi, imei, meterNo) ; + rtuTramp = DbSyBuzi.getSyRtuTramp(baseBusi, imei, rtuAddr) ; if(rtuTramp == null){ - rtuTramp = new SyRtuTramp(imei, meterNo) ; + rtuTramp = new SyRtuTramp(imei, rtuAddr) ; } this.taskResult = new Object[]{baseBusi, orgBusi, nbRtu, rtuTramp, null} ; this.toNextOneTask(data, TkDealRtuTramp.taskId); @@ -67,9 +68,9 @@ }else{ //鏁版嵁搴撲腑鏈煡璇㈠埌NB浜у搧锛圧TU瀹炰綋锛� //娴佹氮鑰匯TU - rtuTramp = DbSyBuzi.getSyRtuTramp(baseBusi, imei, meterNo) ; + rtuTramp = DbSyBuzi.getSyRtuTramp(baseBusi, imei, rtuAddr) ; if(rtuTramp == null){ - rtuTramp = new SyRtuTramp(imei, meterNo) ; + rtuTramp = new SyRtuTramp(imei, rtuAddr) ; } this.taskResult = new Object[]{baseBusi, orgBusi, nbRtu, rtuTramp, null} ; this.toNextOneTask(data, TkDealRtuTramp.taskId); diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/BusiConstantTask.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/FromRtuConstantTask.java similarity index 63% rename from pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/BusiConstantTask.java rename to pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/FromRtuConstantTask.java index f710dda..266d88f 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/BusiConstantTask.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/FromRtuConstantTask.java @@ -1,7 +1,7 @@ package com.dy.aceMw.server.tasks; -import com.dy.aceMw.server.busi.AboutRtuNode; -import com.dy.aceMw.server.busi.TcpUpDataCache; +import com.dy.aceMw.server.rtuData.RtuDataNode; +import com.dy.aceMw.server.rtuData.RtuDataCache; import com.dy.common.mw.core.CoreTask; import com.dy.common.queue.Node; import org.apache.logging.log4j.LogManager; @@ -10,8 +10,8 @@ /** * 瀵筊TU涓婅鏁版嵁杩涜涓氬姟澶勭悊 */ -public class BusiConstantTask extends CoreTask { - private static final Logger log = LogManager.getLogger(BusiConstantTask.class.getName()); +public class FromRtuConstantTask extends CoreTask { + private static final Logger log = LogManager.getLogger(FromRtuConstantTask.class.getName()); /** * 鍦ㄥ崟绾跨▼鐜涓繍琛� @@ -19,7 +19,7 @@ @Override public Integer excute() { try{ - return dealRtuUpdata() ; + return dealRtuUpData() ; }catch(Exception e){ log.error(e); } @@ -29,12 +29,12 @@ /** * 澶勭悊涓婅鏁版嵁 */ - public Integer dealRtuUpdata() { - Node first = TcpUpDataCache.getFirstQueueNode() ; + public Integer dealRtuUpData() { + Node first = RtuDataCache.getFirstQueueNode() ; if(first != null){ - Integer count = TcpUpDataCache.size() ; - Node last = TcpUpDataCache.getLastQueueNode() ; - this.doDealRtuUpdata(first, last); + Integer count = RtuDataCache.size() ; + Node last = RtuDataCache.getLastQueueNode() ; + this.doDealRtuUpData(first, last); return count ; } return null ; @@ -45,18 +45,18 @@ * @param first 绗竴涓妭鐐� * @param last 鏈�鍚庝竴涓妭鐐� */ - private void doDealRtuUpdata(Node first, Node last){ + private void doDealRtuUpData(Node first, Node last){ if(last != null){ //鍦╠ealNode鏂规硶涓紝鍙兘瑕佹妸last浠庨槦鍒椾腑绉婚櫎锛岃繖鏃秎ast.pre涓虹┖锛屾墍浠ユ彁鍓嶆妸last.pre鍙栧嚭鏉� Node pre = last.pre ; dealNode(last) ; if(first != null && first != last){ - doDealRtuUpdata(first, pre) ; + doDealRtuUpData(first, pre) ; }else if(first != null && first == last){ //鍋滄 }else if(first == null){ //杩欑鎯呭喌涓嶄細瀛樺湪 - doDealRtuUpdata(null, pre) ; + doDealRtuUpData(null, pre) ; } } } @@ -66,9 +66,9 @@ * @param node 鑺傜偣 */ private void dealNode(Node node){ - AboutRtuNode obj = (AboutRtuNode)node.obj ; + RtuDataNode obj = (RtuDataNode)node.obj ; obj.dealSelf() ; - TcpUpDataCache.removeNode(node); + RtuDataCache.removeNode(node); } } diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/resources/RtuDataDealTree.xml b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/resources/RtuDataDealTree.xml new file mode 100644 index 0000000..8a89412 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/resources/RtuDataDealTree.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE project> +<project> + <!-- + id:涓庡搴旂被涓殑闈欐�佹垚鍛樺彉閲弔askId涓�鑷� + enable:鏍囪瘑鏈妭鐐规槸鍚︽墽琛岋紝鑻ユ湰鑺傜偣涓嶆墽琛岋紝鍒欑洿鎺ヨ繘鍏ュ叾瀛愯妭鐐� + --> + <task id="TkReceive" name="鎺ユ敹鏁版嵁" enable="true" class="com.dy.aceMw.server.rtuData.TkReceive"> + <task id="TkRtuData" name="鎺ユ敹RTU鏁版嵁" enable="true" class="com.dy.aceMw.server.rtuData.TkRtuData"> + <task id="TkFindP206V1_0_0" name="璇嗗埆P206V1_0_0鏁版嵁" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.TkFindP206V1_0_0"> + <task id="TkPreGenObjs" name="棰勫厛鍑嗗鍚勫璞�" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.TkPreGenObjs"> + </task> + </task> + </task> + </task> +</project> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/resources/Tree_.xml b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/resources/Tree_.xml new file mode 100644 index 0000000..8931838 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/resources/Tree_.xml @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE project> +<project> +<!-- +id:涓庡搴旂被涓殑闈欐�佹垚鍛樺彉閲弔askId涓�鑷� +enable:鏍囪瘑鏈妭鐐规槸鍚︽墽琛岋紝鑻ユ湰鑺傜偣涓嶆墽琛岋紝鍒欑洿鎺ヨ繘鍏ュ叾瀛愯妭鐐� +--> +<task id="TkReceive" name="鎺ユ敹鏁版嵁" enable="true" class="com.dy.aceMw.server.rtuData.TkReceive"> + <task id="TkRtuData" name="鎺ユ敹RTU鏁版嵁" enable="true" class="com.dy.aceMw.server.rtuData.TkRtuData"> + <task id="TkFindP206V1_0_0" name="璇嗗埆P206V1_0_0鏁版嵁" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.TkFindP206V1_0_0"> + <task id="TkPreGenObjs" name="棰勫厛鍑嗗鍚勫璞�" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.TkPreGenObjs"> + <!-- 璇嗗埆娴佹氮鑰匯TU锛屾暟鎹簱涓病鏈夋垨鏁版嵁搴撳瓨鍦ㄤ絾鏈垎閰嶇疆渚涙按鏈烘瀯 --> + <task id="TkDealRtuTramp" name="璇嗗埆娴佹氮鑰匯TU" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.TkDealRtuTramp" /> + <!-- 闈炴祦娴�匯TU锛屽繀椤绘斁鍦═kDealRtuTramp鍚庨潰 --> + <task id="TkDealNoRtuTramp" name="闈炴祦娴�匯TU" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.TkDealNoRtuTramp"> + <!-- 璇嗗埆涓诲姩涓婃姤鏁版嵁 --> + <task id="TkFindAutoReport" name="璇嗗埆涓诲姩涓婃姤鍙婅Е鍙戜笂鎶ユ暟鎹�" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.TkFindAutoReport"> + <!-- 妫�鏌ユ椂闂寸瓑涓嶆纭殑涓婃姤鏁版嵁 --> + <task id="TkCheckAutoReport" name="妫�鏌ユ椂闂寸瓑涓嶆纭殑涓婃姤鏁版嵁" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.autoReport.TkCheckAutoReport"> + <!-- 妫�鏌ラ噸澶嶄笂鎶ユ暟鎹� --> + <task id="TkCheckRepeatReport" name="妫�鏌ラ噸澶嶄笂鎶ユ暟鎹�" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.autoReport.TkCheckRepeatReport"> + <!-- Mn杩愮淮绯荤粺 --> + <task id="TkMnRtuDealAutoReportLastAlarm" name="杩愮淮RTU涓婃姤鏈�鏂版姤璀�" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.autoReport.TkMnRtuDealAutoReportLastAlarm" /> + <!-- RTU涓诲姩涓婃姤鏁版嵁蹇呴』鍦≧TU涓诲姩涓婃姤鎶ヨ浠诲姟鐨勪笅闈紝浠ュ涓诲姩涓婃姤鏁版嵁涓褰曟槸鍚︽湁鎶ヨ--> + <task id="TkMnRtuDealAutoReportLastData" name="杩愮淮RTU涓诲姩涓婃姤鏈�鏂版暟鎹�" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.autoReport.TkMnRtuDealAutoReportLastData" /> + <!-- RTU瀹炴椂锛堣Е鍙戯級涓婃姤鏁版嵁蹇呴』鍦≧TU涓诲姩涓婃姤鎶ヨ浠诲姟鐨勪笅闈紝浠ュ涓诲姩涓婃姤鏁版嵁涓褰曟槸鍚︽湁鎶ヨ--> + <task id="TkMnRtuDealRealReportLastData" name="杩愮淮RTU瀹炴椂锛堣Е鍙戯級涓婃姤鏈�鏂版暟鎹�" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.autoReport.TkMnRtuDealRealReportLastData" /> + <!-- Org渚涙按鏈烘瀯绯荤粺 --> + <task id="TkOrgRtuDealAutoReportLastAlarm" name="渚涙按鏈烘瀯RTU涓诲姩涓婃姤鏈�鏂版姤璀�" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.autoReport.TkOrgRtuDealAutoReportLastAlarm"> + <task id="TkOrgRtuDealAutoReportAlarm" name="渚涙按鏈烘瀯RTU涓诲姩涓婃姤鎶ヨ" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.autoReport.TkOrgRtuDealAutoReportAlarm" /> + <task id="TkOrgRtuDealReportValveOpResult" name="渚涙按鏈烘瀯RTU涓诲姩涓婃姤寮�鍏抽榾缁撴灉" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.autoReport.TkOrgRtuDealReportValveOpResult" /> + </task> + <!-- RTU涓诲姩涓婃姤鏁版嵁蹇呴』鍦≧TU涓诲姩涓婃姤鎶ヨ浠诲姟鐨勪笅闈紝浠ュ涓诲姩涓婃姤鏁版嵁涓褰曟槸鍚︽湁鎶ヨ--> + <task id="TkOrgRtuDealDayAmountAlarm" name="渚涙按鏈烘瀯RTU鏃ョ粨绱娴侀噺鎶ヨ" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.autoReport.TkOrgRtuDealDayAmountAlarm" > + <task id="TkOrgRtuDeal48HourNoAmount" name="渚涙按鏈烘瀯RTU48灏忔椂鏈敤姘�" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.autoReport.TkOrgRtuDeal48HourNoAmount" > + <task id="TkOrgRtuDealAutoReportLastData" name="渚涙按鏈烘瀯RTU涓诲姩涓婃姤鏈�鏂版暟鎹�" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.autoReport.TkOrgRtuDealAutoReportLastData"> + <task id="TkOrgRtuDealAutoReportData" name="渚涙按鏈烘瀯RTU涓诲姩涓婃姤鏁版嵁" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.autoReport.TkOrgRtuDealAutoReportData" /> + <task id="TkOrgRtuDealCycleData" name="渚涙按鏈烘瀯RTU涓诲姩涓婃姤鍛ㄦ湡閲囬泦鏁版嵁" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.autoReport.TkOrgRtuDealCycleData"> + <task id="TkOrgRtuDealCycleLongSmallAmountAlarm" name="渚涙按鏈烘瀯RTU涓诲姩涓婃姤鍛ㄦ湡閲囬泦鏁版嵁闀挎祦姘村垎鏋�" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.autoReport.TkOrgRtuDealCycleLongSmallAmountAlarm" /> + </task> + <task id="TkOrgRtuDealAmountCost" name="渚涙按鏈烘瀯RTU涓诲姩涓婃姤璁$畻鏃ユ按閲忋�佹湀姘撮噺銆佸強姘磋垂" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.autoReport.TkOrgRtuDealAmountCost" > + <task id="TkOrgRtuDealPayCost" name="渚涙按鏈烘瀯鐢ㄦ按鎴锋按琛ㄧ數瀛愰挶鍖呮敮浠樻按璐�" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.autoReport.TkOrgRtuDealPayCost" /> + </task> + </task> + </task> + </task> + <!-- RTU瀹炴椂锛堣Е鍙戯級涓婃姤鏁版嵁蹇呴』鍦≧TU涓诲姩涓婃姤鎶ヨ浠诲姟鐨勪笅闈紝浠ュ涓诲姩涓婃姤鏁版嵁涓褰曟槸鍚︽湁鎶ヨ--> + <task id="TkOrgRtuDealRealReportLastData" name="渚涙按鏈烘瀯RTU瀹炴椂锛堣Е鍙戯級涓婃姤鏈�鏂版暟鎹�" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.autoReport.TkOrgRtuDealRealReportLastData"> + <task id="TkOrgRtuDealRealReportData" name="渚涙按鏈烘瀯RTU瀹炴椂锛堣Е鍙戯級涓婃姤鏁版嵁" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.autoReport.TkOrgRtuDealRealReportData" /> + </task> + </task> + </task> + </task> + <!-- 璇嗗埆鍛戒护鍝嶅簲鏁版嵁 --> + <task id="TkFindComResponse" name="璇嗗埆鍝嶅簲鍛戒护鏁版嵁" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.TkFindComResponse"> + <task id="TkRtuDealCommandResponse" name="RTU鍝嶅簲鍛戒护鏁版嵁" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.comResponse.TkRtuDealCommandResponse" > + <task id="TkRtuDealSetParamComResponse" name="RTU鍝嶅簲璁剧疆鍙傛暟鍛戒护鏁版嵁" enable="true" class="com.dy.aceMw.server.rtuData.p206V1_0_0.comResponse.TkRtuDealSetParamComResponse" /> + </task> + </task> + </task> + </task> + </task> + <task id="TkFindHAC_NBhV2_5" name="璇嗗埆HAC_NBhV2_5鏁版嵁" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.TkFindHAC_NBhV2_5"> + <task id="TkPipPreGenObjs" name="棰勫厛鍑嗗鍚勫璞�" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.TkPipPreGenObjs"> + <!-- 璇嗗埆娴佹氮鑰呯缃戞按琛紝鏁版嵁搴撲腑娌℃湁鎴栨暟鎹簱瀛樺湪浣嗘湭鍒嗛厤缃緵姘存満鏋� --> + <task id="TkPipDealRtuTramp" name="璇嗗埆娴佹氮鑰呯缃戞按琛�" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.TkPipDealRtuTramp" /> + <!-- 闈炴祦娴�呯缃戞按琛紝蹇呴』鏀惧湪TkDealRtuTramp鍚庨潰 --> + <task id="TkPipDealNoRtuTramp" name="闈炴祦娴�呯缃戞按琛�" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.TkPipDealNoRtuTramp"> + <!-- 璇嗗埆涓诲姩涓婃姤鏁版嵁 --> + <task id="TkPipFindAutoReport" name="璇嗗埆涓诲姩涓婃姤鍙婅Е鍙戜笂鎶ユ暟鎹�" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.TkPipFindAutoReport"> + <!-- 妫�鏌ユ椂闂寸瓑涓嶆纭殑涓婃姤鏁版嵁 --> + <task id="TkPipCheckAutoReport" name="妫�鏌ユ椂闂寸瓑涓嶆纭殑涓婃姤鏁版嵁" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.autoReport.TkPipCheckAutoReport"> + <task id="TkPipCheckRepeatAutoReport" name="妫�鏌ラ噸澶嶄笂鎶ユ暟鎹�" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.autoReport.TkPipCheckRepeatAutoReport"> + <!-- Mn杩愮淮绯荤粺 --> + <task id="TkPipMnRtuDealAutoReportLastAlarm" name="杩愮淮绠$綉姘磋〃涓婃姤鏈�鏂版姤璀�" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.autoReport.TkPipMnRtuDealAutoReportLastAlarm" /> + <!-- RTU涓诲姩涓婃姤鏁版嵁蹇呴』鍦≧TU涓诲姩涓婃姤鎶ヨ浠诲姟鐨勪笅闈紝浠ュ涓诲姩涓婃姤鏁版嵁涓褰曟槸鍚︽湁鎶ヨ--> + <task id="TkPipMnRtuDealAutoReportLastData" name="杩愮淮绠$綉姘磋〃涓诲姩涓婃姤鏈�鏂版暟鎹�" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.autoReport.TkPipMnRtuDealAutoReportLastData" /> + <!-- Org渚涙按鏈烘瀯绯荤粺 --> + <task id="TkPipOrgRtuDealAutoReportLastAlarm" name="渚涙按鏈烘瀯绠$綉姘磋〃涓诲姩涓婃姤鏈�鏂版姤璀�" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.autoReport.TkPipOrgRtuDealAutoReportLastAlarm"> + <task id="TkPipOrgRtuDealAutoReportAlarm" name="渚涙按鏈烘瀯绠$綉姘磋〃涓诲姩涓婃姤鎶ヨ" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.autoReport.TkPipOrgRtuDealAutoReportAlarm" /> + </task> + <!-- RTU涓诲姩涓婃姤鏁版嵁蹇呴』鍦≧TU涓诲姩涓婃姤鎶ヨ浠诲姟鐨勪笅闈紝浠ュ涓诲姩涓婃姤鏁版嵁涓褰曟槸鍚︽湁鎶ヨ--> + <task id="TkPipOrgRtuDealAutoReportLastData" name="渚涙按鏈烘瀯绠$綉姘磋〃涓诲姩涓婃姤鏈�鏂版暟鎹�" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.autoReport.TkPipOrgRtuDealAutoReportLastData"> + <task id="TkPipOrgRtuDealAutoReportData" name="渚涙按鏈烘瀯绠$綉姘磋〃涓诲姩涓婃姤鏁版嵁" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.autoReport.TkPipOrgRtuDealAutoReportData" /> + <task id="TkPipOrgRtuDealAmount" name="渚涙按鏈烘瀯绠$綉姘磋〃鏈堟祦閲忕粺璁�" enable="true" class="com.dy.busi.server.rtuData.HAC_NBhV2_5.autoReport.TkPipOrgRtuDealAmount" /> + </task> + </task> + </task> + </task> + </task> + </task> + </task> + </task> +</task> +</project> diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/pom.xml b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/pom.xml index 6e14d6b..9a3404c 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/pom.xml +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/pom.xml @@ -37,6 +37,21 @@ </dependencies> <build> + <resources> + <resource> + <directory>src/main/java</directory> + <includes> + <include>**/*.xml</include> + </includes> + </resource> + <resource> + <directory>src/main/resources</directory> + <includes> + <include>**/*.xml</include> + <include>**/*.yml</include> + </includes> + </resource> + </resources> <plugins> <plugin> <!-- 璇ユ彃浠朵笉浼氬皢椤圭洰涓紩鍏ョ殑渚濊禆鎵撹繘鏈�缁堢殑 Jar 鏂囦欢 --> diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/AdapterImp_HttpClUnit.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/AdapterImp_TcpClUnit.java similarity index 100% rename from pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/AdapterImp_HttpClUnit.java rename to pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/AdapterImp_TcpClUnit.java diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/Server.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/Server.java index 7aa1596..ef09342 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/Server.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/Server.java @@ -68,20 +68,40 @@ //鏀寔妯″潡锛� springHibernate鍜� 绾跨▼姹� SupportUnitConfigVo supVo = new SupportUnitConfigVo() ; //鐭伐浣滄椂闀跨嚎绋嬫睜锛岀嚎绋嬭礋璐g敤鏃惰緝鐭殑宸ヤ綔浠诲姟 - supVo.short_maxThread = conf.getSetAttrPlusInt(doc, "config.support", "short_maxThread", null, 1, 1000, null) ;//姹犱腑鏈�澶х嚎绋嬫暟涓烘墍鏈塁PU鏍告暟+1 - supVo.short_minThread = conf.getSetAttrPlusInt(doc, "config.support", "short_minThread", null, 1, 5, null) ;//姹犱腑鏈�灏忕嚎绋嬫暟 + supVo.short_maxThread = conf.getSetAttrPlusInt(doc, "config.support", "short_maxThread", null, -1, 1000, null) ;//姹犱腑鏈�澶х嚎绋嬫暟涓烘墍鏈塁PU鏍告暟+1 + if(supVo.short_maxThread < 0){ + supVo.short_maxThread = -1 ; + } + supVo.short_minThread = conf.getSetAttrPlusInt(doc, "config.support", "short_minThread", null, -1, 100, null) ;//姹犱腑鏈�灏忕嚎绋嬫暟 + if(supVo.short_minThread < 0){ + supVo.short_minThread = -1 ; + } supVo.short_freeTimeout = conf.getSetAttrPlusInt(doc, "config.support", "short_freeTimeout", null, 1, 90, null) * 1000 ;//绾跨▼鏁扮┖闂叉椂闀匡紝鑻ユ睜涓嚎绋嬫暟閲忓ぇ浜巑inThread锛屼笖鏈夌殑绾跨▼绌洪棽鏃堕暱瓒呰繃freeTimeout锛屽垯娓呴櫎璇ョ嚎绋嬶紝涓轰簡涓嶆竻闄わ紝鎶妋inThread涓巑axThread璁剧疆鐩哥瓑 supVo.short_busyTimeout = conf.getSetAttrPlusInt(doc, "config.support", "short_busyTimeout", null, 1, 10, null) * 1000 ;//绾跨▼涓嶉棿鏂伐浣滄椂闀匡紙鍗曚綅涓虹)瓒呮椂闄愶紝璁や负绾跨▼宸茬粡浜嗗穿婧冿紝灏嗗己鍒舵竻闄わ紝鐭伐浣滄椂闀胯缃负5绉� + if(supVo.short_maxThread == 0 || supVo.short_minThread == 0){ + supVo.enableShortThreadPool = false ; + }else{ + supVo.enableShortThreadPool = true ; + } + //闀垮伐浣滄椂闀跨嚎绋嬫睜锛岀嚎绋嬭礋璐g敤鏃惰緝闀跨殑宸ヤ綔浠诲姟 supVo.long_maxThread = conf.getSetAttrInt(doc, "config.support", "long_maxThread", null, -1, 1000, null) ;//姹犱腑鏈�澶х嚎绋嬫暟,鑻ヤ负-1锛屼笉鍙楅檺鍒� if(supVo.long_maxThread < 0){ supVo.long_maxThread = -1 ; } - supVo.long_minThread = conf.getSetAttrPlusInt(doc, "config.support", "long_minThread", null, 0, 5, null) ;//姹犱腑鏈�灏忕嚎绋嬫暟 + supVo.long_minThread = conf.getSetAttrPlusInt(doc, "config.support", "long_minThread", null, -1, 100, null) ;//姹犱腑鏈�灏忕嚎绋嬫暟 + if(supVo.long_minThread < 0){ + supVo.long_minThread = -1 ; + } supVo.long_freeTimeout = conf.getSetAttrPlusInt(doc, "config.support", "long_freeTimeout", null, 1, 90, null) * 1000 ;//绾跨▼鏁扮┖闂叉椂闀匡紝鑻ユ睜涓嚎绋嬫暟閲忓ぇ浜巑inThread锛屼笖鏈夌殑绾跨▼绌洪棽鏃堕暱瓒呰繃freeTimeout锛屽垯娓呴櫎璇ョ嚎绋� supVo.long_busyTimeout = conf.getSetAttrInt(doc, "config.support", "long_busyTimeout", null, -1, 10, null) ;//绾跨▼涓嶉棿鏂伐浣滄椂闀匡紙鍗曚綅涓虹)瓒呮椂闄愶紝鑻ヤ负-1锛屼笉鍙楅檺鍒� if(supVo.long_busyTimeout < 0){ supVo.long_busyTimeout = -1 ; + } + if(supVo.long_maxThread == 0 || supVo.long_minThread == 0){ + supVo.enableLongThreadPool = false ; + }else{ + supVo.enableLongThreadPool = true ; } supVo.showStartInfo = showStartInfo ; @@ -113,8 +133,6 @@ // Tcp Client 妯″潡 TcpClUnitConfigVo tcpClVo = new TcpClUnitConfigVo(); tcpClVo.enable = conf.getSetAttrBoolean(doc, "config.tcpCl", "enable", null, null) ; - tcpClVo.heartbeatTimes = conf.getSetAttrPlusInt(doc, "config.tcpCl", "heartbeatTimes", null, 1, 10, null) ;//杩炵画閰嶇疆娆℃暟蹇冭烦鍚庡彂閫佷竴娆℃暟鎹� - tcpClVo.sendInterval = conf.getSetAttrPlusInt(doc, "config.tcpCl", "sendInterval", null, 1, 60, null) ;//鍙戦�佸績璺虫垨鏁版嵁鐨勬椂闂撮棿闅� if(tcpClVo.enable){ AdapterImp_TcpClUnit httpClAdap = new AdapterImp_TcpClUnit(); httpClAdap.setConfig(tcpClVo); diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/ServerProperties.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/ServerProperties.java index 7379686..a5f18cf 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/ServerProperties.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/ServerProperties.java @@ -7,9 +7,13 @@ //RTU鎴鍦板潃 public static Long rtuAddrEnd = 0L ; //鏈嶅姟绔疘P - public static String serverIp = "" ; + public static String tcpServerIp = "" ; //鏈嶅姟绔笂涓嬫枃 - public static Integer serverPort = 0 ; + public static Integer tcpServerPort = 0 ; + //鍙戦�佹暟鎹暟鎹棿闅� + public static Integer sendInterval = 0 ;//绉� + //姣忎竴杞鍙戦�佹暟鎹紝鍏朵腑鍖呮嫭蹇冭烦鏁版嵁鐨勬鏁� + public static Integer heartbeatTimes = 3 ; //鍙戦�佹暟鎹鏁� public static Integer sendTimes = 0 ; diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/HttpClUnit.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/HttpClUnit.java deleted file mode 100644 index 9851e91..0000000 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/HttpClUnit.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.dy.testClient.httpCl; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.dy.testClient.rmiClient.RmiClUnit; -import com.dy.testClient.ServerProperties; -import com.dy.common.threadPool.ThreadPool; -import com.dy.common.threadPool.TreadPoolFactory; -import com.dy.common.mw.UnitAdapterInterface; -import com.dy.common.mw.UnitInterface; -import com.dy.common.mw.UnitStartedCallbackInterface; - -public class HttpClUnit implements UnitInterface { - - private static Logger log = LogManager.getLogger(HttpClUnit.class) ; - - private static HttpClUnit instance = new HttpClUnit() ; - - public static HttpClUnitAdapter adapter ; - public static HttpClUnitConfigVo confVo ; - - private static ThreadPool.Pool pool ; - - private static Integer totalRunedClientCount = 0; - private static Integer totalOverClientCount = 0; - - private static Long startTime = 0L ; - - private HttpClUnit(){} ; - - public static HttpClUnit getInstance(){ - return instance ; - } - - @Override - public void setAdapter(UnitAdapterInterface adapter) throws Exception { - if(adapter == null){ - throw new Exception("Http Client妯″潡閫傞厤鍣ㄥ璞′笉鑳戒负绌猴紒") ; - } - HttpClUnit.adapter = (HttpClUnitAdapter)adapter ; - HttpClUnit.confVo = HttpClUnit.adapter.getConfig() ; - if(HttpClUnit.confVo == null){ - throw new Exception("Http Client妯″潡閰嶇疆瀵硅薄涓嶈兘涓虹┖锛�") ; - } - } - - @Override - public void start(UnitStartedCallbackInterface callback) throws Exception { - pool = TreadPoolFactory.getThreadPoolLong() ; - System.out.println("Http Client妯″潡鎴愬姛鍚姩"); - this.doStart(); - callback.call(null) ; - } - - @Override - public void stop(UnitStartedCallbackInterface callback) throws Exception { - callback.call(null); - } - - private void doStart(){ - new Thread(new Runnable(){ - @Override - public void run() { - try { - while(true){ - if(!ServerProperties.startWork){ - Thread.sleep(100L); - }else{ - startTime = System.currentTimeMillis() ; - for(Long i = ServerProperties.rtuAddrStart ; i <= ServerProperties.rtuAddrEnd; i++){ - totalRunedClientCount++ ; - startClient(i) ; - } - while(true){ - if(totalOverClientCount.longValue() >= totalRunedClientCount.longValue()){ - Long seconds = (System.currentTimeMillis() - startTime)/1000 ; - RmiClUnit.getInstance().reportHadReportOver(seconds) ; - System.out.println("鍏辩敤鏃�" + seconds + "绉�"); - break ; - }else{ - Thread.sleep(100L); - } - } - break; - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } - }).start(); - } - - private void startClient(Long imei){ - try { - pool.putJob(new MyThreadJob("" + imei)); - } catch (Exception e) { - log.error("HttpClUnit.startClient() ", e); - } - } - - - public static synchronized void clientOver(){ - totalOverClientCount++; - if(totalOverClientCount % 100 == 0){ - RmiClUnit.getInstance().reportHadReportCount(totalOverClientCount); - System.out.println("宸茬粡鍙戦��" + totalOverClientCount + "鏉℃暟鎹�"); - } - } - -} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/HttpClUnitAdapter.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/HttpClUnitAdapter.java deleted file mode 100644 index 8f80484..0000000 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/HttpClUnitAdapter.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.dy.testClient.httpCl; - -import com.dy.common.mw.UnitAdapterInterface; - -public interface HttpClUnitAdapter extends UnitAdapterInterface { - - public HttpClUnitConfigVo getConfig() ; - -} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/HttpClUnitConfigVo.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/HttpClUnitConfigVo.java deleted file mode 100644 index 7b3513d..0000000 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/HttpClUnitConfigVo.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.dy.testClient.httpCl; - -public class HttpClUnitConfigVo { - public boolean enable ; -} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/HttpPost.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/HttpPost.java deleted file mode 100644 index 3b8e37b..0000000 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/HttpPost.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.dy.testClient.httpCl; - -import com.dy.testClient.ServerProperties; -import com.dy.common.util.HttpUtils; - -public class HttpPost { - - public static synchronized void post(byte[] bytes) throws Exception{ - //HttpUtils.doPost(ServerProperties.serverUrl, ServerProperties.serverContext, null, null, bytes) ; - } -} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/MyThreadJob.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/MyThreadJob.java deleted file mode 100644 index d3494c5..0000000 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/MyThreadJob.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.dy.testClient.httpCl; - -import java.util.Base64; - -import com.dy.common.threadPool.ThreadPool; - -public class MyThreadJob implements ThreadPool.Job { - - public String imei ; - - public MyThreadJob(){ - } - public MyThreadJob(String imei){ - this.imei = imei ; - } - - @Override - public void execute() throws Exception { - testMeterV1_0() ; - //testHAC_NBhV2_5() ; - } - - private void testMeterV1_0(){ - try{ - RtuData4MeterV1_0 rd = new RtuData4MeterV1_0() ; - byte[] bs = rd.create(imei) ; - bs = Base64.getEncoder().encode(bs) ; - - UpDataPayloadVo payloadVo = new UpDataPayloadVo() ; - payloadVo.APPdata = new String(bs, "UTF-8") ; - - UpDataVo vo = new UpDataVo(imei, "8086" + imei ) ; - vo.payload = payloadVo ; - String json = vo.toJson() ; - byte[] bytes = json.getBytes() ; - HttpPost.post(bytes); - }catch(Exception e){ - e.printStackTrace(); - }finally{ - HttpClUnit.clientOver() ; - } - } - - @SuppressWarnings("unused") - private void testHAC_NBhV2_5(){ - try{ - RtuData4HAC_NBhV2_5 rd = new RtuData4HAC_NBhV2_5() ; - byte[] bs = rd.create(imei) ; - bs = Base64.getEncoder().encode(bs) ; - - UpDataPayloadVo payloadVo = new UpDataPayloadVo() ; - payloadVo.APPdata = new String(bs, "UTF-8") ; - - UpDataVo vo = new UpDataVo(imei, "8086" + imei ) ; - vo.payload = payloadVo ; - String json = vo.toJson() ; - byte[] bytes = json.getBytes() ; - HttpPost.post(bytes); - }catch(Exception e){ - e.printStackTrace(); - }finally{ - HttpClUnit.clientOver() ; - } - } - - @Override - public void destroy() { - } - - @Override - public boolean isDestroy() { - return false; - } - - -} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/RtuData4HAC_NBhV2_5.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/RtuData4HAC_NBhV2_5.java deleted file mode 100644 index 52c839f..0000000 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/RtuData4HAC_NBhV2_5.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.dy.testClient.httpCl; - -import com.dy.common.util.ByteUtil; - -public class RtuData4HAC_NBhV2_5 { - public byte[] create(String imei) throws Exception{ - /* - * 0101 - * 00 - * 02 - * 4643 - * 3C - * 00BE - * FF - * 86AB62626E642F332F30026A313233343536373839300D1A64B8FCE60E655554432B3801634E42680719016E110112655056332E30136C56332E30345F32323034323214001701A762626E652F38302F3001020600101A00000000171A00000000181A1A00000000181F00A462626E652F38312F30030101000201A462626E652F38322F30000001000200A262626E652F38342F30001A00015180A462626E652F39392F30016F3836333331383036303136393235390D3903010E390013 - * EA77 - * - */ - String hex = "0101024570753C001AFFA30D1B000001898AB2E3160E655554432B3862626E642F332F303190" ; - //String hex = "0101000246433C00BEFF86AB62626E642F332F30026A313233343536373839300D1A64B8FCE60E655554432B3801634E42680719016E110112655056332E30136C56332E30345F32323034323214001701A762626E652F38302F3001020600101A00000000171A00000000181A1A00000000181F00A462626E652F38312F30030101000201A462626E652F38322F30000001000200A262626E652F38342F30001A00015180A462626E652F39392F30016F3836333331383036303136393235390D3903010E390013EA77" ; - return ByteUtil.hex2Bytes(hex) ; - } - /* - * -86AB62626E642F332F30 -026A3132333435363738 -39300D1A64B8FCE60E65 -5554432B3801634E4268 -0719016E110112655056 -332E30136C56332E3034 -5F323230343232140017 -01A762626E652F38302F -3001020600101A000000 -00171A00000000181A1A -00000000181F00A46262 -6E652F38312F30030101 -000201A462626E652F38 -322F30000001000200A2 -62626E652F38342F3000 -1A00015180A462626E65 -2F39392F30016F383633 -33313830363031363932 -35390D3903010E390013 - */ - -} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/RtuData4MeterV1_0.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/RtuData4MeterV1_0.java deleted file mode 100644 index daf8340..0000000 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/RtuData4MeterV1_0.java +++ /dev/null @@ -1,165 +0,0 @@ -package com.dy.testClient.httpCl; - -import com.dy.common.mw.protocol.pMeterV1_0_1.ProtocolConstantV1_0_1; -import com.dy.common.util.ByteUtil; -import com.dy.common.util.ByteUtilUnsigned; -import com.dy.common.util.CreateRadom; -import com.dy.common.util.DateTime; - -public class RtuData4MeterV1_0 { - public byte[] create(String imei) throws Exception{ - /* - * 68 - * 0051 - * 01 - * 0300000000000001 - * 12233445566778 - * 01 - * 221128152107 - * 0001E240 - * 000004D2 - * 24 - * 0129 - * 11 - * 002D - * 0035 - * 003D - * 006E - * 0038 - * 00C3 - * 00AC - * 004C - * 0028 - * 0081 - * 001B - * 005E - * 003D - * 0063 - * 00AB - * 0071 - * 00BB - * 0046 - * 004A - * 009B - * 0087 - * 00BE - * 0022 - * 00B0 - * DA - * 16 - */ - int len = 89 ; - byte[] bs = new byte[len] ; - bs[0] = ProtocolConstantV1_0_1.P_Head_Byte ; - ByteUtilUnsigned.short2Bytes_BE(bs, len, 1);//闀垮害 - bs[3] = (byte)101 ;//鍗忚鐗堟湰鍙� - while(true){ - if(imei.length() >= 16){ - break ; - }else{ - imei = "0" + imei ; - } - } - ByteUtil.string2BCD_BE(bs, imei, 4) ;//IMEI鍙� - - String meterNo = "" + (Long.valueOf(imei) + 1); - while(true){ - if(meterNo.length() >= 16){ - break ; - }else{ - meterNo = "0" + meterNo ; - } - } - ByteUtil.string2BCD_BE(bs, meterNo, 12) ;//姘磋〃鍙� - - bs[20] = 1 ;//鍔熻兘鐮� - - ByteUtil.string2BCD_BE(bs, DateTime.yyMMddhhmmss(), 21) ;//鏃堕棿 - - ByteUtilUnsigned.int2Bytes_BE(bs, 123456, 27);//瀹炴椂绱姘撮噺 - - ByteUtilUnsigned.int2Bytes_BE(bs, 54321, 31);//鏃ョ疮璁℃按閲� - - bs[35] = (byte)36;//鐢垫睜鐢靛帇 - - ByteUtilUnsigned.short2Bytes_BE(bs, 297, 36);//淇″彿寮哄害 - - byte sta = 0 ; - int num = CreateRadom.radom_4() ; - if(num%2 == 0){ - sta += 1 ;//闃�闂ㄧ姸鎬� - } - num = CreateRadom.radom_4() ; - if(num%2 == 0){ - sta += 4 ;//闃�闂ㄦ晠闅� - } - num = CreateRadom.radom_4() ; - if(num%2 == 0){ - sta += 8 ;//寮虹 - } - num = CreateRadom.radom_4() ; - if(num%2 == 0){ - sta += 16 ;//鐢垫睜娆犲帇 - } - bs[38] = sta;//琛ㄧ姸鎬� - - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 39);//1鐐瑰皬鏃剁敤姘撮噺 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 41);//2鐐瑰皬鏃剁敤姘撮噺 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 43);//3 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 45);//4 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 47);//5 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 49);//6 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 51);//7 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 53);//8 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 55);//9 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 57);//10 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 59);//11 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 61);//12 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 63);//13 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 65);//14 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 67);//15 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 69);//16 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 71);//17 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 73);//18 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 75);//19 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 77);//20 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 79);//21 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 81);//22 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 83);//23 - num = CreateRadom.radom(200, 10) ; - ByteUtilUnsigned.short2Bytes_BE(bs, num, 85);//24 - - byte he = 0 ; - for(byte i = 0 ; i <= 86; i++){ - he = (byte)(he + bs[i]) ; - } - ByteUtilUnsigned.byte2Byte(bs, he, 87) ; - bs[88] = ProtocolConstantV1_0_1.P_Tail_Byte ; - - return bs ; - } - -} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/TestBase64.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/TestBase64.java deleted file mode 100644 index 8bdda86..0000000 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/TestBase64.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.dy.testClient.httpCl; - -import java.io.UnsupportedEncodingException; -import java.util.Base64; - -import com.dy.common.util.ByteUtil; - -public class TestBase64 { - - public static void main(String[] args) throws UnsupportedEncodingException{ - String hex1 = "6838363235393230353934333439373000002002303231310000000000000032003005002E000000000001000000000200000000032101010012330400300521010100123306016907016908000009FF0000FC16" ; - System.out.println(hex1); - byte[] bs = ByteUtil.hex2Bytes(hex1) ; - bs = Base64.getEncoder().encode(bs) ; - String base64 = new String(bs, "UTF-8") ; - System.out.println(base64); - - bs = Base64.getDecoder().decode(base64); - String hex2 = ByteUtil.bytes2Hex(bs, false) ; - System.out.println(hex2); - - } -} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/UpDataPayloadVo.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/UpDataPayloadVo.java deleted file mode 100644 index 8e1e7ff..0000000 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/UpDataPayloadVo.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.dy.testClient.httpCl; - -public class UpDataPayloadVo { - - public String APPdata ; - - - public String getAPPdata() { - return APPdata; - } - - public void setAPPdata(String aPPdata) { - APPdata = aPPdata; - } - -} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/UpDataVo.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/UpDataVo.java deleted file mode 100644 index 88f1e19..0000000 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/httpCl/UpDataVo.java +++ /dev/null @@ -1,174 +0,0 @@ -package com.dy.testClient.httpCl; - - -import com.alibaba.fastjson2.JSON; - -public class UpDataVo { - - public Integer upPacketSN; //:-1, - public Integer upDataSN; //:-1, - public String topic; //:"v1/up/ad", - public Long timestamp; //:1667302244541, - public String tenantId; //:"2000114347", - public String serviceId; //:"", - public String protocol; //:"lwm2m", - public String productId; //:"15410798", - public UpDataPayloadVo payload; //:{"APPdata":"pQAYWhAGFQEmECIgETMgIQEBACASARckZFoAAFeq"}, - public String messageType; //:"dataReport", - public String deviceType; //:"", - public String deviceId; //:"59a4d90bf7a04aeea4d3523fe15d6f3f", - public String assocAssetId; //:"", - public String imsi; //:"undefined", - public String imei; //:"862592059434970" - - public UpDataVo(String imei, String deviceId){ - this.upPacketSN = - 1 ; - this.upDataSN = - 1 ; - this.topic = "v1/up/ad" ; - this.timestamp = System.currentTimeMillis() ; - this.tenantId = "2000114347" ; - this.serviceId = "" ; - this.protocol = "lwm2m" ; - this.productId = "15410798" ; - this.messageType = "dataReport" ; - this.deviceType = "" ; - this.deviceId = deviceId ; - this.assocAssetId = "" ; - this.imsi = "" ; - this.imei = imei ; - } - - public String toString(){ - StringBuffer sb = new StringBuffer() ; - sb.append("\nproductId锛�" + productId + "\n") ; - sb.append("deviceId锛�" + deviceId + "\n") ; - sb.append("imei锛�" + imei + "\n") ; - sb.append("payload锛�" + (payload==null?"":payload.APPdata) + "\n") ; - sb.append("timestamp锛�" + timestamp + "\n") ; - return sb.toString() ; - } - - /** - * 瀵硅薄杞垚json - * @return json - * @throws Exception 寮傚父 - */ - public String toJson()throws Exception{ - try{ - return JSON.toJSONString(this) ; - //return new JSONSerializer().exclude(new String[]{"class", "*.class"}).deepSerialize(this); - }catch(Exception e){ - throw new Exception(e.getMessage() , e ) ; - } - } - /** - * json杞垚瀵硅薄 - * @param json json - * @return 瀵硅薄 - * @throws Exception 寮傚父 - */ - public static UpDataVo jsonToObject(String json)throws Exception{ - try{ - return JSON.parseObject(json, UpDataVo.class) ; - //return new JSONDeserializer<UpDataVo>() - // .use("payload", UpDataPayloadVo.class) - // .deserialize(json, UpDataVo.class) ; - }catch(Exception e){ - throw new Exception(e.getMessage() , e ) ; - } - } - - - public Integer getUpPacketSN() { - return upPacketSN; - } - public void setUpPacketSN(Integer upPacketSN) { - this.upPacketSN = upPacketSN; - } - public Integer getUpDataSN() { - return upDataSN; - } - public void setUpDataSN(Integer upDataSN) { - this.upDataSN = upDataSN; - } - public String getTopic() { - return topic; - } - public void setTopic(String topic) { - this.topic = topic; - } - public Long getTimestamp() { - return timestamp; - } - public void setTimestamp(Long timestamp) { - this.timestamp = timestamp; - } - public String getTenantId() { - return tenantId; - } - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - public String getServiceId() { - return serviceId; - } - public void setServiceId(String serviceId) { - this.serviceId = serviceId; - } - public String getProtocol() { - return protocol; - } - public void setProtocol(String protocol) { - this.protocol = protocol; - } - public String getProductId() { - return productId; - } - public void setProductId(String productId) { - this.productId = productId; - } - public UpDataPayloadVo getPayload() { - return payload; - } - public void setPayload(UpDataPayloadVo payload) { - this.payload = payload; - } - public String getMessageType() { - return messageType; - } - public void setMessageType(String messageType) { - this.messageType = messageType; - } - public String getDeviceType() { - return deviceType; - } - public void setDeviceType(String deviceType) { - this.deviceType = deviceType; - } - public String getDeviceId() { - return deviceId; - } - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - public String getAssocAssetId() { - return assocAssetId; - } - public void setAssocAssetId(String assocAssetId) { - this.assocAssetId = assocAssetId; - } - public String getIMSI() { - return imsi; - } - public void setIMSI(String iMSI) { - imsi = iMSI; - } - public String getIMEI() { - return imei; - } - public void setIMEI(String iMEI) { - imei = iMEI; - } - - -} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/Code.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/Code.java index 4fcd76b..9dc631e 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/Code.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/Code.java @@ -9,7 +9,9 @@ public static String cd3 = "003" ;//璇锋眰寮�濮嬪伐浣� public static String cd4 = "004" ;//鍚戞湇鍔$涓婃姤淇℃伅 - - public static String cd5 = "005" ;//鍚戞湇鍔$涓婃姤 鏁版嵁涓婃姤宸ヤ綔宸茬粡瀹屾垚 - + + public static String cd5 = "005" ;//鍚戞湇鍔$涓婃姤 瀹屾垚浠诲姟鐨勬暟閲� + + public static String cd6 = "006" ;//鍚戞湇鍔$涓婃姤 鍏ㄩ儴浠诲姟瀹屾垚 + } diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/ResConfigVo.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/ResConfigVo.java index c3affa5..59df2ce 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/ResConfigVo.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/ResConfigVo.java @@ -8,12 +8,16 @@ //妯℃嫙瀹㈡埛鐨処MEI鍙锋埅姝㈠彿 public Long rtuAddrEnd = 0L ; //鏈嶅姟绔疘P - public String serverIp = "" ; + public String tcpServerIp = "" ; //鏈嶅姟绔笂涓嬫枃 - public Integer serverPort = 0 ; + public Integer tcpServerPort = 0 ; + //鍙戦�佹暟鎹棿闅� + public Integer sendInterval = 2 ;//绉� + //姣忎竴杞鍙戦�佹暟鎹紝鍏朵腑鍖呮嫭蹇冭烦鍙戦�佹鏁� + public Integer heartbeatTimes = 3 ; //鍙戦�佹暟鎹鏁� public Integer sendTimes = 0 ; - + /** * 瀵硅薄杞垚json * @return 瀵硅薄json @@ -58,20 +62,36 @@ this.rtuAddrEnd = rtuAddrEnd; } - public String getServerIp() { - return serverIp; + public String getTcpServerIp() { + return tcpServerIp; } - public void setServerIp(String serverIp) { - this.serverIp = serverIp; + public void setTcpServerIp(String tcpServerIp) { + this.tcpServerIp = tcpServerIp; } - public Integer getServerPort() { - return serverPort; + public Integer getTcpServerPort() { + return tcpServerPort; } - public void setServerPort(Integer serverPort) { - this.serverPort = serverPort; + public void setTcpServerPort(Integer tcpServerPort) { + this.tcpServerPort = tcpServerPort; + } + + public Integer getSendInterval() { + return sendInterval; + } + + public void setSendInterval(Integer sendInterval) { + this.sendInterval = sendInterval; + } + + public Integer getHeartbeatTimes() { + return heartbeatTimes; + } + + public void setHeartbeatTimes(Integer heartbeatTimes) { + this.heartbeatTimes = heartbeatTimes; } public Integer getSendTimes() { diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/RmiClUnit.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/RmiClUnit.java index 8d30bb8..c8d961c 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/RmiClUnit.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/RmiClUnit.java @@ -94,13 +94,30 @@ } //鎶婃暟鎹笂鎶ュ畬鎴愭儏鍐� 涓婃姤缁檓wTestServer - public void reportHadReportOver(Long seconds){ + public void reportHadReportOver(Integer count){ try { Thread.sleep(100L); RmiRequestVo rqVo = new RmiRequestVo() ; rqVo.id = id ; rqVo.token = token ; rqVo.code = Code.cd5 ; + rqVo.overCount = count ; + String json = rqVo.toJson() ; + frmWork.syncRequest(json) ; + } catch (Exception e) { + log.error("鎶婃暟鎹笂鎶ュ畬鎴愭儏鍐� 涓婃姤缁檓wTestServer澶辫触" + e.getMessage()); + } + } + + + //鎶婃暟鎹笂鎶ュ畬鎴愭儏鍐� 涓婃姤缁檓wTestServer + public void allOver(Long seconds){ + try { + Thread.sleep(100L); + RmiRequestVo rqVo = new RmiRequestVo() ; + rqVo.id = id ; + rqVo.token = token ; + rqVo.code = Code.cd6 ; rqVo.over = true ; rqVo.seconds = seconds ; String json = rqVo.toJson() ; @@ -178,15 +195,19 @@ if(rVo != null){ ServerProperties.rtuAddrStart = rVo.rtuAddrStart; ServerProperties.rtuAddrEnd = rVo.rtuAddrEnd; - ServerProperties.serverIp = rVo.serverIp; - ServerProperties.serverPort = rVo.serverPort; + ServerProperties.tcpServerIp = rVo.tcpServerIp; + ServerProperties.tcpServerPort = rVo.tcpServerPort; + ServerProperties.sendInterval = rVo.sendInterval ; + ServerProperties.heartbeatTimes = rVo.heartbeatTimes ; ServerProperties.sendTimes = rVo.sendTimes ; log.info("寰楀埌閰嶇疆鎴愬姛"); log.info(" 寮�濮婻tuAddr=" + ServerProperties.rtuAddrStart); log.info(" 鎴RtuAddr=" + ServerProperties.rtuAddrEnd); - log.info(" mwAccept鏈嶅姟IP=" + ServerProperties.serverIp); - log.info(" mwAccept鏈嶅姟绔彛=" + ServerProperties.serverPort); - log.info(" 姣廼mei涓婃姤鏁版嵁娆℃暟=" + ServerProperties.sendTimes); + log.info(" mwAccept鏈嶅姟IP=" + ServerProperties.tcpServerIp); + log.info(" mwAccept鏈嶅姟绔彛=" + ServerProperties.tcpServerPort); + log.info(" 鍙戦�佹暟鎹棿闅�=" + ServerProperties.sendTimes); + log.info(" 姣忚疆娆″彂閫佸績璺虫鏁�=" + ServerProperties.heartbeatTimes); + log.info(" 姣廟TU涓婃姤鏁版嵁杞=" + ServerProperties.sendTimes); break ; }else{ log.error("rmi寰楀埌閰嶇疆澶辫触锛歫son杞琑esConfigVo涓簄ull"); diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/RmiRequestVo.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/RmiRequestVo.java index c21c432..99d80ae 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/RmiRequestVo.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/RmiRequestVo.java @@ -9,9 +9,11 @@ public String token ; public String code ; - + public Integer count;//aepTest涓婃姤鏁版嵁鏁伴噺 - + + public Integer overCount;//aepTest缁撴潫涓婃姤鏁版嵁鏁伴噺 + public Boolean over ;//aepTest涓婃姤鏁版嵁缁撴潫 public Long seconds ;//aepTest涓婃姤鏁版嵁鐢ㄦ椂(绉�) diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/RmiResponseVo.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/RmiResponseVo.java index 658591a..8d952a7 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/RmiResponseVo.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/rmiClient/RmiResponseVo.java @@ -1,6 +1,7 @@ package com.dy.testClient.rmiClient; import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONObject; public class RmiResponseVo { @@ -9,7 +10,7 @@ public String errorInfo ; public String code ; - + public Object obj ; /** @@ -33,11 +34,10 @@ */ public static RmiResponseVo jsonToObject(String json, Class<?> clazz)throws Exception{ try{ - return JSON.parseObject(json, RmiResponseVo.class) ; - //JSONDeserializer<RmiResponseVo> jsonD = new JSONDeserializer<RmiResponseVo>() ; - //jsonD.use("obj", clazz) ; - //RmiResponseVo resp = jsonD.deserialize(json, RmiResponseVo.class) ; - //return resp ; + JSONObject jsonObject = JSON.parseObject(json); + RmiResponseVo vo = jsonObject.to(RmiResponseVo.class) ; + vo.obj = jsonObject.getObject("obj", clazz); + return vo ; }catch(Exception e){ throw new Exception(e.getMessage() , e ) ; } diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpConnect/LocalCodecFactory.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/LocalCodecFactory.java similarity index 95% rename from pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpConnect/LocalCodecFactory.java rename to pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/LocalCodecFactory.java index 9f59b93..0251296 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpConnect/LocalCodecFactory.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/LocalCodecFactory.java @@ -1,9 +1,9 @@ -package com.dy.testClient.tcpConnect; +package com.dy.testClient.tcpClient; -import org.apache.mina.filter.codec.ProtocolCodecFactory; -import org.apache.mina.filter.codec.ProtocolEncoder; -import org.apache.mina.filter.codec.ProtocolDecoder; import org.apache.mina.core.session.IoSession; +import org.apache.mina.filter.codec.ProtocolCodecFactory; +import org.apache.mina.filter.codec.ProtocolDecoder; +import org.apache.mina.filter.codec.ProtocolEncoder; public class LocalCodecFactory implements ProtocolCodecFactory { private ProtocolEncoder encoder; diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/LocalDecoder.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/LocalDecoder.java new file mode 100644 index 0000000..610257f --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/LocalDecoder.java @@ -0,0 +1,37 @@ +package com.dy.testClient.tcpClient; + +import com.dy.common.util.ByteUtil; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.mina.core.buffer.IoBuffer; +import org.apache.mina.core.session.IoSession; +import org.apache.mina.filter.codec.CumulativeProtocolDecoder; +import org.apache.mina.filter.codec.ProtocolDecoderOutput; + +import java.io.IOException; + +public class LocalDecoder extends CumulativeProtocolDecoder { + + private static final Logger log = LogManager.getLogger(LocalDecoder.class) ; + + private static final String DECODER_STATE_KEY = LocalDecoder.class.getName() + ".STATE"; + + public static final int MAX_SIZE = 2147483647 ; + + + /** + * 瀵圭綉缁滀紶杈撴潵鐨勬暟鎹繘琛岃В鐮� + */ + protected boolean doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws IOException, Exception{ + int remain = in.remaining() ; + if(remain > 0){ + byte[] preByte = new byte[remain]; + in.get(preByte) ; + in.position(0) ; + log.info("鏀跺埌涓績搴旂瓟鏁版嵁锛�" + ByteUtil.bytes2Hex(preByte, true)); + } + return true; + } + + +} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/LocalEncoder.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/LocalEncoder.java new file mode 100644 index 0000000..fdf716e --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/LocalEncoder.java @@ -0,0 +1,22 @@ +package com.dy.testClient.tcpClient; + +import org.apache.mina.core.buffer.IoBuffer; +import org.apache.mina.core.session.IoSession; +import org.apache.mina.filter.codec.ProtocolEncoderAdapter; +import org.apache.mina.filter.codec.ProtocolEncoderOutput; + +import java.io.IOException; + +public class LocalEncoder extends ProtocolEncoderAdapter { + + /** + * 瀵规暟鎹繘琛岀紪鐮侊紝浠ュ缃戠粶浼犺緭 + */ + public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws IOException, Exception{ + byte[] data = (byte[])message; + //log.info("涓嬭鏁版嵁锛�" + ByteUtil.bytes2Hex(data, true)); + + out.write(IoBuffer.allocate((data==null?0:data.length), false).put(data).flip()); + } + +} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/MyThreadJob.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/MyThreadJob.java index eee927c..e50537f 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/MyThreadJob.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/MyThreadJob.java @@ -1,46 +1,220 @@ package com.dy.testClient.tcpClient; +import com.dy.common.mw.protocol.p206V1_0_0.CommonV1_0_1; +import com.dy.common.mw.protocol.p206V1_0_0.ProtocolConstantV206V1_0_0; +import com.dy.common.mw.protocol.p206V1_0_0.parse.global.GlCreate; import com.dy.common.threadPool.ThreadPool; -import com.dy.testClient.httpCl.*; - -import java.util.Base64; +import com.dy.common.util.ByteUtil; +import com.dy.testClient.ServerProperties; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.mina.core.session.IoSession; public class MyThreadJob implements ThreadPool.Job { + private static final Logger log = LogManager.getLogger(MyThreadJob.class) ; + public String rtuAddr; + public String serverIp; + public Integer serverPort; + + public IoSession session ; + public boolean exceptionOnConnect = false ; + + public static final int connectTimeout = 3000 ; + + public int sendTimes = 0 ;//鍙戦�佹暟鎹鏁� + public int heartbeatTimes = 0 ;//涓婃姤蹇冭烦娆℃暟 + + public boolean isOver = false ; public MyThreadJob(){ } - public MyThreadJob(String rtuAddr){ + public MyThreadJob(String rtuAddr, String serverIp, Integer serverPort){ this.rtuAddr = rtuAddr ; + this.serverIp = serverIp ; + this.serverPort = serverPort ; } @Override public void execute() throws Exception { - testP206V1_0_0() ; - } - - private void testP206V1_0_0(){ - try{ - RtuData4MeterV1_0 rd = new RtuData4MeterV1_0() ; - byte[] bs = rd.create(rtuAddr) ; - bs = Base64.getEncoder().encode(bs) ; - - UpDataPayloadVo payloadVo = new UpDataPayloadVo() ; - payloadVo.APPdata = new String(bs, "UTF-8") ; - - UpDataVo vo = new UpDataVo(rtuAddr, "8086" + rtuAddr) ; - vo.payload = payloadVo ; - String json = vo.toJson() ; - byte[] bytes = json.getBytes() ; - HttpPost.post(bytes); - }catch(Exception e){ - e.printStackTrace(); - }finally{ - HttpClUnit.clientOver() ; + log.info("RTU" + rtuAddr + "寮�濮嬩换鍔�"); + if(session != null){ + log.info("RTU" + rtuAddr + "灏嗚鎵ц" + ServerProperties.sendTimes + "杞浠诲姟锛屽綋鍓嶈疆娆℃槸" + sendTimes); + if(sendTimes <= ServerProperties.sendTimes){ + sendDataOfP206V1_0_0() ; + }else{ + this.jobOver() ; + } } } + private void sendDataOfP206V1_0_0(){ + try{ + if(heartbeatTimes >= ServerProperties.heartbeatTimes){ + heartbeatTimes = 0 ; + this.sendReportData() ; + TcpClUnit.clientSendData(); + sendTimes++ ; + }else{ + this.sendHeartbeat() ; + TcpClUnit.clientSendData(); + heartbeatTimes++ ; + } + }catch(Exception e){ + e.printStackTrace(); + } + } + private void sendHeartbeat(){ + try{ + byte[] bs = this.createHeartbeat() ; + this.session.write(bs) ; + log.info("RTU" + rtuAddr + "鍙戦�佷簡蹇冭烦鏁版嵁锛�" + ByteUtil.bytes2Hex(bs, false)); + }catch (Exception e){ + e.printStackTrace(); + } + } + + private void sendReportData(){ + try{ + byte[] bs = this.createReport() ; + this.session.write(bs) ; + log.info("RTU" + rtuAddr + "鍙戦�佷簡涓婃姤鏁版嵁锛�" + ByteUtil.bytes2Hex(bs, false)); + }catch (Exception e){ + e.printStackTrace(); + } + } + + private void jobOver(){ + session.closeOnFlush() ; + this.isOver = true ; + TcpClUnit.clientOver() ; + } + + /** + * 鏋勯�犲績璺虫暟鎹� + * @return 瀛楄妭鏁扮粍 + * @throws Exception 寮傚父 + */ + public byte[] createHeartbeat( ) throws Exception { + CommonV1_0_1 commonV1_0_1 = new CommonV1_0_1() ; + byte[] bytes ; + byte[] bsHead = new byte[ProtocolConstantV206V1_0_0.lenHead2Code] ; + byte index = 0 ; + bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; + + index++ ; + bsHead[index] = 0 ;//甯ч暱搴� + + index++ ; + bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; + + index++ ; + bsHead[index] = commonV1_0_1.createCtrl((byte)0x80, (byte)0) ;//鎺у埗鍩熷姛鑳界爜锛氱‘璁� 璁ゅ彲 + + index++ ; + GlCreate.createRtuAddr(this.rtuAddr, bsHead, index); + index += 5 ; + + ByteUtil.hex2Bytes("02", bsHead, index) ; + + byte[] bs = new byte[1] ; + bs[0] = (byte)0xF2 ;//鏁版嵁鍩燂細 1 涓瓧鑺傦紝F0 鐧诲綍锛� F1 閫�鍑虹櫥褰曪紝F2 鍦ㄧ嚎淇濇寔銆� + + bytes = ByteUtil.bytesMerge(bsHead, bs) ; + + GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑 + + byte[] bsTail = GlCreate.createCrcTail(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓� + + bytes = ByteUtil.bytesMerge(bytes, bsTail) ; + + return bytes ; + } + + /** + * 鏋勯�犱笂鎶ユ暟鎹� + * @return 瀛楄妭鏁扮粍 + * @throws Exception 寮傚父 + */ + public byte[] createReport( ) throws Exception { + CommonV1_0_1 commonV1_0_1 = new CommonV1_0_1() ; + byte[] bytes ; + byte[] bsHead = new byte[ProtocolConstantV206V1_0_0.lenHead2Code] ; + byte index = 0 ; + bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; + + index++ ; + bsHead[index] = 0 ;//甯ч暱搴� + + index++ ; + bsHead[index] = ProtocolConstantV206V1_0_0.P_Head_Byte ; + + index++ ; + bsHead[index] = commonV1_0_1.createCtrl((byte)0x80, (byte)3) ;//鎺у埗鍩熷姛鑳界爜3锛氳嚜鎶ュ抚锛屾祦閲忥紙姘撮噺锛夊弬鏁� + + index++ ; + GlCreate.createRtuAddr(this.rtuAddr, bsHead, index); + index += 5 ; + + ByteUtil.hex2Bytes("C0", bsHead, index) ; + + byte[] bs = new byte[2] ; + bs[0] = (byte)0x04 ;//鏈夋祦閲忔暟鎹� + bs[1] = (byte)0xE0 ;//鏈夋按鍘嬨�佺數姹犵數鍘嬨�佷俊鍙峰己搴� + + bytes = ByteUtil.bytesMerge(bsHead, bs) ; + + bs = new byte[5] ;//鐬椂娴侀噺 + bs[0] = ByteUtil.int2BCD_LE (21)[0] ; + bs[1] = ByteUtil.int2BCD_LE (43)[0] ; + bs[2] = ByteUtil.int2BCD_LE (65)[0] ; + bytes = ByteUtil.bytesMerge(bytes, bs) ; + + bs = new byte[5] ;//绱娴侀噺 + bs[0] = ByteUtil.int2BCD_LE (21)[0] ; + bs[1] = ByteUtil.int2BCD_LE (43)[0] ; + bs[2] = ByteUtil.int2BCD_LE (65)[0] ; + bs[3] = ByteUtil.int2BCD_LE (87)[0] ; + bytes = ByteUtil.bytesMerge(bytes, bs) ; + + bs = new byte[5] ;//鎹熷け娴侀噺 + bs[0] = ByteUtil.int2BCD_LE (10)[0] ; + bs[1] = ByteUtil.int2BCD_LE (32)[0] ; + bs[2] = ByteUtil.int2BCD_LE (54)[0] ; + bytes = ByteUtil.bytesMerge(bytes, bs) ; + + bs = new byte[4] ;//姘村帇 + bs[0] = ByteUtil.int2BCD_LE (10)[0] ; + bs[1] = ByteUtil.int2BCD_LE (32)[0] ; + bs[2] = ByteUtil.int2BCD_LE (4)[0] ; + bytes = ByteUtil.bytesMerge(bytes, bs) ; + + bs = new byte[4] ;//鐢垫睜鐢靛帇 + bs[0] = ByteUtil.int2BCD_LE (10)[0] ; + bs[1] = ByteUtil.int2BCD_LE (32)[0] ; + bs[2] = ByteUtil.int2BCD_LE (10)[0] ; + bs[3] = ByteUtil.int2BCD_LE (32)[0] ; + bytes = ByteUtil.bytesMerge(bytes, bs) ; + + bs = new byte[1] ;//淇″彿寮哄害 + bs[0] = ByteUtil.int2BCD_LE (21)[0] ; + bytes = ByteUtil.bytesMerge(bytes, bs) ; + + bs = new byte[6] ;//鏃堕挓 + GlCreate.createTp(bs, 0); + bytes = ByteUtil.bytesMerge(bytes, bs) ; + + GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑 + + byte[] bsTail = GlCreate.createCrcTail(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓� + + bytes = ByteUtil.bytesMerge(bytes, bsTail) ; + + return bytes ; + } + + @Override public void destroy() { diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpClUnit.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpClUnit.java index 1189f3b..78a8b90 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpClUnit.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpClUnit.java @@ -5,10 +5,16 @@ import com.dy.common.mw.UnitStartedCallbackInterface; import com.dy.common.threadPool.ThreadPool; import com.dy.common.threadPool.TreadPoolFactory; +import com.dy.common.util.Callback; import com.dy.testClient.ServerProperties; import com.dy.testClient.rmiClient.RmiClUnit; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.apache.mina.core.session.IoSession; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; public class TcpClUnit implements UnitInterface { @@ -20,8 +26,10 @@ public static TcpClUnitConfigVo confVo ; private static ThreadPool.Pool pool ; + private static Map<String, MyThreadJob> jobMap = new HashMap<>() ; - private static Integer totalRunedClientCount = 0; + private static Integer totalRtuClientCount = 0; + private static Integer totalSendDataCount = 0; private static Integer totalOverClientCount = 0; private static Long startTime = 0L ; @@ -66,22 +74,46 @@ if(!ServerProperties.startWork){ Thread.sleep(100L); }else{ - startTime = System.currentTimeMillis() ; - for(Long addr = ServerProperties.rtuAddrStart; addr <= ServerProperties.rtuAddrEnd; addr++){ - totalRunedClientCount++ ; - startClient(addr) ; - } - while(true){ - if(totalOverClientCount.longValue() >= totalRunedClientCount.longValue()){ - Long seconds = (System.currentTimeMillis() - startTime)/1000 ; - RmiClUnit.getInstance().reportHadReportOver(seconds) ; - System.out.println("鍏辩敤鏃�" + seconds + "绉�"); - break ; - }else{ - Thread.sleep(100L); + try{ + startTime = System.currentTimeMillis() ; + for(Long addr = ServerProperties.rtuAddrStart; addr <= ServerProperties.rtuAddrEnd; addr++){ + totalRtuClientCount++ ; + createImitate(addr) ; } + log.info("鍏辨ā鎷熶簡" + totalRtuClientCount + "鍙癛TU"); + + Collection<MyThreadJob> collection = jobMap.values() ; + for(MyThreadJob job : collection){ + connectServer(job) ; + } + log.info("鍚姩鎵�鏈塕TU杩炴帴閫氫俊涓棿浠�"); + + while (true){ + int noConnectedCount = checkConnected() ; + if(noConnectedCount > 0){ + log.info("绛夊緟" + noConnectedCount + "鍙癛TU杩炴帴缃戠粶"); + Thread.sleep(100L); + }else{ + break ; + } + } + + startJob() ; + while(true){ + if(totalOverClientCount.longValue() >= totalRtuClientCount.longValue()){ + Long seconds = (System.currentTimeMillis() - startTime)/1000 ; + RmiClUnit.getInstance().allOver(seconds) ; + log.info("鍏辩敤鏃�" + seconds + "绉�"); + break ; + }else{ + Thread.sleep(100L); + } + } + }catch (Exception e){ + e.printStackTrace(); + }finally { + break ; } - break; } } } catch (Exception e) { @@ -91,20 +123,121 @@ }).start(); } - private void startClient(Long rtuAddr){ - try { - pool.putJob(new MyThreadJob("" + rtuAddr)); - } catch (Exception e) { - log.error("TcpClUnit.startClient() ", e); - } + /** + * 鍒涘缓RTU妯℃嫙MyThreadJob + * @param rtuAddr rtu鍦板潃 + */ + private void createImitate(Long rtuAddr){ + jobMap.put("" + rtuAddr, new MyThreadJob("" + rtuAddr, ServerProperties.tcpServerIp, ServerProperties.tcpServerPort)) ; } + private void connectServer(MyThreadJob job){ + if(job.session == null){ + try{ + new TcpConnect().createSession(job.rtuAddr, + job, + job.serverIp, + job.serverPort, + job.connectTimeout, + new TcpHandler(), + new Callback() { + @Override + public void call(Object obj) { + if(obj == null){ + log.error("鍒涘缓缃戠粶浼氳瘽杩斿洖涓簄ull"); + }else{ + job.session = (IoSession)obj ; + } + } + @Override + public void call(Object... objs) { + } + @Override + public void exception(Exception e) { + } + }) ; + }catch (Exception e){ + job.exceptionOnConnect = true ; + e.printStackTrace(); + } + } + } + + private int checkConnected(){ + int noConnectedCount = 0 ; + Collection<MyThreadJob> collection = jobMap.values() ; + for(MyThreadJob job : collection){ + if(job.session == null && !job.exceptionOnConnect){ + noConnectedCount++ ; + } + } + return noConnectedCount; + } + + private void startJob(){ + new Thread(new Runnable(){ + @Override + public void run() { + try { + int notOverCount; + while(true){ + notOverCount = 0 ; + Collection<MyThreadJob> collection = jobMap.values() ; + for(MyThreadJob job : collection){ + if(!job.isOver){ + notOverCount++ ; + pool.putJob(job); + } + } + if(notOverCount > 0){ + log.info("褰撳墠杩樻湁" + notOverCount + "鍙癛TU鏈畬鎴愪换鍔�"); + Thread.sleep(ServerProperties.sendInterval * 1000); + }else{ + break ; + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + }).start(); + } + + + public static synchronized void clientSendData(){ + totalSendDataCount++; + if(totalOverClientCount.longValue() >= totalRtuClientCount.longValue()){ + RmiClUnit.getInstance().reportHadReportCount(totalSendDataCount); + System.out.println("宸茬粡鍙戦��" + totalSendDataCount + "鏉℃暟鎹�"); + }else{ + if(totalRtuClientCount > 100){ + if(totalSendDataCount % 100 == 0){ + RmiClUnit.getInstance().reportHadReportCount(totalSendDataCount); + System.out.println("宸茬粡鍙戦��" + totalSendDataCount + "鏉℃暟鎹�"); + } + }else{ + RmiClUnit.getInstance().reportHadReportCount(totalSendDataCount); + System.out.println("宸茬粡鍙戦��" + totalSendDataCount + "鏉℃暟鎹�"); + } + } + } + public static synchronized void clientOver(){ totalOverClientCount++; - if(totalOverClientCount % 100 == 0){ - RmiClUnit.getInstance().reportHadReportCount(totalOverClientCount); - System.out.println("宸茬粡鍙戦��" + totalOverClientCount + "鏉℃暟鎹�"); + if(totalOverClientCount.longValue() >= totalRtuClientCount.longValue()){ + RmiClUnit.getInstance().reportHadReportOver(totalOverClientCount); + System.out.println("宸叉湁" + totalOverClientCount + "涓猂TU瀹屾垚浜嗕换鍔�"); + }else{ + if(totalRtuClientCount > 100) { + if (totalOverClientCount % 100 == 0) { + RmiClUnit.getInstance().reportHadReportOver(totalOverClientCount); + System.out.println("宸叉湁" + totalOverClientCount + "涓猂TU瀹屾垚浜嗕换鍔�"); + } + }else{ + RmiClUnit.getInstance().reportHadReportOver(totalOverClientCount); + System.out.println("宸叉湁" + totalOverClientCount + "涓猂TU瀹屾垚浜嗕换鍔�"); + } } } } diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpClUnitConfigVo.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpClUnitConfigVo.java index 0cc19ba..972b18e 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpClUnitConfigVo.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpClUnitConfigVo.java @@ -2,6 +2,4 @@ public class TcpClUnitConfigVo { public boolean enable ; - public int heartbeatTimes ; - public int sendInterval ; } diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpConnect.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpConnect.java new file mode 100644 index 0000000..a4dae41 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpConnect.java @@ -0,0 +1,71 @@ +package com.dy.testClient.tcpClient; + +import com.dy.common.util.Callback; +import org.apache.mina.core.future.ConnectFuture; +import org.apache.mina.core.session.IoSession; +import org.apache.mina.filter.codec.ProtocolCodecFilter; +import org.apache.mina.transport.socket.SocketConnector; +import org.apache.mina.transport.socket.nio.NioSocketConnector; + +import java.net.InetSocketAddress; + +public class TcpConnect { + + public static final String rtuAddrKey = "rtuAddr" ; + public static final String threadJobKey = "threadJob" ; + + /** + * 鍒ゆ柇浼氳瘽鏄惁鏈夋晥 + * @param se 缃戠粶浼氳瘽 + * @return 鏄惁杩炴帴 + */ + public boolean isConnected(IoSession se) { + return (se != null && se.isConnected()); + } + + /** + * 鍒涘缓鏂颁細璇� + * @param rtuAddr rtu鍦板潃 + * @param job rtu宸ヤ綔绫� + * @param host 鏈嶅姟鍣║RI + * @param port 鏈嶅姟鍣ㄧ鍙� + * @param connectTimeout 杩炴帴瓒呮椂鏃堕暱 + * @param handler 鏁版嵁澶勭悊鑰� + * @param callback 鍥炶皟 + * @return 缃戠粶浼氳瘽 + */ + public void createSession(String rtuAddr, + MyThreadJob job, + String host , + int port , + int connectTimeout , + TcpHandler handler, + Callback callback) throws Exception{ + SocketConnector connector = new NioSocketConnector(); + connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(new LocalCodecFactory())); + connector.setHandler(handler); + ConnectFuture connectFuture = connector.connect(new InetSocketAddress(host, port)); + connectFuture.awaitUninterruptibly(connectTimeout); + IoSession se = connectFuture.getSession(); + se.setAttribute(rtuAddrKey, rtuAddr) ; + se.setAttribute(threadJobKey, job) ; + callback.call(se) ; + } + + + /** + * 鍏抽棴浼氳瘽鑱旀帴 + * @param se + * @param connectTimeout + */ + public void disconnect(IoSession se , int connectTimeout) { + if (se != null) { + try{ + se.closeNow().awaitUninterruptibly(connectTimeout); + }catch(Exception e){ + }finally{ + se = null; + } + } + } +} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpHandler.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpHandler.java new file mode 100644 index 0000000..fbd9ed7 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpHandler.java @@ -0,0 +1,77 @@ +package com.dy.testClient.tcpClient; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.mina.core.service.IoHandlerAdapter; +import org.apache.mina.core.session.IdleStatus; +import org.apache.mina.core.session.IoSession; +import org.apache.mina.filter.FilterEvent; + +public class TcpHandler extends IoHandlerAdapter { + + private static Logger log = LogManager.getLogger(TcpHandler.class.getName()) ; + + /** + * {@inheritDoc} + */ + @Override + public void sessionCreated(IoSession session) throws Exception { + } + + /** + * {@inheritDoc} + */ + @Override + public void sessionOpened(IoSession session) throws Exception { + } + + /** + * {@inheritDoc} + */ + @Override + public void sessionClosed(IoSession session) throws Exception { + } + + /** + * {@inheritDoc} + */ + @Override + public void sessionIdle(IoSession session, IdleStatus status) throws Exception { + } + + /** + * {@inheritDoc} + */ + @Override + public void exceptionCaught(IoSession session, Throwable cause) throws Exception { + } + + /** + * {@inheritDoc} + */ + @Override + public void messageReceived(IoSession session, Object message) throws Exception { + } + + /** + * {@inheritDoc} + */ + @Override + public void messageSent(IoSession session, Object message) throws Exception { + } + + /** + * {@inheritDoc} + */ + @Override + public void inputClosed(IoSession session) throws Exception { + session.closeNow(); + } + + /** + * {@inheritDoc} + */ + @Override + public void event(IoSession session, FilterEvent event) throws Exception { + } +} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpConnect/LocalDecoder.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpConnect/LocalDecoder.java deleted file mode 100644 index 05aad53..0000000 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpConnect/LocalDecoder.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.dy.testClient.tcpConnect; -import java.io.*; - -import org.apache.mina.core.buffer.IoBuffer; -import org.apache.mina.core.session.IoSession; -import org.apache.mina.filter.codec.CumulativeProtocolDecoder; -import org.apache.mina.filter.codec.ProtocolDecoderOutput; - -import com.am.cs12.command.*; - -public class LocalDecoder extends CumulativeProtocolDecoder { - - private static final String DECODER_STATE_KEY = LocalDecoder.class.getName() + ".STATE"; - - public static final int MAX_SIZE = 2147483647 ; - - private class DecoderState { - Command com; - } - - /** - * 瀵圭綉缁滀紶杈撴潵鐨勬暟鎹繘琛岃В鐮� - */ - protected boolean doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws IOException, Exception{ - //浠庝細璇濅腑寰楀埌宸茬粡瑙g爜鐨勬暟鎹� - DecoderState decoderState = (DecoderState) session.getAttribute(DECODER_STATE_KEY); - if (decoderState == null) { - decoderState = new DecoderState(); - session.setAttribute(DECODER_STATE_KEY, decoderState); - } - if (decoderState.com == null) { - //璇曠潃璇诲彇鍛戒护鍖哄煙鏁版嵁 - //MAX_IMAGE_SIZE 鐩殑鏄槻姝㈠ぇ鏁版嵁閲忔敾鍑� - if (in.prefixedDataAvailable(4, MAX_SIZE)) { - decoderState.com = readCommand(in); - } else { - //鍛戒护鍖哄煙鏃犺冻澶熺殑鏁版嵁 - return false; - } - } - if (decoderState.com != null) { - //璇曠潃璇诲彇鏁版嵁(鏂囦欢)鍖哄煙鏁版嵁 - //MAX_IMAGE_SIZE 鐩殑鏄槻姝㈠ぇ鏁版嵁閲忔敾鍑� - if (in.prefixedDataAvailable(4, MAX_SIZE)) { - byte[] bs = getDataBytes(in); - MinaData minaCom = new MinaData() ; - minaCom.setCom(decoderState.com) ; - minaCom.setAttachment(bs) ; - out.write(minaCom); - - decoderState.com = null; - return true; - } else { - //鏁版嵁(鏂囦欢)鍖哄煙鏃犺冻澶熺殑鏁版嵁 - return false; - } - } - return false; - } - - /** - * 璇诲彇Command鍛戒护 - * @param in - * @return - * @throws IOException - */ - private Command readCommand(IoBuffer iob) throws IOException , Exception{ - int length = iob.getInt(); - byte[] bytes = new byte[length]; - iob.get(bytes); - Command com = new Command().toObject(bytes); - return com; - } - - /** - * 寰楀埌鏁版嵁鍩熸暟鎹殑瀛楄妭鏁扮粍 - * @param in - * @return - * @throws IOException - */ - private byte[] getDataBytes(IoBuffer iob) throws IOException { - int length = iob.getInt(); - if(length == 0){ - return null ; - } - byte[] bytes = new byte[length]; - iob.get(bytes); - return bytes ; - } - -} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpConnect/LocalEncoder.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpConnect/LocalEncoder.java deleted file mode 100644 index f895d68..0000000 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpConnect/LocalEncoder.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.dy.testClient.tcpConnect; - -import org.apache.mina.filter.codec.ProtocolEncoderOutput; -import org.apache.mina.filter.codec.ProtocolEncoderAdapter; -import org.apache.mina.core.buffer.IoBuffer; -import org.apache.mina.core.session.IoSession; - -import java.io.*; - -public class LocalEncoder extends ProtocolEncoderAdapter { - - /** - * 瀵规暟鎹繘琛岀紪鐮侊紝浠ュ缃戠粶浼犺緭 - */ - public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws IOException, Exception{ - MinaData minaData = null ; - if(message instanceof Command){ - minaData = new MinaData() ; - minaData.setCom((Command)message) ; - }else{ - minaData = (MinaData) message; - } - byte[] bytes1 = getCommandBytes(minaData.getCom()); - byte[] bytes2 = minaData.getAttachment() ; - int capacity = (bytes1==null?0:bytes1.length) + (bytes2==null?0:bytes2.length) + 8; - IoBuffer buffer = IoBuffer.allocate(capacity, false); - buffer.putInt(bytes1.length); - buffer.put(bytes1); - if(bytes2 == null){ - buffer.putInt(0); - }else{ - buffer.putInt(bytes2.length); - buffer.put(bytes2); - } - buffer.flip(); - out.write(buffer); - } - - /** - * 灏嗗懡浠よ浆鎹㈡垚瀛楄妭鏁扮粍 - * @param com - * @return - * @throws IOException - * @throws Exception - */ - private byte[] getCommandBytes(Command com) throws IOException, Exception { - String xml = com.toXml() ; - byte[] bytes = xml.getBytes() ; - return bytes ; - } -} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpConnect/MinaConnect.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpConnect/MinaConnect.java deleted file mode 100644 index 2d85f19..0000000 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpConnect/MinaConnect.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.dy.testClient.tcpConnect; - -import org.apache.mina.core.future.ConnectFuture; -import org.apache.mina.core.session.IoSession; - -import org.apache.mina.filter.codec.ProtocolCodecFilter; -import org.apache.mina.transport.socket.SocketConnector; -import org.apache.mina.transport.socket.nio.NioSocketConnector; - -import java.net.InetSocketAddress; - -public class MinaConnect { - - /** - * 鍒ゆ柇浼氳瘽鏄惁鏈夋晥 - * @param se 缃戠粶浼氳瘽 - * @return 鏄惁杩炴帴 - */ - protected boolean isConnected(IoSession se) { - return (se != null && se.isConnected()); - } - - /** - * 鍒涘缓鏂颁細璇� - * @param host 鏈嶅姟鍣║RI - * @param port 鏈嶅姟鍣ㄧ鍙� - * @return 缃戠粶浼氳瘽 - */ - protected IoSession createSession(String host , int port , int connectTimeout , MinaHandler handler) throws Exception{ - SocketConnector connector = new NioSocketConnector(); - connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(new LocalCodecFactory())); - connector.setHandler(handler); - ConnectFuture connectFuture = connector.connect(new InetSocketAddress(host, port)); - connectFuture.awaitUninterruptibly(connectTimeout); - IoSession se = connectFuture.getSession(); - return se ; - } - - - /** - * 鍏抽棴浼氳瘽鑱旀帴 - * @param se - * @param connectTimeout - */ - protected void disconnect(IoSession se , int connectTimeout) { - if (se != null) { - try{ - se.closeNow().awaitUninterruptibly(connectTimeout); - }catch(Exception e){ - }finally{ - se = null; - } - } - } -} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpConnect/MinaConnectPool.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpConnect/MinaConnectPool.java deleted file mode 100644 index 0f3321f..0000000 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpConnect/MinaConnectPool.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.dy.testClient.tcpConnect; - -import java.util.*; -import org.apache.mina.core.session.IoSession; - - -public class MinaConnectPool { - /** - * 绌洪棽浼氳瘽鐨勬睜(Hashtable鏄嚎绋嬪畨鍏ㄧ殑) - */ - private static Hashtable<String , Vector<IoSession>> freeSessions = new Hashtable<String ,Vector<IoSession>>(); - - /** - * 浠庝細璇濇睜涓緱鍒扮┖闂茬殑浼氳瘽锛屽鏋滄病鏈夌┖闂茬殑浼氳瘽锛屾湰鐫�蹇�熷弽搴旂殑鍘熷垯锛屾柊寤轰竴涓細璇濓紝涓嶅啀绛夊緟绻佸繖浼氳瘽鐨勯噴鏀� - * @param host - * @param port - * @return - * @throws Exception - */ - public static IoSession getSession(String host , int port , int connectTimeout) throws Exception{ - Vector<IoSession> vecter = freeSessions.get(getKey(host , port)) ; - if(vecter == null){ - vecter = new Vector<IoSession>() ; - freeSessions.put(getKey(host , port), vecter) ; - } - - MinaConnect con = new MinaConnect() ; - - IoSession se = popSession(vecter , con) ; - if(se == null){ - MinaHandler handler = new MinaHandler(connectTimeout) ; - se = createNewSession(host, port, connectTimeout, con, handler) ; - } - return se ; - } - - /** - * 灏嗕細璇濇斁鍥炴睜涓� - * @param host - * @param port - * @param se - */ - public static void freeSession(String host , int port , IoSession se){ - if(se == null){ - return ; - } - Vector<IoSession> vecter = freeSessions.get(getKey(host , port)) ; - if(vecter == null){ - vecter = new Vector<IoSession>() ; - freeSessions.put(getKey(host , port), vecter) ; - } - putSession(vecter, se) ; - } - - /** - * 浠庝細璇濇睜涓彇寰楃┖闂茬殑浼氳瘽 - * @param vecter - * @return - */ - private static IoSession popSession(Vector<IoSession> vecter , MinaConnect con){ - IoSession se = null ; - while(se == null && !vecter.isEmpty()){ - se = (IoSession)vecter.firstElement() ; - if(se != null){ - vecter.removeElementAt(0) ; - } - if(!con.isConnected(se)){ - se = null ; - } - } - return se ; - } - - /** - * 鏀炬柊浼氳瘽 - * @param vecter - * @param se - */ - private static void putSession(Vector<IoSession> vecter , IoSession se){ - vecter.addElement(se) ; - } - - /** - * 鍒涘缓鏂颁細璇� - * @param host - * @param port - * @param connectTimeout - * @param con - * @return - * @throws Exception - */ - private static IoSession createNewSession(String host , int port , int connectTimeout, MinaConnect con , MinaHandler handler) throws Exception{ - return con.createSession(host, port, connectTimeout , handler) ; - } - - /** - * 寰楀埌浼氳瘽姹犵殑key - * @param url - * @param port - * @return - */ - private static String getKey(String host , int port){ - return host + port ; - } - -} - diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpConnect/MinaHandler.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpConnect/MinaHandler.java deleted file mode 100644 index 8749cca..0000000 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpConnect/MinaHandler.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.dy.testClient.tcpConnect; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.apache.mina.core.service.IoHandlerAdapter; -import org.apache.mina.core.session.IdleStatus; -import org.apache.mina.core.session.IoSession; - -public class MinaHandler extends IoHandlerAdapter { - - private static Logger log = LogManager.getLogger(MinaHandler.class.getName()) ; - - private Object synObj ; - private int connectTimeout ; - private MinaData minaData ; - - public MinaHandler( int connectTimeout){ - this.connectTimeout = connectTimeout ; - this.synObj = new Object() ; - } - - /** - * 鍙戦�佸懡浠� - * @param session - * @param minaData - */ - public void sendCommand(IoSession session, MinaData minaData){ - session.write(minaData) ; - } - - /** - * 鍙栧緱鍛戒护缁撴灉 - * @param waitTimeout - */ - public MinaData getAnswer(int waitTimeout){ - synchronized (synObj) { - try { - synObj.wait(waitTimeout); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - return this.minaData; - } - - - - @Override - public void exceptionCaught(IoSession session, Throwable cause) throws Exception { - new MinaConnect().disconnect(session, this.connectTimeout) ; - log.error(cause.getMessage()) ; - } - - @Override - public void messageReceived(IoSession session, Object message) throws Exception { - this.minaData = (MinaData) message; - synchronized (synObj) { - if (synObj != null) { - synObj.notifyAll(); - } - } - } - - @Override - public void messageSent(IoSession session, Object message) throws Exception { - super.messageSent(session, message); - log.info("鍛戒护宸茬粡鍙戦�併��") ; - } - - @Override - public void sessionClosed(IoSession session) throws Exception { - super.sessionClosed(session); - log.info("缃戠粶浼氳瘽宸茬粡鍏抽棴銆�") ; - } - - @Override - public void sessionCreated(IoSession session) throws Exception { - super.sessionCreated(session); - log.info("缃戠粶浼氳瘽宸茬粡鍒涘缓銆�") ; - } - - @Override - public void sessionIdle(IoSession session, IdleStatus status) throws Exception { - super.sessionIdle(session, status); - } - - @Override - public void sessionOpened(IoSession session) throws Exception { - super.sessionOpened(session); - log.info("缃戠粶浼氳瘽宸茬粡鎵撳紑銆�") ; - } - - -} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/resources/Config.xml b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/resources/Config.xml index aec0502..7ac7aec 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/resources/Config.xml +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/resources/Config.xml @@ -32,17 +32,13 @@ --> <rmiCl rmiSvUrl="127.0.0.1" - rmiSvContext="mwTestServer" - rmiSvPort="9898" + rmiSvContext="mwTestSv" + rmiSvPort="12345" /> <!-- enable:鏄惁鍚姩 - heartbeatTimes:杩炵画閰嶇疆娆℃暟蹇冭烦鍚庡彂閫佷竴娆℃暟鎹� - sendInterval:鍙戦�佸績璺虫垨鏁版嵁鐨勬椂闂撮棿闅� --> <tcpCl enable="true" - heartbeatTimes="3" - sendInterval="3" /> </config> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/resources/application.yml b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/resources/application.yml deleted file mode 100644 index 8b13789..0000000 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/resources/application.yml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/resources/log4j2.xml b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/resources/log4j2.xml new file mode 100644 index 0000000..104ed67 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/resources/log4j2.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Configuration status="OFF"> + <Appenders> + <Console name="Console" target="SYSTEM_OUT"> + <PatternLayout charset="GBK" pattern="%d %-5p [%t] (%F:%L) - %m%n%throwable"/> + </Console> + <!-- + fileName="${sys:user.home}/logs/aepTest.log" filePattern="${sys:user.home}/logs/aepTest-%d{yyyy-MM}-%i.log.gz" + fileName="/logs/testJgroups.log" filePattern="/logs/testJgroups-%d{yyyyMMdd}-%i.log.gz" + fileName="logs/testJgroups.log" filePattern="logs/testJgroups-%d{yyyyMMdd}-%i.log.gz" + sys:user.home褰撳墠鐢ㄦ埛鍦ㄦ搷浣滅郴缁熶腑鐨勬枃妗g洰褰� + /logs/testJgroups.log褰撳墠杞欢鎵�鍦ㄧ‖鐩樻牴鐩綍 + logs/testJgroups.log褰撳墠杞欢鎵�鍦ㄧ洰褰� + --> + <RollingFile name="File" fileName="logs/mwTestCl.log" filePattern="logs/aepTest-%d{yyyyMMdd}-%i.log"> + <PatternLayout charset="UTF-8" pattern="%d %-5p [%t] (%class.%method:%L) - %m%n%throwable"/> + <Policies> + <TimeBasedTriggeringPolicy interval="7" /> + <SizeBasedTriggeringPolicy size="10MB"/> + </Policies> + <DefaultRolloverStrategy max="50" /> + </RollingFile> + </Appenders> + <Loggers> + <!-- + <Logger name="com.zhzc.jgTest" level="debug"> + <AppenderRef ref="Console"/> + </Logger> + <Logger name="org.jgroups" level="info"> + <AppenderRef ref="File"/> + </Logger> + --> + <!-- Root涓庡悇涓狶ogger鍚屾椂璧蜂綔鐢� --> + <Root level="info"> + <AppenderRef ref="Console"/> + <AppenderRef ref="File"/> + </Root> + </Loggers> +</Configuration> diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/resources/log4j2.yml b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/resources/log4j2.yml deleted file mode 100644 index 375972f..0000000 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/resources/log4j2.yml +++ /dev/null @@ -1,64 +0,0 @@ -Configuration: - #status锛岃繖涓敤浜庤缃甽og4j2鑷韩鍐呴儴鐨勪俊鎭緭鍑猴紝鍙互涓嶈缃紝褰撹缃垚trace鏃讹紝浣犱細鐪嬪埌log4j2鍐呴儴鍚勭璇︾粏杈撳嚭锛涘彲浠ヨ缃垚Off(鍏抽棴)鎴朎rror(鍙緭鍑洪敊璇俊鎭�) - status: Error - - Properties: # 瀹氫箟鍏ㄥ眬鍙橀噺 - Property: - #鏃ュ織鏂囦欢瀛樺偍鐨勭洰褰� - - name: log.path - value: ./logs - #鏃ュ織鏂囦欢瀛樺偍鍚嶇О - - name: project.name - value: mwTestClient - - #瀹氫箟杈撳嚭鍣紝鍙互杈撳嚭鍒版帶鍒跺彴鍜屾枃浠�. - Appenders: - #杈撳嚭鍒版帶鍒跺彴 - Console: - #Appender鍛藉悕 - name: CONSOLE - target: SYSTEM_OUT - ThresholdFilter: - level: debug #杈撳嚭鏃ュ織绾у埆锛岃緭鍑烘棩蹇楁椂锛岄鍏堢敱Loggers.Root.level鎴朙oggers.Logger.level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢辨湰level鍒ゆ柇鏄惁杈撳嚭 - onMatch: ACCEPT #onMatch=ACCEPT 澶т簬绛変簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織杈撳嚭 - onMismatch: DENY #onMismatch=DENY 灏忎簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織涓嶈緭鍑� - #鏃ュ織鍐呭鏍峰紡 - PatternLayout: - #%n-鎹㈣ - #%m-鏃ュ織鍐呭锛岃緭鍑轰唬鐮佷腑鎸囧畾鐨勬棩蹇椾俊鎭� - #%p-杈撳嚭浼樺厛绾э紝鍗矰EBUG,INFO,WARN,ERROR,FATAL - #%r-绋嬪簭鍚姩鍒扮幇鍦ㄧ殑姣鏁� - #%%- 杈撳嚭涓�涓�"%" 瀛楃 - #%t-褰撳墠绾跨▼鍚� - #%d-鏃ユ湡鍜屾椂闂�, 甯哥敤鐨勬牸寮忔湁%d{DATE},%d{ABSOLUTE},%d{HH:mm:ss,SSS},%d{ddMMyyyyHH:mm:ss,SSS} - #%l-鍚�%F%L%C%M - #%F-java婧愭枃浠跺悕 - #%L-java婧愮爜琛屾暟 - #%C-java绫诲悕,%C{1}杈撳嚭鏈�鍚庝竴涓厓绱� - #%M-java鏂规硶鍚� - pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%C.%M:%L) - %m%n" - # 杈撳嚭鍒版枃浠讹紝瓒呰繃10MB褰掓。 - RollingFile: - - name: ROLLING_FILE - ignoreExceptions: false - fileName: ${log.path}/${project.name}.log - filePattern: "${log.path}/$${date:yyyy-MM}/${project.name}-%d{yyyy-MM-dd}-%i.log.gz" - ThresholdFilter: - level: error #杈撳嚭鏃ュ織绾у埆锛岃緭鍑烘棩蹇楁椂锛岄鍏堢敱Loggers.Root.level鎴朙oggers.Logger.level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢辨湰level鍒ゆ柇鏄惁杈撳嚭 - onMatch: ACCEPT #onMatch=ACCEPT 澶т簬绛変簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織杈撳嚭 - onMismatch: DENY #onMismatch=DENY 灏忎簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織涓嶈緭鍑� - #鏃ュ織鍐呭鏍峰紡 - PatternLayout: - pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%C.%M:%L) - %m%n" - Policies: - SizeBasedTriggeringPolicy: - size: "10 MB" - DefaultRolloverStrategy: - max: 1000 - - Loggers: - Root: - level: info #鏃ュ織杈撳嚭绾у埆锛屽叡鏈�8涓骇鍒紝鎸夌収浠庝綆鍒伴珮涓猴細all < trace < debug < info < warn < error < fatal < off - AppenderRef: #Root鐨勫瓙鑺傜偣锛岀敤鏉ユ寚瀹氳鏃ュ織杈撳嚭鍒板摢涓狝ppender. - - ref: CONSOLE #杈撳嚭鏃ュ織鏃讹紝棣栧厛鐢辨湰level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢变笂闈㈢殑Appenders.Console.ThresholdFilter.level鍒ゆ柇鏄惁杈撳嚭 - - ref: ROLLING_FILE #杈撳嚭鏃ュ織鏃讹紝棣栧厛鐢辨湰level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢变笂闈㈢殑Appenders.RollingFile.ThresholdFilter.level鍒ゆ柇鏄惁杈撳嚭 diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/pom.xml b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/pom.xml index 4872f57..18bf9de 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/pom.xml +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/pom.xml @@ -20,6 +20,21 @@ </dependencies> <build> + <resources> + <resource> + <directory>src/main/java</directory> + <includes> + <include>**/*.xml</include> + </includes> + </resource> + <resource> + <directory>src/main/resources</directory> + <includes> + <include>**/*.xml</include> + <include>**/*.yml</include> + </includes> + </resource> + </resources> <plugins> <plugin> <!-- 璇ユ彃浠朵笉浼氬皢椤圭洰涓紩鍏ョ殑渚濊禆鎵撹繘鏈�缁堢殑 Jar 鏂囦欢 --> diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/Server.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/Server.java index 27fcf68..6e08a2e 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/Server.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/Server.java @@ -40,7 +40,7 @@ long start = System.currentTimeMillis() ; try { sv.conf = new ConfigXml() ; - sv.doc = sv.conf.createDom(sv.getClass(), "/config.xml") ; + sv.doc = sv.conf.createDom(sv.getClass(), "config.xml") ; //////////////// //鏈嶅姟 閰嶇疆 sv.showStartInfo = sv.conf.getSetAttrBoolean(sv.doc, "config.server", "showStartInfo", null, null) ; @@ -135,8 +135,10 @@ } ServerProperties.tcpServerIp = conf.getSetAttrTxt(doc, "config.base", "tcpServerIp", null, false, null) ; ServerProperties.tcpServerPort = conf.getSetAttrPlusInt(doc, "config.base", "tcpServerPort", null, 1, 65535, null) ; + ServerProperties.sendInterval = conf.getSetAttrPlusInt(doc, "config.base", "sendInterval", null, 1, null, null) ; + ServerProperties.heartbeatTimes = conf.getSetAttrPlusInt(doc, "config.base", "heartbeatTimes", null, 1, null, null) ; ServerProperties.sendTimes = conf.getSetAttrPlusInt(doc, "config.base", "sendTimes", null, 1, null, null) ; - + ///////////////// //RMI妯″潡 diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/ServerProperties.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/ServerProperties.java index de6cd2d..7bada8e 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/ServerProperties.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/ServerProperties.java @@ -12,6 +12,10 @@ public static String tcpServerIp = "" ; //鏈嶅姟绔笂涓嬫枃 public static Integer tcpServerPort = 60000 ; + //鍙戦�佹暟鎹棿闅� 绉� + public static Integer sendInterval = 0 ; + //姣忎竴杞鍙戦�佹暟鎹紝鍏朵腑鍖呮嫭蹇冭烦鍙戦�佹鏁� + public static Integer heartbeatTimes = 0 ; //鍙戦�佹暟鎹鏁� public static Integer sendTimes = 0 ; diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/console/Command.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/console/Command.java index 8e746e3..263786c 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/console/Command.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/console/Command.java @@ -65,7 +65,9 @@ prtWrt.println(" 姣忎釜mwTest鍒嗛厤鐨凴tuAddr鏁帮細" + ServerProperties.rtuAddrPerMwTest); prtWrt.println(" 閫氫俊涓棿浠禝P锛�" + ServerProperties.tcpServerIp); prtWrt.println(" 閫氫俊涓棿浠剁鍙o細" + ServerProperties.tcpServerPort); + prtWrt.println(" mwTest鍙戦�佹暟鎹棿闅旓紙绉掞級锛�" + ServerProperties.sendInterval); prtWrt.println(" mwTest姣廟tuAddr鍙峰彂閫佹暟鎹鏁帮細" + ServerProperties.sendTimes); + prtWrt.println(" mwTest姣忎竴杞鍙戦�佹暟鎹紝鍏朵腑鍖呮嫭蹇冭烦鍙戦�佹鏁帮細" + ServerProperties.heartbeatTimes); prtWrt.println("鏈湇鍔MI Server閰嶇疆"); String ip = null ; try { @@ -106,6 +108,9 @@ if(sta.count != null){ prtWrt.println(" 宸茬粡涓婃姤鏁版嵁锛�" + sta.count + "鏉�"); } + if(sta.overCount != null){ + prtWrt.println(" 宸茬粡瀹屾垚涓婃姤鏁版嵁锛�" + sta.overCount + "鍙癛TU"); + } if(sta.over != null && sta.over){ prtWrt.println(" 涓婃姤鏁版嵁宸茬粡瀹屾垚锛屽叡鐢ㄦ椂锛�" + sta.seconds + "绉�"); } diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/console/CommandConsole.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/console/CommandConsole.java index b03e5b3..1236153 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/console/CommandConsole.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/console/CommandConsole.java @@ -38,7 +38,7 @@ prtWrt.println("----------------------------------------"); prtWrt.println("-- --"); - prtWrt.println("-- 娆㈣繋浣跨敤mwTest 鏈嶅姟鎺у埗绔� --"); + prtWrt.println("-- 娆㈣繋浣跨敤mwTest 鏈嶅姟鎺у埗绔� --"); prtWrt.println("-- --"); prtWrt.println("----------------------------------------"); } diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/Code.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/Code.java index 889e9b3..970c2f5 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/Code.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/Code.java @@ -9,7 +9,8 @@ public static String cd3 = "003" ;//璇锋眰寮�濮嬪伐浣� public static String cd4 = "004" ;//鍚戞湇鍔$涓婃姤淇℃伅 - - public static String cd5 = "005" ;//鍚戞湇鍔$涓婃姤 鏁版嵁涓婃姤宸ヤ綔宸茬粡瀹屾垚 + public static String cd5 = "005" ;//鍚戞湇鍔$涓婃姤 瀹屾垚浠诲姟鐨勬暟閲� + + public static String cd6 = "006" ;//鍚戞湇鍔$涓婃姤 鍏ㄩ儴浠诲姟瀹屾垚 } diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/Manager.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/Manager.java index 8e057db..cf45570 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/Manager.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/Manager.java @@ -82,6 +82,8 @@ doDealReportCount(rqVo) ; }else if(rqVo.code.equals(Code.cd5)){ doDealReportOver(rqVo) ; + }else if(rqVo.code.equals(Code.cd6)){ + doDealAllOver(rqVo) ; } return resVo ; } @@ -114,6 +116,8 @@ conVo.rtuAddrEnd = (Long)rtuAddrs[1] ; conVo.tcpServerIp = ServerProperties.tcpServerIp ; conVo.tcpServerPort = ServerProperties.tcpServerPort ; + conVo.sendInterval = ServerProperties.sendInterval ; + conVo.heartbeatTimes = ServerProperties.heartbeatTimes ; conVo.sendTimes = ServerProperties.sendTimes ; sta = new MwTestClientStatus() ; sta.confVo = conVo ; @@ -157,6 +161,19 @@ MwTestClientStatus sta = token2ClientMap.get("" + token); if(sta == null){ sta = new MwTestClientStatus() ; + sta.overCount = rqVo.overCount ; + token2ClientMap.put("" + token, sta); + }else{ + sta.overCount = rqVo.overCount ; + } + } + + + private static void doDealAllOver(RmiRequestVo rqVo){ + int token = Integer.parseInt(rqVo.token) ; + MwTestClientStatus sta = token2ClientMap.get("" + token); + if(sta == null){ + sta = new MwTestClientStatus() ; if(rqVo.over != null && rqVo.over){ sta.over = true ; sta.seconds = rqVo.seconds ; @@ -170,4 +187,6 @@ } } + + } diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/MwConfigVo.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/MwConfigVo.java index d5de351..1ee9d72 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/MwConfigVo.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/MwConfigVo.java @@ -11,9 +11,12 @@ public String tcpServerIp = "" ; //閫氫俊涓棿浠剁鍙� public Integer tcpServerPort = 0 ; + //鍙戦�佹暟鎹暟鎹棿闅� + public Integer sendInterval = 2 ;//绉� + //姣忎竴杞鍙戦�佹暟鎹紝鍏朵腑鍖呮嫭蹇冭烦鍙戦�佹鏁� + public Integer heartbeatTimes = 3 ; //鍙戦�佹暟鎹鏁� public Integer sendTimes = 0 ; - /** * 瀵硅薄杞垚json * @return 杩斿洖 json @@ -74,6 +77,22 @@ this.tcpServerPort = tcpServerPort; } + public Integer getSendInterval() { + return sendInterval; + } + + public void setSendInterval(Integer sendInterval) { + this.sendInterval = sendInterval; + } + + public Integer getHeartbeatTimes() { + return heartbeatTimes; + } + + public void setHeartbeatTimes(Integer heartbeatTimes) { + this.heartbeatTimes = heartbeatTimes; + } + public Integer getSendTimes() { return sendTimes; } diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/MwTestClientStatus.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/MwTestClientStatus.java index 3dc24c6..71af287 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/MwTestClientStatus.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/MwTestClientStatus.java @@ -5,9 +5,11 @@ public MwConfigVo confVo ; public ResStartVo startVo ; - + public Integer count ;//mwTest涓婃姤鏁版嵁鏁伴噺 - + + public Integer overCount ;//mwTest瀹屾垚鍏ㄩ儴涓婃姤鏁版嵁RTU鏁伴噺 + public Boolean over ;//mwTest涓婃姤鏁版嵁缁撴潫 public Long seconds ;//mwTest涓婃姤鏁版嵁鐢ㄦ椂(绉�) diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/RmiRequestVo.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/RmiRequestVo.java index 59e9e6c..b7e3ba5 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/RmiRequestVo.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/RmiRequestVo.java @@ -11,7 +11,9 @@ public String code ; public Integer count;//mwTest涓婃姤鏁版嵁鏁伴噺 - + + public Integer overCount;//aepTest缁撴潫涓婃姤鏁版嵁鏁伴噺 + public Boolean over ;//mwTest涓婃姤鏁版嵁缁撴潫 public Long seconds ;//mwTest涓婃姤鏁版嵁鐢ㄦ椂(绉�) @@ -83,5 +85,12 @@ public void setSeconds(Long seconds) { this.seconds = seconds; } - + + public Integer getOverCount() { + return overCount; + } + + public void setOverCount(Integer overCount) { + this.overCount = overCount; + } } diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/resources/Config.xml b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/resources/Config.xml index e0a7651..9145942 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/resources/Config.xml +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/resources/Config.xml @@ -8,6 +8,8 @@ rtuAddrsPerMwTest: 姣忎釜mwTest鍒嗛厤鐨凴tuAddr鏁� tcpServerIp: 閫氫俊涓棿浠禝P tcpServerPort: 閫氫俊涓棿浠剁鍙� + sendInterval锛氬彂閫佹暟鎹棿闅� 绉� + heartbeatTimes锛氭瘡涓�杞鍙戦�佹暟鎹紝鍏朵腑鍖呮嫭蹇冭烦鍙戦�佹鏁� sendTimes锛氬彂閫佹暟鎹鏁� --> <base @@ -16,6 +18,8 @@ rtuAddrPerMwTest="1" tcpServerIp="127.0.0.1" tcpServerPort="60000" + sendInterval="2" + heartbeatTimes="3" sendTimes="1" /> diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/resources/log4j2.xml b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/resources/log4j2.xml new file mode 100644 index 0000000..6dae26f --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/resources/log4j2.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Configuration status="OFF"> + <Appenders> + <Console name="Console" target="SYSTEM_OUT"> + <PatternLayout charset="GBK" pattern="%d %-5p [%t] (%F:%L) - %m%n%throwable"/> + </Console> + <!-- + fileName="${sys:user.home}/logs/aepTest.log" filePattern="${sys:user.home}/logs/aepTest-%d{yyyy-MM}-%i.log.gz" + fileName="/logs/testJgroups.log" filePattern="/logs/testJgroups-%d{yyyyMMdd}-%i.log.gz" + fileName="logs/testJgroups.log" filePattern="logs/testJgroups-%d{yyyyMMdd}-%i.log.gz" + sys:user.home褰撳墠鐢ㄦ埛鍦ㄦ搷浣滅郴缁熶腑鐨勬枃妗g洰褰� + /logs/testJgroups.log褰撳墠杞欢鎵�鍦ㄧ‖鐩樻牴鐩綍 + logs/testJgroups.log褰撳墠杞欢鎵�鍦ㄧ洰褰� + --> + <RollingFile name="File" fileName="logs/mwTestSv.log" filePattern="logs/aepTest-%d{yyyyMMdd}-%i.log"> + <PatternLayout charset="UTF-8" pattern="%d %-5p [%t] (%class.%method:%L) - %m%n%throwable"/> + <Policies> + <TimeBasedTriggeringPolicy interval="7" /> + <SizeBasedTriggeringPolicy size="10MB"/> + </Policies> + <DefaultRolloverStrategy max="50" /> + </RollingFile> + </Appenders> + <Loggers> + <!-- Root涓庡悇涓狶ogger鍚屾椂璧蜂綔鐢� --> + <Root level="info"> + <AppenderRef ref="Console"/> + <AppenderRef ref="File"/> + </Root> + </Loggers> +</Configuration> diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/resources/log4j2.yml b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/resources/log4j2.yml deleted file mode 100644 index 5aba47b..0000000 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/resources/log4j2.yml +++ /dev/null @@ -1,64 +0,0 @@ -Configuration: - #status锛岃繖涓敤浜庤缃甽og4j2鑷韩鍐呴儴鐨勪俊鎭緭鍑猴紝鍙互涓嶈缃紝褰撹缃垚trace鏃讹紝浣犱細鐪嬪埌log4j2鍐呴儴鍚勭璇︾粏杈撳嚭锛涘彲浠ヨ缃垚Off(鍏抽棴)鎴朎rror(鍙緭鍑洪敊璇俊鎭�) - status: Error - - Properties: # 瀹氫箟鍏ㄥ眬鍙橀噺 - Property: - #鏃ュ織鏂囦欢瀛樺偍鐨勭洰褰� - - name: log.path - value: ./logs - #鏃ュ織鏂囦欢瀛樺偍鍚嶇О - - name: project.name - value: mwTestSever - - #瀹氫箟杈撳嚭鍣紝鍙互杈撳嚭鍒版帶鍒跺彴鍜屾枃浠�. - Appenders: - #杈撳嚭鍒版帶鍒跺彴 - Console: - #Appender鍛藉悕 - name: CONSOLE - target: SYSTEM_OUT - ThresholdFilter: - level: debug #杈撳嚭鏃ュ織绾у埆锛岃緭鍑烘棩蹇楁椂锛岄鍏堢敱Loggers.Root.level鎴朙oggers.Logger.level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢辨湰level鍒ゆ柇鏄惁杈撳嚭 - onMatch: ACCEPT #onMatch=ACCEPT 澶т簬绛変簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織杈撳嚭 - onMismatch: DENY #onMismatch=DENY 灏忎簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織涓嶈緭鍑� - #鏃ュ織鍐呭鏍峰紡 - PatternLayout: - #%n-鎹㈣ - #%m-鏃ュ織鍐呭锛岃緭鍑轰唬鐮佷腑鎸囧畾鐨勬棩蹇椾俊鎭� - #%p-杈撳嚭浼樺厛绾э紝鍗矰EBUG,INFO,WARN,ERROR,FATAL - #%r-绋嬪簭鍚姩鍒扮幇鍦ㄧ殑姣鏁� - #%%- 杈撳嚭涓�涓�"%" 瀛楃 - #%t-褰撳墠绾跨▼鍚� - #%d-鏃ユ湡鍜屾椂闂�, 甯哥敤鐨勬牸寮忔湁%d{DATE},%d{ABSOLUTE},%d{HH:mm:ss,SSS},%d{ddMMyyyyHH:mm:ss,SSS} - #%l-鍚�%F%L%C%M - #%F-java婧愭枃浠跺悕 - #%L-java婧愮爜琛屾暟 - #%C-java绫诲悕,%C{1}杈撳嚭鏈�鍚庝竴涓厓绱� - #%M-java鏂规硶鍚� - pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%C.%M:%L) - %m%n" - # 杈撳嚭鍒版枃浠讹紝瓒呰繃10MB褰掓。 - RollingFile: - - name: ROLLING_FILE - ignoreExceptions: false - fileName: ${log.path}/${project.name}.log - filePattern: "${log.path}/$${date:yyyy-MM}/${project.name}-%d{yyyy-MM-dd}-%i.log.gz" - ThresholdFilter: - level: error #杈撳嚭鏃ュ織绾у埆锛岃緭鍑烘棩蹇楁椂锛岄鍏堢敱Loggers.Root.level鎴朙oggers.Logger.level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢辨湰level鍒ゆ柇鏄惁杈撳嚭 - onMatch: ACCEPT #onMatch=ACCEPT 澶т簬绛変簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織杈撳嚭 - onMismatch: DENY #onMismatch=DENY 灏忎簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織涓嶈緭鍑� - #鏃ュ織鍐呭鏍峰紡 - PatternLayout: - pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%C.%M:%L) - %m%n" - Policies: - SizeBasedTriggeringPolicy: - size: "10 MB" - DefaultRolloverStrategy: - max: 1000 - - Loggers: - Root: - level: info #鏃ュ織杈撳嚭绾у埆锛屽叡鏈�8涓骇鍒紝鎸夌収浠庝綆鍒伴珮涓猴細all < trace < debug < info < warn < error < fatal < off - AppenderRef: #Root鐨勫瓙鑺傜偣锛岀敤鏉ユ寚瀹氳鏃ュ織杈撳嚭鍒板摢涓狝ppender. - - ref: CONSOLE #杈撳嚭鏃ュ織鏃讹紝棣栧厛鐢辨湰level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢变笂闈㈢殑Appenders.Console.ThresholdFilter.level鍒ゆ柇鏄惁杈撳嚭 - - ref: ROLLING_FILE #杈撳嚭鏃ュ織鏃讹紝棣栧厛鐢辨湰level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢变笂闈㈢殑Appenders.RollingFile.ThresholdFilter.level鍒ゆ柇鏄惁杈撳嚭 diff --git a/pipIrr-platform/pipIrr-mw/pom.xml b/pipIrr-platform/pipIrr-mw/pom.xml index 379d653..90a65d1 100644 --- a/pipIrr-platform/pipIrr-mw/pom.xml +++ b/pipIrr-platform/pipIrr-mw/pom.xml @@ -25,7 +25,11 @@ <groupId>com.dy</groupId> <artifactId>pipIrr-common</artifactId> <version>1.0.0</version> - <scope>provided</scope> + <!-- + scope涓嶈兘鐢╬rovided锛屽惁鍒橲erver.java鐨勮繍琛屼笉璧锋潵 + scope涓嶈兘鐢╮untime锛屽惁鍒欎笉鑳界紪杈� + --> + <scope>compile</scope> <optional>true</optional> <exclusions> <exclusion> @@ -39,7 +43,7 @@ <groupId>com.dy</groupId> <artifactId>pipIrr-global</artifactId> <version>1.0.0</version> - <scope>provided</scope> + <scope>compile</scope> <optional>true</optional> <exclusions> <exclusion> diff --git a/pipIrr-platform/pipIrr-platform.iml b/pipIrr-platform/pipIrr-platform.iml deleted file mode 100644 index 567993a..0000000 --- a/pipIrr-platform/pipIrr-platform.iml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_16"> - <output url="file://$MODULE_DIR$/target/classes" /> - <output-test url="file://$MODULE_DIR$/target/test-classes" /> - <content url="file://$MODULE_DIR$"> - <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> - <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> - <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> - <excludeFolder url="file://$MODULE_DIR$/target" /> - </content> - <orderEntry type="jdk" jdkName="20" jdkType="JavaSDK" /> - <orderEntry type="sourceFolder" forTests="false" /> - </component> -</module> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/.gitignore b/pipIrr-platform/pipIrr-web/.gitignore index aa4ab25..14569d5 100644 --- a/pipIrr-platform/pipIrr-web/.gitignore +++ b/pipIrr-platform/pipIrr-web/.gitignore @@ -1,2 +1,2 @@ target/ -/pipIrr-web.iml +pipIrr-web.iml diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sso/.gitignore b/pipIrr-platform/pipIrr-web/pipIrr-web-sso/.gitignore index c8fb6c3..b2b42bd 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sso/.gitignore +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sso/.gitignore @@ -1,6 +1,7 @@ HELP.md target/ /pipIrr-web-sso.iml +mvnw !.mvn/wrapper/maven-wrapper.jar !**/src/main/**/target/ !**/src/test/**/target/ diff --git "a/pipIrr-platform/\346\226\207\346\241\243/\346\226\207\344\273\266\345\212\240\345\205\245\344\272\206 .gitignore\357\274\214\344\275\206\350\277\230\346\230\257\350\242\253 git \350\267\237\350\270\252.docx" "b/pipIrr-platform/\346\226\207\346\241\243/\346\226\207\344\273\266\345\212\240\345\205\245\344\272\206 .gitignore\357\274\214\344\275\206\350\277\230\346\230\257\350\242\253 git \350\267\237\350\270\252.docx" new file mode 100644 index 0000000..db32b6b --- /dev/null +++ "b/pipIrr-platform/\346\226\207\346\241\243/\346\226\207\344\273\266\345\212\240\345\205\245\344\272\206 .gitignore\357\274\214\344\275\206\350\277\230\346\230\257\350\242\253 git \350\267\237\350\270\252.docx" Binary files differ -- Gitblit v1.8.0