hfxc226 пре 2 година
родитељ
комит
66918daa2d

+ 1 - 0
platform-common/src/main/java/com/platform/common/constant/RedisKeyConstants.java

@@ -79,6 +79,7 @@ public class RedisKeyConstants {
      */
     public static final String DCS_PREFIX = "redis_opc_";
 
+    public static String redis_ok = "redis_ok";
     public static String redis_opc_update_flag = "redis_opc_update_flag";
     // 待采集点位列表
     public static String redis_opc_wait_add_list = "redis_opc_wait_add_list";

+ 33 - 0
platform-dao/src/main/java/com/platform/dao/vo/export/remote/ExportRemoteOpcLogOneDayVO.java

@@ -0,0 +1,33 @@
+package com.platform.dao.vo.export.remote;
+
+import com.platform.office.annotation.Excel;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * @Description 设备电度记录表导出VO
+ * @Author xc
+ * @Date 2022-09-13 14:14:35
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
+ */
+@Data
+@Accessors(chain = true)
+public class ExportRemoteOpcLogOneDayVO implements Serializable {
+
+    /**
+     * 时间
+     */
+    @Excel(name = "时间", orderNum = "1")
+    private String time;
+
+    /**
+     * 值
+     */
+    @Excel(name = "数值", orderNum = "2")
+    private String value;
+
+}

+ 2 - 2
platform-opc/src/main/java/com/platform/opc/servie/OpcInit.java

@@ -45,7 +45,7 @@ public class OpcInit {
      */
     @PostConstruct
     public void initAddAllItem() {
-        RedisUtils.del(OpcDAClient.redis_ok);
+        RedisUtils.del(RedisKeyConstants.redis_ok);
         log.info("开始初始化分组");
         addGroupAndItems(findAllItems(true, null));
     }
@@ -121,7 +121,7 @@ public class OpcInit {
         AddFailedException exception = OpcDAClient.addGroupList(listMap);
         if (exception != null) {
             // 如果报错要清空这2个,不然获取数据和保存数据不动
-            RedisUtils.setString(OpcDAClient.redis_ok, "0");
+            RedisUtils.setString(RedisKeyConstants.redis_ok, "0");
             RedisUtils.del(RedisKeyConstants.redis_opc_update_flag);
             Map<String, Integer> failedItems = exception.getErrors();
             Map<String, Item> addItems = exception.getItems();

+ 2 - 3
platform-opc/src/main/java/com/platform/opc/util/OpcDAClient.java

@@ -31,7 +31,6 @@ import java.util.stream.Collectors;
 @Slf4j
 public class OpcDAClient {
 
-    public static String redis_ok = "redis_ok";
     public static String host = "192.168.108.108";
     public static String user = "Administrator";
     public static String password = "Hollysys";
@@ -176,11 +175,11 @@ public class OpcDAClient {
                 log.info("组建完成,开始查询数据...,组key:" + group.getName() + ", 组数量:" + itemArrList.get(entry.getKey() + "").size());
             }
         } catch (AddFailedException e) {
-            e.printStackTrace();
+            // e.printStackTrace();
             // 将不存在的点位信息保存到数据库,
             Map<String, Integer> errorsItemMap = e.getErrors();
             // e.printStackTrace();
-            log.error("添加点位出错,有不存在的点位,等待下次启动添加", e);
+            log.error("添加点位出错,有不存在的点位,等待下次启动添加");
             groupList = new ArrayList<>();
             itemArrList = new HashMap<>();
             return e;

+ 2 - 2
platform-opc/src/main/java/org/openscada/opc/lib/da/Group.java

@@ -194,10 +194,10 @@ public class Group {
 
         // if we have failed items then throw an exception with the result
         if (failedItems.size() != 0) {
-            log.error("错误点位数量: " + failedItems.size());
+            /*log.error("错误点位数量: " + failedItems.size());
             for (Map.Entry<String, Integer> entry : failedItems.entrySet()) {
                 log.error("key: " + entry.getKey() + ", value: " + entry.getValue());
-            }
+            }*/
             throw new AddFailedException(failedItems, findItems(foundItems));
         }