From e8ad669f7c97d45cd23630dc101180a130d6c17e Mon Sep 17 00:00:00 2001
From: dongyukun <1208714201@qq.com>
Date: 星期二, 05 十一月 2024 10:04:57 +0800
Subject: [PATCH] tag当前值开发

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/controller/admin/ChannelOPCUATagController.java   |   25 ++++++
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusTagPageReqVO.java                       |    2 
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpTagService.java                        |    2 
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/ihdb/HttpCollectorForIhd.java            |   32 ++++++++
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/vo/OpcUaTagRespVO.java                            |    4 +
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/controller/admin/ChannelKioTagController.java       |   25 ++++++
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusTagController.java |   20 ++++
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/vo/OpcUaTagPageReqVO.java                         |    2 
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/vo/OpcDaTagRespVO.java                            |    4 +
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpTagServiceImpl.java               |    8 ++
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTagController.java            |   24 +++++
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/job/task/PointCollectTaskNet60.java                             |    2 
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/vo/KioTagRespVO.java                                |    8 +
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTagRespVO.java                              |    4 +
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/vo/KioTagPageReqVO.java                             |    2 
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusTagRespVO.java                          |    4 +
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/controller/admin/ChannelOPCDATagController.java   |   33 ++++++++
 17 files changed, 193 insertions(+), 8 deletions(-)

diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/ihdb/HttpCollectorForIhd.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/ihdb/HttpCollectorForIhd.java
index 8b1ad12..9b0cd5f 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/ihdb/HttpCollectorForIhd.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/ihdb/HttpCollectorForIhd.java
@@ -3,9 +3,12 @@
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.google.gson.Gson;
 import com.iailab.framework.common.constant.CommonConstant;
 import com.iailab.module.data.channel.http.entity.HttpApiEntity;
+import com.iailab.module.data.channel.http.entity.HttpTagEntity;
 import com.iailab.module.data.channel.http.service.HttpApiService;
+import com.iailab.module.data.channel.http.service.HttpTagService;
 import com.iailab.module.data.common.enums.DataSourceType;
 import com.iailab.module.data.common.utils.DateUtils;
 import com.iailab.module.data.common.utils.HttpRequest;
@@ -16,6 +19,7 @@
 import org.springframework.util.CollectionUtils;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.*;
 
 /**
@@ -32,6 +36,9 @@
 
     @Autowired
     private HttpApiService httpApiService;
+
+    @Autowired
+    private HttpTagService httpTagService;
 
     private static final String STA_TRUE = "true";
 
@@ -74,6 +81,31 @@
         return value;
     }
 
+    public Map<String, Object> getLastValues(List<String> tagNames) {
+        Map<String, Object> result = new HashMap<>();
+        Gson gson = new Gson();
+        String tagSb = gson.toJson(tagNames);
+        log.info("body=====" + tagSb);
+        String currentDate = DateUtils.format(new Date(), "yyyyMMddHHmm00");
+        String responseStr = HttpRequest.sendPost("http://172.16.59.105:9082/api/IHD/getPointslast" + "/" + currentDate, tagSb);
+        JSONObject responseObj = JSON.parseObject(responseStr);
+        if (STA_TRUE.equals(responseObj.get("isSuccess").toString())) {
+            JSONArray tagValueList = responseObj.getJSONArray("data");
+            if (!CollectionUtils.isEmpty(tagValueList)) {
+                for (int i = 0; i < tagValueList.size(); i++) {
+                    JSONObject item = tagValueList.getJSONObject(i);
+                    if(item.get("value")!=null){
+                        BigDecimal value = new BigDecimal(item.get("value").toString());
+                        result.put(item.get("tagname").toString(), value.setScale(3, RoundingMode.HALF_UP));
+                    }else{
+                        result.put(item.get("tagname").toString(), CommonConstant.BAD_VALUE);
+                    }
+                }
+            }
+        }
+        return result;
+    }
+
     public Map<String, Object> getTagValues(List<Object[]> params) {
         if (CollectionUtils.isEmpty(params)) {
             return new HashMap<>();
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTagController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTagController.java
index c014183..7ef3277 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTagController.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/controller/admin/HttpTagController.java
@@ -3,6 +3,7 @@
 import com.iailab.framework.common.pojo.CommonResult;
 import com.iailab.framework.common.pojo.PageResult;
 import com.iailab.framework.common.util.object.BeanUtils;
+import com.iailab.module.data.channel.http.collector.ihdb.HttpCollectorForIhd;
 import com.iailab.module.data.channel.http.entity.HttpTagEntity;
 import com.iailab.module.data.channel.http.service.HttpTagService;
 import com.iailab.module.data.channel.http.vo.HttpTagPageReqVO;
@@ -14,7 +15,9 @@
 import javax.validation.Valid;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 import java.util.UUID;
+import java.util.stream.Collectors;
 
 import static com.iailab.framework.common.pojo.CommonResult.success;
 
@@ -31,11 +34,30 @@
     @Resource
     private HttpTagService tagService;
 
+    @Resource
+    private HttpCollectorForIhd httpCollectorForIhd;
+
     @PreAuthorize("@ss.hasPermission('data:channel-http:query')")
     @GetMapping("page")
     public CommonResult<PageResult<HttpTagRespVO>> page(@Valid HttpTagPageReqVO reqVO) {
+        
         PageResult<HttpTagEntity> page = tagService.queryPage(reqVO);
-        return success(BeanUtils.toBean(page, HttpTagRespVO.class));
+        PageResult<HttpTagRespVO> pageResultVO = new PageResult<>();
+        List<String> tagNames = page.getList().stream()
+                .map(HttpTagEntity::getTagName)
+                .collect(Collectors.toList());
+        Map<String, Object> dataMap = httpCollectorForIhd.getLastValues(tagNames);
+
+        List<HttpTagRespVO> vos = page.getList().stream().map(entity -> {
+
+            HttpTagRespVO vo = BeanUtils.toBean(entity,HttpTagRespVO.class);
+            vo.setDataValue(Double.parseDouble(dataMap.get(entity.getTagName()).toString()));
+            return vo;
+        }).collect(Collectors.toList());
+
+        pageResultVO.setList(vos);
+
+        return success(pageResultVO);
     }
 
     @PreAuthorize("@ss.hasPermission('data:channel-http:query')")
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpTagService.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpTagService.java
index 2cd7521..aeb2032 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpTagService.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpTagService.java
@@ -23,4 +23,6 @@
     List<HttpTagEntity> selectList(Map<String, Object> params);
 
     List<HttpTagEntity> getApiId(String code);
+
+    List<HttpTagEntity> getInfoByTagNoAndSourceId(String sourceId, String tagNo);
 }
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpTagServiceImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpTagServiceImpl.java
index 9825c91..bf261c2 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpTagServiceImpl.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpTagServiceImpl.java
@@ -73,4 +73,12 @@
                 .orderByDesc("create_time"));
     }
 
+    @Override
+    public List<HttpTagEntity> getInfoByTagNoAndSourceId(String sourceId, String tagName) {
+        return httpTagDao.selectList(new QueryWrapper<HttpTagEntity>()
+        .eq("api_id",sourceId)
+        .eq("tag_name",tagName)
+        );
+    }
+
 }
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTagRespVO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTagRespVO.java
index c8a3d5a..8ca9e9f 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTagRespVO.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/vo/HttpTagRespVO.java
@@ -41,6 +41,10 @@
     @ExcelProperty("是否启用")
     private Boolean enabled;
 
+    @Schema(description = "数据值", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @ExcelProperty("数据值")
+    private Double dataValue;
+
     @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
     @ExcelProperty("创建时间")
     private Date createTime;
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/controller/admin/ChannelKioTagController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/controller/admin/ChannelKioTagController.java
index 6122d90..9bb1ed7 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/controller/admin/ChannelKioTagController.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/controller/admin/ChannelKioTagController.java
@@ -3,6 +3,7 @@
 import com.iailab.framework.common.pojo.CommonResult;
 import com.iailab.framework.common.pojo.PageResult;
 import com.iailab.framework.common.util.object.BeanUtils;
+import com.iailab.module.data.channel.kio.collector.KingIOCollector;
 import com.iailab.module.data.channel.kio.entity.ChannelKioTagEntity;
 import com.iailab.module.data.channel.kio.service.ChannelKioTagService;
 import com.iailab.module.data.channel.kio.vo.KioTagPageReqVO;
@@ -14,7 +15,9 @@
 import javax.annotation.Resource;
 import javax.validation.Valid;
 import java.util.Date;
+import java.util.List;
 import java.util.UUID;
+import java.util.stream.Collectors;
 
 import static com.iailab.framework.common.pojo.CommonResult.success;
 
@@ -27,14 +30,34 @@
     @Resource
     private ChannelKioTagService channelKioTagService;
 
+    @Resource
+    private KingIOCollector kingIOCollector;
+
     /**
      * 分页查询tag
      * */
     @PreAuthorize("@ss.hasPermission('data:channel-kio:query')")
     @GetMapping("page")
     public CommonResult<PageResult<KioTagRespVO>> page(@Valid KioTagPageReqVO reqVO){
+
         PageResult<ChannelKioTagEntity> page = channelKioTagService.queryPage(reqVO);
-        return success(BeanUtils.toBean(page, KioTagRespVO.class));
+        PageResult<KioTagRespVO> pageResultVO = new PageResult<>();
+        pageResultVO.setTotal(page.getTotal());
+
+        List<KioTagRespVO> vos = page.getList().stream().map(entity -> {
+
+            KioTagRespVO vo = BeanUtils.toBean(entity,KioTagRespVO.class);
+            try {
+                vo.setDataValue(Double.parseDouble(kingIOCollector.getTagValue(reqVO.getDeviceId(), entity.getTagName())));
+            }catch (Exception e){
+                e.printStackTrace();
+            }
+            return vo;
+        }).collect(Collectors.toList());
+
+        pageResultVO.setList(vos);
+
+        return success(pageResultVO);
     }
 
     @PreAuthorize("@ss.hasPermission('data:channel-kio:query')")
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/vo/KioTagPageReqVO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/vo/KioTagPageReqVO.java
index 36ac970..8e8331f 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/vo/KioTagPageReqVO.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/vo/KioTagPageReqVO.java
@@ -20,4 +20,6 @@
     private String tagName;
 
     private String device;
+
+    private String deviceId;
 }
\ No newline at end of file
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/vo/KioTagRespVO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/vo/KioTagRespVO.java
index 35fb5eb..e80a47a 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/vo/KioTagRespVO.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/kio/vo/KioTagRespVO.java
@@ -37,10 +37,14 @@
     @ExcelProperty("测点描述")
     private String tagDesc;
 
-    @Schema(description = "是否可以tag", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
-    @ExcelProperty("是否可以tag")
+    @Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @ExcelProperty("是否启用")
     private Boolean enabled;
 
+    @Schema(description = "数据值", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @ExcelProperty("数据值")
+    private Double dataValue;
+
     @Schema(description = "关联设备", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
     @ExcelProperty("关联设备")
     private String device;
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusTagController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusTagController.java
index 38b5a98..00fec66 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusTagController.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/controller/admin/ChannelModbusTagController.java
@@ -3,6 +3,7 @@
 import com.iailab.framework.common.pojo.CommonResult;
 import com.iailab.framework.common.pojo.PageResult;
 import com.iailab.framework.common.util.object.BeanUtils;
+import com.iailab.module.data.channel.modbus.collector.ModBusCollector;
 import com.iailab.module.data.channel.modbus.entity.ChannelModBusTagEntity;
 import com.iailab.module.data.channel.modbus.entity.ChannelModBusTagEntity;
 import com.iailab.module.data.channel.modbus.service.ChannelModbusTagService;
@@ -12,8 +13,11 @@
 
 import javax.annotation.Resource;
 import javax.validation.Valid;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 import java.util.UUID;
+import java.util.stream.Collectors;
 
 import static com.iailab.framework.common.pojo.CommonResult.success;
 
@@ -28,11 +32,25 @@
     @Resource
     private ChannelModbusTagService channelModbusTagService;
 
+    @Resource
+    private ModBusCollector modBusCollector;
+
     @GetMapping("/page")
     public CommonResult<PageResult<ModBusTagRespVO>> list(@Valid ModBusTagPageReqVO reqVO) {
         PageResult<ChannelModBusTagEntity> page = channelModbusTagService.queryPage(reqVO);
+        PageResult<ModBusTagRespVO> pageResultVO = new PageResult<>();
+        pageResultVO.setTotal(page.getTotal());
 
-        return success(BeanUtils.toBean(page, ModBusTagRespVO.class));
+        List<ModBusTagRespVO> vos = page.getList().stream().map(entity -> {
+
+            ModBusTagRespVO vo = BeanUtils.toBean(entity,ModBusTagRespVO.class);
+            vo.setDataValue(modBusCollector.getTagValue(reqVO.getDeviceId(),entity.getTagName()));
+            return vo;
+        }).collect(Collectors.toList());
+
+        pageResultVO.setList(vos);
+
+        return success(pageResultVO);
     }
 
     /**
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusTagPageReqVO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusTagPageReqVO.java
index fc5ca7f..44b9858 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusTagPageReqVO.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusTagPageReqVO.java
@@ -24,4 +24,6 @@
     private String tagDesc;
 
     private String device;
+
+    private String deviceId;
 }
\ No newline at end of file
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusTagRespVO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusTagRespVO.java
index 2486441..a1f3508 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusTagRespVO.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/modbus/vo/ModBusTagRespVO.java
@@ -33,6 +33,10 @@
     @ExcelProperty("是否启用")
     private Boolean enabled;
 
+    @Schema(description = "数据值", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @ExcelProperty("数据值")
+    private Double dataValue;
+
     @Schema(description = "大小端", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
     @ExcelProperty("大小端")
     private String format;
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/controller/admin/ChannelOPCDATagController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/controller/admin/ChannelOPCDATagController.java
index 2a6fb45..e04d02a 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/controller/admin/ChannelOPCDATagController.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/controller/admin/ChannelOPCDATagController.java
@@ -3,19 +3,27 @@
 import com.iailab.framework.common.pojo.CommonResult;
 import com.iailab.framework.common.pojo.PageResult;
 import com.iailab.framework.common.util.object.BeanUtils;
+import com.iailab.module.data.channel.opcda.collector.OpcDACollector;
+import com.iailab.module.data.channel.opcda.entity.ChannelOPCDADeviceEntity;
 import com.iailab.module.data.channel.opcda.entity.ChannelOPCDATagEntity;
+import com.iailab.module.data.channel.opcda.service.ChannelOPCDADeviceService;
 import com.iailab.module.data.channel.opcda.service.ChannelOPCDATagService;
 import com.iailab.module.data.channel.opcda.vo.OpcDaTagPageReqVO;
 import com.iailab.module.data.channel.opcda.vo.OpcDaTagRespVO;
+import com.iailab.module.data.common.enums.DataSourceType;
 import com.iailab.module.data.common.exception.RRException;
+import com.iailab.module.data.common.utils.TagUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.validation.Valid;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 import java.util.UUID;
+import java.util.stream.Collectors;
 
 import static com.iailab.framework.common.pojo.CommonResult.success;
 
@@ -31,11 +39,34 @@
     @Autowired
     private ChannelOPCDATagService channelOPCDATagService;
 
+    @Autowired
+    private OpcDACollector opcDACollector;
+
+    @Autowired
+    private ChannelOPCDADeviceService channelOPCDADeviceService;
+
     @PreAuthorize("@ss.hasPermission('data:channel-opcua:query')")
     @GetMapping("page")
     public CommonResult<PageResult<OpcDaTagRespVO>> list(@Valid OpcDaTagPageReqVO reqVO) {
+
         PageResult<ChannelOPCDATagEntity> page = channelOPCDATagService.queryPage(reqVO);
-        return success(BeanUtils.toBean(page, OpcDaTagRespVO.class));
+        PageResult<OpcDaTagRespVO> pageResultVO = new PageResult<>();
+        pageResultVO.setTotal(page.getTotal());
+
+        List<OpcDaTagRespVO> vos = page.getList().stream().map(entity -> {
+
+            OpcDaTagRespVO vo = BeanUtils.toBean(entity,OpcDaTagRespVO.class);
+            List<String[]> tags = new ArrayList<>();
+            String[] array  = {reqVO.getServerId(),entity.getTagName()};
+            tags.add(array);
+            ChannelOPCDADeviceEntity OPCDADevice = channelOPCDADeviceService.info(reqVO.getServerId());
+            vo.setDataValue(Double.parseDouble(opcDACollector.getTagValues(tags).get(TagUtils.genTagId(DataSourceType.OPCDA.getCode(), OPCDADevice.getServerName(),entity.getTagName())).toString()));
+            return vo;
+        }).collect(Collectors.toList());
+
+        pageResultVO.setList(vos);
+
+        return success(pageResultVO);
     }
 
     @PreAuthorize("@ss.hasPermission('data:channel-opcua:query')")
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/vo/OpcDaTagRespVO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/vo/OpcDaTagRespVO.java
index 89709db..f7e421a 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/vo/OpcDaTagRespVO.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcda/vo/OpcDaTagRespVO.java
@@ -37,6 +37,10 @@
     @ExcelProperty("是否启用")
     private Boolean enabled;
 
+    @Schema(description = "数据值", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @ExcelProperty("数据值")
+    private Double dataValue;
+
     @Schema(description = "itemID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
     @ExcelProperty("itemID")
     private String itemId;
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/controller/admin/ChannelOPCUATagController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/controller/admin/ChannelOPCUATagController.java
index 981ef30..f4911b6 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/controller/admin/ChannelOPCUATagController.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/controller/admin/ChannelOPCUATagController.java
@@ -3,6 +3,7 @@
 import com.iailab.framework.common.pojo.CommonResult;
 import com.iailab.framework.common.pojo.PageResult;
 import com.iailab.framework.common.util.object.BeanUtils;
+import com.iailab.module.data.channel.opcua.collector.OpcUaCollector;
 import com.iailab.module.data.channel.opcua.entity.ChannelOPCUATagEntity;
 import com.iailab.module.data.channel.opcua.service.ChannelOPCUATagService;
 import com.iailab.module.data.channel.opcua.vo.OpcUaTagPageReqVO;
@@ -13,7 +14,9 @@
 import javax.annotation.Resource;
 import javax.validation.Valid;
 import java.util.Date;
+import java.util.List;
 import java.util.UUID;
+import java.util.stream.Collectors;
 
 import static com.iailab.framework.common.pojo.CommonResult.success;
 
@@ -29,11 +32,31 @@
     @Resource
     private ChannelOPCUATagService channelOpcuaTagService;
 
+    @Resource
+    private OpcUaCollector opcUaCollector;
+
     @PreAuthorize("@ss.hasPermission('data:channel-opcua:query')")
     @GetMapping("page")
     public CommonResult<PageResult<OpcUaTagRespVO>> list(@Valid OpcUaTagPageReqVO reqVO) {
+
         PageResult<ChannelOPCUATagEntity> page = channelOpcuaTagService.queryPage(reqVO);
-        return success(BeanUtils.toBean(page, OpcUaTagRespVO.class));
+        PageResult<OpcUaTagRespVO> pageResultVO = new PageResult<>();
+        pageResultVO.setTotal(page.getTotal());
+
+        List<OpcUaTagRespVO> vos = page.getList().stream().map(entity -> {
+
+            OpcUaTagRespVO vo = BeanUtils.toBean(entity,OpcUaTagRespVO.class);
+            try{
+                vo.setDataValue( Double.parseDouble(opcUaCollector.getTagValue(reqVO.getDeviceId(),entity.getTagName())));
+            }catch (Exception e){
+                e.printStackTrace();
+            }
+            return vo;
+        }).collect(Collectors.toList());
+
+        pageResultVO.setList(vos);
+
+        return success(pageResultVO);
     }
 
     @PreAuthorize("@ss.hasPermission('data:channel-opcua:query')")
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/vo/OpcUaTagPageReqVO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/vo/OpcUaTagPageReqVO.java
index 4641af1..cc91622 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/vo/OpcUaTagPageReqVO.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/vo/OpcUaTagPageReqVO.java
@@ -20,4 +20,6 @@
     private String tagName;
 
     private String device;
+
+    private String deviceId;
 }
\ No newline at end of file
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/vo/OpcUaTagRespVO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/vo/OpcUaTagRespVO.java
index 2da2f1b..a08b3dd 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/vo/OpcUaTagRespVO.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/vo/OpcUaTagRespVO.java
@@ -33,6 +33,10 @@
     @ExcelProperty("是否启用")
     private Boolean enabled;
 
+    @Schema(description = "数据值", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @ExcelProperty("数据值")
+    private Double dataValue;
+
     @Schema(description = "关联设备", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
     @ExcelProperty("关联设备")
     private String device;
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/job/task/PointCollectTaskNet60.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/job/task/PointCollectTaskNet60.java
index 9770ce1..005363a 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/job/task/PointCollectTaskNet60.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/job/task/PointCollectTaskNet60.java
@@ -23,7 +23,7 @@
 public class PointCollectTaskNet60 implements ITask {
     private final Logger logger = LoggerFactory.getLogger(getClass());
 
-    private static final String NET = "1min";
+    private static final String NET = "NET60";
 
     @Resource
     private PointCollector pointCollector;

--
Gitblit v1.9.3