From affbb7b8e8189127121d15dcc94b53639656d332 Mon Sep 17 00:00:00 2001 From: yantian yue <306727702@qq.com> Date: 星期三, 25 十月 2023 14:31:34 +0800 Subject: [PATCH] OPCUA更新 --- guns-vip-main/src/main/java/cn/stylefeng/guns/opcua/cert/MethodName.java | 21 +++++++++++++++------ guns-vip-main/src/main/java/cn/stylefeng/guns/opcua/client/ClientHandler.java | 7 ++++--- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/opcua/cert/MethodName.java b/guns-vip-main/src/main/java/cn/stylefeng/guns/opcua/cert/MethodName.java index ed6c92e..2c5d0ff 100644 --- a/guns-vip-main/src/main/java/cn/stylefeng/guns/opcua/cert/MethodName.java +++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/opcua/cert/MethodName.java @@ -5,11 +5,11 @@ import lombok.extern.slf4j.Slf4j; @Slf4j -public class MethodName { - public void a(String name){ - log.info("str={},鍝嶅簲鏂规硶:{}", name,"A"); +public class MethodName {/* + public void a(String Nodee){ + log.info("str={},鍝嶅簲鏂规硶:{}", Nodee,Nodee); } - public void b(String name){ + public void c(String Nodee){ try { NodeEntity node = NodeEntity.builder().index(2).identifier("my.device.x2") .value("99").type("int").build(); @@ -20,7 +20,16 @@ e.printStackTrace(); } } - public void c(String name){ - log.info("str={},鍝嶅簲鏂规硶:{}", name,"C"); + public void b(String Nodee){ + log.info("str={},鍝嶅簲鏂规硶:{}", Nodee,Nodee); + }*/ + public void a(String param1, String param2) { + log.info("str={},鍝嶅簲鏂规硶:{}", param1,param2); + } + public void b(String param1, String param2) { + log.info("str={},鍝嶅簲鏂规硶:{}", param1,param2); + } + public void c(String param1, String param2) { + log.info("str={},鍝嶅簲鏂规硶:{}", param1,param2); } } diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/opcua/client/ClientHandler.java b/guns-vip-main/src/main/java/cn/stylefeng/guns/opcua/client/ClientHandler.java index 5877f51..7878868 100644 --- a/guns-vip-main/src/main/java/cn/stylefeng/guns/opcua/client/ClientHandler.java +++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/opcua/client/ClientHandler.java @@ -184,7 +184,6 @@ opcuaConfParam.setSubscribe(1); b=opcuaConfController.mylist(opcuaConfParam); } - String str1 = id.getIdentifier().toString()+":"+value.getValue().toString(); //浣跨敤Stream API鍦↙ist<T>涓煡鎵惧厓绱� OpcuaConfResult opcuaConfResult = b.stream() .filter(customer ->id.getIdentifier().toString().equals(customer.getNode())) @@ -192,8 +191,10 @@ .orElse(null); try { Class<?> clazz = Class.forName(opcuaConfResult.getRModule()); - Method method = clazz.getMethod(opcuaConfResult.getRFunction(), String.class); - method.invoke(clazz.newInstance(), str1); + Method method = clazz.getMethod(opcuaConfResult.getRFunction(), new Class[] { String.class, + String.class }); + method.invoke(clazz.newInstance(),new Object[] { + new String(id.getIdentifier().toString()), new String(value.getValue().toString()) }); } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { e.printStackTrace(); -- Gitblit v1.9.3