From 6b13839488edcd06046e26a41fe897358176689c Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期五, 13 十二月 2024 17:56:41 +0800
Subject: [PATCH] 采集质量

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/entity/DaPointCollectStatusEntity.java            |    4 ++--
 iailab-module-data/iailab-module-data-biz/db/mysql/tenant.sql                                                                          |    8 ++++----
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/dto/DaPointDTO.java                               |   12 ++++++++++++
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointCollectStatusServiceImpl.java |    6 +++---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/DaPointCollectStatusService.java          |    2 +-
 iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/point/DaPointDao.xml                                               |    6 +++++-
 iailab-module-data/iailab-module-data-biz/src/main/resources/application.yaml                                                          |    1 +
 7 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/iailab-module-data/iailab-module-data-biz/db/mysql/tenant.sql b/iailab-module-data/iailab-module-data-biz/db/mysql/tenant.sql
index 354998b..4675bd8 100644
--- a/iailab-module-data/iailab-module-data-biz/db/mysql/tenant.sql
+++ b/iailab-module-data/iailab-module-data-biz/db/mysql/tenant.sql
@@ -402,10 +402,10 @@
 
 CREATE TABLE t_da_point_collect_status(
                            `id` VARCHAR(36) NOT NULL  COMMENT 'ID' ,
-                           `point_id` VARCHAR(36) NOT NULL   COMMENT '测点ID',
-                           `collect_value` VARCHAR(36)   COMMENT '采集值',
-                           `collect_quality` VARCHAR(36)   COMMENT '采集质量',
+                           `point_no` VARCHAR(36) NOT NULL   COMMENT '测点编码',
+                           `collect_value` VARCHAR(24)   COMMENT '采集值',
+                           `collect_quality` VARCHAR(5)   COMMENT '采集质量',
                            `collect_time` DATETIME   COMMENT '采集时间' ,
                            PRIMARY KEY (id) USING BTREE,
-                           UNIQUE KEY `uk_point_id` (`point_id`) USING BTREE
+                           UNIQUE KEY `uk_point_no` (`point_no`) USING BTREE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT = '测点采集状态表';
\ No newline at end of file
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/dto/DaPointDTO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/dto/DaPointDTO.java
index 7d56e18..55a1c57 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/dto/DaPointDTO.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/dto/DaPointDTO.java
@@ -1,5 +1,6 @@
 package com.iailab.module.data.point.dto;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.iailab.framework.common.validation.group.AddGroup;
 import com.iailab.framework.common.validation.group.UpdateGroup;
 import com.iailab.framework.excel.core.annotations.DictFormat;
@@ -127,4 +128,15 @@
 
     @Schema(description = "累计点")
     private DaCumulatePointDTO cumulatePoint;
+
+    @Schema(description = "采集值")
+    private String collectValue;
+
+    @Schema(description = "采集质量")
+    private String collectQuality;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @Schema(description = "采集时间")
+    private Date collectTime;
+
 }
\ No newline at end of file
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/entity/DaPointCollectStatusEntity.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/entity/DaPointCollectStatusEntity.java
index 40fc4f6..33b2ad3 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/entity/DaPointCollectStatusEntity.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/entity/DaPointCollectStatusEntity.java
@@ -25,9 +25,9 @@
     private String id;
 
     /**
-     * 测点ID
+     * 测点编码
      */
-    private String pointId;
+    private String pointNo;
 
     /**
      * 采集值
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/DaPointCollectStatusService.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/DaPointCollectStatusService.java
index fa07645..b42e94e 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/DaPointCollectStatusService.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/DaPointCollectStatusService.java
@@ -14,5 +14,5 @@
 public interface DaPointCollectStatusService extends BaseService<DaPointCollectStatusEntity> {
 
     @Async
-    void recordStatus(String pointId, String collectValue, Date collectTime);
+    void recordStatus(String pointNo, String collectValue, Date collectTime);
 }
\ No newline at end of file
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointCollectStatusServiceImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointCollectStatusServiceImpl.java
index 5c95b95..74e4931 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointCollectStatusServiceImpl.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/service/impl/DaPointCollectStatusServiceImpl.java
@@ -20,14 +20,14 @@
 public class DaPointCollectStatusServiceImpl extends BaseServiceImpl<DaPointCollectStatusDao, DaPointCollectStatusEntity>
         implements DaPointCollectStatusService {
 
-    public void recordStatus(String pointId, String collectValue, Date collectTime) {
+    public void recordStatus(String pointNo, String collectValue, Date collectTime) {
         QueryWrapper<DaPointCollectStatusEntity> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("point_id", pointId);
+        queryWrapper.eq("point_no", pointNo);
         DaPointCollectStatusEntity entity = baseDao.selectOne(queryWrapper);
         if (entity == null) {
             entity = new DaPointCollectStatusEntity();
             entity.setId(UUID.randomUUID().toString());
-            entity.setPointId(pointId);
+            entity.setPointNo(pointNo);
             entity.setCollectValue(collectValue);
             entity.setCollectQuality(DataQualityEnum.getEumByValue(collectValue).getCode());
             entity.setCollectTime(collectTime);
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/resources/application.yaml b/iailab-module-data/iailab-module-data-biz/src/main/resources/application.yaml
index 0b49ea4..b155a20 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/resources/application.yaml
+++ b/iailab-module-data/iailab-module-data-biz/src/main/resources/application.yaml
@@ -184,6 +184,7 @@
       - t_plan_item_category
       - t_plan_item
       - t_da_cumulate_point
+      - t_da_point_collect_status
   app:
     app-key: data
     app-secret: 85b0df7edc3df3611913df34ed695011
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/point/DaPointDao.xml b/iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/point/DaPointDao.xml
index bdf1e3d..a6cb801 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/point/DaPointDao.xml
+++ b/iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/point/DaPointDao.xml
@@ -26,9 +26,13 @@
       t3.source_name,
       t2.tag_no,
       t2.dimension,
-      t2.value_type
+      t2.value_type,
+      t6.collect_value,
+      t6.collect_quality,
+      t6.collect_time
       from t_da_point t1
       left join t_da_measure_point t2 on t2.point_id = t1.id
+      left join t_da_point_collect_status t6 on t6.point_no = t1.point_no
       left join (
         select id source_id,server_name source_name
         from t_channel_opcua_device

--
Gitblit v1.9.3