From ac34819ca4dadb4dfc14215c31f76db6e3defdd1 Mon Sep 17 00:00:00 2001 From: wuzeyu <1223318623@qq.com> Date: 星期一, 27 十一月 2023 09:27:47 +0800 Subject: [PATCH] 提交了才能重新拉 --- pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/global/GlParse.java | 56 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/AnnotationScan.java | 6 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TaskSurpport.java | 132 + pipIrr-platform/pipIrr-web/pipIrr-web-gis/src/main/resources/application.yml | 2 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_C0_Down.java | 87 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_84_Down.java | 87 pipIrr-platform/pipIrr-web/pipIrr-web-gis/pom.xml | 118 + pipIrr-platform/pipIrr-web/pipIrr-web.iml | 4 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/Task.java | 46 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/RtuUpTask.java | 6 pipIrr-platform/pipIrr-global/src/main/resources/init-config.xml | 9 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_02_Down.java | 80 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/TcpUpDataCache.java | 70 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/AsciiPic.java | 2 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/pom.xml | 112 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/console/CommandConsole.java | 91 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/PipIrrMwAcceptApplication.java | 1 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/console/Command.java | 126 + pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/MidResultActionToRtu.java | 2 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnitConfigVo.java | 6 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/resources/application.yml | 2 pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml | 2 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/TcpIoSessionAttrIdIsRtuAddr.java | 2 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ParseParamsForDownV1_0_1.java | 40 pipIrr-platform/pipIrr-web/pipIrr-web-sso/pom.xml | 120 + pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/OnLine.java | 6 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd84Vo.java | 33 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/AboutRtuNode.java | 62 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaClient.java | 2 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/ToRtuConstantTask.java | 46 pipIrr-platform/文档/在线需求文件访问地址.txt | 3 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DriverV1_0_1.java | 149 + pipIrr-platform/pipIrr-mw/pom.xml | 129 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/PrefixedDataAvailableHandleImp.java | 14 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataV1_0_1.java | 30 pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaClientMapper.xml | 15 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/AdapterImp_RmiUnit.java | 26 pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java | 22 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/Server.java | 167 + pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/threadPool/TreadPoolFactory.java | 17 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TreeConfig.java | 6 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ParseParamsForUpV1_0_1.java | 39 pipIrr-platform/pipIrr-web/pipIrr-web-demo/pom.xml | 118 + pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/dbSv/说明.txt | 1 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Driver.java | 14 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/ResRegisterVo.java | 46 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCdC0Vo.java | 52 pipIrr-platform/pipIrr-global/pipIrr-global.iml | 57 pipIrr-platform/pipIrr-web/pom.xml | 52 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_83_Down.java | 87 pipIrr-platform/pipIrr-web/pipIrr-web-base/pom.xml | 120 + pipIrr-platform/文档/Git操作.txt | 2 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolUnit.java | 6 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/DistrictLevel.java | 5 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TaskConfig.java | 9 pipIrr-platform/pom.xml | 90 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd83CloseVo.java | 61 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/queue/Queue.java | 27 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CommonV1_0_1.java | 176 + pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/threadPool/ThreadPoolImp.java | 92 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/RmiRequestedCallback.java | 36 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_84_Up.java | 149 + pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DateTime.java | 4 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd71Vo.java | 21 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/MwTestClientStatus.java | 56 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/ResStartVo.java | 63 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TkReceive.java | 31 pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockSv.java | 1 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/RmiRequestVo.java | 87 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd02Vo.java | 20 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnit.java | 48 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_71_Up.java | 65 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/pom.xml | 104 pipIrr-platform/文档/编码设计.docx | 0 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CodeV1_0_1.java | 33 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/resources/application.yml | 2 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TkRtuData.java | 29 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/resources/Config.xml | 31 pipIrr-platform/文档/Maven 打包插件 maven-jar-plugin.docx | 0 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultFromRtu.java | 5 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_83_Up.java | 253 ++ pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ProtocolConstantV206V1_0_0.java | 52 pipIrr-platform/pipIrr-web/pipIrr-web-remote/pom.xml | 119 + pipIrr-platform/pipIrr-web/pipIrr-web-statistics/pom.xml | 119 + pipIrr-platform/文档/Maven打包.docx | 0 pipIrr-platform/pipIrr-common/pom.xml | 94 pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/resources/application.yml | 2 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_02_Up.java | 89 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/ServerProperties.java | 8 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TreeParse.java | 172 + pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/p206V1_0_0/TkFindP206V1_0_0.java | 27 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/DriverParserDataCallback.java | 16 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultError.java | 6 pipIrr-platform/文档/Maven的maven-compiler-plugin插件.docx | 0 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_71_Down.java | 85 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/resources/config.xml | 37 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/.gitignore | 33 pipIrr-platform/pipIrr-web/pipIrr-web-demo/src/main/resources/application.yml | 2 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Data.java | 11 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/ServerProperties.java | 18 pipIrr-platform/pipIrr-mw/pipIrr-mw.iml | 107 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Command.java | 47 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/PrefixedDataAvailableV1_0_1.java | 57 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreThread.java | 6 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataAlarmVo.java | 28 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/RtuDownTask.java | 11 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/fastjson/FastJsonConfig.java | 6 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/MwConfigVo.java | 84 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TaskPool.java | 115 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/p206V1_0_0/TkPreGenObjs.java | 82 pipIrr-platform/文档/增加一个应用机构.docx | 0 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolCache.java | 4 pipIrr-platform/pipIrr-global/pom.xml | 128 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/MidResultActionFromRtu.java | 26 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaDistrict.java | 4 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandObj.java | 4 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/dbSv/RtuSv.java | 7 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultToRtu.java | 5 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/Server.java | 50 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd83OpenVo.java | 46 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/Manager.java | 173 + /dev/null | 0 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataStateVo.java | 24 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_C0_Up.java | 224 + pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java | 444 ++- pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictVo.java | 4 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandCache.java | 32 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/global/GlCreate.java | 39 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/Tree.xml | 95 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/resources/log4j2.yml | 64 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/OnLineHandle.java | 6 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/Code.java | 15 pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/BusiConstantTask.java | 74 pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/RmiResponseVo.java | 75 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/OnLineV1_0_1.java | 12 135 files changed, 6,049 insertions(+), 967 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/pom.xml b/pipIrr-platform/pipIrr-common/pom.xml index d645758..893e832 100644 --- a/pipIrr-platform/pipIrr-common/pom.xml +++ b/pipIrr-platform/pipIrr-common/pom.xml @@ -42,6 +42,7 @@ <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> + <!-- @Aspect @Pointcut @Around绛夊簲鐢� --> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> @@ -71,7 +72,6 @@ <artifactId>springdoc-openapi-security</artifactId> </dependency> - <!--mysql椹卞姩--> <dependency> <groupId>com.mysql</groupId> @@ -82,25 +82,25 @@ <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> + <version>1.2.20</version> </dependency> <!--mybatis-plus-spring-boot--> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> + <version>3.5.3.2</version> </dependency> <!-- 闃块噷fastjson --> <dependency> - <groupId>cglib</groupId> - <artifactId>cglib</artifactId> - </dependency> - <dependency> <groupId>com.alibaba.fastjson2</groupId> <artifactId>fastjson2</artifactId> + <version>2.0.40</version> </dependency> <dependency> <groupId>com.alibaba.fastjson2</groupId> <artifactId>fastjson2-extension-spring6</artifactId> + <version>2.0.40</version> </dependency> <!-- jdom2 --> @@ -113,12 +113,8 @@ <dependency> <groupId>org.apache.mina</groupId> <artifactId>mina-core</artifactId> + <version>2.2.2</version> </dependency> - <dependency> - <groupId>org.apache.mina</groupId> - <artifactId>mina-filter-compression</artifactId> - </dependency> - <!-- quartz --> <dependency> <groupId>org.quartz-scheduler</groupId> @@ -130,22 +126,77 @@ <groupId>cn.hutool</groupId> <artifactId>hutool-all</artifactId> </dependency> - </dependencies> <build> <plugins> <plugin> - <!-- spring boot鎻愪緵鐨刴aven鎵撳寘鎻掍欢 --> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> + <!-- 璇ユ彃浠朵笉浼氬皢椤圭洰涓紩鍏ョ殑渚濊禆鎵撹繘鏈�缁堢殑 Jar 鏂囦欢 --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> <configuration> + <archive> + <!-- 鐢熸垚鐨刯ar涓紝涓嶈鍖呭惈pom.xml鍜宲om.properties杩欎袱涓枃浠� --> + <addMavenDescriptor>false</addMavenDescriptor> + <!-- 杩欓儴鍒嗗彲鏈夊彲鏃�,鍔犱笂鐨勮瘽鍒欑洿鎺ョ敓鎴愬彲杩愯jar鍖� + <manifest> + <mainClass>com.dy.Main</mainClass> + <useUniqueVersions>false</useUniqueVersions> + <addClasspath>true</addClasspath> + <classpathPrefix>lib/</classpathPrefix> + </manifest> + --> + <!-- manifestEntries鐨勪綔鐢ㄦ槸鎸囧畾鏈湴锛堣嚜宸变笅杞界殑lib涓嬬殑锛塲ar鍖呮坊鍔犲埌MANIFEST.MF鏂囦欢涓幓 + <manifestEntries> + <Class-Path>.lib/alipay-sdk.java.jar</Class-Path> + </manifestEntries> + --> + </archive> + <!-- 鎺掗櫎鏌愪釜鏂囦欢 <excludes> - <exclude> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - </exclude> + <exclude>com/dy/App.class</exclude> </excludes> + --> + <!-- 鍙墽琛宩ar杩涜鍛藉悕銆傝繖鏍蜂細鎵撳寘鎴愪袱涓猨ar鍖咃紝涓嶄細瀵规櫘閫歫ar閲嶆柊鍛藉悕銆� + <classifier>exec</classifier> + --> + </configuration> + </plugin> + <plugin> + <!-- 褰撻」鐩腑渚濊禆姣旇緝澶氭椂锛屾垜浠彲浠ュ�熷姪 maven-dependency-plugin 鎻掍欢鑷姩甯垜浠笅杞戒緷璧栫殑 Jar 鏂囦欢锛屾帹鑽愬皢璇ユ彃浠剁粦瀹氬埌package鐢熷懡鍛ㄦ湡涓� --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <!-- 缁戝畾鐢熷懡鍛ㄦ湡 --> + <phase>package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <!-- 璁剧疆渚濊禆鐨勫瓨鏀捐矾寰� --> + <configuration> + <outputDirectory>${project.build.directory}/lib</outputDirectory> + </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> @@ -157,9 +208,10 @@ </configuration> </plugin> <plugin> - <!-- 寮哄埗璁惧畾 java缂栬瘧鐗堟湰锛岃繍琛岀幆澧冪増鏈� --> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> + <!-- 涓嬮潰瑙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> diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/fastjson/FastJsonConfig.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/fastjson/FastJsonConfig.java index 477f78a..22eb799 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/fastjson/FastJsonConfig.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/fastjson/FastJsonConfig.java @@ -6,18 +6,18 @@ import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; @Configuration -public class FastJsonConfig implements WebMvcConfigurer { +public class FastJsonConfig { /** * 閰嶇疆fastjson杈撳嚭鏍煎紡 **/ - @Override + @SuppressWarnings("unused") public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { // 1. 閰嶇疆fastjson com.alibaba.fastjson2.support.config.FastJsonConfig config = new com.alibaba.fastjson2.support.config.FastJsonConfig(); diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/TcpIoSessionAttrIdIsRtuAddr.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/TcpIoSessionAttrIdIsRtuAddr.java index 3bd48c5..0d3eb64 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/TcpIoSessionAttrIdIsRtuAddr.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/tcp/TcpIoSessionAttrIdIsRtuAddr.java @@ -7,5 +7,5 @@ */ public class TcpIoSessionAttrIdIsRtuAddr { - public static final String sessionArrIdKey = "key_rtuAddr" ; //杩欎釜key瀛樺偍鐨勬槸IMEI鍙� + public static final String sessionArrIdKey = "key_rtuAddr" ; //杩欎釜key瀛樺偍鐨勬槸Rtu鍦板潃 } diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreThread.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreThread.java index 46341fe..124c735 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreThread.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/core/CoreThread.java @@ -10,7 +10,7 @@ private static CoreThread instance = new CoreThread() ; - private static Long sleepBigBusy = 100L ;//澶у繖鏃讹紙闄や簡鎭掍箙浠诲姟锛岃繕鏄叾浠栦换鍔★級锛屾牳蹇冪嚎绋嬫殏鍋滈棿闅� + private static Long sleepBigBusy = 100L ;//澶у繖鏃讹紙闄や簡鎭掍箙浠诲姟锛岃繕鏈夊叾浠栦换鍔★級锛屾牳蹇冪嚎绋嬫殏鍋滈棿闅� private static Long sleepSmallBusy = 500L ;//灏忓繖鏃讹紙鍙湁鎭掍箙浠诲姟锛屾棤鍏朵粬浠诲姟锛夛紝鏍稿績绾跨▼鏆傚仠闂撮殧 private CoreThread(){ @@ -22,8 +22,8 @@ /** * 璁剧疆鏆傚仠鏃堕暱 - * @param sleepWorking - * @param sleepIdel + * @param sleepBigBusy 澶у繖鏃讹紙闄や簡鎭掍箙浠诲姟锛岃繕鏈夊叾浠栦换鍔★級锛屾牳蹇冪嚎绋嬫殏鍋滈棿闅� + * @param sleepSmallBusy 灏忓繖鏃讹紙鍙湁鎭掍箙浠诲姟锛屾棤鍏朵粬浠诲姟锛夛紝鏍稿績绾跨▼鏆傚仠闂撮殧 */ public void setSleep(Long sleepBigBusy, Long sleepSmallBusy){ CoreThread.sleepBigBusy = sleepBigBusy ; diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/AnnotationScan.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/AnnotationScan.java index f4ec4cb..2b3aa3a 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/AnnotationScan.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/AnnotationScan.java @@ -65,9 +65,9 @@ int onLineDataMinLength; int headMinLength ; - HashMap<String, AnnotationDriverVo> driverMap = ProtocolCach.getDriverMap() ; - HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCach.getPrefixedDataAvailableMap() ; - HashMap<String, AnnotationOnLineVo> onLineMap = ProtocolCach.getOnLineMap() ; + HashMap<String, AnnotationDriverVo> driverMap = ProtocolCache.getDriverMap() ; + HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCache.getPrefixedDataAvailableMap() ; + HashMap<String, AnnotationOnLineVo> onLineMap = ProtocolCache.getOnLineMap() ; for(String cName : classNames){ String className = cName.substring(0, cName.lastIndexOf('.')) ; 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 674046b..7bb4162 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 @@ -32,25 +32,7 @@ * RTU 鍦板潃 */ public String rtuAddr ; - - /** - * 姘磋〃鍙� - * 搴旂敤鐢典俊骞冲彴鏃舵湁鏁� - */ - public String meterNo ; - - /** - * 鐢典俊骞冲彴涓婄殑浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴涓婅繍琛屾椂锛屼负null - * 搴旂敤鐢典俊骞冲彴鏃舵湁鏁� - */ - public Integer productId ; - - /** - * 鐢典俊骞冲彴涓婄殑璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴涓婅繍琛屾椂锛屼负null - * 搴旂敤鐢典俊骞冲彴鏃舵湁鏁� - */ - public String deviceId ; - + /** * 鍛戒护绫诲瀷:Rtu鍛戒护銆侀拡瀵圭洃鎺т腑闂翠欢鐨勫懡浠� * 鐢眂om.dy.common.mw.protocol.CommandType绫诲畾涔� @@ -80,14 +62,7 @@ public String toString(){ String s = "鍛戒护id=" + id + "\n" ; s += (protocol == null ? "" : ("鍗忚=" + protocol + "\n")); - s += (rtuAddr == null ? "" : ("IMEI鍙�=" + rtuAddr + "\n")); - s += (meterNo == null ? "" : ("姘磋〃鍙�=" + meterNo + "\n")); - if(productId != null){ - s += "鐢典俊骞冲彴浜у搧ID=" + productId + "\n" ; - } - if(deviceId != null && !deviceId.trim().equals("")){ - s += "鐢典俊骞冲彴璁惧ID=" + deviceId + "\n" ; - } + s += (rtuAddr == null ? "" : ("Rtu鍦板潃=" + rtuAddr + "\n")); s += "鍛戒护绫诲瀷=" + (type.equals(CommandType.innerCommand)?"鍐呴儴鍛戒护":"缁堢鍛戒护") + "\n" ; s += (code == null ? "" : ("鍔熻兘鐮�=" + code + "\n")) ; s += "杩斿洖涓棿浠跺鍛戒护澶勭悊缁撴灉=" + (noRtMwDealRes == null?"杩斿洖":(noRtMwDealRes?"涓嶈繑鍥�":"杩斿洖") + "\n") ; @@ -209,24 +184,6 @@ } public void setProtocol(String protocol) { this.protocol = protocol; - } - public String getMeterNo() { - return meterNo; - } - public void setMeterNo(String meterNo) { - this.meterNo = meterNo; - } - public Integer getProductId() { - return productId; - } - public void setProductId(Integer productId) { - this.productId = productId; - } - public String getDeviceId() { - return deviceId; - } - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; } public String getType() { return type; 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 cbc9b69..58b5ede 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 @@ -6,7 +6,6 @@ /** * 鏁版嵁鏍� - * @author Administrator * */ public class Data implements java.io.Serializable{ @@ -15,7 +14,6 @@ private String commandId ;//鍛戒护ID锛屽彲鑳戒负null private String rtuAddr ;//缁堢鍦板潃 - private String meterNo ;//姘磋〃鍙� private String protocol ;//鏁版嵁鎵�瀵瑰簲鐨勫崗璁悕绉� private String code ;//鏁版嵁鎵�瀵瑰簲鐨勫姛鑳界爜: private Object subData ;//瀵瑰簲鍚勪釜鍔熻兘鐮佺殑鍏蜂綋鏁版嵁 @@ -24,8 +22,7 @@ public String toString() { StringBuilder sb = new StringBuilder() ; sb.append("涓婅鎶ユ枃(鍗佸叚杩涘埗): ").append((hex == null?"":hex)).append("\n") ; // - sb.append("IMEI鍙� : ").append((rtuAddr==null?"":rtuAddr)).append("\n") ; - sb.append("姘磋〃鍙� : ").append((meterNo==null?"":meterNo)).append("\n") ; + sb.append("Rtu鍦板潃 : ").append((rtuAddr==null?"":rtuAddr)).append("\n") ; if(commandId != null){ sb.append("鍛戒护ID : ").append(commandId).append("\n") ; //鍛戒护ID } @@ -88,12 +85,6 @@ this.rtuAddr = rtuAddr; } - public String getMeterNo() { - return meterNo; - } - public void setMeterNo(String meterNo) { - this.meterNo = meterNo; - } public String getCode() { return code; } diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Driver.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Driver.java index 4b607f3..9f29d8c 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Driver.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/Driver.java @@ -142,7 +142,7 @@ return codeParse ; } /** - * 瑙f瀽涓婅鏁版嵁 + * 瑙f瀽鐢典俊骞冲彴涓婅鏁版嵁 * @param isLowPower 鏄惁鍦ㄤ綆鍔熻�楃幆澧冧笅杩愯 * @param rtuAddr 鎺у埗鍣ㄥ湴鍧� * @param upBuffer 瀛楄妭鏁扮粍 @@ -151,18 +151,6 @@ * @return MidResult[] */ public abstract MidResult[] parseData(Boolean isLowPower, String rtuAddr, byte[] upBuffer, String upHex, DriverParserDataCallback callback, Object... params) ; - /** - * 瑙f瀽鐢典俊骞冲彴涓婅鏁版嵁 - * @param isLowPower 鏄惁鍦ㄤ綆鍔熻�楃幆澧冧笅杩愯 - * @param rtuAddr 鎺у埗鍣ㄥ湴鍧� - * @param productId 鐢典俊骞冲彴浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴涓繍琛屾椂锛屼负null - * @param deviceId 鐢典俊骞冲彴璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴涓繍琛屾椂锛屼负null - * @param upBuffer 瀛楄妭鏁扮粍 - * @param upHex 瀛楄妭鏁扮粍16杩涘埗褰㈠紡 - * @param callback 鍥炶皟 - * @return MidResult[] - */ - public abstract MidResult[] parseData(Boolean isLowPower, String rtuAddr, Integer productId, String deviceId, byte[] upBuffer, String upHex, DriverParserDataCallback callback, Object... params) ; /** * 鏋勯�犱笅琛屾暟鎹紙鍛戒护锛� diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/DriverParserDataCallback.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/DriverParserDataCallback.java index 5ca3e20..30f219a 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/DriverParserDataCallback.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/DriverParserDataCallback.java @@ -4,23 +4,19 @@ /** * 瑙f瀽涓婅鏁版嵁鍚庡洖璋� - * @param rtuAddr 涓婅鏁版嵁鍗忚澶翠腑鐨処MEI鍙� - * @param meterNo 涓婅鏁版嵁鍗忚澶翠腑鐨勬按琛ㄥ彿 + * @param rtuAddr 涓婅鏁版嵁鍗忚澶翠腑RtuAddr * @param code 涓婅鏁版嵁 鍔熻兘鐮� * @param upHex 涓婅鏁版嵁 * @param reportOrResponse_trueOrFalse 涓婅鏁版嵁鏄富鍔ㄤ笂鎶ヨ繕鏄懡浠ょ粨鏋� * @param parseFail 涓婅鏁版嵁瑙f瀽鏄惁澶辫触 - * @param rtuAddrInData 涓婅鏁版嵁涓湪鍗忚鏁版嵁涓殑IMEI鍙凤紝 - * @param meterNoInData 涓婅鏁版嵁涓湪鍗忚鏁版嵁涓殑姘磋〃鍙凤紝 - * 鈥滀慨鏀筊TU缁堢绠$悊閰嶇疆鍙傛暟鈥濆懡浠ょ殑杩斿洖鏁版嵁锛屽叾鍗忚澶翠腑鐨処MEI鍙蜂笌鏁版嵁涓殑IMEI鍙蜂笉涓�鏍凤紝 - * 濡傛灉RTU涓嶈兘鍏抽棴缃戠粶锛岄偅涔坰essionCach涓殑IMEI鍙锋�绘槸鐢ㄤ慨鏀瑰墠鐨処MEI鍙凤紝浣垮緱浠ュ悗涓婅鏁版嵁鐨勪笉鑳芥壘鍒扮紦瀛樹腑鐨凷ession + * @param rtuAddrInData 涓婅鏁版嵁涓湪鍗忚鏁版嵁涓殑Rtu鍦板潃锛� + * 鈥滀慨鏀筊TU缁堢绠$悊閰嶇疆鍙傛暟鈥濆懡浠ょ殑杩斿洖鏁版嵁锛屽叾鍗忚澶翠腑鐨凴tu鍦板潃涓庢暟鎹腑鐨凴tu鍦板潃涓嶄竴鏍凤紝 + * 濡傛灉RTU涓嶈兘鍏抽棴缃戠粶锛岄偅涔坰essionCach涓殑Rtu鍦板潃鎬绘槸鐢ㄤ慨鏀瑰墠鐨凴tu鍦板潃锛屼娇寰椾互鍚庝笂琛屾暟鎹殑涓嶈兘鎵惧埌缂撳瓨涓殑Session */ void callback(String rtuAddr, - String meterNo, - String code, + String code, String upHex, Boolean reportOrResponse_trueOrFalse, boolean parseFail, - String rtuAddrInData, - String meterNoInData) ; + String rtuAddrInData) ; } diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultError.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultError.java index 0a71d84..bdbb7a0 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultError.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultError.java @@ -11,15 +11,13 @@ } public String protocolName ;//鍗忚鍚嶇О - public String rtuAddr ;//IMEI鍙凤紝娉ㄦ剰rtuAddr鍙兘涓簄ull - public String meterNo ;//姘磋〃鍙凤紝娉ㄦ剰meterNo鍙兘涓簄ull + public String rtuAddr ;//Rtu鍦板潃锛屾敞鎰弐tuAddr鍙兘涓簄ull public String message ;//鍑洪敊娑堟伅 public Exception e ;//寮傚父 - public MidResultError(String protocolName, String rtuAddr, String meterNo, String message, Exception e){ + public MidResultError(String protocolName, String rtuAddr, String message, Exception e){ this.protocolName = protocolName ; this.rtuAddr = rtuAddr ; - this.meterNo = meterNo ; this.message = message ; this.e = e ; } diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultFromRtu.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultFromRtu.java index 50562ef..4813115 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultFromRtu.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultFromRtu.java @@ -13,10 +13,7 @@ public String commandId ;//鍙戦�佸懡浠ょ殑ID锛屽鏋滄槸鍛戒护缁撴灉锛屽苟涓斿尮閰嶄簡涓嬪彂鍛戒护锛屾鍊间笉涓虹┖ public String protocolName ;//鍗忚鍚嶇О - public String rtuAddr ;//IMEI鍙� - public String meterNo ;//姘磋〃鍙� - public Integer productId ;//鐢典俊骞冲彴浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - public String deviceId ;//鐢典俊骞冲彴璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull + public String rtuAddr ;//Rtu鍦板潃 public String upCode ;//涓婅鏁版嵁涓殑鍔熻兘鐮� public String upHex ;//涓婅鏁版嵁鍗佸叚杩涘埗褰㈠紡 public byte[] upBuffer ;//涓婅鏁版嵁瀛楄妭鏁扮粍 diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultToRtu.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultToRtu.java index 4c58abe..087aa53 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultToRtu.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/MidResultToRtu.java @@ -11,10 +11,7 @@ } public String protocolName ;//鍗忚鍚嶇О - public String rtuAddr ;//IMEI鍙�(鐢典俊骞冲彴IMEI) - public String meterNo ;//姘磋〃鍙� - public Integer productId ;//鐢典俊骞冲彴浜у搧ID - public String deviceId ;//鐢典俊骞冲彴璁惧ID + public String rtuAddr ;//Rtu鍦板潃 public String commandId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉 public String downCode ;//涓嬭鍛戒护鍔熻兘鐮�; public byte[] downBuffer ;//涓嬭鍛戒护鏁版嵁 diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/OnLine.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/OnLine.java index f8b693b..746e926 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/OnLine.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/OnLine.java @@ -16,19 +16,17 @@ class OnLineResult{ public int result ;//鍒嗘瀽缁撴灉 public String protocolName ;//鍗忚鍚嶇О - public String rtuAddr ;//IMEI鍙� - public String meterNo ;//姘磋〃鍙� + public String rtuAddr ;//Rtu鍦板潃 public byte[] remoteData;//闇�瑕佸悜Rtu鍥炲啓鐨勬暟鎹� public OnLineResult(){ result = OnLineAction_fail ; rtuAddr = null ; - meterNo = null ; remoteData = null ; } } int OnLineAction_fail = 0; //鍒嗘瀽涓婄嚎鏁版嵁澶辫触锛屽鎻愪緵鐨勬暟鎹负null绛夊師鍥� - int OnLineAction_success = 1; //鍒嗘瀽涓婄嚎鏁版嵁鎴愬姛锛屽苟鑳藉緱鍒癐MEI鍙� + int OnLineAction_success = 1; //鍒嗘瀽涓婄嚎鏁版嵁鎴愬姛锛屽苟鑳藉緱鍒癛tu鍦板潃 int OnLineAction_success_noMe = 2; //鍒嗘瀽涓婄嚎鏁版嵁鎴愬姛锛岃瘑鍒嚭涓嶆槸鏈崗璁暟鎹� int OnLineAction_success_response = 3; //鍒嗘瀽涓婄嚎鏁版嵁鎴愬姛锛屽苟闇�瑕佸悜Rtu鍥炲啓鏁版嵁 diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/OnLineHandle.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/OnLineHandle.java index 825588f..a3c306b 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/OnLineHandle.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/OnLineHandle.java @@ -6,13 +6,13 @@ public class OnLineHandle { /** - * 瑙f瀽涓婄嚎鏁版嵁锛屽緱鍒癐MEI鍙� + * 瑙f瀽涓婄嚎鏁版嵁锛屽緱鍒癛tuAddr * @param bs 瀛楄妭鏁扮粍 * @return OnLine.OnLineResult */ public OnLine.OnLineResult parse(byte[] bs)throws Exception{ OnLine.OnLineResult rs = null ; - HashMap<String, AnnotationOnLineVo> onLineMap = ProtocolCach.getOnLineMap() ; + HashMap<String, AnnotationOnLineVo> onLineMap = ProtocolCache.getOnLineMap() ; Collection<AnnotationOnLineVo> set = onLineMap.values() ; if(set.size() == 0){ throw new Exception("澶勭悊涓婄嚎鏃讹紝寰楀埌鐨勫崗璁泦鍚堜负绌恒��") ; @@ -47,7 +47,7 @@ } } if(rs == null){ - throw new Exception("澶勭悊涓婄嚎鏃跺嚭閿欙紝鏈兘鎴愬姛鍒嗘瀽鍑篒MEI鍙凤紒") ; + throw new Exception("澶勭悊涓婄嚎鏃跺嚭閿欙紝鏈兘鎴愬姛鍒嗘瀽鍑篟tu鍦板潃锛�") ; } return rs ; } diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/PrefixedDataAvailableHandleImp.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/PrefixedDataAvailableHandleImp.java index 56d32fc..30864ee 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/PrefixedDataAvailableHandleImp.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/PrefixedDataAvailableHandleImp.java @@ -30,18 +30,18 @@ try{ PrefixedDataAvailableStatus pds = null ; - HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCach.getPrefixedDataAvailableMap() ; + HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCache.getPrefixedDataAvailableMap() ; Collection<AnnotationPrefixedDataAvailableVo> set = prefixedDataAvailableMap.values() ; if(set.size() == 0){ throw new Exception("涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ユ椂锛屽緱鍒扮殑鍗忚瀹屾暣鎬ф鏌ョ被闆嗗悎涓虹┖銆�") ; } - int prority = ProtocolConstant.firstPriority ; + int priority = ProtocolConstant.firstPriority ; while(true){ - Object[] objs = this.getClassObjAndAnnotationVo(prority, set) ; + Object[] objs = this.getClassObjAndAnnotationVo(priority, set) ; PrefixedDataAvailable pda = (PrefixedDataAvailable)objs[0] ; - if(pda == null && prority == ProtocolConstant.firstPriority){ - throw new Exception("涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ユ椂锛屾湭寰楀埌浼樺厛绾т负" + prority + "涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ョ被锛�") ; + if(pda == null && priority == ProtocolConstant.firstPriority){ + throw new Exception("涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ユ椂锛屾湭寰楀埌浼樺厛绾т负" + priority + "涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ョ被锛�") ; }else if(pda == null){ //璇存槑涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ョ被闆嗗悎宸茬粡閬嶅巻瀹屼簡銆� break ; @@ -53,7 +53,7 @@ if(pds == null){ //璇存槑涓嶆槸瀵瑰簲鐨勫崗璁暟鎹紝闇�瑕佸彟澶栫殑鍗忚鏉ュ鐞嗕笂绾� //寰幆缁х画 - prority++ ; + priority++ ; }else{ //鍋滄寰幆锛岃繑鍥炵粨鏋� break ; @@ -90,7 +90,7 @@ try{ PrefixedDataAvailableStatus pds = null ; - HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCach.getPrefixedDataAvailableMap() ; + HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCache.getPrefixedDataAvailableMap() ; Collection<AnnotationPrefixedDataAvailableVo> set = prefixedDataAvailableMap.values() ; if(set.size() == 0){ throw new Exception("涓婄嚎鏁版嵁瀹屾暣鎬ф鏌ユ椂锛屽緱鍒扮殑鍗忚闆嗗悎涓虹┖銆�") ; diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolCach.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolCache.java similarity index 98% rename from pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolCach.java rename to pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolCache.java index 58dddb1..a8815d9 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolCach.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolCache.java @@ -5,7 +5,7 @@ import java.util.List; import java.util.Map; -public class ProtocolCach { +public class ProtocolCache { //鏈郴缁熶腑锛孌river鍦ㄥ崟绾跨▼涓繍琛岋紝鎵�浠ュ彧鐢ㄤ竴涓疄渚� private static final HashMap<String, Driver> drivers = new HashMap<>() ; @@ -79,6 +79,7 @@ return onLineMap; } + /* public static void main(String[] args){ HashMap<String, Integer> mp = new HashMap<>() ; mp.put("a1", 1) ; @@ -86,4 +87,5 @@ List<String> list = new ArrayList<>(mp.keySet()) ; System.out.println(list); } + */ } diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolUnit.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolUnit.java index 71dea2a..0e280fb 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolUnit.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/ProtocolUnit.java @@ -44,7 +44,7 @@ AnnotationScan.getIntance() ; //鍚勪釜鍗忚椹卞姩绫绘壂鎻忚嚜宸辩殑鍔熻兘鐮佹敞瑙� - HashMap<String, AnnotationDriverVo> drivers = ProtocolCach.getDriverMap() ; + HashMap<String, AnnotationDriverVo> drivers = ProtocolCache.getDriverMap() ; Collection<String> colDrivers = drivers.keySet() ; StringBuilder totalProtocols = new StringBuilder() ; for(String protocolName : colDrivers){ @@ -52,7 +52,7 @@ totalProtocols.append("锛�") ; } totalProtocols.append(protocolName) ; - Driver dri = ProtocolCach.getDriver(protocolName) ; + Driver dri = ProtocolCache.getDriver(protocolName) ; if(dri != null){ dri.scanAnnotationCode(); } @@ -70,7 +70,7 @@ */ @SuppressWarnings("unused") public boolean isOnlyOneProtocol(){ - HashMap<String, AnnotationDriverVo> drivers = ProtocolCach.getDriverMap() ; + HashMap<String, AnnotationDriverVo> drivers = ProtocolCache.getDriverMap() ; return drivers.size() == 1 ; } diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206/ProtocolConstantV206.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206/ProtocolConstantV206.java deleted file mode 100644 index ba9afef..0000000 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206/ProtocolConstantV206.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.dy.common.mw.protocol.p206; - -public class ProtocolConstantV206 { -} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CodeV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CodeV1_0_1.java new file mode 100644 index 0000000..faa8770 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CodeV1_0_1.java @@ -0,0 +1,33 @@ +package com.dy.common.mw.protocol.p206V1_0_0; + +public class CodeV1_0_1 { + //鍔熻兘鐮佷负瀛楃涓诧紝鍗佸叚杩涘埗鏁版嵁 + public static final String cd_02 = "02" ;//閬ユ祴绔欓摼璺娴� + public static final String cd_C0 = "C0" ;//閬ユ祴绔欒嚜鎶ュ疄鏃舵暟鎹� + public static final String cd_83 = "83" ;//閬ユ祴绔欏紑鍏抽榾鑷姤 + public static final String cd_84 = "84" ;//寮�闃�宸ヤ綔鎶� + public static final String cd_71 = "71" ;//鏌ヨ闃�闂ㄧ姸鎬� + + public static String getCodeName(String code) { + String name = (code.equals(cd_02) ? "閾捐矾妫�娴�" : + (code.equals(cd_C0) ? "鑷姤瀹炴椂鏁版嵁" : + (code.equals(cd_83) ? "寮�鍏抽榾鑷姤" : + (code.equals(cd_84) ? "寮�闃�宸ヤ綔鎶�" : + (code.equals(cd_71) ? "鏌ヨ闃�闂ㄧ姸鎬�" : + ""))))) ; + return name ; + } + + /** + * 鏄惁涓烘湁鏁堝姛鑳界爜 + * @param code 鍔熻兘鐮� + * @return 鏈夋晥true锛屾棤鏁坒alse + */ + public static boolean isValid(String code){ + String name = getCodeName(code) ; + if(name != null && !name.equals("")){ + return true ; + } + return false ; + } +} 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 new file mode 100644 index 0000000..9ab7b11 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/CommonV1_0_1.java @@ -0,0 +1,176 @@ +package com.dy.common.mw.protocol.p206V1_0_0; + +import com.dy.common.util.ByteUtil; +import com.dy.common.util.ByteUtilUnsigned; + + +public class CommonV1_0_1 { + /** + * 妫�鏌ュご + * @param bs 涓婅瀛楄妭鏁扮粍 + * @return true鏄�,false鍚� + * @throws Exception 寮傚父 + */ + public Boolean isThisProtocolHead(byte[] bs) throws Exception{ + if(bs == null){ + return null ; + }else if(bs.length >= (ProtocolConstantV206V1_0_0.ctrlIndex - 1) + && bs[0] == ProtocolConstantV206V1_0_0.P_Head_Byte + && bs[2] == ProtocolConstantV206V1_0_0.P_Head_Byte){ + //String vs = this.parseVersion(bs) ; + //return vs.equals(ProtocolConstantV206V1_0_0.version); + return true ; + }else{ + return false ; + } + } + + /** + * 妫�鏌ュご + * @param bs 涓婅瀛楄妭鏁扮粍 + * @throws Exception 寮傚父 + */ + public void checkHead(byte[] bs) throws Exception{ + if(bs.length < 13 || bs[0] != ProtocolConstantV206V1_0_0.P_Head_Byte || bs[2] != ProtocolConstantV206V1_0_0.P_Head_Byte){ + throw new Exception("涓婅鏁版嵁甯уご涓嶆纭紒") ; + } + } + + /** + * 妫�鏌ュ熬 + * @param bs 涓婅瀛楄妭鏁扮粍 + * @throws Exception 寮傚父 + */ + public void checkTail(byte[] bs) throws Exception{ + if(bs.length < 1 || bs[bs.length - 1] != ProtocolConstantV206V1_0_0.P_Tail_Byte){ + throw new Exception("涓婅鏁版嵁灏句笉姝g‘锛�") ; + } + } + + + /** + * 鍒嗘瀽鏁版嵁瀛楄妭鏁� + * @param bs 涓婅瀛楄妭鏁扮粍 + * @return 鏁版嵁闀垮害 + * @throws Exception 寮傚父 + */ + public int parseDataLen(byte[] bs)throws Exception{ + return ByteUtilUnsigned.bytes2Short_BE(bs, ProtocolConstantV206V1_0_0.dataLenIndex) ; + } + + + /** + * 鍒嗘瀽Rtu鍦板潃 + * @param bs 涓婅瀛楄妭鏁扮粍 + * @return 鎺у埗鍣ㄥ湴鍧� + * @throws Exception 寮傚父 + */ + 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){ + rtuAddrStr = "0" + rtuAddrStr ; + } + return rtuAddrBCD + rtuAddrStr ; + } + + /** + * 鍒嗘瀽鍔熻兘鐮� + * @param bs 涓婅瀛楄妭鏁扮粍 + * @return 鍔熻兘鐮� + */ + public String parseCode(byte[] bs){ + 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 涓婅瀛楄妭鏁扮粍 + * @return 閫氳繃null锛屾湭閫氳繃杩斿洖鍘熷洜 + * @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){ + return null ; + }else{ + return "璁$畻鏍¢獙鍜屾槸:" + hes + "锛屼笂浼犳牎楠屽拰鏄�" + heOrg ; + } + } + + + /* + 鏋勯�犳帶鍒跺煙 + D7 D6 D5锝濪4 D3锝濪0 + 浼犺緭鏂瑰悜浣� DIR 鎷嗗垎鏍囧織浣� DIV 甯ц鏁颁綅 FCB 鍔熻兘鐮� + */ + public byte createCtrl(byte funcCode){ + byte b = 0 ; + b = (byte)(b | funcCode) ; + //FCB == 3 + b = (byte)(b | (byte)60) ; + //DIV = 0 + //DIR = 0 + return b ; + } + + /** + * 寰楀埌鍏冲紑闃�绫诲瀷鍚嶇О + * @param type 瀛楄妭 + * @return 鍚嶇О + */ + public static String openCloseValveType(byte type){ + return switch (type) { + case 1 -> "鍒峰崱寮�闃�"; + case 2 -> "鍒峰崱鍏抽榾"; + case 3 -> "涓績绔欏紑闃�"; + case 4 -> "涓績绔欏叧闃�"; + case 5 -> "娆犺垂鍏抽榾"; + case 6 -> "娴侀噺璁℃晠闅滃叧闃�"; + case 7 -> "绱ф�ュ叧闃�"; + case 8 -> "鐢ㄦ埛杩滅▼寮�闃�"; + case 9 -> "鐢ㄦ埛杩滅▼鍏抽榾"; + default -> "鏈煡"; + }; + } + + /* + * 鍒嗘瀽鐗堟湰鍙� + * @param bs 涓婅瀛楄妭鏁扮粍 + * @return 鐗堟湰鍙� + * @throws Exception 寮傚父 + public String parseVersion(byte[] bs)throws Exception{ + short ver = ByteUtilUnsigned.byte2Byte(bs, ProtocolConstantV206V1_0_0.versionIndex) ; + char[] cs = ("" + ver).toCharArray() ; + StringBuilder vs = new StringBuilder() ; + for(byte i = 0 ; i < cs.length; i++){ + if(i == 0){ + vs.append(cs[i]) ; + }else{ + vs.append(".").append(cs[i]) ; + } + } + return vs.toString() ; + } + */ + +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataAlarmVo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataAlarmVo.java new file mode 100644 index 0000000..3accdc0 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataAlarmVo.java @@ -0,0 +1,28 @@ +package com.dy.common.mw.protocol.p206V1_0_0; + +import lombok.Data; + +@Data +public class DataAlarmVo { + public Byte batteryVolt ;// 钃勭數姹犵數鍘� + public Byte loss ;//婕忔崯 + public Byte meter ;//浠〃 + public Byte valve ;//闃�闂� + + public String toString(){ + StringBuilder str = new StringBuilder() ; + str.append(" 鎶ヨ:\n"); + str.append(" 钃勭數姹犵數鍘嬶細"); + str.append(batteryVolt==null?"":(batteryVolt==1?"鎶ヨ":"姝e父")); + str.append("\n"); + str.append(" 婕忔崯锛�"); + str.append(loss==null?"":(loss==1?"鎶ヨ":"姝e父")); + str.append("\n"); + str.append(" 浠〃锛�"); + str.append(meter==null?"":(meter==1?"鎶ヨ":"姝e父")); + str.append("\n"); + str.append(" 闃�闂細"); + str.append(valve==null?"":(valve==1?"鎶ヨ":"姝e父")); + return str.toString() ; + } +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd02Vo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd02Vo.java new file mode 100644 index 0000000..edd5ccd --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd02Vo.java @@ -0,0 +1,20 @@ +package com.dy.common.mw.protocol.p206V1_0_0; + +import lombok.Data; + +//閾捐矾妫�娴� +@Data +public class DataCd02Vo { + + public String status ;//F0 鐧诲綍锛孎1 閫�鍑虹櫥褰曪紝F2 鍦ㄧ嚎淇濇寔 + + public String toString(){ + StringBuffer sb = new StringBuffer() ; + sb.append(" 閾捐矾妫�娴� : \n") ; + sb.append(" 璇锋眰鐘舵�� : ") ; + sb.append(status == null?"":(status.equals("F0")?"鐧诲綍":(status.equals("F1")?"閫�鍑虹櫥褰�":(status.equals("F2")?"鍦ㄧ嚎淇濇寔":status)))) ; + sb.append("\n") ; + return sb.toString() ; + } + +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd71Vo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd71Vo.java new file mode 100644 index 0000000..405a121 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd71Vo.java @@ -0,0 +1,21 @@ +package com.dy.common.mw.protocol.p206V1_0_0; + +import lombok.Data; + +@Data +public class DataCd71Vo { + + public Byte state ;//闃�闂ㄧ姸鎬佺爜锛�0锛氶榾闂ㄥ叧闂姸鎬侊紱1锛氶榾闂ㄦ墦寮�鐘舵�侊級 + public String stateName ; + + public String toString(){ + StringBuilder sb = new StringBuilder() ; + sb.append(" 鏌ヨ璁惧闃�闂ㄧ姸鎬佸簲绛�:\n"); + sb.append(" 闃�闂ㄧ姸鎬侊細"); + sb.append(state==null?"":state); + sb.append(stateName==null?"":("(" + stateName + ")")); + sb.append("\n"); + + return sb.toString() ; + } +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd83CloseVo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd83CloseVo.java new file mode 100644 index 0000000..5d93ebd --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd83CloseVo.java @@ -0,0 +1,61 @@ +package com.dy.common.mw.protocol.p206V1_0_0; + +import lombok.Data; + +@Data +public class DataCd83CloseVo { + // 寮�鍏抽榾绫诲瀷锛� + // 1銆佸埛鍗″紑闃�锛�2鍒峰崱鍏抽榾锛�3銆佷腑蹇冪珯寮�闃�锛�4銆佷腑蹇冪珯鍏抽榾锛�5銆佹瑺璐瑰叧闃�锛� + // 6銆佹祦閲忚鏁呴殰鍏抽榾锛�7銆佺揣鎬ュ叧闃�锛�8銆佺敤鎴疯繙绋嬪紑闃�锛�9銆佺敤鎴疯繙绋嬪叧闃�锛� + public Byte type ; + public Double totalAmount; //绱娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆� + public String clientNum ;//鍐滄埛缂栧彿 + public String icAddr ;//ic鍗″湴鍧� + public Double remainMoney ;//鍓╀綑閲戦锛氱敤鎴蜂綑棰�4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0.00~999999.99锛屽崟浣嶄负鍏� + public String openDt ;//鐢ㄦ按鎴风敤姘村紑濮嬫椂闂达細6瀛楄妭BCD鐮侊紝椤哄簭鏄勾鏈堟棩鏃跺垎绉掞紝鍏朵腑鍏厓骞�=2000+骞淬�� + public String closeDt ;//鐢ㄦ按鎴风敤姘寸粨鏉熸椂闂达細6瀛楄妭BCD鐮侊紝椤哄簭鏄勾鏈堟棩鏃跺垎绉掞紝鍏朵腑鍏厓骞�=2000+骞淬�� + public Double thisAmount ;//鐢ㄦ按鎴锋湰娆$敤姘撮噺锛氱疮璁℃祦閲�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆� + public Double thisMoney ;//鐢ㄦ按鎴锋湰娆℃秷璐归噾棰濓細鐢ㄦ埛浣欓4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0.00~999999.99锛屽崟浣嶄负鍏冦�� + public Integer thisTime ;//鐢ㄦ按鎴锋湰娆$敤姘存椂闀匡細鐢ㄦ按鏃堕暱2瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999锛屽崟浣嶄负鍒嗛挓銆� + public String rtuDt ;//鎺у埗鍣ㄦ椂閽� + + public String toString(){ + StringBuilder sb = new StringBuilder() ; + sb.append(" 缁堢鍏抽榾鑷姤:\n"); + sb.append(" 鍏抽榾绫诲瀷锛�"); + sb.append(CommonV1_0_1.openCloseValveType(type)) ; + sb.append("\n"); + sb.append(" 绱娴侀噺锛�"); + sb.append(totalAmount==null?"":totalAmount); + sb.append("\n"); + sb.append(" 鍐滄埛缂栧彿锛�"); + sb.append(clientNum); + sb.append("\n"); + sb.append(" ic鍗″湴鍧�锛�"); + sb.append(icAddr); + sb.append("\n"); + sb.append(" 鍓╀綑閲戦锛堝厓锛夛細"); + sb.append(remainMoney ==null?"": remainMoney); + sb.append("\n"); + sb.append(" 寮�闃�鏃堕棿锛�"); + sb.append(openDt); + sb.append("\n"); + sb.append(" 鍏抽榾鏃堕棿锛�"); + sb.append(closeDt); + sb.append("\n"); + sb.append(" 鏈鐢ㄦ按閲忥細"); + sb.append(thisAmount==null?"":thisAmount); + sb.append("\n"); + sb.append(" 鏈鑺辫垂閲戦锛堝厓锛夛細"); + sb.append(thisMoney==null?"":thisMoney); + sb.append("\n"); + sb.append(" 鏈鐢ㄦ按鏃堕暱锛堝垎閽燂級锛�"); + sb.append(thisTime==null?"":thisTime); + sb.append("\n"); + sb.append(" 鎺у埗鍣ㄦ椂閽燂細"); + sb.append(rtuDt==null?"":rtuDt); + sb.append("\n"); + + return sb.toString() ; + } +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd83OpenVo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd83OpenVo.java new file mode 100644 index 0000000..6b8da04 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd83OpenVo.java @@ -0,0 +1,46 @@ +package com.dy.common.mw.protocol.p206V1_0_0; + + +import lombok.Data; + +@Data +public class DataCd83OpenVo { + // 寮�鍏抽榾绫诲瀷锛� + // 1銆佸埛鍗″紑闃�锛�2鍒峰崱鍏抽榾锛�3銆佷腑蹇冪珯寮�闃�锛�4銆佷腑蹇冪珯鍏抽榾锛�5銆佹瑺璐瑰叧闃�锛� + // 6銆佹祦閲忚鏁呴殰鍏抽榾锛�7銆佺揣鎬ュ叧闃�锛�8銆佺敤鎴疯繙绋嬪紑闃�锛�9銆佺敤鎴疯繙绋嬪叧闃�锛� + public Byte type ; + public Double totalAmount; //绱娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆� + public String clientNum ;//鍐滄埛缂栧彿 + public String icAddr ;//ic鍗″湴鍧� + public Double remainMoney;//鍓╀綑閲戦锛氱敤鎴蜂綑棰�4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0.00~999999.99锛屽崟浣嶄负鍏� + public String openDt ;//鐢ㄦ按鎴峰紑闃�鏃堕棿锛�6瀛楄妭BCD鐮侊紝椤哄簭鏄勾鏈堟棩鏃跺垎绉掞紝鍏朵腑鍏厓骞�=2000+骞淬�� + public String rtuDt ;//鎺у埗鍣ㄦ椂閽� + + public String toString(){ + StringBuilder sb = new StringBuilder() ; + sb.append(" 缁堢寮�闃�鑷姤:\n"); + sb.append(" 寮�闃�绫诲瀷锛�"); + sb.append(CommonV1_0_1.openCloseValveType(type)) ; + sb.append("\n"); + sb.append(" 绱娴侀噺锛�"); + sb.append(totalAmount==null?"":totalAmount); + sb.append("\n"); + sb.append(" 鍐滄埛缂栧彿锛�"); + sb.append(clientNum); + sb.append("\n"); + sb.append(" ic鍗″湴鍧�锛�"); + sb.append(icAddr); + sb.append("\n"); + sb.append(" 鍓╀綑閲戦锛堝厓锛夛細"); + sb.append(remainMoney ==null?"": remainMoney); + sb.append("\n"); + sb.append(" 寮�闃�鏃堕棿锛�"); + sb.append(openDt); + sb.append("\n"); + sb.append(" 鎺у埗鍣ㄦ椂閽燂細"); + sb.append(rtuDt==null?"":rtuDt); + sb.append("\n"); + + return sb.toString() ; + } +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd84Vo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd84Vo.java new file mode 100644 index 0000000..789350f --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCd84Vo.java @@ -0,0 +1,33 @@ +package com.dy.common.mw.protocol.p206V1_0_0; + +import lombok.Data; + +@Data +public class DataCd84Vo { + public String clientNum ;//鍐滄埛缂栧彿 + public Double remainMoney ;//鍓╀綑閲戦锛氱敤鎴蜂綑棰�4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0.00~999999.99锛屽崟浣嶄负鍏� + public Double totalAmount; //绱娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆� + public Double instantAmount; //鐬椂娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999.999锛屽崟浣嶄负m3/h銆� + public String rtuDt ;//鎺у埗鍣ㄦ椂閽� + + public String toString(){ + StringBuilder sb = new StringBuilder() ; + sb.append(" 缁堢寮�闃�宸ヤ綔鎶�:\n"); + sb.append(" 鍐滄埛缂栧彿锛�"); + sb.append(clientNum); + sb.append("\n"); + sb.append(" 鍓╀綑閲戦锛堝厓锛夛細"); + sb.append(remainMoney==null?"":remainMoney); + sb.append("\n"); + sb.append(" 绱娴侀噺锛�"); + sb.append(totalAmount==null?"":totalAmount); + sb.append("\n"); + sb.append(" 鐬椂娴侀噺锛�"); + sb.append(instantAmount==null?"":instantAmount); + sb.append("\n"); + sb.append(" 鎺у埗鍣ㄦ椂閽燂細"); + sb.append(rtuDt==null?"":rtuDt); + sb.append("\n"); + return sb.toString() ; + } +} 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 new file mode 100644 index 0000000..997792e --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataCdC0Vo.java @@ -0,0 +1,52 @@ +package com.dy.common.mw.protocol.p206V1_0_0; + +import lombok.Data; + +@Data +public class DataCdC0Vo { + public Double instantAmount; //鐬椂娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999.999锛屽崟浣嶄负m3/h銆� + public Double totalAmount; //绱娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆� + public Double lossAmount; //鎹熷け娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆� + public Double waterPress; //姘村帇锛�4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~999999.99锛屽崟浣嶄负KPa銆� + public Double batteryVolt;//钃勭數姹犵數鍘�:4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~99.99锛屽崟浣嶄负V銆� + public Double sunVolt ;//澶槼鑳界數鍘�:4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~99.99锛屽崟浣嶄负V銆� + public Integer signal; //淇″彿寮哄害锛�1瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~99銆� + public String rtuDt ;//鎺у埗鍣ㄦ椂閽� + public DataAlarmVo alarmVo ;//鎶ヨ + public DataStateVo stateVo ;//鐘舵�� + public String toString(){ + StringBuilder sb = new StringBuilder() ; + sb.append(" 缁堢鑷姤瀹炴椂鏁版嵁:\n"); + sb.append(" 鐬椂娴侀噺锛�"); + sb.append(instantAmount==null?"":instantAmount); + sb.append("\n"); + sb.append(" 绱娴侀噺锛�"); + sb.append(totalAmount==null?"":totalAmount); + sb.append("\n"); + sb.append(" 鎹熷け娴侀噺锛�"); + sb.append(lossAmount==null?"":lossAmount); + sb.append("\n"); + sb.append(" 姘村帇锛�"); + sb.append(waterPress==null?"":waterPress); + sb.append("\n"); + sb.append(" 钃勭數姹犵數鍘嬶細"); + sb.append(batteryVolt==null?"":batteryVolt); + sb.append("\n"); + sb.append(" 澶槼鑳界數鍘嬶細"); + sb.append(sunVolt==null?"":sunVolt); + sb.append("\n"); + sb.append(" 淇″彿寮哄害锛�"); + sb.append(signal==null?"":signal); + sb.append("\n"); + 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"); + + return sb.toString() ; + } + +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataStateVo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataStateVo.java new file mode 100644 index 0000000..08bfef9 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataStateVo.java @@ -0,0 +1,24 @@ +package com.dy.common.mw.protocol.p206V1_0_0; + +import lombok.Data; + +@Data +public class DataStateVo { + public Byte idCard ;// 钃勭數姹犵數鍘� + public Byte work;//宸ヤ綔鐘舵�� + public Byte valve ;//闃�闂� + + public String toString(){ + StringBuilder str = new StringBuilder() ; + str.append(" 鐘舵��:\n"); + str.append(" IC 鍗″姛鑳斤細"); + str.append(idCard==null?"":(idCard==1?"鏈夋晥":"鏃犳晥")); + str.append("\n"); + str.append(" 宸ヤ綔鐘舵�侊細"); + str.append(work ==null?"":(work==1?"鍚姩":"鍋滄")); + str.append("\n"); + str.append(" 闃�闂細"); + str.append(valve==null?"":(valve==1?"鎵撳紑":"鍏抽棴")); + return str.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 new file mode 100644 index 0000000..78675d2 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DataV1_0_1.java @@ -0,0 +1,30 @@ +package com.dy.common.mw.protocol.p206V1_0_0; + +import lombok.Data; + +@Data +public class DataV1_0_1 implements java.io.Serializable{ + + private static final long serialVersionUID = 202211271110001L; + + public String rtuAddr ;//RtuAddr + + public DataCd02Vo dataCd02Vo;//閾捐矾妫�娴� + public DataCdC0Vo dataCdC0Vo;//缁堢鑷姤瀹炴椂鏁版嵁 + public DataCd83OpenVo dataCd83OpenVo;//寮�闃�鑷姤 + public DataCd83CloseVo dataCd83CloseVo;//鍏抽榾鑷姤 + public DataCd84Vo dataCd84Vo;//寮�闃�宸ヤ綔鎶� + public DataCd71Vo dataCd71Vo;//鏌ヨ闃�闂ㄧ姸鎬� + + public String dt ;//閫氫俊涓棿浠朵骇鐢熷彂鎶ユ椂闂�(yyyy-MM-dd hh:mm:ss) + + public String toString(){ + StringBuffer sb = new StringBuffer() ; + sb.append(" 鎺у埗鍣ㄥ湴鍧� : " + (rtuAddr==null?"":rtuAddr) + "\n") ; + sb.append(" 缁堢鏁版嵁:\n") ; + if(dataCd02Vo != null){ + sb.append(dataCd02Vo.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 new file mode 100644 index 0000000..6ddc78e --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/DriverV1_0_1.java @@ -0,0 +1,149 @@ +package com.dy.common.mw.protocol.p206V1_0_0; + +import com.dy.common.mw.protocol.*; +import com.dy.common.util.DateTime; + +import java.net.URI; +import java.net.URL; + +@AnnotationDriver(name= ProtocolConstantV206V1_0_0.protocolName) +public class DriverV1_0_1 extends Driver { + + private static String scanRootPackage = "" ; + + //鍦―river涓槸鍗曚緥锛岄殢Driver鐨勫崟渚嬪璞″湪鍗曠嚎绋嬩腑杩愯 + private ParseParamsForUpV1_0_1 upCpParams ; + private ParseParamsForDownV1_0_1 downCpParams ; + + private Boolean reportOrResponse_trueOrFalse = null ; + private String rtuAddrInData = null ; + + public DriverV1_0_1(){ + upCpParams = new ParseParamsForUpV1_0_1() ; + downCpParams = new ParseParamsForDownV1_0_1() ; + } + + + /** + * 鎵弿璇嗗埆鍔熻兘鐮佹敞瑙g被 + */ + @Override + public void scanAnnotationCode() throws Exception{ + if(!scanRootPackage.endsWith(".")){ + scanRootPackage += "." ; + } + URL url = this.getClass().getResource("/" + scanRootPackage.replace('.', '/')); + URI uri = new URI(url.toString()); + super.doScanAnnotationCode(this, ProtocolConstantV206V1_0_0.protocolName, uri, scanRootPackage) ; + } + + /** + * 瑙f瀽涓婅鏁版嵁 + * @param isLowPower 鏄惁鍦ㄤ綆鍔熻�楃幆澧冧笅杩愯 + * @param rtuAddr + * @param upBuffer + * @param callback + * @param upHex + * @return + */ + @Override + public MidResult[] parseData(Boolean isLowPower, String rtuAddr, byte[] upBuffer, String upHex, DriverParserDataCallback callback, Object... params) { + reportOrResponse_trueOrFalse = null ; + boolean isFail = false ; + String upCode = null ; + try{ + CommonV1_0_1 cp = new CommonV1_0_1() ; + cp.checkHead(upBuffer) ; + cp.checkTail(upBuffer) ; + String crcStr = cp.checkCrc_str(upBuffer) ; + if(crcStr != null){ + return new MidResult[]{(new MidResultError(ProtocolConstantV206V1_0_0.protocolName, rtuAddr, "涓ラ噸閿欒锛屼笂琛屾暟鎹瓹RC妫�鏌ュけ璐ワ紝" + crcStr, null))} ; + } + rtuAddr = cp.parseRtuAddr(upBuffer) ; + upCode = cp.parseCode(upBuffer) ; + if(upCode == null){ + return new MidResult[]{(new MidResultError(ProtocolConstantV206V1_0_0.protocolName, rtuAddr, "涓ラ噸閿欒锛屾湭鑳戒粠涓婅鏁版嵁涓В鏋愬嚭鍔熻兘鐮侊紒", null))} ; + } + //Integer dataLen = cp.parseFrameLen(upBuffer) ; + Data upData = new Data() ; + upData.setRtuAddr(rtuAddr) ; + upData.setProtocol(ProtocolConstantV206V1_0_0.protocolName); + upData.setCode(upCode) ; + upData.setHex(upHex) ; + + + DataV1_0_1 dV1_0_1 = new DataV1_0_1() ; + //dV1_0_1.version = cp.parseVersion(upBuffer) ; + dV1_0_1.rtuAddr = rtuAddr ; + dV1_0_1.dt = DateTime.yyyy_MM_dd_HH_mm_ss() ; + + upData.setSubData(dV1_0_1) ; + + this.upCpParams.clear(); + this.upCpParams.setValue(ProtocolConstantV206V1_0_0.protocolName, + rtuAddr, + upCode, + upHex, + upBuffer, + upData); + CodeParse codeParse = this.getUpCodeParser(upCode) ; + if(codeParse == null){ + return new MidResult[]{(new MidResultError(ProtocolConstantV206V1_0_0.protocolName, rtuAddr, "涓ラ噸閿欒锛屾湭鑳藉緱鍒颁笂琛屾暟鎹姛鑳界爜" + upCode + "澶勭悊绫�!", null))} ; + }else{ + return codeParse.parse(isLowPower, this.upCpParams, new CodeParseCallback(){ + @Override + public void callback(Boolean flag) { + reportOrResponse_trueOrFalse = flag ; + rtuAddrInData = dV1_0_1.getRtuAddr() ; + } + }); + } + + } catch (Exception e) { + isFail = true ; + return new MidResult[]{(new MidResultError(ProtocolConstantV206V1_0_0.protocolName, rtuAddr, "涓ラ噸閿欒锛屽垎鏋怰tu鏁版嵁鍑洪敊锛佹暟鎹负锛�" + upHex + (e.getMessage() == null?"":("锛屽嚭閿欎俊鎭細" + e.getMessage())), e))} ; + } finally{ + callback.callback(rtuAddr, upCode, upHex, reportOrResponse_trueOrFalse, isFail, rtuAddrInData); + } + } + /** + * 鏋勯�犱笅琛屾暟鎹紙鍛戒护锛� + * @param isLowPower 鏄惁鍦ㄤ綆鍔熻�楃幆澧冧笅杩愯 + * @param command 鍛戒护 + * @return + */ + @Override + public MidResult[] createCommand(Boolean isLowPower, Command command, Object... params) { + String rtuAddr = command.getRtuAddr() ; + if(rtuAddr == null){ + return new MidResult[]{(new MidResultError(ProtocolConstantV206V1_0_0.protocolName, null, "涓ラ噸閿欒锛屽懡浠や腑Rtu鍦板潃涓虹┖锛屼笉鑳芥瀯寤轰换浣曞懡浠わ紒", null))} ; + } + try { + String commandCode = command.getCode() ; + + this.downCpParams.clear(); + this.downCpParams.setValue( + ProtocolConstantV206V1_0_0.protocolName, + rtuAddr, + command.getId(), + commandCode, + command.getParam(), + command.getAttachment()); + + if(commandCode == null){ + return new MidResult[]{(new MidResultError(ProtocolConstantV206V1_0_0.protocolName, rtuAddr, "涓ラ噸閿欒锛屽懡浠や腑鍔熻兘鐮佷负绌猴紝涓嶈兘鏋勫缓浠讳綍鍛戒护锛�", null))} ; + }else{ + CodeParse codeParse = this.getDownCodeParser(commandCode) ; + if(codeParse == null){ + return new MidResult[]{(new MidResultError(ProtocolConstantV206V1_0_0.protocolName, rtuAddr, "涓ラ噸閿欒锛屾湭鑳藉緱鍒颁笅琛屾暟鎹姛鑳界爜" + commandCode + "澶勭悊绫�!", null))} ; + }else{ + return codeParse.parse(isLowPower, this.downCpParams, null); + } + } + } catch (Exception e) { + return new MidResult[]{(new MidResultError(ProtocolConstantV206V1_0_0.protocolName, rtuAddr, "涓ラ噸閿欒锛屾瀯閫犱笅琛屾暟鎹嚭閿欙紒鍛戒护涓猴細" + command.toString(), e))} ; + } + } + + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/OnLineV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/OnLineV1_0_1.java similarity index 73% rename from pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/OnLineV1_0_1.java rename to pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/OnLineV1_0_1.java index 2e56566..69d63a1 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/OnLineV1_0_1.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/OnLineV1_0_1.java @@ -1,11 +1,12 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1; +package com.dy.common.mw.protocol.p206V1_0_0; import com.dy.common.mw.protocol.AnnotationOnLine; import com.dy.common.mw.protocol.OnLine; @AnnotationOnLine( - protocolName = ProtocolConstantV1_0_1.protocolName, - priority = ProtocolConstantV1_0_1.priority) + protocolName = ProtocolConstantV206V1_0_0.protocolName, + priority = ProtocolConstantV206V1_0_0.priority) +@SuppressWarnings("unused") public class OnLineV1_0_1 implements OnLine{ /** @@ -22,18 +23,15 @@ //鍑洪敊 olr.result = OnLine.OnLineAction_fail ; olr.rtuAddr = null ; - olr.meterNo = null ; }else if(!flag.booleanValue()){ //涓嶆槸鏈崗璁暟鎹� olr.result = OnLine.OnLineAction_success_noMe ; olr.rtuAddr = null ; - olr.meterNo = null ; }else{ //鏄湰鍗忚鏁版嵁 olr.result = OnLine.OnLineAction_success ; olr.rtuAddr = cp.parseRtuAddr(upBuf) ; - olr.meterNo = cp.parseMeterNo(upBuf) ; - olr.protocolName = ProtocolConstantV1_0_1.protocolName ; + olr.protocolName = ProtocolConstantV206V1_0_0.protocolName ; } return olr; } diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ParseParamsForDownV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ParseParamsForDownV1_0_1.java new file mode 100644 index 0000000..a0f2caa --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ParseParamsForDownV1_0_1.java @@ -0,0 +1,40 @@ +package com.dy.common.mw.protocol.p206V1_0_0; + +import com.dy.common.mw.protocol.CodeParseParams; + +public class ParseParamsForDownV1_0_1 implements CodeParseParams{ + + public String protocolName ; + public String rtuAddr ;//鎺у埗鍣ㄥ湴鍧� + public String commandId ; + public String commandCode ; + public Object param ; + public Object attachment ; + + public ParseParamsForDownV1_0_1(){} + + public void clear(){ + this.protocolName = null ; + this.rtuAddr = null ; + this.commandId = null ; + this.commandCode = null ; + this.param = null ; + this.attachment = null ; + } + + public void setValue( + String protocolName, + String rtuAddr, + String commandId, + String commandCode, + Object param, + Object attachment ){ + this.protocolName = protocolName ; + this.rtuAddr = rtuAddr ; + this.commandId = commandId ; + this.commandCode = commandCode ; + this.param = param ; + this.attachment = attachment ; + } + +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ParseParamsForUpV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ParseParamsForUpV1_0_1.java new file mode 100644 index 0000000..58d58c9 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ParseParamsForUpV1_0_1.java @@ -0,0 +1,39 @@ +package com.dy.common.mw.protocol.p206V1_0_0; + +import com.dy.common.mw.protocol.CodeParseParams; +import com.dy.common.mw.protocol.Data; + +public class ParseParamsForUpV1_0_1 implements CodeParseParams{ + + public String protocolName ;//鍗忚鍚嶇О + public String rtuAddr ;//鎺у埗鍣ㄥ潃 + public String upCode ;//涓婅鎶ユ枃鏁版嵁涓殑鍔熻兘鐮� + public String upHex ;//琛屾姤鏂囨暟鎹崄鍏繘鍒跺舰寮� + public byte[] upBuffer ;//琛屾姤鏂囨暟鎹瓧鑺傛暟缁� + public Data data ;//瑙f瀽鍚庣殑鏁版嵁 + + public ParseParamsForUpV1_0_1(){} + + public void clear(){ + this.protocolName = null ; + this.rtuAddr = null ; + this.upCode = null ; + this.upHex = null ; + this.upBuffer = null ; + this.data = null ; + } + + public void setValue(String protocolName, + String rtuAddr, + String upCode, + String upHex, + byte[] upBuffer, + Data data){ + this.protocolName = protocolName ; + this.rtuAddr = rtuAddr ; + this.upCode = upCode ; + this.upHex = upHex ; + this.upBuffer = upBuffer ; + this.data = data ; + } +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/PrefixedDataAvailableV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/PrefixedDataAvailableV1_0_1.java similarity index 75% rename from pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/PrefixedDataAvailableV1_0_1.java rename to pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/PrefixedDataAvailableV1_0_1.java index 63ec806..e53f268 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/PrefixedDataAvailableV1_0_1.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/PrefixedDataAvailableV1_0_1.java @@ -1,36 +1,36 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.apache.mina.core.buffer.BufferDataException; -import org.apache.mina.core.buffer.IoBuffer; +package com.dy.common.mw.protocol.p206V1_0_0; import com.dy.common.mw.channel.tcp.PrefixedDataAvailableStatus; import com.dy.common.mw.protocol.AnnotationPrefixedDataAvailable; import com.dy.common.mw.protocol.PrefixedDataAvailable; import com.dy.common.util.ByteUtil; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.mina.core.buffer.BufferDataException; +import org.apache.mina.core.buffer.IoBuffer; @AnnotationPrefixedDataAvailable( - protocolName = ProtocolConstantV1_0_1.protocolName, - priority = ProtocolConstantV1_0_1.priority, - onLineDataMinLength = ProtocolConstantV1_0_1.onLineDataMinLength, - headMinLength = ProtocolConstantV1_0_1.headMinLength) -public class PrefixedDataAvailableV1_0_1 implements PrefixedDataAvailable { + protocolName = ProtocolConstantV206V1_0_0.protocolName, + priority = ProtocolConstantV206V1_0_0.priority, + onLineDataMinLength = ProtocolConstantV206V1_0_0.onLineDataMinLength, + headMinLength = ProtocolConstantV206V1_0_0.headMinLength) +@SuppressWarnings("unused") +public class PrefixedDataAvailableV1_0_1 implements PrefixedDataAvailable { - private static Logger log = LogManager.getLogger(PrefixedDataAvailableV1_0_1.class) ; + private static final Logger log = LogManager.getLogger(PrefixedDataAvailableV1_0_1.class) ; - private static String protocolName = ProtocolConstantV1_0_1.protocolName ; + private static final String protocolName = ProtocolConstantV206V1_0_0.protocolName ; /** * 鍒嗘瀽涓婄嚎鏁版嵁(缃戠粶杩炴帴鍚庣涓�鍖呮暟鎹�)鏄惁鍙幏寰� - * @param in + * @param in IoBuffer * @param remain 涓�瀹氭椂澶т簬0鐨勬暟鎹� * @param minDataLength 鏈�灏忔暟鎹暱搴� * @param maxDataLength 鏈�澶ф暟鎹暱搴︼紝杈惧埌鎴栬秴杩囨闀垮害锛岃涓烘槸鍨冨溇鏁版嵁銆備緥濡傦細鏁版嵁澶撮儴鏄纭殑锛屼絾鍚堟硶鏁版嵁缁撳熬鎬讳笉鍑虹幇锛岃涓烘鏁版嵁鍨冨溇鏁版嵁 * @return 涓嶆槸鏈崗璁暟鎹椂杩斿洖绌� - * @throws Exception + * @throws Exception 寮傚父 */ public PrefixedDataAvailableStatus forOnLine(IoBuffer in, int remain, @@ -49,11 +49,12 @@ /** * 鍒嗘瀽涓婄嚎鍚�(缃戠粶杩炴帴鍚庨潪绗竴鍖呮暟鎹�)鏄惁鍙幏寰� - * @param in - * @param protocolConf Rtu閰嶇疆 - * @param maxDataLength - * @return - * @throws Exception + * @param in IoBuffer + * @param remain 鍓╀綑 + * @param minDataLength 鏈�灏忔暟鎹暱搴� + * @param maxDataLength 鏈�澶ф暟鎹暱搴� + * @return PrefixedDataAvailableStatus + * @throws Exception 寮傚父 */ @Override public PrefixedDataAvailableStatus forUpData(IoBuffer in, @@ -71,9 +72,11 @@ } /** * 杩涜鍒ゆ柇 - * @param preByte - * @param maxDataLength - * @return + * @param preByte byte[] + * @param minDataLength 鏈�灏忔暟鎹暱搴� + * @param maxDataLength 鏈�澶ф暟鎹暱搴� + * @return PrefixedDataAvailableStatus + * @throws Exception 寮傚父 */ private PrefixedDataAvailableStatus doForData(byte[] preByte, int minDataLength, int maxDataLength) throws Exception{ int remain = preByte.length ; @@ -98,14 +101,14 @@ } Integer dataLen = parseCommon.parseDataLen(preByte) ; - - String headHex = ByteUtil.bytes2Hex(preByte, true) ; - + if(dataLen == null){ + String headHex = ByteUtil.bytes2Hex(preByte, true) ; throw new BufferDataException("鏀跺埌鏁版嵁涔嬪抚鍓嶉儴锛�" + headHex + "锛屼絾涓ラ噸閿欒锛屽湪杩涜鏂寘涓庣矘鍖呮鏌ユ椂锛屾湭鑳藉緱鍒版暟鎹抚鐨勯暱搴︺��"); } if (dataLen <= 0 || dataLen > maxDataLength) { + String headHex = ByteUtil.bytes2Hex(preByte, true) ; throw new BufferDataException("鏀跺埌鏁版嵁涔嬪抚鍓嶉儴锛�" + headHex + "锛屼絾涓ラ噸閿欒锛屽湪杩涜鏂寘涓庣矘鍖呮鏌ユ椂锛屾暟鎹抚鐨勯暱搴�(" + dataLen + ")瓒呭嚭鍚堟硶鑼冨洿銆�"); } @@ -113,10 +116,12 @@ //涓嶆柇涓嶇矘 return new PrefixedDataAvailableStatus().completed(dataLen) ; }else if(remain > dataLen){ + String headHex = ByteUtil.bytes2Hex(preByte, true) ; log.warn("鏀跺埌鏁版嵁涔嬪抚鍓嶉儴锛�" + headHex + "锛屼絾鍙戠敓绮樺寘鐜拌薄銆�") ; return new PrefixedDataAvailableStatus().adjoined(dataLen) ; }else{ // remain < dataLen + String headHex = ByteUtil.bytes2Hex(preByte, true) ; log.warn("鏀跺埌鏁版嵁涔嬪抚鍓嶉儴锛�" + headHex + "锛屼絾鍙戠敓鏂寘鐜拌薄銆�") ; return new PrefixedDataAvailableStatus().breaked() ; } 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 new file mode 100644 index 0000000..e520aee --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/ProtocolConstantV206V1_0_0.java @@ -0,0 +1,52 @@ +package com.dy.common.mw.protocol.p206V1_0_0; + +public class ProtocolConstantV206V1_0_0 { + + public static final String version = "1.0.1" ; + public static final Byte versionByte = 101 ; + + /** + * 娉ㄨВ鐩稿叧 + */ + public static final String protocolName = "p206V1_0_1" ; + public static final int priority = 1 ;//浼樺厛绾� + /** + * RTU涓婄嚎鏁版嵁锛堜笂绾垮悗绗竴鍖呮暟鎹級鏈�灏忛暱搴︼紝璁剧疆璇ュ睘鎬т互澶囪繘琛屽畬鏁存�ф鏌ワ紝 + * 鍗虫柇鍖呮鏌ワ紝浣垮敖鍙兘鏀跺叏涓婄嚎鏁版嵁锛堝彇鍊艰寖鍥�1-100锛� + */ + public static final int onLineDataMinLength = 30 ;//閲囩敤闃�鎺у洖鎵э紙鍏堕暱搴︽渶鐭級鐨勫瓧鑺傛暟 + + /** + * RTU涓婃姤鏁版嵁鐨勫ご閮ㄦ渶灏忛暱搴︼紝涓婃姤鏁版嵁涓紝鍙栬繖涓渶灏忛暱搴︾殑閮ㄥ垎鏁版嵁涓紝 + * 瑕佷竴瀹氬寘鍚暟鎹抚闀垮害锛屼互澶囧彇鍑烘暟鎹抚闀垮害鏉ワ紝杩涜瀹屾暣鎬ф鏌ワ紝 + * 鍗虫柇鍖呬笌绮樺寘妫�鏌�(鍙栧�艰寖鍥�0-100锛屽叾涓彇鍊间负0鏃讹紝琛ㄧずheadMinLength鏁版嵁鏃犱綔鐢紝鐢卞崗璁疄鐜版潵鎺у埗) + */ + public static final int headMinLength = 3 ; + + + //甯ц捣濮� + public static final byte P_Head_Byte = (byte)0x68 ; + public static final byte P_Tail_Byte = (byte)0x16 ; + + public static final byte P_Default_mode = (byte)0x0F ;//榛樿宸ヤ綔妯″紡 + + 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 lenTail = 2 ; //甯у熬閮ㄥ瓧鑺傛暟缁勯暱搴� + /** + * 鎵�鍦ㄥ瓧鑺傛暟缁勭殑浣嶇疆锛堜笅鏍囷級 + */ + public static final int dataLenIndex = 1 ;//甯ч暱搴︽墍鍦� 瀛楄妭鏁扮粍璧峰涓嬫爣 + public static final int ctrlIndex = 3 ;//鎺у埗鍩熸墍鍦� 瀛楄妭鏁扮粍璧峰涓嬫爣 + public static final int rtuAddr1Index_start = 4 ;//鎺у埗鍣ㄥ湴鍧� 瀛楄妭鏁扮粍寮�濮嬩笅鏍� + public static final int rtuAddr1Index_end = 6 ;//鎺у埗鍣ㄥ湴鍧� 瀛楄妭鏁扮粍寮�濮嬩笅鏍� + public static final int rtuAddr2Index_start = 7 ;//鎺у埗鍣ㄥ湴鍧� 瀛楄妭鏁扮粍鎴涓嬫爣 + public static final int rtuAddr2Index_end = 8 ;//鎺у埗鍣ㄥ湴鍧� 瀛楄妭鏁扮粍鎴涓嬫爣 + public static final int codeIndex = 9 ;//鍔熻兘鐮佸瓧鑺傛暟缁勪笅鏍� + public static final int dataIndex = 10 ;//鍏蜂綋鏁版嵁瀛楄妭鏁扮粍涓嬫爣 + + + +} \ No newline at end of file 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 new file mode 100644 index 0000000..5a6cb09 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_02_Down.java @@ -0,0 +1,80 @@ +package com.dy.common.mw.protocol.p206V1_0_0.parse; + +import com.dy.common.mw.protocol.*; +import com.dy.common.mw.protocol.p206V1_0_0.*; +import com.dy.common.mw.protocol.p206V1_0_0.parse.global.GlCreate; +import com.dy.common.util.ByteUtil; + +@AnnotationCodeDown(ifAny={ + CodeV1_0_1.cd_02 +}) +public class Cd_02_Down implements CodeParse { + + //private static Logger log = LogManager.getLogger(Cd_02_Down.class); + + @Override + public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback) throws Exception { + ParseParamsForDownV1_0_1 para = (ParseParamsForDownV1_0_1) params ; + byte[] bs = this.doParse(para) ; + + MidResultToRtu midRs = new MidResultToRtu() ; + midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О + midRs.rtuAddr = para.rtuAddr ;//Rtu鍦板潃锛堢數淇″钩鍙拌澶嘔MEI锛� + midRs.commandId = para.commandId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉 + midRs.downCode = para.commandCode ;//涓嬭鍛戒护鍔熻兘鐮�; + midRs.downBuffer = bs ;//涓嬭鍛戒护鏁版嵁 + midRs.downBufHex = ByteUtil.bytes2Hex(bs, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡 + midRs.hasResponse = false ;//鏄惁鏈夊簲绛� + midRs.maxSendTimes = 1 ;//鍛戒护鏈�澶у彂閫佹鏁�(褰撴敹涓嶅埌搴旂瓟鏃讹紝灏嗛噸鍙�)锛屽鏋滀笉璁剧疆锛屽懡浠ょ紦瀛樺櫒杩涜琛ュ厖璁剧疆 + midRs.isCachForOffLine = false ;//RTU涓嶅湪绾匡紝鍛戒护鏄惁缂撳瓨锛屼綆鍔熻�楁椂涓簍rue + + midRs.isSendFirst = true ;//鍛戒护搴旂瓟锛岄鍏堝彂閫侊紝闃叉RTU閲嶆柊涓婃姤 + if(isLowPower != null && isLowPower.booleanValue()){ + //浣庡姛鑰楁椂锛屽敖蹇彂閫� + midRs.isQuickSend = true ; + } + + return new MidResult[]{midRs} ; + } + /** + * 鏋勯�犱笅琛屾暟鎹� + * @param para 鍙傛暟 + * @return 瀛楄妭鏁扮粍 + * @throws Exception 寮傚父 + */ + public byte[] doParse(ParseParamsForDownV1_0_1 para) 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)0) ; + + index++ ; + GlCreate.createRtuAddr(para.rtuAddr, bsHead, index); + index += 5 ; + + ByteUtil.hex2Bytes(para.commandCode, bsHead, index) ; + + byte[] bs = new byte[7] ; + bs[0] = (byte)0xF2 ;//鏁版嵁鍩燂細 1 涓瓧鑺傦紝F0 鐧诲綍锛� F1 閫�鍑虹櫥褰曪紝F2 鍦ㄧ嚎淇濇寔銆� + GlCreate.createTp(bs, 1); + + bytes = ByteUtil.bytesMerge(bsHead, bs) ; + + GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑 + + bytes = GlCreate.createCrcTail(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓� + + return bytes ; + } + +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_02_Up.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_02_Up.java new file mode 100644 index 0000000..dd96f44 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_02_Up.java @@ -0,0 +1,89 @@ +package com.dy.common.mw.protocol.p206V1_0_0.parse; + + +import com.dy.common.mw.protocol.*; +import com.dy.common.util.ByteUtil; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import com.dy.common.mw.protocol.p206V1_0_0.*; + +@AnnotationCodeUp(ifAny={ + CodeV1_0_1.cd_02 +}) +@SuppressWarnings("unused") +public class Cd_02_Up implements CodeParse{ + + private static final Logger log = LogManager.getLogger(Cd_02_Up.class); + + /** + * 鍒嗘瀽涓婅鏁版嵁 + */ + @Override + public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception { + ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ; + int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ; + if(bsLen > 0){ + this.doParse(para.upBuffer, + bsLen, + para.upCode, + para.data) ; + } + log.info("鍒嗘瀽涓婅鏁版嵁<" + CodeV1_0_1.getCodeName(para.upCode) + " RTU鍦板潃=" + para.rtuAddr + ">:\n" + para.data.toString()); + + MidResultFromRtu midRs = new MidResultFromRtu() ; + midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О + midRs.rtuAddr = para.rtuAddr ;//Rtu鍦板潃 + midRs.upCode = para.upCode ;//涓婅鏁版嵁涓殑鍔熻兘鐮� + midRs.upHex = para.upHex ;//涓婅鏁版嵁鍗佸叚杩涘埗褰㈠紡 + midRs.upBuffer = para.upBuffer ;//涓婅鏁版嵁瀛楄妭鏁扮粍 + midRs.data = para.data ;//瑙f瀽鍚庣殑鏁版嵁 + + midRs.reportOrResponse_trueOrFalse = true ;//涓诲姩涓婃姤 + + String confirmComCode = para.upCode ; + ParseParamsForDownV1_0_1 downCpParams = new ParseParamsForDownV1_0_1() ; + downCpParams.setValue( + ProtocolConstantV206V1_0_0.protocolName, + para.rtuAddr, + Command.defaultId, + confirmComCode, + null, + null); + //鏋勯�犲簲绛� + byte[] data = new Cd_02_Down().doParse(downCpParams) ; + + MidResultToRtu confirmCommand = new MidResultToRtu() ; + confirmCommand.protocolName = para.protocolName ;//鍗忚鍚嶇О + confirmCommand.rtuAddr = para.rtuAddr ;//Rtu鍦板潃 + confirmCommand.commandId = Command.defaultId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉 + confirmCommand.downCode = confirmComCode ;//涓嬭鍛戒护鍔熻兘鐮�; + confirmCommand.downBuffer = data ;//涓嬭鍛戒护鏁版嵁 + confirmCommand.downBufHex = ByteUtil.bytes2Hex(data, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡 + confirmCommand.hasResponse = false ;//鏄惁鏈夊簲绛� + confirmCommand.maxSendTimes = 1 ;//鍛戒护鏈�澶у彂閫佹鏁�(褰撴敹涓嶅埌搴旂瓟鏃讹紝灏嗛噸鍙�2娆�)锛屽鏋滀笉璁剧疆锛屽懡浠ょ紦瀛樺櫒杩涜琛ュ厖璁剧疆 + confirmCommand.isCachForOffLine = false ;//RTU涓嶅湪绾匡紝鍛戒护鏄惁缂撳瓨 + + confirmCommand.isSendFirst = true ;//纭鍛戒护锛屼紭鍏堝彂閫� + if(isLowPower != null && isLowPower.booleanValue()){ + //浣庡姛鑰楁椂锛屽敖蹇彂閫� + confirmCommand.isQuickSend = true ; + } + callback.callback(midRs.reportOrResponse_trueOrFalse); + return new MidResult[]{midRs, confirmCommand} ; + } + /** + * 鎵ц鍒嗘瀽 + * @param bs 瀛楄妭鏁扮粍 + * @param bsLen 瀛楄妭闀垮害锛堟�诲寘闀匡紝鍖呮嫭鍖呭ご鍜屽寘灏撅級 + * @param dataCode 鍔熻兘鐮� + * @param data 鏁版嵁 + * @throws Exception 寮傚父 + */ + protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { + DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ; + DataCd02Vo cdData = new DataCd02Vo() ; + dV1.dataCd02Vo = cdData ; + cdData.status = ByteUtil.bytes2Hex(bs, false, ProtocolConstantV206V1_0_0.dataIndex, 1) ; + } +} 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 new file mode 100644 index 0000000..dc4a95a --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_71_Down.java @@ -0,0 +1,85 @@ +package com.dy.common.mw.protocol.p206V1_0_0.parse; + +import com.dy.common.mw.protocol.*; +import com.dy.common.mw.protocol.p206V1_0_0.CodeV1_0_1; +import com.dy.common.mw.protocol.p206V1_0_0.CommonV1_0_1; +import com.dy.common.mw.protocol.p206V1_0_0.ParseParamsForDownV1_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.util.ByteUtil; + +@AnnotationCodeDown(ifAny={ + CodeV1_0_1.cd_71 +}) +public class Cd_71_Down implements CodeParse { + + //private static Logger log = LogManager.getLogger(Cd_71_Down.class); + + @Override + public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback) throws Exception { + ParseParamsForDownV1_0_1 para = (ParseParamsForDownV1_0_1) params ; + byte[] bs = this.doParse(para) ; + + MidResultToRtu midRs = new MidResultToRtu() ; + midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О + midRs.rtuAddr = para.rtuAddr ;//Rtu鍦板潃锛堢數淇″钩鍙拌澶嘔MEI锛� + midRs.commandId = para.commandId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉 + midRs.downCode = para.commandCode ;//涓嬭鍛戒护鍔熻兘鐮�; + midRs.downBuffer = bs ;//涓嬭鍛戒护鏁版嵁 + midRs.downBufHex = ByteUtil.bytes2Hex(bs, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡 + midRs.hasResponse = true ;//鏄惁鏈夊簲绛� + midRs.maxSendTimes = null ;//鍛戒护鏈�澶у彂閫佹鏁�(褰撴敹涓嶅埌搴旂瓟鏃讹紝灏嗛噸鍙�)锛屽鏋滀笉璁剧疆锛屽懡浠ょ紦瀛樺櫒杩涜琛ュ厖璁剧疆 + midRs.isCachForOffLine = false ;//RTU涓嶅湪绾匡紝鍛戒护鏄惁缂撳瓨锛屼綆鍔熻�楁椂涓簍rue + + if(isLowPower != null && isLowPower.booleanValue()){ + //浣庡姛鑰楁椂锛屽敖蹇彂閫� + midRs.isQuickSend = true ; + } + + return new MidResult[]{midRs} ; + } + + /** + * 鏋勯�犱笅琛屾暟鎹� + * @param para 鍙傛暟 + * @return 瀛楄妭鏁扮粍 + * @throws Exception 寮傚父 + */ + public byte[] doParse(ParseParamsForDownV1_0_1 para) 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)0) ; + + index++ ; + GlCreate.createRtuAddr(para.rtuAddr, bsHead, index); + index += 5 ; + + ByteUtil.hex2Bytes(para.commandCode, bsHead, index) ; + + byte[] bs = new byte[0] ; + //纭甯х殑鏁版嵁鍩熺敤浜庨仴娴嬬粓绔伐浣滄ā寮忕殑纭鎴栬浆鎹€�傛暟鎹负 1 涓瓧鑺� HEX锛�00H 鏃堕仴娴嬬粓 + //绔湪鍏煎宸ヤ綔鐘舵�侊紱 01H 鏃堕仴娴嬬粓绔湪鑷姤宸ヤ綔鐘舵�侊紱 02H 鏃堕仴娴嬬粓绔湪鏌ヨ/搴旂瓟宸ヤ綔 + //鐘舵�侊紱 03H 鏃堕仴娴嬬粓绔湪璋冭瘯/缁翠慨鐘舵�併�� + bs[0] = (byte)0xF1;//鏁版嵁鍩� + + bytes = ByteUtil.bytesMerge(bsHead, bs) ; + + GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑 + + bytes = GlCreate.createCrcTail(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓� + + return bytes ; + } + +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_71_Up.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_71_Up.java new file mode 100644 index 0000000..69e36a4 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_71_Up.java @@ -0,0 +1,65 @@ +package com.dy.common.mw.protocol.p206V1_0_0.parse; + +import com.dy.common.mw.protocol.*; +import com.dy.common.mw.protocol.p206V1_0_0.*; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +@AnnotationCodeUp(ifAny={ + CodeV1_0_1.cd_71 +}) +@SuppressWarnings("unused") +public class Cd_71_Up implements CodeParse { + + private static final Logger log = LogManager.getLogger(Cd_71_Up.class); + + /** + * 鍒嗘瀽涓婅鏁版嵁 + */ + @Override + public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception { + ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ; + int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ; + if(bsLen > 0){ + this.doParse(para.upBuffer, + bsLen, + para.upCode, + para.data) ; + } + log.info("鍒嗘瀽涓婅鏁版嵁<" + CodeV1_0_1.getCodeName(para.upCode) + " RTU鍦板潃=" + para.rtuAddr + ">:\n" + para.data.toString()); + + MidResultFromRtu midRs = new MidResultFromRtu() ; + midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О + midRs.rtuAddr = para.rtuAddr ;//Rtu鍦板潃 + midRs.upCode = para.upCode ;//涓婅鏁版嵁涓殑鍔熻兘鐮� + midRs.upHex = para.upHex ;//涓婅鏁版嵁鍗佸叚杩涘埗褰㈠紡 + midRs.upBuffer = para.upBuffer ;//涓婅鏁版嵁瀛楄妭鏁扮粍 + midRs.data = para.data ;//瑙f瀽鍚庣殑鏁版嵁 + + midRs.reportOrResponse_trueOrFalse = false ;//涓诲姩涓婃姤 + + callback.callback(midRs.reportOrResponse_trueOrFalse); + return new MidResult[]{midRs} ; + } + /** + * 鎵ц鍒嗘瀽 + * @param bs 瀛楄妭鏁扮粍 + * @param bsLen 瀛楄妭闀垮害锛堟�诲寘闀匡紝鍖呮嫭鍖呭ご鍜屽寘灏撅級 + * @param dataCode 鍔熻兘鐮� + * @param data 鏁版嵁 + * @throws Exception 寮傚父 + */ + protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { + DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ; + DataCd71Vo cdData = new DataCd71Vo() ; + dV1.dataCd71Vo = cdData ; + cdData.state = bs[ProtocolConstantV206V1_0_0.dataIndex] ; + if(cdData.state == 0){ + cdData.stateName = "闃�闂ㄥ叧闂�" ; + }else if(cdData.state == 1){ + cdData.stateName = "闃�闂ㄦ墦寮�" ; + }else{ + cdData.stateName = "鏈煡" ; + } + } +} 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 new file mode 100644 index 0000000..600aedb --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_83_Down.java @@ -0,0 +1,87 @@ +package com.dy.common.mw.protocol.p206V1_0_0.parse; + +import com.dy.common.mw.protocol.*; +import com.dy.common.mw.protocol.p206V1_0_0.CodeV1_0_1; +import com.dy.common.mw.protocol.p206V1_0_0.CommonV1_0_1; +import com.dy.common.mw.protocol.p206V1_0_0.ParseParamsForDownV1_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.util.ByteUtil; + +@AnnotationCodeDown(ifAny={ + CodeV1_0_1.cd_83 +}) +public class Cd_83_Down implements CodeParse { + + //private static Logger log = LogManager.getLogger(Cd_C0_Down.class); + + @Override + public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback) throws Exception { + ParseParamsForDownV1_0_1 para = (ParseParamsForDownV1_0_1) params ; + byte[] bs = this.doParse(para) ; + + MidResultToRtu midRs = new MidResultToRtu() ; + midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О + midRs.rtuAddr = para.rtuAddr ;//Rtu鍦板潃锛堢數淇″钩鍙拌澶嘔MEI锛� + midRs.commandId = para.commandId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉 + midRs.downCode = para.commandCode ;//涓嬭鍛戒护鍔熻兘鐮�; + midRs.downBuffer = bs ;//涓嬭鍛戒护鏁版嵁 + midRs.downBufHex = ByteUtil.bytes2Hex(bs, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡 + midRs.hasResponse = false ;//鏄惁鏈夊簲绛� + midRs.maxSendTimes = 1 ;//鍛戒护鏈�澶у彂閫佹鏁�(褰撴敹涓嶅埌搴旂瓟鏃讹紝灏嗛噸鍙�)锛屽鏋滀笉璁剧疆锛屽懡浠ょ紦瀛樺櫒杩涜琛ュ厖璁剧疆 + midRs.isCachForOffLine = false ;//RTU涓嶅湪绾匡紝鍛戒护鏄惁缂撳瓨锛屼綆鍔熻�楁椂涓簍rue + + midRs.isSendFirst = true ;//鍛戒护搴旂瓟锛岄鍏堝彂閫侊紝闃叉RTU閲嶆柊涓婃姤 + if(isLowPower != null && isLowPower.booleanValue()){ + //浣庡姛鑰楁椂锛屽敖蹇彂閫� + midRs.isQuickSend = true ; + } + + return new MidResult[]{midRs} ; + } + + /** + * 鏋勯�犱笅琛屾暟鎹� + * @param para 鍙傛暟 + * @return 瀛楄妭鏁扮粍 + * @throws Exception 寮傚父 + */ + public byte[] doParse(ParseParamsForDownV1_0_1 para) 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)0) ; + + index++ ; + GlCreate.createRtuAddr(para.rtuAddr, bsHead, index); + index += 5 ; + + ByteUtil.hex2Bytes(para.commandCode, bsHead, index) ; + + byte[] bs = new byte[7] ; + //纭甯х殑鏁版嵁鍩熺敤浜庨仴娴嬬粓绔伐浣滄ā寮忕殑纭鎴栬浆鎹€�傛暟鎹负 1 涓瓧鑺� HEX锛�00H 鏃堕仴娴嬬粓 + //绔湪鍏煎宸ヤ綔鐘舵�侊紱 01H 鏃堕仴娴嬬粓绔湪鑷姤宸ヤ綔鐘舵�侊紱 02H 鏃堕仴娴嬬粓绔湪鏌ヨ/搴旂瓟宸ヤ綔 + //鐘舵�侊紱 03H 鏃堕仴娴嬬粓绔湪璋冭瘯/缁翠慨鐘舵�併�� + bs[0] = ProtocolConstantV206V1_0_0.P_Default_mode;//鏁版嵁鍩� + GlCreate.createTp(bs, 1); + + bytes = ByteUtil.bytesMerge(bsHead, bs) ; + + GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑 + + bytes = GlCreate.createCrcTail(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓� + + return bytes ; + } + +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_83_Up.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_83_Up.java new file mode 100644 index 0000000..15ff9f1 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_83_Up.java @@ -0,0 +1,253 @@ +package com.dy.common.mw.protocol.p206V1_0_0.parse; + +import com.dy.common.mw.protocol.*; +import com.dy.common.mw.protocol.p206V1_0_0.*; +import com.dy.common.mw.protocol.p206V1_0_0.parse.global.GlParse; +import com.dy.common.util.ByteUtil; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +@AnnotationCodeUp(ifAny={ + CodeV1_0_1.cd_83 +}) +@SuppressWarnings("unused") +public class Cd_83_Up implements CodeParse { + + private static final Logger log = LogManager.getLogger(Cd_83_Up.class); + + /** + * 鍒嗘瀽涓婅鏁版嵁 + */ + @Override + public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception { + ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ; + int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ; + if(bsLen > 0){ + this.doParse(para.upBuffer, + bsLen, + para.upCode, + para.data) ; + } + log.info("鍒嗘瀽涓婅鏁版嵁<" + CodeV1_0_1.getCodeName(para.upCode) + " RTU鍦板潃=" + para.rtuAddr + ">:\n" + para.data.toString()); + + MidResultFromRtu midRs = new MidResultFromRtu() ; + midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О + midRs.rtuAddr = para.rtuAddr ;//Rtu鍦板潃 + midRs.upCode = para.upCode ;//涓婅鏁版嵁涓殑鍔熻兘鐮� + midRs.upHex = para.upHex ;//涓婅鏁版嵁鍗佸叚杩涘埗褰㈠紡 + midRs.upBuffer = para.upBuffer ;//涓婅鏁版嵁瀛楄妭鏁扮粍 + midRs.data = para.data ;//瑙f瀽鍚庣殑鏁版嵁 + + midRs.reportOrResponse_trueOrFalse = true ;//涓诲姩涓婃姤 + + String confirmComCode = para.upCode ; + ParseParamsForDownV1_0_1 downCpParams = new ParseParamsForDownV1_0_1() ; + downCpParams.setValue( + ProtocolConstantV206V1_0_0.protocolName, + para.rtuAddr, + Command.defaultId, + confirmComCode, + null, + null); + //鏋勯�犲簲绛� + byte[] data = new Cd_83_Down().doParse(downCpParams) ; + + MidResultToRtu confirmCommand = new MidResultToRtu() ; + confirmCommand.protocolName = para.protocolName ;//鍗忚鍚嶇О + confirmCommand.rtuAddr = para.rtuAddr ;//Rtu鍦板潃 + confirmCommand.commandId = Command.defaultId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉 + confirmCommand.downCode = confirmComCode ;//涓嬭鍛戒护鍔熻兘鐮�; + confirmCommand.downBuffer = data ;//涓嬭鍛戒护鏁版嵁 + confirmCommand.downBufHex = ByteUtil.bytes2Hex(data, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡 + confirmCommand.hasResponse = false ;//鏄惁鏈夊簲绛� + confirmCommand.maxSendTimes = 1 ;//鍛戒护鏈�澶у彂閫佹鏁�(褰撴敹涓嶅埌搴旂瓟鏃讹紝灏嗛噸鍙�2娆�)锛屽鏋滀笉璁剧疆锛屽懡浠ょ紦瀛樺櫒杩涜琛ュ厖璁剧疆 + confirmCommand.isCachForOffLine = false ;//RTU涓嶅湪绾匡紝鍛戒护鏄惁缂撳瓨 + + confirmCommand.isSendFirst = true ;//纭鍛戒护锛屼紭鍏堝彂閫� + if(isLowPower != null && isLowPower.booleanValue()){ + //浣庡姛鑰楁椂锛屽敖蹇彂閫� + confirmCommand.isQuickSend = true ; + } + + callback.callback(midRs.reportOrResponse_trueOrFalse); + return new MidResult[]{midRs, confirmCommand} ; + } + /** + * 鎵ц鍒嗘瀽 + * @param bs 瀛楄妭鏁扮粍 + * @param bsLen 瀛楄妭闀垮害锛堟�诲寘闀匡紝鍖呮嫭鍖呭ご鍜屽寘灏撅級 + * @param dataCode 鍔熻兘鐮� + * @param data 鏁版嵁 + * @throws Exception 寮傚父 + */ + protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { + short index = ProtocolConstantV206V1_0_0.dataIndex ; + byte opType = bs[ProtocolConstantV206V1_0_0.dataIndex]; + if(opType == 1 || opType == 3 || opType == 8){ + this.doParseOpen(opType, bs, bsLen, dataCode, data); + }else{ + this.doParseClose(opType, bs, bsLen, dataCode, data); + } + } + private void doParseOpen(byte opType, byte[] bs, int bsLen, String dataCode, Data data) throws Exception { + DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ; + DataCd83OpenVo cdData = new DataCd83OpenVo() ; + dV1.dataCd83OpenVo = cdData ; + + cdData.type = opType ; + + short index = ProtocolConstantV206V1_0_0.dataIndex + 1 ; + //绱娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆� + cdData.totalAmount = 0.0D ; + int tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.totalAmount += tpInt; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.totalAmount += tpInt * 100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.totalAmount += tpInt * 10000.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.totalAmount += tpInt * 1000000.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.totalAmount += tpInt * 100000000.0 ; + + //鐢ㄦ按鎴峰彿鏁版嵁鏍煎紡锛�5瀛楄妭BCD鐮佷綆浣嶅湪鍓嶉珮浣嶅湪鍚庛�� + cdData.clientNum = ByteUtil.BCD2String_LE(bs, index, index + 4) ; + index += 5 ; + + //IC鍗″彿鏍煎紡锛�4瀛楄妭HEX鐮佷綆浣嶅湪鍓嶉珮浣嶅湪鍚庛�� + cdData.clientNum = ByteUtil.bytesToHex(bs, index, index + 3) ; + index += 4 ; + + //鐢ㄦ按鎴蜂綑棰濓細鐢ㄦ埛浣欓4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0.00~999999.99锛屽崟浣嶄负鍏冦�� + cdData.remainMoney = 0.0D ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.remainMoney += tpInt/100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.remainMoney += tpInt; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.remainMoney += tpInt * 100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.remainMoney += tpInt * 10000.0 ; + + //鐢ㄦ按鎴风敤姘村紑濮嬫椂闂达細6瀛楄妭BCD鐮侊紝椤哄簭鏄勾鏈堟棩鏃跺垎绉掞紝鍏朵腑鍏厓骞�=2000+骞淬�� + cdData.openDt = GlParse.parseTp(bs, index) ; + index += 6 ; + + //鎺у埗鍣ㄦ椂閽� + cdData.rtuDt = GlParse.parseTp(bs, index) ; + //index += 6 ; + } + + private void doParseClose(byte opType, byte[] bs, int bsLen, String dataCode, Data data) throws Exception { + DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ; + DataCd83CloseVo cdData = new DataCd83CloseVo() ; + dV1.dataCd83CloseVo = cdData ; + + cdData.type = opType ; + + short index = ProtocolConstantV206V1_0_0.dataIndex + 1 ; + //绱娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆� + cdData.totalAmount = 0.0D ; + int tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.totalAmount += tpInt; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.totalAmount += tpInt * 100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.totalAmount += tpInt * 10000.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.totalAmount += tpInt * 1000000.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.totalAmount += tpInt * 100000000.0 ; + + //鐢ㄦ按鎴峰彿鏁版嵁鏍煎紡锛�5瀛楄妭BCD鐮佷綆浣嶅湪鍓嶉珮浣嶅湪鍚庛�� + cdData.clientNum = ByteUtil.BCD2String_LE(bs, index, index + 4) ; + index += 5 ; + + //IC鍗″彿鏍煎紡锛�4瀛楄妭HEX鐮佷綆浣嶅湪鍓嶉珮浣嶅湪鍚庛�� + cdData.clientNum = ByteUtil.bytesToHex(bs, index, index + 3) ; + index += 4 ; + + //鐢ㄦ按鎴蜂綑棰濓細鐢ㄦ埛浣欓4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0.00~999999.99锛屽崟浣嶄负鍏冦�� + cdData.remainMoney = 0.0D ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.remainMoney += tpInt/100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.remainMoney += tpInt; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.remainMoney += tpInt * 100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.remainMoney += tpInt * 10000.0 ; + + //鐢ㄦ按鎴风敤姘村紑濮嬫椂闂达細6瀛楄妭BCD鐮侊紝椤哄簭鏄勾鏈堟棩鏃跺垎绉掞紝鍏朵腑鍏厓骞�=2000+骞淬�� + cdData.openDt = GlParse.parseTp(bs, index) ; + index += 6 ; + + //鐢ㄦ按鎴风敤姘寸粨鏉熸椂闂达細6瀛楄妭BCD鐮侊紝椤哄簭鏄勾鏈堟棩鏃跺垎绉掞紝鍏朵腑鍏厓骞�=2000+骞淬�� + cdData.closeDt = GlParse.parseTp(bs, index) ; + index += 6 ; + + //鐢ㄦ按鎴锋湰娆$敤姘撮噺锛氱疮璁℃祦閲�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆� + cdData.thisAmount = 0.0D ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.thisAmount += tpInt/100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.thisAmount += tpInt ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.thisAmount += tpInt * 100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.thisAmount += tpInt * 10000.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.thisAmount += tpInt * 1000000.0 ; + + //鐢ㄦ按鎴锋湰娆℃秷璐归噾棰濓細鐢ㄦ埛浣欓4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0.00~999999.99锛屽崟浣嶄负鍏冦�� + cdData.thisMoney = 0.0D ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.thisMoney += tpInt/100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.thisMoney += tpInt; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.thisMoney += tpInt * 100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.thisMoney += tpInt * 10000.0 ; + + //鐢ㄦ按鎴锋湰娆$敤姘存椂闀匡細鐢ㄦ按鏃堕暱2瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999锛屽崟浣嶄负鍒嗛挓銆� + cdData.thisTime = 0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.thisTime += tpInt; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.thisTime += tpInt * 100 ; + + //鎺у埗鍣ㄦ椂閽� + cdData.rtuDt = GlParse.parseTp(bs, index) ; + //index += 6 ; + } +} 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 new file mode 100644 index 0000000..9aa0f96 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_84_Down.java @@ -0,0 +1,87 @@ +package com.dy.common.mw.protocol.p206V1_0_0.parse; + +import com.dy.common.mw.protocol.*; +import com.dy.common.mw.protocol.p206V1_0_0.CodeV1_0_1; +import com.dy.common.mw.protocol.p206V1_0_0.CommonV1_0_1; +import com.dy.common.mw.protocol.p206V1_0_0.ParseParamsForDownV1_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.util.ByteUtil; + +@AnnotationCodeDown(ifAny={ + CodeV1_0_1.cd_84 +}) +public class Cd_84_Down implements CodeParse { + + //private static Logger log = LogManager.getLogger(Cd_C0_Down.class); + + @Override + public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback) throws Exception { + ParseParamsForDownV1_0_1 para = (ParseParamsForDownV1_0_1) params ; + byte[] bs = this.doParse(para) ; + + MidResultToRtu midRs = new MidResultToRtu() ; + midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О + midRs.rtuAddr = para.rtuAddr ;//Rtu鍦板潃锛堢數淇″钩鍙拌澶嘔MEI锛� + midRs.commandId = para.commandId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉 + midRs.downCode = para.commandCode ;//涓嬭鍛戒护鍔熻兘鐮�; + midRs.downBuffer = bs ;//涓嬭鍛戒护鏁版嵁 + midRs.downBufHex = ByteUtil.bytes2Hex(bs, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡 + midRs.hasResponse = false ;//鏄惁鏈夊簲绛� + midRs.maxSendTimes = 1 ;//鍛戒护鏈�澶у彂閫佹鏁�(褰撴敹涓嶅埌搴旂瓟鏃讹紝灏嗛噸鍙�)锛屽鏋滀笉璁剧疆锛屽懡浠ょ紦瀛樺櫒杩涜琛ュ厖璁剧疆 + midRs.isCachForOffLine = false ;//RTU涓嶅湪绾匡紝鍛戒护鏄惁缂撳瓨锛屼綆鍔熻�楁椂涓簍rue + + midRs.isSendFirst = true ;//鍛戒护搴旂瓟锛岄鍏堝彂閫侊紝闃叉RTU閲嶆柊涓婃姤 + if(isLowPower != null && isLowPower.booleanValue()){ + //浣庡姛鑰楁椂锛屽敖蹇彂閫� + midRs.isQuickSend = true ; + } + + return new MidResult[]{midRs} ; + } + + /** + * 鏋勯�犱笅琛屾暟鎹� + * @param para 鍙傛暟 + * @return 瀛楄妭鏁扮粍 + * @throws Exception 寮傚父 + */ + public byte[] doParse(ParseParamsForDownV1_0_1 para) 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)0) ; + + index++ ; + GlCreate.createRtuAddr(para.rtuAddr, bsHead, index); + index += 5 ; + + ByteUtil.hex2Bytes(para.commandCode, bsHead, index) ; + + byte[] bs = new byte[7] ; + //纭甯х殑鏁版嵁鍩熺敤浜庨仴娴嬬粓绔伐浣滄ā寮忕殑纭鎴栬浆鎹€�傛暟鎹负 1 涓瓧鑺� HEX锛�00H 鏃堕仴娴嬬粓 + //绔湪鍏煎宸ヤ綔鐘舵�侊紱 01H 鏃堕仴娴嬬粓绔湪鑷姤宸ヤ綔鐘舵�侊紱 02H 鏃堕仴娴嬬粓绔湪鏌ヨ/搴旂瓟宸ヤ綔 + //鐘舵�侊紱 03H 鏃堕仴娴嬬粓绔湪璋冭瘯/缁翠慨鐘舵�併�� + bs[0] = ProtocolConstantV206V1_0_0.P_Default_mode;//鏁版嵁鍩� + GlCreate.createTp(bs, 1); + + bytes = ByteUtil.bytesMerge(bsHead, bs) ; + + GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑 + + bytes = GlCreate.createCrcTail(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓� + + return bytes ; + } + +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_84_Up.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_84_Up.java new file mode 100644 index 0000000..a14fc36 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_84_Up.java @@ -0,0 +1,149 @@ +package com.dy.common.mw.protocol.p206V1_0_0.parse; + +import com.dy.common.mw.protocol.*; +import com.dy.common.mw.protocol.p206V1_0_0.*; +import com.dy.common.mw.protocol.p206V1_0_0.parse.global.GlParse; +import com.dy.common.util.ByteUtil; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +@AnnotationCodeUp(ifAny={ + CodeV1_0_1.cd_84 +}) +@SuppressWarnings("unused") +public class Cd_84_Up implements CodeParse { + + private static final Logger log = LogManager.getLogger(Cd_84_Up.class); + + /** + * 鍒嗘瀽涓婅鏁版嵁 + */ + @Override + public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception { + ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ; + int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ; + if(bsLen > 0){ + this.doParse(para.upBuffer, + bsLen, + para.upCode, + para.data) ; + } + log.info("鍒嗘瀽涓婅鏁版嵁<" + CodeV1_0_1.getCodeName(para.upCode) + " RTU鍦板潃=" + para.rtuAddr + ">:\n" + para.data.toString()); + + MidResultFromRtu midRs = new MidResultFromRtu() ; + midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О + midRs.rtuAddr = para.rtuAddr ;//Rtu鍦板潃 + midRs.upCode = para.upCode ;//涓婅鏁版嵁涓殑鍔熻兘鐮� + midRs.upHex = para.upHex ;//涓婅鏁版嵁鍗佸叚杩涘埗褰㈠紡 + midRs.upBuffer = para.upBuffer ;//涓婅鏁版嵁瀛楄妭鏁扮粍 + midRs.data = para.data ;//瑙f瀽鍚庣殑鏁版嵁 + + midRs.reportOrResponse_trueOrFalse = true ;//涓诲姩涓婃姤 + + String confirmComCode = para.upCode ; + ParseParamsForDownV1_0_1 downCpParams = new ParseParamsForDownV1_0_1() ; + downCpParams.setValue( + ProtocolConstantV206V1_0_0.protocolName, + para.rtuAddr, + Command.defaultId, + confirmComCode, + null, + null); + //鏋勯�犲簲绛� + byte[] data = new Cd_84_Down().doParse(downCpParams) ; + + MidResultToRtu confirmCommand = new MidResultToRtu() ; + confirmCommand.protocolName = para.protocolName ;//鍗忚鍚嶇О + confirmCommand.rtuAddr = para.rtuAddr ;//Rtu鍦板潃 + confirmCommand.commandId = Command.defaultId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉 + confirmCommand.downCode = confirmComCode ;//涓嬭鍛戒护鍔熻兘鐮�; + confirmCommand.downBuffer = data ;//涓嬭鍛戒护鏁版嵁 + confirmCommand.downBufHex = ByteUtil.bytes2Hex(data, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡 + confirmCommand.hasResponse = false ;//鏄惁鏈夊簲绛� + confirmCommand.maxSendTimes = 1 ;//鍛戒护鏈�澶у彂閫佹鏁�(褰撴敹涓嶅埌搴旂瓟鏃讹紝灏嗛噸鍙�2娆�)锛屽鏋滀笉璁剧疆锛屽懡浠ょ紦瀛樺櫒杩涜琛ュ厖璁剧疆 + confirmCommand.isCachForOffLine = false ;//RTU涓嶅湪绾匡紝鍛戒护鏄惁缂撳瓨 + + confirmCommand.isSendFirst = true ;//纭鍛戒护锛屼紭鍏堝彂閫� + if(isLowPower != null && isLowPower.booleanValue()){ + //浣庡姛鑰楁椂锛屽敖蹇彂閫� + confirmCommand.isQuickSend = true ; + } + + callback.callback(midRs.reportOrResponse_trueOrFalse); + return new MidResult[]{midRs, confirmCommand} ; + } + /** + * 鎵ц鍒嗘瀽 + * @param bs 瀛楄妭鏁扮粍 + * @param bsLen 瀛楄妭闀垮害锛堟�诲寘闀匡紝鍖呮嫭鍖呭ご鍜屽寘灏撅級 + * @param dataCode 鍔熻兘鐮� + * @param data 鏁版嵁 + * @throws Exception 寮傚父 + */ + protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { + DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ; + DataCd84Vo cdData = new DataCd84Vo() ; + dV1.dataCd84Vo = cdData ; + + short index = ProtocolConstantV206V1_0_0.dataIndex ; + //鐢ㄦ按鎴峰彿鏁版嵁鏍煎紡锛�5瀛楄妭BCD鐮佷綆浣嶅湪鍓嶉珮浣嶅湪鍚庛�� + cdData.clientNum = ByteUtil.BCD2String_LE(bs, index, index + 4) ; + index += 5 ; + + //鐢ㄦ按鎴蜂綑棰濓細鐢ㄦ埛浣欓4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0.00~999999.99锛屽崟浣嶄负鍏冦�� + cdData.remainMoney = 0.0D ; + int tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.remainMoney += tpInt/100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.remainMoney += tpInt; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.remainMoney += tpInt * 100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.remainMoney += tpInt * 10000.0 ; + + //绱娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆� + cdData.totalAmount = 0.0D ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.totalAmount += tpInt; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.totalAmount += tpInt * 100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.totalAmount += tpInt * 10000.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.totalAmount += tpInt * 1000000.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.totalAmount += tpInt * 100000000.0 ; + + //鐬椂娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999.999锛屽崟浣嶄负m3/h銆� + cdData.instantAmount = 0.0D ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.instantAmount += tpInt/1000.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.instantAmount += tpInt/10.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.instantAmount += tpInt * 10.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.instantAmount += tpInt * 1000.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.instantAmount += tpInt * 100000.0 ; + + //鎺у埗鍣ㄦ椂閽� + cdData.rtuDt = GlParse.parseTp(bs, index) ; + //index += 6 ; + } + +} 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 new file mode 100644 index 0000000..f4926b9 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_C0_Down.java @@ -0,0 +1,87 @@ +package com.dy.common.mw.protocol.p206V1_0_0.parse; + +import com.dy.common.mw.protocol.*; +import com.dy.common.mw.protocol.p206V1_0_0.CodeV1_0_1; +import com.dy.common.mw.protocol.p206V1_0_0.CommonV1_0_1; +import com.dy.common.mw.protocol.p206V1_0_0.ParseParamsForDownV1_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.util.ByteUtil; + +@AnnotationCodeDown(ifAny={ + CodeV1_0_1.cd_C0 +}) +public class Cd_C0_Down implements CodeParse { + + //private static Logger log = LogManager.getLogger(Cd_C0_Down.class); + + @Override + public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback) throws Exception { + ParseParamsForDownV1_0_1 para = (ParseParamsForDownV1_0_1) params ; + byte[] bs = this.doParse(para) ; + + MidResultToRtu midRs = new MidResultToRtu() ; + midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О + midRs.rtuAddr = para.rtuAddr ;//Rtu鍦板潃锛堢數淇″钩鍙拌澶嘔MEI锛� + midRs.commandId = para.commandId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉 + midRs.downCode = para.commandCode ;//涓嬭鍛戒护鍔熻兘鐮�; + midRs.downBuffer = bs ;//涓嬭鍛戒护鏁版嵁 + midRs.downBufHex = ByteUtil.bytes2Hex(bs, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡 + midRs.hasResponse = false ;//鏄惁鏈夊簲绛� + midRs.maxSendTimes = 1 ;//鍛戒护鏈�澶у彂閫佹鏁�(褰撴敹涓嶅埌搴旂瓟鏃讹紝灏嗛噸鍙�)锛屽鏋滀笉璁剧疆锛屽懡浠ょ紦瀛樺櫒杩涜琛ュ厖璁剧疆 + midRs.isCachForOffLine = false ;//RTU涓嶅湪绾匡紝鍛戒护鏄惁缂撳瓨锛屼綆鍔熻�楁椂涓簍rue + + midRs.isSendFirst = true ;//鍛戒护搴旂瓟锛岄鍏堝彂閫侊紝闃叉RTU閲嶆柊涓婃姤 + if(isLowPower != null && isLowPower.booleanValue()){ + //浣庡姛鑰楁椂锛屽敖蹇彂閫� + midRs.isQuickSend = true ; + } + + return new MidResult[]{midRs} ; + } + + /** + * 鏋勯�犱笅琛屾暟鎹� + * @param para 鍙傛暟 + * @return 瀛楄妭鏁扮粍 + * @throws Exception 寮傚父 + */ + public byte[] doParse(ParseParamsForDownV1_0_1 para) 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)0) ; + + index++ ; + GlCreate.createRtuAddr(para.rtuAddr, bsHead, index); + index += 5 ; + + ByteUtil.hex2Bytes(para.commandCode, bsHead, index) ; + + byte[] bs = new byte[7] ; + //纭甯х殑鏁版嵁鍩熺敤浜庨仴娴嬬粓绔伐浣滄ā寮忕殑纭鎴栬浆鎹€�傛暟鎹负 1 涓瓧鑺� HEX锛�00H 鏃堕仴娴嬬粓 + //绔湪鍏煎宸ヤ綔鐘舵�侊紱 01H 鏃堕仴娴嬬粓绔湪鑷姤宸ヤ綔鐘舵�侊紱 02H 鏃堕仴娴嬬粓绔湪鏌ヨ/搴旂瓟宸ヤ綔 + //鐘舵�侊紱 03H 鏃堕仴娴嬬粓绔湪璋冭瘯/缁翠慨鐘舵�併�� + bs[0] = ProtocolConstantV206V1_0_0.P_Default_mode;//鏁版嵁鍩� + GlCreate.createTp(bs, 1); + + bytes = ByteUtil.bytesMerge(bsHead, bs) ; + + GlCreate.createLen(bytes);//闀垮害鏀惧瓧鑺傛暟缁勪腑 + + bytes = GlCreate.createCrcTail(bytes) ;//CRC鍜屽熬鍙犲姞瀛楄妭鏁扮粍涓� + + return bytes ; + } + +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_C0_Up.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_C0_Up.java new file mode 100644 index 0000000..dd61198 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/Cd_C0_Up.java @@ -0,0 +1,224 @@ +package com.dy.common.mw.protocol.p206V1_0_0.parse; + +import com.dy.common.mw.protocol.*; +import com.dy.common.mw.protocol.p206V1_0_0.*; +import com.dy.common.mw.protocol.p206V1_0_0.parse.global.GlParse; +import com.dy.common.util.ByteUtil; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +@AnnotationCodeUp(ifAny={ + CodeV1_0_1.cd_C0 +}) +@SuppressWarnings("unused") +public class Cd_C0_Up implements CodeParse { + + private static final Logger log = LogManager.getLogger(Cd_C0_Up.class); + + /** + * 鍒嗘瀽涓婅鏁版嵁 + */ + @Override + public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception { + ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ; + int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ; + if(bsLen > 0){ + this.doParse(para.upBuffer, + bsLen, + para.upCode, + para.data) ; + } + log.info("鍒嗘瀽涓婅鏁版嵁<" + CodeV1_0_1.getCodeName(para.upCode) + " RTU鍦板潃=" + para.rtuAddr + ">:\n" + para.data.toString()); + + MidResultFromRtu midRs = new MidResultFromRtu() ; + midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О + midRs.rtuAddr = para.rtuAddr ;//Rtu鍦板潃 + midRs.upCode = para.upCode ;//涓婅鏁版嵁涓殑鍔熻兘鐮� + midRs.upHex = para.upHex ;//涓婅鏁版嵁鍗佸叚杩涘埗褰㈠紡 + midRs.upBuffer = para.upBuffer ;//涓婅鏁版嵁瀛楄妭鏁扮粍 + midRs.data = para.data ;//瑙f瀽鍚庣殑鏁版嵁 + + midRs.reportOrResponse_trueOrFalse = true ;//涓诲姩涓婃姤 + + String confirmComCode = para.upCode ; + ParseParamsForDownV1_0_1 downCpParams = new ParseParamsForDownV1_0_1() ; + downCpParams.setValue( + ProtocolConstantV206V1_0_0.protocolName, + para.rtuAddr, + Command.defaultId, + confirmComCode, + null, + null); + //鏋勯�犲簲绛� + byte[] data = new Cd_02_Down().doParse(downCpParams) ; + + MidResultToRtu confirmCommand = new MidResultToRtu() ; + confirmCommand.protocolName = para.protocolName ;//鍗忚鍚嶇О + confirmCommand.rtuAddr = para.rtuAddr ;//Rtu鍦板潃 + confirmCommand.commandId = Command.defaultId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉 + confirmCommand.downCode = confirmComCode ;//涓嬭鍛戒护鍔熻兘鐮�; + confirmCommand.downBuffer = data ;//涓嬭鍛戒护鏁版嵁 + confirmCommand.downBufHex = ByteUtil.bytes2Hex(data, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡 + confirmCommand.hasResponse = false ;//鏄惁鏈夊簲绛� + confirmCommand.maxSendTimes = 1 ;//鍛戒护鏈�澶у彂閫佹鏁�(褰撴敹涓嶅埌搴旂瓟鏃讹紝灏嗛噸鍙�2娆�)锛屽鏋滀笉璁剧疆锛屽懡浠ょ紦瀛樺櫒杩涜琛ュ厖璁剧疆 + confirmCommand.isCachForOffLine = false ;//RTU涓嶅湪绾匡紝鍛戒护鏄惁缂撳瓨 + + confirmCommand.isSendFirst = true ;//纭鍛戒护锛屼紭鍏堝彂閫� + if(isLowPower != null && isLowPower.booleanValue()){ + //浣庡姛鑰楁椂锛屽敖蹇彂閫� + confirmCommand.isQuickSend = true ; + } + + callback.callback(midRs.reportOrResponse_trueOrFalse); + return new MidResult[]{midRs, confirmCommand} ; + } + /** + * 鎵ц鍒嗘瀽 + * @param bs 瀛楄妭鏁扮粍 + * @param bsLen 瀛楄妭闀垮害锛堟�诲寘闀匡紝鍖呮嫭鍖呭ご鍜屽寘灏撅級 + * @param dataCode 鍔熻兘鐮� + * @param data 鏁版嵁 + * @throws Exception 寮傚父 + */ + protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { + DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ; + DataCdC0Vo cdData = new DataCdC0Vo() ; + dV1.dataCdC0Vo = cdData ; + + boolean hasWaterAmount = false ;//鏄惁鏈夋祦閲忔暟鎹� + boolean hasWaterPress = false ;//鏄惁鏈夋按鍘嬫暟鎹� + boolean hasEleVolt = false ;//鏄惁鏈夌數鍘嬫暟鎹� + boolean hasSignal = false ;//鏄惁鏈変俊鍙峰己搴︽暟鎹� + boolean hasAlarmStatus = false ;//鏄惁鏈夋暟鎹� + + short index = ProtocolConstantV206V1_0_0.dataIndex ; + + byte tmpBt1 = bs[index] ; + index++ ; + if(((tmpBt1 & 4) >> 2) == 1){ + hasWaterAmount = true ; + } + + byte tmpBt2 = bs[index] ; + index++ ; + if(((tmpBt2 & 0x10) >> 4) == 1){ + hasAlarmStatus = true ; + } + if(((tmpBt2 & 0x20) >> 5) == 1){ + hasWaterPress = true ; + } + if(((tmpBt2 & 0x40) >> 6) == 1){ + hasEleVolt = true ; + } + if(((tmpBt2 & 0x80) >> 7) == 1){ + hasSignal = true ; + } + + if(hasWaterAmount){ + //鐬椂娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999.999锛屽崟浣嶄负m3/h銆� + cdData.instantAmount = 0.0D ; + int tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.instantAmount += tpInt/1000.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.instantAmount += tpInt/10.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.instantAmount += tpInt * 10.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.instantAmount += tpInt * 1000.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.instantAmount += tpInt * 100000.0 ; + + //绱娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆� + cdData.totalAmount = 0.0D ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.totalAmount += tpInt; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.totalAmount += tpInt * 100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.totalAmount += tpInt * 10000.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.totalAmount += tpInt * 1000000.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.totalAmount += tpInt * 100000000.0 ; + + //鎹熷け娴侀噺锛�5瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~9999999999锛屽崟浣嶄负m3銆� + cdData.lossAmount = 0.0D ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.lossAmount += tpInt; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.lossAmount += tpInt * 100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.lossAmount += tpInt * 10000.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.lossAmount += tpInt * 1000000.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.lossAmount += tpInt * 100000000.0 ; + } + if(hasWaterPress){ + //姘村帇锛�4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~999999.99锛屽崟浣嶄负KPa銆� + cdData.waterPress = 0.0D ; + int tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.waterPress += tpInt/100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.waterPress += tpInt; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.waterPress += tpInt * 100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.waterPress += tpInt * 10000.0 ; + } + if(hasEleVolt){ + //鐢垫睜鐢靛帇锛�4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~99.99锛屽崟浣嶄负V銆� + cdData.batteryVolt = 0.0D ;//钃勭數姹犵數鍘� + cdData.sunVolt = 0.0D ;//澶槼鑳界數鍘� + int tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.batteryVolt += tpInt/100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.batteryVolt += tpInt; + //澶槼鑳界數鍘嬶細4瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~99.99锛屽崟浣嶄负V銆� + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.sunVolt += tpInt/100.0 ; + tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.sunVolt += tpInt; + } + if(hasSignal){ + //淇″彿寮哄害锛�1瀛楄妭BCD鐮侊紝鍙栧�艰寖鍥�0~99銆� + cdData.signal = 0 ; + int tpInt = ByteUtil.BCD2Int_LE(bs, index, index) ; + index++ ; + cdData.signal += tpInt ; + } + if(hasAlarmStatus){ + //鎶ヨ鏁版嵁 + cdData.alarmVo = GlParse.parseAlarm(bs, index) ; + index += 2 ; + //鐘舵�佹暟鎹� + cdData.stateVo = GlParse.parseState(bs, index) ; + index += 2 ; + } + cdData.rtuDt = GlParse.parseTp(bs, index) ; + + } +} 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 new file mode 100644 index 0000000..4f13733 --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/global/GlCreate.java @@ -0,0 +1,39 @@ +package com.dy.common.mw.protocol.p206V1_0_0.parse.global; + +import com.dy.common.mw.protocol.p206V1_0_0.ProtocolConstantV206V1_0_0; +import com.dy.common.util.ByteUtil; +import com.dy.common.util.ByteUtilUnsigned; +import com.dy.common.util.CRC8_for_2_0; +import com.dy.common.util.DateTime; + +public class GlCreate { + + public static void createRtuAddr(String rtuAddr, byte[] bs, int index) throws Exception { + String rtuAddr1 = rtuAddr.substring(0, 6) ; + String rtuAddr2 = rtuAddr.substring(6) ; + + index++ ; + ByteUtil.string2BCD_BE(bs, rtuAddr1, index) ; + index += 3 ; + + Integer rtuAddr2Int = Integer.parseInt(rtuAddr2) ; + ByteUtilUnsigned.short2Bytes_BE(bs, rtuAddr2Int.shortValue(), index); + } + + public static void createTp(byte[] bs, int index) throws Exception { + ByteUtil.string2BCD_BE(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 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) ; + } +} 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 new file mode 100644 index 0000000..43785ec --- /dev/null +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/p206V1_0_0/parse/global/GlParse.java @@ -0,0 +1,56 @@ +package com.dy.common.mw.protocol.p206V1_0_0.parse.global; + +import com.dy.common.mw.protocol.p206V1_0_0.DataAlarmVo; +import com.dy.common.mw.protocol.p206V1_0_0.DataStateVo; +import com.dy.common.util.ByteUtil; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class GlParse { + + private static final Logger log = LogManager.getLogger(GlParse.class); + + public static DataAlarmVo parseAlarm(byte[] bs, short index){ + DataAlarmVo avo = new DataAlarmVo() ; + byte b = bs[index] ; + index++ ; + avo.batteryVolt = (byte)(b & 0x2) ; + avo.loss = (byte)(b & 0x8) ; + avo.meter = (byte)(b & 0x20) ; + + b = bs[index] ; + avo.valve = (byte)(b & 0x20) ; + return avo ; + } + + public static DataStateVo parseState(byte[] bs, short index){ + DataStateVo avo = new DataStateVo() ; + byte b = bs[index] ; + index++ ; + avo.idCard = (byte)(b & 0x4) ; + avo.work = (byte)(b & 0x8) ; + avo.valve = (byte)(b & 0x20) ; + return avo ; + } + + public static String parseTp(byte[] bs, short index){ + String dt = "" ; + try{ + dt = dt + ByteUtil.BCD2String_BE(bs, index, index) ;//绉� + index++ ; + dt = ByteUtil.BCD2String_BE(bs, index, index) + ":" + dt ;//鍒� + index++ ; + dt = ByteUtil.BCD2String_BE(bs, index, index) + " " + dt ;//鏃� + index++ ; + dt = ByteUtil.BCD2String_BE(bs, index, index) + "-" + dt ;//鏃� + index++ ; + bs[index] = (byte)(bs[index] & 0x10); + dt = ByteUtil.BCD2String_BE(bs, index, index) + "-" + dt ;//鏈� + index++ ; + dt = "20" + ByteUtil.BCD2String_BE(bs, index, index) + "-" + dt ;//骞� + }catch (Exception e){ + log.error("瑙f瀽鎺у埗鍣ㄦ椂閽熸椂寮傚父锛�" + e.getMessage(), e); + } + return dt ; + } +} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/CodeV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/CodeV1_0_1.java deleted file mode 100644 index 4a82844..0000000 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/CodeV1_0_1.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1; - -public class CodeV1_0_1 { - //鍔熻兘鐮佷负瀛楃涓诧紝鍗佸叚杩涘埗鏁版嵁 - public static final String cd_01 = "01" ;//瀹氭椂锛堝懆鏈燂級涓婃姤 - public static final String cd_02 = "02" ;//瀹炴椂(瑙﹀彂)涓婃姤 - public static final String cd_03 = "03" ;//浜嬩欢涓婃姤 - public static final String cd_04 = "04" ;//寮�闃� - public static final String cd_05 = "05" ;//鍏抽榾 - public static final String cd_06 = "06" ;//闃�闂ㄥ姩浣滅粨鏋� - - public static String getCodeName(String code) { - String name = (code.equals(cd_01) ? "瀹氭椂涓婃姤 " : - (code.equals(cd_02) ? "瑙﹀彂涓婃姤" : - (code.equals(cd_03) ? "浜嬩欢涓婃姤" : - (code.equals(cd_04) ? "寮�闃�" : - (code.equals(cd_05) ? "鍏抽榾" : - (code.equals(cd_06) ? "闃�闂ㄥ姩浣滅粨鏋�" : - "")))))) ; - return name ; - } - - /** - * 鏄惁涓烘湁鏁堝姛鑳界爜 - * @param code - * @return - */ - public static boolean isValid(String code){ - String name = getCodeName(code) ; - if(name != null && !name.equals("")){ - return true ; - } - return false ; - } -} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/CommonV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/CommonV1_0_1.java deleted file mode 100644 index 5d8478f..0000000 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/CommonV1_0_1.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1; - -import com.dy.common.util.ByteUtil; -import com.dy.common.util.ByteUtilUnsigned; - - -public class CommonV1_0_1 { - /** - * 妫�鏌ュご - * @param bs - * @return - * @throws Exception - */ - public Boolean isThisProtocolHead(byte[] bs) throws Exception{ - if(bs == null){ - return null ; - }else if(bs.length >= (ProtocolConstantV1_0_1.versionIndex + 1) - && bs[0] == ProtocolConstantV1_0_1.P_Head_Byte){ - String vs = this.parseVersion(bs) ; - if(vs.equals(ProtocolConstantV1_0_1.version)){ - return true ; - }else{ - return false ; - } - }else{ - return false ; - } - } - - /** - * 妫�鏌ュご - * @param bs - * @return - * @throws Exception - */ - public void checkHead(byte[] bs) throws Exception{ - if(bs.length >= 1 && bs[0] == ProtocolConstantV1_0_1.P_Head_Byte){ - return ; - }else{ - throw new Exception("涓婅鏁版嵁甯уご涓嶆纭紒") ; - } - } - - /** - * 妫�鏌ュ熬 - * @param bs - * @return - * @throws Exception - */ - public void checkTail(byte[] bs) throws Exception{ - if(bs.length >= 1 && bs[bs.length - 1] == ProtocolConstantV1_0_1.P_Tail_Byte){ - return ; - }else{ - throw new Exception("涓婅鏁版嵁灏句笉姝g‘锛�") ; - } - } - - - - /** - * 鏍¢獙鍜屾鏌� - * @param bs - * @param userdataLen - * @param hasPackages - * @return - * @throws Exception - */ - public boolean checkCrc(byte[] bs) throws Exception { - byte he = 0 ; - for(int i = 0 ; i <= bs.length - 3 ; i++){ - he = (byte)(he + bs[i]) ; - } - if(bs[bs.length - 2] == he){ - return true ; - }else{ - return false ; - } - } - - /** - * 鏍¢獙鍜屾鏌� - * @param bs - * @param userdataLen - * @param hasPackages - * @return - * @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){ - return null ; - }else{ - return "璁$畻鏍¢獙鍜屾槸:" + hes + "锛屼笂浼犳牎楠屽拰鏄�" + heOrg ; - } - } - - /** - * 鍒嗘瀽鐗堟湰鍙� - * @param bs - * @return - * @throws Exception - */ - public String parseVersion(byte[] bs)throws Exception{ - Short ver = ByteUtilUnsigned.byte2Byte(bs, ProtocolConstantV1_0_1.versionIndex) ; - char[] cs = ("" + ver).toCharArray() ; - String vs = "" ; - for(byte i = 0 ; i < cs.length; i++){ - if(i == 0){ - vs += "" + cs[i] ; - }else{ - vs += "." + cs[i] ; - } - } - return vs ; - } - - - /** - * 鍒嗘瀽鏁版嵁瀛楄妭鏁� - * @param bs - * @return - * @throws Exception - */ - public int parseDataLen(byte[] bs)throws Exception{ - return ByteUtilUnsigned.bytes2Short_BE(bs, ProtocolConstantV1_0_1.dataLenIndex_start) ; - } - - - /** - * 鍒嗘瀽IMEI鍙� - * @param bs - * @return - * @throws Exception - */ - public String parseRtuAddr(byte[] bs)throws Exception{ - return "" + ByteUtil.BCD2Long_BE(bs, ProtocolConstantV1_0_1.rtuAddrIndex_start, ProtocolConstantV1_0_1.rtuAddrIndex_end) ; - } - - - /** - * 鍒嗘瀽琛ㄥ彿 - * @param bs - * @return - * @throws Exception - */ - public String parseMeterNo(byte[] bs)throws Exception{ - return "" + ByteUtil.BCD2Long_BE(bs, ProtocolConstantV1_0_1.meterNoIndex_start, ProtocolConstantV1_0_1.meterNoIndex_end) ; - } - - - /** - * 鍒嗘瀽鍔熻兘鐮� - * @param bs - * @return - * @throws Exception - */ - public String parseCode(byte[] bs)throws Exception{ - return ByteUtil.bytes2Hex(bs, false, ProtocolConstantV1_0_1.codeIndex, 1) ; - } - -} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DataCd01Vo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DataCd01Vo.java deleted file mode 100644 index a9f2d76..0000000 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DataCd01Vo.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1; - -import java.util.List; - -//鍛ㄦ湡涓婃姤 -public class DataCd01Vo { - //浠ヤ笅鏁版嵁閮芥槸24锛�0锛夋椂鏁寸偣閲囬泦鐨勬暟鎹� - public String dt ;//涓婃姤鏃堕棿(鏍煎紡 yyyy-mm-dd hh:mm:ss) - public String dataDt ;//鏁版嵁鏃堕棿(鏍煎紡 yyyy-mm-dd) - public Float totalAmount ;//绱鐢ㄦ按閲� - public Float totalAmountPerDay ;//鏃ョ粨鐢ㄦ按閲� - public Float volt ;//鐢垫睜鐢靛帇 - public Float signal ;//淇″彿寮哄害 - public Byte valveSta ;//闃�闂ㄧ姸鎬�: 00闃�寮�锛�01闃�鍏� - public Byte alarmValve ;//闃�闂ㄦ姤璀�: 1鎶ヨ锛�0鏃� - public Byte alarmMagnetism ;//寮虹鎶ヨ: 1鎶ヨ锛�0鏃� - public Byte alarmVolt ;//鐢靛帇娆犲帇鎶ヨ: 1鎶ヨ锛�0鏃� - public List<Float> values ;//鍛ㄦ湡涓婃姤鏁版嵁 - public Short gap ;//瀵嗛噰鏁版嵁闂撮殧锛堝垎閽燂級 - - public boolean isAlarm(){ - boolean flag = false ; - if(valveSta != null && valveSta.intValue() == 1){//闃�闂ㄧ姸鎬�(0:闃�寮� 1:闃�鍏�) - flag = true ; - } - if(alarmValve != null && alarmValve.intValue() == 1){//闃�闂ㄥ紓甯稿憡璀� 1 闃�闂ㄥ紓甯革紝0 闃�闂ㄦ甯� - flag = true ; - } - if(alarmVolt != null && alarmVolt.intValue() == 1){//鐢垫睜娆犲帇鍛婅 1鍛婅锛�0鏃犲憡璀� - flag = true ; - } - if(alarmMagnetism != null && alarmMagnetism.intValue() == 1){//纾佸共鎵板憡璀� 1鍛婅锛�0鏃犲憡璀� - flag = true ; - } - return flag ; - } - public String toString(){ - StringBuffer sb = new StringBuffer() ; - sb.append(" 瀹氭椂涓婃姤 : \n") ; - sb.append(" 缁堢鏃堕棿 : " + dt + "\n") ; - sb.append(" 鏁版嵁鏃堕棿 : " + dataDt + "\n") ; - sb.append(" 鍐荤粨绱姘撮噺 : " + totalAmount + "\n") ; - sb.append(" 鏃ョ疮璁℃按閲� : " + totalAmountPerDay + "\n") ; - sb.append(" 鐢靛帇 : " + volt + "\n") ; - sb.append(" 淇″彿寮哄害 : " + signal + "\n") ; - sb.append(" 闃�闂ㄧ姸鎬� : " + valveSta + "锛�" + (valveSta==0?"闃�寮�":"闃�鍏�") + "锛塡n") ; - sb.append(" 闃�闂ㄦ姤璀� : " + alarmValve + "锛�" + (alarmValve==0?"姝e父":"鎶ヨ") + "锛塡n") ; - sb.append(" 寮虹鎶ヨ : " + alarmMagnetism + "锛�" + (alarmMagnetism==0?"姝e父":"鎶ヨ") + "锛塡n") ; - sb.append(" 娆犲帇鎶ヨ : " + alarmVolt + "锛�" + (alarmVolt==0?"姝e父":"鎶ヨ") + "锛塡n") ; - sb.append(" 瀵嗛噰鏁版嵁闂撮殧 : " + gap + "锛堝垎閽燂級\n") ; - sb.append(" 瀵嗛噰鏁版嵁锛歕n") ; - if(values != null && values.size() > 0){ - for(int i = 0 ; i < values.size(); i++){ - sb.append(" " + (i + 1) + "鏃剁敤姘撮噺锛�" + values.get(i) + "\n") ; - } - } - return sb.toString() ; - } - public String getDt() { - return dt; - } - public void setDt(String dt) { - this.dt = dt; - } - public String getDataDt() { - return dataDt; - } - public void setDataDt(String dataDt) { - this.dataDt = dataDt; - } - public Float getTotalAmount() { - return totalAmount; - } - public void setTotalAmount(Float totalAmount) { - this.totalAmount = totalAmount; - } - public Float getTotalAmountPerDay() { - return totalAmountPerDay; - } - public void setTotalAmountPerDay(Float totalAmountPerDay) { - this.totalAmountPerDay = totalAmountPerDay; - } - public Float getVolt() { - return volt; - } - public void setVolt(Float volt) { - this.volt = volt; - } - public Float getSignal() { - return signal; - } - public void setSignal(Float signal) { - this.signal = signal; - } - public Byte getValveSta() { - return valveSta; - } - public void setValveSta(Byte valveSta) { - this.valveSta = valveSta; - } - public Byte getAlarmValve() { - return alarmValve; - } - public void setAlarmValve(Byte alarmValve) { - this.alarmValve = alarmValve; - } - public Byte getAlarmMagnetism() { - return alarmMagnetism; - } - public void setAlarmMagnetism(Byte alarmMagnetism) { - this.alarmMagnetism = alarmMagnetism; - } - public Byte getAlarmVolt() { - return alarmVolt; - } - public void setAlarmVolt(Byte alarmVolt) { - this.alarmVolt = alarmVolt; - } - public List<Float> getValues() { - return values; - } - public void setValues(List<Float> values) { - this.values = values; - } - public Short getGap() { - return gap; - } - public void setGap(Short gap) { - this.gap = gap; - } - - -} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DataCd02Vo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DataCd02Vo.java deleted file mode 100644 index 99c9ee3..0000000 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DataCd02Vo.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1; - -//瀹炴椂(瑙﹀彂)涓婃姤 -public class DataCd02Vo { - //浠ヤ笅鏁版嵁閮芥槸涓婃姤鏃跺埢鐨勬暟鎹� - public String dt ;//涓婃姤鏃堕棿(鏍煎紡 yyyy-mm-dd hh:mm:ss) - public Float totalAmount ; - public Float volt ; - public Float signal ;//淇″彿寮哄害 - public Byte valveSta ;//闃�闂ㄧ姸鎬�: 00闃�寮�锛�01闃�鍏� - public Byte alarmValve ;//闃�闂ㄦ姤璀� - public Byte alarmMagnetism ;//寮虹鎶ヨ - public Byte alarmVolt ;//鐢靛帇娆犲帇鎶ヨ - - - public boolean isAlarm(){ - boolean flag = false ; - if(valveSta != null && valveSta.intValue() == 1){//闃�闂ㄧ姸鎬�(0:闃�寮� 1:闃�鍏�) - flag = true ; - } - if(alarmValve != null && alarmValve.intValue() == 1){//闃�闂ㄥ紓甯稿憡璀� 1 闃�闂ㄥ紓甯革紝0 闃�闂ㄦ甯� - flag = true ; - } - if(alarmVolt != null && alarmVolt.intValue() == 1){//鐢垫睜娆犲帇鍛婅 1鍛婅锛�0鏃犲憡璀� - flag = true ; - } - if(alarmMagnetism != null && alarmMagnetism.intValue() == 1){//纾佸共鎵板憡璀� 1鍛婅锛�0鏃犲憡璀� - flag = true ; - } - return flag ; - } - - public String toString(){ - StringBuffer sb = new StringBuffer() ; - sb.append(" 瑙﹀彂涓婃姤 : \n") ; - sb.append(" 缁堢鏃堕棿 : " + dt + "\n") ; - sb.append(" 鍐荤粨绱姘撮噺 : " + totalAmount + "\n") ; - sb.append(" 鐢靛帇 : " + volt + "\n") ; - sb.append(" 淇″彿寮哄害 : " + signal + "\n") ; - sb.append(" 闃�闂ㄧ姸鎬� : " + valveSta + "锛�" + (valveSta==0?"闃�寮�":"闃�鍏�") + "锛塡n") ; - sb.append(" 闃�闂ㄦ姤璀� : " + alarmValve + "锛�" + (alarmValve==0?"姝e父":"鎶ヨ") + "锛塡n") ; - sb.append(" 寮虹鎶ヨ : " + alarmMagnetism + "锛�" + (alarmMagnetism==0?"姝e父":"鎶ヨ") + "锛塡n") ; - sb.append(" 娆犲帇鎶ヨ : " + alarmVolt + "锛�" + (alarmVolt==0?"姝e父":"鎶ヨ") + "锛塡n") ; - return sb.toString() ; - } - public String getDt() { - return dt; - } - public void setDt(String dt) { - this.dt = dt; - } - public Float getTotalAmount() { - return totalAmount; - } - public void setTotalAmount(Float totalAmount) { - this.totalAmount = totalAmount; - } - public Float getVolt() { - return volt; - } - public void setVolt(Float volt) { - this.volt = volt; - } - public Float getSignal() { - return signal; - } - public void setSignal(Float signal) { - this.signal = signal; - } - public Byte getValveSta() { - return valveSta; - } - public void setValveSta(Byte valveSta) { - this.valveSta = valveSta; - } - public Byte getAlarmValve() { - return alarmValve; - } - public void setAlarmValve(Byte alarmValve) { - this.alarmValve = alarmValve; - } - public Byte getAlarmMagnetism() { - return alarmMagnetism; - } - public void setAlarmMagnetism(Byte alarmMagnetism) { - this.alarmMagnetism = alarmMagnetism; - } - public Byte getAlarmVolt() { - return alarmVolt; - } - public void setAlarmVolt(Byte alarmVolt) { - this.alarmVolt = alarmVolt; - } -} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DataCd03Vo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DataCd03Vo.java deleted file mode 100644 index 3331af9..0000000 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DataCd03Vo.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1; - -//浜嬩欢涓婃姤 -public class DataCd03Vo { - //浠ヤ笅鏁版嵁閮芥槸涓婃姤鏃跺埢鐨勬暟鎹� - public String dt ;//涓婃姤鏃堕棿(鏍煎紡 yyyy-mm-dd hh:mm:ss) - public Float volt ; - public Byte valveSta ;//闃�闂ㄧ姸鎬�: 00闃�寮�锛�01闃�鍏� - public Byte alarmValve ;//闃�闂ㄦ姤璀� - public Byte alarmMagnetism ;//寮虹鎶ヨ - public Byte alarmVolt ;//鐢靛帇娆犲帇鎶ヨ - - public boolean isAlarm(){ - boolean flag = false ; - if(valveSta != null && valveSta.intValue() == 1){//闃�闂ㄧ姸鎬�(0:闃�寮� 1:闃�鍏�) - flag = true ; - } - if(alarmValve != null && alarmValve.intValue() == 1){//闃�闂ㄥ紓甯稿憡璀� 1 闃�闂ㄥ紓甯革紝0 闃�闂ㄦ甯� - flag = true ; - } - if(alarmVolt != null && alarmVolt.intValue() == 1){//鐢垫睜娆犲帇鍛婅 1鍛婅锛�0鏃犲憡璀� - flag = true ; - } - if(alarmMagnetism != null && alarmMagnetism.intValue() == 1){//纾佸共鎵板憡璀� 1鍛婅锛�0鏃犲憡璀� - flag = true ; - } - return flag ; - } - - public String toString(){ - StringBuffer sb = new StringBuffer() ; - sb.append(" 浜嬩欢涓婃姤 : \n") ; - sb.append(" 缁堢鏃堕棿 : " + dt + "\n") ; - sb.append(" 鐢靛帇 : " + volt + "\n") ; - sb.append(" 闃�闂ㄧ姸鎬� : " + valveSta + "锛�" + (valveSta==0?"闃�寮�":"闃�鍏�") + "锛塡n") ; - sb.append(" 闃�闂ㄦ姤璀� : " + alarmValve + "锛�" + (alarmValve==0?"姝e父":"鎶ヨ") + "锛塡n") ; - sb.append(" 寮虹鎶ヨ : " + alarmMagnetism + "锛�" + (alarmMagnetism==0?"姝e父":"鎶ヨ") + "锛塡n") ; - sb.append(" 娆犲帇鎶ヨ : " + alarmVolt + "锛�" + (alarmVolt==0?"姝e父":"鎶ヨ") + "锛塡n") ; - return sb.toString() ; - } - public String getDt() { - return dt; - } - public void setDt(String dt) { - this.dt = dt; - } - public Float getVolt() { - return volt; - } - public void setVolt(Float volt) { - this.volt = volt; - } - public Byte getValveSta() { - return valveSta; - } - public void setValveSta(Byte valveSta) { - this.valveSta = valveSta; - } - public Byte getAlarmValve() { - return alarmValve; - } - public void setAlarmValve(Byte alarmValve) { - this.alarmValve = alarmValve; - } - public Byte getAlarmMagnetism() { - return alarmMagnetism; - } - public void setAlarmMagnetism(Byte alarmMagnetism) { - this.alarmMagnetism = alarmMagnetism; - } - public Byte getAlarmVolt() { - return alarmVolt; - } - public void setAlarmVolt(Byte alarmVolt) { - this.alarmVolt = alarmVolt; - } - -} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DataCd0405Vo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DataCd0405Vo.java deleted file mode 100644 index 4b43380..0000000 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DataCd0405Vo.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1; - -public class DataCd0405Vo { - - public Byte open1_close2 ;//寮�闃�鏄�1锛屽叧闃�鏄�2 - - public Byte state ;//寮�鍏抽榾鎿嶄綔缁撴灉锛氬紑鍏冲埌浣嶏細01H锛� 寮�鍏宠秴鏃讹細02H 鐢垫祦瓒呴檺锛�03H - - //浠ヤ笅鏁版嵁閮芥槸涓婃姤鏃跺埢鐨勬暟鎹� - public String dt ;//涓婃姤鏃堕棿(鏍煎紡 yyyy-mm-dd hh:mm:ss) - - public String toString(){ - StringBuffer sb = new StringBuffer() ; - if(open1_close2 != null && open1_close2.byteValue() == 1){ - if(state != null && state.byteValue() == 1){ - sb.append(" 寮�闃�缁撴灉 : 寮�鍒颁綅\n") ; - }else if(state != null && state.byteValue() == 2){ - sb.append(" 寮�闃�缁撴灉 : 瓒呮椂\n") ; - }else if(state != null && state.byteValue() == 2){ - sb.append(" 寮�闃�缁撴灉 : 鐢垫祦瓒呴檺\n") ; - } - }else if(open1_close2 != null && open1_close2.byteValue() == 2){ - if(state != null && state.byteValue() == 1){ - sb.append(" 鍏抽榾缁撴灉 : 鍏冲埌浣峔n") ; - }else if(state != null && state.byteValue() == 2){ - sb.append(" 鍏抽榾缁撴灉 : 瓒呮椂\n") ; - }else if(state != null && state.byteValue() == 2){ - sb.append(" 鍏抽榾缁撴灉 : 鐢垫祦瓒呴檺\n") ; - } - } - sb.append(" 缁堢鏃堕棿 : " + dt + "\n") ; - return sb.toString() ; - } - - /** - * 鐢卞叾浜х敓鍛戒护鏃ュ織锛屽苟瀛樺偍鍒版暟鎹簱涓� - * @return - */ - public String resultInfo(){ - StringBuffer sb = new StringBuffer() ; - if(open1_close2 != null && open1_close2.byteValue() == 1){ - if(state != null && state.byteValue() == 1){ - sb.append(" 寮�闃�缁撴灉 : 寮�鍒颁綅\n") ; - }else if(state != null && state.byteValue() == 2){ - sb.append(" 寮�闃�缁撴灉 : 瓒呮椂\n") ; - }else if(state != null && state.byteValue() == 2){ - sb.append(" 寮�闃�缁撴灉 : 鐢垫祦瓒呴檺\n") ; - } - }else if(open1_close2 != null && open1_close2.byteValue() == 2){ - if(state != null && state.byteValue() == 1){ - sb.append(" 鍏抽榾缁撴灉 : 鍏冲埌浣峔n") ; - }else if(state != null && state.byteValue() == 2){ - sb.append(" 鍏抽榾缁撴灉 : 瓒呮椂\n") ; - }else if(state != null && state.byteValue() == 2){ - sb.append(" 鍏抽榾缁撴灉 : 鐢垫祦瓒呴檺\n") ; - } - } - sb.append(" 缁堢鏃堕棿 : " + dt + "\n") ; - return sb.toString() ; - } - - public Byte getOpen1_close2() { - return open1_close2; - } - public void setOpen1_close2(Byte open1_close2) { - this.open1_close2 = open1_close2; - } - public Byte getState() { - return state; - } - public void setState(Byte sate) { - this.state = sate; - } - public String getDt() { - return dt; - } - public void setDt(String dt) { - this.dt = dt; - } - -} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DataCd06Vo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DataCd06Vo.java deleted file mode 100644 index a4784fd..0000000 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DataCd06Vo.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1; - -//寮�鍏抽榾缁撴灉涓婃姤 -public class DataCd06Vo { - public String dt ;//涓婃姤鏃堕棿(鏍煎紡 yyyy-mm-dd hh:mm:ss) - public Byte valveRes ;//闃�闂ㄥ姩浣滅粨鏋�: //0, 鍏冲埌浣�; 1, 寮�鍒颁綅; 2, 瓒呮椂; 3, 鍫佃浆; 4, 娲楅榾鎴愬姛 - - public boolean isAlarm(){ - if(valveRes != null && (valveRes.intValue() == 2 || valveRes.intValue() == 3)){//2 瓒呮椂 3鍫佃浆 - return true ; - } - return false ; - } - - public String toString(){ - StringBuffer sb = new StringBuffer() ; - sb.append(" 寮�鍏抽榾缁撴灉涓婃姤 : \n") ; - sb.append(" 缁堢鏃堕棿 : " + dt + "\n") ; - sb.append(" 闃�闂ㄥ姩浣滅粨鏋� : " + valveRes + "锛�" + (valveRes==0?"鍏冲埌浣�":(valveRes==1?"寮�鍒颁綅":(valveRes==2?"瓒呮椂":(valveRes==3?"鍫佃浆":(valveRes==4?"娲楅榾鎴愬姛":""))))) + "锛塡n") ; - return sb.toString() ; - } - - public String getDt() { - return dt; - } - - public void setDt(String dt) { - this.dt = dt; - } - - public Byte getValveRes() { - return valveRes; - } - - public void setValveRes(Byte valveRes) { - this.valveRes = valveRes; - } - - - -} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DataV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DataV1_0_1.java deleted file mode 100644 index 5f9d4cf..0000000 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DataV1_0_1.java +++ /dev/null @@ -1,136 +0,0 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1; - -public class DataV1_0_1 implements java.io.Serializable{ - - private static final long serialVersionUID = 202211271110001L; - - public static String ALIAS = DataV1_0_1.class.getName() ; - - public String rtuAddr ;//RtuAddr - public String meterNo ;//姘磋〃鍙� - public String version ;//鍗忚鐗堟湰鍙� - - public DataCd01Vo dataCd01Vo ;//鍛ㄦ湡涓婃姤鏁版嵁 - public DataCd02Vo dataCd02Vo ;//瀹炴椂锛堣Е鍙戯級涓婃姤鏁版嵁 - public DataCd03Vo dataCd03Vo ;//浜嬩欢鎶� - public DataCd0405Vo dataCd0405Vo ;//寮�鍏抽榾鍥炴墽 - public DataCd06Vo dataCd06Vo ;//寮�鍏抽榾缁撴灉 - - public String dt ;//閫氫俊涓棿浠朵骇鐢熷彂鎶ユ椂闂�(yyyy-MM-dd hh:mm:ss) - - - public String toString(){ - StringBuffer sb = new StringBuffer() ; - sb.append(" 鐢典俊IMEI鍙� : " + (rtuAddr==null?"":rtuAddr) + "\n") ; - sb.append(" 姘磋〃鍙� : " + (meterNo==null?"":meterNo) + "\n") ; - sb.append(" 鍗忚鐗堟湰鍙�:" + version + "\n") ; - sb.append(" 缁堢鏁版嵁:\n") ; - if(dataCd01Vo != null){ - sb.append(dataCd01Vo.toString()) ; - } - if(dataCd02Vo != null){ - sb.append(dataCd02Vo.toString()) ; - } - if(dataCd03Vo != null){ - sb.append(dataCd03Vo.toString()) ; - } - if(dataCd0405Vo != null){ - sb.append(dataCd0405Vo.toString()) ; - } - if(dataCd06Vo != null){ - sb.append(dataCd06Vo.toString()) ; - } - return sb.toString() ; - } - - /** - * 鐢卞叾浜х敓鍛戒护鏃ュ織 - * @return - */ - public String resultInfo(){ - if(dataCd0405Vo != null){ - return dataCd0405Vo.resultInfo() ; - } - return "" ; - } - - - public String getRtuAddr() { - return rtuAddr; - } - public void setRtuAddr(String rtuAddr) { - this.rtuAddr = rtuAddr; - } - - public String getMeterNo() { - return meterNo; - } - - - public void setMeterNo(String meterNo) { - this.meterNo = meterNo; - } - - - public String getVersion() { - return version; - } - public void setVersion(String version) { - this.version = version; - } - public String getDt() { - return dt; - } - public void setDt(String dt) { - this.dt = dt; - } - - - public DataCd01Vo getDataCd01Vo() { - return dataCd01Vo; - } - - - public void setDataCd01Vo(DataCd01Vo dataCd01Vo) { - this.dataCd01Vo = dataCd01Vo; - } - - - public DataCd02Vo getDataCd02Vo() { - return dataCd02Vo; - } - - - public void setDataCd02Vo(DataCd02Vo dataCd02Vo) { - this.dataCd02Vo = dataCd02Vo; - } - - - public DataCd03Vo getDataCd03Vo() { - return dataCd03Vo; - } - - - public void setDataCd03Vo(DataCd03Vo dataCd03Vo) { - this.dataCd03Vo = dataCd03Vo; - } - - - public DataCd0405Vo getDataCd0405Vo() { - return dataCd0405Vo; - } - - - public void setDataCd0405Vo(DataCd0405Vo dataCd0405Vo) { - this.dataCd0405Vo = dataCd0405Vo; - } - - public DataCd06Vo getDataCd06Vo() { - return dataCd06Vo; - } - - public void setDataCd06Vo(DataCd06Vo dataCd06Vo) { - this.dataCd06Vo = dataCd06Vo; - } - -} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DriverV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DriverV1_0_1.java deleted file mode 100644 index a3a1648..0000000 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/DriverV1_0_1.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1; - -import java.net.URI; -import java.net.URL; - -import com.dy.common.mw.protocol.AnnotationDriver; -import com.dy.common.mw.protocol.CodeParse; -import com.dy.common.mw.protocol.CodeParseCallback; -import com.dy.common.mw.protocol.Command; -import com.dy.common.mw.protocol.Data; -import com.dy.common.mw.protocol.Driver; -import com.dy.common.mw.protocol.DriverParserDataCallback; -import com.dy.common.mw.protocol.MidResult; -import com.dy.common.mw.protocol.MidResultError; -import com.dy.common.util.DateTime; - -@AnnotationDriver(name=ProtocolConstantV1_0_1.protocolName) -public class DriverV1_0_1 extends Driver { - - private static String scanRootPackage = "com.dy.common.mw.protocol.pMeterV1_0_1." ; - - //鍦―river涓槸鍗曚緥锛岄殢Driver鐨勫崟渚嬪璞″湪鍗曠嚎绋嬩腑杩愯 - private ParseParamsForUpV1_0_1 upCpParams ; - private ParseParamsForDownV1_0_1 downCpParams ; - - private Boolean reportOrResponse_trueOrFalse = null ; - private String rtuAddrInData = null ; - private String meterNoInData = null ; - - public DriverV1_0_1(){ - upCpParams = new ParseParamsForUpV1_0_1() ; - downCpParams = new ParseParamsForDownV1_0_1() ; - } - - - /** - * 鎵弿璇嗗埆鍔熻兘鐮佹敞瑙g被 - */ - @Override - public void scanAnnotationCode() throws Exception{ - if(!scanRootPackage.endsWith(".")){ - scanRootPackage += "." ; - } - URL url = this.getClass().getResource("/" + scanRootPackage.replace('.', '/')); - URI uri = new URI(url.toString()); - super.doScanAnnotationCode(this, ProtocolConstantV1_0_1.protocolName, uri, scanRootPackage) ; - } - /** - * 瑙f瀽涓婅鏁版嵁 - * @param isLowPower 鏄惁鍦ㄤ綆鍔熻�楃幆澧冧笅杩愯 - * @param rtuAddr - * @param upBuffer - * @param callback - * @param upHex - * @return - */ - @Override - public MidResult[] parseData(Boolean isLowPower, String rtuAddr, byte[] upBuffer, String upHex, DriverParserDataCallback callback, Object... params) { - return parseData(isLowPower, rtuAddr, null, null, upBuffer, upHex, callback) ; - } - /** - * 瑙f瀽涓婅鏁版嵁 - * @param isLowPower 鏄惁鍦ㄤ綆鍔熻�楃幆澧冧笅杩愯 - * @param rtuAddr - * @param productId 鐢典俊骞冲彴浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴涓繍琛屾椂锛屼负null - * @param deviceId 鐢典俊骞冲彴璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴涓繍琛屾椂锛屼负null - * @param upBuffer - * @param callback - * @param upHex - * @return - */ - @Override - public MidResult[] parseData(Boolean isLowPower, String rtuAddr, Integer productId, String deviceId, byte[] upBuffer, String upHex, DriverParserDataCallback callback, Object... params) { - reportOrResponse_trueOrFalse = null ; - boolean isFail = false ; - String meterNo = null ; - String upCode = "" ; - try{ - CommonV1_0_1 cp = new CommonV1_0_1() ; - cp.checkHead(upBuffer) ; - cp.checkTail(upBuffer) ; - String crcStr = cp.checkCrc_str(upBuffer) ; - if(crcStr != null){ - return new MidResult[]{(new MidResultError(ProtocolConstantV1_0_1.protocolName, rtuAddr, null, "涓ラ噸閿欒锛屼笂琛屾暟鎹瓹RC妫�鏌ュけ璐ワ紝" + crcStr, null))} ; - } - rtuAddr = cp.parseRtuAddr(upBuffer) ; - upCode = cp.parseCode(upBuffer) ; - if(upCode == null){ - return new MidResult[]{(new MidResultError(ProtocolConstantV1_0_1.protocolName, rtuAddr, null, "涓ラ噸閿欒锛屾湭鑳戒粠涓婅鏁版嵁涓В鏋愬嚭鍔熻兘鐮侊紒", null))} ; - } - //Integer dataLen = cp.parseFrameLen(upBuffer) ; - Data upData = new Data() ; - upData.setRtuAddr(rtuAddr) ; - meterNo = cp.parseMeterNo(upBuffer) ; - upData.setMeterNo(meterNo) ; - upData.setProtocol(ProtocolConstantV1_0_1.protocolName); - upData.setCode(upCode) ; - upData.setHex(upHex) ; - - - DataV1_0_1 dV1_0_1 = new DataV1_0_1() ; - dV1_0_1.version = cp.parseVersion(upBuffer) ; - dV1_0_1.rtuAddr = rtuAddr ; - dV1_0_1.meterNo = meterNo ; - dV1_0_1.meterNo = cp.parseMeterNo(upBuffer) ; - dV1_0_1.dt = DateTime.yyyy_MM_dd_HH_mm_ss() ; - - upData.setSubData(dV1_0_1) ; - - this.upCpParams.clear(); - this.upCpParams.setValue(ProtocolConstantV1_0_1.protocolName, - rtuAddr, - meterNo, - productId, - deviceId, - upCode, - upHex, - upBuffer, - upData); - CodeParse codeParse = this.getUpCodeParser(upCode) ; - if(codeParse == null){ - return new MidResult[]{(new MidResultError(ProtocolConstantV1_0_1.protocolName, rtuAddr, meterNo, "涓ラ噸閿欒锛屾湭鑳藉緱鍒颁笂琛屾暟鎹姛鑳界爜" + upCode + "澶勭悊绫�!", null))} ; - }else{ - return codeParse.parse(isLowPower, this.upCpParams, new CodeParseCallback(){ - @Override - public void callback(Boolean flag) { - reportOrResponse_trueOrFalse = flag ; - rtuAddrInData = dV1_0_1.getRtuAddr() ; - meterNoInData = dV1_0_1.getMeterNo() ; - } - }); - } - - } catch (Exception e) { - isFail = true ; - return new MidResult[]{(new MidResultError(ProtocolConstantV1_0_1.protocolName, rtuAddr, meterNo, "涓ラ噸閿欒锛屽垎鏋怰tu鏁版嵁鍑洪敊锛佹暟鎹负锛�" + upHex + (e.getMessage() == null?"":("锛屽嚭閿欎俊鎭細" + e.getMessage())), e))} ; - } finally{ - callback.callback(rtuAddr, meterNo, upCode, upHex, reportOrResponse_trueOrFalse, isFail, rtuAddrInData, meterNoInData); - } - } - /** - * 鏋勯�犱笅琛屾暟鎹紙鍛戒护锛� - * @param isLowPower 鏄惁鍦ㄤ綆鍔熻�楃幆澧冧笅杩愯 - * @param command 鍛戒护 - * @return - */ - @Override - public MidResult[] createCommand(Boolean isLowPower, Command command, Object... params) { - String rtuAddr = command.getRtuAddr() ; - if(rtuAddr == null){ - return new MidResult[]{(new MidResultError(ProtocolConstantV1_0_1.protocolName, null, null, "涓ラ噸閿欒锛屽懡浠や腑IMEI鍙蜂负绌猴紝涓嶈兘鏋勫缓浠讳綍鍛戒护锛�", null))} ; - } - String meterNo = command.getMeterNo() ; - if(meterNo == null){ - return new MidResult[]{(new MidResultError(ProtocolConstantV1_0_1.protocolName, null, null, "涓ラ噸閿欒锛屽懡浠や腑姘磋〃鍙蜂负绌猴紝涓嶈兘鏋勫缓浠讳綍鍛戒护锛�", null))} ; - } - try { - String commandCode = command.getCode() ; - - this.downCpParams.clear(); - this.downCpParams.setValue( - ProtocolConstantV1_0_1.protocolName, - rtuAddr, - meterNo, - command.getProductId(), //鐢典俊骞冲彴浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - command.getDeviceId(), //鐢典俊骞冲彴璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - command.getId(), - commandCode, - command.getParam(), - command.getAttachment()); - - if(commandCode == null){ - return new MidResult[]{(new MidResultError(ProtocolConstantV1_0_1.protocolName, rtuAddr, meterNo, "涓ラ噸閿欒锛屽懡浠や腑鍔熻兘鐮佷负绌猴紝涓嶈兘鏋勫缓浠讳綍鍛戒护锛�", null))} ; - }else{ - CodeParse codeParse = this.getDownCodeParser(commandCode) ; - if(codeParse == null){ - return new MidResult[]{(new MidResultError(ProtocolConstantV1_0_1.protocolName, rtuAddr, meterNo, "涓ラ噸閿欒锛屾湭鑳藉緱鍒颁笅琛屾暟鎹姛鑳界爜" + commandCode + "澶勭悊绫�!", null))} ; - }else{ - return codeParse.parse(isLowPower, this.downCpParams, null); - } - } - } catch (Exception e) { - return new MidResult[]{(new MidResultError(ProtocolConstantV1_0_1.protocolName, rtuAddr, meterNo, "涓ラ噸閿欒锛屾瀯閫犱笅琛屾暟鎹嚭閿欙紒鍛戒护涓猴細" + command.toString(), e))} ; - } - } - - -} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/ParseParamsForDownV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/ParseParamsForDownV1_0_1.java deleted file mode 100644 index 862ab0c..0000000 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/ParseParamsForDownV1_0_1.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1; - -import com.dy.common.mw.protocol.CodeParseParams; - -public class ParseParamsForDownV1_0_1 implements CodeParseParams{ - - public String protocolName ; - public String rtuAddr ;//IMEI鍙凤紙鐢典俊骞冲彴璁惧IMEI锛� - public String meterNo ;//姘磋〃鍙� - public Integer productId ;//鐢典俊骞冲彴浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - public String deviceId ;//鐢典俊骞冲彴璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - public String commandId ; - public String commandCode ; - public Object param ; - public Object attachment ; - - public ParseParamsForDownV1_0_1(){} - - public void clear(){ - this.protocolName = null ; - this.rtuAddr = null ; - this.meterNo = null ; - this.productId = null ; - this.deviceId = null ; - this.commandId = null ; - this.commandCode = null ; - this.param = null ; - this.attachment = null ; - } - - public void setValue( - String protocolName, - String rtuAddr, - String meterNo, - Integer productId, - String deviceId, - String commandId, - String commandCode, - Object param, - Object attachment ){ - this.protocolName = protocolName ; - this.rtuAddr = rtuAddr ; - this.meterNo = meterNo ; - this.productId = productId ; - this.deviceId = deviceId ; - this.commandId = commandId ; - this.commandCode = commandCode ; - this.param = param ; - this.attachment = attachment ; - } - -} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/ParseParamsForUpV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/ParseParamsForUpV1_0_1.java deleted file mode 100644 index 988ddc1..0000000 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/ParseParamsForUpV1_0_1.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1; - -import com.dy.common.mw.protocol.CodeParseParams; -import com.dy.common.mw.protocol.Data; - -public class ParseParamsForUpV1_0_1 implements CodeParseParams{ - - public String protocolName ;//鍗忚鍚嶇О - public String rtuAddr ;//IMEI鍙�(IMEI鍙�) - public String meterNo ;//姘磋〃鍙� - public Integer productId ;//鐢典俊骞冲彴浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - public String deviceId ;//鐢典俊骞冲彴璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - public String upCode ;//涓婅鎶ユ枃鏁版嵁涓殑鍔熻兘鐮� - public String upHex ;//琛屾姤鏂囨暟鎹崄鍏繘鍒跺舰寮� - public byte[] upBuffer ;//琛屾姤鏂囨暟鎹瓧鑺傛暟缁� - public Data data ;//瑙f瀽鍚庣殑鏁版嵁 - - public ParseParamsForUpV1_0_1(){} - - public void clear(){ - this.protocolName = null ; - this.rtuAddr = null ; - this.meterNo = null ; - this.productId = null ; - this.deviceId = null ; - this.upCode = null ; - this.upHex = null ; - this.upBuffer = null ; - this.data = null ; - } - - public void setValue(String protocolName, - String rtuAddr, - String meterNo, - Integer productId, - String deviceId, - String upCode, - String upHex, - byte[] upBuffer, - Data data){ - this.protocolName = protocolName ; - this.rtuAddr = rtuAddr ; - this.meterNo = meterNo ; - this.productId = productId ; - this.deviceId = deviceId ; - this.upCode = upCode ; - this.upHex = upHex ; - this.upBuffer = upBuffer ; - this.data = data ; - } -} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/ProtocolConstantV1_0_1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/ProtocolConstantV1_0_1.java deleted file mode 100644 index a12d6ff..0000000 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/ProtocolConstantV1_0_1.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1; - -public class ProtocolConstantV1_0_1 { - - public static final String version = "1.0.1" ; - public static final Byte versionByte = 101 ; - - /** - * 娉ㄨВ鐩稿叧 - */ - public static final String protocolName = "meterV1_0_1" ; - public static final int priority = 1 ;//浼樺厛绾� - /** - * RTU涓婄嚎鏁版嵁锛堜笂绾垮悗绗竴鍖呮暟鎹級鏈�灏忛暱搴︼紝璁剧疆璇ュ睘鎬т互澶囪繘琛屽畬鏁存�ф鏌ワ紝 - * 鍗虫柇鍖呮鏌ワ紝浣垮敖鍙兘鏀跺叏涓婄嚎鏁版嵁锛堝彇鍊艰寖鍥�1-100锛� - */ - public static final int onLineDataMinLength = 30 ;//閲囩敤闃�鎺у洖鎵э紙鍏堕暱搴︽渶鐭級鐨勫瓧鑺傛暟 - - /** - * RTU涓婃姤鏁版嵁鐨勫ご閮ㄦ渶灏忛暱搴︼紝涓婃姤鏁版嵁涓紝鍙栬繖涓渶灏忛暱搴︾殑閮ㄥ垎鏁版嵁涓紝 - * 瑕佷竴瀹氬寘鍚暟鎹抚闀垮害锛屼互澶囧彇鍑烘暟鎹抚闀垮害鏉ワ紝杩涜瀹屾暣鎬ф鏌ワ紝 - * 鍗虫柇鍖呬笌绮樺寘妫�鏌�(鍙栧�艰寖鍥�0-100锛屽叾涓彇鍊间负0鏃讹紝琛ㄧずheadMinLength鏁版嵁鏃犱綔鐢紝鐢卞崗璁疄鐜版潵鎺у埗) - */ - public static final int headMinLength = 3 ; - - - //甯ц捣濮� - public static final byte P_Head_Byte = (byte)0x68 ; - public static final byte P_Tail_Byte = (byte)0x16 ; - - public static final String P_Head_Hex = "68" ; - public static final String P_Tail_Hex = "16" ; - - public static final byte downBsHeadLen = 21 ;//涓嬭鏁版嵁澶撮儴(寮�濮嬭嚦鍔熻兘鐮佹墍鍦ㄥ瓧鑺�) - public static final byte downBsTailLen = 2 ;//涓嬭鏁版嵁灏鹃儴(鏍¢獙鍜屾墍鍦ㄥ瓧鑺傝嚦鏈�鍚�) - - /** - * 鎵�鍦ㄥ瓧鑺傛暟缁勭殑浣嶇疆锛堜笅鏍囷級 - */ - public static final int dataLenIndex_start = 1 ;//甯ч暱搴︽墍鍦� 瀛楄妭鏁扮粍璧峰涓嬫爣 - public static final int dataLenIndex_end = 2 ;//甯ч暱搴︽墍鍦� 瀛楄妭鏁扮粍鎴涓嬫爣 - public static final int versionIndex = 3 ;//鐗堟湰鍙峰瓧鑺傛暟缁勪笅鏍� - public static final int rtuAddrIndex_start = 4 ;//閫氳妯″潡 IMEI 璧峰瀛楄妭鏁扮粍涓嬫爣 - public static final int rtuAddrIndex_end = 11 ;//閫氳妯″潡 IMEI 鎴瀛楄妭鏁扮粍涓嬫爣 - public static final int meterNoIndex_start = 12 ;//琛ㄥ彿璧峰瀛楄妭鏁扮粍涓嬫爣 - public static final int meterNoIndex_end = 19 ;//琛ㄥ彿鎴瀛楄妭鏁扮粍涓嬫爣 - public static final int codeIndex = 20 ;//鍔熻兘鐮佸瓧鑺傛暟缁勪笅鏍� - //public static final int dtIndex_start = 13 ;////鏃ユ湡寮�濮嬪瓧鑺傛暟缁勪笅鏍� - //public static final int dtIndex_end = 18 ;////鏃ユ湡鎴瀛楄妭鏁扮粍涓嬫爣 - //public static final int signalIndex_start = 28 ;//淇″彿寮哄害寮�濮嬪瓧鑺傛暟缁勪笅鏍� - //public static final int signalIndex_end = 29 ;//淇″彿寮哄害鎴瀛楄妭鏁扮粍涓嬫爣 - - -} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_01_Up.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_01_Up.java deleted file mode 100644 index 0c47f3b..0000000 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_01_Up.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1.parse; - -import java.util.ArrayList; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.dy.common.mw.protocol.AnnotationCodeUp; -import com.dy.common.mw.protocol.CodeParse; -import com.dy.common.mw.protocol.CodeParseCallback; -import com.dy.common.mw.protocol.CodeParseParams; -import com.dy.common.mw.protocol.Command; -import com.dy.common.mw.protocol.Data; -import com.dy.common.mw.protocol.MidResult; -import com.dy.common.mw.protocol.MidResultFromRtu; -import com.dy.common.mw.protocol.MidResultToRtu; -import com.dy.common.mw.protocol.pMeterV1_0_1.*; -import com.dy.common.util.ByteUtil; -import com.dy.common.util.ByteUtilUnsigned; -import com.dy.common.util.DateTime; - -@AnnotationCodeUp(ifAny={ - CodeV1_0_1.cd_01 -}) -public class Cd_01_Up implements CodeParse{ - - private static Logger log = LogManager.getLogger(Cd_01_Up.class); - - /** - * 鍒嗘瀽涓婅鏁版嵁 - */ - @Override - public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception { - ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ; - int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ; - if(bsLen > 0){ - this.doParse(para.upBuffer, - bsLen, - para.upCode, - para.data) ; - } - log.info("鍒嗘瀽涓婅鏁版嵁<" + CodeV1_0_1.getCodeName(para.upCode) + " 姘磋〃鍙�=" + para.meterNo + ">:\n" + para.data.toString()); - - MidResultFromRtu midRs = new MidResultFromRtu() ; - midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О - midRs.rtuAddr = para.rtuAddr ;//IMEI鍙� - midRs.meterNo = para.meterNo ;//姘磋〃鍙� - midRs.productId = para.productId ;//鐢典俊骞冲彴浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - midRs.deviceId = para.deviceId ;//鐢典俊骞冲彴璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - midRs.upCode = para.upCode ;//涓婅鏁版嵁涓殑鍔熻兘鐮� - midRs.upHex = para.upHex ;//涓婅鏁版嵁鍗佸叚杩涘埗褰㈠紡 - midRs.upBuffer = para.upBuffer ;//涓婅鏁版嵁瀛楄妭鏁扮粍 - midRs.data = para.data ;//瑙f瀽鍚庣殑鏁版嵁 - - midRs.reportOrResponse_trueOrFalse = true ;//涓诲姩涓婃姤 - - String confirmComCode = CodeV1_0_1.cd_01 ; - ParseParamsForDownV1_0_1 downCpParams = new ParseParamsForDownV1_0_1() ; - downCpParams.setValue( - ProtocolConstantV1_0_1.protocolName, - para.rtuAddr, - para.meterNo, - para.productId, - para.deviceId, - Command.defaultId, - confirmComCode, - null, - null); - //鏋勯�犱笂鎶ョ‘璁ゅ簲绛� - byte[] data = new Cd_XY_Down().doParse(downCpParams) ; - - MidResultToRtu confirmCommand = new MidResultToRtu() ; - confirmCommand.protocolName = para.protocolName ;//鍗忚鍚嶇О - confirmCommand.rtuAddr = para.rtuAddr ;//IMEI鍙� - confirmCommand.meterNo = para.meterNo ;//姘磋〃鍙� - confirmCommand.productId = para.productId ;//鐢典俊骞冲彴浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - confirmCommand.deviceId = para.deviceId ;//鐢典俊骞冲彴璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - confirmCommand.commandId = Command.defaultId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉 - confirmCommand.downCode = confirmComCode ;//涓嬭鍛戒护鍔熻兘鐮�; - confirmCommand.downBuffer = data ;//涓嬭鍛戒护鏁版嵁 - confirmCommand.downBufHex = ByteUtil.bytes2Hex(data, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡 - confirmCommand.hasResponse = false ;//鏄惁鏈夊簲绛� - confirmCommand.maxSendTimes = 1 ;//鍛戒护鏈�澶у彂閫佹鏁�(褰撴敹涓嶅埌搴旂瓟鏃讹紝灏嗛噸鍙�2娆�)锛屽鏋滀笉璁剧疆锛屽懡浠ょ紦瀛樺櫒杩涜琛ュ厖璁剧疆 - confirmCommand.isSendFirst = true ;//纭鍛戒护锛屼紭鍏堝彂閫� - confirmCommand.isCachForOffLine = false ;//RTU涓嶅湪绾匡紝鍛戒护鏄惁缂撳瓨 - - callback.callback(midRs.reportOrResponse_trueOrFalse); - return new MidResult[]{midRs, confirmCommand} ; - } - /** - * 鎵ц鍒嗘瀽 - * @param bs - * @param bsLen瀛楄妭闀垮害锛堟�诲寘闀匡紝鍖呮嫭鍖呭ご鍜屽寘灏撅級 - * @param dataCode - * @param index - * @param contentDataEndIndex - * @param data - * @throws Exception - */ - protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { - DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ; - DataCd01Vo cdData = new DataCd01Vo() ; - dV1.dataCd01Vo = cdData ; - - int index = ProtocolConstantV1_0_1.codeIndex + 1 ; - - cdData.dt = "20" + ByteUtil.BCD2String_BE(bs, index, index++) - + "-" + ByteUtil.BCD2String_BE(bs, index, index++) - + "-" + ByteUtil.BCD2String_BE(bs, index, index++) - + " " + ByteUtil.BCD2String_BE(bs, index, index++) - + ":" + ByteUtil.BCD2String_BE(bs, index, index++) - + ":" + ByteUtil.BCD2String_BE(bs, index, index) ; - int[] ymdhms = DateTime.yyyy_MM_dd_HH_MM_SS_2_ymdhmsGroup(cdData.dt) ; - String yesterday = DateTime.yesterday_yyyy_MM_dd(ymdhms[0], ymdhms[1], ymdhms[2]); - cdData.dataDt = yesterday ; - - index++ ; - if(!ByteUtilUnsigned.bytesIsAll0xFF(bs, index, 4)){ - //褰揜TU瀹炴涓婃姤鏃讹紝鍥犳湭鍒濆鍖栦笂鎶ョ殑鏄� 0xFFFF - cdData.totalAmount = ByteUtilUnsigned.bytes2Int_BE(bs, index)/100.0f ; - }else{ - cdData.totalAmount = 0.0f ; - } - - index += 4 ; - if(!ByteUtilUnsigned.bytesIsAll0xFF(bs, index, 4)){ - //褰揜TU瀹炴涓婃姤鏃讹紝鍥犳湭鍒濆鍖栦笂鎶ョ殑鏄� 0xFFFF - cdData.totalAmountPerDay = ByteUtilUnsigned.bytes2Int_BE(bs, index)/100.0f ; - }else{ - cdData.totalAmountPerDay = 0.0f ; - } - - index += 4 ; - cdData.volt = ByteUtilUnsigned.byte2Byte(bs, index)/10.0f ; - - index += 1 ; - cdData.signal = 0.0f + ByteUtilUnsigned.bytes2Short_BE(bs, index) ; - - index += 2 ; - byte staAlarm = bs[index] ; - cdData.valveSta = (byte)(staAlarm & 1) ; - staAlarm = (byte)(staAlarm >> 2) ; - cdData.alarmValve = (byte)(staAlarm & 1) ; - staAlarm = (byte)(staAlarm >> 1) ; - cdData.alarmMagnetism = (byte)(staAlarm & 1) ; - staAlarm = (byte)(staAlarm >> 1) ; - cdData.alarmVolt = (byte)(staAlarm & 1) ; - - index++ ; - cdData.values = new ArrayList<Float>() ; - for(byte i = 0; (i < (byte)24 && index < (bsLen - 2)); i++){ - if(!ByteUtilUnsigned.bytesIsAll0xFF(bs, index, 2)){ - //褰揜TU瀹炴涓婃姤鏃讹紝鍥犳湭鍒濆鍖栦笂鎶ョ殑鏄� 0xFFFF - Integer v = ByteUtilUnsigned.bytes2Short_BE(bs, index) ; - if(v >= Integer.MAX_VALUE){ - //鏍规嵁鍗忚锛屽綋缁堢娌℃湁璁板綍鏁版嵁锛屾暟鎹唴瀹规槸ffff ffff - v = 0 ; - } - cdData.values.add(v/100.0f) ; - }else{ - cdData.values.add(0.0f) ; - } - index += 2 ; - } - - cdData.gap = 60 ;//鏍规嵁褰撳墠姘磋〃瀹炵幇锛屽瘑閲囨暟鎹噰闆嗛棿闅旀槸60鍒嗛挓 - } -} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_02_Up.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_02_Up.java deleted file mode 100644 index 4d3f5cc..0000000 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_02_Up.java +++ /dev/null @@ -1,136 +0,0 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1.parse; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.dy.common.mw.protocol.AnnotationCodeUp; -import com.dy.common.mw.protocol.CodeParse; -import com.dy.common.mw.protocol.CodeParseCallback; -import com.dy.common.mw.protocol.CodeParseParams; -import com.dy.common.mw.protocol.Command; -import com.dy.common.mw.protocol.Data; -import com.dy.common.mw.protocol.MidResult; -import com.dy.common.mw.protocol.MidResultFromRtu; -import com.dy.common.mw.protocol.MidResultToRtu; -import com.dy.common.mw.protocol.pMeterV1_0_1.*; -import com.dy.common.util.ByteUtil; -import com.dy.common.util.ByteUtilUnsigned; - -@AnnotationCodeUp(ifAny={ - CodeV1_0_1.cd_02 -}) -public class Cd_02_Up implements CodeParse{ - - private static Logger log = LogManager.getLogger(Cd_02_Up.class); - - /** - * 鍒嗘瀽涓婅鏁版嵁 - */ - @Override - public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception { - ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ; - int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ; - if(bsLen > 0){ - this.doParse(para.upBuffer, - bsLen, - para.upCode, - para.data) ; - } - log.info("鍒嗘瀽涓婅鏁版嵁<" + CodeV1_0_1.getCodeName(para.upCode) + " 姘磋〃鍙�=" + para.meterNo + ">:\n" + para.data.toString()); - - MidResultFromRtu midRs = new MidResultFromRtu() ; - midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О - midRs.rtuAddr = para.rtuAddr ;//IMEI鍙� - midRs.meterNo = para.meterNo ;//姘磋〃鍙� - midRs.productId = para.productId ;//鐢典俊骞冲彴浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - midRs.deviceId = para.deviceId ;//鐢典俊骞冲彴璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - midRs.upCode = para.upCode ;//涓婅鏁版嵁涓殑鍔熻兘鐮� - midRs.upHex = para.upHex ;//涓婅鏁版嵁鍗佸叚杩涘埗褰㈠紡 - midRs.upBuffer = para.upBuffer ;//涓婅鏁版嵁瀛楄妭鏁扮粍 - midRs.data = para.data ;//瑙f瀽鍚庣殑鏁版嵁 - - midRs.reportOrResponse_trueOrFalse = true ;//涓诲姩涓婃姤 - - String confirmComCode = CodeV1_0_1.cd_02 ; - ParseParamsForDownV1_0_1 downCpParams = new ParseParamsForDownV1_0_1() ; - downCpParams.setValue( - ProtocolConstantV1_0_1.protocolName, - para.rtuAddr, - para.meterNo, - para.productId, - para.deviceId, - Command.defaultId, - confirmComCode, - null, - null); - //鏋勯�犱笂鎶ョ‘璁ゅ簲绛� - byte[] data = new Cd_XY_Down().doParse(downCpParams) ; - - MidResultToRtu confirmCommand = new MidResultToRtu() ; - confirmCommand.protocolName = para.protocolName ;//鍗忚鍚嶇О - confirmCommand.rtuAddr = para.rtuAddr ;//IMEI鍙� - confirmCommand.meterNo = para.meterNo ;//姘磋〃鍙� - confirmCommand.productId = para.productId ;//鐢典俊骞冲彴浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - confirmCommand.deviceId = para.deviceId ;//鐢典俊骞冲彴璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - confirmCommand.commandId = Command.defaultId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉 - confirmCommand.downCode = confirmComCode ;//涓嬭鍛戒护鍔熻兘鐮�; - confirmCommand.downBuffer = data ;//涓嬭鍛戒护鏁版嵁 - confirmCommand.downBufHex = ByteUtil.bytes2Hex(data, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡 - confirmCommand.hasResponse = false ;//鏄惁鏈夊簲绛� - confirmCommand.maxSendTimes = 1 ;//鍛戒护鏈�澶у彂閫佹鏁�(褰撴敹涓嶅埌搴旂瓟鏃讹紝灏嗛噸鍙�2娆�)锛屽鏋滀笉璁剧疆锛屽懡浠ょ紦瀛樺櫒杩涜琛ュ厖璁剧疆 - confirmCommand.isSendFirst = true ;//纭鍛戒护锛屼紭鍏堝彂閫� - confirmCommand.isCachForOffLine = false ;//RTU涓嶅湪绾匡紝鍛戒护鏄惁缂撳瓨 - - callback.callback(midRs.reportOrResponse_trueOrFalse); - return new MidResult[]{midRs, confirmCommand} ; - } - /** - * 鎵ц鍒嗘瀽 - * @param bs - * @param bsLen瀛楄妭闀垮害锛堟�诲寘闀匡紝鍖呮嫭鍖呭ご鍜屽寘灏撅級 - * @param dataCode - * @param index - * @param contentDataEndIndex - * @param data - * @throws Exception - */ - protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { - DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ; - DataCd02Vo cdData = new DataCd02Vo() ; - dV1.dataCd02Vo = cdData ; - - int index = ProtocolConstantV1_0_1.codeIndex + 1 ; - - cdData.dt = "20" + ByteUtil.BCD2String_BE(bs, index, index++) - + "-" + ByteUtil.BCD2String_BE(bs, index, index++) - + "-" + ByteUtil.BCD2String_BE(bs, index, index++) - + " " + ByteUtil.BCD2String_BE(bs, index, index++) - + ":" + ByteUtil.BCD2String_BE(bs, index, index++) - + ":" + ByteUtil.BCD2String_BE(bs, index, index) ; - - index++ ; - if(!ByteUtilUnsigned.bytesIsAll0xFF(bs, index, 4)){ - //褰揜TU瀹炴涓婃姤鏃讹紝鍥犳湭鍒濆鍖栦笂鎶ョ殑瀛楄妭鏄� 0xFF - cdData.totalAmount = ByteUtilUnsigned.bytes2Int_BE(bs, index)/100.0f; - }else{ - cdData.totalAmount = 0.0f ; - } - - index += 4 ; - cdData.volt = ByteUtilUnsigned.byte2Byte(bs, index)/10.0f ; - - index += 1 ; - cdData.signal = 0.0f + ByteUtilUnsigned.bytes2Short_BE(bs, index) ; - - index += 2 ; - byte staAlarm = bs[index] ; - cdData.valveSta = (byte)(staAlarm & 1) ; - staAlarm = (byte)(staAlarm >> 2) ; - cdData.alarmValve = (byte)(staAlarm & 1) ; - staAlarm = (byte)(staAlarm >> 1) ; - cdData.alarmMagnetism = (byte)(staAlarm & 1) ; - staAlarm = (byte)(staAlarm >> 1) ; - cdData.alarmVolt = (byte)(staAlarm & 1) ; - - } -} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_03_Up.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_03_Up.java deleted file mode 100644 index 0be46e9..0000000 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_03_Up.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1.parse; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.dy.common.mw.protocol.AnnotationCodeUp; -import com.dy.common.mw.protocol.CodeParse; -import com.dy.common.mw.protocol.CodeParseCallback; -import com.dy.common.mw.protocol.CodeParseParams; -import com.dy.common.mw.protocol.Command; -import com.dy.common.mw.protocol.Data; -import com.dy.common.mw.protocol.MidResult; -import com.dy.common.mw.protocol.MidResultFromRtu; -import com.dy.common.mw.protocol.MidResultToRtu; -import com.dy.common.mw.protocol.pMeterV1_0_1.*; -import com.dy.common.util.ByteUtil; -import com.dy.common.util.ByteUtilUnsigned; - -@AnnotationCodeUp(ifAny={ - CodeV1_0_1.cd_03 -}) -public class Cd_03_Up implements CodeParse{ - - private static Logger log = LogManager.getLogger(Cd_03_Up.class); - - /** - * 鍒嗘瀽涓婅鏁版嵁 - */ - @Override - public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception { - ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ; - int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ; - if(bsLen > 0){ - this.doParse(para.upBuffer, - bsLen, - para.upCode, - para.data) ; - } - log.info("鍒嗘瀽涓婅鏁版嵁<" + CodeV1_0_1.getCodeName(para.upCode) + " 姘磋〃鍙�=" + para.meterNo + ">:\n" + para.data.toString()); - - MidResultFromRtu midRs = new MidResultFromRtu() ; - midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О - midRs.rtuAddr = para.rtuAddr ;//IMEI鍙� - midRs.meterNo = para.meterNo ;//姘磋〃鍙� - midRs.productId = para.productId ;//鐢典俊骞冲彴浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - midRs.deviceId = para.deviceId ;//鐢典俊骞冲彴璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - midRs.upCode = para.upCode ;//涓婅鏁版嵁涓殑鍔熻兘鐮� - midRs.upHex = para.upHex ;//涓婅鏁版嵁鍗佸叚杩涘埗褰㈠紡 - midRs.upBuffer = para.upBuffer ;//涓婅鏁版嵁瀛楄妭鏁扮粍 - midRs.data = para.data ;//瑙f瀽鍚庣殑鏁版嵁 - - midRs.reportOrResponse_trueOrFalse = true ;//涓诲姩涓婃姤 - - String confirmComCode = CodeV1_0_1.cd_03 ; - ParseParamsForDownV1_0_1 downCpParams = new ParseParamsForDownV1_0_1() ; - downCpParams.setValue( - ProtocolConstantV1_0_1.protocolName, - para.rtuAddr, - para.meterNo, - para.productId, - para.deviceId, - Command.defaultId, - confirmComCode, - null, - null); - //鏋勯�犱笂鎶ョ‘璁ゅ簲绛� - byte[] data = new Cd_XY_Down().doParse(downCpParams) ; - - MidResultToRtu confirmCommand = new MidResultToRtu() ; - confirmCommand.protocolName = para.protocolName ;//鍗忚鍚嶇О - confirmCommand.rtuAddr = para.rtuAddr ;//IMEI鍙� - confirmCommand.meterNo = para.meterNo ;//姘磋〃鍙� - confirmCommand.productId = para.productId ;//鐢典俊骞冲彴浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - confirmCommand.deviceId = para.deviceId ;//鐢典俊骞冲彴璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - confirmCommand.commandId = Command.defaultId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉 - confirmCommand.downCode = confirmComCode ;//涓嬭鍛戒护鍔熻兘鐮�; - confirmCommand.downBuffer = data ;//涓嬭鍛戒护鏁版嵁 - confirmCommand.downBufHex = ByteUtil.bytes2Hex(data, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡 - confirmCommand.hasResponse = false ;//鏄惁鏈夊簲绛� - confirmCommand.maxSendTimes = 1 ;//鍛戒护鏈�澶у彂閫佹鏁�(褰撴敹涓嶅埌搴旂瓟鏃讹紝灏嗛噸鍙�2娆�)锛屽鏋滀笉璁剧疆锛屽懡浠ょ紦瀛樺櫒杩涜琛ュ厖璁剧疆 - confirmCommand.isSendFirst = true ;//纭鍛戒护锛屼紭鍏堝彂閫� - confirmCommand.isCachForOffLine = false ;//RTU涓嶅湪绾匡紝鍛戒护鏄惁缂撳瓨 - - callback.callback(midRs.reportOrResponse_trueOrFalse); - return new MidResult[]{midRs, confirmCommand} ; - } - /** - * 鎵ц鍒嗘瀽 - * @param bs - * @param bsLen瀛楄妭闀垮害锛堟�诲寘闀匡紝鍖呮嫭鍖呭ご鍜屽寘灏撅級 - * @param dataCode - * @param index - * @param contentDataEndIndex - * @param data - * @throws Exception - */ - protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { - DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ; - DataCd03Vo cdData = new DataCd03Vo() ; - dV1.dataCd03Vo = cdData ; - - int index = ProtocolConstantV1_0_1.codeIndex + 1 ; - - cdData.dt = "20" + ByteUtil.BCD2String_BE(bs, index, index++) - + "-" + ByteUtil.BCD2String_BE(bs, index, index++) - + "-" + ByteUtil.BCD2String_BE(bs, index, index++) - + " " + ByteUtil.BCD2String_BE(bs, index, index++) - + ":" + ByteUtil.BCD2String_BE(bs, index, index++) - + ":" + ByteUtil.BCD2String_BE(bs, index, index) ; - - index++ ; - cdData.volt = ByteUtilUnsigned.bytes2Short_BE(bs, index)/10.0f ; - - index++ ; - byte staAlarm = bs[index] ; - cdData.valveSta = (byte)(staAlarm & 1) ; - staAlarm = (byte)(staAlarm >> 2) ; - cdData.alarmValve = (byte)(staAlarm & 1) ; - staAlarm = (byte)(staAlarm >> 1) ; - cdData.alarmMagnetism = (byte)(staAlarm & 1) ; - staAlarm = (byte)(staAlarm >> 1) ; - cdData.alarmVolt = (byte)(staAlarm & 1) ; - } -} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_0405_Up.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_0405_Up.java deleted file mode 100644 index f9433e2..0000000 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_0405_Up.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1.parse; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.dy.common.mw.protocol.AnnotationCodeUp; -import com.dy.common.mw.protocol.CodeParse; -import com.dy.common.mw.protocol.CodeParseCallback; -import com.dy.common.mw.protocol.CodeParseParams; -import com.dy.common.mw.protocol.Data; -import com.dy.common.mw.protocol.MidResult; -import com.dy.common.mw.protocol.MidResultFromRtu; -import com.dy.common.mw.protocol.pMeterV1_0_1.*; -import com.dy.common.util.ByteUtil; - -@AnnotationCodeUp(ifAny={ - CodeV1_0_1.cd_04, - CodeV1_0_1.cd_05 -}) -public class Cd_0405_Up implements CodeParse{ - - private static Logger log = LogManager.getLogger(Cd_0405_Up.class); - - /** - * 鍒嗘瀽涓婅鏁版嵁 - */ - @Override - public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception { - ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ; - int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ; - if(bsLen > 0){ - this.doParse(para.upBuffer, - bsLen, - para.upCode, - para.data) ; - } - log.info("鍒嗘瀽涓婅鏁版嵁<" + CodeV1_0_1.getCodeName(para.upCode) + " 姘磋〃鍙�=" + para.meterNo + ">:\n" + para.data.toString()); - - MidResultFromRtu midRs = new MidResultFromRtu() ; - midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О - midRs.rtuAddr = para.rtuAddr ;//IMEI鍙� - midRs.meterNo = para.meterNo ;//姘磋〃鍙� - midRs.productId = para.productId ;//鐢典俊骞冲彴浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - midRs.deviceId = para.deviceId ;//鐢典俊骞冲彴璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - midRs.upCode = para.upCode ;//涓婅鏁版嵁涓殑鍔熻兘鐮� - midRs.upHex = para.upHex ;//涓婅鏁版嵁鍗佸叚杩涘埗褰㈠紡 - midRs.upBuffer = para.upBuffer ;//涓婅鏁版嵁瀛楄妭鏁扮粍 - midRs.data = para.data ;//瑙f瀽鍚庣殑鏁版嵁 - - midRs.reportOrResponse_trueOrFalse = false ;//鍛戒护鍥炴壂 - - callback.callback(midRs.reportOrResponse_trueOrFalse); - return new MidResult[]{midRs} ; - } - /** - * 鎵ц鍒嗘瀽 - * @param bs - * @param bsLen瀛楄妭闀垮害锛堟�诲寘闀匡紝鍖呮嫭鍖呭ご鍜屽寘灏撅級 - * @param dataCode - * @param index - * @param contentDataEndIndex - * @param data - * @throws Exception - */ - protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { - DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ; - DataCd0405Vo cdData = new DataCd0405Vo() ; - dV1.dataCd0405Vo = cdData ; - - if(dataCode.equals(CodeV1_0_1.cd_04)){ - cdData.open1_close2 = 1 ; - } else if(dataCode.equals(CodeV1_0_1.cd_05)){ - cdData.open1_close2 = 2 ; - } - - int index = ProtocolConstantV1_0_1.codeIndex + 1 ; - cdData.dt = "20" + ByteUtil.BCD2String_BE(bs, index, index++) - + "-" + ByteUtil.BCD2String_BE(bs, index, index++) - + "-" + ByteUtil.BCD2String_BE(bs, index, index++) - + " " + ByteUtil.BCD2String_BE(bs, index, index++) - + ":" + ByteUtil.BCD2String_BE(bs, index, index++) - + ":" + ByteUtil.BCD2String_BE(bs, index, index) ; - - index ++ ; - cdData.state = bs[index] ; - - } -} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_06_Down.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_06_Down.java deleted file mode 100644 index 1bcee3e..0000000 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_06_Down.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1.parse; - -import com.dy.common.mw.protocol.AnnotationCodeDown; -import com.dy.common.mw.protocol.CodeParse; -import com.dy.common.mw.protocol.CodeParseCallback; -import com.dy.common.mw.protocol.CodeParseParams; -import com.dy.common.mw.protocol.MidResult; -import com.dy.common.mw.protocol.MidResultToRtu; -import com.dy.common.mw.protocol.pMeterV1_0_1.*; -import com.dy.common.util.ByteUtil; -import com.dy.common.util.ByteUtilUnsigned; -import com.dy.common.util.DateTime; - -@AnnotationCodeDown(ifAny={ - CodeV1_0_1.cd_06 -}) -public class Cd_06_Down implements CodeParse{ - - //private static Logger log = LogManager.getLogger(Cd_XY_Down.class); - - @Override - public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback) throws Exception { - ParseParamsForDownV1_0_1 para = (ParseParamsForDownV1_0_1) params ; - byte[] bs = this.doParse(para) ; - - MidResultToRtu midRs = new MidResultToRtu() ; - midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О - midRs.rtuAddr = para.rtuAddr ;//IMEI鍙凤紙鐢典俊骞冲彴璁惧IMEI锛� - midRs.meterNo = para.meterNo ;//姘磋〃鍙� - midRs.productId = para.productId ;//鐢典俊骞冲彴浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - midRs.deviceId = para.deviceId ;//鐢典俊骞冲彴璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - midRs.commandId = para.commandId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉 - midRs.downCode = para.commandCode ;//涓嬭鍛戒护鍔熻兘鐮�; - midRs.downBuffer = bs ;//涓嬭鍛戒护鏁版嵁 - midRs.downBufHex = ByteUtil.bytes2Hex(bs, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡 - midRs.hasResponse = true ;//鏄惁鏈夊簲绛� - midRs.maxSendTimes = null ;//鍛戒护鏈�澶у彂閫佹鏁�(褰撴敹涓嶅埌搴旂瓟鏃讹紝灏嗛噸鍙�)锛屽鏋滀笉璁剧疆锛屽懡浠ょ紦瀛樺櫒杩涜琛ュ厖璁剧疆 - midRs.isCachForOffLine = true ;//RTU涓嶅湪绾匡紝鍛戒护鏄惁缂撳瓨锛屼綆鍔熻�楁椂涓簍rue - - //瀵筊TU涓婅鏁版嵁鐨勫簲绛� - midRs.hasResponse = false ;//鏄惁鏈夊簲绛� - midRs.maxSendTimes = 1 ;//瀵筊TU涓婅鏁版嵁搴旂瓟锛屾墍浠ュ彧闇�鍙戜竴娆� - if(isLowPower != null && isLowPower.booleanValue()){ - //浣庡姛鑰楁椂 - midRs.isQuickSend = true ; - } - - return new MidResult[]{midRs} ; - } - /** - * 鏋勯�犱笅琛屾暟鎹� - * @param params - * @return - * @throws Exception - */ - public byte[] doParse(ParseParamsForDownV1_0_1 para) throws Exception { - byte[] bytes = null ; - byte[] bsHead = new byte[ProtocolConstantV1_0_1.downBsHeadLen] ; - byte index = 0 ; - bsHead[index] = ProtocolConstantV1_0_1.P_Head_Byte ; - index++ ; - bsHead[index] = 0 ;//甯ч暱搴� - index++ ; - bsHead[index] = 0 ;//甯ч暱搴� - - index++ ; - bsHead[index] = ProtocolConstantV1_0_1.versionByte ;//鍗忚鐗堟湰鍙� - index++ ; - - String rtuAddr = para.rtuAddr ; - while(true){ - if(rtuAddr.length() >= 16){ - break ; - }else{ - rtuAddr = "0" + rtuAddr ; - } - } - - ByteUtil.string2BCD_BE(bsHead, rtuAddr, index) ;//IMEI鍙� - index += 8 ; - String meterNo = para.meterNo ; - while(true){ - if(meterNo.length() >= 16){ - break ; - }else{ - meterNo = "0" + meterNo ; - } - } - ByteUtil.string2BCD_BE(bsHead, meterNo, index) ;//姘磋〃鍙� - index += 8 ; - - ByteUtil.hex2Bytes(para.commandCode, bsHead, index) ; - - byte[] bs = new byte[7] ; - bs[0] = ((Byte)para.param).byteValue();//闃�闂ㄥ姩浣滅粨鏋滃洖浼� - ByteUtil.string2BCD_BE(bs, DateTime.yyMMddhhmmss(), 1) ; - - bytes = ByteUtil.bytesMerge(bsHead, bs) ; - - int len = bytes.length + ProtocolConstantV1_0_1.downBsTailLen ; - ByteUtilUnsigned.short2Bytes_BE(bytes, len, ProtocolConstantV1_0_1.dataLenIndex_start); - - - byte he = 0 ; - for(int i = 0 ; i < bytes.length; i++){ - he += bytes[i] ; - } - - bs = new byte[ProtocolConstantV1_0_1.downBsTailLen] ; - ByteUtilUnsigned.byte2Byte(bs, he, 0) ; - bs[1] = ProtocolConstantV1_0_1.P_Tail_Byte ; - bytes = ByteUtil.bytesMerge(bytes, bs) ; - - return bytes ; - } - -} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_06_Up.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_06_Up.java deleted file mode 100644 index 5cd2f7d..0000000 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_06_Up.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1.parse; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.dy.common.mw.protocol.AnnotationCodeUp; -import com.dy.common.mw.protocol.CodeParse; -import com.dy.common.mw.protocol.CodeParseCallback; -import com.dy.common.mw.protocol.CodeParseParams; -import com.dy.common.mw.protocol.Command; -import com.dy.common.mw.protocol.Data; -import com.dy.common.mw.protocol.MidResult; -import com.dy.common.mw.protocol.MidResultFromRtu; -import com.dy.common.mw.protocol.MidResultToRtu; -import com.dy.common.mw.protocol.pMeterV1_0_1.*; -import com.dy.common.util.ByteUtil; - -@AnnotationCodeUp(ifAny={ - CodeV1_0_1.cd_06 -}) -public class Cd_06_Up implements CodeParse{ - - private static Logger log = LogManager.getLogger(Cd_06_Up.class); - - /** - * 鍒嗘瀽涓婅鏁版嵁 - */ - @Override - public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback)throws Exception { - ParseParamsForUpV1_0_1 para = (ParseParamsForUpV1_0_1)params ; - int bsLen = new CommonV1_0_1().parseDataLen(para.upBuffer) ; - if(bsLen > 0){ - this.doParse(para.upBuffer, - bsLen, - para.upCode, - para.data) ; - } - log.info("鍒嗘瀽涓婅鏁版嵁<" + CodeV1_0_1.getCodeName(para.upCode) + " 姘磋〃鍙�=" + para.meterNo + ">:\n" + para.data.toString()); - - MidResultFromRtu midRs = new MidResultFromRtu() ; - midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О - midRs.rtuAddr = para.rtuAddr ;//IMEI鍙� - midRs.meterNo = para.meterNo ;//姘磋〃鍙� - midRs.productId = para.productId ;//鐢典俊骞冲彴浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - midRs.deviceId = para.deviceId ;//鐢典俊骞冲彴璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - midRs.upCode = para.upCode ;//涓婅鏁版嵁涓殑鍔熻兘鐮� - midRs.upHex = para.upHex ;//涓婅鏁版嵁鍗佸叚杩涘埗褰㈠紡 - midRs.upBuffer = para.upBuffer ;//涓婅鏁版嵁瀛楄妭鏁扮粍 - midRs.data = para.data ;//瑙f瀽鍚庣殑鏁版嵁 - - midRs.reportOrResponse_trueOrFalse = true ;//涓诲姩涓婃姤 - - String confirmComCode = CodeV1_0_1.cd_06 ; - ParseParamsForDownV1_0_1 downCpParams = new ParseParamsForDownV1_0_1() ; - downCpParams.setValue( - ProtocolConstantV1_0_1.protocolName, - para.rtuAddr, - para.meterNo, - para.productId, - para.deviceId, - Command.defaultId, - confirmComCode, - ((DataV1_0_1)para.data.getSubData()).dataCd06Vo.valveRes, - null); - //鏋勯�犱笂鎶ョ‘璁ゅ簲绛� - byte[] data = new Cd_06_Down().doParse(downCpParams) ; - - MidResultToRtu confirmCommand = new MidResultToRtu() ; - confirmCommand.protocolName = para.protocolName ;//鍗忚鍚嶇О - confirmCommand.rtuAddr = para.rtuAddr ;//IMEI鍙� - confirmCommand.meterNo = para.meterNo ;//姘磋〃鍙� - confirmCommand.productId = para.productId ;//鐢典俊骞冲彴浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - confirmCommand.deviceId = para.deviceId ;//鐢典俊骞冲彴璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - confirmCommand.commandId = Command.defaultId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉 - confirmCommand.downCode = confirmComCode ;//涓嬭鍛戒护鍔熻兘鐮�; - confirmCommand.downBuffer = data ;//涓嬭鍛戒护鏁版嵁 - confirmCommand.downBufHex = ByteUtil.bytes2Hex(data, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡 - confirmCommand.hasResponse = false ;//鏄惁鏈夊簲绛� - confirmCommand.maxSendTimes = 1 ;//鍛戒护鏈�澶у彂閫佹鏁�(褰撴敹涓嶅埌搴旂瓟鏃讹紝灏嗛噸鍙�2娆�)锛屽鏋滀笉璁剧疆锛屽懡浠ょ紦瀛樺櫒杩涜琛ュ厖璁剧疆 - confirmCommand.isSendFirst = true ;//纭鍛戒护锛屼紭鍏堝彂閫� - confirmCommand.isCachForOffLine = false ;//RTU涓嶅湪绾匡紝鍛戒护鏄惁缂撳瓨 - - callback.callback(midRs.reportOrResponse_trueOrFalse); - return new MidResult[]{midRs, confirmCommand} ; - } - /** - * 鎵ц鍒嗘瀽 - * @param bs - * @param bsLen瀛楄妭闀垮害锛堟�诲寘闀匡紝鍖呮嫭鍖呭ご鍜屽寘灏撅級 - * @param dataCode - * @param index - * @param contentDataEndIndex - * @param data - * @throws Exception - */ - protected void doParse(byte[] bs, int bsLen, String dataCode, Data data) throws Exception { - DataV1_0_1 dV1 = (DataV1_0_1)data.getSubData() ; - DataCd06Vo cdData = new DataCd06Vo() ; - dV1.dataCd06Vo = cdData ; - - int index = ProtocolConstantV1_0_1.codeIndex + 1 ; - cdData.valveRes = bs[index] ; - - /* 浜轰负璁剧疆鎶ヨ鐘舵�佽繘琛屾祴璇� - if(cdData.valveRes == 0){ - cdData.valveRes = 2 ; - }else if(cdData.valveRes == 1){ - cdData.valveRes = 3 ; - } - */ - - index++ ; - cdData.dt = "20" + ByteUtil.BCD2String_BE(bs, index, index++) - + "-" + ByteUtil.BCD2String_BE(bs, index, index++) - + "-" + ByteUtil.BCD2String_BE(bs, index, index++) - + " " + ByteUtil.BCD2String_BE(bs, index, index++) - + ":" + ByteUtil.BCD2String_BE(bs, index, index++) - + ":" + ByteUtil.BCD2String_BE(bs, index, index) ; - } -} diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_XY_Down.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_XY_Down.java deleted file mode 100644 index 118bf27..0000000 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/parse/Cd_XY_Down.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.dy.common.mw.protocol.pMeterV1_0_1.parse; - -import com.dy.common.mw.protocol.AnnotationCodeDown; -import com.dy.common.mw.protocol.CodeParse; -import com.dy.common.mw.protocol.CodeParseCallback; -import com.dy.common.mw.protocol.CodeParseParams; -import com.dy.common.mw.protocol.MidResult; -import com.dy.common.mw.protocol.MidResultToRtu; -import com.dy.common.mw.protocol.pMeterV1_0_1.*; -import com.dy.common.util.ByteUtil; -import com.dy.common.util.ByteUtilUnsigned; -import com.dy.common.util.DateTime; - -@AnnotationCodeDown(ifAny={ - CodeV1_0_1.cd_01, - CodeV1_0_1.cd_02, - CodeV1_0_1.cd_03, - CodeV1_0_1.cd_04, - CodeV1_0_1.cd_05 -}) -public class Cd_XY_Down implements CodeParse{ - - //private static Logger log = LogManager.getLogger(Cd_XY_Down.class); - - @Override - public MidResult[] parse(Boolean isLowPower, CodeParseParams params, CodeParseCallback callback) throws Exception { - ParseParamsForDownV1_0_1 para = (ParseParamsForDownV1_0_1) params ; - byte[] bs = this.doParse(para) ; - - MidResultToRtu midRs = new MidResultToRtu() ; - midRs.protocolName = para.protocolName ;//鍗忚鍚嶇О - midRs.rtuAddr = para.rtuAddr ;//IMEI鍙凤紙鐢典俊骞冲彴璁惧IMEI锛� - midRs.meterNo = para.meterNo ;//姘磋〃鍙� - midRs.productId = para.productId ;//鐢典俊骞冲彴浜у搧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - midRs.deviceId = para.deviceId ;//鐢典俊骞冲彴璁惧ID锛屽綋涓嶅湪鐢典俊骞冲彴杩愯鏃讹紝涓簄ull - midRs.commandId = para.commandId ;//鍛戒护ID锛屽彂璧峰懡浠ょ殑瀹㈡埛绔�(web绔�)鐢熸垚锛屼互鍖归厤鍛戒护缁撴灉 - midRs.downCode = para.commandCode ;//涓嬭鍛戒护鍔熻兘鐮�; - midRs.downBuffer = bs ;//涓嬭鍛戒护鏁版嵁 - midRs.downBufHex = ByteUtil.bytes2Hex(bs, true) ;//涓嬭鍛戒护鏁版嵁鍗佸叚杩涘埗褰㈠紡 - midRs.hasResponse = true ;//鏄惁鏈夊簲绛� - midRs.maxSendTimes = null ;//鍛戒护鏈�澶у彂閫佹鏁�(褰撴敹涓嶅埌搴旂瓟鏃讹紝灏嗛噸鍙�)锛屽鏋滀笉璁剧疆锛屽懡浠ょ紦瀛樺櫒杩涜琛ュ厖璁剧疆 - midRs.isCachForOffLine = true ;//RTU涓嶅湪绾匡紝鍛戒护鏄惁缂撳瓨锛屼綆鍔熻�楁椂涓簍rue - - if(para.commandCode != null && ( - para.commandCode.equals(CodeV1_0_1.cd_01) || - para.commandCode.equals(CodeV1_0_1.cd_02) || - para.commandCode.equals(CodeV1_0_1.cd_03) - )){ - //瀵筊TU涓婅鏁版嵁鐨勫簲绛� - midRs.hasResponse = false ;//鏄惁鏈夊簲绛� - midRs.maxSendTimes = 1 ;//瀵筊TU涓婅鏁版嵁搴旂瓟锛屾墍浠ュ彧闇�鍙戜竴娆� - if(isLowPower != null && isLowPower.booleanValue()){ - //浣庡姛鑰楁椂 - midRs.isQuickSend = true ; - } - } - - return new MidResult[]{midRs} ; - } - /** - * 鏋勯�犱笅琛屾暟鎹� - * @param params - * @return - * @throws Exception - */ - public byte[] doParse(ParseParamsForDownV1_0_1 para) throws Exception { - byte[] bytes = null ; - byte[] bsHead = new byte[ProtocolConstantV1_0_1.downBsHeadLen] ; - byte index = 0 ; - bsHead[index] = ProtocolConstantV1_0_1.P_Head_Byte ; - index++ ; - bsHead[index] = 0 ;//甯ч暱搴� - index++ ; - bsHead[index] = 0 ;//甯ч暱搴� - - index++ ; - bsHead[index] = ProtocolConstantV1_0_1.versionByte ;//鍗忚鐗堟湰鍙� - index++ ; - - String rtuAddr = para.rtuAddr ; - while(true){ - if(rtuAddr.length() >= 16){ - break ; - }else{ - rtuAddr = "0" + rtuAddr ; - } - } - - ByteUtil.string2BCD_BE(bsHead, rtuAddr, index) ;//IMEI鍙� - index += 8 ; - String meterNo = para.meterNo ; - while(true){ - if(meterNo.length() >= 16){ - break ; - }else{ - meterNo = "0" + meterNo ; - } - } - ByteUtil.string2BCD_BE(bsHead, meterNo, index) ;//姘磋〃鍙� - index += 8 ; - - ByteUtil.hex2Bytes(para.commandCode, bsHead, index) ; - - byte[] bs = new byte[6] ; - ByteUtil.string2BCD_BE(bs, DateTime.yyMMddhhmmss(), 0) ; - - bytes = ByteUtil.bytesMerge(bsHead, bs) ; - - int len = bytes.length + ProtocolConstantV1_0_1.downBsTailLen ; - ByteUtilUnsigned.short2Bytes_BE(bytes, len, ProtocolConstantV1_0_1.dataLenIndex_start); - - - byte he = 0 ; - for(int i = 0 ; i < bytes.length; i++){ - he += bytes[i] ; - } - - bs = new byte[ProtocolConstantV1_0_1.downBsTailLen] ; - ByteUtilUnsigned.byte2Byte(bs, he, 0) ; - bs[1] = ProtocolConstantV1_0_1.P_Tail_Byte ; - bytes = ByteUtil.bytesMerge(bytes, bs) ; - - return bytes ; - } - -} diff --git "a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/\350\257\264\346\230\216.txt" "b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/\350\257\264\346\230\216.txt" deleted file mode 100644 index e69de29..0000000 --- "a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol/pMeterV1_0_1/\350\257\264\346\230\216.txt" +++ /dev/null diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnit.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnit.java index ea7216e..4bd6941 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnit.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnit.java @@ -39,31 +39,36 @@ public void start(UnitStartedCallbackInterface callback) throws Exception { if(!started){ started = true ; - if(confVo.enableThreadPool){ - TreadPoolFactory.initThreadPoolShort("鐭换鍔″伐浣滅嚎绋嬫睜", - this.confVo.short_maxThread, - this.confVo.short_minThread, - this.confVo.short_freeTimeout, + if(confVo.enableShortThreadPool) { + TreadPoolFactory.initThreadPoolShort("鐭换鍔″伐浣滅嚎绋嬫睜", + this.confVo.short_maxThread, + this.confVo.short_minThread, + this.confVo.short_freeTimeout, this.confVo.short_busyTimeout); - TreadPoolFactory.initThreadPoolLong("闀夸换鍔″伐浣滅嚎绋嬫睜", - this.confVo.long_maxThread, - this.confVo.long_minThread, - this.confVo.long_freeTimeout, - this.confVo.long_busyTimeout); - - if(this.confVo.showStartInfo){ - System.out.println("绾跨▼姹犳ā鍧楁垚鍔熷惎鍔�"); - } + }else{ + System.out.println("鐭嚎绋嬫睜閰嶇疆涓嶅惎鍔�"); } - callback.call(null); + if(confVo.enableLongThreadPool) { + TreadPoolFactory.initThreadPoolLong("闀夸换鍔″伐浣滅嚎绋嬫睜", + this.confVo.long_maxThread, + this.confVo.long_minThread, + this.confVo.long_freeTimeout, + this.confVo.long_busyTimeout); + }else{ + System.out.println("闀跨嚎绋嬫睜閰嶇疆涓嶅惎鍔�"); + } + if(this.confVo.showStartInfo){ + System.out.println("绾跨▼姹犳ā鍧楁垚鍔熷惎鍔�"); + } } + callback.call(null); } @Override - public void stop(UnitStartedCallbackInterface callback) throws Exception { + public void stop(UnitStartedCallbackInterface callback) { } - + /* public static void main(String[] args) throws Exception{ SupportUnitConfigVo supVo = new SupportUnitConfigVo() ; //鐭伐浣滄椂闀跨嚎绋嬫睜锛岀嚎绋嬭礋璐g敤鏃惰緝鐭殑宸ヤ綔浠诲姟 @@ -82,8 +87,9 @@ supVo.long_busyTimeout = -1 ; } - supVo.enableThreadPool = true ; - + supVo.enableShortThreadPool = true ; + supVo.enableLongThreadPool = true ; + supVo.showStartInfo = true ; SupportUnit supUnit = SupportUnit.getInstance() ; @@ -94,6 +100,7 @@ supUnit.start(obj -> { }); } + private static class AdapterImp_SupportUnit implements SupportUnitAdapter { private SupportUnitConfigVo configVo = null ; @@ -106,7 +113,6 @@ public void setConfig(SupportUnitConfigVo configVo) { this.configVo = configVo; } - - } + */ } diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnitConfigVo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnitConfigVo.java index 9bf912c..fd6cd57 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnitConfigVo.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/support/SupportUnitConfigVo.java @@ -1,8 +1,10 @@ package com.dy.common.mw.support; public class SupportUnitConfigVo { - - public boolean enableThreadPool ; + + public boolean enableShortThreadPool ; + + public boolean enableLongThreadPool ; //鐭换鍔$嚎绋嬫睜 public int short_maxThread ; diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/queue/Queue.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/queue/Queue.java index cfa77d5..13114af 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/queue/Queue.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/queue/Queue.java @@ -4,7 +4,7 @@ import org.apache.logging.log4j.Logger; /** - * 闃熷垪锛屽厛杩涘厛鍑� + * 闃熷垪锛屽厛杩涘厛鍑猴紝闈炵嚎绋嬪畨鍏� */ public class Queue { @SuppressWarnings("unfinal") @@ -62,6 +62,7 @@ */ @SuppressWarnings("unused") public void pushHead(NodeObj obj)throws Exception{ + //涓や釜绾跨▼鐜锛岄渶瑕佸悓姝ラ攣 synchronized(synObj){ if(obj == null){ return ; @@ -89,6 +90,7 @@ * @param obj 鍏ュ垪鐨勫璞� */ public void pushTail(NodeObj obj)throws Exception{ + //涓や釜绾跨▼鐜锛岄渶瑕佸悓姝ラ攣 synchronized(synObj){ if(obj == null){ return ; @@ -116,6 +118,7 @@ * @return 鍑哄垪瀵硅薄 */ public NodeObj pop(){ + //涓や釜绾跨▼鐜锛岄渶瑕佸悓姝ラ攣 synchronized(synObj){ NodeObj obj = null ; if(this.size > 0){ @@ -139,11 +142,14 @@ */ @SuppressWarnings("unused") public Node getFirstNode(){ - Node node = this.head.next ; - if(node != this.tail){ - return node ; + //涓や釜绾跨▼鐜锛岄渶瑕佸悓姝ラ攣 + synchronized(synObj) { + Node node = this.head.next; + if (node != this.tail) { + return node; + } + return null; } - return null ; } /** * 寰楀埌鏈�鍚庝竴涓妭鐐癸紝浣嗕笉鎶婅妭鐐逛粠闃熷垪涓竻闄� @@ -151,11 +157,14 @@ */ @SuppressWarnings("unused") public Node getLastNode(){ - Node node = this.tail.pre ; - if(node != this.head){ - return node ; + //涓や釜绾跨▼鐜锛岄渶瑕佸悓姝ラ攣 + synchronized(synObj) { + Node node = this.tail.pre; + if (node != this.head) { + return node; + } + return null; } - return null ; } /** 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 204d758..8ec40ae 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 @@ -75,36 +75,6 @@ */ private Logger log = LogManager.getLogger(MonitorThread.class.getName()); - /** - * 寰楀埌榛樿鍞竴瀹炰緥 - * @return - */ -// public MyThreadPool getDefaultInstance(){ -// if(myPool == null){ -// myPool = new MyThreadPool(null, null, null, null, null) ; -// } -// return myPool ; -// } - /** - * 寰楀埌鍞竴瀹炰緥 - * @param poolName - * @param maxNum - * @param minNum - * @param freeTimeout - * @param busyTimeout - * @return - */ -// public MyThreadPool getInstance( -// String poolName , -// Integer maxNum , -// Integer minNum , -// Long freeTimeout , -// Long busyTimeout){ -// if(myPool == null){ -// myPool = new MyThreadPool(poolName, maxNum, minNum, freeTimeout, busyTimeout) ; -// } -// return myPool ; -// } /** * 绾跨▼姹犳瀯閫犳柟娉� @@ -125,8 +95,8 @@ } this.poolName = poolName ; - if(maxNum == null || maxNum.intValue() <= 0){ - maxNum = -1 ; + if(maxNum == null || maxNum.intValue() < 0){ + maxNum = 65535 ; } if(minNum == null || minNum.intValue() < 0){ minNum = 0 ; @@ -148,20 +118,19 @@ }else{ this.busyTimeout = busyTimeout ; } - - this.busiThreads = new ArrayList<MyThread>(); - this.freeThreads = new ArrayList<MyThread>(); - - //鏈�灏忓寲绾跨▼姹� - for (int i = 0; i < this.minNum ; i++) { - MyThread t = new MyThread(this); - t.start(); - this.freeThreads.add(t); - this.currNum++; + if(maxNum != 0){ + this.busiThreads = new ArrayList<>(); + this.freeThreads = new ArrayList<>(); + //鏈�灏忓寲绾跨▼姹� + for (int i = 0; i < this.minNum ; i++) { + MyThread t = new MyThread(this); + t.start(); + this.freeThreads.add(t); + this.currNum++; + } + this.monitorThread = new MonitorThread(this) ; + this.monitorThread.start() ; } - - this.monitorThread = new MonitorThread(this) ; - this.monitorThread.start() ; } /** @@ -171,6 +140,9 @@ */ @Override public void putJob(Job job) throws Exception { + if(this.busiThreads == null || this.freeThreads == null){ + throw new Exception("绾跨▼姹犳湭鍚姩") ; + } synchronized(this.synObj) { //log.debug("宸ヤ綔浠诲姟鍒嗛厤鍒扮嚎绋嬫睜涓��") ; MyThread t = null ; @@ -215,7 +187,10 @@ /** * 绾跨▼宸ヤ綔瀹屾垚锛屼粠busiThreads鍥炲綊freeThreads */ - protected void freeThread(MyThread t) { + protected void freeThread(MyThread t) throws Exception { + if(this.busiThreads == null || this.freeThreads == null){ + throw new Exception("绾跨▼姹犳湭鍚姩") ; + } synchronized (synObj) { busiThreads.remove(t); freeThreads.add(t); @@ -236,7 +211,7 @@ /** * - * @param pool + * @param pool 姹� */ public MonitorThread(MyThreadPool pool){ this.pool = pool ; @@ -302,6 +277,7 @@ } }//end synchronized (pool.synObj) }catch(Exception e){ + e.printStackTrace(); }finally{ continue ; } @@ -354,7 +330,7 @@ /** * 璁剧疆绾跨▼宸ヤ綔瀵硅薄 - * @param job + * @param job 宸ヤ綔 */ protected void putJob(Job job) throws Exception { if(job == null){ @@ -418,13 +394,19 @@ } public void free(){ - //浣挎湰绾跨▼鍥炲綊绌洪棽绾跨▼姹� - pool.freeThread(this); - //绌洪棽寮�濮嬭鏃� - this.time = System.currentTimeMillis() ; - // 娌℃湁鍙仛鐨勪簡 - this.canJob = false; - log.debug("绾跨▼姹�(" + this.pool.poolName + ")涓殑绾跨▼鍥炲綊绌洪棽闆嗗悎銆�"); + try{ + //浣挎湰绾跨▼鍥炲綊绌洪棽绾跨▼姹� + pool.freeThread(this); + //绌洪棽寮�濮嬭鏃� + this.time = System.currentTimeMillis() ; + // 娌℃湁鍙仛鐨勪簡 + this.canJob = false; + log.debug("绾跨▼姹�(" + this.pool.poolName + ")涓殑绾跨▼鍥炲綊绌洪棽闆嗗悎銆�"); + }catch (Exception e){ + log.error("绾跨▼姹�(" + pool.poolName + ")鐨勫伐浣滅嚎绋嬮噴鏀惧洖褰掓椂鍙戠敓寮傚父:\n" + e.getMessage(), e); + e.printStackTrace(); + } + } /** diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/threadPool/TreadPoolFactory.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/threadPool/TreadPoolFactory.java index 040913d..cbdc7ba 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/threadPool/TreadPoolFactory.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/threadPool/TreadPoolFactory.java @@ -8,9 +8,9 @@ /** * 鍒濆鍖栫嚎绋嬫睜 - * @param threadPoolName 绾跨▼姹犲拰绾跨▼鍚嶇О - * @param maxThreadNum 绾跨▼姹犳渶澶х嚎绋嬫暟 锛岃嫢涓�-1锛屼笉鍙楅檺鍒� - * @param minThreadNum 绾跨▼姹犳渶灏忕嚎绋嬫暟锛屾垨鍒濆绾跨▼鏁� + * @param poolName 绾跨▼姹犲拰绾跨▼鍚嶇О + * @param maxNum 绾跨▼姹犳渶澶х嚎绋嬫暟 锛岃嫢涓�-1锛屼笉鍙楅檺鍒� + * @param minNum 绾跨▼姹犳渶灏忕嚎绋嬫暟锛屾垨鍒濆绾跨▼鏁� * @param freeTimeout 绌洪棽绾跨▼瓒呮椂鏃堕暱(绉�) * @param busyTimeout 蹇欑绾跨▼瓒呮椂鏃堕暱(绉�)锛岃嫢涓�-1锛屼笉鍙楅檺鍒� * @return 绾跨▼姹犲疄渚� @@ -30,9 +30,9 @@ /** * 鍒濆鍖栫嚎绋嬫睜 - * @param threadPoolName 绾跨▼姹犲拰绾跨▼鍚嶇О - * @param maxThreadNum 绾跨▼姹犳渶澶х嚎绋嬫暟锛岃嫢涓�-1锛屼笉鍙楅檺鍒� - * @param minThreadNum 绾跨▼姹犳渶灏忕嚎绋嬫暟锛屾垨鍒濆绾跨▼鏁� + * @param poolName 绾跨▼姹犲拰绾跨▼鍚嶇О + * @param maxNum 绾跨▼姹犳渶澶х嚎绋嬫暟锛岃嫢涓�-1锛屼笉鍙楅檺鍒� + * @param minNum 绾跨▼姹犳渶灏忕嚎绋嬫暟锛屾垨鍒濆绾跨▼鏁� * @param freeTimeout 绌洪棽绾跨▼瓒呮椂鏃堕暱(绉�) * @param busyTimeout 蹇欑绾跨▼瓒呮椂鏃堕暱(绉�)锛岃嫢涓�-1锛屼笉鍙楅檺鍒� * @return 绾跨▼姹犲疄渚� @@ -51,8 +51,6 @@ } /** * 寰楀埌鍞竴绾跨▼姹犲疄渚� - * @param dataSourceName - * @return * @throws Exception */ public final static ThreadPool.Pool getThreadPoolShort() @@ -64,9 +62,6 @@ } /** * 寰楀埌鍞竴绾跨▼姹犲疄渚� - * @param dataSourceName - * @return - * @throws Exception */ public final static ThreadPool.Pool getThreadPoolLong() throws Exception { diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/AsciiPic.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/AsciiPic.java index 53f71b7..f1e4a93 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/AsciiPic.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/AsciiPic.java @@ -81,6 +81,7 @@ } } + /* public static void main(final String[] args) { try { AsciiPic.createAsciiPic(toBufferedImage(creatImage("DY.png"))); @@ -88,4 +89,5 @@ e.printStackTrace(); } } + */ } \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java index 7b06e4d..31a6248 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/ByteUtil.java @@ -9,7 +9,7 @@ * 灏嗗瓧鑺傛暟缁勫悎骞跺埌瀛楄妭鏁扮粍涓� * @param bGroup1 琚悎骞舵暟缁� * @param bGroup2 鍚堝苟鏁扮粍 - * @return 鍚堝苟鍚庢暟缁� + * @return 杩斿洖 鍚堝苟鍚庢暟缁� */ public static byte[] bytesMerge(byte[] bGroup1, byte[] bGroup2){ if(bGroup1 == null && bGroup2 == null){ @@ -29,11 +29,11 @@ /** * 鍒ゆ柇鎵�鏈夊瓧鑺傛槸鍚︿负0xFF - * @param bs - * @param index - * @param len - * @return - * @throws Exception + * @param bs 瀛楄妭鏁扮粍 + * @param index 涓嬫爣浣� + * @param len 闀垮害 + * @return 杩斿洖 杩斿洖 + * @throws Exception 寮傚父 */ public static boolean bytesIsAll0xFF(byte[] bs, int index, int len)throws Exception { int count = 0 ; @@ -42,14 +42,14 @@ count++ ; } } - return count==len?true:false ; + return count == len; } - + /** * 浜岃繘鍒惰浆鍗佽繘鍒舵暟 * @param str - * @return - * @throws Exception + * @return 杩斿洖 + * @throws Exception 寮傚父 */ public static int binary2Int(String str) throws Exception { int cnt=0; @@ -69,13 +69,13 @@ return sum; } - + /** * 瀛楄妭杞瓨浜岃繘鍒� - * + * * @param b byte - * @throws Exception - * @return String + * @throws Exception 寮傚父 + * @return 杩斿洖 String */ public static String byte2Binary(byte b) throws Exception { int n = (b + 256) % 256 + 256; @@ -87,11 +87,11 @@ } /** * 瀛楄妭杞瓨8浣嶄簩杩涘埗 - * + * * @param b * byte - * @throws Exception - * @return String + * @throws Exception 寮傚父 + * @return 杩斿洖 String */ public static String byte2bit8Binary(byte b) throws Exception { String s = byte2Binary(b); @@ -101,13 +101,13 @@ } return s; } - + /** * 瀛楄妭鍙朾it * @param b - * @param index - * @throws Exception - * @return String + * @param b + * @throws Exception 寮傚父 + * @return 杩斿洖 String */ public static byte[] getBit(byte b) throws Exception { byte[] bs = new byte[8] ; @@ -125,9 +125,9 @@ /** * 瀛楄妭鍙朾it * @param b - * @param index - * @throws Exception - * @return String + * @param index 涓嬫爣浣� + * @throws Exception 寮傚父 + * @return 杩斿洖 String */ public static byte getBit(byte b, byte index) throws Exception { if(index == 0){ @@ -153,11 +153,11 @@ /** * 涓�涓瓧鑺傝浆姝f暣鏁� - * + * * @param b * byte - * @throws Exception - * @return String + * @throws Exception 寮傚父 + * @return 杩斿洖 String */ public static Short byte2PlusInt(byte b) throws Exception { short v = b ; @@ -167,13 +167,13 @@ return v ; } - + /** * 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘�� * double杞崲byte - * @param bs byte[] + * @param bs 瀛楄妭鏁扮粍 byte[] * @param value double double绫诲瀷鐨勫弬鏁� - * @param from int + * @param from 寮�濮嬩綅 int */ public static void double2Bytes_BE(byte[] bs, double value, int from)throws Exception { boolean b = isOutOfArrLength(bs.length, (from - 1) + 8); @@ -188,9 +188,9 @@ /** * 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘�� * double杞崲byte锛屽瓧鑺傞『搴忔槸鍊掔殑 - * @param bs byte[] + * @param bs 瀛楄妭鏁扮粍 byte[] * @param value double double绫诲瀷鐨勫弬鏁� - * @param from int + * @param from 寮�濮嬩綅 int */ public static void double2Bytes_LE(byte[] bs, double value, int from)throws Exception { boolean b = isOutOfArrLength(bs.length, (from - 1) + 8); @@ -205,8 +205,8 @@ /** * 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘�� * byte杞崲double - * @param bs byte[] - * @param from int + * @param bs 瀛楄妭鏁扮粍 byte[] + * @param from 寮�濮嬩綅 int */ public static double bytes2Double_BE(byte[] bs, int from) throws Exception { long l = bytes2Long_BE(bs, from); @@ -216,8 +216,8 @@ /** * 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘�� * byte杞崲double锛屽瓧鑺傞『搴忔槸鍊掔殑 - * @param bs byte[] - * @param from int + * @param bs 瀛楄妭鏁扮粍 byte[] + * @param from 寮�濮嬩綅 int */ public static double bytes2Double_LE(byte[] bs, int from) throws Exception { long l = bytes2Long_LE(bs, from); @@ -306,7 +306,7 @@ /** * 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘�� - * 杞崲long鍨嬩负byte鏁扮粍 + * 杞崲long鍨嬩负byte鏁扮粍 * @value bs byte[] * @value value long * @value from int @@ -315,8 +315,8 @@ boolean b = isOutOfArrLength(bs.length, (from - 1) + 8); if (b) { for (int i = 0; i < 8; i++) { - bs[from + i] = Long.valueOf(value & 0xff).byteValue(); - value = value >> 8; + bs[from + i] = Long.valueOf(value & 0xff).byteValue(); + value = value >> 8; if(value == 0){ break ; } @@ -325,12 +325,12 @@ throw new Exception("long2Bytes鏃舵暟缁勮秺鐣�"); } } - + /** * 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘�� * 8浣嶅瓧鑺傛暟缁勮浆鎹负闀挎暣鍨� - * @param bs byte[] - * @return + * @param bs 瀛楄妭鏁扮粍 byte[] + * @return 杩斿洖 */ public static long bytes2Long_BE(byte[] bs) { int len = bs.length ; @@ -347,16 +347,16 @@ l = l | ls[i] ; } return l; - } + } return 0L ; } - + /** * 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘�� * 8浣嶅瓧鑺傛暟缁勮浆鎹负闀挎暣鍨� - * @param bs byte[] - * @param from int - * @return + * @param bs 瀛楄妭鏁扮粍 byte[] + * @param from 寮�濮嬩綅 int + * @return 杩斿洖 */ public static long bytes2Long_BE(byte[] bs, int from) throws Exception { boolean b = isOutOfArrLength(bs.length, (from - 1) + 8); @@ -388,10 +388,10 @@ /** * 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘�� * 8浣嶅瓧鑺傛暟缁勮浆鎹负闀挎暣鍨� - * @param bs byte[] - * @param from int + * @param bs 瀛楄妭鏁扮粍 byte[] + * @param from 寮�濮嬩綅 int * @param end int - * @return + * @return 杩斿洖 */ public static long bytes2Long_BE(byte[] bs, int from, int end) throws Exception { boolean b = isOutOfArrLength(bs.length, end); @@ -414,13 +414,13 @@ } } - - + + /** * 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘�� * 8浣嶅瓧鑺傛暟缁勮浆鎹负闀挎暣鍨� - * @param bs byte[] - * @return + * @param bs 瀛楄妭鏁扮粍 byte[] + * @return 杩斿洖 */ public static long bytes2Long_LE(byte[] bs) { int len = bs.length ; @@ -437,16 +437,16 @@ l = l | ls[i] ; } return l; - } + } return 0L ; } /** * 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘�� - * 8浣嶅瓧鑺傛暟缁勮浆鎹负闀挎暣鍨� - * @param bs byte[] - * @param from int - * @return + * 8浣嶅瓧鑺傛暟缁勮浆鎹负闀挎暣鍨� + * @param bs 瀛楄妭鏁扮粍 byte[] + * @param from 寮�濮嬩綅 int + * @return 杩斿洖 */ public static long bytes2Long_LE(byte[] bs, int from) throws Exception { boolean b = isOutOfArrLength(bs.length, (from - 1) + 8); @@ -479,10 +479,10 @@ /** * 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘�� * 8浣嶅瓧鑺傛暟缁勮浆鎹负闀挎暣鍨� - * @param bs byte[] - * @param from int + * @param bs 瀛楄妭鏁扮粍 byte[] + * @param from 寮�濮嬩綅 int * @param end int - * @return + * @return 杩斿洖 */ public static long bytes2Long_LE(byte[] bs, int from, int end) throws Exception { boolean b = isOutOfArrLength(bs.length, end); @@ -551,8 +551,9 @@ /** * 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘�� * 4浣嶅瓧鑺傛暟缁勮浆鎹负鏁村瀷 - * @param b - * @return + * @param bs 瀛楄妭鏁扮粍 + * @param from 寮�濮嬩綅 + * @return 杩斿洖 */ public static int bytes2Int_BE(byte[] bs, int from) throws Exception { boolean b = isOutOfArrLength(bs.length, (from - 1) + 4); @@ -573,13 +574,13 @@ throw new Exception("byte2Int鏃舵暟缁勮秺鐣�"); } } - + /** * 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘�� * 4浣嶅瓧鑺傛暟缁勮浆鎹负鏁村瀷锛屽瓧鑺傞『搴忔槸鍊掔殑 - * @param b - * @return + * @param bs 瀛楄妭鏁扮粍 瀛楄妭鏁扮粍 + * @return 杩斿洖 */ public static int bytes2Int_LE(byte[] bs, int from) throws Exception { boolean b = isOutOfArrLength(bs.length, (from - 1) + 4); @@ -600,7 +601,7 @@ throw new Exception("byte2Int鏃舵暟缁勮秺鐣�"); } } - + /** * 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘�� @@ -674,14 +675,14 @@ /** * 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘�� * 2浣嶅瓧鑺傛暟缁勮浆鎹负鐭暣鍨� - * @param b - * @return + * @param bs 瀛楄妭鏁扮粍 瀛楄妭鏁扮粍 + * @return 杩斿洖 */ public static short bytes2Short_BE(byte[] bs, int from) throws Exception { boolean b = isOutOfArrLength(bs.length, (from - 1) + 2); if (b) { int s = 0; - int s0 = bs[from + 0] ; + int s0 = bs[from + 0] ; int s1 = bs[from + 1] ; // s1涓嶅彉 @@ -697,14 +698,14 @@ /** * 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘�� * 2浣嶅瓧鑺傛暟缁勮浆鎹负鐭暣鍨嬶紝瀛楄妭椤哄簭鏄�掔殑 - * @param b - * @return + * @param bs 瀛楄妭鏁扮粍 瀛楄妭鏁扮粍 + * @return 杩斿洖 */ public static short bytes2Short_LE(byte[] bs, int from) throws Exception { boolean b = isOutOfArrLength(bs.length, (from - 1) + 2); if (b) { int s = 0; - int s0 = bs[from + 0] ; + int s0 = bs[from + 0] ; int s1 = bs[from + 1] ; // s0涓嶅彉 @@ -718,11 +719,11 @@ } /** * 瀛楃鍒颁竴瀛楄妭杞崲 - * + * * @value bs byte[] * @value ch char char绫诲瀷鐨勫弬鏁� * @value index int - * @return + * @return 杩斿洖 */ public static void char2Bytes(byte[] bs, char ch, int index)throws Exception { boolean b = isOutOfArrLength(bs.length, index); @@ -735,10 +736,9 @@ /** * 涓�瀛楄妭杞崲涓哄瓧绗� - * - * @param b + * @param bs 瀛楄妭鏁扮粍 瀛楄妭鏁扮粍 * @value index int - * @return + * @return 杩斿洖 */ public static char bytes2Char(byte[] bs, int index) throws Exception { boolean b = isOutOfArrLength(bs.length, index); @@ -751,13 +751,13 @@ /** * 瀛楃涓插瀷鏁板瓧杞垚byte - * + * * @param s - * @return - * @throws Exception + * @return 杩斿洖 + * @throws Exception 寮傚父 */ public static byte string2byte(String s) throws Exception { - int n = 0; + int n ; try { n = Integer.parseInt(s); } catch (Exception e) { @@ -772,7 +772,7 @@ * @value bs byte[] * @value str String * @value from int - * @return + * @return 杩斿洖 * @throws java.io.UnsupportedEncodingException */ public static int string2Bytes_BE(byte[] bs, String str, int from, int end)throws Exception { @@ -798,7 +798,7 @@ * @value bs byte[] * @value str String * @value from int - * @return + * @return 杩斿洖 * @throws java.io.UnsupportedEncodingException */ public static int string2Bytes_LE(byte[] bs, String str, int from, int end)throws Exception { @@ -824,7 +824,7 @@ * @value bs byte[] * @value str String * @value from int - * @return + * @return 杩斿洖 * @throws java.io.UnsupportedEncodingException */ public static int string2Bytes_BE(byte[] bs, String str, int from)throws Exception { @@ -846,7 +846,7 @@ * @value bs byte[] * @value str String * @value from int - * @return + * @return 杩斿洖 * @throws java.io.UnsupportedEncodingException */ public static int string2Bytes_LE(byte[] bs, String str, int from)throws Exception { @@ -898,10 +898,10 @@ /** * 鍒ゆ柇鏁扮粍涓嬫爣鏄惁瓒婄晫 - * + * * @value bsLength 鏁扮粍鎬婚暱搴� * @value toSite 鏁扮粍鍋忕Щ閲� - * @return + * @return 杩斿洖 */ private static boolean isOutOfArrLength(int bsLength, int toSite) { if (bsLength > toSite) { @@ -911,104 +911,104 @@ } } - + /** - * 瀛楄妭鏁扮粍杞崲鎴愬崄鍏繘鍒剁殑瀛楃涓� - * - * @param b byte[] + * 瀛楄妭鏁扮粍杞崲鎴愬崄鍏繘鍒剁殑瀛楃涓� + * + * @param src byte[] * @param hasBlank 16杩涘埗鏄惁鐢ㄧ┖鏍煎垎闅� - * @return String + * @return 杩斿洖 String */ - public static String bytes2Hex(byte[] src, boolean hasBlank){ - StringBuilder stringBuilder = new StringBuilder(""); - if (src == null || src.length <= 0) { - return null; - } - for (int i = 0; i < src.length; i++) { - int v = src[i] & 0xFF; - String str = Integer.toHexString(v); - if (str.length() < 2) { + public static String bytes2Hex(byte[] src, boolean hasBlank){ + StringBuilder stringBuilder = new StringBuilder(""); + if (src == null || src.length <= 0) { + return null; + } + for (int i = 0; i < src.length; i++) { + int v = src[i] & 0xFF; + String str = Integer.toHexString(v); + if (str.length() < 2) { str = "0" + str; - } + } if (hasBlank) { if (i == 0) { - stringBuilder.append(str); + stringBuilder.append(str); } else { - stringBuilder.append(" " + str); + stringBuilder.append(" " + str); } } else { - stringBuilder.append(str); + stringBuilder.append(str); } - } + } return stringBuilder.toString().toUpperCase(Locale.US); - } + } /** - * 瀛楄妭鏁扮粍杞崲鎴愬崄鍏繘鍒剁殑瀛楃涓� - * - * @param b byte[] + * 瀛楄妭鏁扮粍杞崲鎴愬崄鍏繘鍒剁殑瀛楃涓� + * + * @param src byte[] * @param hasBlank 16杩涘埗鏄惁鐢ㄧ┖鏍煎垎闅� - * @param from - * @param len - * @return String + * @param from 寮�濮嬩綅 + * @param len 闀垮害 + * @return 杩斿洖 String */ - public static String bytes2Hex(byte[] src, boolean hasBlank, int from, int len){ - if (src == null || src.length <= 0 || src.length < from + len) { - return null; - } + public static String bytes2Hex(byte[] src, boolean hasBlank, int from, int len){ + if (src == null || src.length <= 0 || src.length < from + len) { + return null; + } byte[] bb = new byte[len]; for (int i = 0 ; i < len; i++) { bb[i] = src[from + i]; } return bytes2Hex(bb, hasBlank) ; - } - /** + } + /** * 鍗佸叚杩涘埗杞瓧鑺傛暟缁� - * @param hexString the hex string - * @return byte[] - */ - public static byte[] hex2Bytes(String hex) { - if (hex == null || hex.equals("")) { - return null; - } - hex = hex.toUpperCase(Locale.ENGLISH); - int length = hex.length() / 2; - char[] hexChars = hex.toCharArray(); - byte[] d = new byte[length]; - for (int i = 0; i < length; i++) { - int pos = i * 2; - d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1])); - } - return d; - } - /** + * @param hex the hex string + * @return 杩斿洖 byte[] + */ + public static byte[] hex2Bytes(String hex) { + if (hex == null || hex.equals("")) { + return null; + } + hex = hex.toUpperCase(Locale.ENGLISH); + int length = hex.length() / 2; + char[] hexChars = hex.toCharArray(); + byte[] d = new byte[length]; + for (int i = 0; i < length; i++) { + int pos = i * 2; + d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1])); + } + return d; + } + /** * 鍗佸叚杩涘埗杞瓧鑺傛暟缁� - * @param hexString the hex string - * @return byte[] - */ - public static int hex2Bytes(String hex, byte[] bs, int fromIndex) { - if (hex == null || hex.equals("")) { - return fromIndex; - } - hex = hex.toUpperCase(Locale.ENGLISH); - int length = hex.length() / 2; - char[] hexChars = hex.toCharArray(); - byte[] d = new byte[length]; - for (int i = 0; i < length; i++) { - int pos = i * 2; - d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1])); + * @param hex the hex string + * @return 杩斿洖 byte[] + */ + public static int hex2Bytes(String hex, byte[] bs, int fromIndex) { + if (hex == null || hex.equals("")) { + return fromIndex; + } + hex = hex.toUpperCase(Locale.ENGLISH); + int length = hex.length() / 2; + char[] hexChars = hex.toCharArray(); + byte[] d = new byte[length]; + for (int i = 0; i < length; i++) { + int pos = i * 2; + d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1])); } for(int i = 0 ; i < d.length; i++){ bs[fromIndex++] = d[i] ; } - return fromIndex ; - } + return fromIndex ; + } private static final char[] HEX_CHAR = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; /** * 灏哹yte[]杞崲涓�16杩涘埗瀛楃涓� * * @param bytes 寰呰浆鎹yte[] - * @return 杞崲鍚庣殑瀛楃涓� + * @return 杩斿洖 杞崲鍚庣殑瀛楃涓� */ public static String bytesToHex(byte[] bytes) { //涓�涓猙yte涓�8浣嶏紝鍙敤涓や釜鍗佸叚杩涘埗浣嶆爣璇� @@ -1027,12 +1027,40 @@ } return new String(buf); } + /** + * 灏哹yte[]杞崲涓�16杩涘埗瀛楃涓� + * + * @param bytes 寰呰浆鎹yte[] + * @return 杩斿洖 杞崲鍚庣殑瀛楃涓� + */ + public static String bytesToHex(byte[] bytes, int startIndex, int endIndex) { + byte[] bs = new byte[endIndex - startIndex + 1] ; + byte j = 0 ; + for(int i = startIndex; i <= endIndex; i++){ + bs[j++] = bytes[i] ; + } + //涓�涓猙yte涓�8浣嶏紝鍙敤涓や釜鍗佸叚杩涘埗浣嶆爣璇� + char[] buf = new char[bs.length * 2]; + int a = 0; + int index = 0; + for (byte b : bs) { // 浣跨敤闄や笌鍙栦綑杩涜杞崲 + if (b < 0) { + a = 256 + b; + } else { + a = b; + } + + buf[index++] = HEX_CHAR[a / 16]; + buf[index++] = HEX_CHAR[a % 16]; + } + return new String(buf); + } /** * 灏�16杩涘埗瀛楃涓茶浆鎹负byte[] * * @param str 寰呰浆鎹㈠瓧绗︿覆 - * @return 杞崲鍚庣殑byte[] + * @return 杩斿洖 杞崲鍚庣殑byte[] */ public static byte[] hexToBytes(String str) { if (str == null || "".equals(str.trim())) { @@ -1051,18 +1079,18 @@ /** * Convert char to byte * @param c char - * @return byte + * @return 杩斿洖 byte */ private static byte charToByte(char c) { return (byte) "0123456789ABCDEF".indexOf(c); - } - + } + /** * 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘�� * 鏁村舰杞垚BCD缂栫爜 - * @param l - * @return + * @param i + * @return 杩斿洖 */ public static byte[] int2BCD_BE(int i)throws Exception { String str = "" + i; @@ -1079,8 +1107,8 @@ /** * 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘�� * 鏁村舰杞垚BCD缂栫爜锛屽瓧鑺傞『搴忔槸鍊掔殑 - * @param l - * @return + * @param i + * @return 杩斿洖 */ public static byte[] int2BCD_LE(int i)throws Exception { String str = "" + i; @@ -1099,7 +1127,7 @@ * 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘�� * 闀挎暣褰㈣浆鎴怋CD缂栫爜 * @param l - * @return + * @return 杩斿洖 */ public static byte[] long2BCD_BE(long l)throws Exception { String str = "" + l; @@ -1118,7 +1146,7 @@ * 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘�� * 闀挎暣褰㈣浆鎴怋CD缂栫爜锛屽瓧鑺傞『搴忔槸鍊掔殑 * @param l - * @return + * @return 杩斿洖 */ public static byte[] long2BCD_LE(long l) throws Exception { String str = "" + l; @@ -1137,30 +1165,30 @@ * 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘�� * 瀛楃涓插瀷鏁板瓧杞垚BCD缂栫爜 * @param s - * @return - * @throws Exception + * @return 杩斿洖 + * @throws Exception 寮傚父 */ public static byte[] string2BCD_BE(String s) throws Exception { - byte[] b = null; + byte[] b ; if (s.length() % 2 == 0) { b = new byte[s.length() / 2]; } else { b = new byte[(s.length() / 2) + 1]; } - + encodeBCD_BE(s, b, 0, b.length); return b ; } - + /** * 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘�� * 瀛楃涓茶浆鎹㈡垚byte鏁扮粍 * @value bs byte[] * @value str String * @value fromIndex int - * @return - * @throws java.io.Exception + * @return 杩斿洖 + * @throws Exception 寮傚父 寮傚父 */ public static int string2BCD_BE(byte[] bs, String str, int fromIndex)throws Exception { byte[] bb = string2BCD_BE(str); @@ -1179,8 +1207,8 @@ * 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘�� * 瀛楃涓插瀷鏁板瓧杞垚BCD缂栫爜锛屽瓧鑺傞『搴忔槸鍊掔殑 * @param s - * @return - * @throws Exception + * @return 杩斿洖 + * @throws Exception 寮傚父 */ public static byte[] string2BCD_LE(String s) throws Exception { byte[] b = null; @@ -1193,15 +1221,15 @@ return b; } - + /** * 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘�� * 瀛楃涓茶浆鎹㈡垚byte鏁扮粍 * @value bs byte[] * @value str String * @value fromIndex int - * @return - * @throws java.io.Exception + * @return 杩斿洖 + * @throws Exception 寮傚父 寮傚父 */ public static int string2BCD_LE(byte[] bs, String str, int fromIndex)throws Exception { byte[] bb = string2BCD_LE(str); @@ -1221,10 +1249,8 @@ * 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘�� * BCD缂栫爜杞垚鏁村瀷 * @param b - * @param startIndex - * @param endIndex - * @return - * @throws Exception + * @return 杩斿洖 + * @throws Exception 寮傚父 */ public static int BCD2Int_BE(byte b) throws Exception { String str = ""; @@ -1237,10 +1263,8 @@ * 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘�� * BCD缂栫爜杞垚鏁村瀷锛屽瓧鑺傞『搴忔槸鍊掔殑 * @param b - * @param startIndex - * @param endIndex - * @return - * @throws Exception + * @return 杩斿洖 + * @throws Exception 寮傚父 */ public static int BCD2Int_LE(byte b) throws Exception { String str = ""; @@ -1255,8 +1279,8 @@ * @param b * @param startIndex * @param endIndex - * @return - * @throws Exception + * @return 杩斿洖 + * @throws Exception 寮傚父 */ public static int BCD2Int_BE(byte[] b, int startIndex, int endIndex)throws Exception { String str = ""; @@ -1271,8 +1295,8 @@ * @param b * @param startIndex * @param endIndex - * @return - * @throws Exception + * @return 杩斿洖 + * @throws Exception 寮傚父 */ public static int BCD2Int_LE(byte[] b, int startIndex, int endIndex)throws Exception { String str = ""; @@ -1287,8 +1311,8 @@ * @param b * @param startIndex * @param endIndex - * @return - * @throws Exception + * @return 杩斿洖 + * @throws Exception 寮傚父 */ public static long BCD2Long_BE(byte[] b, int startIndex, int endIndex)throws Exception { String str = ""; @@ -1304,8 +1328,8 @@ * @param b * @param startIndex * @param endIndex - * @return - * @throws Exception + * @return 杩斿洖 + * @throws Exception 寮傚父 */ public static long BCD2Long_LE(byte[] b, int startIndex, int endIndex)throws Exception { String str = ""; @@ -1320,8 +1344,8 @@ * @param b * @param startIndex * @param endIndex - * @return - * @throws Exception + * @return 杩斿洖 + * @throws Exception 寮傚父 */ public static String BCD2String_BE(byte[] b, int startIndex, int endIndex) throws Exception { return decodeBCD_BE(b, startIndex, endIndex - startIndex + 1); @@ -1333,8 +1357,8 @@ * @param b * @param startIndex * @param endIndex - * @return - * @throws Exception + * @return 杩斿洖 + * @throws Exception 寮傚父 */ public static String BCD2String_LE(byte[] b, int startIndex, int endIndex) throws Exception { return decodeBCD_LE(b, startIndex, endIndex - startIndex + 1); @@ -1342,17 +1366,17 @@ /** * 澶х妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍楂樺瓧鑺傘�� - * 缂栫爜BCD锛屼緥濡�1387缂栫爜鎴� 13 87锛岄『搴忔槸姝g殑 + * 缂栫爜BCD锛屼緥濡�1387缂栫爜鎴� 13 87锛岄『搴忔槸姝g殑 * @param value * @param dest * @param startIndex - * @param length + * @param length 闀垮害 */ private static void encodeBCD_BE(String value, byte[] dest, int startIndex, int length)throws Exception { if (value == null || !value.matches("\\d*")) { throw new Exception("鏁板瓧杞垚BCD缂栫爜鏃跺嚭閿欙紝涓嶆槸鍚堟硶鏁板瓧:" + value, null); } - + int[] tmpInts = new int[2 * length]; int index = value.length() - 1; for (int i = tmpInts.length - 1; i >= 0 && index >= 0; i--, index--) { @@ -1362,20 +1386,20 @@ dest[i] = (byte) (tmpInts[2 * j] * 16 + tmpInts[2 * j + 1]); } } - + /** * 灏忕妯″紡銆婃暟鎹綆浣嶅湪鏁扮粍浣庡瓧鑺傘�� - * 缂栫爜BCD锛屼緥濡�1387缂栫爜鎴� 87 13锛岄『搴忔槸鍊掔殑 + * 缂栫爜BCD锛屼緥濡�1387缂栫爜鎴� 87 13锛岄『搴忔槸鍊掔殑 * @param value * @param dest * @param startIndex - * @param length + * @param length 闀垮害 */ private static void encodeBCD_LE(String value, byte[] dest, int startIndex, int length)throws Exception { if (value == null || !value.matches("\\d*")) { throw new Exception("鏁板瓧杞垚BCD缂栫爜鏃跺嚭閿欙紝涓嶆槸鍚堟硶鏁板瓧:" + value, null); } - + int[] tmpInts = new int[2 * length]; int index = value.length() - 1; for (int i = 0; i <= tmpInts.length - 1 && index >= 0; i++, index--) { @@ -1393,8 +1417,8 @@ * 瑙g爜BCD锛岄『搴忔槸姝g殑 * @param src * @param startIndex - * @param length - * @return + * @param length 闀垮害 + * @return 杩斿洖 */ private static String decodeBCD_BE(byte[] src, int startIndex, int length)throws Exception { StringBuilder sb = new StringBuilder(); @@ -1415,8 +1439,8 @@ * 缂栫爜BCD锛岄『搴忔槸鍊掔殑 * @param src * @param startIndex - * @param length - * @return + * @param length 闀垮害 + * @return 杩斿洖 */ private static String decodeBCD_LE(byte[] src, int startIndex, int length)throws Exception { StringBuilder sb = new StringBuilder(); @@ -1462,6 +1486,7 @@ // System.out.println(v5); // // } + /* public static void main(String[] args) throws Exception { byte[] bs = new byte[]{0x38, 0x36, 0x39, 0x31} ; String s = bytes2String_BE(bs, 0, 3) ; @@ -1475,5 +1500,6 @@ } System.out.println(v); } + */ } diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DateTime.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DateTime.java index 1e04eeb..158a591 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DateTime.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/DateTime.java @@ -1619,7 +1619,7 @@ } - + /* public static void main(String[] args){ Long now = getTime() ; System.out.println(now); @@ -1631,6 +1631,6 @@ String s = yyyy_MM_dd_HH_mm_ss(dt); System.out.println(s); } - + */ } diff --git a/pipIrr-platform/pipIrr-global/pipIrr-global.iml b/pipIrr-platform/pipIrr-global/pipIrr-global.iml index 89d9c6f..286d8a0 100644 --- a/pipIrr-platform/pipIrr-global/pipIrr-global.iml +++ b/pipIrr-platform/pipIrr-global/pipIrr-global.iml @@ -25,24 +25,21 @@ </content> <orderEntry type="jdk" jdkName="20" jdkType="JavaSDK" /> <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module" module-name="pipIrr-common" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:3.1.3" level="project" /> + <orderEntry type="module" module-name="pipIrr-common" scope="PROVIDED" /> + <orderEntry type="module" module-name="pipIrr-common" scope="PROVIDED" /> + <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:3.1.3" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:3.1.3" level="project" /> + <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:3.1.3" level="project" /> + <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:3.1.3" level="project" /> + <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.4.11" level="project" /> + <orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.4.11" level="project" /> + <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.20.0" level="project" /> + <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.20.0" level="project" /> + <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:2.0.7" level="project" /> <orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:2.1.1" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-core:6.0.11" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-jcl:6.0.11" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:3.1.3" level="project" /> - <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:10.1.12" level="project" /> - <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:10.1.12" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-web:6.0.11" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-beans:6.0.11" level="project" /> - <orderEntry type="library" name="Maven: io.micrometer:micrometer-observation:1.11.2" level="project" /> - <orderEntry type="library" name="Maven: io.micrometer:micrometer-commons:1.11.2" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:6.0.11" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-aop:6.0.11" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-context:6.0.11" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-expression:6.0.11" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:3.1.3" level="project" /> + <orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.33" level="project" /> <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:10.1.12" level="project" /> <orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:8.0.1.Final" level="project" /> <orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:3.0.2" level="project" /> @@ -54,28 +51,25 @@ <orderEntry type="library" name="Maven: org.springdoc:springdoc-openapi-starter-common:2.2.0" level="project" /> <orderEntry type="library" name="Maven: io.swagger.core.v3:swagger-core-jakarta:2.2.15" level="project" /> <orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.12.0" level="project" /> + <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:2.0.7" level="project" /> <orderEntry type="library" name="Maven: io.swagger.core.v3:swagger-annotations-jakarta:2.2.15" level="project" /> <orderEntry type="library" name="Maven: io.swagger.core.v3:swagger-models-jakarta:2.2.15" level="project" /> <orderEntry type="library" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:4.0.0" level="project" /> <orderEntry type="library" name="Maven: jakarta.activation:jakarta.activation-api:2.1.2" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.15.2" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: org.springframework.boot:spring-boot-devtools:3.1.3" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:3.1.3" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:3.1.3" level="project" /> - <orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.28" level="project" /> - <orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.20" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-log4j2:2.7.9" level="project" /> - <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-slf4j-impl:2.20.0" level="project" /> - <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.20.0" level="project" /> - <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:2.0.7" level="project" /> - <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.20.0" level="project" /> - <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-jul:2.20.0" level="project" /> - <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:2.0.7" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.2" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.15.2" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.15.2" level="project" /> - <orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.33" level="project" /> + <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.15.2" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.15.2" level="project" /> + <orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.2" level="project" /> + <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.15.2" level="project" /> + <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:6.0.11" level="project" /> + <orderEntry type="library" name="Maven: org.springframework:spring-aop:6.0.11" level="project" /> + <orderEntry type="library" name="Maven: org.springframework:spring-beans:6.0.11" level="project" /> + <orderEntry type="library" name="Maven: org.springframework:spring-context:6.0.11" level="project" /> + <orderEntry type="library" name="Maven: org.springframework:spring-expression:6.0.11" level="project" /> + <orderEntry type="library" name="Maven: org.springframework:spring-web:6.0.11" level="project" /> + <orderEntry type="library" name="Maven: io.micrometer:micrometer-observation:1.11.2" level="project" /> + <orderEntry type="library" name="Maven: io.micrometer:micrometer-commons:1.11.2" level="project" /> + <orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.28" level="project" /> <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.5.3.2" level="project" /> <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.5.3.2" level="project" /> <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.5.3.2" level="project" /> @@ -84,12 +78,11 @@ <orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.6" level="project" /> <orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.13" level="project" /> <orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.1.1" level="project" /> + <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:3.1.3" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.1.3" level="project" /> <orderEntry type="library" name="Maven: com.zaxxer:HikariCP:5.0.1" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:6.0.11" level="project" /> <orderEntry type="library" name="Maven: org.springframework:spring-tx:6.0.11" level="project" /> - <orderEntry type="library" name="Maven: cglib:cglib:3.3.0" level="project" /> - <orderEntry type="library" name="Maven: org.ow2.asm:asm:7.1" level="project" /> <orderEntry type="library" name="Maven: com.alibaba.fastjson2:fastjson2:2.0.40" level="project" /> <orderEntry type="library" name="Maven: com.alibaba.fastjson2:fastjson2-extension-spring6:2.0.40" level="project" /> <orderEntry type="library" name="Maven: com.alibaba.fastjson2:fastjson2-extension:2.0.40" level="project" /> diff --git a/pipIrr-platform/pipIrr-global/pom.xml b/pipIrr-platform/pipIrr-global/pom.xml index 960b924..1131ab6 100644 --- a/pipIrr-platform/pipIrr-global/pom.xml +++ b/pipIrr-platform/pipIrr-global/pom.xml @@ -21,23 +21,19 @@ <groupId>com.dy</groupId> <artifactId>pipIrr-common</artifactId> <version>1.0.0</version> - </dependency> - - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - <version>3.1.3</version> + <scope>provided</scope> + <!-- optional=true锛屼笉浼犻�掍緷璧栵紝鍗硃ipIrr-web-base渚濊禆pipIrr-global锛屼絾涓嶄細浼犻�掍緷璧栧埌pipIrr-common --> + <optional>true</optional> <exclusions> <exclusion> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-json</artifactId> - </exclusion> - <exclusion> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-logging</artifactId> + <!-- 鎺掗櫎鎺塸ipIrr-common鐨勬墍鏈変緷璧栵紝鏈ā鍧楄嚜宸卞畾涔変緷璧� --> + <groupId>*</groupId> + <artifactId>*</artifactId> </exclusion> </exclusions> </dependency> + + <!-- 杈撳叆鍙傛暟鎹獙璇� --> <dependency> <groupId>org.springframework.boot</groupId> @@ -53,47 +49,19 @@ <artifactId>springdoc-openapi-starter-webmvc-api</artifactId> </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-devtools</artifactId> - <version>3.1.3</version> - <scope>runtime</scope> - </dependency> <!-- lombok --> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.28</version> </dependency> - <dependency> - <groupId>org.aspectj</groupId> - <artifactId>aspectjweaver</artifactId> - <version>1.9.20</version> - </dependency> - <!--log4j2鏃ュ織--> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-log4j2</artifactId> - <version>2.7.9</version> - </dependency> - <!-- 鐢ㄤ簬杈ㄨlog4j2.yml鏂囦欢 --> - <dependency> - <groupId>com.fasterxml.jackson.dataformat</groupId> - <artifactId>jackson-dataformat-yaml</artifactId> - <version>2.15.2</version> - </dependency> - <!--mybatis-plus-spring-boot--> + <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.5.3.2</version> </dependency> <!-- 闃块噷fastjson --> - <dependency> - <groupId>cglib</groupId> - <artifactId>cglib</artifactId> - <version>3.3.0</version> - </dependency> <dependency> <groupId>com.alibaba.fastjson2</groupId> <artifactId>fastjson2</artifactId> @@ -120,21 +88,79 @@ </dependency> </dependencies> + <build> <plugins> <plugin> - <!-- spring boot鎻愪緵鐨刴aven鎵撳寘鎻掍欢 --> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> + <!-- 璇ユ彃浠朵笉浼氬皢椤圭洰涓紩鍏ョ殑渚濊禆鎵撹繘鏈�缁堢殑 Jar 鏂囦欢 --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> <configuration> + <archive> + <!-- 鐢熸垚鐨刯ar涓紝涓嶈鍖呭惈pom.xml鍜宲om.properties杩欎袱涓枃浠� --> + <addMavenDescriptor>false</addMavenDescriptor> + <!-- 杩欓儴鍒嗗彲鏈夊彲鏃�,鍔犱笂鐨勮瘽鍒欑洿鎺ョ敓鎴愬彲杩愯jar鍖� + <manifest> + <mainClass>com.dy.Main</mainClass> + <useUniqueVersions>false</useUniqueVersions> + <addClasspath>true</addClasspath> + <classpathPrefix>lib/</classpathPrefix> + </manifest> + --> + <!-- manifestEntries鐨勪綔鐢ㄦ槸鎸囧畾鏈湴锛堣嚜宸变笅杞界殑lib涓嬬殑锛塲ar鍖呮坊鍔犲埌MANIFEST.MF鏂囦欢涓幓 + <manifestEntries> + <Class-Path>.lib/alipay-sdk.java.jar</Class-Path> + </manifestEntries> + --> + </archive> + <!-- 鎺掗櫎鏌愪釜鏂囦欢 <excludes> - <exclude> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - </exclude> + <exclude>com/dy/App.class</exclude> </excludes> + --> + <!-- 鍙墽琛宩ar杩涜鍛藉悕銆傝繖鏍蜂細鎵撳寘鎴愪袱涓猨ar鍖咃紝涓嶄細瀵规櫘閫歫ar閲嶆柊鍛藉悕銆� + <classifier>exec</classifier> + --> </configuration> </plugin> + <plugin> + <!-- 褰撻」鐩腑渚濊禆姣旇緝澶氭椂锛屾垜浠彲浠ュ�熷姪 maven-dependency-plugin 鎻掍欢鑷姩甯垜浠笅杞戒緷璧栫殑 Jar 鏂囦欢锛屾帹鑽愬皢璇ユ彃浠剁粦瀹氬埌package鐢熷懡鍛ㄦ湡涓� --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <!-- 缁戝畾鐢熷懡鍛ㄦ湡 --> + <phase>package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <!-- 璁剧疆渚濊禆鐨勫瓨鏀捐矾寰� --> + <configuration> + <outputDirectory>${project.build.directory}/lib</outputDirectory> + </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> @@ -143,11 +169,7 @@ <skipTests>true</skipTests> </configuration> </plugin> - <plugin> - <!-- 寮哄埗璁惧畾 java缂栬瘧鐗堟湰锛岃繍琛岀幆澧冪増鏈� --> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - </plugin> + </plugins> </build> </project> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaClient.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaClient.java index af0402b..8650633 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaClient.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaClient.java @@ -95,7 +95,7 @@ * 缂栧彿 */ @Schema(description = "鍐滄埛缂栧彿(绯荤粺鑷姩鐢熸垚)", requiredMode = Schema.RequiredMode.NOT_REQUIRED) - public Integer num; + public String num ; /** * 鎵嬫満鍙� diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaDistrict.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaDistrict.java index d88ab02..083d580 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaDistrict.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoBa/BaDistrict.java @@ -55,9 +55,9 @@ /** * 琛屾斂鍖虹紪鍙� */ - @Schema(description = "琛屾斂鍖虹紪鍙�", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "琛屾斂鍖虹紪鍙�(鐪佸競鍘�2浣嶏紝闀囨潙3浣�)", requiredMode = Schema.RequiredMode.REQUIRED) @NotEmpty(message = "琛屾斂鍖虹紪鍙蜂笉鑳戒负绌�") //涓嶈兘涓虹┖涔熶笉鑳戒负null - @Max(message = "琛屾斂鍖虹紪鍙蜂笉澶т簬99", value = 99) + @Max(message = "琛屾斂鍖虹紪鍙蜂笉澶т簬99", value = 999) @Min(message = "琛屾斂鍖虹紪鍙蜂笉灏忎簬0",value = 0) public String num; diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/DistrictLevel.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/DistrictLevel.java index edc4a10..6cd780d 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/DistrictLevel.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/DistrictLevel.java @@ -9,6 +9,7 @@ */ public enum DistrictLevel implements IEnum { + Province((byte)0, "鐪�"), City((byte)1, "甯�"), County((byte)2, "鍘�"), Town((byte)3, "闀�"), @@ -34,7 +35,9 @@ } public static DistrictLevel get(Byte code){ - if(code.byteValue() == City.code.byteValue()){ + if(code.byteValue() == Province.code.byteValue()){ + return Province ; + }if(code.byteValue() == City.code.byteValue()){ return City ; }else if(code.byteValue() == County.code.byteValue()){ return County ; diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml index d189a60..72b6ac0 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml @@ -77,7 +77,7 @@ commandCallback: http://127.0.0.1:8079/remote/rtu/comCallback webPort: 8070 actutorPort: 9070 - idSuffix: 0 + idSuffix: 0 #姝ゅ鍙槸鍗犱綅锛屽叿浣撹缃湪閫氫俊涓棿浠剁殑config.xml涓缃� sso: checkUrl: http://127.0.0.1:8079/sso/sso/ssoCheck webPort: 8079 diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/init-config.xml b/pipIrr-platform/pipIrr-global/src/main/resources/init-config.xml index 6259b52..0eaec32 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/init-config.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/init-config.xml @@ -4,9 +4,12 @@ <!-- 澶氫釜缁勭粐锛岀敤缂栧彿鍖哄垎锛岀紪鍙蜂粠1寮�濮� --> <org1 name="ym"> <districts> - <city name="妤氶泟褰濇棌鑷不宸�" num="23" level="1"> - <country name="鍏冭皨鍘�" num="28" level="2" /> - </city> + <!-- 鐪佺骇琛屾斂鍖哄湪涓氬姟闇�姹備腑娌℃湁浣撶幇锛屽彧鍦ㄧ帇姹熸捣IC鍗¤璁′腑鐢ㄥ埌锛屾墍浠ヨ繖閲屾妸鍏秎evel璁剧疆涓�0 --> + <province name="浜戝崡鐪�" num="53" level="0"> + <city name="妤氶泟褰濇棌鑷不宸�" num="23" level="1"> + <country name="鍏冭皨鍘�" num="28" level="2" /> + </city> + </province> </districts> <user name="瓒呯骇绠$悊鍛�" phone="admin" password="admin" supperAdmin="1" /> </org1> diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaClientMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaClientMapper.xml index c5a0f21..1685fd1 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaClientMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaClientMapper.xml @@ -12,7 +12,7 @@ <result column="divideId" jdbcType="BIGINT" property="divideId" /> <result column="typeId" jdbcType="BIGINT" property="typeId" /> <result column="name" jdbcType="VARCHAR" property="name" /> - <result column="num" jdbcType="INTEGER" property="num" /> + <result column="num" jdbcType="VARCHAR" property="num" /> <result column="phone" jdbcType="VARCHAR" property="phone" /> <result column="idCard" jdbcType="VARCHAR" property="idcard" /> <result column="area" jdbcType="FLOAT" property="area" /> @@ -29,8 +29,9 @@ </sql> <sql id="part_Column_List"> <!--@mbg.generated--> - ${alias}.id, ${alias}.countyId, ${alias}.townId, ${alias}.villageId, ${alias}.blockId, ${alias}.divideId, ${alias}.typeId, ${alias}.name, ${alias}.num, ${alias}.phone, ${alias}.idCard, ${alias}.area, ${alias}.district,${alias}.address, ${alias}.remark, - ${alias}.disabled + ${alias}.id, ${alias}.countyId, ${alias}.townId, ${alias}.villageId, ${alias}.blockId, ${alias}.divideId, ${alias}.typeId, + ${alias}.`name`, ${alias}.num, ${alias}.phone, ${alias}.idCard, ${alias}.area, ${alias}.district,${alias}.address, + ${alias}.remark, ${alias}.disabled </sql> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> @@ -129,7 +130,7 @@ values (#{id,jdbcType=BIGINT}, #{countyId,jdbcType=BIGINT}, #{townId,jdbcType=BIGINT}, #{villageId,jdbcType=BIGINT}, #{blockId,jdbcType=BIGINT}, #{divideId,jdbcType=BIGINT}, #{typeId,jdbcType=BIGINT}, - #{name,jdbcType=VARCHAR}, #{num,jdbcType=INTEGER}, + #{name,jdbcType=VARCHAR}, #{num,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{idcard,jdbcType=VARCHAR}, #{area,jdbcType=FLOAT}, #{district,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR}, @@ -219,7 +220,7 @@ #{name,jdbcType=VARCHAR}, </if> <if test="num != null"> - #{num,jdbcType=INTEGER}, + #{num,jdbcType=VARCHAR}, </if> <if test="phone != null"> #{phone,jdbcType=VARCHAR}, @@ -272,7 +273,7 @@ 'name' = #{name,jdbcType=VARCHAR}, </if> <if test="num != null"> - num = #{num,jdbcType=INTEGER}, + num = #{num,jdbcType=VARCHAR}, </if> <if test="phone != null"> phone = #{phone,jdbcType=VARCHAR}, @@ -312,7 +313,7 @@ blockId = #{blockId,jdbcType=BIGINT}, typeId = #{typeId,jdbcType=BIGINT}, `name` = #{name,jdbcType=VARCHAR}, - num = #{num,jdbcType=INTEGER}, + num = #{num,jdbcType=VARCHAR}, phone = #{phone,jdbcType=VARCHAR}, idcard = #{idcard,jdbcType=VARCHAR}, area = #{area,jdbcType=FLOAT}, diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/pom.xml b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/pom.xml index 6131694..bcbec20 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/pom.xml +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/pom.xml @@ -11,25 +11,125 @@ <packaging>jar</packaging> <artifactId>pipIrr-mw-accept</artifactId> + <version>1.0.0</version> <name>pipIrr-mw-accept</name> <description>閫氫俊涓棿浠�</description> <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-json</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + <!-- 绯荤粺鐩戠 --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-actuator</artifactId> + </dependency> + + <!-- api鍦ㄧ嚎鏂囨。 https://springdoc.org/#modules--> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> + </dependency> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-starter-webmvc-api</artifactId> + </dependency> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-security</artifactId> + </dependency> + + <!-- 鍔ㄦ�佸姞杞芥柊缂栬瘧鐨勭被 --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-devtools</artifactId> + <scope>runtime</scope> + </dependency> + + <!--mysql椹卞姩--> + <dependency> + <groupId>com.mysql</groupId> + <artifactId>mysql-connector-j</artifactId> + <version>8.0.33</version> + </dependency> + <!--druid-spring-boot杩炴帴姹�--> + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>druid-spring-boot-starter</artifactId> + <version>1.2.20</version> + </dependency> + <!--mybatis-plus-spring-boot--> + <dependency> + <groupId>com.baomidou</groupId> + <artifactId>mybatis-plus-boot-starter</artifactId> + <version>3.5.3.2</version> + </dependency> + + <!-- bean鍜宮ap浜掕浆鎹� --> + <dependency> + <groupId>org.apache.dubbo</groupId> + <artifactId>dubbo</artifactId> + <version>3.2.7</version> + <exclusions> + <exclusion> + <groupId>io.netty</groupId> + <artifactId>netty-all</artifactId> + </exclusion> + <exclusion> + <groupId>org.yaml</groupId> + <artifactId>snakeyaml</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + </exclusion> + <exclusion> + <groupId>com.alibaba.spring</groupId> + <artifactId>spring-context-support</artifactId> + </exclusion> + <exclusion> + <groupId>com.alibaba.fastjson2</groupId> + <artifactId>fastjson2</artifactId> + </exclusion> + <exclusion> + <groupId>com.alibaba</groupId> + <artifactId>hessian-lite</artifactId> + </exclusion> + <exclusion> + <groupId>org.javassist</groupId> + <artifactId>javassist</artifactId> + </exclusion> + </exclusions> + </dependency> + <!-- apache mina --> <dependency> <groupId>org.apache.mina</groupId> <artifactId>mina-core</artifactId> - <version>2.2.1</version> - </dependency> - <dependency> - <groupId>org.apache.mina</groupId> - <artifactId>mina-filter-compression</artifactId> - <version>2.2.1</version> + <version>2.2.2</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>2.0.7</version> </dependency> + + <!-- 娴嬭瘯 --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> </dependencies> </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 a93ac94..f69af6f 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 @@ -6,7 +6,6 @@ import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.EnableAspectJAutoProxy; 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 fab544b..6829b00 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,6 +3,7 @@ import java.util.ArrayList; import java.util.List; +import com.dy.aceMw.server.tasks.BusiConstantTask; import com.dy.common.mw.UnitInterface; import com.dy.common.mw.UnitStartedCallbackInterface; import com.dy.common.mw.channel.rmi.RmiConfigVo; @@ -147,7 +148,14 @@ 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.cacheUpDownDataWarnCount = conf.getSetAttrPlusInt(doc, "config.base", "cacheUpDownDataWarnCount", null, 1, null, null) ; + //涓婁笅琛屾暟鎹紦瀛橀槦鍒椾腑缂撳瓨鏁版嵁涓暟鐨勬渶澶у�硷紝杩欎釜涓庣幇瀹為」鐩墍鎺ユ按琛ㄦ暟鐩稿叧 + ServerProperties.cacheUpDownDataMaxCount = conf.getSetAttrPlusInt(doc, "config.base", "cacheUpDownDataMaxCount", null, 1, null, null) ; + if(ServerProperties.cacheUpDownDataMaxCount <= ServerProperties.cacheUpDownDataWarnCount){ + throw new Exception("cacheUpDownDataMaxCount蹇呴』澶т簬cacheUpDownDataWarnCount") ; + } + //璁剧疆ID鐢熸垚鍣ㄧ殑鍚庣紑 IDLongGenerator.setSuffix(ServerProperties.dbDataIdSuffix.intValue()); @@ -175,29 +183,42 @@ //鏀寔妯″潡锛� 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 ; } - - supVo.enableThreadPool = conf.getSetAttrBoolean(doc, "config.support", "enableThreadPool", null, null) ; - -// supVo.enableSpringHibernate = conf.getSetAttrBoolean(doc, "config.support", "enableSpringHibernate", null, null) ; -// if(supVo.enableSpringHibernate){ -// supVo.springXmlFile = conf.getSetAttrTxt(doc, "config.support", "springXmlFile", null, false, null) ; -// } - + if(supVo.long_maxThread == 0 || supVo.long_minThread == 0){ + supVo.enableLongThreadPool = false ; + }else{ + supVo.enableLongThreadPool = true ; + } + supVo.showStartInfo = showStartInfo ; AdapterImp_SupportUnit supAdap = new AdapterImp_SupportUnit() ; @@ -270,14 +291,15 @@ CoreUnitConfigVo coreConfVo = new CoreUnitConfigVo(); coreConfVo.sleepBigBusy = conf.getSetAttrPlusInt(doc, "config.core", "sleepBigBusy", null, 1, 200, null).longValue() ; coreConfVo.sleepSmallBusy = conf.getSetAttrPlusInt(doc, "config.core", "sleepSmallBusy", null, 2, 1000, null).longValue(); - coreConfVo.queueWarnSize = conf.getSetAttrPlusInt(doc, "config.core", "queueWarnSize", null, 500, 1000000, null) ; - coreConfVo.queueMaxSize = conf.getSetAttrPlusInt(doc, "config.core", "queueMaxSize", null, 5000, 3000000, null) ; + coreConfVo.queueWarnSize = ServerProperties.cacheUpDownDataWarnCount ; + coreConfVo.queueMaxSize = ServerProperties.cacheUpDownDataMaxCount ; coreConfVo.showStartInfo = showStartInfo ; AdapterImp_CoreUnit coreAdap = new AdapterImp_CoreUnit(); coreAdap.setConfig(coreConfVo); 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) { diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/ServerProperties.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/ServerProperties.java index 84a9a42..670ef33 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/ServerProperties.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/ServerProperties.java @@ -25,6 +25,12 @@ public static Long lastUpDataTimeLive = 1000L ; //鏁版嵁搴撴暟鎹甶d鐢熸垚鍣ㄧ殑id鍚庣紑锛�0鏄粯璁ょ殑鍚庣紑锛屼竴鑸瑆eb绯荤粺搴旂敤锛屾暟鎹腑闂翠欢id鍚庣紑澶т簬绛変簬1 - public static Integer dbDataIdSuffix = 1 ; + public static Integer dbDataIdSuffix = 1 ; + + //涓婁笅琛屾暟鎹紦瀛橀槦鍒椾腑缂撳瓨鏁版嵁涓暟鐨勬姤璀﹂噺锛岃繖涓笌瀹炰綋椤圭洰鎵�鎺ユ按琛ㄦ暟鐩稿叧 + public static Integer cacheUpDownDataWarnCount = 1000000 ; + + //涓婁笅琛屾暟鎹紦瀛橀槦鍒椾腑缂撳瓨鏁版嵁涓暟鐨勬渶澶у�硷紝杩欎釜涓庡疄浣撻」鐩墍鎺ユ按琛ㄦ暟鐩稿叧 + public static Integer cacheUpDownDataMaxCount = 1100000 ; } 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/busi/AboutRtuNode.java new file mode 100644 index 0000000..6bcf088 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/AboutRtuNode.java @@ -0,0 +1,62 @@ +package com.dy.aceMw.server.busi; + +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 { + + private static final Logger log = LogManager.getLogger(AboutRtuNode.class.getName()); + + public Object obj ;//鏁版嵁 + + public AboutRtuNode(Object obj){ + this.obj = obj ; + } + /** + * 鑷繁澶勭悊鑷繁 + * @return + */ + public boolean dealSelf(){ + try { + ThreadPool.Pool pool = TreadPoolFactory.getThreadPoolLong() ; + pool.putJob(new ThreadPool.Job() { + public void execute() { + if(obj != null){ + TaskSurpport t = null ; + try{ + t = TaskPool.popTask() ; + if(t != null){ + t.execute(obj); + }else{ + log.error("鏈緱鍒癛TU涓诲姩涓婃姤鏁版嵁澶勭悊浠诲姟锛�"); + } + }catch(Exception e){ + if(t != null){ + //褰撴湁寮傚父鏃讹紝try catch涓殑浠g爜鍙病鏈夋墽琛宖reeAndCleanTask + TaskPool.freeAndCleanTask(t); + } + } + } + } + @Override + public void destroy(){ + } + @Override + public boolean isDestroy(){ + return false ; + } + + }); + } catch (Exception e) { + log.error("鍦≧tuDataNode鍐呭彂鐢熷紓甯�", e); + } + return true ; + } + + +} 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/busi/TcpUpDataCache.java new file mode 100644 index 0000000..3da1fb8 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/TcpUpDataCache.java @@ -0,0 +1,70 @@ +package com.dy.aceMw.server.busi; + +import com.dy.aceMw.server.ServerProperties; +import com.dy.common.queue.Node; +import com.dy.common.queue.Queue; + +public class TcpUpDataCache { + + //TCP涓嬭鍛戒护缂撳瓨闃熷垪 + private static Queue cacheQueue = new Queue("tcpUpDataQueue") ; + + private static TcpUpDataCache instance = new TcpUpDataCache() ; + + private TcpUpDataCache(){ + cacheQueue.setLimit(ServerProperties.cacheUpDownDataWarnCount, ServerProperties.cacheUpDownDataMaxCount); + } + + public static TcpUpDataCache getInstance(){ + return instance ; + } + + /** + * 缂撳瓨鑺傜偣 + * @param reportOrResponse_trueOrFalse reportOrResponse_trueOrFalse + * @param node node + * @throws Exception 寮傚父 + */ + public static void cacheRtuUpData(boolean reportOrResponse_trueOrFalse, AboutRtuNode node) throws Exception{ + if(node != null && node.obj != null){ + if(reportOrResponse_trueOrFalse){ + cacheQueue.pushHead(node); + }else{ + cacheQueue.pushTail(node); + } + } + } + + /** + * 寰楀埌绗竴涓妭鐐� + * @return Node + */ + public static Node getFirstQueueNode(){ + return cacheQueue.getFirstNode() ; + } + + /** + * 寰楀埌鏈�鍚庝竴涓妭鐐� + * @return Node + */ + public static Node getLastQueueNode(){ + return cacheQueue.getLastNode() ; + } + + /** + * 绉婚櫎鑺傜偣 + * @param node + */ + public static void removeNode(Node node){ + cacheQueue.remove(node); + } + + /** + * 缂撳瓨鐨勮妭鐐规暟 + * @Return 缂撳瓨鑺傜偣鏁� + */ + public static Integer size(){ + return cacheQueue.size() ; + } + +} 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/busi/deal/Task.java new file mode 100644 index 0000000..9c615ee --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/Task.java @@ -0,0 +1,46 @@ +package com.dy.aceMw.server.busi.deal; + +public interface Task { + + + /** + * 浠诲姟閲囩敤瀵硅薄姹狅紝浠ヤ究閲嶇敤浠诲姟瀵硅薄锛� + * 閲嶇敤鍓嶈杩涜瀵硅薄鍒濆鍖栵紝娓呴櫎涓婃鎵ц浠诲姟鏃堕仐鐣欑殑瀵硅薄灞炴�ф暟鎹� + * 鍒濆鍖栨湰浠诲姟鍙婃墍鏈夊瓙浠诲姟 + */ + public void cleanMeAndSubs() ; + + /** + * 鎵ц鑺傜偣浠诲姟 + * @param data 闇�瑕佸鐞嗙殑鏁版嵁 + */ + public void execute(Object data) ; + + /** + * 寰楀埌鏈换鍔¤妭鐐瑰鐞嗕骇鐢熺殑涓棿缁撴灉锛屼互渚涙湰鑺傜偣鎵�鍦ㄦ爲鏋濈殑涓嬬骇浠诲姟鑺傜偣鍙婃湰鏍戞灊鐨勫乏渚э紙鏍瑰湪涓婏級鎵�鏈夋爲鏋濈殑鑺傜偣搴旂敤鏈粨鏋� + * @return + */ + public Object[] getMyResults() ; + + /** + * 寰楀埌鎸囧畾浠诲姟鑺傜偣澶勭悊浜х敓鐨勪腑闂寸粨鏋滐紝浠ヤ緵鏈妭鐐规墍鍦ㄦ爲鏋濈殑涓嬬骇浠诲姟鑺傜偣鍙婃湰鏍戞灊鐨勫乏渚э紙鏍瑰湪涓婏級鎵�鏈夋爲鏋濈殑鑺傜偣搴旂敤鏈粨鏋� + * @param id 鎸囧畾浠诲姟ID + * @return + */ + public Object[] getTaskResults(String id); + + /** + * 杞笅绾т换鍔¤妭鐐瑰鐞嗭紝棣栧厛瑕佸疄浣撳寲鎵�鏈夊瓙鑺傜偣銆� + * @param data 闇�瑕佸鐞嗙殑鏁版嵁 + */ + public void toNextTasks(Object data) ; + + + /** + * 杞笅绾ф煇涓换鍔¤妭鐐瑰鐞� + * @param data 闇�瑕佸鐞嗙殑鏁版嵁 + * @param id 鎸囧畾浠诲姟ID + */ + public void toNextOneTask(Object data, String id); + +} 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/busi/deal/TaskConfig.java new file mode 100644 index 0000000..7817954 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TaskConfig.java @@ -0,0 +1,9 @@ +package com.dy.aceMw.server.busi.deal; + + +public class TaskConfig { + public String id ; + public String name ; + public Boolean enable ;//鏄惁鎵ц鑺傜偣鐨勬暟鎹鐞嗕换鍔′换鍔� + public String clazz ; +} 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/busi/deal/TaskPool.java new file mode 100644 index 0000000..8dcd7fc --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TaskPool.java @@ -0,0 +1,115 @@ +package com.dy.aceMw.server.busi.deal; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + + +public class TaskPool { + + private static Logger log = LogManager.getLogger(TaskPool.class.getName()) ; + + private static List<TaskSurpport> tasks = new ArrayList<TaskSurpport>() ; + + private static TreeConfig taskTreeConf ; + + + public static void setTaskTreeCofig(TreeConfig conf){ + taskTreeConf = conf ; + } + + + /** + * 寰楀埌浠诲姟 + * 澶氱嚎绋嬬幆澧冧笅杩愯 + * @return + */ + public static synchronized TaskSurpport popTask(){ + TaskSurpport t = (tasks.size() > 0)?tasks.get(0):null ; + if(t != null){ + tasks.remove(0) ; + }else{ + try { + t = newTaskTree() ; + } catch (Exception e) { + log.error(e.getMessage() == null?"瀹炰緥鍖栦笂琛屾暟鎹鐞嗕换鍔″璞℃爲澶辫触锛�" : e.getMessage(), e); + } finally { + if(t == null){ + log.error("瀹炰緥鍖栦笂琛屾暟鎹鐞嗕换鍔″璞″け璐ワ紒" ); + } + } + } + + return t ; + } + + /** + * 鏀惧洖浠诲姟 + * 澶氱嚎绋嬬幆澧冧笅杩愯 + * 杩欓噷闇�瑕佸悓姝ラ攣锛屽洜涓轰笂闈㈡柟娉曚腑鎵ц瀹宼asks.get(0)涓旀湭鎵цtasks.remove(0)鏈熼棿锛屾湰鏂规硶鎵ц骞朵笖鎵ц瀹岋紝閭d箞鍚庢湡灏变細鍑轰贡瀛� + * @param t + */ + public static synchronized void freeAndCleanTask(TaskSurpport t){ + if(t != null){ + boolean find = false ; + for(TaskSurpport tin : tasks){ + if(tin == t){ + find = true ; + break ; + } + } + if(!find){ + t.cleanMeAndSubs(); + tasks.add(0, t) ; + } + } + } + + /** + * 瀹炰緥鍖栦换鍔″璞℃爲 + * @return + * @throws Exception + */ + private static TaskSurpport newTaskTree() throws Exception{ + TaskSurpport t = null ; + if(taskTreeConf != null){ + t = newTask(null, taskTreeConf.taskConf, taskTreeConf.subTreeConfs) ; + } + return t ; + } + + private static TaskSurpport newTask(TaskSurpport root, TaskConfig taskConf, TreeConfig[] subTreeConfs) throws Exception{ + TaskSurpport t = null ; + if(taskConf != null){ + t = instanceTask(taskConf.clazz) ; + if(t != null){ + t.conf = taskConf ; + t.root = root ; + if(root == null){ + root = t ; + } + newSubTask(root, t, subTreeConfs); + } + } + return t ; + } + private static void newSubTask(TaskSurpport root, TaskSurpport parent, TreeConfig[] treeConfs)throws Exception{ + if(parent != null && treeConfs != null && treeConfs.length > 0){ + parent.subTasks = new TaskSurpport[treeConfs.length] ; + for(int i = 0 ; i < treeConfs.length; i++){ + parent.subTasks[i] = newTask(root, treeConfs[i].taskConf, treeConfs[i].subTreeConfs) ; + } + } + } + private static TaskSurpport instanceTask(String clazz)throws Exception{ + Class<?> c = Class.forName(clazz); + if (c == null) { + throw new Exception("瀹炰緥鍖栦笂琛屾暟鎹鐞嗕换鍔″璞℃爲澶辫触锛佷换鍔$被涓�" + clazz + "锛�"); + }else{ + 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/busi/deal/TaskSurpport.java new file mode 100644 index 0000000..c120db6 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TaskSurpport.java @@ -0,0 +1,132 @@ +package com.dy.aceMw.server.busi.deal; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +/** + * 閮ㄥ垎瀹炵幇Task + */ +public abstract class TaskSurpport implements Task { + + private static final Logger log = LogManager.getLogger(TaskSurpport.class.getName()) ; + + //褰撳墠鎵�澶勭悊鐨勪笂琛屾暟鎹墍灞濺TU鐨勫湴鍧� + public String rtuAddr_inRootTk ;//鍙湪鏍箁oot浠诲姟瀵硅薄涓婁細浠樻鍊� + //鏈妭鐐归厤缃� + protected TaskConfig conf ; + //鏍逛换鍔� + protected TaskSurpport root ; + //鏈换鍔$殑瀛愪换鍔� + protected TaskSurpport[] subTasks ; + //鏈换鍔$殑澶勭悊缁撴灉 + protected Object[] taskResult ; + + /** + * 鎵ц鑺傜偣浠诲姟 + * @param data 闇�瑕佸鐞嗙殑鏁版嵁 + */ + @Override + public abstract void execute(Object data) ; + + /** + * 浠诲姟閲囩敤瀵硅薄姹狅紝浠ヤ究閲嶇敤浠诲姟瀵硅薄锛� + * 閲嶇敤鍓嶈杩涜瀵硅薄鍒濆鍖栵紝娓呴櫎涓婃鎵ц浠诲姟鏃堕仐鐣欑殑瀵硅薄灞炴�ф暟鎹� + * 鍒濆鍖栨湰浠诲姟鍙婃墍鏈夊瓙浠诲姟 + */ + @Override + public void cleanMeAndSubs() { + rtuAddr_inRootTk = null ; + taskResult = null ; + if(this.subTasks != null && this.subTasks.length > 0){ + for(int i = 0 ; i < this.subTasks.length; i++){ + this.subTasks[i].cleanMeAndSubs() ; + } + } + } + + /** + * 寰楀埌鏈换鍔¤妭鐐瑰鐞嗕骇鐢熺殑涓棿缁撴灉锛屼互渚涙湰鑺傜偣鎵�鍦ㄦ爲鏋濈殑涓嬬骇浠诲姟鑺傜偣鍙婃湰鏍戞灊鐨勫乏渚э紙鏍瑰湪涓婏級鎵�鏈夋爲鏋濈殑鑺傜偣搴旂敤鏈粨鏋� + * @return + */ + @Override + public Object[] getMyResults(){ + return taskResult ; + } + + /** + * 寰楀埌鎸囧畾浠诲姟鑺傜偣澶勭悊浜х敓鐨勪腑闂寸粨鏋滐紝浠ヤ緵鏈妭鐐规墍鍦ㄦ爲鏋濈殑涓嬬骇浠诲姟鑺傜偣鍙婃湰鏍戞灊鐨勫乏渚э紙鏍瑰湪涓婏級鎵�鏈夋爲鏋濈殑鑺傜偣搴旂敤鏈粨鏋� + * @param id 鎸囧畾浠诲姟ID + * @return + */ + public Object[] getTaskResults(String id){ + if(root != null){ + return this.getTaskResults(root, id) ; + } + return null ; + } + private Object[] getTaskResults(TaskSurpport task, String id){ + if(task != null && task.conf != null && task.conf.id != null && task.conf.id.equals(id)){ + return task.getMyResults() ; + }else{ + if(task.subTasks != null && task.subTasks.length > 0){ + Object[] rs = null ; + for(int i = 0 ; i < task.subTasks.length; i++){ + rs = getTaskResults(task.subTasks[i], id) ; + if(rs != null){ + return rs ; + } + } + } + } + return null ; + } + + /** + * 杞笅绾т换鍔¤妭鐐瑰鐞嗭紝棣栧厛瑕佸疄浣撳寲鎵�鏈夊瓙鑺傜偣銆� + * @param data 闇�瑕佸鐞嗙殑鏁版嵁 + */ + @Override + public void toNextTasks(Object data) { + try { + if(subTasks != null && subTasks.length > 0){ + for(int i = 0 ; i < subTasks.length ; i++){ + if(subTasks[i].conf.enable){ + subTasks[i].execute(data) ; + }else{ + //鏈妭鐐逛笉璧蜂綔鐢紝鐩存帴杩涘叆鏈妭鐨勫瓙鑺傜偣 + subTasks[i].toNextTasks(data) ; + } + } + } + } catch (Exception e) { + log.error("鍚戜笅绾т换鍔′紶閫掑伐浣滄椂鍑洪敊锛�" , e); + }finally{ + } + } + + /** + * 杞笅绾ф煇涓换鍔¤妭鐐瑰鐞� + * @param data 闇�瑕佸鐞嗙殑鏁版嵁 + * @param id 鎸囧畾浠诲姟ID + */ + public void toNextOneTask(Object data, String id){ + try { + if(subTasks != null && subTasks.length > 0){ + for(int i = 0 ; i < subTasks.length ; i++){ + if(subTasks[i].conf.id.equals(id)){ + if(subTasks[i].conf.enable){ + subTasks[i].execute(data) ; + }else{ + //鏈妭鐐逛笉璧蜂綔鐢紝鐩存帴杩涘叆鏈妭鐨勫瓙鑺傜偣 + subTasks[i].toNextTasks(data) ; + } + } + } + } + } catch (Exception e) { + log.error("鍚戞寚瀹氬瓙浠诲姟锛�" + id + "锛変紶閫掍换鍔℃椂鍑洪敊锛�" , e); + }finally{ + } + } + +} 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/busi/deal/TkReceive.java new file mode 100644 index 0000000..f932998 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TkReceive.java @@ -0,0 +1,31 @@ +package com.dy.aceMw.server.busi.deal; + +import com.dy.common.mw.protocol.Data; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class TkReceive extends TaskSurpport { + + private static final Logger log = LogManager.getLogger(TkReceive.class.getName()) ; + + //绫籌D锛屼竴瀹氫笌Tree.xml閰嶇疆鏂囦欢涓厤缃竴鑷� + public static final String taskId = "TkReceive" ; + + /** + * 鎵ц鑺傜偣浠诲姟 + * @param data 闇�瑕佸鐞嗙殑鏁版嵁 + */ + @Override + public void execute(Object data) { + if(data == null){ + log.error("涓ラ噸閿欒锛孯TU涓婅鏁版嵁涓虹┖锛�" ); + }else{ + if(data instanceof Data){ + this.toNextTasks(data); + }else{ + log.error("涓ラ噸閿欒锛岃鏁版嵁绫诲瀷锛�" + data.getClass().getName() + "锛夛紝鎺ユ敹鏁版嵁浠诲姟杩樻湭瀹炵幇锛�" ); + } + } + } + +} 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/busi/deal/TkRtuData.java new file mode 100644 index 0000000..1b403ca --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TkRtuData.java @@ -0,0 +1,29 @@ +package com.dy.aceMw.server.busi.deal; + +import com.dy.common.mw.protocol.Data; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class TkRtuData extends TaskSurpport { + + private static Logger log = LogManager.getLogger(TkRtuData.class.getName()) ; + + //绫籌D锛屼竴瀹氫笌Tree.xml閰嶇疆鏂囦欢涓厤缃竴鑷� + public static final String taskId = "TkRtuData" ; + + /** + * 鎵ц鑺傜偣浠诲姟 + * @param data 闇�瑕佸鐞嗙殑鏁版嵁 + */ + @Override + public void execute(Object data) { + Data d = (Data)data ; + String rtuAddr = d.getRtuAddr() ; + if(rtuAddr == null){ + log.error("涓ラ噸閿欒锛孯TU涓婅鏁版嵁涓棤RTU鍦板潃锛�" ); + }else{ + this.toNextTasks(data); + } + } + +} 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 new file mode 100644 index 0000000..51172bc --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/Tree.xml @@ -0,0 +1,95 @@ +<?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/busi/deal/TreeConfig.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TreeConfig.java new file mode 100644 index 0000000..ce4bf6a --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TreeConfig.java @@ -0,0 +1,6 @@ +package com.dy.aceMw.server.busi.deal; + +public class TreeConfig { + public TaskConfig taskConf ; + public TreeConfig[] subTreeConfs ;//鎵�鏈夊瓙鑺傜偣 +} 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/busi/deal/TreeParse.java new file mode 100644 index 0000000..fb4e224 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/TreeParse.java @@ -0,0 +1,172 @@ +package com.dy.aceMw.server.busi.deal; + + +import java.net.URL; +import java.util.*; + +import org.jdom2.Document; +import org.jdom2.Element; +import org.jdom2.input.SAXBuilder; + + +public class TreeParse { + public List<String> ids ; + public List<String> classes ; + +// public static void main(String args[]) { +// TreeParse o = new TreeParse(); +// TreeConfig conf = o.parseConfig(); +// } + + public TreeParse(){ + ids = new ArrayList<String>() ; + classes = new ArrayList<String>() ; + } + + /** + * 瑙f瀽澶勭悊鍣ㄩ厤缃� + * @return + */ + protected TreeConfig parseConfig() { + try { + URL configFileURL = TreeParse.class.getResource("Tree.xml"); + return this.parse(this.createDom(configFileURL)) ; + } catch (Exception e) { + System.out.println("绯荤粺鍚姩鏃讹紝鍒濆涓婅鏁版嵁澶勭悊浠诲姟閰嶇疆鍑洪敊 !"); + System.out.println(e.getMessage()); + e.printStackTrace(); + return null; + } + } + + /** + * + * @return + */ + private Document createDom(URL configFileURL) throws Exception { + if (configFileURL == null) { + throw new Exception("鏈緱鍒颁笂琛屾暟鎹鐞嗕换鍔¢厤缃枃浠�!", null); + } + Document doc = null; + try { + SAXBuilder sb = new SAXBuilder(); + doc = sb.build(configFileURL); + if (doc == null) { + throw new Exception("鏈敓鎴愪笂琛屾暟鎹鐞嗕换鍔¢厤缃枃浠剁殑DOM瀵硅薄!", null); + } + } catch (Exception e) { + throw new Exception("鐢熸垚涓婅鏁版嵁澶勭悊浠诲姟閰嶇疆鏂囦欢鐨凞OM瀵硅薄澶辫触!", e); + } + return doc; + } + + /** + * 鍒嗘瀽 + * @return ArrayList<String> + * @throws Exception + */ + private TreeConfig parse(Document doc) throws Exception { + Element root = doc.getRootElement(); + if (root == null) { + throw new Exception("鏈緱鍒颁笂琛屾暟鎹鐞嗕换鍔¢厤缃枃浠舵牴鍏冪礌config!"); + } + + List<Element> rootTasks = root.getChildren("task") ; + if(rootTasks == null || rootTasks.size() == 0){ + throw new Exception("鏈緱鍒颁笂琛屾暟鎹鐞嗕换鍔¢厤缃枃浠舵牴浠诲姟task!"); + } + if(rootTasks.size() > 1){ + throw new Exception("鏈緱鍒颁笂琛屾暟鎹鐞嗕换鍔¢厤缃枃浠舵牴浠诲姟task蹇呴』鍙湁涓�涓�!"); + } + + TreeConfig tree = new TreeConfig() ; + tree.taskConf = new TaskConfig() ; + + this.parseNode(rootTasks.get(0), tree, tree.taskConf) ; + return tree ; + } + + private void parseNode(Element taskEle, TreeConfig me, TaskConfig taskConf)throws Exception { +// <task id="task2.1" name="鏋勯�犳暟鎹�" enable="true" class="" /> + if(taskEle == null){ + throw new Exception("鍒嗘瀽涓婅鏁版嵁澶勭悊浠诲姟閰嶇疆鏂囦欢鍑洪敊锛�"); + } + + String id = taskEle.getAttributeValue("id") ; + if(id == null || id.trim().equals("")){ + throw new Exception("涓婅鏁版嵁澶勭悊浠诲姟閰嶇疆鏂囦欢涓璱d蹇呴』閰嶇疆锛�"); + } + id = id.trim() ; + if(ids.contains(id)){ + throw new Exception("涓婅鏁版嵁澶勭悊浠诲姟閰嶇疆鏂囦欢涓璱d=" + id + "閲嶅閰嶇疆锛�"); + } + taskConf.id = id ; + ids.add(id) ; + + String name = taskEle.getAttributeValue("name") ; + if(name == null || name.trim().equals("")){ + throw new Exception("涓婅鏁版嵁澶勭悊浠诲姟閰嶇疆鏂囦欢涓璶ame蹇呴』閰嶇疆锛�"); + } + name = name.trim() ; + taskConf.name = name ; + + String enable = taskEle.getAttributeValue("enable") ; + if(enable == null || !(enable.trim().equals("true") || enable.trim().equals("false"))){ + throw new Exception("涓婅鏁版嵁澶勭悊浠诲姟閰嶇疆鏂囦欢涓璭nable蹇呴』閰嶇疆锛屽苟涓斿�煎彧鑳戒负true鎴杅alse锛�"); + } + if(enable.trim().equals("true")){ + taskConf.enable = true ; + } + if(enable.trim().equals("false")){ + taskConf.enable = false ; + } + + String clazz = taskEle.getAttributeValue("class") ; + if(clazz == null || clazz.trim().equals("")){ + throw new Exception("涓婅鏁版嵁澶勭悊浠诲姟閰嶇疆鏂囦欢涓璫lass蹇呴』閰嶇疆锛�"); + } + clazz = clazz.trim() ; + if(classes.contains(clazz)){ + throw new Exception("涓婅鏁版嵁澶勭悊浠诲姟閰嶇疆鏂囦欢涓璫lass=" + clazz + "閲嶅閰嶇疆锛�"); + } + taskConf.clazz = clazz ; + classes.add(clazz) ; + this.checkClass(taskConf.clazz) ; + + this.parseSubNode(taskEle, me) ; + + } + + private void parseSubNode(Element ele, TreeConfig parent)throws Exception { + List<?> list = ele.getChildren("task") ; + if(list != null && list.size() > 0){ + parent.subTreeConfs = new TreeConfig[list.size()] ; + Iterator<?> it = list.iterator(); + Element e = null; + int count = 0 ; + TreeConfig me ; + while(it.hasNext()){ + e = (Element) it.next(); + me = new TreeConfig() ; + me.taskConf = new TaskConfig() ; + parent.subTreeConfs[count++] = me ; + parseNode(e, me, me.taskConf) ; + } + } + } + + private void checkClass(String clazz)throws Exception { + Class<?> c = Class.forName(clazz); + if (c == null) { + throw new Exception("涓婅鏁版嵁澶勭悊浠诲姟閰嶇疆鏂囦欢涓笉鑳藉疄渚嬪寲class=" + clazz + "锛�"); + }else{ + Object o = c.newInstance(); + if(o instanceof Task){ + }else{ + throw new Exception("涓婅鏁版嵁澶勭悊浠诲姟閰嶇疆鏂囦欢涓璫lass=" + clazz + "蹇呴』瀹炵幇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/busi/deal/dbSv/RtuSv.java new file mode 100644 index 0000000..ddd1aec --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/dbSv/RtuSv.java @@ -0,0 +1,7 @@ +package com.dy.aceMw.server.busi.deal.dbSv; + +import org.springframework.stereotype.Service; + +@Service +public class RtuSv { +} 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/busi/deal/dbSv/\350\257\264\346\230\216.txt" new file mode 100644 index 0000000..9429677 --- /dev/null +++ "b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/dbSv/\350\257\264\346\230\216.txt" @@ -0,0 +1 @@ +springboot瀹瑰櫒涓殑Server bean \ No newline at end of file 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/busi/deal/p206V1_0_0/TkFindP206V1_0_0.java new file mode 100644 index 0000000..62f9780 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/p206V1_0_0/TkFindP206V1_0_0.java @@ -0,0 +1,27 @@ +package com.dy.aceMw.server.busi.deal.p206V1_0_0; + + +import com.dy.aceMw.server.busi.deal.TaskSurpport; +import com.dy.common.mw.protocol.Data; +import com.dy.common.mw.protocol.p206V1_0_0.ProtocolConstantV206V1_0_0; + +public class TkFindP206V1_0_0 extends TaskSurpport { + + //绫籌D锛屼竴瀹氫笌Tree.xml閰嶇疆鏂囦欢涓厤缃竴鑷� + public static final String taskId = "TkFindP206V1_0_0" ; + + /** + * 鎵ц鑺傜偣浠诲姟 + * @param data 闇�瑕佸鐞嗙殑鏁版嵁 + */ + @Override + public void execute(Object data) { + Data d = (Data)data ; + if(d.getProtocol() != null && d.getProtocol().equals(ProtocolConstantV206V1_0_0.protocolName)){ + this.toNextTasks(data); + }else{ + //涓嶆槸鏈崗璁殑鏁版嵁 + } + } + +} 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/busi/deal/p206V1_0_0/TkPreGenObjs.java new file mode 100644 index 0000000..11ad57a --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/busi/deal/p206V1_0_0/TkPreGenObjs.java @@ -0,0 +1,82 @@ +package com.dy.aceMw.server.busi.deal.p206V1_0_0; + +import com.dy.aceMw.server.busi.deal.TaskSurpport; +import com.dy.common.mw.protocol.Data; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class TkPreGenObjs extends TaskSurpport { + + private static final Logger log = LogManager.getLogger(TkPreGenObjs.class.getName()) ; + + //绫籌D锛屼竴瀹氫笌Tree.xml閰嶇疆鏂囦欢涓厤缃竴鑷� + public static final String taskId = "TkPreGenObjs" ; + + /** + * 鎵ц鑺傜偣浠诲姟 + * @param data 闇�瑕佸鐞嗙殑鏁版嵁 + */ + @Override + public void execute(Object data) { + Data d = (Data)data ; + String rtuAddr = d.getRtuAddr() ; + //寰楀埌鏈湴RTU 鏁版嵁锛屼互澶囧悗闈㈣妭鐐瑰簲鐢� + /* + BuziInterface baseBusi = BuziGeter.getBaseBusi() ; + BuziInterface orgBusi = null ; + SyRtu nbRtu = null ; + SyRtuTramp rtuTramp = null ; + if(baseBusi != null){ + nbRtu = DbSyBuzi.getRtu(baseBusi, imei) ; + if(nbRtu != null){ + //鏁版嵁搴撲腑鏌ヨ鍒癗B浜у搧锛圧TU瀹炰綋锛� + if(nbRtu.orgTag != null && !nbRtu.orgTag.trim().equals("")){ + orgBusi = BuziGeter.getBusi(nbRtu.orgTag) ; + if(orgBusi == null){ + log.error("涓ラ噸閿欒锛屾湭鑳藉緱鍒版爣绛句负" + nbRtu.orgTag + "鐨勪緵姘存満鏋勬暟鎹簱涓氬姟Busi"); + }else{ + BaMeter meter = DbOrgBuzi.getMeterByImeiAndNo(orgBusi, imei, meterNo) ; + //鍙兘鏈煡璇㈠埌meter锛屽嵆浠嶆槸娴佹氮鑰匯TU锛屼絾浠嶈鍚庣画澶勭悊锛氾紙1锛夈�佷粛鑳借瘑鍒嚭娴佹氮鑰匯TU锛岋紙2锛夈�佷粛瑕佽褰曞叾涓婃姤鏁版嵁 + if(meter != null){ + String protocol = d.getProtocol() ; + if(protocol != null){ + protocol = protocol.trim(); + if(!protocol.equals("")){ + if(meter.protocol == null + || meter.protocol.trim().equals("") + || !meter.protocol.trim().equals(protocol)){ + //闇�瑕佹洿鏂板崗璁悕绉� + DbOrgBuzi.updateMeter4Protocol(orgBusi, meter.id, protocol); + } + } + } + } + this.taskResult = new Object[]{baseBusi, orgBusi, nbRtu, null, meter} ; + this.toNextTasks(data); + } + }else{ + //NB浜у搧锛圧TU瀹炰綋锛夋湭鍒嗛厤缁欏叿浣撶殑渚涙按鏈烘瀯 + //娴佹氮鑰匯TU + rtuTramp = DbSyBuzi.getSyRtuTramp(baseBusi, imei, meterNo) ; + if(rtuTramp == null){ + rtuTramp = new SyRtuTramp(imei, meterNo) ; + } + this.taskResult = new Object[]{baseBusi, orgBusi, nbRtu, rtuTramp, null} ; + this.toNextOneTask(data, TkDealRtuTramp.taskId); + } + }else{ + //鏁版嵁搴撲腑鏈煡璇㈠埌NB浜у搧锛圧TU瀹炰綋锛� + //娴佹氮鑰匯TU + rtuTramp = DbSyBuzi.getSyRtuTramp(baseBusi, imei, meterNo) ; + if(rtuTramp == null){ + rtuTramp = new SyRtuTramp(imei, meterNo) ; + } + this.taskResult = new Object[]{baseBusi, orgBusi, nbRtu, rtuTramp, null} ; + this.toNextOneTask(data, TkDealRtuTramp.taskId); + } + }else{ + log.error("涓ラ噸閿欒锛屾湭鑳藉緱鍒癇aseBusi瀵硅薄"); + } + */ + } +} 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 896f2d8..fa580b0 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,5 +1,7 @@ package com.dy.aceMw.server.forTcp; +import com.dy.aceMw.server.busi.AboutRtuNode; +import com.dy.aceMw.server.busi.TcpUpDataCache; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -23,33 +25,33 @@ //姝ゅ瀹炵幇锛屼笌浠ュ墠涓嶄竴鏍凤紝 //浠ュ墠瀹炵幇锛氬尮閰嶅懡浠ゆ槸浠庡悗鍚戝墠鍖归厤锛� //褰撳墠瀹炵幇锛屽尮閰嶅懡浠ゆ槸浠庡墠鍚戝悗鍖归厤锛屽師鍥狅細涓句緥锛屽綋鎵归噺涓嬪彂琛ュ彫鍛戒护锛屽鏋滀粠鍚庡尮閰嶏紝鍒欏墠闈㈠懡浠や細涓嬪彂澶氭锛屽嵆涓�涓笂鎶ユ鏁版嵁浼氳ˉ鍙娆� - MidResultToRtu resToRtu = TcpDownCommandCach.matchFromHead(resFromRtu) ; + MidResultToRtu resToRtu = TcpDownCommandCache.matchFromHead(resFromRtu) ; if(resToRtu != null){ //鍖归厤鍒颁笅鍙戠殑鍛戒护 resFromRtu.setCommandId(resToRtu.commandId) ; - this.sendResult(false, resFromRtu); + this.nextDeal(false, resFromRtu); }else{ - this.sendResult(false, resFromRtu); + this.nextDeal(false, resFromRtu); //鏈尮閰嶅埌涓嬪彂鐨勫懡浠わ紝鍛戒护鍦ㄧ紦瀛樺洜瓒呮椂琚竻闄や簡 RtuStatusDealer.commandFail2Success(resFromRtu.rtuAddr) ; } }else{ //涓诲姩涓婃姤鏁版嵁 - this.sendResult(true, resFromRtu); + this.nextDeal(true, resFromRtu); } } } - private void sendResult(boolean reportOrResponse_trueOrFalse, MidResultFromRtu resFromRtu){ + + /** + * 杩涘叆澶氱嚎绋嬬幆澧冧腑杩愯 + * @param reportOrResponse_trueOrFalse + * @param resFromRtu + */ + private void nextDeal(boolean reportOrResponse_trueOrFalse, MidResultFromRtu resFromRtu){ try{ - String json = resFromRtu.data.toJson() ; -// if(reportOrResponse_trueOrFalse){ -// ToMqMessageCach.cachObj(MessageType.RtuAutoReport, json); -// }else{ -// ToMqMessageCach.cachObj(MessageType.RtuCmdResponse, json); -// } + TcpUpDataCache.cacheRtuUpData(reportOrResponse_trueOrFalse, new AboutRtuNode(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/forTcp/MidResultActionToRtu.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/MidResultActionToRtu.java index 33e2417..e8d0d3c 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/MidResultActionToRtu.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/MidResultActionToRtu.java @@ -15,7 +15,7 @@ if(result != null && result instanceof MidResultToRtu){ try { MidResultToRtu resToRtu = (MidResultToRtu)result ; - TcpDownCommandCach.cachCommand(resToRtu); + TcpDownCommandCache.cacheCommand(resToRtu); log.info("涓嬭鍛戒护(toRtu)" + resToRtu.downCode + "涓棿缁撴灉宸茬粡鏀惧叆涓嬭鍛戒护缂撳瓨涓�"); } catch (Exception e) { log.error(e); diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandCach.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandCache.java similarity index 72% rename from pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandCach.java rename to pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandCache.java index fcdf427..7a0cf8b 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandCach.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandCache.java @@ -10,18 +10,18 @@ /** * 闈炵嚎绋嬪畨鍏ㄧ殑锛屽彧鑳藉湪鍗曠嚎绋嬩腑杩愯 */ -public class TcpDownCommandCach { +public class TcpDownCommandCache { //TCP涓嬭鍛戒护缂撳瓨闃熷垪 - private static Queue cachQueue = new Queue("tcpDownComandQueue") ; + private static Queue cacheQueue = new Queue("tcpDownCommandQueue") ; - private static TcpDownCommandCach instance = new TcpDownCommandCach() ; + private static TcpDownCommandCache instance = new TcpDownCommandCache() ; - private TcpDownCommandCach(){ - cachQueue.setLimit(990000, 1000000); + private TcpDownCommandCache(){ + cacheQueue.setLimit(ServerProperties.cacheUpDownDataWarnCount, ServerProperties.cacheUpDownDataMaxCount); } - public static TcpDownCommandCach getInstance(){ + public static TcpDownCommandCache getInstance(){ return instance ; } @@ -30,16 +30,16 @@ * @param result * @throws Exception */ - public static void cachCommand(MidResultToRtu result) throws Exception{ + public static void cacheCommand(MidResultToRtu result) throws Exception{ if(result != null){ if(result.maxSendTimes == null){ //璁剧疆鏈�澶у彂閫佹鏁� result.maxSendTimes = ServerProperties.downComandMaxResendTimes ; } if(result.isSendFirst){ - cachQueue.pushHead(new TcpDownCommandObj(result)); + cacheQueue.pushHead(new TcpDownCommandObj(result)); }else{ - cachQueue.pushTail(new TcpDownCommandObj(result)); + cacheQueue.pushTail(new TcpDownCommandObj(result)); } } } @@ -52,7 +52,7 @@ public static MidResultToRtu matchFromHead(MidResultFromRtu rsFromRtu){ MidResultToRtu res = null ; TcpDownCommandObj obj = null ; - Node node = cachQueue.getFirstNode() ; + Node node = cacheQueue.getFirstNode() ; while(node != null && node.obj != null){ obj = (TcpDownCommandObj)node.obj; res = obj.result ; @@ -77,7 +77,7 @@ public static MidResultToRtu matchFromTail(MidResultFromRtu rsFromRtu){ MidResultToRtu res = null ; TcpDownCommandObj obj = null ; - Node node = cachQueue.getLastNode() ; + Node node = cacheQueue.getLastNode() ; while(node != null && node.obj != null){ obj = (TcpDownCommandObj)node.obj; res = obj.result ; @@ -99,7 +99,7 @@ * @return */ public static Node getFirstQueueNode(){ - return cachQueue.getFirstNode() ; + return cacheQueue.getFirstNode() ; } /** @@ -107,7 +107,7 @@ * @return */ public static Node getLastQueueNode(){ - return cachQueue.getLastNode() ; + return cacheQueue.getLastNode() ; } /** @@ -115,15 +115,15 @@ * @param node */ public static void removeNode(Node node){ - cachQueue.remove(node); + cacheQueue.remove(node); } /** * 缂撳瓨鐨勮妭鐐规暟 - * @param node + * @Return 缂撳瓨鑺傜偣鏁� */ public static Integer size(){ - return cachQueue.size() ; + return cacheQueue.size() ; } } diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandObj.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandObj.java index 40dad55..ae05e4f 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandObj.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/forTcp/TcpDownCommandObj.java @@ -73,8 +73,8 @@ } Long lastSendStamp = tcpSe.lastDownComTime ; - if(lastSendStamp == null || (now - lastSendStamp >= ServerProperties.commandSendInterval)){ - //鏈敹鍒板懡浠ょ粨鏋滐紝鏈揪鍒版渶澶у彂閫佹鏁帮紝RTU鍦ㄧ嚎锛岃秴杩囧懡浠ら棿涓嬪彂闂撮殧锛屼互涓婃弧瓒冲彂閫佸懡浠ゆ潯浠讹紝鎵ц鍙戦�佸懡浠� + if(this.result.isQuickSend || lastSendStamp == null || (now - lastSendStamp >= ServerProperties.commandSendInterval)){ + //鏈敹鍒板懡浠ょ粨鏋滐紝鏈揪鍒版渶澶у彂閫佹鏁帮紝RTU鍦ㄧ嚎锛岄�熷彂鍛戒护鎴栬秴杩囧懡浠や笅鍙戦棿闅旓紝浠ヤ笂婊¤冻鍙戦�佸懡浠ゆ潯浠讹紝鎵ц鍙戦�佸懡浠� tcpSe.ioSession.write(this.result.downBuffer) ; tcpSe.lastDownComTime = now ; if(!this.result.hasResponse){ 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/BusiConstantTask.java new file mode 100644 index 0000000..f710dda --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/BusiConstantTask.java @@ -0,0 +1,74 @@ +package com.dy.aceMw.server.tasks; + +import com.dy.aceMw.server.busi.AboutRtuNode; +import com.dy.aceMw.server.busi.TcpUpDataCache; +import com.dy.common.mw.core.CoreTask; +import com.dy.common.queue.Node; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +/** + * 瀵筊TU涓婅鏁版嵁杩涜涓氬姟澶勭悊 + */ +public class BusiConstantTask extends CoreTask { + private static final Logger log = LogManager.getLogger(BusiConstantTask.class.getName()); + + /** + * 鍦ㄥ崟绾跨▼鐜涓繍琛� + */ + @Override + public Integer excute() { + try{ + return dealRtuUpdata() ; + }catch(Exception e){ + log.error(e); + } + return null ; + } + + /** + * 澶勭悊涓婅鏁版嵁 + */ + public Integer dealRtuUpdata() { + Node first = TcpUpDataCache.getFirstQueueNode() ; + if(first != null){ + Integer count = TcpUpDataCache.size() ; + Node last = TcpUpDataCache.getLastQueueNode() ; + this.doDealRtuUpdata(first, last); + return count ; + } + return null ; + } + + /** + * 澶勭悊缂撳瓨鐨勪笂琛屾暟鎹妭鐐� + * @param first 绗竴涓妭鐐� + * @param 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) ; + }else if(first != null && first == last){ + //鍋滄 + }else if(first == null){ + //杩欑鎯呭喌涓嶄細瀛樺湪 + doDealRtuUpdata(null, pre) ; + } + } + } + + /** + * 澶勭悊涓�涓妭鐐� + * @param node 鑺傜偣 + */ + private void dealNode(Node node){ + AboutRtuNode obj = (AboutRtuNode)node.obj ; + obj.dealSelf() ; + TcpUpDataCache.removeNode(node); + } + +} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/RtuDownTask.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/RtuDownTask.java index 410f43c..64891d0 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/RtuDownTask.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/RtuDownTask.java @@ -7,7 +7,7 @@ import com.dy.common.mw.protocol.MidResult; import com.dy.common.mw.protocol.Command; import com.dy.common.mw.protocol.Driver; -import com.dy.common.mw.protocol.ProtocolCach; +import com.dy.common.mw.protocol.ProtocolCache; import com.dy.aceMw.server.ServerProperties; import com.dy.aceMw.server.forTcp.TcpSessionCach; @@ -34,8 +34,7 @@ /** * 澶勭悊鍛戒护 - * @param webJgroupName - * @param com + * @param com 鍛戒护 * @throws Exception */ private void deal(Command com) throws Exception{ @@ -45,13 +44,13 @@ String protocolName = TcpSessionCach.getTcpProtocolName(rtuAddr) ; if(protocolName == null){ //RTU鏈浘涓婄嚎 - int count = ProtocolCach.driverCount() ; + int count = ProtocolCache.driverCount() ; if(count == 1){ //鍙湁涓�涓崗璁� - dri = ProtocolCach.getFirstDriver() ; + dri = ProtocolCache.getFirstDriver() ; } }else{ - dri = ProtocolCach.getDriver(protocolName) ; + dri = ProtocolCache.getDriver(protocolName) ; } if(dri == null){ log.error("涓ラ噸閿欒锛屾湭鑳藉緱鍒板崗璁�" + protocolName + "椹卞姩绫诲疄渚嬶紒"); diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/RtuUpTask.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/RtuUpTask.java index 16418cf..c27241f 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/RtuUpTask.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/RtuUpTask.java @@ -14,7 +14,7 @@ import com.dy.common.mw.protocol.Driver; import com.dy.common.mw.protocol.OnLine; import com.dy.common.mw.protocol.OnLineHandle; -import com.dy.common.mw.protocol.ProtocolCach; +import com.dy.common.mw.protocol.ProtocolCache; import com.dy.aceMw.server.ServerProperties; import com.dy.aceMw.server.forTcp.RtuLogDealer; import com.dy.aceMw.server.forTcp.RtuStatusDealer; @@ -144,13 +144,13 @@ * @throws Exception 寮傚父 */ private void dealUpData(IoSession session, String rtuAddrAtHead, String protocolName, boolean isOnLine, byte[] upBuf, String upHex) throws Exception{ - Driver dri = ProtocolCach.getDriver(protocolName) ; + Driver dri = ProtocolCache.getDriver(protocolName) ; if(dri == null){ log.error("涓ラ噸閿欒锛屾湭鑳藉緱鍒板崗璁�" + protocolName + "椹卞姩绫诲疄渚嬶紒"); }else{ MidResult[] midRs = dri.parseData(ServerProperties.isLowPower, rtuAddrAtHead, upBuf, upHex, new DriverParserDataCallback(){ @Override - public void callback(String rtuAddrAtHead, String meterNoAtHead, String code, String upHex, Boolean reportOrResponse_trueOrFalse, boolean parseFail, String rtuAddrInData, String meterNoInData) { + public void callback(String rtuAddrAtHead, String code, String upHex, Boolean reportOrResponse_trueOrFalse, boolean parseFail, String rtuAddrInData) { //鏇存柊缁堢鐘舵�� if(rtuAddrInData != null && !rtuAddrInData.equals(rtuAddrAtHead)){ //鏁版嵁澶翠腑鐨凴TU鍦板潃涓庢暟鎹腑鐨凴TU鍦板潃涓嶄竴鑷达紝鏇存崲鎴愭暟鎹腑鐨凴TU鍦板潃 diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/ToRtuConstantTask.java b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/ToRtuConstantTask.java index 08721c8..d042ef3 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/ToRtuConstantTask.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/java/com/dy/aceMw/server/tasks/ToRtuConstantTask.java @@ -5,7 +5,7 @@ import com.dy.common.queue.Node; import com.dy.common.mw.core.CoreTask; -import com.dy.aceMw.server.forTcp.TcpDownCommandCach; +import com.dy.aceMw.server.forTcp.TcpDownCommandCache; import com.dy.aceMw.server.forTcp.TcpDownCommandObj; import com.dy.aceMw.server.forTcp.TcpSessionCach; @@ -40,16 +40,12 @@ * 澶勭悊涓嬭鍛戒护 */ public Integer dealDownCommand(Long now) { - try{ - Node first = TcpDownCommandCach.getFirstQueueNode() ; - if(first != null){ - Integer count = TcpDownCommandCach.size() ; - Node last = TcpDownCommandCach.getLastQueueNode() ; - this.doDealDownCommand(now, first, last); - return count ; - } - }catch(Exception e){ - log.error(e); + Node first = TcpDownCommandCache.getFirstQueueNode() ; + if(first != null){ + Integer count = TcpDownCommandCache.size() ; + Node last = TcpDownCommandCache.getLastQueueNode() ; + this.doDealDownCommand(now, first, last); + return count ; } return null ; } @@ -57,9 +53,9 @@ * 澶勭悊缂撳瓨鐨勪笅琛屽懡浠よ妭鐐� * @param now 褰撳墠鏃跺埢 * @param first 绗竴涓妭鐐� - * @param last 鏄悗涓�涓妭鐐� + * @param last 鏈�鍚庝竴涓妭鐐� */ - private void doDealDownCommand(Long now, Node first, Node last){ + private void doDealDownCommand1(Long now, Node first, Node last){ if(first != null){ //鍦╠ealNode鏂规硶涓紝鍙兘瑕佹妸first浠庨槦鍒椾腑绉婚櫎锛岃繖鏃秄irst.next涓虹┖锛屾墍浠ユ彁鍓嶆妸first.next鍙栧嚭鏉� Node next = first.next ; @@ -74,6 +70,28 @@ } } } + + /** + * 澶勭悊缂撳瓨鐨勪笅琛屽懡浠よ妭鐐� + * @param now 褰撳墠鏃跺埢 + * @param first 绗竴涓妭鐐� + * @param last 鏈�鍚庝竴涓妭鐐� + */ + private void doDealDownCommand(Long now, Node first, Node last){ + if(last != null){ + //鍦╠ealNode鏂规硶涓紝鍙兘瑕佹妸last浠庨槦鍒椾腑绉婚櫎锛岃繖鏃秎ast.pre涓虹┖锛屾墍浠ユ彁鍓嶆妸last.pre鍙栧嚭鏉� + Node pre = last.pre ; + dealNode(now, last) ; + if(first != null && first != last){ + doDealDownCommand(now, first, pre) ; + }else if(first != null && first == last){ + //鍋滄 + }else if(first == null){ + //杩欑鎯呭喌涓嶄細瀛樺湪 + doDealDownCommand(now, null, pre) ; + } + } + } /** * 澶勭悊涓�涓妭鐐� @@ -84,7 +102,7 @@ TcpDownCommandObj obj = (TcpDownCommandObj)node.obj ; boolean removeNode = obj.dealSelf(now) ; if(removeNode){ - TcpDownCommandCach.removeNode(node); + TcpDownCommandCache.removeNode(node); } } diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/resources/config.xml b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/resources/config.xml index 230a69b..8530fff 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/resources/config.xml +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-accept/src/main/resources/config.xml @@ -14,20 +14,24 @@ offLineCachTimeout: 涓嶅湪绾跨紦瀛樼殑鍛戒护鏈�澶х紦瀛樻椂闀�(绉�) lastUpDataTimeLive: TCP涓婅鏁版嵁鏃跺埢缂撳瓨鏃堕暱(绉�)锛屽綋杈惧埌鏃堕暱鏃讹紝TCP涓婅鏁版嵁鏃跺埢琚竻绌猴紝閲囩敤TCP涓婅鏁版嵁鏃跺埢鐩殑鏄紝闃绘涓婅鏁版嵁鍚屾椂涓嬪彂鏁版嵁锛屽洜涓篟TU澶勭悊涓嶈繃鏉�(缁忓垵娆″疄楠岋紝1绉掕繕鏄湁闂锛�2绉掓棤闂) dbDataIdSuffix锛氭暟鎹簱鏁版嵁id鐢熸垚鍣ㄧ殑id鍚庣紑锛�0鏄粯璁ょ殑鍚庣紑锛屼竴鑸瑆eb绯荤粺搴旂敤锛屾暟鎹腑闂翠欢id鍚庣紑澶т簬绛変簬1 + cacheUpDownDataWarnCount锛氫笂涓嬭鏁版嵁缂撳瓨闃熷垪涓紦瀛樻暟鎹釜鏁扮殑鎶ヨ閲忥紝杩欎釜涓庣幇瀹為」鐩墍鎺ユ按琛ㄦ暟鐩稿叧 + cacheUpDownDataMaxCount锛氫笂涓嬭鏁版嵁缂撳瓨闃熷垪涓紦瀛樻暟鎹釜鏁扮殑鏈�澶у�硷紝杩欎釜涓庣幇瀹為」鐩墍鎺ユ按琛ㄦ暟鐩稿叧 --> <base isLowPower="false" onlyOneProtocol="true" - downComandMaxResendTimes="1" + downComandMaxResendTimes="3" commandSendInterval="3" cachWaitResultTimeout="60" offLineCachTimeout="86400" lastUpDataTimeLive="1" - dbDataIdSuffix="1" + dbDataIdSuffix="0" + cacheUpDownDataWarnCount="100000" + cacheUpDownDataMaxCount="110000" /> <!-- - centerAddr: 涓績鍦板潃锛屽綋鍓嶏紝鍦ㄦ埛琛ㄧ郴缁熶腑鐨勶紝centerAddr鏈敤鍒� + centerAddr: 涓績鍦板潃锛屽綋鍓嶏紝centerAddr鏈敤鍒� synchroRtuClock: 鏄惁瀵筊TU鏍℃椂 synchroRtuClockTimepieces锛氬綋RTU涓庢湇鍔″櫒鏃堕挓鐩稿樊涓�瀹氭绉掞紙閰嶇疆鏂囦欢鏄閽燂級鍚庯紝杩涜鏍℃椂 --> @@ -41,7 +45,7 @@ <!-- 杞欢鍗囩骇 --> <updateRtuSoft enable="true"> <soft1 enable="true" oldVersionName="meter_v2_0,meter_v1_0" > - <newVersion newVersionName="meter_v3_0" file="rtuSoft/meter_v3_0.txt"></newVersion> + <newVersion newVersionName="meter_v3_0" file="rtuSoft/meter_v3_0.txt"> </newVersion> </soft1> <!-- <soft2 enable="false" oldVersionName="rtu_v1_0,rtu_v2_0,rtu_v3_0" > @@ -53,27 +57,28 @@ <!-- 鏀寔妯″潡 鐭伐浣滄椂闀跨嚎绋嬫睜锛岀嚎绋嬭礋璐g敤鏃惰緝鐭殑宸ヤ綔浠诲姟 - short_maxThread锛� 姹犱腑鏈�澶х嚎绋嬫暟涓烘墍鏈塁PU鏍告暟+1 - short_minThread锛� 姹犱腑鏈�灏忕嚎绋嬫暟 + short_maxThread锛� 姹犱腑鏈�澶х嚎绋嬫暟涓烘墍鏈塁PU鏍告暟+1锛坰hort姹犱笌long姹犲悇鍒嗕竴鍗婏級锛岃嫢涓�-1锛屼笉鍙楅檺鍒� 锛岃缃负0锛岃〃绀轰笉鍚姩绾跨▼姹� + short_minThread锛� 姹犱腑鏈�灏忕嚎绋嬫暟锛岃嫢涓�-1锛屼笉鍙楅檺鍒讹紝璁剧疆涓�0锛岃〃绀轰笉鍚姩绾跨▼姹� short_freeTimeout锛� 绾跨▼鏁扮┖闂叉椂闀匡紝鑻ユ睜涓嚎绋嬫暟閲忓ぇ浜巑inThread锛屼笖鏈夌殑绾跨▼绌洪棽鏃堕暱瓒呰繃freeTimeout锛屽垯娓呴櫎璇ョ嚎绋嬶紝涓轰簡涓嶆竻闄わ紝鎶妋inThread涓巑axThread璁剧疆鐩哥瓑 short_busyTimeout锛氱嚎绋嬩笉闂存柇宸ヤ綔鏃堕暱锛堝崟浣嶄负绉�)瓒呮椂闄愶紝璁や负绾跨▼宸茬粡浜嗗穿婧冿紝灏嗗己鍒舵竻闄わ紝鐭伐浣滄椂闀胯缃负5绉� - 闀垮伐浣滄椂闀跨嚎绋嬫睜锛岀嚎绋嬭礋璐g敤鏃惰緝闀跨殑宸ヤ綔浠诲姟锛屼緥濡備粠Redis涓彇缂撳瓨鐨凴TU涓婅鏁版嵁 - long_maxThread锛� 姹犱腑鏈�澶х嚎绋嬫暟,鑻ヤ负-1锛屼笉鍙楅檺鍒� - long_minThread锛� 姹犱腑鏈�灏忕嚎绋嬫暟 + 闀垮伐浣滄椂闀跨嚎绋嬫睜锛岀嚎绋嬭礋璐g敤鏃惰緝闀跨殑宸ヤ綔浠诲姟锛屼緥濡傛暟鎹簱瀛樺彇鎿嶄綔 + long_maxThread锛� 姹犱腑鏈�澶х嚎绋嬫暟涓烘墍鏈塁PU鏍告暟+1锛坰hort姹犱笌long姹犲悇鍒嗕竴鍗婏級锛岃嫢涓�-1锛屼笉鍙楅檺鍒讹紝璁剧疆涓�0锛岃〃绀轰笉鍚姩绾跨▼姹� + long_minThread锛� 姹犱腑鏈�灏忕嚎绋嬫暟锛岃嫢涓�-1锛屼笉鍙楅檺鍒讹紝璁剧疆涓�0锛岃〃绀轰笉鍚姩绾跨▼姹� long_freeTimeout锛� 绾跨▼鏁扮┖闂叉椂闀匡紝鑻ユ睜涓嚎绋嬫暟閲忓ぇ浜巑inThread锛屼笖鏈夌殑绾跨▼绌洪棽鏃堕暱瓒呰繃freeTimeout锛屽垯娓呴櫎璇ョ嚎绋� long_busyTimeout锛氱嚎绋嬩笉闂存柇宸ヤ綔鏃堕暱锛堝崟浣嶄负绉�)瓒呮椂闄愶紝鑻ヤ负-1锛屼笉鍙楅檺鍒� enableThreadPool锛氭槸鍚﹀惎鐢ㄧ嚎绋嬫睜 --> + <!-- 褰撳墠瀹炵幇锛屽啓rtu鏃ュ織銆丷MI鏁版嵁澶勭悊鐢ㄥ埌浜嗙煭绾跨▼姹� --> + <!-- 褰撳墠瀹炵幇锛宺tu涓婅鏁版嵁澶勭悊锛堣鍐欐暟鎹級鐢ㄥ埌浜嗙绾跨▼姹� --> <support - short_maxThread="100" - short_minThread="5" + short_maxThread="6" + short_minThread="6" short_freeTimeout="60" short_busyTimeout="5" - long_maxThread="200" - long_minThread="0" + long_maxThread="6" + long_minThread="6" long_freeTimeout="60" long_busyTimeout="-1" - enableThreadPool="true" /> <!-- @@ -105,14 +110,10 @@ <!-- sleepBigBusy锛氫富绾跨▼澶у繖鏃舵瘡娆℃墽琛岄棿闅旀椂闀匡紙姣锛� sleepSmallBusy锛氫富绾跨▼灏忓繖鏃舵瘡娆℃墽琛岄棿闅旀椂闀匡紙姣锛� - queueWarnSize: 缂撳瓨闃熷垪鑺傜偣鏁拌鍛婃暟閲� - queueMaxSize: 缂撳瓨闃熷垪鑺傜偣鏁版渶澶ф暟閲� --> <core sleepBigBusy="100" sleepSmallBusy="500" - queueWarnSize="100000" - queueMaxSize="300000" /> <!-- diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw.iml b/pipIrr-platform/pipIrr-mw/pipIrr-mw.iml index 754c7d6..12810d8 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw.iml +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw.iml @@ -8,88 +8,20 @@ </content> <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module" module-name="pipIrr-common" /> - <orderEntry type="module" module-name="pipIrr-global" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:3.1.3" level="project" /> - <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:10.1.12" level="project" /> - <orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:8.0.1.Final" level="project" /> - <orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:3.0.2" level="project" /> - <orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.5.3.Final" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:3.1.3" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:3.1.3" level="project" /> - <orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:2.1.1" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:3.1.3" level="project" /> - <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:10.1.12" level="project" /> - <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:10.1.12" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-web:6.0.11" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-beans:6.0.11" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:6.0.11" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-aop:6.0.11" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-context:6.0.11" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-expression:6.0.11" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: org.springframework.boot:spring-boot-devtools:3.1.3" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:3.1.3" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:3.1.3" level="project" /> + <orderEntry type="module" module-name="pipIrr-common" scope="PROVIDED" /> + <orderEntry type="module" module-name="pipIrr-common" scope="PROVIDED" /> + <orderEntry type="module" module-name="pipIrr-global" scope="PROVIDED" /> <orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.28" level="project" /> <orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.20" level="project" /> + <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:2.0.7" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-log4j2:3.1.3" level="project" /> <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-slf4j2-impl:2.20.0" level="project" /> <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.20.0" level="project" /> <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.20.0" level="project" /> <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-jul:2.20.0" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.2" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.15.2" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.15.2" level="project" /> <orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.33" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.15.2" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-actuator:3.1.3" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator-autoconfigure:3.1.3" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator:3.1.3" level="project" /> - <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.15.2" level="project" /> - <orderEntry type="library" name="Maven: io.micrometer:micrometer-observation:1.11.2" level="project" /> - <orderEntry type="library" name="Maven: io.micrometer:micrometer-commons:1.11.2" level="project" /> - <orderEntry type="library" name="Maven: io.micrometer:micrometer-core:1.11.2" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: org.hdrhistogram:HdrHistogram:2.1.12" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: org.latencyutils:LatencyUtils:2.0.3" level="project" /> - <orderEntry type="library" name="Maven: org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0" level="project" /> - <orderEntry type="library" name="Maven: org.webjars:swagger-ui:5.2.0" level="project" /> - <orderEntry type="library" name="Maven: org.springdoc:springdoc-openapi-starter-webmvc-api:2.2.0" level="project" /> - <orderEntry type="library" name="Maven: org.springdoc:springdoc-openapi-starter-common:2.2.0" level="project" /> - <orderEntry type="library" name="Maven: io.swagger.core.v3:swagger-core-jakarta:2.2.15" level="project" /> - <orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.12.0" level="project" /> - <orderEntry type="library" name="Maven: io.swagger.core.v3:swagger-annotations-jakarta:2.2.15" level="project" /> - <orderEntry type="library" name="Maven: io.swagger.core.v3:swagger-models-jakarta:2.2.15" level="project" /> - <orderEntry type="library" name="Maven: org.springdoc:springdoc-openapi-security:1.7.0" level="project" /> - <orderEntry type="library" name="Maven: org.springdoc:springdoc-openapi-common:1.7.0" level="project" /> - <orderEntry type="library" name="Maven: io.swagger.core.v3:swagger-core:2.2.9" level="project" /> - <orderEntry type="library" name="Maven: io.swagger.core.v3:swagger-annotations:2.2.9" level="project" /> - <orderEntry type="library" name="Maven: io.swagger.core.v3:swagger-models:2.2.9" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.security:spring-security-core:6.1.2" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.security:spring-security-crypto:6.1.2" level="project" /> - <orderEntry type="library" name="Maven: com.mysql:mysql-connector-j:8.0.33" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.2.20" level="project" /> - <orderEntry type="library" name="Maven: com.alibaba:druid:1.2.20" level="project" /> - <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:2.0.7" level="project" /> - <orderEntry type="library" name="Maven: org.glassfish.jaxb:jaxb-runtime:4.0.3" level="project" /> - <orderEntry type="library" name="Maven: org.glassfish.jaxb:jaxb-core:4.0.3" level="project" /> - <orderEntry type="library" scope="RUNTIME" name="Maven: org.eclipse.angus:angus-activation:2.0.1" level="project" /> - <orderEntry type="library" name="Maven: org.glassfish.jaxb:txw2:4.0.3" level="project" /> - <orderEntry type="library" name="Maven: com.sun.istack:istack-commons-runtime:4.1.2" level="project" /> - <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.5.3.2" level="project" /> - <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.5.3.2" level="project" /> - <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.5.3.2" level="project" /> - <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.5.3.2" level="project" /> - <orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.5.3.2" level="project" /> - <orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.6" level="project" /> - <orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.13" level="project" /> - <orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.1.1" level="project" /> - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:3.1.3" level="project" /> - <orderEntry type="library" name="Maven: com.zaxxer:HikariCP:5.0.1" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:6.0.11" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-tx:6.0.11" level="project" /> - <orderEntry type="library" name="Maven: cglib:cglib:3.3.0" level="project" /> - <orderEntry type="library" name="Maven: org.ow2.asm:asm:7.1" level="project" /> <orderEntry type="library" name="Maven: com.alibaba.fastjson2:fastjson2:2.0.40" level="project" /> <orderEntry type="library" name="Maven: com.alibaba.fastjson2:fastjson2-extension-spring6:2.0.40" level="project" /> <orderEntry type="library" name="Maven: com.alibaba.fastjson2:fastjson2-extension:2.0.40" level="project" /> @@ -97,37 +29,8 @@ <orderEntry type="library" name="Maven: org.mapstruct:mapstruct-processor:1.5.5.Final" level="project" /> <orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.8.21" level="project" /> <orderEntry type="library" name="Maven: org.jdom:jdom2:2.0.6.1" level="project" /> - <orderEntry type="library" name="Maven: org.apache.dubbo:dubbo:3.2.7" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:3.1.3" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:3.1.3" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:3.1.3" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.8.0" level="project" /> - <orderEntry type="library" name="Maven: jakarta.xml.bind:jakarta.xml.bind-api:4.0.0" level="project" /> - <orderEntry type="library" name="Maven: jakarta.activation:jakarta.activation-api:2.1.2" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.4.11" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:2.4.11" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.24.2" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy:1.14.6" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest:2.2" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.9.3" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.9.3" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.9.3" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.2" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.9.3" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.9.3" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.9.3" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:5.3.1" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.14.6" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:3.3" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-junit-jupiter:5.3.1" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.1" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-core:6.0.11" level="project" /> - <orderEntry type="library" name="Maven: org.springframework:spring-jcl:6.0.11" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:6.0.11" level="project" /> - <orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.9.1" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13.2" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:2.2" level="project" /> + <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest:2.2" level="project" /> </component> </module> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/.gitignore b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.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-mwTest-server/pom.xml b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/pom.xml new file mode 100644 index 0000000..4872f57 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/pom.xml @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>pipIrr-mw</artifactId> + <groupId>com.dy</groupId> + <version>1.0.0</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <packaging>jar</packaging> + <artifactId>pipIrr-mwTest-server</artifactId> + <version>1.0.0</version> + <name>pipIrr-mwTest-server</name> + <description>涓烘ā鎷烺TU娴嬭瘯绔彁渚涙湇鍔�</description> + + <dependencies> + </dependencies> + + <build> + <plugins> + <plugin> + <!-- 璇ユ彃浠朵笉浼氬皢椤圭洰涓紩鍏ョ殑渚濊禆鎵撹繘鏈�缁堢殑 Jar 鏂囦欢 --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <!-- 鐢熸垚鐨刯ar涓紝涓嶈鍖呭惈pom.xml鍜宲om.properties杩欎袱涓枃浠� --> + <addMavenDescriptor>false</addMavenDescriptor> + <!-- 杩欓儴鍒嗗彲鏈夊彲鏃�,鍔犱笂鐨勮瘽鍒欑洿鎺ョ敓鎴愬彲杩愯jar鍖� --> + <manifest> + <mainClass>com.dy.testServer.Server</mainClass> + <useUniqueVersions>false</useUniqueVersions> + <addClasspath>true</addClasspath> + <classpathPrefix>lib/</classpathPrefix> + </manifest> + <!-- manifestEntries鐨勪綔鐢ㄦ槸鎸囧畾鏈湴锛堣嚜宸变笅杞界殑lib涓嬬殑锛塲ar鍖呮坊鍔犲埌MANIFEST.MF鏂囦欢涓幓 + <manifestEntries> + <Class-Path>.lib/alipay-sdk.java.jar</Class-Path> + </manifestEntries> + --> + </archive> + <!-- 鎺掗櫎鏌愪釜鏂囦欢 + <excludes> + <exclude>com/dy/App.class</exclude> + </excludes> + --> + <!-- 鍙墽琛宩ar杩涜鍛藉悕銆傝繖鏍蜂細鎵撳寘鎴愪袱涓猨ar鍖咃紝涓嶄細瀵规櫘閫歫ar閲嶆柊鍛藉悕銆� + <classifier>exec</classifier> + --> + </configuration> + </plugin> + <plugin> + <!-- 褰撻」鐩腑渚濊禆姣旇緝澶氭椂锛屾垜浠彲浠ュ�熷姪 maven-dependency-plugin 鎻掍欢鑷姩甯垜浠笅杞戒緷璧栫殑 Jar 鏂囦欢锛屾帹鑽愬皢璇ユ彃浠剁粦瀹氬埌package鐢熷懡鍛ㄦ湡涓� --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <!-- 缁戝畾鐢熷懡鍛ㄦ湡 --> + <phase>package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <!-- 璁剧疆渚濊禆鐨勫瓨鏀捐矾寰� --> + <configuration> + <outputDirectory>${project.build.directory}/lib</outputDirectory> + </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> + + </plugins> + </build> +</project> diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/AdapterImp_RmiUnit.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/AdapterImp_RmiUnit.java new file mode 100644 index 0000000..de59d8c --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/AdapterImp_RmiUnit.java @@ -0,0 +1,26 @@ +package com.dy.testServer; + +import com.dy.common.mw.channel.rmi.RmiConfigVo; +import com.dy.common.mw.channel.rmi.RmiRequestCallback; +import com.dy.common.mw.channel.rmi.RmiUnitAdapter; +import com.dy.testServer.forRmi.RmiRequestedCallback; + +public class AdapterImp_RmiUnit implements RmiUnitAdapter { + + private RmiConfigVo configVo ; + + @Override + public RmiConfigVo getConfig() { + return configVo; + } + + public void setConfig(RmiConfigVo configVo){ + this.configVo = configVo ; + } + + @Override + public RmiRequestCallback newRequestCallback() { + return new RmiRequestedCallback(); + } + +} 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 new file mode 100644 index 0000000..27fcf68 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/Server.java @@ -0,0 +1,167 @@ +package com.dy.testServer; + +import java.io.Console; +import java.util.ArrayList; +import java.util.List; + +import com.dy.testServer.console.CommandConsole; +import com.dy.testServer.forRmi.Manager; +import org.jdom2.Document; + +import com.dy.common.mw.UnitInterface; +import com.dy.common.mw.UnitStartedCallbackInterface; +import com.dy.common.mw.channel.rmi.RmiConfigVo; +import com.dy.common.mw.channel.rmi.RmiUnit; +import com.dy.common.util.ConfigXml; +import com.dy.common.util.NumUtil; + +public class Server{ + + private ConfigXml conf = null ; + private Document doc = null ; + private boolean showStartInfo = false ; + + private String RmiSvUrl ; + + private final List<UnitInterface> units = new ArrayList<>() ; + + /** + * @param args 鍙傛暟 + */ + public static void main(String[] args) { + new Server().startServer(args); + } + + /** + * 鍚姩鏈嶅姟 + */ + public void startServer(String[] args){ + Server sv = new Server(); + long start = System.currentTimeMillis() ; + try { + sv.conf = new ConfigXml() ; + sv.doc = sv.conf.createDom(sv.getClass(), "/config.xml") ; + //////////////// + //鏈嶅姟 閰嶇疆 + sv.showStartInfo = sv.conf.getSetAttrBoolean(sv.doc, "config.server", "showStartInfo", null, null) ; + + sv.startUnits() ; + + String svName ; + try{ + svName = sv.conf.getSetAttrTxt(sv.doc, "config.server", "name", null, false, null) ; + }catch(Exception e){ + svName = "" ; + } + + System.out.println("OOOOOOOOOO OOOOOOOO OOOOOOOO") ; + System.out.println("@@@@@@@@@@@@@@@@#O $@@@@@@@@& @@@@@@@@#") ; + System.out.println("@@@@@@@@@@@@@@@@@@@# @@@@@@@@# $@@@@@@@@&") ; + System.out.println("@@@@@@@@@@@@@@@@@@@@@# #@@@@@@@@@@@@@@@@O") ; + System.out.println("@@@@@@@@@@@@@@@@@@@@@@@ &@@@@@@@@@@@@@@") ; + System.out.println("@@@@@@$ $@@@@@@@@@& O@@@@@@@@@@@#") ; + System.out.println("@@@@@@$ @@@@@@@@@ @@@@@@@@@& " + svName + "mwTestSv " ) ; + System.out.println("@@@@@@$ @@@@@@@@@ &@@@@@@@@") ; + System.out.println("@@@@@@$ O@@@@@@@@@ &@@@@@@@@") ; + if(sv.RmiSvUrl != null){ + System.out.println("@@@@@@$ #@@@@@@@@@$ &@@@@@@@@ RmiSv " + sv.RmiSvUrl ) ; + }else{ + System.out.println("@@@@@@$ #@@@@@@@@@$ &@@@@@@@@" ) ; + } + System.out.println("@@@@@@@@@@@@@@@@@@@@@@# &@@@@@@@@ Runing in standalone mode" ) ; + System.out.println("@@@@@@@@@@@@@@@@@@@@@& &@@@@@@@@ Startup in " + (System.currentTimeMillis() - start) + " MS" ) ; + System.out.println("@@@@@@@@@@@@@@@@@@@# &@@@@@@@@") ; + System.out.println("@@@@@@@@@@@@@@@@#O &@@@@@@@@") ; + + + + Console console = System.console(); + if (console == null) { + throw new IllegalStateException("涓ラ噸閿欒锛屾湭鑳藉緱鍒版帶鍒跺彴瀵硅薄!"); + } + CommandConsole mwConsole = new CommandConsole(console) ; + mwConsole.init(args); + boolean exit = mwConsole.clientConsole() ; + if(exit){ + System.exit(-1); + } + }catch(Exception e){ + e.printStackTrace(); + } + } + + private void startUnits(){ + try { + /////////////// + //鍩烘湰閰嶇疆 + String txt = conf.getSetAttrTxt(doc, "config.base", "rtuAddrStart", null, false, null) ; + if(txt == null || txt.trim().equals("")){ + throw new Exception("鍏冪礌config.base鐨勫睘鎬tuAddrStart鐨勫�间负绌哄瓧绗︿覆!"); + } + txt = txt.trim() ; + if(!NumUtil.isPlusIntNumber(txt)){ + throw new Exception("鍏冪礌config.base鐨勫睘鎬tuAddrStart鐨勫�煎繀椤讳负鏁板��!"); + } + if(txt.startsWith("0")){ + throw new Exception("鍏冪礌config.base鐨勫睘鎬tuAddrStart鐨勬暟鍊间笉鑳戒互0寮�澶�!"); + } + if(txt.length() != 10){ + throw new Exception("鍏冪礌config.base鐨勫睘鎬tuAddrStart鐨勬暟鍊奸暱搴﹀繀椤讳负10浣�!"); + } + ServerProperties.rtuAddrStart = Long.valueOf(txt) ; + + txt = conf.getSetAttrTxt(doc, "config.base", "rtuAddrEnd", null, false, null) ; + if(txt == null || txt.trim().equals("")){ + throw new Exception("鍏冪礌config.base鐨勫睘鎬tuAddrEnd鐨勫�间负绌哄瓧绗︿覆!"); + } + txt = txt.trim() ; + if(!NumUtil.isPlusIntNumber(txt)){ + throw new Exception("鍏冪礌config.base鐨勫睘鎬tuAddrEnd鐨勫�煎繀椤讳负鏁板��!"); + } + if(txt.startsWith("0")){ + throw new Exception("鍏冪礌config.base鐨勫睘鎬tuAddrEnd鐨勬暟鍊间笉鑳戒互0寮�澶�!"); + } + if(txt.length() != 10){ + throw new Exception("鍏冪礌config.base鐨勫睘鎬tuAddrEnd鐨勬暟鍊奸暱搴﹀繀椤讳负10浣�!"); + } + ServerProperties.rtuAddrEnd = Long.valueOf(txt) ; + if(ServerProperties.rtuAddrEnd <= ServerProperties.rtuAddrStart){ + throw new Exception("鍏冪礌config.base鐨勫睘鎬tuAddrEnd鐨勬暟鍊煎繀椤诲ぇ浜巖tuAddrStart!"); + } + + ServerProperties.rtuAddrPerMwTest = conf.getSetAttrPlusInt(doc, "config.base", "rtuAddrPerMwTest", null, 1, null, null) ; + if(ServerProperties.rtuAddrPerMwTest > ServerProperties.rtuAddrEnd - ServerProperties.rtuAddrStart){ + throw new Exception("鍏冪礌config.base鐨勫睘鎬tuAddrPerMwTest鐨勬暟鍊奸厤缃笉姝g‘!"); + } + ServerProperties.tcpServerIp = conf.getSetAttrTxt(doc, "config.base", "tcpServerIp", null, false, null) ; + ServerProperties.tcpServerPort = conf.getSetAttrPlusInt(doc, "config.base", "tcpServerPort", null, 1, 65535, null) ; + ServerProperties.sendTimes = conf.getSetAttrPlusInt(doc, "config.base", "sendTimes", null, 1, null, null) ; + + + ///////////////// + //RMI妯″潡 + Manager.init(); + RmiConfigVo rmiVo = new RmiConfigVo(); + rmiVo.enable = conf.getSetAttrBoolean(doc, "config.rmi", "enable", null, null) ; + if(rmiVo.enable){ + rmiVo.port = conf.getSetAttrPlusInt(doc, "config.rmi", "port", null, 100, 65535, null); + rmiVo.context = conf.getSetAttrTxt(doc, "config.rmi", "context", null, false, null); + rmiVo.showStartInfo = showStartInfo ; + AdapterImp_RmiUnit rmiAdap = new AdapterImp_RmiUnit(); + rmiAdap.setConfig(rmiVo); + RmiUnit rmiUnit = RmiUnit.getInstance(); + rmiUnit.setAdapter(rmiAdap); + rmiUnit.start(new UnitStartedCallbackInterface(){ + @Override + public void call(Object obj) { + } + }); + RmiSvUrl = "[ip]:" + rmiVo.port + "/" + rmiVo.context ; + units.add(rmiUnit) ; + } + } catch (Exception e) { + e.printStackTrace(); + } + } + +} 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 new file mode 100644 index 0000000..de6cd2d --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/ServerProperties.java @@ -0,0 +1,18 @@ +package com.dy.testServer; + +public class ServerProperties { + + //妯℃嫙瀹㈡埛鐨剅tuAddr璧峰鍙� + public static Long rtuAddrStart = 0L ; + //妯℃嫙瀹㈡埛鐨剅tuAddr鎴鍙� + public static Long rtuAddrEnd = 0L ; + //姣忎釜mwTest鍒嗛厤鐨剅tuAddr鏁� + public static Integer rtuAddrPerMwTest = 0 ; + //鏈嶅姟绔疷RL + public static String tcpServerIp = "" ; + //鏈嶅姟绔笂涓嬫枃 + public static Integer tcpServerPort = 60000 ; + //鍙戦�佹暟鎹鏁� + 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 new file mode 100644 index 0000000..8e746e3 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/console/Command.java @@ -0,0 +1,126 @@ +package com.dy.testServer.console; + +import java.io.PrintWriter; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +import com.dy.common.mw.channel.rmi.RmiConfigVo; +import com.dy.common.mw.channel.rmi.RmiUnit; +import com.dy.testServer.ServerProperties; +import com.dy.testServer.forRmi.MwTestClientStatus; +import com.dy.testServer.forRmi.Manager; + +public class Command { + + private static final String[] commands ; + static{ + commands = new String[]{ + "config 鏌ョ湅閰嶇疆淇℃伅", + "show 鏄剧ずmwTest鎯呭喌", + "start 鍚姩mwTest涓婃姤鏁版嵁", + "exit 閫�鍑�", + }; + } + + + public static boolean dealCommand(String command, PrintWriter prtWrt){ + boolean exit = false ; + if (command.equals("help")) { + outCommand(prtWrt); + } else if (command.equals("config")) { + config(prtWrt); + } else if (command.equals("show")) { + show(prtWrt); + } else if (command.equals("start")) { + start(prtWrt); + } else if(command.equals("exit")){ + exit = true ; + } else { + outError(prtWrt); + } + return exit ; + } + private static void outCommand(PrintWriter prtWrt){ + prtWrt.println(""); + prtWrt.println("鍛戒护"); + for(String s : commands){ + prtWrt.println(" " + s); + } + prtWrt.println(""); + } + private static void outError(PrintWriter prtWrt){ + prtWrt.println(""); + prtWrt.println("鍛戒护涓嶅彲璇嗗埆锛�"); + prtWrt.println(""); + } + + private static void config(PrintWriter prtWrt){ + prtWrt.println(""); + prtWrt.println("鐩稿叧mwTest鐨勯厤缃�"); + prtWrt.println(" 妯℃嫙瀹㈡埛鐨凴tuAddr璧峰鍙凤細" + ServerProperties.rtuAddrStart); + prtWrt.println(" 妯℃嫙瀹㈡埛鐨凴tuAddr鎴鍙凤細" + ServerProperties.rtuAddrEnd); + prtWrt.println(" 姣忎釜mwTest鍒嗛厤鐨凴tuAddr鏁帮細" + ServerProperties.rtuAddrPerMwTest); + prtWrt.println(" 閫氫俊涓棿浠禝P锛�" + ServerProperties.tcpServerIp); + prtWrt.println(" 閫氫俊涓棿浠剁鍙o細" + ServerProperties.tcpServerPort); + prtWrt.println(" mwTest姣廟tuAddr鍙峰彂閫佹暟鎹鏁帮細" + ServerProperties.sendTimes); + prtWrt.println("鏈湇鍔MI Server閰嶇疆"); + String ip = null ; + try { + ip = InetAddress.getLocalHost().getHostAddress(); + } catch (UnknownHostException e) { + e.printStackTrace(); + } + RmiConfigVo confVo = RmiUnit.getInstance().getAdapter().getConfig() ; + if(ip != null){ + prtWrt.println(" RMI Server锛�" + ip + ":" + confVo.port + "/" + confVo.context); + }else{ + prtWrt.println(" RMI Server锛歔ip]:" + confVo.port + "/" + confVo.context); + } + prtWrt.println(""); + } + + private static void show(PrintWriter prtWrt){ + prtWrt.println(""); + prtWrt.println("褰撳墠宸叉敞鍐宮wTest瀹㈡埛绔暟閲忥細" + Manager.id2TokenMap.size()); + if(Manager.id2TokenMap.size() > 0){ + prtWrt.println("mwTest瀹㈡埛绔強鍏跺伐浣滀俊鎭�"); + Set<Map.Entry<String, MwTestClientStatus>> set = Manager.token2ClientMap.entrySet() ; + Iterator<Map.Entry<String, MwTestClientStatus>> it = set.iterator() ; + Map.Entry<String, MwTestClientStatus> ent ; + while(it.hasNext()){ + ent = it.next() ; + prtWrt.println(" mwTest瀹㈡埛绔�(token=" + ent.getKey() + ")"); + MwTestClientStatus sta = ent.getValue() ; + if(sta != null){ + if(sta.confVo != null){ + prtWrt.println(" rtuAddr鑼冨洿锛�" + sta.confVo.rtuAddrStart + "--" + sta.confVo.rtuAddrEnd); + } + if(sta.startVo != null){ + prtWrt.println(" 涓婃姤鏁版嵁锛�" + (sta.startVo.start?"宸茬粡寮�濮�":"鏈紑濮�")); + }else{ + prtWrt.println(" 涓婃姤鏁版嵁锛氭湭寮�濮�") ; + } + if(sta.count != null){ + prtWrt.println(" 宸茬粡涓婃姤鏁版嵁锛�" + sta.count + "鏉�"); + } + if(sta.over != null && sta.over){ + prtWrt.println(" 涓婃姤鏁版嵁宸茬粡瀹屾垚锛屽叡鐢ㄦ椂锛�" + sta.seconds + "绉�"); + } + } + } + } + prtWrt.println(""); + } + + private static void start(PrintWriter prtWrt){ + prtWrt.println(""); + prtWrt.println(" 宸茬粡鍏佽mwTest涓婃姤鏁版嵁浜�"); + prtWrt.println(""); + Manager.enablemwTestStart = true ; + } + + +} 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 new file mode 100644 index 0000000..b03e5b3 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/console/CommandConsole.java @@ -0,0 +1,91 @@ +package com.dy.testServer.console; + +import java.io.Console; +import java.io.PrintWriter; + +public class CommandConsole { + + private Console console ; + private PrintWriter prtWrt ; + private static final String myPassword = "123456" ; + private static final String commandPrefix1 = ">>" ; + private static final String commandPrefix2 = "$: " ; + private static String commandPrefix = commandPrefix1 + commandPrefix2 ; + + + public CommandConsole(Console console)throws Exception{ + this.console = console ; + if(this.console == null){ + throw new Exception("涓ラ噸閿欒锛宩ava鎺у埗鍙板璞′负绌猴紒"); + } + prtWrt = console.writer() ; + } + + /** + * 鍒濆锛屾鏌ュ苟杈撳嚭涓�浜涗俊鎭� + * @param args 鍙傛暟 + * @throws Exception 寮傚父 + */ + public void init(String[] args) throws Exception{ + PrintWriter prtWrt = console.writer() ; + if(args != null && args.length > 0){ + String str = "" ; + for(String s : args){ + str += s ; + } + prtWrt.println("info锛氬惎鍔ㄥ弬鏁�" + str); + } + + prtWrt.println("----------------------------------------"); + prtWrt.println("-- --"); + prtWrt.println("-- 娆㈣繋浣跨敤mwTest 鏈嶅姟鎺у埗绔� --"); + prtWrt.println("-- --"); + prtWrt.println("----------------------------------------"); + } + + /** + * 鎵ц鎺у埗鍙版帶鍒� + * @return 杩斿洖 + */ + public boolean clientConsole(){ + boolean exit = false ; + try { + this.login() ; + exit = this.doConsole(); + } catch (Exception e) { + e.printStackTrace(); + } + return exit ; + } + + private boolean login(){ + while (true) { + //String username = console.readLine("Username: "); + char[] password = console.readPassword(">>Password: "); + String passwordStr = String.valueOf(password) ; + if (passwordStr.equals("help")) { + console.printf("瀵嗙爜鏄�%1$s.\n", "123456"); + // 浣跨敤鍚庡簲绔嬪嵆灏嗘暟缁勬竻绌猴紝浠ュ噺灏戝叾鍦ㄥ唴瀛樹腑鍗犵敤鐨勬椂闂达紝澧炲己瀹夊叏鎬� + password = null; + } else if(passwordStr.equals(myPassword)){ + return true; + } + } + } + + private boolean doConsole(){ + boolean exit = false ; + while (!exit) { + String command = console.readLine(commandPrefix); + exit = Command.dealCommand(command, prtWrt) ; + } + return exit ; + } + + public static void changeCommandPrefix(String prefix){ + commandPrefix = commandPrefix1 + prefix ; + } + public static void recoverCommandPrefix(){ + commandPrefix = commandPrefix1 + commandPrefix2 ; + } +} 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 new file mode 100644 index 0000000..889e9b3 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/Code.java @@ -0,0 +1,15 @@ +package com.dy.testServer.forRmi; + +public class Code { + + public static String cd1 = "001" ;//娉ㄥ唽 + + public static String cd2 = "002" ;//璇锋眰mwClient鐨勯厤缃� + + public static String cd3 = "003" ;//璇锋眰寮�濮嬪伐浣� + + public static String cd4 = "004" ;//鍚戞湇鍔$涓婃姤淇℃伅 + + public static String cd5 = "005" ;//鍚戞湇鍔$涓婃姤 鏁版嵁涓婃姤宸ヤ綔宸茬粡瀹屾垚 + +} 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 new file mode 100644 index 0000000..8e057db --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/Manager.java @@ -0,0 +1,173 @@ +package com.dy.testServer.forRmi; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.dy.testServer.ServerProperties; + +public class Manager { + + public static boolean enablemwTestStart = false ; + + public static int clientId = 1 ; + + public static long maxClient = 0 ; + + public static Map<String, String> id2TokenMap = new HashMap<>() ; + + public static Map<String, MwTestClientStatus> token2ClientMap = new HashMap<>() ; + + public static List<Object[]> rtuAddrList = new ArrayList<>() ; + + public static void init(){ + maxClient = (ServerProperties.rtuAddrEnd - ServerProperties.rtuAddrStart)/ServerProperties.rtuAddrPerMwTest ; + if((ServerProperties.rtuAddrEnd - ServerProperties.rtuAddrStart)%ServerProperties.rtuAddrPerMwTest > 0 ){ + maxClient = maxClient + 1 ; + } + int count = 0 ; + for(int i = 0; i < maxClient; i++){ + long start = ServerProperties.rtuAddrStart + (i * ServerProperties.rtuAddrPerMwTest) ; + long end = ServerProperties.rtuAddrStart + ((i + 1) * ServerProperties.rtuAddrPerMwTest - 1) ; + if(end > ServerProperties.rtuAddrEnd){ + end = ServerProperties.rtuAddrEnd ; + } + if(end < start){ + break ; + }else{ + rtuAddrList.add(count++, new Object[]{start, end}); + } + } + } + + public synchronized static String dealRequest(Object obj) throws Exception{ + RmiResponseVo resVo ; + if(obj == null){ + resVo = new RmiResponseVo() ; + resVo.success = false ; + resVo.errorInfo = "鏀跺埌鐨勬暟鎹负null" ; + }else if(!(obj instanceof String)){ + resVo = new RmiResponseVo() ; + resVo.success = false ; + resVo.errorInfo = "鏀跺埌鐨勬暟鎹笉鏄瓧绗︿覆绫诲瀷" ; + }else{ + RmiRequestVo rqVo = RmiRequestVo.jsonToObject((String)obj) ; + resVo = doDeal(rqVo) ; + } + return resVo.toJson() ; + } + + private static RmiResponseVo doDeal(RmiRequestVo rqVo){ + RmiResponseVo resVo = new RmiResponseVo() ; + resVo.code = rqVo.code ; + if(rqVo.code.equals(Code.cd1)){ + if(rqVo.id == null || rqVo.id.trim().equals("")){ + resVo.success = false ; + resVo.errorInfo = "娉ㄥ唽澶辫触锛屽繀椤绘彁渚涘鎴风ID " ; + }else{ + ResRegisterVo vo = doDealRegister(rqVo) ; + if(vo != null){ + resVo.obj = vo ; + }else{ + resVo.success = false ; + resVo.errorInfo = "rtuAddr宸茬粡鍒嗛厤瀹屾垚锛屾敞鍐屽け璐�" ; + } + } + }else if(rqVo.code.equals(Code.cd2)){ + resVo.obj = doDealGetConfig(rqVo) ; + }else if(rqVo.code.equals(Code.cd3)){ + resVo.obj = doDealGetStart(rqVo) ; + }else if(rqVo.code.equals(Code.cd4)){ + doDealReportCount(rqVo) ; + }else if(rqVo.code.equals(Code.cd5)){ + doDealReportOver(rqVo) ; + } + return resVo ; + } + + private static ResRegisterVo doDealRegister(RmiRequestVo rqVo){ + ResRegisterVo resVo = null ; + String token = id2TokenMap.get(rqVo.id) ; + if(token == null){ + if(clientId <= rtuAddrList.size()){ + resVo = new ResRegisterVo() ; + resVo.token = "" + clientId ; + id2TokenMap.put(rqVo.id, resVo.token) ; + clientId++ ; + } + }else{ + resVo = new ResRegisterVo() ; + resVo.token = token ; + } + return resVo ; + } + + private static MwConfigVo doDealGetConfig(RmiRequestVo rqVo){ + MwConfigVo conVo ; + int token = Integer.parseInt(rqVo.token) ; + MwTestClientStatus sta = token2ClientMap.get("" + token); + if(sta == null){ + Object[] rtuAddrs = rtuAddrList.get(token-1) ; + conVo = new MwConfigVo() ; + conVo.rtuAddrStart = (Long)rtuAddrs[0] ; + conVo.rtuAddrEnd = (Long)rtuAddrs[1] ; + conVo.tcpServerIp = ServerProperties.tcpServerIp ; + conVo.tcpServerPort = ServerProperties.tcpServerPort ; + conVo.sendTimes = ServerProperties.sendTimes ; + sta = new MwTestClientStatus() ; + sta.confVo = conVo ; + token2ClientMap.put("" + token, sta); + }else{ + conVo = sta.confVo; + } + return conVo ; + } + private static ResStartVo doDealGetStart(RmiRequestVo rqVo){ + ResStartVo rvo = new ResStartVo() ; + rvo.start = enablemwTestStart ; + int token = Integer.parseInt(rqVo.token) ; + MwTestClientStatus sta = token2ClientMap.get("" + token); + if(sta == null){ + sta = new MwTestClientStatus() ; + sta.startVo = rvo ; + token2ClientMap.put("" + token, sta); + }else{ + sta.startVo = rvo ; + } + return rvo ; + } + + + private static void doDealReportCount(RmiRequestVo rqVo){ + int token = Integer.parseInt(rqVo.token) ; + MwTestClientStatus sta = token2ClientMap.get("" + token); + if(sta == null){ + sta = new MwTestClientStatus() ; + sta.count = rqVo.count ; + token2ClientMap.put("" + token, sta); + }else{ + sta.count = rqVo.count ; + } + } + + + private static void doDealReportOver(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 ; + } + token2ClientMap.put("" + token, sta); + }else{ + if(rqVo.over != null && rqVo.over){ + sta.over = true ; + sta.seconds = rqVo.seconds ; + } + } + } + +} 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 new file mode 100644 index 0000000..d5de351 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/MwConfigVo.java @@ -0,0 +1,84 @@ +package com.dy.testServer.forRmi; + +import com.alibaba.fastjson2.JSON; + +public class MwConfigVo { + //妯℃嫙瀹㈡埛鐨凴tuAddr璧峰鍙� + public Long rtuAddrStart = 0L ; + //妯℃嫙瀹㈡埛鐨凴tuAddr鎴鍙� + public Long rtuAddrEnd = 0L ; + //閫氫俊涓棿浠禝P + public String tcpServerIp = "" ; + //閫氫俊涓棿浠剁鍙� + public Integer tcpServerPort = 0 ; + //鍙戦�佹暟鎹鏁� + public Integer sendTimes = 0 ; + + /** + * 瀵硅薄杞垚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 鍙傛暟 + * @return 杩斿洖瀵硅薄 + * @throws Exception 寮傚父 + */ + public static MwConfigVo jsonToObject(String json)throws Exception{ + try{ + return JSON.parseObject(json, MwConfigVo.class) ; + //return new JSONDeserializer<ResConfigVo>().deserialize(json, ResConfigVo.class) ; + }catch(Exception e){ + throw new Exception(e.getMessage() , e ) ; + } + } + + public Long getRtuAddrStart() { + return rtuAddrStart; + } + + public void setRtuAddrStart(Long rtuAddrStart) { + this.rtuAddrStart = rtuAddrStart; + } + + public Long getRtuAddrEnd() { + return rtuAddrEnd; + } + + public void setRtuAddrEnd(Long rtuAddrEnd) { + this.rtuAddrEnd = rtuAddrEnd; + } + + public String getTcpServerIp() { + return tcpServerIp; + } + + public void setTcpServerIp(String tcpServerIp) { + this.tcpServerIp = tcpServerIp; + } + + public Integer getTcpServerPort() { + return tcpServerPort; + } + + public void setTcpServerPort(Integer tcpServerPort) { + this.tcpServerPort = tcpServerPort; + } + + public Integer getSendTimes() { + return sendTimes; + } + + public void setSendTimes(Integer sendTimes) { + this.sendTimes = 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 new file mode 100644 index 0000000..3dc24c6 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/MwTestClientStatus.java @@ -0,0 +1,56 @@ +package com.dy.testServer.forRmi; + +public class MwTestClientStatus { + + public MwConfigVo confVo ; + + public ResStartVo startVo ; + + public Integer count ;//mwTest涓婃姤鏁版嵁鏁伴噺 + + public Boolean over ;//mwTest涓婃姤鏁版嵁缁撴潫 + + public Long seconds ;//mwTest涓婃姤鏁版嵁鐢ㄦ椂(绉�) + + public MwConfigVo getConfVo() { + return confVo; + } + + public void setConfVo(MwConfigVo confVo) { + this.confVo = confVo; + } + + public ResStartVo getStartVo() { + return startVo; + } + + public void setStartVo(ResStartVo startVo) { + this.startVo = startVo; + } + + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public Boolean getOver() { + return over; + } + + public void setOver(Boolean over) { + this.over = over; + } + + public Long getSeconds() { + return seconds; + } + + public void setSeconds(Long seconds) { + this.seconds = seconds; + } + + +} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/ResRegisterVo.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/ResRegisterVo.java new file mode 100644 index 0000000..7a71d33 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/ResRegisterVo.java @@ -0,0 +1,46 @@ +package com.dy.testServer.forRmi; + + +import com.alibaba.fastjson2.JSON; + +public class ResRegisterVo { + + public String token ; + + /** + * 瀵硅薄杞垚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 鍙傛暟 + * @return 瀵硅薄 + * @throws Exception 寮傚父 + */ + public static ResRegisterVo jsonToObject(String json)throws Exception{ + try{ + return JSON.parseObject(json, ResRegisterVo.class) ; + //return new JSONDeserializer<ResRegisterVo>().deserialize(json, ResRegisterVo.class) ; + }catch(Exception e){ + throw new Exception(e.getMessage() , e ) ; + } + } + + public String getToken() { + return token; + } + + public void setToken(String id) { + this.token = id; + } + +} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/ResStartVo.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/ResStartVo.java new file mode 100644 index 0000000..ce87eb6 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/ResStartVo.java @@ -0,0 +1,63 @@ +package com.dy.testServer.forRmi; + + +import com.alibaba.fastjson2.JSON; + +public class ResStartVo { + + public boolean success = true ; + + public String errorInfo ; + + public boolean start ; + + + /** + * 瀵硅薄杞垚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 鍙傛暟 + * @return 瀵硅薄 + * @throws Exception 寮傚父 + */ + public static ResStartVo jsonToObject(String json)throws Exception{ + try{ + return JSON.parseObject(json, ResStartVo.class) ; + //return new JSONDeserializer<ResStartVo>().deserialize(json, ResStartVo.class) ; + }catch(Exception e){ + throw new Exception(e.getMessage() , e ) ; + } + } + + public boolean isSuccess() { + return success; + } + public void setSuccess(boolean success) { + this.success = success; + } + public String getErrorInfo() { + return errorInfo; + } + public void setErrorInfo(String errorInfo) { + this.errorInfo = errorInfo; + } + public boolean isStart() { + return start; + } + + public void setStart(boolean start) { + this.start = start; + } + +} 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 new file mode 100644 index 0000000..59e9e6c --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/RmiRequestVo.java @@ -0,0 +1,87 @@ +package com.dy.testServer.forRmi; + +import com.alibaba.fastjson2.JSON; + +public class RmiRequestVo { + + public String id ;//瀹㈡埛绔疘D + + public String token ;//鏈嶅姟绔垎閰嶇殑token + + public String code ; + + public Integer count;//mwTest涓婃姤鏁版嵁鏁伴噺 + + public Boolean over ;//mwTest涓婃姤鏁版嵁缁撴潫 + + public Long seconds ;//mwTest涓婃姤鏁版嵁鐢ㄦ椂(绉�) + + /** + * 瀵硅薄杞垚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 鍙傛暟 + * @return 瀵硅薄 + * @throws Exception 寮傚父 + */ + public static RmiRequestVo jsonToObject(String json)throws Exception{ + try{ + return JSON.parseObject(json, RmiRequestVo.class) ; + //JSONDeserializer<RmiRequestVo> jsonD = new JSONDeserializer<>() ; + //RmiRequestVo rqVo = jsonD.deserialize(json, RmiRequestVo.class) ; + //return rqVo ; + }catch(Exception e){ + throw new Exception(e.getMessage() , e ) ; + } + } + + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getToken() { + return token; + } + public void setToken(String id) { + this.token = id; + } + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + public Integer getCount() { + return count; + } + public void setCount(Integer count) { + this.count = count; + } + public Boolean getOver() { + return over; + } + public void setOver(Boolean over) { + this.over = over; + } + public Long getSeconds() { + return seconds; + } + public void setSeconds(Long seconds) { + this.seconds = seconds; + } + +} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/RmiRequestedCallback.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/RmiRequestedCallback.java new file mode 100644 index 0000000..da9d2b2 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/RmiRequestedCallback.java @@ -0,0 +1,36 @@ +package com.dy.testServer.forRmi; + +import java.rmi.RemoteException; + +import com.dy.common.mw.channel.rmi.RmiRequestCallback; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class RmiRequestedCallback implements RmiRequestCallback { + + @SuppressWarnings("unused") + private static Logger log = LogManager.getLogger(RmiRequestedCallback.class.getName()) ; + + @Override + public Object syncRequest(Object obj) throws RemoteException { + String json ; + try { + json = Manager.dealRequest(obj); + } catch (Exception e) { + throw new RemoteException("鏈嶅姟绔紓甯�" , e) ; + } + return json ; + } + + @Override + public String asyncRequest(Object obj) throws RemoteException { + String json ; + try { + json = Manager.dealRequest(obj); + } catch (Exception e) { + throw new RemoteException("鏈嶅姟绔紓甯�" , e) ; + } + return json ; + } + +} diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/RmiResponseVo.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/RmiResponseVo.java new file mode 100644 index 0000000..c076cea --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/java/com/dy/testServer/forRmi/RmiResponseVo.java @@ -0,0 +1,75 @@ +package com.dy.testServer.forRmi; + +import com.alibaba.fastjson2.JSON; + +public class RmiResponseVo { + + public boolean success = true ; + + public String errorInfo ; + + public String code ; + + public Object obj ; + + /** + * 瀵硅薄杞垚json + * @return + * @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 + * @param clazz + * @return + * @throws Exception + */ + public static RmiResponseVo jsonToObject(String json, Class<?> clazz)throws Exception{ + try{ + return JSON.parseObject(json, RmiResponseVo.class) ; + //JSONDeserializer<RmiResponseVo> jsonD = new JSONDeserializer<>() ; + //jsonD.use("obj", clazz) ; + //RmiResponseVo resp = jsonD.deserialize(json, RmiResponseVo.class) ; + //return resp ; + }catch(Exception e){ + throw new Exception(e.getMessage() , e ) ; + } + } + + public String getCode() { + return code; + } + + public boolean isSuccess() { + return success; + } + public void setSuccess(boolean success) { + this.success = success; + } + public String getErrorInfo() { + return errorInfo; + } + public void setErrorInfo(String errorInfo) { + this.errorInfo = errorInfo; + } + public void setCode(String code) { + this.code = code; + } + + public Object getObj() { + return obj; + } + + public void setObj(Object obj) { + this.obj = obj; + } + +} 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 new file mode 100644 index 0000000..e0a7651 --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/resources/Config.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<config> + <server name="mwTest娴嬭瘯鎺у埗绔�" showStartInfo="true" company="http://www.dyjs.com"/> + <!-- + 鍩烘湰閰嶇疆 + rtuAddrStart: 妯℃嫙瀹㈡埛鐨凴tuAddr璧峰鍙� + rtuAddrEnd: 妯℃嫙瀹㈡埛鐨凴tuAddr鎴鍙� + rtuAddrsPerMwTest: 姣忎釜mwTest鍒嗛厤鐨凴tuAddr鏁� + tcpServerIp: 閫氫俊涓棿浠禝P + tcpServerPort: 閫氫俊涓棿浠剁鍙� + sendTimes锛氬彂閫佹暟鎹鏁� + --> + <base + rtuAddrStart="5323280000" + rtuAddrEnd="5323289999" + rtuAddrPerMwTest="1" + tcpServerIp="127.0.0.1" + tcpServerPort="60000" + sendTimes="1" + /> + + <!-- + port锛歳mi鏈嶅姟绔彛鍙� + context锛歳mi鏈嶅姟涓婁笅鏂� + --> + <rmi enable="true" + port="12345" + context="mwTestSv" + /> + +</config> \ No newline at end of file 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 new file mode 100644 index 0000000..5aba47b --- /dev/null +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-server/src/main/resources/log4j2.yml @@ -0,0 +1,64 @@ +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 780ceef..57010d3 100644 --- a/pipIrr-platform/pipIrr-mw/pom.xml +++ b/pipIrr-platform/pipIrr-mw/pom.xml @@ -16,6 +16,7 @@ <modules> <module>pipIrr-mw-accept</module> + <module>pipIrr-mwTest-server</module> </modules> <dependencies> @@ -23,41 +24,47 @@ <groupId>com.dy</groupId> <artifactId>pipIrr-common</artifactId> <version>1.0.0</version> + <scope>provided</scope> + <optional>true</optional> + <exclusions> + <exclusion> + <!-- 鎺掗櫎鎺塸ipIrr-common鐨勬墍鏈変緷璧栵紝鏈ā鍧楄嚜宸卞畾涔変緷璧� --> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>com.dy</groupId> <artifactId>pipIrr-global</artifactId> <version>1.0.0</version> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> + <scope>provided</scope> + <optional>true</optional> <exclusions> <exclusion> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-json</artifactId> - </exclusion> - <exclusion> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-logging</artifactId> + <!-- 鎺掗櫎鎺塸ipIrr-common鐨勬墍鏈変緷璧栵紝鏈ā鍧楄嚜宸卞畾涔変緷璧� --> + <groupId>*</groupId> + <artifactId>*</artifactId> </exclusion> </exclusions> </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-devtools</artifactId> - <scope>runtime</scope> - </dependency> + <!-- lombok --> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> + <!-- @Aspect @Pointcut @Around绛夊簲鐢� --> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> </dependency> <!--log4j2鏃ュ織--> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>2.0.7</version> + </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-log4j2</artifactId> @@ -66,53 +73,16 @@ <dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> <artifactId>jackson-dataformat-yaml</artifactId> - </dependency> - - <!-- 绯荤粺鐩戠 --> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-actuator</artifactId> - </dependency> - - <!-- api鍦ㄧ嚎鏂囨。 https://springdoc.org/#modules--> - <dependency> - <groupId>org.springdoc</groupId> - <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> - </dependency> - <dependency> - <groupId>org.springdoc</groupId> - <artifactId>springdoc-openapi-starter-webmvc-api</artifactId> - </dependency> - <dependency> - <groupId>org.springdoc</groupId> - <artifactId>springdoc-openapi-security</artifactId> - </dependency> - - - <!--mysql椹卞姩--> - <dependency> - <groupId>com.mysql</groupId> - <artifactId>mysql-connector-j</artifactId> - <version>8.0.33</version> - </dependency> - <!--druid-spring-boot杩炴帴姹�--> - <dependency> - <groupId>com.alibaba</groupId> - <artifactId>druid-spring-boot-starter</artifactId> - <version>1.2.20</version> - </dependency> - <!--mybatis-plus-spring-boot--> - <dependency> - <groupId>com.baomidou</groupId> - <artifactId>mybatis-plus-boot-starter</artifactId> - <version>3.5.3.2</version> + <exclusions> + <exclusion> + <!-- 鎺掗櫎鎺変緷璧� --> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </exclusion> + </exclusions> </dependency> <!-- 闃块噷fastjson --> - <dependency> - <groupId>cglib</groupId> - <artifactId>cglib</artifactId> - </dependency> <dependency> <groupId>com.alibaba.fastjson2</groupId> <artifactId>fastjson2</artifactId> @@ -148,49 +118,8 @@ <artifactId>jdom2</artifactId> </dependency> - <!-- bean鍜宮ap浜掕浆鎹� --> - <dependency> - <groupId>org.apache.dubbo</groupId> - <artifactId>dubbo</artifactId> - <version>3.2.7</version> - <exclusions> - <exclusion> - <groupId>io.netty</groupId> - <artifactId>netty-all</artifactId> - </exclusion> - <exclusion> - <groupId>org.yaml</groupId> - <artifactId>snakeyaml</artifactId> - </exclusion> - <exclusion> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - </exclusion> - <exclusion> - <groupId>com.alibaba.spring</groupId> - <artifactId>spring-context-support</artifactId> - </exclusion> - <exclusion> - <groupId>com.alibaba.fastjson2</groupId> - <artifactId>fastjson2</artifactId> - </exclusion> - <exclusion> - <groupId>com.alibaba</groupId> - <artifactId>hessian-lite</artifactId> - </exclusion> - <exclusion> - <groupId>org.javassist</groupId> - <artifactId>javassist</artifactId> - </exclusion> - </exclusions> - </dependency> <!-- 娴嬭瘯 --> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/pom.xml b/pipIrr-platform/pipIrr-web/pipIrr-web-base/pom.xml index 02bf348..77f0653 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/pom.xml +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/pom.xml @@ -15,4 +15,124 @@ <name>pipIrr-web-base</name> <description>web鍩虹淇℃伅绯荤粺</description> + + <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.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> + + <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> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockSv.java index 3cae9c1..6e09240 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/block/BlockSv.java @@ -3,7 +3,6 @@ import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoBa.BaBlockMapper; import com.dy.pipIrrGlobal.pojoBa.BaBlock; -import com.dy.pipIrrGlobal.pojoBa.BaClientType; import lombok.extern.slf4j.Slf4j; import org.apache.dubbo.common.utils.PojoUtils; import org.springframework.beans.factory.annotation.Autowired; diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictVo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictVo.java index 1f712ff..f6c38f7 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictVo.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/district/DistrictVo.java @@ -23,9 +23,9 @@ @Length(message = "琛屾斂鍖哄悕绉板皬浜巤max}瀛�", min = 1, max = 25) public String name ; - @Schema(description = "琛屾斂鍖虹紪鍙�", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "琛屾斂鍖虹紪鍙�(鐪佸競鍘�2浣嶏紝闀囨潙3浣�)", requiredMode = Schema.RequiredMode.REQUIRED) @NotEmpty(message = "琛屾斂鍖虹紪鍙蜂笉鑳戒负绌�") //涓嶈兘涓虹┖涔熶笉鑳戒负null - @Length(message = "琛屾斂鍖虹紪鍙锋槸涓�浣嶆垨涓や綅鏁�", min = 1, max = 2) + @Length(message = "琛屾斂鍖虹紪鍙锋槸涓�浣嶆垨涓や綅鏁�", min = 2, max = 3) public String num ; @Schema(description = "琛屾斂鍖虹骇鍒�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java index aa77c42..d61e5f6 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java @@ -83,6 +83,27 @@ //璁剧疆鏁版嵁婧� DataSourceContext.set(orgTag); if(!this.existDistricts()){ + if(configXml.existElement(doc, "config.orgs.org" + num + ".districts.province")){ + String distriName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province","name", null, false, null) ; + String distriNum = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province","num", null, false, null) ; + Integer distriLevel = configXml.getSetAttrPlusInt(doc, "config.orgs.org" + num + ".districts.province","level", null, 0, 99,null) ; + Long supperId = this.saveDistrict(null, distriName, distriNum, distriLevel); + if(supperId != null && configXml.existElement(doc, "config.orgs.org" + num + ".districts.province.city")){ + if(configXml.existElement(doc, "config.orgs.org" + num + ".districts.province.city")){ + distriName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province.city","name", null, false, null) ; + distriNum = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province.city","num", null, false, null) ; + distriLevel = configXml.getSetAttrPlusInt(doc, "config.orgs.org" + num + ".districts.province.city","level", null, 1, 99,null) ; + supperId = this.saveDistrict(supperId, distriName, distriNum, distriLevel); + if(supperId != null && configXml.existElement(doc, "config.orgs.org" + num + ".districts.province.city.country")){ + distriName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province.city.country","name", null, false, null) ; + distriNum = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.province.city.country","num", null, false, null) ; + distriLevel = configXml.getSetAttrPlusInt(doc, "config.orgs.org" + num + ".districts.province.city.country","level", null, 1, 99,null) ; + this.saveDistrict(supperId, distriName, distriNum, distriLevel); + } + } + } + } + /* 2023-11-23 涓嬮潰鏄渶鍒濆疄鐜帮紝鍚庢弧瓒矷C鍗′腑瀛樺湪鐪佺殑瑕佹眰锛屽鍔犵渷绾ц鏀垮尯鍒� if(configXml.existElement(doc, "config.orgs.org" + num + ".districts.city")){ String distriName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.city","name", null, false, null) ; String distriNum = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".districts.city","num", null, false, null) ; @@ -95,6 +116,7 @@ this.saveDistrict(supperId, distriName, distriNum, distriLevel); } } + */ } if(!this.existUsers()){ if(configXml.existElement(doc, "config.orgs.org" + num + ".user")){ diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-demo/pom.xml b/pipIrr-platform/pipIrr-web/pipIrr-web-demo/pom.xml index ae0ed8e..84d7f0d 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-demo/pom.xml +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-demo/pom.xml @@ -15,5 +15,123 @@ <name>pipIrr-web-demo</name> <description>web寮�鍙戞紨绀虹郴缁燂紝婕旂ず绀轰緥</description> + <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.pipIrrDemo.PipIrrDemoApplication</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> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-demo/src/main/resources/application.yml b/pipIrr-platform/pipIrr-web/pipIrr-web-demo/src/main/resources/application.yml index c03d2cc..78ca9b8 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-demo/src/main/resources/application.yml +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-demo/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: profiles: - include: global, database + include: global, database, database-ym, database-pj #actutor鐨剋eb绔彛 management: diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-gis/pom.xml b/pipIrr-platform/pipIrr-web/pipIrr-web-gis/pom.xml index 10d9c51..2abaa94 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-gis/pom.xml +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-gis/pom.xml @@ -15,5 +15,123 @@ <name>pipIrr-web-gis</name> <description>web鐢靛瓙鍦板浘绯荤粺</description> + <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.pipIrrGis.PipIrrGisApplication</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> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-gis/src/main/resources/application.yml b/pipIrr-platform/pipIrr-web/pipIrr-web-gis/src/main/resources/application.yml index e777640..9945c2b 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-gis/src/main/resources/application.yml +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-gis/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: profiles: - include: global, database + include: global, database, database-ym, database-pj #actutor鐨剋eb绔彛 management: diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/pom.xml b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/pom.xml index d98b6bf..1363c26 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/pom.xml +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/pom.xml @@ -15,4 +15,123 @@ <name>pipIrr-web-remote</name> <description>web杩滅▼鎿嶄綔淇℃伅绯荤粺</description> + <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.pipIrrRemote.PipIrrRemoteApplication</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> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/resources/application.yml b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/resources/application.yml index aca21d0..9627a3d 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/resources/application.yml +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: profiles: - include: global, database + include: global, database, database-ym, database-pj #actutor鐨剋eb绔彛 management: diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sso/pom.xml b/pipIrr-platform/pipIrr-web/pipIrr-web-sso/pom.xml index a9e19dc..50c030a 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sso/pom.xml +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sso/pom.xml @@ -36,4 +36,124 @@ <!-- 鑷姩鍒ゆ柇浣跨敤涓巗pring boot鍏煎鐨勭増鏈� --> </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.sso.PipIrrSsoApplication</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> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/resources/application.yml b/pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/resources/application.yml index b5ef085..6281a58 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/resources/application.yml +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: profiles: - include: global, database + include: global, database, database-ym, database-pj #actutor鐨剋eb绔彛 management: diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/pom.xml b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/pom.xml index 8cda3d4..b7dd239 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/pom.xml +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/pom.xml @@ -15,4 +15,123 @@ <name>pipIrr-web-statistics</name> <description>web缁熻鍒嗘瀽绯荤粺</description> + <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.pipIrrStatistics.PipIrrStatisticsApplication</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-web/pipIrr-web-statistics/src/main/resources/application.yml b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/resources/application.yml index 0031756..228c7c2 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/resources/application.yml +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/resources/application.yml @@ -1,6 +1,6 @@ spring: profiles: - include: global, database + include: global, database, database-ym, database-pj #actutor鐨剋eb绔彛 management: diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web.iml b/pipIrr-platform/pipIrr-web/pipIrr-web.iml index b162fa6..f075f0e 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web.iml +++ b/pipIrr-platform/pipIrr-web/pipIrr-web.iml @@ -23,6 +23,10 @@ <orderEntry type="jdk" jdkName="20" jdkType="JavaSDK" /> <orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="module" module-name="pipIrr-common" /> + <orderEntry type="module" module-name="pipIrr-common" /> + <orderEntry type="library" name="Maven: org.apache.mina:mina-core:2.2.2" level="project" /> + <orderEntry type="library" name="Maven: org.quartz-scheduler:quartz:2.3.2" level="project" /> + <orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.15" level="project" /> <orderEntry type="module" module-name="pipIrr-global" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:3.1.3" level="project" /> <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:3.1.3" level="project" /> diff --git a/pipIrr-platform/pipIrr-web/pom.xml b/pipIrr-platform/pipIrr-web/pom.xml index 568c48c..abbd0c9 100644 --- a/pipIrr-platform/pipIrr-web/pom.xml +++ b/pipIrr-platform/pipIrr-web/pom.xml @@ -210,58 +210,6 @@ <artifactId>junit</artifactId> <scope>test</scope> </dependency> - - <!-- <!– 鍏ㄥ眬鎺掗櫎–>--> - <!-- <dependency>--> - <!-- <groupId>org.springframework.boot</groupId>--> - <!-- <artifactId>spring-boot-starter-json</artifactId>--> - <!-- <exclusions>--> - <!-- <exclusion>--> - <!-- <groupId>*</groupId>--> - <!-- <artifactId>*</artifactId>--> - <!-- </exclusion>--> - <!-- </exclusions>--> - <!-- </dependency>--> - <!-- <dependency>--> - <!-- <groupId>org.springframework.boot</groupId>--> - <!-- <artifactId>spring-boot-starter-logging</artifactId>--> - <!-- <exclusions>--> - <!-- <exclusion>--> - <!-- <groupId>*</groupId>--> - <!-- <artifactId>*</artifactId>--> - <!-- </exclusion>--> - <!-- </exclusions>--> - <!-- </dependency>--> </dependencies> - <build> - <plugins> - <plugin> - <!-- spring boot鎻愪緵鐨刴aven鎵撳寘鎻掍欢 --> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <configuration> - <excludes> - <exclude> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - </exclude> - </excludes> - </configuration> - </plugin> - <plugin> - <!-- maven閲屾墽琛屾祴璇曠敤渚嬬殑鎻掍欢 --> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <skipTests>true</skipTests> - </configuration> - </plugin> - <plugin> - <!-- 寮哄埗璁惧畾 java缂栬瘧鐗堟湰锛岃繍琛岀幆澧冪増鏈� --> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - </plugin> - </plugins> - </build> </project> \ No newline at end of file diff --git a/pipIrr-platform/pom.xml b/pipIrr-platform/pom.xml index 9479a41..1732cbc 100644 --- a/pipIrr-platform/pom.xml +++ b/pipIrr-platform/pom.xml @@ -44,8 +44,15 @@ <mapstruct.version>1.5.5.Final</mapstruct.version> <hutool-all.version>5.8.22</hutool-all.version> <org-jdom2.version>2.0.6.1</org-jdom2.version> - <compiler-plugin.version>3.11.0</compiler-plugin.version> - <surefire-plugin.version>3.0.0</surefire-plugin.version> + + <spring-boot-maven-plugin.version>3.2.0</spring-boot-maven-plugin.version> + <maven-jar-plugin-plugin.version>3.3.0</maven-jar-plugin-plugin.version> + <maven-dependency-plugin.version>3.5.0</maven-dependency-plugin.version> + <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version> + <maven-resources-plugin.version>3.3.1</maven-resources-plugin.version> + <maven-surefire-plugin.version>3.0.0</maven-surefire-plugin.version> + <maven-bundle-plugin.version>5.1.9</maven-bundle-plugin.version> + <encoding>UTF-8</encoding> </properties> @@ -243,14 +250,7 @@ <dependency> <groupId>org.apache.mina</groupId> <artifactId>mina-core</artifactId> - <version>2.2.1</version> - <type>pom</type> - <scope>import</scope> - </dependency> - <dependency> - <groupId>org.apache.mina</groupId> - <artifactId>mina-filter-compression</artifactId> - <version>2.2.1</version> + <version>2.2.2</version> <type>pom</type> <scope>import</scope> </dependency> @@ -297,34 +297,66 @@ <!-- spring boot鎻愪緵鐨刴aven鎵撳寘鎻掍欢 --> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> - <version>3.1.3</version> + <version>${spring-boot-maven-plugin.version}</version> + </plugin> + <plugin> + <!-- 璇ユ彃浠朵笉浼氬皢椤圭洰涓紩鍏ョ殑渚濊禆鎵撹繘鏈�缁堢殑 Jar 鏂囦欢 --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>${maven-jar-plugin-plugin.version}</version> + </plugin> + <plugin> + <!-- 褰撻」鐩腑渚濊禆姣旇緝澶氭椂锛屾垜浠彲浠ュ�熷姪 maven-dependency-plugin 鎻掍欢鑷姩甯垜浠笅杞戒緷璧栫殑 Jar 鏂囦欢锛屾帹鑽愬皢璇ユ彃浠剁粦瀹氬埌package鐢熷懡鍛ㄦ湡涓� --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>${maven-dependency-plugin.version}</version> + <executions> + <execution> + <!-- 缁戝畾鐢熷懡鍛ㄦ湡 --> + <phase>package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <!-- 璁剧疆渚濊禆鐨勫瓨鏀捐矾寰� --> + <configuration> + <outputDirectory>${project.build.directory}/lib</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <!-- 璁剧疆java缂栬瘧鐗堟湰锛岃繍琛岀幆澧冪増鏈� --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>${maven-compiler-plugin.version}</version> + <!-- source锛� 婧愪唬鐮佺紪璇戠増鏈紱target锛� 鐩爣骞冲彴缂栬瘧鐗堟湰锛沞ncoding锛� 瀛楃闆嗙紪鐮併�� --> <configuration> - <excludes> - <exclude> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - </exclude> - </excludes> + <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> + <version>${maven-resources-plugin.version}</version> + <configuration> + <encoding>${encoding}</encoding> </configuration> </plugin> <plugin> <!-- maven閲屾墽琛屾祴璇曠敤渚嬬殑鎻掍欢 --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <version>3.0.0</version> - <configuration> - <skipTests>true</skipTests> - </configuration> + <version>${maven-surefire-plugin.version}</version> </plugin> <plugin> - <!-- 寮哄埗璁惧畾 java缂栬瘧鐗堟湰锛岃繍琛岀幆澧冪増鏈� --> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>${compiler-plugin.version}</version> - <configuration> - <source>20</source> - <target>20</target> - </configuration> + <!-- 涓嬮潰瑙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> + <version>${maven-bundle-plugin.version}</version> + <extensions>true</extensions> </plugin> </plugins> </pluginManagement> diff --git "a/pipIrr-platform/\346\226\207\346\241\243/Git\346\223\215\344\275\234.txt" "b/pipIrr-platform/\346\226\207\346\241\243/Git\346\223\215\344\275\234.txt" new file mode 100644 index 0000000..9294710 --- /dev/null +++ "b/pipIrr-platform/\346\226\207\346\241\243/Git\346\223\215\344\275\234.txt" @@ -0,0 +1,2 @@ +push涔嬪墠鍏坧ull +pull鍓嶈鍏坈ommit \ No newline at end of file diff --git "a/pipIrr-platform/\346\226\207\346\241\243/Maven \346\211\223\345\214\205\346\217\222\344\273\266 maven-jar-plugin.docx" "b/pipIrr-platform/\346\226\207\346\241\243/Maven \346\211\223\345\214\205\346\217\222\344\273\266 maven-jar-plugin.docx" new file mode 100644 index 0000000..ea62d10 --- /dev/null +++ "b/pipIrr-platform/\346\226\207\346\241\243/Maven \346\211\223\345\214\205\346\217\222\344\273\266 maven-jar-plugin.docx" Binary files differ diff --git "a/pipIrr-platform/\346\226\207\346\241\243/Maven\346\211\223\345\214\205.docx" "b/pipIrr-platform/\346\226\207\346\241\243/Maven\346\211\223\345\214\205.docx" new file mode 100644 index 0000000..4b1a0a9 --- /dev/null +++ "b/pipIrr-platform/\346\226\207\346\241\243/Maven\346\211\223\345\214\205.docx" Binary files differ diff --git "a/pipIrr-platform/\346\226\207\346\241\243/Maven\347\232\204maven-compiler-plugin\346\217\222\344\273\266.docx" "b/pipIrr-platform/\346\226\207\346\241\243/Maven\347\232\204maven-compiler-plugin\346\217\222\344\273\266.docx" new file mode 100644 index 0000000..88a43ce --- /dev/null +++ "b/pipIrr-platform/\346\226\207\346\241\243/Maven\347\232\204maven-compiler-plugin\346\217\222\344\273\266.docx" Binary files differ diff --git "a/pipIrr-platform/\346\226\207\346\241\243/\345\234\250\347\272\277\351\234\200\346\261\202\346\226\207\344\273\266\350\256\277\351\227\256\345\234\260\345\235\200.txt" "b/pipIrr-platform/\346\226\207\346\241\243/\345\234\250\347\272\277\351\234\200\346\261\202\346\226\207\344\273\266\350\256\277\351\227\256\345\234\260\345\235\200.txt" index 61ce6a3..b709088 100644 --- "a/pipIrr-platform/\346\226\207\346\241\243/\345\234\250\347\272\277\351\234\200\346\261\202\346\226\207\344\273\266\350\256\277\351\227\256\345\234\260\345\235\200.txt" +++ "b/pipIrr-platform/\346\226\207\346\241\243/\345\234\250\347\272\277\351\234\200\346\261\202\346\226\207\344\273\266\350\256\277\351\227\256\345\234\260\345\235\200.txt" @@ -1 +1,2 @@ -https://docs.qq.com/doc/DRHBkeVlCekp1d1RU \ No newline at end of file +https://docs.qq.com/desktop +https://lanhuapp.com/link/#/invite?sid=lX0nqhHU \ No newline at end of file diff --git "a/pipIrr-platform/\346\226\207\346\241\243/\345\242\236\345\212\240\344\270\200\344\270\252\345\272\224\347\224\250\346\234\272\346\236\204.docx" "b/pipIrr-platform/\346\226\207\346\241\243/\345\242\236\345\212\240\344\270\200\344\270\252\345\272\224\347\224\250\346\234\272\346\236\204.docx" index 7b69488..aaf2d3c 100644 --- "a/pipIrr-platform/\346\226\207\346\241\243/\345\242\236\345\212\240\344\270\200\344\270\252\345\272\224\347\224\250\346\234\272\346\236\204.docx" +++ "b/pipIrr-platform/\346\226\207\346\241\243/\345\242\236\345\212\240\344\270\200\344\270\252\345\272\224\347\224\250\346\234\272\346\236\204.docx" Binary files differ diff --git "a/pipIrr-platform/\346\226\207\346\241\243/\347\274\226\347\240\201\350\256\276\350\256\241.docx" "b/pipIrr-platform/\346\226\207\346\241\243/\347\274\226\347\240\201\350\256\276\350\256\241.docx" new file mode 100644 index 0000000..a42ca3a --- /dev/null +++ "b/pipIrr-platform/\346\226\207\346\241\243/\347\274\226\347\240\201\350\256\276\350\256\241.docx" Binary files differ -- Gitblit v1.8.0