From c2fccb01b972176dc3da5a497b5e904025e9e98d Mon Sep 17 00:00:00 2001
From: bsw215583320 <baoshiwei121@163.com>
Date: 星期二, 16 四月 2024 15:06:51 +0800
Subject: [PATCH] Merge branch 'master' of http://210.22.126.130:1111/r/dry/herb

---
 jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/listener/InitListener.java |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/listener/InitListener.java b/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/listener/InitListener.java
new file mode 100644
index 0000000..1e24954
--- /dev/null
+++ b/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/listener/InitListener.java
@@ -0,0 +1,42 @@
+package org.jeecg.modules.dry.listener;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.google.common.io.ByteStreams;
+import org.eclipse.milo.opcua.sdk.client.OpcUaClient;
+import org.jeecg.modules.dry.common.CacheConstants;
+import org.jeecg.modules.dry.common.CommonDict;
+import org.jeecg.modules.dry.vo.DryFault;
+import org.springframework.boot.context.event.ApplicationStartedEvent;
+import org.springframework.context.ApplicationListener;
+import org.springframework.stereotype.Component;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+//@Component
+public class InitListener implements ApplicationListener<ApplicationStartedEvent> {
+    @Override
+    public void onApplicationEvent(ApplicationStartedEvent event) {
+//        try {
+//            OpcUaClient client = OPCUA.createClient();
+//            client.connect().get();
+//            OPCUA.managedSubscriptionEvent(client);
+//        } catch (Exception e) {
+//            throw new RuntimeException(e);
+//        }
+        InputStream fault = getClass().getResourceAsStream("/fault.json");
+        try {
+            JSONObject jsonObject = JSONObject.parseObject(fault, JSONObject.class);
+            Map<String, String> map = jsonObject.toJavaObject(Map.class);
+            CommonDict.faultDict = map;
+
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}

--
Gitblit v1.9.3