pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/p206V202404test/ComSupportP206V202404.java
@@ -19,8 +19,10 @@ * @Description */ public class ComSupportP206V202404 { protected static final String mwIp = "romq9311819.vicp.fun" ; //http://romq9311819.vicp.fun:16583 protected static final String mwPort = "16583" ; //protected static final String mwIp = "romq9311819.vicp.fun" ; //http://romq9311819.vicp.fun:16583 //protected static final String mwPort = "16583" ; protected static final String mwIp = "127.0.0.1" ; protected static final String mwPort = "8071" ; protected static String mwUrlTest = "http://" + mwIp + ":" + mwPort + "/rtuMw/com/test" ; protected static String mwUrlSendCom = "http://" + mwIp + ":" + mwPort + "/rtuMw/com/send" ; pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/java/com/dy/pipIrrMwTestWeb/p206V202404test/CommandP206V202404Ctrl.java
@@ -18,53 +18,58 @@ public class CommandP206V202404Ctrl extends ComSupportP206V202404 { @GetMapping(path = "test") public BaseResponse<String> test(String com) { public BaseResponse<String> test(String rtuAddr, String com) { BaseResponse<String> rt = null ; if(com == null){ if(rtuAddr == null || rtuAddr.trim().equals("")){ 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) ;//发送固定参数XY的命令, 例命令CodeV202404.cd_9C this.rtuAddr = rtuAddr ; if(com == null || com.trim().equals("")){ 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) ;//发送固定参数XY的命令, 例命令CodeV202404.cd_9C } }catch (Exception e){ e.printStackTrace(); } }catch (Exception e){ e.printStackTrace(); } } return rt ; pipIrr-platform/pipIrr-web/pipIrr-mwTest-web/src/main/resources/log4j2.yml
New file @@ -0,0 +1,73 @@ Configuration: #status,这个用于设置log4j2自身内部的信息输出,可以不设置,当设置成trace时,你会看到log4j2内部各种详细输出;可以设置成Off(关闭)或Error(只输出错误信息) status: Error Properties: # 定义全局变量 Property: #日志文件存储的目录 - name: log.path value: ./logs #日志文件存储名称 - name: project.name value: mwTestWeb #定义输出器,可以输出到控制台和文件. Appenders: #输出到控制台 Console: #Appender命名 name: CONSOLE target: SYSTEM_OUT ThresholdFilter: level: debug #输出日志级别,输出日志时,首先由Loggers.Root.level或Loggers.Logger.level判断是否输出,然后再由本level判断是否输出 onMatch: ACCEPT #onMatch=ACCEPT 大于等于 "level" 配置的等级地日志输出 onMismatch: DENY #onMismatch=DENY 小于 "level" 配置的等级地日志不输出 #日志内容样式 PatternLayout: #%n-换行 #%m-日志内容,输出代码中指定的日志信息 #%p-输出优先级,即DEBUG,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或Loggers.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的子节点,用来指定该日志输出到哪个Appender. - ref: CONSOLE #输出日志时,首先由本level判断是否输出,然后再由上面的Appenders.Console.ThresholdFilter.level判断是否输出 - ref: ROLLING_FILE #输出日志时,首先由本level判断是否输出,然后再由上面的Appenders.RollingFile.ThresholdFilter.level判断是否输出 # 为包配置特殊的Log级别,方便调试, # 不受Loggers.Root.level限制 Logger: - name: com.dy.pipIrrGlobal.daoBa additivity: false #去除重复的log level: debug #输出日志级别 AppenderRef: - ref: CONSOLE #输出日志时,首先由本.level判断是否输出,然后再由上面的Appenders.Console.ThresholdFilter.level判断是否输出 - ref: ROLLING_FILE #输出日志时,首先由本level判断是否输出,然后再由上面的Appenders.RollingFile.ThresholdFilter.level判断是否输出