|
@@ -20,20 +20,28 @@ import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
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();
|
|
|
|
|
|
- static String baseURL = V2Config.getBaseurl();
|
|
|
+ private String baseURL = V2Config.getBaseurl();
|
|
|
|
|
|
@Override
|
|
|
public PointData getRealData(Windpowerstationpointnew point) throws Exception {
|
|
|
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
+
|
|
|
if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
{
|
|
|
try {
|
|
@@ -85,7 +93,13 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
@Override
|
|
|
public List<PointData> getHistoryDatasSnap(Windpowerstationpointnew point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
|
-
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
{
|
|
|
Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
@@ -136,50 +150,52 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
getHistsnapSameTiem(point.getCode(), beginDate, pried, resultList);
|
|
|
}else
|
|
|
{
|
|
|
- for (PointData snapItem : snapList) {
|
|
|
-
|
|
|
- long subTime = snapItem.getPointTime() - pried;
|
|
|
- //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
|
|
|
- // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
|
|
|
- // 则代表该时间节点快照有效,否则为0
|
|
|
- String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getCode() + "&ts=" + snapItem.getPointTime() + "000";
|
|
|
- ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
|
|
|
- JSONObject jsonObjectSection = sectionResp.getBody();
|
|
|
-
|
|
|
- if (jsonObjectSection != null) {
|
|
|
- List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
|
|
|
- if (sectionlist.size() > 0) {
|
|
|
- if(sectionlist.get(0).getPointTime()>=subTime&§ionlist.get(0).getPointTime()<=snapItem.getPointTime()){
|
|
|
- resultList.add(snapItem);
|
|
|
- }
|
|
|
- else{
|
|
|
- PointData data = new PointData();
|
|
|
- data.setEdnaId(point.getCode());
|
|
|
- data.setPointTime(0L);
|
|
|
- data.setPointValue("0");
|
|
|
- data.setPointName("1");
|
|
|
- data.setPointValueInDouble(0.0);
|
|
|
- resultList.add(data);
|
|
|
- }
|
|
|
- } else {
|
|
|
- PointData data = new PointData();
|
|
|
- data.setEdnaId(point.getCode());
|
|
|
- data.setPointTime(0l);
|
|
|
- data.setPointValue("0");
|
|
|
- data.setPointName("1");
|
|
|
- data.setPointValueInDouble(0.0);
|
|
|
- resultList.add(data);
|
|
|
- }
|
|
|
- } else {
|
|
|
- PointData data = new PointData();
|
|
|
- data.setEdnaId(point.getCode());
|
|
|
- data.setPointTime(0l);
|
|
|
- data.setPointValue("0");
|
|
|
- data.setPointName("1");
|
|
|
- data.setPointValueInDouble(0.0);
|
|
|
- resultList.add(data);
|
|
|
- }
|
|
|
- }
|
|
|
+ resultList=snapList;
|
|
|
+// resultList=snapList;
|
|
|
+// for (PointData snapItem : snapList) {
|
|
|
+//
|
|
|
+// long subTime = snapItem.getPointTime() - pried;
|
|
|
+// //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
|
|
|
+// // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
|
|
|
+// // 则代表该时间节点快照有效,否则为0
|
|
|
+// String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getCode() + "&ts=" + snapItem.getPointTime() + "000";
|
|
|
+// ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
|
|
|
+// JSONObject jsonObjectSection = sectionResp.getBody();
|
|
|
+//
|
|
|
+// if (jsonObjectSection != null) {
|
|
|
+// List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
|
|
|
+// if (sectionlist.size() > 0) {
|
|
|
+// if(sectionlist.get(0).getPointTime()>=subTime&§ionlist.get(0).getPointTime()<=snapItem.getPointTime()){
|
|
|
+// resultList.add(snapItem);
|
|
|
+// }
|
|
|
+// else{
|
|
|
+// PointData data = new PointData();
|
|
|
+// data.setEdnaId(point.getCode());
|
|
|
+// data.setPointTime(0L);
|
|
|
+// data.setPointValue("0");
|
|
|
+// data.setPointName("1");
|
|
|
+// data.setPointValueInDouble(0.0);
|
|
|
+// resultList.add(data);
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// PointData data = new PointData();
|
|
|
+// data.setEdnaId(point.getCode());
|
|
|
+// data.setPointTime(0l);
|
|
|
+// data.setPointValue("0");
|
|
|
+// data.setPointName("1");
|
|
|
+// data.setPointValueInDouble(0.0);
|
|
|
+// resultList.add(data);
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// PointData data = new PointData();
|
|
|
+// data.setEdnaId(point.getCode());
|
|
|
+// data.setPointTime(0l);
|
|
|
+// data.setPointValue("0");
|
|
|
+// data.setPointName("1");
|
|
|
+// data.setPointValueInDouble(0.0);
|
|
|
+// resultList.add(data);
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -216,7 +232,13 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
private void getHistsnapSameTiem(String pointid, Long beginDate, Long pried,
|
|
|
List<PointData> resultList) {
|
|
|
|
|
|
-
|
|
|
+ if(!pointid.startsWith(JKFC) && !pointid.startsWith(JKFJ))
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
long subTime =beginDate - pried;
|
|
|
String rawUrl = baseURL + "/history/section?null=0&tagNames=" + pointid + "&ts=" + beginDate + "000";
|
|
|
ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
|
|
@@ -259,7 +281,13 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
@Override
|
|
|
public List<PointData> getHistoryDatasRaw(Windpowerstationpointnew point, Long beginDate, Long endDate) throws Exception {
|
|
|
-
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
{
|
|
|
Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
@@ -319,7 +347,13 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
@Override
|
|
|
public PointData getRealData(Windturbinetestingpointnew point) throws Exception {
|
|
|
-
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
{
|
|
|
Optional<String> keys = Optional.ofNullable(point.getCode());
|
|
@@ -373,7 +407,13 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
@Override
|
|
|
public List<PointData> getHistoryDatasSnap(Windturbinetestingpointnew point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
|
-
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
{
|
|
|
Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
@@ -424,49 +464,51 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
getHistsnapSameTiem(point.getCode(), beginDate, pried, resultList);
|
|
|
}else
|
|
|
{
|
|
|
- for (PointData snapItem : snapList) {
|
|
|
- long subTime = snapItem.getPointTime() - pried;
|
|
|
- //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
|
|
|
- // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
|
|
|
- // 则代表该时间节点快照有效,否则为0
|
|
|
- String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getCode() + "&ts=" + snapItem.getPointTime() + "000";
|
|
|
- ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
|
|
|
- JSONObject jsonObjectSection = sectionResp.getBody();
|
|
|
-
|
|
|
- if (jsonObjectSection != null) {
|
|
|
- List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
|
|
|
- if (sectionlist.size() > 0) {
|
|
|
- if(sectionlist.get(0).getPointTime()>=subTime&§ionlist.get(0).getPointTime()<=snapItem.getPointTime()){
|
|
|
- resultList.add(snapItem);
|
|
|
- }
|
|
|
- else{
|
|
|
- PointData data = new PointData();
|
|
|
- data.setEdnaId(point.getCode());
|
|
|
- data.setPointTime(0L);
|
|
|
- data.setPointValue("0");
|
|
|
- data.setPointName("1");
|
|
|
- data.setPointValueInDouble(0.0);
|
|
|
- resultList.add(data);
|
|
|
- }
|
|
|
- } else {
|
|
|
- PointData data = new PointData();
|
|
|
- data.setEdnaId(point.getCode());
|
|
|
- data.setPointTime(0l);
|
|
|
- data.setPointValue("0");
|
|
|
- data.setPointName("1");
|
|
|
- data.setPointValueInDouble(0.0);
|
|
|
- resultList.add(data);
|
|
|
- }
|
|
|
- } else {
|
|
|
- PointData data = new PointData();
|
|
|
- data.setEdnaId(point.getCode());
|
|
|
- data.setPointTime(0l);
|
|
|
- data.setPointValue("0");
|
|
|
- data.setPointName("1");
|
|
|
- data.setPointValueInDouble(0.0);
|
|
|
- resultList.add(data);
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ resultList=snapList;
|
|
|
+// for (PointData snapItem : snapList) {
|
|
|
+// long subTime = snapItem.getPointTime() - pried;
|
|
|
+// //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
|
|
|
+// // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
|
|
|
+// // 则代表该时间节点快照有效,否则为0
|
|
|
+// String rawUrl = baseURL + "/history/section?null=0&tagNames=" + point.getCode() + "&ts=" + snapItem.getPointTime() + "000";
|
|
|
+// ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
|
|
|
+// JSONObject jsonObjectSection = sectionResp.getBody();
|
|
|
+//
|
|
|
+// if (jsonObjectSection != null) {
|
|
|
+// List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
|
|
|
+// if (sectionlist.size() > 0) {
|
|
|
+// if(sectionlist.get(0).getPointTime()>=subTime&§ionlist.get(0).getPointTime()<=snapItem.getPointTime()){
|
|
|
+// resultList.add(snapItem);
|
|
|
+// }
|
|
|
+// else{
|
|
|
+// PointData data = new PointData();
|
|
|
+// data.setEdnaId(point.getCode());
|
|
|
+// data.setPointTime(0L);
|
|
|
+// data.setPointValue("0");
|
|
|
+// data.setPointName("1");
|
|
|
+// data.setPointValueInDouble(0.0);
|
|
|
+// resultList.add(data);
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// PointData data = new PointData();
|
|
|
+// data.setEdnaId(point.getCode());
|
|
|
+// data.setPointTime(0l);
|
|
|
+// data.setPointValue("0");
|
|
|
+// data.setPointName("1");
|
|
|
+// data.setPointValueInDouble(0.0);
|
|
|
+// resultList.add(data);
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// PointData data = new PointData();
|
|
|
+// data.setEdnaId(point.getCode());
|
|
|
+// data.setPointTime(0l);
|
|
|
+// data.setPointValue("0");
|
|
|
+// data.setPointName("1");
|
|
|
+// data.setPointValueInDouble(0.0);
|
|
|
+// resultList.add(data);
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -498,6 +540,15 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
@Override
|
|
|
public List<PointData> getHistoryDatasRaw(Windturbinetestingpointnew point, Long beginDate, Long endDate) throws Exception {
|
|
|
+
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
+
|
|
|
if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
{
|
|
|
Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
@@ -556,6 +607,14 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public PointData getRealData(String pointid) throws Exception {
|
|
|
|
|
|
+
|
|
|
+ if(StringUtils.notEmp(pointid) && !pointid.startsWith(JKFC) && !pointid.startsWith(JKFJ))
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
if(StringUtils.notEmp(pointid) && !V2Config.getInitialcode().equals(pointid))
|
|
|
{
|
|
|
Optional<String> keys = Optional.ofNullable(pointid);
|
|
@@ -603,6 +662,14 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
if(StringUtils.notEmp(pointids) )
|
|
|
{
|
|
|
+ if(!pointids[0].startsWith(JKFC) && !pointids[0].startsWith(JKFJ))
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
+
|
|
|
List<String> idls=new ArrayList<>();
|
|
|
for(String str:pointids)
|
|
|
{
|
|
@@ -634,8 +701,8 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
if (pointDataHashMap.containsKey(pointids[i]) == false){
|
|
|
PointData pd = new PointData();
|
|
|
- pd.setPointName(idls.get(i));
|
|
|
- pd.setEdnaId(idls.get(i));
|
|
|
+ pd.setPointName(pointids[i]);
|
|
|
+ pd.setEdnaId(pointids[i]);
|
|
|
pd.setPointValueInDouble(0.0);
|
|
|
pd.setPointTime(0l);
|
|
|
result.add(pd);
|
|
@@ -643,7 +710,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
pointDataHashMap.put(pd.getPointName(), pd);
|
|
|
}
|
|
|
else{
|
|
|
- result.add(pointDataHashMap.get(idls.get(i)));
|
|
|
+ result.add(pointDataHashMap.get(pointids[i]));
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -741,6 +808,14 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
if(StringUtils.notEmp(pointids) )
|
|
|
{
|
|
|
+
|
|
|
+ if(!pointids.get(0).startsWith(JKFC) && !pointids.get(0).startsWith(JKFJ))
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
List<String> idls=new ArrayList<>();
|
|
|
for(String str:pointids)
|
|
|
{
|
|
@@ -775,8 +850,8 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
if (pointDataHashMap.containsKey(pointids.get(i)) == false){
|
|
|
PointData pd = new PointData();
|
|
|
- pd.setPointName(idls.get(i));
|
|
|
- pd.setEdnaId(idls.get(i));
|
|
|
+ pd.setPointName(pointids.get(i));
|
|
|
+ pd.setEdnaId(pointids.get(i));
|
|
|
pd.setPointValueInDouble(0.0);
|
|
|
pd.setPointTime(0l);
|
|
|
result.add(pd);
|
|
@@ -784,7 +859,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
pointDataHashMap.put(pd.getPointName(), pd);
|
|
|
}
|
|
|
else{
|
|
|
- result.add(pointDataHashMap.get(idls.get(i)));
|
|
|
+ result.add(pointDataHashMap.get(pointids.get(i)));
|
|
|
}
|
|
|
}
|
|
|
Iterator<String> sIterator = jsonObject.keySet().iterator();
|
|
@@ -878,6 +953,15 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
if(StringUtils.notEmp(pointids) )
|
|
|
{
|
|
|
+
|
|
|
+ if(!pointids[0].startsWith(JKFC) && !pointids[0].startsWith(JKFJ))
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
+
|
|
|
List<String> idls=new ArrayList<>();
|
|
|
for(String str:pointids)
|
|
|
{
|
|
@@ -962,6 +1046,14 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public List<PointData> getHistoryDatasSnap(String pointid, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
|
|
|
|
+
|
|
|
+ if(StringUtils.notEmp(pointid) && !pointid.startsWith(JKFC) && !pointid.startsWith(JKFJ))
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
if(StringUtils.notEmp(pointid) && !V2Config.getInitialcode().equals(pointid))
|
|
|
{
|
|
|
Optional<String> tagName = Optional.ofNullable(pointid);
|
|
@@ -1003,49 +1095,51 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
getHistsnapSameTiem(pointid, beginDate, pried, resultList);
|
|
|
}else
|
|
|
{
|
|
|
- for (PointData snapItem : list) {
|
|
|
- long subTime = snapItem.getPointTime() - pried;
|
|
|
- //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
|
|
|
- // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
|
|
|
- // 则代表该时间节点快照有效,否则为0
|
|
|
- String rawUrl = baseURL + "/history/section?null=0&tagNames=" +pointid+ "&ts=" + snapItem.getPointTime() + "000";
|
|
|
- ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
|
|
|
- JSONObject jsonObjectSection = sectionResp.getBody();
|
|
|
-
|
|
|
- if (jsonObjectSection != null) {
|
|
|
- List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
|
|
|
- if (sectionlist.size() > 0) {
|
|
|
- if(sectionlist.get(0).getPointTime()>=subTime&§ionlist.get(0).getPointTime()<=snapItem.getPointTime()){
|
|
|
- resultList.add(snapItem);
|
|
|
- }
|
|
|
- else{
|
|
|
- PointData data = new PointData();
|
|
|
- data.setEdnaId(pointid);
|
|
|
- data.setPointTime(0L);
|
|
|
- data.setPointValue("0");
|
|
|
- data.setPointName("1");
|
|
|
- data.setPointValueInDouble(0.0);
|
|
|
- resultList.add(data);
|
|
|
- }
|
|
|
- } else {
|
|
|
- PointData data = new PointData();
|
|
|
- data.setEdnaId(pointid);
|
|
|
- data.setPointTime(0l);
|
|
|
- data.setPointValue("0");
|
|
|
- data.setPointName("1");
|
|
|
- data.setPointValueInDouble(0.0);
|
|
|
- resultList.add(data);
|
|
|
- }
|
|
|
- } else {
|
|
|
- PointData data = new PointData();
|
|
|
- data.setEdnaId(pointid);
|
|
|
- data.setPointTime(0l);
|
|
|
- data.setPointValue("0");
|
|
|
- data.setPointName("1");
|
|
|
- data.setPointValueInDouble(0.0);
|
|
|
- resultList.add(data);
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ resultList=list;
|
|
|
+// for (PointData snapItem : list) {
|
|
|
+// long subTime = snapItem.getPointTime() - pried;
|
|
|
+// //查询时间区间的截面值(截面值为传入时间节点的上一个最近值,返回时间为值的真实时间),
|
|
|
+// // 再进行比较,若截面值的时间戳在以快照时间节点前推一个单位的时间区间中,
|
|
|
+// // 则代表该时间节点快照有效,否则为0
|
|
|
+// String rawUrl = baseURL + "/history/section?null=0&tagNames=" +pointid+ "&ts=" + snapItem.getPointTime() + "000";
|
|
|
+// ResponseEntity<JSONObject> sectionResp = restTemplate.getForEntity(rawUrl, JSONObject.class);
|
|
|
+// JSONObject jsonObjectSection = sectionResp.getBody();
|
|
|
+//
|
|
|
+// if (jsonObjectSection != null) {
|
|
|
+// List<PointData> sectionlist = JsonObjectHelper.phrasePointData(jsonObjectSection);
|
|
|
+// if (sectionlist.size() > 0) {
|
|
|
+// if(sectionlist.get(0).getPointTime()>=subTime&§ionlist.get(0).getPointTime()<=snapItem.getPointTime()){
|
|
|
+// resultList.add(snapItem);
|
|
|
+// }
|
|
|
+// else{
|
|
|
+// PointData data = new PointData();
|
|
|
+// data.setEdnaId(pointid);
|
|
|
+// data.setPointTime(0L);
|
|
|
+// data.setPointValue("0");
|
|
|
+// data.setPointName("1");
|
|
|
+// data.setPointValueInDouble(0.0);
|
|
|
+// resultList.add(data);
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// PointData data = new PointData();
|
|
|
+// data.setEdnaId(pointid);
|
|
|
+// data.setPointTime(0l);
|
|
|
+// data.setPointValue("0");
|
|
|
+// data.setPointName("1");
|
|
|
+// data.setPointValueInDouble(0.0);
|
|
|
+// resultList.add(data);
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// PointData data = new PointData();
|
|
|
+// data.setEdnaId(pointid);
|
|
|
+// data.setPointTime(0l);
|
|
|
+// data.setPointValue("0");
|
|
|
+// data.setPointName("1");
|
|
|
+// data.setPointValueInDouble(0.0);
|
|
|
+// resultList.add(data);
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
return resultList;
|
|
@@ -1079,7 +1173,13 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public List<PointData> getHistoryDatasRaw(String pointid, Long beginDate, Long endDate) throws Exception {
|
|
|
|
|
|
-
|
|
|
+ if(StringUtils.notEmp(pointid) && StringUtils.notEmp(pointid) && !pointid.startsWith(JKFC) && !pointid.startsWith(JKFJ))
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
if(StringUtils.notEmp(pointid) && !V2Config.getInitialcode().equals(pointid))
|
|
|
{
|
|
|
Optional<String> tagName = Optional.ofNullable(pointid);
|
|
@@ -1128,6 +1228,13 @@ 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(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
{
|
|
|
Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
@@ -1203,7 +1310,13 @@ 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(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !point.getCode().startsWith(JKFC) && !point.getCode().startsWith(JKFJ))
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
{
|
|
|
Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
@@ -1273,7 +1386,13 @@ 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(StringUtils.notEmp(pointid) && !pointid.startsWith(JKFC) && !pointid.startsWith(JKFJ))
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
if(StringUtils.notEmp(pointid) && !V2Config.getInitialcode().equals(pointid))
|
|
|
{
|
|
|
Optional<String> tagName = Optional.ofNullable(pointid);
|
|
@@ -1332,7 +1451,13 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public DNAStatVal[] getHistStat(String point, Long beginDate, Long endDate, Integer pried) throws Exception {
|
|
|
|
|
|
-
|
|
|
+ if(StringUtils.notEmp(point) && !point.startsWith(JKFC) && !point.startsWith(JKFJ))
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
if(StringUtils.notEmp(point) && !V2Config.getInitialcode().equals(point))
|
|
|
{
|
|
|
Optional<String> tagName = Optional.ofNullable(point);
|
|
@@ -1429,16 +1554,28 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
@Override
|
|
|
public void updatePoint(PointData point) throws Exception {
|
|
|
- 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()) &&!point.getEdnaId().startsWith(JKFC) && !point.getEdnaId().startsWith(JKFJ))
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
+ 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
|
|
@@ -1448,6 +1585,13 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
if (StringUtils.notEmp(tagNames) && tagNames.length > 0) {
|
|
|
|
|
|
|
|
|
+ if(!tagNames[0].startsWith(JKFC) && !tagNames[0].startsWith(JKFJ))
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
DNAVal[] result = new DNAVal[tagNames.length];
|
|
|
for (int i = 0; i < tagNames.length; i++) {
|
|
|
if (StringUtils.notEmp(tagNames[i]) && !V2Config.getInitialcode().equals(tagNames[i])) {
|
|
@@ -1487,31 +1631,31 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
@Override
|
|
|
public void updatePoint(List<PointData> pointls) throws Exception {
|
|
|
- String url = baseURL + "/history/batch";
|
|
|
|
|
|
- List<JSONObject> writeList = new ArrayList<>();
|
|
|
-
|
|
|
- if(StringUtils.notEmp(pointls) )
|
|
|
+ if(null!=pointls && !pointls.isEmpty())
|
|
|
{
|
|
|
- for(PointData entity:pointls)
|
|
|
+ if(!pointls.get(0).getEdnaId().startsWith(JKFC) && !pointls.get(0).getEdnaId().startsWith(JKFJ))
|
|
|
{
|
|
|
- if(StringUtils.notEmp(entity) && !V2Config.getInitialcode().equals(entity.getEdnaId()))
|
|
|
- {
|
|
|
- writeList.add(convertPointData(entity));
|
|
|
- }
|
|
|
- }
|
|
|
- if(!writeList.isEmpty())
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
{
|
|
|
- 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;
|
|
|
- }
|
|
|
- }
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
+
|
|
|
+ String url = baseURL + "/history/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) {
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ throw exception;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1519,10 +1663,19 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
@Override
|
|
|
public void sendSinglePoint(PointData point) throws Exception {
|
|
|
- String url = baseURL + "/latest";
|
|
|
|
|
|
- if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getEdnaId()) && !V2Config.getInitialcode().equals(point.getEdnaId()))
|
|
|
+ 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";
|
|
|
+
|
|
|
+
|
|
|
try {
|
|
|
String result = restTemplate.postForObject(url, convertPointData(point), String.class);
|
|
|
} catch (HttpClientErrorException exception) {
|
|
@@ -1539,72 +1692,50 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public void sendMultiPoint(List<PointData> pointls) throws Exception {
|
|
|
|
|
|
- String url = baseURL + "/latest/batch";
|
|
|
-
|
|
|
- List<JSONObject> writeList = new ArrayList<>();
|
|
|
-
|
|
|
- if(StringUtils.notEmp(pointls) )
|
|
|
+ if(null !=pointls && !pointls.isEmpty())
|
|
|
{
|
|
|
- for(PointData entity:pointls)
|
|
|
+ if(!pointls.get(0).getEdnaId().startsWith(JKFC) && !pointls.get(0).getEdnaId().startsWith(JKFJ))
|
|
|
{
|
|
|
- if(StringUtils.notEmp(entity) && !V2Config.getInitialcode().equals(entity.getEdnaId()))
|
|
|
- {
|
|
|
- writeList.add(convertPointData(entity));
|
|
|
- }
|
|
|
- }
|
|
|
- if(!writeList.isEmpty())
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
{
|
|
|
- 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;
|
|
|
- }
|
|
|
- }
|
|
|
+ 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, writeList, String.class);
|
|
|
+ } catch (HttpClientErrorException exception) {
|
|
|
+ if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
|
+ //System.out.println("404请求错误");
|
|
|
+ } else {
|
|
|
+ throw exception;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|
|
|
-//
|
|
|
-// @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, long tTime) throws Exception {
|
|
|
|
|
|
|
|
|
- if(StringUtils.notEmp(nameList) )
|
|
|
+ if(StringUtils.notEmp(nameList) && nameList.length>0 && StringUtils.notEmp(tTime))
|
|
|
{
|
|
|
+ if(!nameList[0].startsWith(JKFC) && !nameList[0].startsWith(JKFJ))
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getBaseurl();
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ baseURL = V2Config.getHealthurl();
|
|
|
+ }
|
|
|
List<String> idls=new ArrayList<>();
|
|
|
for(String str:nameList)
|
|
|
{
|
|
@@ -1675,4 +1806,4 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
}
|
|
|
|
|
|
|
|
|
-}
|
|
|
+}
|