|
@@ -136,50 +136,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);
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -424,49 +426,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);
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -611,7 +615,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
idls.add(str);
|
|
|
}
|
|
|
}
|
|
|
- if(!idls.isEmpty() )
|
|
|
+ if(!idls.isEmpty() )
|
|
|
{
|
|
|
String pointIdString = StringUtil.join(idls.toArray(), ",");
|
|
|
Optional<String> keys = Optional.ofNullable(pointIdString);
|
|
@@ -626,32 +630,25 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
JSONObject jsonObject = resp.getBody();
|
|
|
if (jsonObject != null) {
|
|
|
//对结果进行有序返回
|
|
|
- int len = idls.size();
|
|
|
+ int len = pointids.length;
|
|
|
List<PointData> result = new ArrayList<>();
|
|
|
HashMap<String, PointData> pointDataHashMap = new HashMap<>();
|
|
|
for (int i = 0; i < len; i++) {
|
|
|
|
|
|
|
|
|
- PointData pd = new PointData();
|
|
|
- pd.setPointName(pointids[i]);
|
|
|
- pd.setEdnaId(pointids[i]);
|
|
|
- pd.setPointValueInDouble(0.0);
|
|
|
- pd.setPointTime(0l);
|
|
|
- result.add(pd);
|
|
|
-
|
|
|
- pointDataHashMap.put(pd.getPointName(), pd);
|
|
|
+ if (pointDataHashMap.containsKey(pointids[i]) == false){
|
|
|
+ PointData pd = new PointData();
|
|
|
+ pd.setPointName(pointids[i]);
|
|
|
+ pd.setEdnaId(pointids[i]);
|
|
|
+ pd.setPointValueInDouble(0.0);
|
|
|
+ pd.setPointTime(0l);
|
|
|
+ result.add(pd);
|
|
|
|
|
|
-// if (pointDataHashMap.containsKey(idls.get(i)) == false){
|
|
|
-// PointData pd = new PointData();
|
|
|
-// pd.setPointName(idls.get(i));
|
|
|
-// pd.setEdnaId(idls.get(i));
|
|
|
-// result.add(pd);
|
|
|
-//
|
|
|
-// pointDataHashMap.put(pd.getPointName(), pd);
|
|
|
-// }
|
|
|
-// else{
|
|
|
-// result.add(pointDataHashMap.get(idls.get(i)));
|
|
|
-// }
|
|
|
+ pointDataHashMap.put(pd.getPointName(), pd);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ result.add(pointDataHashMap.get(pointids[i]));
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
Iterator<String> sIterator = jsonObject.keySet().iterator();
|
|
@@ -780,27 +777,19 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
HashMap<String, PointData> pointDataHashMap = new HashMap<>();
|
|
|
for (int i = 0; i < len; i++) {
|
|
|
|
|
|
- PointData pd = new PointData();
|
|
|
- pd.setPointName(pointids.get(i));
|
|
|
- pd.setEdnaId(pointids.get(i));
|
|
|
- pd.setPointValueInDouble(0.0);
|
|
|
- pd.setPointTime(0l);
|
|
|
- result.add(pd);
|
|
|
-
|
|
|
- pointDataHashMap.put(pd.getPointName(), pd);
|
|
|
-
|
|
|
+ if (pointDataHashMap.containsKey(pointids.get(i)) == false){
|
|
|
+ PointData pd = new PointData();
|
|
|
+ pd.setPointName(pointids.get(i));
|
|
|
+ pd.setEdnaId(pointids.get(i));
|
|
|
+ pd.setPointValueInDouble(0.0);
|
|
|
+ pd.setPointTime(0l);
|
|
|
+ result.add(pd);
|
|
|
|
|
|
-// if (pointDataHashMap.containsKey(idls.get(i)) == false){
|
|
|
-// PointData pd = new PointData();
|
|
|
-// pd.setPointName(idls.get(i));
|
|
|
-// pd.setEdnaId(idls.get(i));
|
|
|
-// result.add(pd);
|
|
|
-//
|
|
|
-// pointDataHashMap.put(pd.getPointName(), pd);
|
|
|
-// }
|
|
|
-// else{
|
|
|
-// result.add(pointDataHashMap.get(idls.get(i)));
|
|
|
-// }
|
|
|
+ pointDataHashMap.put(pd.getPointName(), pd);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ result.add(pointDataHashMap.get(pointids.get(i)));
|
|
|
+ }
|
|
|
}
|
|
|
Iterator<String> sIterator = jsonObject.keySet().iterator();
|
|
|
while (sIterator.hasNext()) {
|
|
@@ -1018,49 +1007,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;
|
|
@@ -1660,4 +1651,4 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
}
|
|
|
|
|
|
|
|
|
-}
|
|
|
+}
|