xushili 5 ヶ月 前
コミット
4057c6de2f

+ 1 - 1
.idea/dataSources.local.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
-  <component name="dataSourceStorageLocal" created-in="IU-242.21829.142">
+  <component name="dataSourceStorageLocal" created-in="IU-242.22855.74">
     <data-source name="admin_1" uuid="2ec8658d-a635-4464-ba73-a1bc060beb5e">
       <database-info product="" version="" jdbc-version="" driver-name="" driver-version="" dbms="POSTGRES" />
       <schema-mapping />

+ 81 - 64
.idea/workspace.xml

@@ -4,19 +4,19 @@
     <option name="autoReloadType" value="SELECTIVE" />
   </component>
   <component name="ChangeListManager">
-    <list default="true" id="c9251c3e-9f2f-4b6c-a5f7-503156fe13c0" name="Changes" comment="bug修复">
-      <change afterPath="$PROJECT_DIR$/generationXK-service/src/test/java/com/gyee/generation/SaticScheduleCALTaskTest.java" afterDir="false" />
+    <list default="true" id="c9251c3e-9f2f-4b6c-a5f7-503156fe13c0" name="Changes" comment="bug修复2">
+      <change beforePath="$PROJECT_DIR$/.idea/dataSources.local.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources.local.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/config/DataConverterManager2.java" beforeDir="false" afterPath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/config/DataConverterManager2.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/config/MqttServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/config/MqttServer.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/config/PushCallback.java" beforeDir="false" afterPath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/config/PushCallback.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/controller/SubscribeController.java" beforeDir="false" afterPath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/controller/SubscribeController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/controller/AdapterController.java" beforeDir="false" afterPath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/controller/AdapterController.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/dao/IHistoryDao.java" beforeDir="false" afterPath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/dao/IHistoryDao.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/dao_mqtt_influxdb_taos/MqttTaosLatestDao.java" beforeDir="false" afterPath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/dao_mqtt_influxdb_taos/MqttTaosLatestDao.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/entity/PointData.java" beforeDir="false" afterPath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/entity/PointData.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/service/IAdapterService.java" beforeDir="false" afterPath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/service/IAdapterService.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/service/TaosDataService.java" beforeDir="false" afterPath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/dao_mqtt_influxdb_taos/TaosDataService.java" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/service/TsDataService.java" beforeDir="false" afterPath="$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/service/TsDataService.java" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/data-adapter/src/main/resources/application.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/data-adapter/src/main/resources/application.yaml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/generationXK-service/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/generationXK-service/pom.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/generationXK-service/src/test/java/com/gyee/generation/CurveTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/generationXK-service/src/test/java/com/gyee/generation/CurveTest.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/generationXK-service/src/main/java/com/gyee/generation/util/realtimesource/EdosUtil.java" beforeDir="false" afterPath="$PROJECT_DIR$/generationXK-service/src/main/java/com/gyee/generation/util/realtimesource/EdosUtil.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/generationXK-service/src/main/java/com/gyee/generation/util/realtimesource/IEdosUtil.java" beforeDir="false" afterPath="$PROJECT_DIR$/generationXK-service/src/main/java/com/gyee/generation/util/realtimesource/IEdosUtil.java" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/generationXK-service/src/test/java/com/gyee/generation/SaticScheduleCALTaskTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/generationXK-service/src/test/java/com/gyee/generation/SaticScheduleCALTaskTest.java" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -60,61 +60,62 @@
     <option name="hideEmptyMiddlePackages" value="true" />
     <option name="showLibraryContents" value="true" />
   </component>
-  <component name="PropertiesComponent"><![CDATA[{
-  "keyToString": {
-    "HTTP 请求.generated-requests | #259.executor": "Run",
-    "HTTP 请求.generated-requests | #260.executor": "Run",
-    "HTTP 请求.generated-requests | #261.executor": "Run",
-    "HTTP 请求.generated-requests | #262.executor": "Run",
-    "HTTP 请求.generated-requests | #263.executor": "Run",
-    "HTTP 请求.generated-requests | #264.executor": "Run",
-    "JUnit.SaticScheduleCALTaskTest.all.executor": "Debug",
-    "JUnit.test.test1.executor": "Debug",
-    "Maven.common [clean].executor": "Run",
-    "Maven.common [compile].executor": "Run",
-    "Maven.common [package].executor": "Run",
-    "Maven.runeconmy-nx [clean].executor": "Run",
-    "Maven.runeconomy-xk [clean].executor": "Run",
-    "Maven.runeconomy-xk [compile].executor": "Run",
-    "Maven.runeconomy-xk [package].executor": "Run",
-    "RequestMappingsPanelOrder0": "0",
-    "RequestMappingsPanelOrder1": "1",
-    "RequestMappingsPanelWidth0": "75",
-    "RequestMappingsPanelWidth1": "75",
-    "RunOnceActivity.OpenProjectViewOnStart": "true",
-    "RunOnceActivity.ShowReadmeOnStart": "true",
-    "SHARE_PROJECT_CONFIGURATION_FILES": "true",
-    "Spring Boot.DataAdapterApp.executor": "Debug",
-    "Spring Boot.DataAdapterApplication.executor": "Debug",
-    "Spring Boot.GenerationMain.executor": "Debug",
-    "Spring Boot.RunEconomyApplication.executor": "Debug",
-    "WebServerToolWindowFactoryState": "false",
-    "git-widget-placeholder": "master",
-    "kotlin-language-version-configured": "true",
-    "last_opened_file_path": "D:/ruoyi/runeconomy-nx/generationXK-service/src/test/java/com/gyee/generation",
-    "node.js.detected.package.eslint": "true",
-    "node.js.detected.package.tslint": "true",
-    "node.js.selected.package.eslint": "(autodetect)",
-    "node.js.selected.package.tslint": "(autodetect)",
-    "nodejs_package_manager_path": "npm",
-    "project.structure.last.edited": "SDK",
-    "project.structure.proportion": "0.15",
-    "project.structure.side.proportion": "0.2",
-    "run.configurations.included.in.services": "true",
-    "settings.editor.selected.configurable": "MavenSettings",
-    "vue.rearranger.settings.migration": "true"
+  <component name="PropertiesComponent">{
+  &quot;keyToString&quot;: {
+    &quot;HTTP 请求.generated-requests | #259.executor&quot;: &quot;Run&quot;,
+    &quot;HTTP 请求.generated-requests | #260.executor&quot;: &quot;Run&quot;,
+    &quot;HTTP 请求.generated-requests | #261.executor&quot;: &quot;Run&quot;,
+    &quot;HTTP 请求.generated-requests | #262.executor&quot;: &quot;Run&quot;,
+    &quot;HTTP 请求.generated-requests | #263.executor&quot;: &quot;Run&quot;,
+    &quot;HTTP 请求.generated-requests | #264.executor&quot;: &quot;Run&quot;,
+    &quot;JUnit.SaticScheduleCALTaskTest.all.executor&quot;: &quot;Debug&quot;,
+    &quot;JUnit.test.test1.executor&quot;: &quot;Debug&quot;,
+    &quot;Maven.common [clean].executor&quot;: &quot;Run&quot;,
+    &quot;Maven.common [compile].executor&quot;: &quot;Run&quot;,
+    &quot;Maven.common [package].executor&quot;: &quot;Run&quot;,
+    &quot;Maven.runeconmy-nx [clean].executor&quot;: &quot;Run&quot;,
+    &quot;Maven.runeconomy-xk [clean].executor&quot;: &quot;Run&quot;,
+    &quot;Maven.runeconomy-xk [compile].executor&quot;: &quot;Run&quot;,
+    &quot;Maven.runeconomy-xk [package].executor&quot;: &quot;Run&quot;,
+    &quot;RequestMappingsPanelOrder0&quot;: &quot;0&quot;,
+    &quot;RequestMappingsPanelOrder1&quot;: &quot;1&quot;,
+    &quot;RequestMappingsPanelWidth0&quot;: &quot;75&quot;,
+    &quot;RequestMappingsPanelWidth1&quot;: &quot;75&quot;,
+    &quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
+    &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
+    &quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
+    &quot;Spring Boot.DataAdapterApp.executor&quot;: &quot;Debug&quot;,
+    &quot;Spring Boot.DataAdapterApplication.executor&quot;: &quot;Debug&quot;,
+    &quot;Spring Boot.GenerationMain.executor&quot;: &quot;Debug&quot;,
+    &quot;Spring Boot.RunEconomyApplication.executor&quot;: &quot;Debug&quot;,
+    &quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
+    &quot;git-widget-placeholder&quot;: &quot;master&quot;,
+    &quot;kotlin-language-version-configured&quot;: &quot;true&quot;,
+    &quot;last_opened_file_path&quot;: &quot;D:/ruoyi/runeconomy-nx/generationXK-service/src/test/java/com/gyee/generation&quot;,
+    &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
+    &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
+    &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
+    &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
+    &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
+    &quot;project.structure.last.edited&quot;: &quot;SDK&quot;,
+    &quot;project.structure.proportion&quot;: &quot;0.15&quot;,
+    &quot;project.structure.side.proportion&quot;: &quot;0.2&quot;,
+    &quot;run.configurations.included.in.services&quot;: &quot;true&quot;,
+    &quot;settings.editor.selected.configurable&quot;: &quot;MavenSettings&quot;,
+    &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
   },
-  "keyToStringList": {
-    "DatabaseDriversLRU": [
-      "32cedcb1-ba4b-45b2-8a73-afb0e89cadeb"
+  &quot;keyToStringList&quot;: {
+    &quot;DatabaseDriversLRU&quot;: [
+      &quot;32cedcb1-ba4b-45b2-8a73-afb0e89cadeb&quot;
     ]
   }
-}]]></component>
+}</component>
   <component name="ReactorSettings">
     <option name="notificationShown" value="true" />
   </component>
   <component name="RecentsManager">
     <key name="CopyFile.RECENT_KEYS">
+      <recent name="D:\ruoyi\runeconomy-nx\generationXK-service\src\test\java\com\gyee\generation" />
       <recent name="D:\ruoyi\runeconomy-nx" />
       <recent name="D:\ruoyi\runeconomy-nx\data-adapter\src\main\java\com\gyee\dataadapter\entity" />
       <recent name="D:\work\workspaces\runeconomy-nx\runeconomy-xk\src\main\java\com\gyee\runeconomy" />
@@ -135,7 +136,7 @@
       </set>
     </option>
   </component>
-  <component name="RunManager" selected="JUnit.SaticScheduleCALTaskTest.all">
+  <component name="RunManager" selected="Spring Boot.DataAdapterApp">
     <configuration name="generated-requests | #259" type="HttpClient.HttpRequestRunConfigurationType" factoryName="HTTP Request" temporary="true" nameIsGenerated="true" path="$APPLICATION_CONFIG_DIR$/scratches/generated-requests.http" index="259" requestIdentifier="#259" runType="运行单个请求">
       <method v="2" />
     </configuration>
@@ -218,7 +219,7 @@
   <component name="SharedIndexes">
     <attachedChunks>
       <set>
-        <option value="bundled-jdk-9823dce3aa75-b114ca120d71-intellij.indexing.shared.core-IU-242.21829.142" />
+        <option value="bundled-jdk-9823dce3aa75-28b599e66164-intellij.indexing.shared.core-IU-242.22855.74" />
       </set>
     </attachedChunks>
   </component>
@@ -249,7 +250,9 @@
       <workItem from="1726275498465" duration="21935000" />
       <workItem from="1726622318617" duration="13588000" />
       <workItem from="1726642901861" duration="8316000" />
-      <workItem from="1726708351953" duration="14332000" />
+      <workItem from="1726708351953" duration="14726000" />
+      <workItem from="1726731645761" duration="7456000" />
+      <workItem from="1726794107135" duration="7768000" />
     </task>
     <task id="LOCAL-00001" summary="宁夏风公司">
       <option name="closed" value="true" />
@@ -291,7 +294,15 @@
       <option name="project" value="LOCAL" />
       <updated>1726725051595</updated>
     </task>
-    <option name="localTasksCounter" value="6" />
+    <task id="LOCAL-00006" summary="bug修复2">
+      <option name="closed" value="true" />
+      <created>1726731399306</created>
+      <option name="number" value="00006" />
+      <option name="presentableId" value="LOCAL-00006" />
+      <option name="project" value="LOCAL" />
+      <updated>1726731399306</updated>
+    </task>
+    <option name="localTasksCounter" value="7" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
@@ -313,26 +324,32 @@
     <MESSAGE value="适配器适配" />
     <MESSAGE value="读取调试" />
     <MESSAGE value="bug修复" />
-    <option name="LAST_COMMIT_MESSAGE" value="bug修复" />
+    <MESSAGE value="bug修复2" />
+    <option name="LAST_COMMIT_MESSAGE" value="bug修复2" />
   </component>
   <component name="XDebuggerManager">
     <breakpoint-manager>
       <breakpoints>
         <line-breakpoint enabled="true" type="java-line">
           <url>file://$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/controller/AdapterController.java</url>
-          <line>89</line>
+          <line>94</line>
           <option name="timeStamp" value="1" />
         </line-breakpoint>
         <line-breakpoint enabled="true" type="java-line">
           <url>file://$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/dao_mqtt_influxdb_taos/MqttTaosLatestDao.java</url>
-          <line>46</line>
+          <line>43</line>
           <option name="timeStamp" value="3" />
         </line-breakpoint>
         <line-breakpoint enabled="true" type="java-line">
           <url>file://$PROJECT_DIR$/data-adapter/src/main/java/com/gyee/dataadapter/dao_mqtt_influxdb_taos/MqttTaosLatestDao.java</url>
-          <line>48</line>
+          <line>45</line>
           <option name="timeStamp" value="7" />
         </line-breakpoint>
+        <line-breakpoint enabled="true" type="java-line">
+          <url>file://$PROJECT_DIR$/generationXK-service/src/main/java/com/gyee/generation/service/WindPowerInfo1Service.java</url>
+          <line>1258</line>
+          <option name="timeStamp" value="8" />
+        </line-breakpoint>
       </breakpoints>
     </breakpoint-manager>
     <watches-manager>

+ 2 - 2
data-adapter/src/main/java/com/gyee/dataadapter/controller/AdapterController.java

@@ -90,12 +90,12 @@ public class AdapterController {
         return tsDataService.getHistorySection(ts, tagNames);
     }
 
-    @PostMapping("/latest/batch")
+    @PostMapping("/save/batch")
     public boolean writeLatestBatch(@RequestBody List<PointData> PointDataList) {
         return tsDataService.writeLatest(PointDataList);
     }
 
-    @PostMapping("/latest/save")
+    @PostMapping("/save")
     public boolean writeLatest(@RequestBody PointData PointData) {
         return writeLatestBatch(Collections.singletonList(PointData));
     }

+ 7 - 12
data-adapter/src/main/java/com/gyee/dataadapter/dao/IHistoryDao.java

@@ -2,21 +2,16 @@ package com.gyee.dataadapter.dao;
 
 import com.gyee.dataadapter.entity.PointData;
 
+import java.sql.SQLException;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
 public interface IHistoryDao {
-    Map<String, PointData> getLatest(String tagNames);
-    Map<String, PointData> getLatest(String... tagNames);
-    List<PointData> getHistoryRaw(String tagName, Date startTime, Date endTime);
-    List<PointData> getHistoryRaw(String tagName, long startTs, long endTs);
-    List<PointData> getHistorySnap(String tagName, long startTs, long endTs, Integer interval);
-    List<PointData> getHistorySnap(String tagName, Date startTime, Date endTime, Integer interval);
-    List<PointData> getHistoryStat(String tagName, Date startTime, Date endTime, Integer interval, Integer type);
-    PointData getHistoryStat0(String tagName, Date startTime, Date endTime, Integer type);
-    boolean writeLatest(List<PointData> dataList);
-    boolean writeLatest(PointData data);
-    Map<String, PointData> getHistorySection(long ts, String tagNames);
-    Map<String, PointData> getHistorySection(Date time, String tagNames);
+    Map<String, PointData> getLatest(List<String> tagNames) throws Exception;
+    List<PointData> getHistoryRaw(String tagName, Date startTime, Date endTime) throws Exception;
+    List<PointData> getHistorySnap(String tagName, Date startTime, Date endTime, Integer interval) throws Exception;
+    List<PointData> getHistoryStat(String tagName, Date startTime, Date endTime, Integer interval, Integer type) throws Exception;
+    PointData getHistoryStat0(String tagName, Date startTime, Date endTime, Integer type) throws Exception;
+    Map<String, PointData> getHistorySection(Date time, List<String> tagNames) throws Exception;
 }

+ 0 - 3
data-adapter/src/main/java/com/gyee/dataadapter/dao_mqtt_influxdb_taos/MqttTaosLatestDao.java

@@ -23,9 +23,6 @@ public class MqttTaosLatestDao implements ILatestDao {
     @Resource
     TaosConfig config;
 
-    @Resource
-    private IAdapterService adapterService;
-
     @Override
     public Map<String, PointData> getPointDataLatest(String... tagNames) {
         return new HashMap<>();

+ 131 - 0
data-adapter/src/main/java/com/gyee/dataadapter/dao_mqtt_influxdb_taos/TaosDataService.java

@@ -0,0 +1,131 @@
+package com.gyee.dataadapter.dao_mqtt_influxdb_taos;
+
+import com.gyee.dataadapter.dao.IHistoryDao;
+import com.gyee.dataadapter.entity.PointData;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+public class TaosDataService implements IHistoryDao {
+
+    @Resource
+    TaosConfig config;
+
+    @Override
+    public Map<String, PointData> getLatest(List<String> tagNames) throws Exception {
+        Map<String, PointData> tsDataMap = new HashMap<>();
+        Statement st = config.getInstance().createStatement();
+        String collect = tagNames.stream().map(s -> "'" + s.toLowerCase() + "'").collect(Collectors.joining(","));
+        StringBuilder sql = new StringBuilder();
+        sql.append("select last_row(*),tbname from ").append(config.getDbName()).append(".")
+                .append(config.getAIStableName()).append(" where tbname in (").append(collect).append(") group by tbname");
+        ResultSet rs = st.executeQuery(sql.toString());
+        while (rs.next()) {
+            tsDataMap.put(rs.getString(3).toUpperCase(), new PointData(rs.getDate(1), rs.getDouble(2)));
+        }
+        return tsDataMap;
+    }
+
+    @Override
+    public List<PointData> getHistoryRaw(String tagName, Date startTime, Date endTime) throws Exception {
+        List<PointData> tsDataList = new ArrayList<>();
+        Statement st = config.getInstance().createStatement();
+        String sql = getHistoryRawSql(tagName, startTime.getTime(), endTime.getTime());
+        ResultSet rs = st.executeQuery(sql);
+        while (rs.next()) {
+            tsDataList.add(new PointData(rs.getDate(1), rs.getDouble(2)));
+        }
+        return tsDataList;
+    }
+
+    private String getHistoryRawSql(String tagName, long startTs, long endTs) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("select * from ").append(config.getDbName()).append(".").append(tagName.toLowerCase())
+                .append(" where ts between ").append(startTs).append(" and ").append(endTs);
+        return sb.toString();
+    }
+
+    private String getHistorySnapSql(String tagName, long startTs, long endTs, Integer interval) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("select interp(val,1) from ").append(config.getDbName()).append(".").append(tagName.toLowerCase())
+                .append(" range(").append(startTs).append(",").append(endTs).append(") every(")
+                .append(interval).append("s) fill(prev)");
+        return sb.toString();
+    }
+
+    @Override
+    public List<PointData> getHistorySnap(String tagName, Date startTime, Date endTime, Integer interval) throws Exception {
+        List<PointData> tsDataList = new ArrayList<>();
+        Statement st = config.getInstance().createStatement();
+        String sql = getHistorySnapSql(tagName, startTime.getTime(), endTime.getTime(), interval);
+        ResultSet rs = st.executeQuery(sql);
+        while (rs.next()) {
+            tsDataList.add(new PointData(rs.getDate(1), rs.getDouble(2)));
+        }
+        return tsDataList;
+    }
+
+    @Override
+    public List<PointData> getHistoryStat(String tagName, Date startTime, Date endTime, Integer interval, Integer type) throws Exception {
+        List<PointData> result = new ArrayList<>();
+        Statement st = config.getInstance().createStatement();
+        StringBuilder sb = new StringBuilder();
+        if (type == 2) {
+            sb.append("select max(val) from ");
+        } else if (type == 3) {
+            sb.append("select min(val) from ");
+        } else {
+            sb.append("select avg(val) from ");
+        }
+        sb.append(config.getDbName()).append(".").append(tagName.toLowerCase())
+                .append(" where ts between ").append(startTime.getTime()).append(" and ").append(endTime.getTime())
+                .append(" interval(").append(interval).append("s)");
+        ResultSet rs = st.executeQuery(sb.toString());
+        while (rs.next()) {
+            result.add(new PointData(endTime, rs.getDouble(1)));
+        }
+        return result;
+    }
+
+    @Override
+    public PointData getHistoryStat0(String tagName, Date startTime, Date endTime, Integer type) throws Exception {
+        Statement st = config.getInstance().createStatement();
+        StringBuilder sb = new StringBuilder();
+        if (type == 2) {
+            sb.append("select max(val) from ");
+        } else if (type == 3) {
+            sb.append("select min(val) from ");
+        } else {
+            sb.append("select avg(val) from ");
+        }
+        sb.append(config.getDbName()).append(".").append(tagName.toLowerCase())
+                .append(" where ts between ").append(startTime.getTime()).append(" and ").append(endTime.getTime());
+        ResultSet rs = st.executeQuery(sb.toString());
+        while (rs.next()) {
+            return new PointData(endTime, rs.getDouble(1));
+        }
+        return new PointData(endTime, 0);
+    }
+
+    @Override
+    public Map<String, PointData> getHistorySection(Date ts, List<String> tagNames) throws Exception {
+        Map<String, PointData> tsDataMap = new HashMap<>();
+        Statement st = config.getInstance().createStatement();
+        String collect = tagNames.stream().map(s -> "'" + s.toLowerCase() + "'").collect(Collectors.joining(","));
+        StringBuilder sql = new StringBuilder();
+        sql.append("select interp(val,1),tbname from ").append(config.getDbName()).append(".")
+                .append(config.getAIStableName()).append(" where tbname in (").append(collect)
+                .append(") partition by tbname range(").append(ts.getTime()).append(") fill(prev)");
+        ResultSet rs = st.executeQuery(sql.toString());
+        while (rs.next()) {
+            tsDataMap.put(rs.getString(2).toUpperCase(), new PointData(ts, rs.getDouble(1)));
+        }
+        return tsDataMap;
+    }
+}

+ 3 - 0
data-adapter/src/main/java/com/gyee/dataadapter/entity/PointData.java

@@ -39,6 +39,9 @@ public class PointData {
     }
 
     public long getTs() {
+        if (ts == 0 && time != null) {
+            return time.getTime();
+        }
         return ts;
     }
 

+ 1 - 1
data-adapter/src/main/java/com/gyee/dataadapter/service/IAdapterService.java

@@ -26,5 +26,5 @@ public interface IAdapterService {
     //实时数据接口
     Map<String, PointInfo> getLatestData(String paths);
 
-    Map<String, PointData> getLatestData2(String... paths);
+    Map<String, PointData> getLatestData2(List<String> paths);
 }

+ 0 - 73
data-adapter/src/main/java/com/gyee/dataadapter/service/TaosDataService.java

@@ -1,73 +0,0 @@
-package com.gyee.dataadapter.service;
-
-import com.gyee.dataadapter.dao.IHistoryDao;
-import com.gyee.dataadapter.entity.PointData;
-import org.springframework.stereotype.Service;
-
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-@Service
-public class TaosDataService implements IHistoryDao {
-    @Override
-    public Map<String, PointData> getLatest(String tagNames) {
-        return Collections.emptyMap();
-    }
-
-    @Override
-    public Map<String, PointData> getLatest(String... tagNames) {
-        return Collections.emptyMap();
-    }
-
-    @Override
-    public List<PointData> getHistoryRaw(String tagName, Date startTime, Date endTime) {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public List<PointData> getHistoryRaw(String tagName, long startTs, long endTs) {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public List<PointData> getHistorySnap(String tagName, long startTs, long endTs, Integer interval) {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public List<PointData> getHistorySnap(String tagName, Date startTime, Date endTime, Integer interval) {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public List<PointData> getHistoryStat(String tagName, Date startTime, Date endTime, Integer interval, Integer type) {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public PointData getHistoryStat0(String tagName, Date startTime, Date endTime, Integer type) {
-        return null;
-    }
-
-    @Override
-    public boolean writeLatest(List<PointData> dataList) {
-        return false;
-    }
-
-    @Override
-    public boolean writeLatest(PointData data) {
-        return false;
-    }
-
-    @Override
-    public Map<String, PointData> getHistorySection(long ts, String tagNames) {
-        return Collections.emptyMap();
-    }
-
-    @Override
-    public Map<String, PointData> getHistorySection(Date time, String tagNames) {
-        return Collections.emptyMap();
-    }
-}

+ 44 - 12
data-adapter/src/main/java/com/gyee/dataadapter/service/TsDataService.java

@@ -24,17 +24,29 @@ public class TsDataService {
 
     public Map<String, PointData> getLatest(String tagNames) {
         String[] split = tagNames.split(",");
-        return getLatest(split);
+        return getLatest(Arrays.asList(split));
     }
 
-    public Map<String, PointData> getLatest(String... tagNames) {
-        Map<Boolean, List<String>> nxFgs = Arrays.stream(tagNames).collect(Collectors.groupingBy(tn -> tn.startsWith("NX_FGS_")));
-        return adapterService.getLatestData2(tagNames);
+    public Map<String, PointData> getLatest(List<String> tagNames) {
+        Map<Boolean, List<String>> nxFgs = tagNames.stream().collect(Collectors.groupingBy(tn -> tn.startsWith("NX_FGS_")));
+        Map<String, PointData> latest = null;
+        try {
+            latest = historyDao.getLatest(nxFgs.get(true));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        Map<String, PointData> data2 = adapterService.getLatestData2(nxFgs.get(false));
+        latest.putAll(data2);
+        return latest;
     }
 
     public List<PointData> getHistoryRaw(String tagName, Date startTime, Date endTime) {
         try {
-            return adapterService.getPointData(startTime, endTime, 1, null, tagName);
+            if (tagName.startsWith("NX_FGS_")) {
+                return historyDao.getHistoryRaw(tagName, startTime, endTime);
+            } else {
+                return adapterService.getPointData(startTime, endTime, 1, null, tagName);
+            }
         } catch (Exception e) {
             log.error("异常点:" + tagName);
             log.error(e.getMessage());
@@ -53,7 +65,11 @@ public class TsDataService {
     public List<PointData> getHistorySnap(String tagName, Date startTime, Date endTime, Integer interval) {
         if (interval == null || interval == 0) interval = 60;
         try {
-            return adapterService.getPointData(startTime, endTime, 0, interval, tagName);
+            if (tagName.startsWith("NX_FGS_")) {
+                return historyDao.getHistorySnap(tagName, startTime, endTime, interval);
+            } else {
+                return adapterService.getPointData(startTime, endTime, 0, interval, tagName);
+            }
         } catch (Exception e) {
             log.error("异常点:" + tagName);
             log.error(e.getMessage());
@@ -72,7 +88,11 @@ public class TsDataService {
         if (interval == null || interval == 0) interval = 60;
         if (type == null || type < 2 || type > 4) type = 4;
         try {
-            return adapterService.getPointData(startTime, endTime, type, interval, tagName);
+            if (tagName.startsWith("NX_FGS_")) {
+                return historyDao.getHistoryStat(tagName, startTime, endTime, interval, type);
+            } else {
+                return adapterService.getPointData(startTime, endTime, type, interval, tagName);
+            }
         } catch (Exception e) {
             log.error("异常点:" + tagName);
             log.error(e.getMessage());
@@ -81,9 +101,18 @@ public class TsDataService {
     }
 
     public PointData getHistoryStat0(String tagName, Date startTime, Date endTime, Integer type) {
-        int interval = (int) TimeUnit.MILLISECONDS.toMinutes(endTime.getTime() - startTime.getTime());
-        List<PointData> pd = adapterService.getPointData(startTime, endTime, type, interval, tagName);
-        return pd.get(0);
+        if (tagName.startsWith("NX_FGS_")) {
+            try {
+                return historyDao.getHistoryStat0(tagName, startTime, endTime, type);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        } else {
+            int interval = (int) TimeUnit.MILLISECONDS.toMinutes(endTime.getTime() - startTime.getTime());
+            List<PointData> pd = adapterService.getPointData(startTime, endTime, type, interval, tagName);
+            return pd.get(0);
+        }
+        return new PointData();
     }
 
     public boolean writeLatest(List<PointData> dataList) {
@@ -99,13 +128,16 @@ public class TsDataService {
     }
 
     public Map<String, PointData> getHistorySection(Date time, String tagNames) {
+        Map<Boolean, List<String>> nxFgs = Arrays.stream(tagNames.split(",")).collect(
+                Collectors.groupingBy(tn -> tn.startsWith("NX_FGS_")));
         Map<String, PointData> result = new HashMap<>();
-        String[] split = tagNames.split(",");
         try {
-            for (String tagName : split) {
+            for (String tagName : nxFgs.get(false)) {
                 List<PointData> pdsMap = adapterService.getPointData(time, time, 1, null, tagName);
                 result.put(tagName, pdsMap.get(0));
             }
+            Map<String, PointData> latest = historyDao.getHistorySection(time, nxFgs.get(true));
+            result.putAll(latest);
             return result;
         } catch (Exception e) {
             log.error(e.getMessage());

+ 2 - 460
generationXK-service/src/main/java/com/gyee/generation/util/realtimesource/EdosUtil.java

@@ -211,7 +211,6 @@ public class EdosUtil implements IEdosUtil {
 
     }
 
-
     @Override
     public List<PointData> getHistoryDatasSnap(ProBasicPowerstationPoint point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
 
@@ -396,7 +395,6 @@ public class EdosUtil implements IEdosUtil {
         }
     }
 
-
     @Override
     public List<PointData> getHistoryDatasRaw(ProBasicPowerstationPoint point, Long beginDate, Long endDate) throws Exception {
 
@@ -656,67 +654,6 @@ public class EdosUtil implements IEdosUtil {
 
     }
 
-
-    @Override
-    public List<PointData> getHistoryDatasRaw(ProBasicEquipmentPoint point, Long beginDate, Long endDate) throws Exception {
-        if (StringUtils.notEmp(point) && StringUtils.notEmp(point.getNemCode()) && !initialcode.equals(point.getNemCode())) {
-            Optional<String> tagName = Optional.ofNullable(point.getNemCode());
-            Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationId());
-            Optional<String> thingType = Optional.ofNullable(point.getModelId());
-            Optional<String> uniformCode = Optional.ofNullable(point.getUniformCode());
-            Optional<Long> startTs = Optional.ofNullable(beginDate);
-            Optional<Long> endTs = Optional.ofNullable(endDate);
-            try {
-                String url = "";
-                if (point.getNemCode().startsWith("GF-")) {
-                    url = baseURL2 + "/history/snap?null=0";
-                } else {
-                    url = baseURL + "/history/snap?null=0";
-                }
-                //tagName 或thingType,thingId,uniformCode可以确定一个标签点
-                if (tagName.isPresent())
-                    url = url + "&tagName=" + tagName.get();
-                else {
-                    if (thingType.isPresent())
-                        url = url + "&thingType=" + thingType.get();
-                    if (thingId.isPresent())
-                        url = url + "&thingId=" + thingId.get();
-                    if (uniformCode.isPresent())
-                        url = url + "&uniformCodes=" + uniformCode.get();
-                }
-
-                if (startTs.isPresent())
-                    url = url + "&startTs=" + startTs.get();
-                if (endTs.isPresent())
-                    url = url + "&endTs=" + endTs.get();
-
-                ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
-                JSONArray jsonArray = resp.getBody();
-                if (jsonArray != null)
-                    return JsonObjectHelper.phrasePointData(jsonArray, point.getNemCode());
-                else {
-                    return ErrorRequest.RequestListError(point.getNemCode());
-                }
-            } catch (HttpClientErrorException exception) {
-                if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
-                    //System.out.println("404请求错误");
-                    return ErrorRequest.RequestListError(point.getNemCode());
-                } else {
-                    throw exception;
-                }
-            }
-        } else {
-            List<PointData> pols = new ArrayList<>();
-            PointData po = new PointData();
-            po.setEdnaId(point.getNemCode());
-            po.setPointValueInDouble(0.0);
-            po.setPointTime(0l);
-            pols.add(po);
-            return pols;
-        }
-
-    }
-
     @Override
     public PointData getRealData(String pointid) throws Exception {
 
@@ -857,7 +794,6 @@ public class EdosUtil implements IEdosUtil {
 
     }
 
-
     @Override
     public List<PointData> getRealData(List<String> pointids) throws Exception {
 
@@ -949,88 +885,6 @@ public class EdosUtil implements IEdosUtil {
     }
 
     @Override
-    public Map<String, Double> getRealDataMap(String... pointids) throws Exception {
-
-
-        if (StringUtils.notEmp(pointids)) {
-            List<String> idls = new ArrayList<>();
-            for (String str : pointids) {
-                if (StringUtils.notEmp(str) && !initialcode.equals(str)) {
-                    idls.add(str);
-                }
-            }
-            if (!idls.isEmpty()) {
-                String pointIdString = StringUtil.join(pointids, ",");
-                Optional<String> keys = Optional.ofNullable(pointIdString);
-                String url = baseURL + "/latest?null=0";
-                if (pointIdString.startsWith("GF-")) {
-                    url = baseURL2 + "/latest?null=0";
-                }
-                try {
-                    if (keys.isPresent())
-                        url = url + "&keys=" + keys.get();
-                    else
-                        return null;
-                    ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
-                    JSONObject jsonArray = resp.getBody();
-                    if (StringUtils.isNotEmpty(jsonArray)) {
-                        Iterator<String> sIterator = jsonArray.keySet().iterator();
-                        Map<String, Double> resultMap = new HashMap();
-                        while (sIterator.hasNext()) {
-                            // 获得key
-                            String key = sIterator.next();
-                            // 根据key获得value, value也可以是JSONObject,JSONArray,使用对应的参数接收即可
-                            JSONObject jsonData = jsonArray.getJSONObject(key);
-                            Long ts = jsonData.getLong("ts");
-                            String pointValue = null;
-                            if (jsonData.containsKey("doubleValue")) {
-                                pointValue = jsonData.getString("doubleValue");
-                            } else if (jsonData.containsKey("booleanValue")) {
-                                pointValue = jsonData.getString("booleanValue");
-                            } else if (jsonData.containsKey("longValue")) {
-                                pointValue = jsonData.getString("longValue");
-                            } else if (jsonData.containsKey("stringValue")) {
-                                pointValue = jsonData.getString("stringValue");
-                            }
-                            resultMap.put(key, Double.parseDouble(pointValue));
-                        }
-                        return resultMap;
-
-                    } else
-                        return ErrorRequest.RequestMapError();
-                } catch (HttpClientErrorException exception) {
-                    if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
-                        //System.out.println("404请求错误");
-                        return ErrorRequest.RequestMapError();
-                    } else {
-                        throw exception;
-                    }
-                }
-            } else {
-                Map<String, Double> map = new HashMap<>();
-                for (String str : pointids) {
-
-                    map.put(str, 0.0);
-
-                }
-                return map;
-            }
-        } else {
-
-            Map<String, Double> map = new HashMap<>();
-
-            for (String str : pointids) {
-
-                map.put(str, 0.0);
-
-            }
-            return map;
-        }
-
-    }
-
-
-    @Override
     public List<PointData> getHistoryDatasSnap(String pointid, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
 
         if (StringUtils.notEmp(pointid) && !initialcode.equals(pointid)) {
@@ -1158,58 +1012,6 @@ public class EdosUtil implements IEdosUtil {
 
     }
 
-
-    @Override
-    public List<PointData> getHistoryDatasRaw(String pointid, Long beginDate, Long endDate) throws Exception {
-
-
-        if (StringUtils.notEmp(pointid) && !initialcode.equals(pointid)) {
-            Optional<String> tagName = Optional.ofNullable(pointid);
-            Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
-            Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
-
-            try {
-
-                String url = baseURL + "/history/raw?null=0";
-                if (pointid.startsWith("GF-")) {
-                    url = baseURL2 + "/history/raw?null=0";
-                }
-                //tagName 或thingType,thingId,uniformCode可以确定一个标签点
-                if (tagName.isPresent())
-                    url = url + "&tagName=" + tagName.get();
-                if (startTs.isPresent())
-                    url = url + "&startTs=" + startTs.get();
-                if (endTs.isPresent())
-                    url = url + "&endTs=" + endTs.get();
-
-                ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
-
-                JSONArray jsonArray = resp.getBody();
-                if (jsonArray != null)
-                    return JsonObjectHelper.phrasePointData(jsonArray, pointid);
-                else {
-                    return ErrorRequest.RequestListError(pointid);
-                }
-            } catch (HttpClientErrorException exception) {
-                if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
-                    //System.out.println("404请求错误");
-                    return ErrorRequest.RequestListError(pointid);
-                } else {
-                    throw exception;
-                }
-            }
-        } else {
-            List<PointData> pols = new ArrayList<>();
-            PointData po = new PointData();
-            po.setEdnaId(pointid);
-            po.setPointValueInDouble(0.0);
-            po.setPointTime(0l);
-            pols.add(po);
-            return pols;
-        }
-
-    }
-
     @Override
     public List<PointData> getHistStat(ProBasicEquipmentPoint point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
 
@@ -1421,90 +1223,7 @@ public class EdosUtil implements IEdosUtil {
 
     @Override
     public DNAStatVal[] getHistStat(String point, Long beginDate, Long endDate, Integer pried) throws Exception {
-
-
-        if (StringUtils.notEmp(point) && !initialcode.equals(point)) {
-            Optional<String> tagName = Optional.ofNullable(point);
-            Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
-            Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
-            //通过时间区间和时间间隔获取点数
-            Optional<Integer> interval = Optional.ofNullable(pried);
-
-            try {
-                String url = baseURL + "/history/stat?null=0";
-                if (point.startsWith("GF-")) {
-                    url = baseURL2 + "/history/stat?null=0";
-                }
-                //tagName 或thingType,thingId,uniformCode可以确定一个标签点
-                if (tagName.isPresent())
-                    url = url + "&tagName=" + tagName.get();
-                if (startTs.isPresent())
-                    url = url + "&startTs=" + startTs.get();
-                if (endTs.isPresent())
-                    url = url + "&endTs=" + endTs.get();
-                if (interval.isPresent())
-                    url = url + "&interval=" + interval.get();
-
-                ////System.out.println(restTemplate.getForEntity(url, JSONArray.class));
-                ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
-                if (resp != null) {
-                    JSONArray jsonArray = resp.getBody();
-                    if (jsonArray == null || jsonArray.size() <= 0) {
-                        DNAStatVal[] dnaVal = new DNAStatVal[1];
-                        DNAVal errorData = new DNAVal();
-                        errorData.Status = 0;
-
-                        DNAStatVal val = new DNAStatVal();
-                        val.avg = errorData;
-                        val.max = errorData;
-                        val.min = errorData;
-                        dnaVal[0] = val;
-                        return dnaVal;
-                    } else {
-                        return JsonObjectHelper.phraseDNAVal(jsonArray);
-                    }
-                } else {
-                    return null;
-                }
-
-            } catch (HttpClientErrorException exception) {
-                if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
-                    //System.out.println("404请求错误");
-                    DNAStatVal val = new DNAStatVal();
-                    DNAStatVal[] dnaVal = new DNAStatVal[1];
-                    DNAVal errorData = new DNAVal();
-                    errorData.Status = 0;
-                    val.avg = errorData;
-                    val.max = errorData;
-                    val.min = errorData;
-                    dnaVal[0] = val;
-                    return dnaVal;
-
-                } else {
-                    DNAStatVal val = new DNAStatVal();
-                    DNAStatVal[] dnaVal = new DNAStatVal[1];
-                    DNAVal errorData = new DNAVal();
-                    errorData.Status = 0;
-                    val.avg = errorData;
-                    val.max = errorData;
-                    val.min = errorData;
-                    dnaVal[0] = val;
-                    return dnaVal;
-                }
-            }
-        } else {
-            DNAStatVal val = new DNAStatVal();
-            DNAStatVal[] dnaVal = new DNAStatVal[1];
-            DNAVal errorData = new DNAVal();
-            errorData.Status = 0;
-            val.avg = errorData;
-            val.max = errorData;
-            val.min = errorData;
-            dnaVal[0] = val;
-            return dnaVal;
-        }
-
-
+        return new DNAStatVal[0];
     }
 
     private JSONObject convertPointData(PointData pd) {
@@ -1519,65 +1238,6 @@ public class EdosUtil implements IEdosUtil {
     }
 
     @Override
-    public void updatePoint(PointData point) throws Exception {
-        String url = baseURL + "/history";
-        if (point.getEdnaId().startsWith("GF-")) {
-            url = baseURL2 + "/history";
-        }
-        try {
-            String result = restTemplate.postForObject(url, convertPointData(point), String.class);
-        } catch (HttpClientErrorException exception) {
-            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
-                return;
-            } else {
-                throw exception;
-            }
-        }
-    }
-
-    @Override
-    public DNAVal[] getRealtimeTagValues(String... tagNames) throws Exception {
-
-
-        if (StringUtils.notEmp(tagNames) && tagNames.length > 0) {
-
-
-            DNAVal[] result = new DNAVal[tagNames.length];
-            for (int i = 0; i < tagNames.length; i++) {
-                if (StringUtils.notEmp(tagNames[i]) && !initialcode.equals(tagNames[i])) {
-                    PointData po = getRealData(tagNames[i]);
-                    DNAVal val = new DNAVal();
-                    val.DValue = po.getPointValueInDouble();
-                    if (StringUtils.notEmp(po.getPointTime())) {
-                        val.Time = Integer.valueOf(String.valueOf(po.getPointTime()));
-                    } else {
-                        val.Time = 0;
-                    }
-
-                    val.Status = 1;
-                    result[i] = val;
-                } else {
-                    DNAVal val = new DNAVal();
-                    val.Status = 0;
-                    result[i] = val;
-                }
-
-            }
-            return result;
-        } else {
-            DNAVal[] result = new DNAVal[tagNames.length];
-            for (int i = 0; i < tagNames.length; i++) {
-                DNAVal val = new DNAVal();
-                val.Status = 0;
-                result[i] = val;
-
-            }
-            return result;
-        }
-
-    }
-
-    @Override
     public void updatePoint(List<PointData> pointls) throws Exception {
         String url = baseURL + "/history/batch";
         if (!pointls.isEmpty()) {
@@ -1680,128 +1340,14 @@ public class EdosUtil implements IEdosUtil {
 
     @Override
     public void sendMultiPoint(String[] realvalue, DNAVal[] pointls) throws Exception {
-        String url = baseURL + "/latest/batch";
 
-        List<JSONObject> writeDataList = new ArrayList<>();
-        if (realvalue != null && pointls != null & realvalue.length == pointls.length) {
-            for (int i = 0; i < realvalue.length; i++) {
-                PointData writeData = new PointData();
-                writeData.setEdnaId(realvalue[i]);
-                writeData.setPointValueInDouble(pointls[i].DValue);
-                writeData.setPointTime((long) pointls[i].Time);
-                JSONObject jsonObject = convertPointData(writeData);
-                writeDataList.add(jsonObject);
-            }
-
-            try {
-                String result = restTemplate.postForObject(url, writeDataList, String.class);
-            } catch (HttpClientErrorException exception) {
-                if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
-                    System.out.println("404请求错误");
-                } else {
-                    throw exception;
-                }
-            }
-        } else
-            return;
     }
 
-
     @Override
     public DNAVal[] getHistMatrix(String[] nameList, int tTime) throws Exception {
-        if (StringUtils.notEmp(nameList)) {
-            List<String> idls = new ArrayList<>();
-            for (String str : nameList) {
-                if (StringUtils.notEmp(str) && !initialcode.equals(str)) {
-                    idls.add(str);
-                }
-            }
-            if (!idls.isEmpty() && idls.size() == nameList.length) {
-                String tagNameString = StringUtil.join(nameList, ",");
-                Long time = Long.valueOf(tTime);
-                Optional<String> tagName = Optional.ofNullable(tagNameString);
-                Optional<Long> ts = Optional.ofNullable(time * 1000);
-                String url = baseURL + "/history/section?tagNames=" + tagName.get() + "&ts=" + ts.get();
-                try {
-                    ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
-                    JSONObject jsonObject = resp.getBody();
-                    if (StringUtils.isNotEmpty(jsonObject) && !jsonObject.isEmpty()) {
-                        return JsonObjectHelper.phraseDNAVal(jsonObject, nameList);
-                    } else {
-                        DNAVal[] errorResult = new DNAVal[nameList.length];
-                        for (int i = 0; i < nameList.length; i++) {
-                            DNAVal val = new DNAVal();
-                            val.Status = 0;
-                            errorResult[i] = val;
-                        }
-                        return errorResult;
-                    }
-                } catch (Exception e) {
-                    DNAVal[] errorResult = new DNAVal[nameList.length];
-                    for (int i = 0; i < nameList.length; i++) {
-                        DNAVal val = new DNAVal();
-                        val.Status = 0;
-                        errorResult[i] = val;
-                    }
-                    return errorResult;
-                }
-            } else {
-
-                DNAVal[] errorResult = new DNAVal[nameList.length];
-                for (int i = 0; i < nameList.length; i++) {
-                    DNAVal val = new DNAVal();
-                    val.Status = 0;
-                    errorResult[i] = val;
-                }
-                return errorResult;
-            }
-        } else {
-
-            DNAVal[] errorResult = new DNAVal[nameList.length];
-            for (int i = 0; i < nameList.length; i++) {
-                DNAVal val = new DNAVal();
-                val.Status = 0;
-                errorResult[i] = val;
-            }
-            return errorResult;
-        }
-
-
-    }
-
-    @Override
-    public void sendMultiRealTimeParamete(List<RealTimeParameterVo> pointls) throws Exception {
-
-
-        String url = baseURL + "/latest/batch";
-        List<JSONObject> writeList = new ArrayList<>();
-
-        for (RealTimeParameterVo entity : pointls) {
-            writeList.add(convertRealTimeParamete(entity));
-        }
-        try {
-            String result = restTemplate.postForObject(url, writeList, String.class);
-        } catch (HttpClientErrorException exception) {
-            if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
-                System.out.println("404请求错误");
-            } else {
-                throw exception;
-            }
-        }
+        return new DNAVal[0];
     }
 
-    private JSONObject convertRealTimeParamete(RealTimeParameterVo pd) {
-        JSONObject jo = new JSONObject();
-        jo.put("tagName", pd.getPoint());
-        JSONObject joo = new JSONObject();
-        joo.put("ts", pd.getTime().getTime());
-        joo.put("status", 0);
-        joo.put("doubleValue", pd.getInsertValue());
-        jo.put("tsData", joo);
-        return jo;
-    }
-
-
     @Override
     public List<PointData> getHistoryDatasSnap(String pointid, Long beginDate, Long endDate) throws Exception {
 
@@ -1910,10 +1456,7 @@ public class EdosUtil implements IEdosUtil {
 
     }
 
-
     //多点切面数据
-
-
     @Override
     public List<PointData> getHistMatrix(List<String> nameList, long tTime) throws Exception {
         String tagNameString = StringUtil.join(nameList, ",");
@@ -1983,5 +1526,4 @@ public class EdosUtil implements IEdosUtil {
 
     }
 
-
 }

+ 0 - 58
generationXK-service/src/main/java/com/gyee/generation/util/realtimesource/IEdosUtil.java

@@ -23,7 +23,6 @@ public interface IEdosUtil {
      */
     public PointData getRealData(ProBasicPowerstationPoint point) throws Exception;
 
-
     /**
      * 通过风场测点获得测点切面数据
      *
@@ -34,7 +33,6 @@ public interface IEdosUtil {
      */
     public PointData getSectionData(String point, Long date) throws Exception;
 
-
     /**
      * 通过风场测点获得测点切面数据
      *
@@ -102,18 +100,6 @@ public interface IEdosUtil {
     public List<PointData> getHistoryDatasSnap(ProBasicEquipmentPoint point, Long beginDate, Long endDate, Long count, Long pried) throws Exception;
 
     /**
-     * 通过风机测点获得测点历史存储数据,存多少取多少
-     *
-     * @param point     只是用了id字段,作为唯一标识
-     * @param beginDate 开始时间(秒级)
-     * @param endDate   结束时间(秒级)
-     * @return
-     * @throws Exception
-     */
-    public List<PointData> getHistoryDatasRaw(ProBasicEquipmentPoint point, Long beginDate, Long endDate) throws Exception;
-
-
-    /**
      * 通过风机测点获得测点实时数据
      *
      * @param pointid 测点编号
@@ -141,15 +127,6 @@ public interface IEdosUtil {
     public List<PointData> getRealData(List<String> pointids) throws Exception;
 
     /**
-     * 通过全局点名获得测点实时数据 读取多个点
-     *
-     * @param pointids 测点的数组
-     * @return Map集合
-     * @throws Exception
-     */
-    public Map<String, Double> getRealDataMap(String... pointids) throws Exception;
-
-    /**
      * 通过全局点名获得历史数据快照
      *
      * @param pointid   全局点名
@@ -163,18 +140,6 @@ public interface IEdosUtil {
     public List<PointData> getHistoryDatasSnap(String pointid, Long beginDate, Long endDate, Long count, Long pried) throws Exception;
 
     /**
-     * 通过风机测点获得测点历史存储数据,存多少取多少
-     *
-     * @param pointid   全局点名
-     * @param beginDate 开始时间(秒级)
-     * @param endDate   结束时间(秒级)
-     * @return
-     * @throws Exception
-     */
-    public List<PointData> getHistoryDatasRaw(String pointid, Long beginDate, Long endDate) throws Exception;
-
-
-    /**
      * 通过风机测点获得测点指定时间周期的统计数据
      *
      * @param point     只是用了id字段,作为唯一标识
@@ -229,25 +194,6 @@ public interface IEdosUtil {
     public DNAStatVal[] getHistStat(String point, Long beginDate, Long endDate, Integer pried) throws Exception;
 
     /**
-     * 补录单点历史数据
-     *
-     * @param point 测点对象
-     * @return
-     * @throws Exception
-     */
-    public void updatePoint(PointData point) throws Exception;
-
-    /**
-     * 批量查询实时数据
-     *
-     * @param tagNames 测点字符串数组
-     * @return
-     * @throws Exception
-     */
-
-    public DNAVal[] getRealtimeTagValues(String... tagNames) throws Exception;
-
-    /**
      * 批量插入历史数据
      *
      * @param pointls 测点对象集合
@@ -289,12 +235,8 @@ public interface IEdosUtil {
      */
     public DNAVal[] getHistMatrix(String[] nameList, int tTime) throws Exception;
 
-
-    public void sendMultiRealTimeParamete(List<RealTimeParameterVo> pointls) throws Exception;
-
     public List<PointData> getHistoryDatasSnap(String pointid, Long beginDate, Long endDate) throws Exception;
 
-
     /**
      * @param nameList 测点名称列表集合
      * @param tTime    时间点(秒级)

+ 1 - 0
generationXK-service/src/test/java/com/gyee/generation/SaticScheduleCALTaskTest.java

@@ -27,6 +27,7 @@ public class SaticScheduleCALTaskTest {
 
     @Test
     public void all() throws Exception {
+        saticSchedulePgTask.ndgfzb();
         //        saticScheduleCALTask.status_powerRationing();//status_middleStatusReal
         //        saticScheduleCALTask.status_statusReal();
         //          saticScheduleCALTask.calculate_powerRationing();