From db184afd0c5bf3359b44eb0251fa5b07386eb3ff Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期三, 06 十一月 2024 09:48:13 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/opcua/controller/admin/ChannelOPCUATagController.java |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

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 365bcc2..b4f579d 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
@@ -7,6 +7,9 @@
 import com.iailab.framework.common.util.object.BeanUtils;
 import com.iailab.framework.common.util.object.ConvertUtils;
 import com.iailab.framework.excel.core.util.ExcelUtils;
+import com.iailab.module.data.channel.opcua.collector.OpcUaCollector;
+import com.iailab.framework.common.util.object.ConvertUtils;
+import com.iailab.framework.excel.core.util.ExcelUtils;
 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.OpcUaTagExportExcelVO;
@@ -30,6 +33,7 @@
 import java.util.Date;
 import java.util.List;
 import java.util.UUID;
+import java.util.stream.Collectors;
 
 import static com.iailab.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
 import static com.iailab.framework.common.pojo.CommonResult.success;
@@ -46,11 +50,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')")

--
Gitblit v1.9.3