From c0b8cf32504dd1a42780bb1ee06ae8a7b0d7b120 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期三, 09 十月 2024 23:36:11 +0800
Subject: [PATCH] 指标数据

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/collection/IndItemCollector.java |   84 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 84 insertions(+), 0 deletions(-)

diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/collection/IndItemCollector.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/collection/IndItemCollector.java
new file mode 100644
index 0000000..2abeda0
--- /dev/null
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/ind/collection/IndItemCollector.java
@@ -0,0 +1,84 @@
+package com.iailab.module.data.ind.collection;
+
+import com.iailab.module.data.common.enums.ItemTypeEnum;
+import com.iailab.module.data.ind.collection.handler.AtomItemHandler;
+import com.iailab.module.data.ind.collection.handler.CalItemHandler;
+import com.iailab.module.data.ind.collection.handler.DerItemHandler;
+import com.iailab.module.data.ind.item.entity.IndItemEntity;
+import com.iailab.module.data.ind.item.service.IndItemService;
+import com.iailab.module.data.ind.item.vo.IndItemValueVO;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author PanZhibao
+ * @Description
+ * @createTime 2024年10月04日
+ */
+@Slf4j
+@Component
+public class IndItemCollector {
+
+    @Autowired
+    private IndItemService indItemService;
+
+    @Autowired
+    private AtomItemHandler atomItemHandler;
+
+    @Autowired
+    private DerItemHandler derItemHandler;
+
+    @Autowired
+    private CalItemHandler calItemHandler;
+
+    public List<IndItemValueVO> queryValue(String itemNo) {
+        List<IndItemValueVO> result = new ArrayList<IndItemValueVO>();
+        IndItemEntity indItem = indItemService.getInfoByNo(itemNo);
+        if (indItem == null) {
+            return result;
+        }
+        ItemTypeEnum itemType = ItemTypeEnum.getEumByCode(indItem.getItemType());
+        switch (itemType) {
+            case ATOM:
+                result = atomItemHandler.queryValue(indItem.getId());
+                break;
+            case DER:
+                result = derItemHandler.queryValue(itemNo);
+                break;
+            case CAL:
+                result = calItemHandler.queryValue(itemNo);
+                break;
+            default:
+                break;
+        }
+        return result;
+    }
+
+    public List<IndItemValueVO> queryValue(String itemNo, Date startTime, Date endTime) {
+        List<IndItemValueVO> result = new ArrayList<IndItemValueVO>();
+        IndItemEntity indItem = indItemService.getInfoByNo(itemNo);
+        if (indItem == null) {
+            return result;
+        }
+        ItemTypeEnum itemType = ItemTypeEnum.getEumByCode(indItem.getItemType());
+        switch (itemType) {
+            case ATOM:
+                result = atomItemHandler.queryValue(indItem.getId());
+                break;
+            case DER:
+                result = derItemHandler.queryValue(itemNo, startTime, endTime);
+                break;
+            case CAL:
+                result = calItemHandler.queryValue(itemNo, startTime, endTime);
+                break;
+            default:
+                break;
+        }
+        return result;
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.3