|
@@ -156,7 +156,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
else{
|
|
|
PointData data = new PointData();
|
|
|
data.setEdnaId(point.getCode());
|
|
|
- data.setPointTime(snapItem.getPointTime());
|
|
|
+ data.setPointTime(0L);
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -165,7 +165,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
} else {
|
|
|
PointData data = new PointData();
|
|
|
data.setEdnaId(point.getCode());
|
|
|
- data.setPointTime(snapItem.getPointTime());
|
|
|
+ data.setPointTime(0l);
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -174,7 +174,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
} else {
|
|
|
PointData data = new PointData();
|
|
|
data.setEdnaId(point.getCode());
|
|
|
- data.setPointTime(snapItem.getPointTime());
|
|
|
+ data.setPointTime(0l);
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -231,7 +231,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
else{
|
|
|
PointData data = new PointData();
|
|
|
data.setEdnaId(pointid);
|
|
|
- data.setPointTime(sectionlist.get(0).getPointTime());
|
|
|
+ data.setPointTime(0L);
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -240,7 +240,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
} else {
|
|
|
PointData data = new PointData();
|
|
|
data.setEdnaId(pointid);
|
|
|
- data.setPointTime(sectionlist.get(0).getPointTime());
|
|
|
+ data.setPointTime(0L);
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -443,7 +443,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
else{
|
|
|
PointData data = new PointData();
|
|
|
data.setEdnaId(point.getCode());
|
|
|
- data.setPointTime(snapItem.getPointTime());
|
|
|
+ data.setPointTime(0L);
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -452,7 +452,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
} else {
|
|
|
PointData data = new PointData();
|
|
|
data.setEdnaId(point.getCode());
|
|
|
- data.setPointTime(snapItem.getPointTime());
|
|
|
+ data.setPointTime(0l);
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -461,7 +461,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
} else {
|
|
|
PointData data = new PointData();
|
|
|
data.setEdnaId(point.getCode());
|
|
|
- data.setPointTime(snapItem.getPointTime());
|
|
|
+ data.setPointTime(0l);
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -612,7 +612,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);
|
|
@@ -627,32 +627,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(idls.get(i));
|
|
|
+ pd.setEdnaId(idls.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(idls.get(i)));
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
Iterator<String> sIterator = jsonObject.keySet().iterator();
|
|
@@ -757,7 +750,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);
|
|
@@ -781,27 +774,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(idls.get(i));
|
|
|
+ pd.setEdnaId(idls.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(idls.get(i)));
|
|
|
+ }
|
|
|
}
|
|
|
Iterator<String> sIterator = jsonObject.keySet().iterator();
|
|
|
while (sIterator.hasNext()) {
|
|
@@ -1037,7 +1022,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
else{
|
|
|
PointData data = new PointData();
|
|
|
data.setEdnaId(pointid);
|
|
|
- data.setPointTime(snapItem.getPointTime());
|
|
|
+ data.setPointTime(0L);
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -1046,7 +1031,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
} else {
|
|
|
PointData data = new PointData();
|
|
|
data.setEdnaId(pointid);
|
|
|
- data.setPointTime(snapItem.getPointTime());
|
|
|
+ data.setPointTime(0l);
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -1055,7 +1040,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
} else {
|
|
|
PointData data = new PointData();
|
|
|
data.setEdnaId(pointid);
|
|
|
- data.setPointTime(snapItem.getPointTime());
|
|
|
+ data.setPointTime(0l);
|
|
|
data.setPointValue("0");
|
|
|
data.setPointName("1");
|
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -1470,7 +1455,14 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
PointData po = getRealData(tagNames[i]);
|
|
|
DNAVal val = new DNAVal();
|
|
|
val.DValue = po.getPointValueInDouble();
|
|
|
- val.Time = Integer.valueOf(String.valueOf(po.getPointTime()));
|
|
|
+ if(StringUtils.notEmp(po.getPointTime()))
|
|
|
+ {
|
|
|
+ val.Time = Integer.valueOf(String.valueOf(po.getPointTime()));
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ val.Time = 0;
|
|
|
+ }
|
|
|
+
|
|
|
val.Status = 1;
|
|
|
result[i] = val;
|
|
|
} else {
|
|
@@ -1497,57 +1489,87 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public void updatePoint(List<PointData> pointls) throws Exception {
|
|
|
String url = baseURL + "/history/batch";
|
|
|
+
|
|
|
List<JSONObject> writeList = new ArrayList<>();
|
|
|
|
|
|
- for (PointData entity : pointls) {
|
|
|
- writeList.add(convertPointData(entity));
|
|
|
+ if(StringUtils.notEmp(pointls) )
|
|
|
+ {
|
|
|
+ for(PointData entity:pointls)
|
|
|
+ {
|
|
|
+ if(StringUtils.notEmp(entity) && !V2Config.getInitialcode().equals(entity.getEdnaId()))
|
|
|
+ {
|
|
|
+ writeList.add(convertPointData(entity));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!writeList.isEmpty())
|
|
|
+ {
|
|
|
+ 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, writeList, String.class);
|
|
|
- } catch (HttpClientErrorException exception) {
|
|
|
- if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
|
- return;
|
|
|
- } else {
|
|
|
- throw exception;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @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()))
|
|
|
+ {
|
|
|
+ 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 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;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// @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;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
+ @Override
|
|
|
+ public void sendMultiPoint(List<PointData> pointls) throws Exception {
|
|
|
+
|
|
|
+ String url = baseURL + "/latest/batch";
|
|
|
+
|
|
|
+ List<JSONObject> writeList = new ArrayList<>();
|
|
|
+
|
|
|
+ if(StringUtils.notEmp(pointls) )
|
|
|
+ {
|
|
|
+ for(PointData entity:pointls)
|
|
|
+ {
|
|
|
+ if(StringUtils.notEmp(entity) && !V2Config.getInitialcode().equals(entity.getEdnaId()))
|
|
|
+ {
|
|
|
+ writeList.add(convertPointData(entity));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!writeList.isEmpty())
|
|
|
+ {
|
|
|
+ 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 {
|
|
@@ -1653,20 +1675,5 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void sendSinglePoint(PointData point) throws Exception {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void sendMultiPoint(List<PointData> pointls) throws Exception {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void sendMultiPoint(String[] realvalue, DNAVal[] pointls) throws Exception {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
}
|