From 69fbaaa1a5fd16b05953e750ea7fcc3e18e3a27c Mon Sep 17 00:00:00 2001
From: yantian yue <306727702@qq.com>
Date: 星期三, 18 十月 2023 16:12:32 +0800
Subject: [PATCH] OPCUA更新

---
 guns-vip-main/src/main/java/cn/stylefeng/guns/opcua/client/ClientHandler.java |   31 ++++++++++++++++++++++++-------
 1 files changed, 24 insertions(+), 7 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 008716b..44743ac 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
@@ -1,8 +1,19 @@
 package cn.stylefeng.guns.opcua.client;
 
+import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory;
+import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
+import cn.stylefeng.guns.opcua.controller.OpcuaConfController;
+import cn.stylefeng.guns.opcua.entity.OpcuaConf;
+import cn.stylefeng.guns.opcua.mapper.OpcuaConfMapper;
+import cn.stylefeng.guns.opcua.model.params.OpcuaConfParam;
+import cn.stylefeng.guns.opcua.model.result.OpcuaConfResult;
+import cn.stylefeng.guns.opcua.service.OpcuaConfService;
+import cn.stylefeng.roses.kernel.model.response.ResponseData;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.google.common.collect.ImmutableList;
 import cn.stylefeng.guns.opcua.entity.NodeEntity;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.poi.ss.formula.functions.T;
 import org.eclipse.milo.opcua.sdk.client.OpcUaClient;
 import org.eclipse.milo.opcua.sdk.client.api.nodes.VariableNode;
 import org.eclipse.milo.opcua.sdk.client.api.subscriptions.UaSubscription;
@@ -42,6 +53,10 @@
 
 	@Autowired
 	private ClientRunner clientRunner;
+
+	@Autowired
+	private OpcuaConfController opcuaConfController;
+
 
 	/**
 	 * 
@@ -147,21 +162,23 @@
 	 */
 
 	public void handle(NodeId id, Variant value){
-		String className = "cn.stylefeng.guns.opcua.cert.MethodName";
-		String methodName = "a";
+		long startTime = System.currentTimeMillis();
+
+		OpcuaConfParam opcuaConfParam=new OpcuaConfParam();
+		opcuaConfParam.setNode(id.getIdentifier().toString());
+		List<OpcuaConfResult> a=opcuaConfController.mylist(opcuaConfParam);
+
 		String str1 = id.getIdentifier().toString()+":"+value.getValue().toString();
 		try {
-			Class<?> clazz = Class.forName(className);
-			Method method = clazz.getMethod(methodName, String.class);
+			Class<?> clazz = Class.forName(a.get(0).getRModule());
+			Method method = clazz.getMethod(a.get(0).getRFunction(), String.class);
 
 			method.invoke(clazz.newInstance(), str1);
 		} catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InstantiationException |
 				 InvocationTargetException e) {
 			e.printStackTrace();
 		}
-		//if(id.getIdentifier().toString().equals("my.device.x1")){
-		//	log.info("item={}, value={},{}", id.getIdentifier().toString(), value,"杩斿洖涓�涓猄N鍙�");
-		//}
+		log.info("浠g爜鎵ц鏃堕棿锛�" + (System.currentTimeMillis() - startTime) + "姣");
 	}
 
 	/**

--
Gitblit v1.9.3