Forráskód Böngészése

实现庚顿数据库的标准接口类,并实现测试和bug修复

shilin 5 hónapja
szülő
commit
39c899d4a3
1 módosított fájl, 69 hozzáadás és 1 törlés
  1. 69 1
      src/main/java/com/gyee/generation/init/CacheContext.java

+ 69 - 1
src/main/java/com/gyee/generation/init/CacheContext.java

@@ -7,7 +7,10 @@ import com.alibaba.fastjson.TypeReference;
 import com.gyee.generation.model.auto.*;
 import com.gyee.generation.service.auto.*;
 
+import com.gyee.generation.util.realtimesource.TaosUtil;
+import com.gyee.generation.util.realtimesource.timeseries.PointData;
 import com.gyee.generation.util.redis.RedisService;
+import com.gyee.generation.util.rule.expression.DeviceTypeValue;
 import jakarta.annotation.Resource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -66,6 +69,8 @@ public class CacheContext implements CommandLineRunner {
     @Value("${runWindpowerstation}")
     private String runWindpowerstation;
 
+    @Resource
+    private TaosUtil taosUtil;
 
     public static List<ProBasicEnergyGroup> egls = new ArrayList<>();
     public static List<ProBasicRegion> rgls = new ArrayList<>();
@@ -120,7 +125,6 @@ public class CacheContext implements CommandLineRunner {
     public static Map<String, Map<String, ProBasicPowerstationPoint>> propointmap = new HashMap<>();
     public static Map<String, Map<String, ProBasicPowerstationPoint>> wppointmap = new HashMap<>();
     public static Map<String, Map<String, ProBasicPowerstationPoint>> subwppointmap = new HashMap<>();
-
     public static Map<String, Map<String, ProBasicPowerstationPoint>> wswppointmap = new HashMap<>();
     public static Map<String, Map<String, ProBasicPowerstationPoint>> companypointmap = new HashMap<>();
     public static Map<String, Map<String, ProBasicPowerstationPoint>> regionpointmap = new HashMap<>();
@@ -133,6 +137,8 @@ public class CacheContext implements CommandLineRunner {
 
     public static Map<String, Integer> redisDbMap = new HashMap<>();
 
+
+
     @Override
     public void run(String... args) throws Exception {
         logger.info("缓存开始------------------------------------------------------------");
@@ -509,4 +515,66 @@ public class CacheContext implements CommandLineRunner {
     }
 
 
+    public  PointData  getTagInfo(String varName,String thingId,DeviceTypeValue thingType) throws Exception {
+
+
+        Map<String, ProBasicEquipmentPoint> wtMap=new HashMap();
+        Map<String, ProBasicPowerstationPoint> wpMap=new HashMap();
+
+
+        if(ObjectUtil.isNotEmpty(varName) && ObjectUtil.isNotEmpty(thingId) && ObjectUtil.isNotEmpty(thingType))
+        {
+            if (thingType == DeviceTypeValue.WT ) {
+                wtMap = eqpointmap.get(thingId);
+                if(wtMap.containsKey(varName))
+                {
+                    ProBasicEquipmentPoint wtPoint=wtMap.get(varName);
+
+                    PointData wtValue=taosUtil.getRealData(wtPoint.getNemCode());
+                    return wtValue;
+                }
+            } else   if (thingType == DeviceTypeValue.LN )  {
+
+                wpMap = propointmap.get(thingId);
+
+            } else   if (thingType == DeviceTypeValue.WP )  {
+
+                wpMap = wppointmap.get(thingId);
+
+            } else   if (thingType == DeviceTypeValue.LN )  {
+
+                wpMap = linepointmap.get(thingId);
+
+            } else   if (thingType == DeviceTypeValue.CP )  {
+
+                wpMap = companypointmap.get(thingId);
+
+            } else   if (thingType == DeviceTypeValue.RG )  {
+
+                wpMap = regionpointmap.get(thingId);
+
+            }else   if (thingType == DeviceTypeValue.EG )  {
+
+                wpMap = grouppointmap.get(thingId);
+
+            }
+
+            if(!wpMap.isEmpty())
+            {
+                if(wpMap.containsKey(varName))
+                {
+                    ProBasicPowerstationPoint wpPoint=wpMap.get(varName);
+
+                    PointData wpValue=taosUtil.getRealData(wpPoint.getNemCode());
+                    return wpValue;
+                }
+            }
+
+
+
+        }
+
+        return null;
+    }
+
 }