From cc6270c5f434f93bf51f4c454e3de512be70b584 Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期三, 02 四月 2025 13:10:33 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/MeasureHandle.java |   65 +++++++++++++++++++++++++++-----
 1 files changed, 55 insertions(+), 10 deletions(-)

diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/MeasureHandle.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/MeasureHandle.java
index fd55e6d..9fbd7ee 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/MeasureHandle.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/collection/handler/MeasureHandle.java
@@ -1,6 +1,10 @@
 package com.iailab.module.data.point.collection.handler;
 
+import com.iailab.framework.common.util.string.StrUtils;
 import com.iailab.module.data.channel.http.collector.SourceApiEnum;
+import com.iailab.module.data.channel.http.collector.asdb.HttpCollectorForAsdb;
+import com.iailab.module.data.channel.http.collector.asdb.HttpCollectorForAsdc;
+import com.iailab.module.data.channel.http.collector.asdb.HttpCollectorForAsde;
 import com.iailab.module.data.channel.http.collector.ihdb.HttpCollectorForIhd;
 import com.iailab.module.data.channel.opcda.collector.OpcDACollector;
 import com.iailab.module.data.common.enums.CommonConstant;
@@ -10,6 +14,7 @@
 import com.iailab.module.data.channel.kio.collector.KingIOCollector;
 import com.iailab.module.data.channel.modbus.collector.ModBusCollector;
 import com.iailab.module.data.channel.opcua.collector.OpcUaCollector;
+import com.iailab.module.data.enums.DataPointFreqEnum;
 import com.iailab.module.data.point.collection.PointCollector;
 import com.iailab.module.data.point.collection.utils.GenInfluxPointValueUtils;
 import com.iailab.module.data.point.common.PointDataTypeEnum;
@@ -39,10 +44,6 @@
 @Component
 public class MeasureHandle {
 
-    private BigDecimal maxValue = new BigDecimal("1000000000");
-
-    private BigDecimal minValue = new BigDecimal("0");
-
     @Resource
     private ModBusCollector modBusCollector;
 
@@ -57,6 +58,15 @@
 
     @Autowired
     private HttpCollectorForIhd httpCollectorForIhd;
+
+    @Autowired
+    private HttpCollectorForAsdb httpCollectorForAsdb;
+
+    @Autowired
+    private HttpCollectorForAsde httpCollectorForAsde;
+
+    @Autowired
+    private HttpCollectorForAsdc httpCollectorForAsdc;
 
     @Resource
     private DaPointService daPointService;
@@ -76,7 +86,9 @@
         List<String[]> modbusTagIds = new ArrayList<>();
         List<String[]> kioTagIds = new ArrayList<>();
         List<Object[]> httpTagIhd = new ArrayList<>();
-
+        List<Object[]> httpTagAsdb = new ArrayList<>();
+        List<Object[]> httpTagAsde = new ArrayList<>();
+        List<Object[]> httpTagAsdc = new ArrayList<>();
 
         dtos.stream().forEach(item -> {
             if (DataSourceType.OPCUA.getCode().equals(item.getSourceType())) {
@@ -91,6 +103,18 @@
                 if (SourceApiEnum.iHyperDB.getCode().equals(item.getSourceName())) {
                     if (item.getTagNo() != null && item.getDimension() != null && item.getValueType() != null) {
                         httpTagIhd.add(new Object[]{item.getSourceId(), item.getTagNo(), item.getDimension(), item.getValueType()});
+                    }
+                } else if (SourceApiEnum.ASDB.getCode().equals(item.getSourceName())) {
+                    if (item.getTagNo() != null && item.getDimension() != null && item.getValueType() != null) {
+                        httpTagAsdb.add(new Object[]{item.getSourceId(), item.getTagNo(), item.getDimension(), item.getValueType()});
+                    }
+                } else if (SourceApiEnum.ASDE.getCode().equals(item.getSourceName())) {
+                    if (item.getTagNo() != null && item.getDimension() != null && item.getValueType() != null) {
+                        httpTagAsde.add(new Object[]{item.getSourceId(), item.getTagNo(), item.getDimension(), item.getValueType()});
+                    }
+                } else if (SourceApiEnum.ASDC.getCode().equals(item.getSourceName())) {
+                    if (item.getTagNo() != null && item.getDimension() != null && item.getValueType() != null) {
+                        httpTagAsdc.add(new Object[]{item.getSourceId(), item.getTagNo(), item.getDimension(), item.getValueType()});
                     }
                 }
             }
@@ -112,6 +136,15 @@
         if (!CollectionUtils.isEmpty(httpTagIhd)) {
             tagValues.putAll(httpCollectorForIhd.getTagValues(httpTagIhd, collectTime));
         }
+        if (!CollectionUtils.isEmpty(httpTagAsdb)) {
+            tagValues.putAll(httpCollectorForAsdb.getTagValues(httpTagAsdb, collectTime));
+        }
+        if (!CollectionUtils.isEmpty(httpTagAsde)) {
+            tagValues.putAll(httpCollectorForAsde.getTagValues(httpTagAsde, collectTime));
+        }
+        if (!CollectionUtils.isEmpty(httpTagAsdc)) {
+            tagValues.putAll(httpCollectorForAsdc.getTagValues(httpTagAsdc, collectTime));
+        }
         this.toCommonResult(collectTime, dtos, tagValues, dataMap, result,listGood,listBad);
         log.info("测量点处理结束");
         return result;
@@ -126,16 +159,16 @@
                 if (tagValues.containsKey(tagId)) {
                     Object value = handleData(dto, tagValues.get(tagId));
                     InfluxPointValuePOJO pojo = GenInfluxPointValueUtils.getByPoint(dto, value);
-                    pojo.setTimestamp(collectTime.toInstant());
+                    pojo.setTimestamp(GenInfluxPointValueUtils.getByMin(collectTime, DataPointFreqEnum.getEumByCode(dto.getMinfreqid())));
                     dataMap.put(dto.getPointNo(), value);
                     result.add(pojo);
                     listGood.add(dto.getPointNo());
                 } else {
                     InfluxPointValuePOJO pojo = GenInfluxPointValueUtils.getByPoint(dto, CommonConstant.BAD_VALUE);
-                    pojo.setTimestamp(collectTime.toInstant());
+                    pojo.setTimestamp(GenInfluxPointValueUtils.getByMin(collectTime, DataPointFreqEnum.getEumByCode(dto.getMinfreqid())));
                     result.add(pojo);
                     listBad.add(dto.getPointNo());
-                    System.out.println("值异常!TagId=" + tagId);
+                    log.info("值异常!TagId=" + tagId);
                 }
             });
         }
@@ -182,9 +215,13 @@
         pointMeasureList.forEach(
                 item -> {
                     try {
-                        boolean hasKey = redisTemplate.hasKey(PointCollector.PV + item.getPointNo());
                         Object value = CommonConstant.BAD_VALUE;
+                        boolean hasKey = redisTemplate.hasKey(PointCollector.PV + item.getPointNo());
                         if (hasKey) {
+                            value = redisTemplate.opsForValue().get(PointCollector.PV + item.getPointNo());
+                        }
+                        if(hasKey && StrUtils.isNumeric(value.toString()) &&
+                                new BigDecimal(value.toString()).compareTo(CommonConstant.BAD_VALUE) != 0 ) {
                             value = redisTemplate.opsForValue().get(PointCollector.PV + item.getPointNo());
                         } else if (DataSourceType.OPCUA.getCode().equals(item.getSourceType())) {
                             value = opcUaCollector.getTagValue(item.getSourceId(), item.getTagNo());
@@ -193,7 +230,15 @@
                         } else if (DataSourceType.KIO.getCode().equals(item.getSourceType())) {
                             value = kingIOCollector.getTagValue(item.getSourceId(), item.getTagNo());
                         } else if (DataSourceType.HTTP.getCode().equals(item.getSourceType())) {
-                            value = httpCollectorForIhd.getTagValue(item.getSourceId(), item.getTagNo(), item.getDimension(), item.getValueType());
+                            if (SourceApiEnum.iHyperDB.getCode().equals(item.getSourceName())) {
+                                value = httpCollectorForIhd.getTagValue(item.getSourceId(), item.getTagNo(), item.getDimension(), item.getValueType());
+                            } else if (SourceApiEnum.ASDB.getCode().equals(item.getSourceName())) {
+                                value = httpCollectorForAsdb.getTagValue(item.getSourceId(), item.getTagNo());
+                            } else if (SourceApiEnum.ASDE.getCode().equals(item.getSourceName())) {
+                                value = httpCollectorForAsde.getTagValue(item.getSourceId(), item.getTagNo());
+                            } else if (SourceApiEnum.ASDC.getCode().equals(item.getSourceName())) {
+                                value = httpCollectorForAsdc.getTagValue(item.getSourceId(), item.getTagNo());
+                            }
                         } else {
                             log.info("没有匹配的TagNo=" + item.getTagNo());
                         }

--
Gitblit v1.9.3