From abb175b29054b9708af27136c035b1b7351dcd20 Mon Sep 17 00:00:00 2001
From: 懒羊羊 <15939171744@163.com>
Date: 星期二, 14 十一月 2023 13:18:48 +0800
Subject: [PATCH] 优化

---
 guns-vip-main/src/main/java/cn/stylefeng/guns/opcua/client/ClientHandler.java |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

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 b7a43c8..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
@@ -42,7 +42,7 @@
 public class ClientHandler {
 
 	// 瀹㈡埛绔疄渚�
-	private OpcUaClient client = null;
+	public static OpcUaClient client = null;
 
 	public List<OpcuaConfResult> b = null;
 
@@ -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();
@@ -224,6 +225,9 @@
 		case "boolean":
 			value = new Variant(Boolean.parseBoolean(node.getValue().toString()));
 			break;
+		case "long":
+			value = new Variant(Long.parseLong(node.getValue().toString()));
+			break;
 		}
 		DataValue dataValue = new DataValue(value, null, null);
 

--
Gitblit v1.9.3