From 7ed80ed1085e5350f2a1eea7ebb6a3e76a19043d Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期四, 29 八月 2024 10:47:19 +0800 Subject: [PATCH] 完善代码,删除重复类 --- pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/p206V202404test/CommandP206V202404Ctrl.java | 67 +++++++++++++++++++++++++-------- /dev/null | 18 --------- pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/p206V202404test/ComSupportP206V202404.java | 9 +++- 3 files changed, 56 insertions(+), 38 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/p206V202404test/ComSupportP206V202404.java b/pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/p206V202404test/ComSupportP206V202404.java index 2496adb..d9198ea 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/p206V202404test/ComSupportP206V202404.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/p206V202404test/ComSupportP206V202404.java @@ -19,10 +19,13 @@ * @Description */ public class ComSupportP206V202404 { - protected static String mwUrlTest = "http://127.0.0.1:8070/rtuMw/com/test" ; - protected static String mwUrlSendCom = "http://127.0.0.1:8070/rtuMw/com/send" ; + protected static final String mwIp = "romq9311819.vicp.fun" ; //http://romq9311819.vicp.fun:16583 + protected static final String mwPort = "16583" ; - protected static String rtuAddr = "37142501020100215" ; + protected static String mwUrlTest = "http://" + mwIp + ":" + mwPort + "/rtuMw/com/test" ; + protected static String mwUrlSendCom = "http://" + mwIp + ":" + mwPort + "/rtuMw/com/send" ; + + protected static String rtuAddr = "41162810400100001" ; protected static String rtuResultSendWebUrl = "http://127.0.0.1:65535/test/comRes/receive" ; protected static String controllerType = "57" ;//鎺у埗鍣ㄧ被鍨� diff --git a/pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/p206V202404test/CommandP206V202404Ctrl.java b/pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/p206V202404test/CommandP206V202404Ctrl.java index a7e9eb7..1a4430f 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/p206V202404test/CommandP206V202404Ctrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/p206V202404test/CommandP206V202404Ctrl.java @@ -18,23 +18,56 @@ public class CommandP206V202404Ctrl extends ComSupportP206V202404 { @GetMapping(path = "test") - public BaseResponse<String> test() { - //return this.connect() ;//杩炴帴閫氫俊涓棿浠舵祴璇� - //return this.cdXY(CodeV202404.cd_9C) ;//鍙戦�佸浐瀹氬弬鏁癤Y鐨勫懡浠� - //return this.cd55(1) ; - //return this.cd15() ; - //return this.cd16() ; - //return this.cd21() ; - //return this.cd22() ; - //return this.cd23() ; - //return this.cd24() ; - //return this.cd26() ; - //return this.cd31() ; - //return this.cd86() ; - //return this.cd87() ; - return this.cd92() ; - //return this.cd93() ; - //return this.cd9C() ; + public BaseResponse<String> test(String com) { + BaseResponse<String> rt = null ; + if(com == null){ + rt = this.connect() ;//杩炴帴閫氫俊涓棿浠舵祴璇� + }else{ + try{ + if(com.equals("10")){ + rt = this.cd10() ; + }else if(com.equals("15")){ + rt = this.cd15() ; + }else if(com.equals("16")){ + rt = this.cd16() ; + }else if(com.equals("21")){ + rt = this.cd21() ; + }else if(com.equals("22")){ + rt = this.cd22() ; + }else if(com.equals("23")){ + rt = this.cd23() ; + }else if(com.equals("24")){ + rt = this.cd24() ; + }else if(com.equals("26")){ + rt = this.cd26() ; + }else if(com.equals("31")){ + rt = this.cd31() ; + }else if(com.equals("55")){ + rt = this.cd55(1) ; + }else if(com.equals("65")){ + rt = this.cd65(1) ; + }else if(com.equals("86")){ + rt = this.cd86() ; + }else if(com.equals("87")){ + rt = this.cd87() ; + }else if(com.equals("92")){ + rt = this.cd92() ; + }else if(com.equals("93")){ + rt = this.cd93() ; + }else if(com.equals("9C")){ + rt = this.cd9C() ; + }else if(com.equals("A2")){ + rt = this.cdA2() ; + }else if(com.equals("A3")){ + rt = this.cdA3() ; + }else{ + rt = this.cdXY(com) ;//鍙戦�佸浐瀹氬弬鏁癤Y鐨勫懡浠�, 渚嬪懡浠odeV202404.cd_9C + } + }catch (Exception e){ + e.printStackTrace(); + } + } + return rt ; } /** diff --git a/pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/rtuLog/ByteArrayHttpMessageConverter.java b/pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/rtuLog/ByteArrayHttpMessageConverter.java deleted file mode 100644 index 5e6256e..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/rtuLog/ByteArrayHttpMessageConverter.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.dy.pipIrrMwTestWeb.rtuLog; - -import org.springframework.http.HttpInputMessage; -import org.springframework.http.HttpOutputMessage; -import org.springframework.http.MediaType; -import org.springframework.http.converter.AbstractHttpMessageConverter; -import org.springframework.http.converter.HttpMessageNotReadableException; -import org.springframework.http.converter.HttpMessageNotWritableException; - -import java.io.IOException; -import java.nio.charset.StandardCharsets; - -/** - * @Author: liurunyu - * @Date: 2024/8/28 15:58 - * @Description - */ -public class ByteArrayHttpMessageConverter extends AbstractHttpMessageConverter<byte[]> { - - public ByteArrayHttpMessageConverter() { - super(MediaType.APPLICATION_OCTET_STREAM, new MediaType("application", "octet-stream", StandardCharsets.UTF_8)); - } - - @Override - protected boolean supports(Class<?> clazz) { - return byte[].class == clazz; - } - - @Override - protected byte[] readInternal(Class<? extends byte[]> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { - // Read the byte array from the input message - return org.springframework.util.StreamUtils.copyToByteArray(inputMessage.getBody()); - } - - @Override - protected void writeInternal(byte[] bytes, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException { - // Write the byte array to the output message - outputMessage.getBody().write(bytes); - } -} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/rtuLog/ByteArrayHttpMessageConverterConfig.java b/pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/rtuLog/ByteArrayHttpMessageConverterConfig.java deleted file mode 100644 index 05fc64c..0000000 --- a/pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/rtuLog/ByteArrayHttpMessageConverterConfig.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.dy.pipIrrMwTestWeb.rtuLog; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.converter.HttpMessageConverter; - -/** - * @Author: liurunyu - * @Date: 2024/8/28 16:02 - * @Description - */ -@Configuration -public class ByteArrayHttpMessageConverterConfig { - @Bean - public HttpMessageConverter<byte[]> logFileByteArrayHttpMessageConverter() { - return new ByteArrayHttpMessageConverter(); - } -} -- Gitblit v1.8.0