|
@@ -4,7 +4,6 @@ package com.gyee.frame.util.golden;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.gyee.frame.common.conf.V2Config;
|
|
|
-import com.gyee.frame.common.spring.InitialRunner;
|
|
|
import com.gyee.frame.model.auto.Windpowerstationpointnew;
|
|
|
import com.gyee.frame.model.auto.Windturbinetestingpointnew;
|
|
|
import com.gyee.frame.model.custom.DNAStatVal;
|
|
@@ -23,11 +22,13 @@ import java.util.*;
|
|
|
|
|
|
/**
|
|
|
*/
|
|
|
-public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
+public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
|
|
|
|
|
|
+ private final String JKFC="JKFC.";
|
|
|
+ private final String JKFJ="JKFJ.";
|
|
|
private RestTemplate restTemplate =new RestTemplate();
|
|
|
|
|
|
private String baseURL = V2Config.getBaseurl();
|
|
@@ -35,7 +36,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public PointData getRealData(Windpowerstationpointnew point) throws Exception {
|
|
|
|
|
|
- if(!InitialRunner.hpmap.containsKey(point.getCode()))
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|
|
@@ -94,7 +95,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
@Override
|
|
|
public List<PointData> getHistoryDatasSnap(Windpowerstationpointnew point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
|
- if(!InitialRunner.hpmap.containsKey(point.getCode()))
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|
|
@@ -233,7 +234,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
private void getHistsnapSameTiem(String pointid, Long beginDate, Long pried,
|
|
|
List<PointData> resultList) {
|
|
|
|
|
|
- if(!InitialRunner.hpmap.containsKey(pointid))
|
|
|
+ if(!pointid.startsWith(JKFC) && !pointid.startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|
|
@@ -282,7 +283,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
@Override
|
|
|
public List<PointData> getHistoryDatasRaw(Windpowerstationpointnew point, Long beginDate, Long endDate) throws Exception {
|
|
|
- if(!InitialRunner.hpmap.containsKey(point.getCode()))
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|
|
@@ -348,7 +349,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
@Override
|
|
|
public PointData getRealData(Windturbinetestingpointnew point) throws Exception {
|
|
|
- if(!InitialRunner.hpmap.containsKey(point.getCode()))
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|
|
@@ -408,7 +409,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
@Override
|
|
|
public List<PointData> getHistoryDatasSnap(Windturbinetestingpointnew point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
|
- if(!InitialRunner.hpmap.containsKey(point.getCode()))
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|
|
@@ -542,7 +543,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public List<PointData> getHistoryDatasRaw(Windturbinetestingpointnew point, Long beginDate, Long endDate) throws Exception {
|
|
|
|
|
|
- if(!InitialRunner.hpmap.containsKey(point.getCode()))
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|
|
@@ -609,7 +610,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
public PointData getRealData(String pointid) throws Exception {
|
|
|
|
|
|
|
|
|
- if(!InitialRunner.hpmap.containsKey(pointid))
|
|
|
+ if(StringUtils.notEmp(pointid) && !pointid.startsWith(JKFC) && !pointid.startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|
|
@@ -663,7 +664,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
if(StringUtils.notEmp(pointids) )
|
|
|
{
|
|
|
- if(!InitialRunner.hpmap.containsKey(pointids[0]))
|
|
|
+ if(!pointids[0].startsWith(JKFC) && !pointids[0].startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|
|
@@ -810,7 +811,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
if(StringUtils.notEmp(pointids) )
|
|
|
{
|
|
|
|
|
|
- if(!InitialRunner.hpmap.containsKey(pointids.get(0)))
|
|
|
+ if(!pointids.get(0).startsWith(JKFC) && !pointids.get(0).startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|
|
@@ -955,7 +956,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
if(StringUtils.notEmp(pointids) )
|
|
|
{
|
|
|
|
|
|
- if(!InitialRunner.hpmap.containsKey(pointids[0]))
|
|
|
+ if(!pointids[0].startsWith(JKFC) && !pointids[0].startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|
|
@@ -1048,7 +1049,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
public List<PointData> getHistoryDatasSnap(String pointid, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
|
|
|
|
|
|
|
- if(!InitialRunner.hpmap.containsKey(pointid))
|
|
|
+ if(StringUtils.notEmp(pointid) && !pointid.startsWith(JKFC) && !pointid.startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|
|
@@ -1174,7 +1175,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public List<PointData> getHistoryDatasRaw(String pointid, Long beginDate, Long endDate) throws Exception {
|
|
|
|
|
|
- if(!InitialRunner.hpmap.containsKey(pointid))
|
|
|
+ if(StringUtils.notEmp(pointid) && StringUtils.notEmp(pointid) && !pointid.startsWith(JKFC) && !pointid.startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|
|
@@ -1229,7 +1230,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public List<PointData> getHistStat(Windturbinetestingpointnew point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
|
|
|
|
|
|
- if(!InitialRunner.hpmap.containsKey(point.getCode()))
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|
|
@@ -1311,7 +1312,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
@Override
|
|
|
public List<PointData> getHistStat(Windpowerstationpointnew point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
|
|
|
- if(!InitialRunner.hpmap.containsKey(point.getCode()))
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|
|
@@ -1387,7 +1388,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public List<PointData> getHistStat(String pointid, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
|
|
|
|
|
|
- if(!InitialRunner.hpmap.containsKey(pointid))
|
|
|
+ if(StringUtils.notEmp(pointid) && !pointid.startsWith(JKFC) && !pointid.startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|
|
@@ -1452,7 +1453,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public DNAStatVal[] getHistStat(String point, Long beginDate, Long endDate, Integer pried) throws Exception {
|
|
|
|
|
|
- if(!InitialRunner.hpmap.containsKey(point))
|
|
|
+ if(StringUtils.notEmp(point) && !point.startsWith(JKFC) && !point.startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|
|
@@ -1556,23 +1557,27 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public void updatePoint(PointData point) throws Exception {
|
|
|
|
|
|
- if(!InitialRunner.hpmap.containsKey(point.getEdnaId()))
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getEdnaId()) &&!point.getEdnaId().startsWith(JKFC) && !point.getEdnaId().startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|
|
|
{
|
|
|
baseURL = V2Config.getHealthurl();
|
|
|
}
|
|
|
- String url = baseURL + "/history";
|
|
|
- try {
|
|
|
- String result = restTemplate.postForObject(url, convertPointData(point), String.class);
|
|
|
- } catch (HttpClientErrorException exception) {
|
|
|
- if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
|
- return;
|
|
|
- } else {
|
|
|
- throw exception;
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getEdnaId()))
|
|
|
+ {
|
|
|
+ String url = baseURL + "/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
|
|
@@ -1581,7 +1586,8 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
if (StringUtils.notEmp(tagNames) && tagNames.length > 0) {
|
|
|
|
|
|
- if(!InitialRunner.hpmap.containsKey(tagNames[0]))
|
|
|
+
|
|
|
+ if(!tagNames[0].startsWith(JKFC) && !tagNames[0].startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|
|
@@ -1630,7 +1636,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
if(null!=pointls && !pointls.isEmpty())
|
|
|
{
|
|
|
- if(!InitialRunner.hpmap.containsKey(pointls.get(0).getEdnaId()))
|
|
|
+ if(!pointls.get(0).getEdnaId().startsWith(JKFC) && !pointls.get(0).getEdnaId().startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|
|
@@ -1659,57 +1665,52 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
// @Override
|
|
|
// public void sendSinglePoint(PointData point) throws Exception {
|
|
|
-// String url = baseURL + "/latest";
|
|
|
//
|
|
|
-//
|
|
|
-// try {
|
|
|
-// String result = restTemplate.postForObject(url, convertPointData(point), String.class);
|
|
|
-// } catch (HttpClientErrorException exception) {
|
|
|
-// if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
|
-// return;
|
|
|
-// } else {
|
|
|
-// throw exception;
|
|
|
+// if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getEdnaId()))
|
|
|
+// {
|
|
|
+// if(!point.getEdnaId().startsWith(JKFC) && !point.getEdnaId().startsWith(JKFJ))
|
|
|
+// {
|
|
|
+// baseURL = V2Config.getBaseurl();
|
|
|
+// }else
|
|
|
+// {
|
|
|
+// baseURL = V2Config.getHealthurl();
|
|
|
// }
|
|
|
-// }
|
|
|
-// }
|
|
|
+// String url = baseURL + "/latest";
|
|
|
//
|
|
|
-// @Override
|
|
|
-// public void sendMultiPoint(List<PointData> pointls) throws Exception {
|
|
|
-//
|
|
|
-// String url = baseURL + "/latest/batch";
|
|
|
-// List<JSONObject> writeList = new ArrayList<>();
|
|
|
//
|
|
|
-// for (PointData entity : pointls) {
|
|
|
-// writeList.add(convertPointData(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;
|
|
|
+// 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 void sendMultiPoint(String[] realvalue, DNAVal[] pointls) throws Exception {
|
|
|
-// String url = baseURL + "/latest/batch";
|
|
|
+// public void sendMultiPoint(List<PointData> pointls) throws Exception {
|
|
|
//
|
|
|
-// 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);
|
|
|
+// if(null !=pointls && !pointls.isEmpty())
|
|
|
+// {
|
|
|
+// if(!pointls.get(0).getEdnaId().startsWith(JKFC) && !pointls.get(0).getEdnaId().startsWith(JKFJ))
|
|
|
+// {
|
|
|
+// baseURL = V2Config.getBaseurl();
|
|
|
+// }else
|
|
|
+// {
|
|
|
+// baseURL = V2Config.getHealthurl();
|
|
|
// }
|
|
|
+// String url = baseURL + "/latest/batch";
|
|
|
+// List<JSONObject> writeList = new ArrayList<>();
|
|
|
//
|
|
|
+// for (PointData entity : pointls) {
|
|
|
+// writeList.add(convertPointData(entity));
|
|
|
+// }
|
|
|
// try {
|
|
|
-// String result = restTemplate.postForObject(url, writeDataList, String.class);
|
|
|
+// String result = restTemplate.postForObject(url, writeList, String.class);
|
|
|
// } catch (HttpClientErrorException exception) {
|
|
|
// if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
|
// //System.out.println("404请求错误");
|
|
@@ -1717,18 +1718,20 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
// throw exception;
|
|
|
// }
|
|
|
// }
|
|
|
-// } else
|
|
|
-// return;
|
|
|
+// }
|
|
|
+//
|
|
|
// }
|
|
|
|
|
|
+
|
|
|
+
|
|
|
//多点切面数据
|
|
|
@Override
|
|
|
public DNAVal[] getHistMatrix(String[] nameList, long tTime) throws Exception {
|
|
|
|
|
|
|
|
|
- if(StringUtils.notEmp(nameList) )
|
|
|
+ if(StringUtils.notEmp(nameList) && nameList.length>0 && StringUtils.notEmp(tTime))
|
|
|
{
|
|
|
- if(!InitialRunner.hpmap.containsKey(nameList[0]))
|
|
|
+ if(!nameList[0].startsWith(JKFC) && !nameList[0].startsWith(JKFJ))
|
|
|
{
|
|
|
baseURL = V2Config.getBaseurl();
|
|
|
}else
|