|
@@ -51,23 +51,28 @@ public class EdosUtil implements IEdosUtil {
|
|
if (point.getNemCode().startsWith("GF-")){
|
|
if (point.getNemCode().startsWith("GF-")){
|
|
url = baseURL2 + "/latest?null=0";
|
|
url = baseURL2 + "/latest?null=0";
|
|
}
|
|
}
|
|
- if (keys.isPresent())
|
|
+ if (keys.isPresent()) {
|
|
url = url + "&keys=" + keys.get();
|
|
url = url + "&keys=" + keys.get();
|
|
- if (thingType.isPresent())
|
|
+ }
|
|
|
|
+ if (thingType.isPresent()) {
|
|
url = url + "&thingType=" + thingType.get();
|
|
url = url + "&thingType=" + thingType.get();
|
|
- if (thingId.isPresent())
|
|
+ }
|
|
|
|
+ if (thingId.isPresent()) {
|
|
url = url + "&thingId=" + thingId.get();
|
|
url = url + "&thingId=" + thingId.get();
|
|
- if (uniformCodes.isPresent())
|
|
+ }
|
|
|
|
+ if (uniformCodes.isPresent()) {
|
|
url = url + "&uniformCodes=" + uniformCodes.get();
|
|
url = url + "&uniformCodes=" + uniformCodes.get();
|
|
|
|
+ }
|
|
|
|
|
|
ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
JSONObject jsonArray = resp.getBody();
|
|
JSONObject jsonArray = resp.getBody();
|
|
if (StringUtils.isNotEmpty(jsonArray)){
|
|
if (StringUtils.isNotEmpty(jsonArray)){
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
- if (list.size() > 0)
|
|
+ if (list.size() > 0) {
|
|
return list.get(0);
|
|
return list.get(0);
|
|
- else
|
|
+ } else {
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
}
|
|
}
|
|
@@ -84,7 +89,7 @@ public class EdosUtil implements IEdosUtil {
|
|
PointData po=new PointData();
|
|
PointData po=new PointData();
|
|
po.setEdnaId(point.getNemCode());
|
|
po.setEdnaId(point.getNemCode());
|
|
po.setPointValueInDouble(0.0);
|
|
po.setPointValueInDouble(0.0);
|
|
- po.setPointTime(0l);
|
|
+ po.setPointTime(0L);
|
|
return po;
|
|
return po;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -105,10 +110,11 @@ public class EdosUtil implements IEdosUtil {
|
|
JSONObject jsonArray = resp.getBody();
|
|
JSONObject jsonArray = resp.getBody();
|
|
if (StringUtils.isNotEmpty(jsonArray)){
|
|
if (StringUtils.isNotEmpty(jsonArray)){
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
- if (list.size() > 0)
|
|
+ if (list.size() > 0) {
|
|
return list.get(0);
|
|
return list.get(0);
|
|
- else
|
|
+ } else {
|
|
return ErrorRequest.RequestError(point);
|
|
return ErrorRequest.RequestError(point);
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
return ErrorRequest.RequestError(point);
|
|
return ErrorRequest.RequestError(point);
|
|
}
|
|
}
|
|
@@ -117,7 +123,7 @@ public class EdosUtil implements IEdosUtil {
|
|
PointData po=new PointData();
|
|
PointData po=new PointData();
|
|
po.setEdnaId(point);
|
|
po.setEdnaId(point);
|
|
po.setPointValueInDouble(0.0);
|
|
po.setPointValueInDouble(0.0);
|
|
- po.setPointTime(0l);
|
|
+ po.setPointTime(0L);
|
|
return po;
|
|
return po;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -135,10 +141,11 @@ public class EdosUtil implements IEdosUtil {
|
|
JSONObject jsonArray = resp.getBody();
|
|
JSONObject jsonArray = resp.getBody();
|
|
if (StringUtils.isNotEmpty(jsonArray)){
|
|
if (StringUtils.isNotEmpty(jsonArray)){
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
- if (list.size() > 0)
|
|
+ if (list.size() > 0) {
|
|
return list.get(0);
|
|
return list.get(0);
|
|
- else
|
|
+ } else {
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
}
|
|
}
|
|
@@ -147,7 +154,7 @@ public class EdosUtil implements IEdosUtil {
|
|
PointData po=new PointData();
|
|
PointData po=new PointData();
|
|
po.setEdnaId(point.getNemCode());
|
|
po.setEdnaId(point.getNemCode());
|
|
po.setPointValueInDouble(0.0);
|
|
po.setPointValueInDouble(0.0);
|
|
- po.setPointTime(0l);
|
|
+ po.setPointTime(0L);
|
|
return po;
|
|
return po;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -170,10 +177,11 @@ public class EdosUtil implements IEdosUtil {
|
|
JSONObject jsonArray = resp.getBody();
|
|
JSONObject jsonArray = resp.getBody();
|
|
if (StringUtils.isNotEmpty(jsonArray)){
|
|
if (StringUtils.isNotEmpty(jsonArray)){
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
- if (list.size() > 0)
|
|
+ if (list.size() > 0) {
|
|
return list.get(0);
|
|
return list.get(0);
|
|
- else
|
|
+ } else {
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
}
|
|
}
|
|
@@ -182,7 +190,7 @@ public class EdosUtil implements IEdosUtil {
|
|
PointData po=new PointData();
|
|
PointData po=new PointData();
|
|
po.setEdnaId(point.getNemCode());
|
|
po.setEdnaId(point.getNemCode());
|
|
po.setPointValueInDouble(0.0);
|
|
po.setPointValueInDouble(0.0);
|
|
- po.setPointTime(0l);
|
|
+ po.setPointTime(0L);
|
|
return po;
|
|
return po;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -201,12 +209,13 @@ public class EdosUtil implements IEdosUtil {
|
|
Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
|
|
Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
|
|
|
|
|
|
Long finalInterval;
|
|
Long finalInterval;
|
|
- if (pried != null)
|
|
+ if (pried != null) {
|
|
finalInterval = pried;
|
|
finalInterval = pried;
|
|
- else if (count != null)
|
|
+ } else if (count != null) {
|
|
finalInterval = (endDate - beginDate) / count;
|
|
finalInterval = (endDate - beginDate) / count;
|
|
- else
|
|
+ } else {
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
|
+ }
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -216,22 +225,28 @@ public class EdosUtil implements IEdosUtil {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- if (tagName.isPresent())
|
|
+ if (tagName.isPresent()) {
|
|
url = url + "&tagName=" + tagName.get();
|
|
url = url + "&tagName=" + tagName.get();
|
|
- else {
|
|
+ } else {
|
|
- if (thingType.isPresent())
|
|
+ if (thingType.isPresent()) {
|
|
url = url + "&thingType=" + thingType.get();
|
|
url = url + "&thingType=" + thingType.get();
|
|
- if (thingId.isPresent())
|
|
+ }
|
|
|
|
+ if (thingId.isPresent()) {
|
|
url = url + "&thingId=" + thingId.get();
|
|
url = url + "&thingId=" + thingId.get();
|
|
- if (uniformCode.isPresent())
|
|
+ }
|
|
|
|
+ if (uniformCode.isPresent()) {
|
|
url = url + "&uniformCodes=" + uniformCode.get();
|
|
url = url + "&uniformCodes=" + uniformCode.get();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (startTs.isPresent())
|
|
+ if (startTs.isPresent()) {
|
|
url = url + "&startTs=" + startTs.get();
|
|
url = url + "&startTs=" + startTs.get();
|
|
- if (endTs.isPresent())
|
|
+ }
|
|
|
|
+ if (endTs.isPresent()) {
|
|
url = url + "&endTs=" + endTs.get();
|
|
url = url + "&endTs=" + endTs.get();
|
|
- if (interval.isPresent())
|
|
+ }
|
|
|
|
+ if (interval.isPresent()) {
|
|
url = url + "&interval=" + interval.get();
|
|
url = url + "&interval=" + interval.get();
|
|
|
|
+ }
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
JSONArray jsonArray = resp.getBody();
|
|
JSONArray jsonArray = resp.getBody();
|
|
@@ -276,7 +291,7 @@ public class EdosUtil implements IEdosUtil {
|
|
} else {
|
|
} else {
|
|
PointData data = new PointData();
|
|
PointData data = new PointData();
|
|
data.setEdnaId(point.getNemCode());
|
|
data.setEdnaId(point.getNemCode());
|
|
- data.setPointTime(0l);
|
|
+ data.setPointTime(0L);
|
|
data.setPointValue("0");
|
|
data.setPointValue("0");
|
|
data.setPointName("1");
|
|
data.setPointName("1");
|
|
data.setPointValueInDouble(0.0);
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -285,7 +300,7 @@ public class EdosUtil implements IEdosUtil {
|
|
} else {
|
|
} else {
|
|
PointData data = new PointData();
|
|
PointData data = new PointData();
|
|
data.setEdnaId(point.getNemCode());
|
|
data.setEdnaId(point.getNemCode());
|
|
- data.setPointTime(0l);
|
|
+ data.setPointTime(0L);
|
|
data.setPointValue("0");
|
|
data.setPointValue("0");
|
|
data.setPointName("1");
|
|
data.setPointName("1");
|
|
data.setPointValueInDouble(0.0);
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -316,7 +331,7 @@ public class EdosUtil implements IEdosUtil {
|
|
PointData po=new PointData();
|
|
PointData po=new PointData();
|
|
po.setEdnaId(point.getNemCode());
|
|
po.setEdnaId(point.getNemCode());
|
|
po.setPointValueInDouble(0.0);
|
|
po.setPointValueInDouble(0.0);
|
|
- po.setPointTime(0l);
|
|
+ po.setPointTime(0L);
|
|
pols.add(po);
|
|
pols.add(po);
|
|
return pols;
|
|
return pols;
|
|
}
|
|
}
|
|
@@ -355,7 +370,7 @@ public class EdosUtil implements IEdosUtil {
|
|
} else {
|
|
} else {
|
|
PointData data = new PointData();
|
|
PointData data = new PointData();
|
|
data.setEdnaId(pointid);
|
|
data.setEdnaId(pointid);
|
|
- data.setPointTime(0l);
|
|
+ data.setPointTime(0L);
|
|
data.setPointValue("0");
|
|
data.setPointValue("0");
|
|
data.setPointName("1");
|
|
data.setPointName("1");
|
|
data.setPointValueInDouble(0.0);
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -391,27 +406,32 @@ public class EdosUtil implements IEdosUtil {
|
|
url = baseURL2 + "/history/snap?null=0";
|
|
url = baseURL2 + "/history/snap?null=0";
|
|
}
|
|
}
|
|
|
|
|
|
- if (tagName.isPresent())
|
|
+ if (tagName.isPresent()) {
|
|
url = url + "&tagName=" + tagName.get();
|
|
url = url + "&tagName=" + tagName.get();
|
|
- else {
|
|
+ } else {
|
|
- if (thingType.isPresent())
|
|
+ if (thingType.isPresent()) {
|
|
url = url + "&thingType=" + thingType.get();
|
|
url = url + "&thingType=" + thingType.get();
|
|
- if (thingId.isPresent())
|
|
+ }
|
|
|
|
+ if (thingId.isPresent()) {
|
|
url = url + "&thingId=" + thingId.get();
|
|
url = url + "&thingId=" + thingId.get();
|
|
- if (uniformCode.isPresent())
|
|
+ }
|
|
|
|
+ if (uniformCode.isPresent()) {
|
|
url = url + "&uniformCodes=" + uniformCode.get();
|
|
url = url + "&uniformCodes=" + uniformCode.get();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- if (startTs.isPresent())
|
|
+ if (startTs.isPresent()) {
|
|
url = url + "&startTs=" + startTs.get();
|
|
url = url + "&startTs=" + startTs.get();
|
|
- if (endTs.isPresent())
|
|
+ }
|
|
|
|
+ if (endTs.isPresent()) {
|
|
url = url + "&endTs=" + endTs.get();
|
|
url = url + "&endTs=" + endTs.get();
|
|
|
|
+ }
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
JSONArray jsonArray = resp.getBody();
|
|
JSONArray jsonArray = resp.getBody();
|
|
- if (jsonArray != null)
|
|
+ if (jsonArray != null) {
|
|
return JsonObjectHelper.phrasePointData(jsonArray, point.getNemCode());
|
|
return JsonObjectHelper.phrasePointData(jsonArray, point.getNemCode());
|
|
- else {
|
|
+ } else {
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -429,7 +449,7 @@ public class EdosUtil implements IEdosUtil {
|
|
PointData po=new PointData();
|
|
PointData po=new PointData();
|
|
po.setEdnaId(point.getNemCode());
|
|
po.setEdnaId(point.getNemCode());
|
|
po.setPointValueInDouble(0.0);
|
|
po.setPointValueInDouble(0.0);
|
|
- po.setPointTime(0l);
|
|
+ po.setPointTime(0L);
|
|
pols.add(po);
|
|
pols.add(po);
|
|
return pols;
|
|
return pols;
|
|
}
|
|
}
|
|
@@ -455,24 +475,28 @@ public class EdosUtil implements IEdosUtil {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- if (keys.isPresent())
|
|
+ if (keys.isPresent()) {
|
|
url = url + "&keys=" + keys.get();
|
|
url = url + "&keys=" + keys.get();
|
|
- else {
|
|
+ } else {
|
|
- if (thingType.isPresent())
|
|
+ if (thingType.isPresent()) {
|
|
url = url + "&thingType=" + thingType.get();
|
|
url = url + "&thingType=" + thingType.get();
|
|
- if (thingId.isPresent())
|
|
+ }
|
|
|
|
+ if (thingId.isPresent()) {
|
|
url = url + "&thingId=" + thingId.get();
|
|
url = url + "&thingId=" + thingId.get();
|
|
- if (uniformCodes.isPresent())
|
|
+ }
|
|
|
|
+ if (uniformCodes.isPresent()) {
|
|
url = url + "&uniformCodes=" + uniformCodes.get();
|
|
url = url + "&uniformCodes=" + uniformCodes.get();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
JSONObject jsonArray = resp.getBody();
|
|
JSONObject jsonArray = resp.getBody();
|
|
if (StringUtils.isNotEmpty(jsonArray)){
|
|
if (StringUtils.isNotEmpty(jsonArray)){
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
- if (list.size() > 0)
|
|
+ if (list.size() > 0) {
|
|
return list.get(0);
|
|
return list.get(0);
|
|
- else
|
|
+ } else {
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
return ErrorRequest.RequestError(point.getNemCode());
|
|
}
|
|
}
|
|
@@ -490,7 +514,7 @@ public class EdosUtil implements IEdosUtil {
|
|
PointData po=new PointData();
|
|
PointData po=new PointData();
|
|
po.setEdnaId(point.getNemCode());
|
|
po.setEdnaId(point.getNemCode());
|
|
po.setPointValueInDouble(0.0);
|
|
po.setPointValueInDouble(0.0);
|
|
- po.setPointTime(0l);
|
|
+ po.setPointTime(0L);
|
|
return po;
|
|
return po;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -509,12 +533,13 @@ public class EdosUtil implements IEdosUtil {
|
|
Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
|
|
Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
|
|
|
|
|
|
Long finalInterval;
|
|
Long finalInterval;
|
|
- if (pried != null)
|
|
+ if (pried != null) {
|
|
finalInterval = pried;
|
|
finalInterval = pried;
|
|
- else if (count != null)
|
|
+ } else if (count != null) {
|
|
finalInterval = (endDate - beginDate) / count;
|
|
finalInterval = (endDate - beginDate) / count;
|
|
- else
|
|
+ } else {
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
|
+ }
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -525,22 +550,28 @@ public class EdosUtil implements IEdosUtil {
|
|
url = baseURL + "/history/snap?null=0";
|
|
url = baseURL + "/history/snap?null=0";
|
|
}
|
|
}
|
|
|
|
|
|
- if (tagName.isPresent())
|
|
+ if (tagName.isPresent()) {
|
|
url = url + "&tagName=" + tagName.get();
|
|
url = url + "&tagName=" + tagName.get();
|
|
- else {
|
|
+ } else {
|
|
- if (thingType.isPresent())
|
|
+ if (thingType.isPresent()) {
|
|
url = url + "&thingType=" + thingType.get();
|
|
url = url + "&thingType=" + thingType.get();
|
|
- if (thingId.isPresent())
|
|
+ }
|
|
|
|
+ if (thingId.isPresent()) {
|
|
url = url + "&thingId=" + thingId.get();
|
|
url = url + "&thingId=" + thingId.get();
|
|
- if (uniformCode.isPresent())
|
|
+ }
|
|
|
|
+ if (uniformCode.isPresent()) {
|
|
url = url + "&uniformCodes=" + uniformCode.get();
|
|
url = url + "&uniformCodes=" + uniformCode.get();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (startTs.isPresent())
|
|
+ if (startTs.isPresent()) {
|
|
url = url + "&startTs=" + startTs.get();
|
|
url = url + "&startTs=" + startTs.get();
|
|
- if (endTs.isPresent())
|
|
+ }
|
|
|
|
+ if (endTs.isPresent()) {
|
|
url = url + "&endTs=" + endTs.get();
|
|
url = url + "&endTs=" + endTs.get();
|
|
- if (interval.isPresent())
|
|
+ }
|
|
|
|
+ if (interval.isPresent()) {
|
|
url = url + "&interval=" + interval.get();
|
|
url = url + "&interval=" + interval.get();
|
|
|
|
+ }
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
JSONArray jsonArray = resp.getBody();
|
|
JSONArray jsonArray = resp.getBody();
|
|
@@ -586,7 +617,7 @@ public class EdosUtil implements IEdosUtil {
|
|
} else {
|
|
} else {
|
|
PointData data = new PointData();
|
|
PointData data = new PointData();
|
|
data.setEdnaId(point.getNemCode());
|
|
data.setEdnaId(point.getNemCode());
|
|
- data.setPointTime(0l);
|
|
+ data.setPointTime(0L);
|
|
data.setPointValue("0");
|
|
data.setPointValue("0");
|
|
data.setPointName("1");
|
|
data.setPointName("1");
|
|
data.setPointValueInDouble(0.0);
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -595,7 +626,7 @@ public class EdosUtil implements IEdosUtil {
|
|
} else {
|
|
} else {
|
|
PointData data = new PointData();
|
|
PointData data = new PointData();
|
|
data.setEdnaId(point.getNemCode());
|
|
data.setEdnaId(point.getNemCode());
|
|
- data.setPointTime(0l);
|
|
+ data.setPointTime(0L);
|
|
data.setPointValue("0");
|
|
data.setPointValue("0");
|
|
data.setPointName("1");
|
|
data.setPointName("1");
|
|
data.setPointValueInDouble(0.0);
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -623,7 +654,7 @@ public class EdosUtil implements IEdosUtil {
|
|
PointData po=new PointData();
|
|
PointData po=new PointData();
|
|
po.setEdnaId(point.getNemCode());
|
|
po.setEdnaId(point.getNemCode());
|
|
po.setPointValueInDouble(0.0);
|
|
po.setPointValueInDouble(0.0);
|
|
- po.setPointTime(0l);
|
|
+ po.setPointTime(0L);
|
|
pols.add(po);
|
|
pols.add(po);
|
|
return pols;
|
|
return pols;
|
|
}
|
|
}
|
|
@@ -649,27 +680,32 @@ public class EdosUtil implements IEdosUtil {
|
|
url = baseURL + "/history/snap?null=0";
|
|
url = baseURL + "/history/snap?null=0";
|
|
}
|
|
}
|
|
|
|
|
|
- if (tagName.isPresent())
|
|
+ if (tagName.isPresent()) {
|
|
url = url + "&tagName=" + tagName.get();
|
|
url = url + "&tagName=" + tagName.get();
|
|
- else {
|
|
+ } else {
|
|
- if (thingType.isPresent())
|
|
+ if (thingType.isPresent()) {
|
|
url = url + "&thingType=" + thingType.get();
|
|
url = url + "&thingType=" + thingType.get();
|
|
- if (thingId.isPresent())
|
|
+ }
|
|
|
|
+ if (thingId.isPresent()) {
|
|
url = url + "&thingId=" + thingId.get();
|
|
url = url + "&thingId=" + thingId.get();
|
|
- if (uniformCode.isPresent())
|
|
+ }
|
|
|
|
+ if (uniformCode.isPresent()) {
|
|
url = url + "&uniformCodes=" + uniformCode.get();
|
|
url = url + "&uniformCodes=" + uniformCode.get();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- if (startTs.isPresent())
|
|
+ if (startTs.isPresent()) {
|
|
url = url + "&startTs=" + startTs.get();
|
|
url = url + "&startTs=" + startTs.get();
|
|
- if (endTs.isPresent())
|
|
+ }
|
|
|
|
+ if (endTs.isPresent()) {
|
|
url = url + "&endTs=" + endTs.get();
|
|
url = url + "&endTs=" + endTs.get();
|
|
|
|
+ }
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
JSONArray jsonArray = resp.getBody();
|
|
JSONArray jsonArray = resp.getBody();
|
|
- if (jsonArray != null)
|
|
+ if (jsonArray != null) {
|
|
return JsonObjectHelper.phrasePointData(jsonArray, point.getNemCode());
|
|
return JsonObjectHelper.phrasePointData(jsonArray, point.getNemCode());
|
|
- else {
|
|
+ } else {
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
}
|
|
}
|
|
} catch (HttpClientErrorException exception) {
|
|
} catch (HttpClientErrorException exception) {
|
|
@@ -686,7 +722,7 @@ public class EdosUtil implements IEdosUtil {
|
|
PointData po=new PointData();
|
|
PointData po=new PointData();
|
|
po.setEdnaId(point.getNemCode());
|
|
po.setEdnaId(point.getNemCode());
|
|
po.setPointValueInDouble(0.0);
|
|
po.setPointValueInDouble(0.0);
|
|
- po.setPointTime(0l);
|
|
+ po.setPointTime(0L);
|
|
pols.add(po);
|
|
pols.add(po);
|
|
return pols;
|
|
return pols;
|
|
}
|
|
}
|
|
@@ -705,19 +741,21 @@ public class EdosUtil implements IEdosUtil {
|
|
}
|
|
}
|
|
|
|
|
|
try {
|
|
try {
|
|
- if (keys.isPresent())
|
|
+ if (keys.isPresent()) {
|
|
url = url + "&keys=" + keys.get();
|
|
url = url + "&keys=" + keys.get();
|
|
- else
|
|
+ } else {
|
|
return null;
|
|
return null;
|
|
|
|
+ }
|
|
|
|
|
|
ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
JSONObject jsonArray = resp.getBody();
|
|
JSONObject jsonArray = resp.getBody();
|
|
if (StringUtils.isNotEmpty(jsonArray)){
|
|
if (StringUtils.isNotEmpty(jsonArray)){
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
- if (list.size() > 0)
|
|
+ if (list.size() > 0) {
|
|
return list.get(0);
|
|
return list.get(0);
|
|
- else
|
|
+ } else {
|
|
return ErrorRequest.RequestError(pointid);
|
|
return ErrorRequest.RequestError(pointid);
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
return ErrorRequest.RequestError(pointid);
|
|
return ErrorRequest.RequestError(pointid);
|
|
}
|
|
}
|
|
@@ -735,7 +773,7 @@ public class EdosUtil implements IEdosUtil {
|
|
PointData po=new PointData();
|
|
PointData po=new PointData();
|
|
po.setEdnaId(pointid);
|
|
po.setEdnaId(pointid);
|
|
po.setPointValueInDouble(0.0);
|
|
po.setPointValueInDouble(0.0);
|
|
- po.setPointTime(0l);
|
|
+ po.setPointTime(0L);
|
|
return po;
|
|
return po;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -752,9 +790,9 @@ public class EdosUtil implements IEdosUtil {
|
|
url = baseURL2 + "/latest?null=0";
|
|
url = baseURL2 + "/latest?null=0";
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
- if (keys.isPresent())
|
|
+ if (keys.isPresent()) {
|
|
url = url + "&keys=" + keys.get();
|
|
url = url + "&keys=" + keys.get();
|
|
- else {
|
|
+ } else {
|
|
return ErrorRequest.RequestListError(pointids);
|
|
return ErrorRequest.RequestListError(pointids);
|
|
}
|
|
}
|
|
ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
@@ -784,8 +822,9 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
String key = sIterator.next();
|
|
String key = sIterator.next();
|
|
PointData pointData = pointDataHashMap.get(key);
|
|
PointData pointData = pointDataHashMap.get(key);
|
|
- if (pointData == null)
|
|
+ if (pointData == null) {
|
|
continue;
|
|
continue;
|
|
|
|
+ }
|
|
|
|
|
|
JSONObject jsonData = jsonObject.getJSONObject(key);
|
|
JSONObject jsonData = jsonObject.getJSONObject(key);
|
|
Long ts = jsonData.getLong("ts");
|
|
Long ts = jsonData.getLong("ts");
|
|
@@ -846,9 +885,9 @@ public class EdosUtil implements IEdosUtil {
|
|
url = baseURL2 + "/latest?null=0";
|
|
url = baseURL2 + "/latest?null=0";
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
- if (keys.isPresent())
|
|
+ if (keys.isPresent()) {
|
|
url = url + "&keys=" + keys.get();
|
|
url = url + "&keys=" + keys.get();
|
|
- else {
|
|
+ } else {
|
|
String[] arr = new String[pointids.size()];
|
|
String[] arr = new String[pointids.size()];
|
|
return ErrorRequest.RequestListError(pointids.toArray(arr));
|
|
return ErrorRequest.RequestListError(pointids.toArray(arr));
|
|
}
|
|
}
|
|
@@ -880,8 +919,9 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
String key = sIterator.next();
|
|
String key = sIterator.next();
|
|
PointData pointData = pointDataHashMap.get(key);
|
|
PointData pointData = pointDataHashMap.get(key);
|
|
- if (pointData == null)
|
|
+ if (pointData == null) {
|
|
continue;
|
|
continue;
|
|
|
|
+ }
|
|
|
|
|
|
JSONObject jsonData = jsonObject.getJSONObject(key);
|
|
JSONObject jsonData = jsonObject.getJSONObject(key);
|
|
Long ts = jsonData.getLong("ts");
|
|
Long ts = jsonData.getLong("ts");
|
|
@@ -951,10 +991,11 @@ public class EdosUtil implements IEdosUtil {
|
|
url = baseURL2 + "/latest?null=0";
|
|
url = baseURL2 + "/latest?null=0";
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
- if (keys.isPresent())
|
|
+ if (keys.isPresent()) {
|
|
url = url + "&keys=" + keys.get();
|
|
url = url + "&keys=" + keys.get();
|
|
- else
|
|
+ } else {
|
|
return null;
|
|
return null;
|
|
|
|
+ }
|
|
ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
JSONObject jsonArray = resp.getBody();
|
|
JSONObject jsonArray = resp.getBody();
|
|
if (StringUtils.isNotEmpty(jsonArray)){
|
|
if (StringUtils.isNotEmpty(jsonArray)){
|
|
@@ -980,8 +1021,9 @@ public class EdosUtil implements IEdosUtil {
|
|
}
|
|
}
|
|
return resultMap;
|
|
return resultMap;
|
|
|
|
|
|
- } else
|
|
+ } else {
|
|
return ErrorRequest.RequestMapError();
|
|
return ErrorRequest.RequestMapError();
|
|
|
|
+ }
|
|
} catch (HttpClientErrorException exception) {
|
|
} catch (HttpClientErrorException exception) {
|
|
if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
|
|
|
|
@@ -1029,12 +1071,13 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
|
|
|
|
Long finalInterval;
|
|
Long finalInterval;
|
|
- if (pried != null)
|
|
+ if (pried != null) {
|
|
finalInterval = pried;
|
|
finalInterval = pried;
|
|
- else if (count != null)
|
|
+ } else if (count != null) {
|
|
finalInterval = (endDate - beginDate) / count;
|
|
finalInterval = (endDate - beginDate) / count;
|
|
- else
|
|
+ } else {
|
|
return ErrorRequest.RequestListError(pointid);
|
|
return ErrorRequest.RequestListError(pointid);
|
|
|
|
+ }
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -1043,15 +1086,19 @@ public class EdosUtil implements IEdosUtil {
|
|
url = baseURL2 + "/history/snap?null=0";
|
|
url = baseURL2 + "/history/snap?null=0";
|
|
}
|
|
}
|
|
|
|
|
|
- if (tagName.isPresent())
|
|
+ if (tagName.isPresent()) {
|
|
url = url + "&tagName=" + tagName.get();
|
|
url = url + "&tagName=" + tagName.get();
|
|
|
|
+ }
|
|
|
|
|
|
- if (startTs.isPresent())
|
|
+ if (startTs.isPresent()) {
|
|
url = url + "&startTs=" + startTs.get();
|
|
url = url + "&startTs=" + startTs.get();
|
|
- if (endTs.isPresent())
|
|
+ }
|
|
|
|
+ if (endTs.isPresent()) {
|
|
url = url + "&endTs=" + endTs.get();
|
|
url = url + "&endTs=" + endTs.get();
|
|
- if (interval.isPresent())
|
|
+ }
|
|
|
|
+ if (interval.isPresent()) {
|
|
url = url + "&interval=" + interval.get();
|
|
url = url + "&interval=" + interval.get();
|
|
|
|
+ }
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
JSONArray jsonArray = resp.getBody();
|
|
JSONArray jsonArray = resp.getBody();
|
|
@@ -1095,7 +1142,7 @@ public class EdosUtil implements IEdosUtil {
|
|
} else {
|
|
} else {
|
|
PointData data = new PointData();
|
|
PointData data = new PointData();
|
|
data.setEdnaId(pointid);
|
|
data.setEdnaId(pointid);
|
|
- data.setPointTime(0l);
|
|
+ data.setPointTime(0L);
|
|
data.setPointValue("0");
|
|
data.setPointValue("0");
|
|
data.setPointName("1");
|
|
data.setPointName("1");
|
|
data.setPointValueInDouble(0.0);
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -1104,7 +1151,7 @@ public class EdosUtil implements IEdosUtil {
|
|
} else {
|
|
} else {
|
|
PointData data = new PointData();
|
|
PointData data = new PointData();
|
|
data.setEdnaId(pointid);
|
|
data.setEdnaId(pointid);
|
|
- data.setPointTime(0l);
|
|
+ data.setPointTime(0L);
|
|
data.setPointValue("0");
|
|
data.setPointValue("0");
|
|
data.setPointName("1");
|
|
data.setPointName("1");
|
|
data.setPointValueInDouble(0.0);
|
|
data.setPointValueInDouble(0.0);
|
|
@@ -1132,7 +1179,7 @@ public class EdosUtil implements IEdosUtil {
|
|
PointData po=new PointData();
|
|
PointData po=new PointData();
|
|
po.setEdnaId(pointid);
|
|
po.setEdnaId(pointid);
|
|
po.setPointValueInDouble(0.0);
|
|
po.setPointValueInDouble(0.0);
|
|
- po.setPointTime(0l);
|
|
+ po.setPointTime(0L);
|
|
pols.add(po);
|
|
pols.add(po);
|
|
return pols;
|
|
return pols;
|
|
}
|
|
}
|
|
@@ -1158,19 +1205,22 @@ public class EdosUtil implements IEdosUtil {
|
|
url = baseURL2 + "/history/raw?null=0";
|
|
url = baseURL2 + "/history/raw?null=0";
|
|
}
|
|
}
|
|
|
|
|
|
- if (tagName.isPresent())
|
|
+ if (tagName.isPresent()) {
|
|
url = url + "&tagName=" + tagName.get();
|
|
url = url + "&tagName=" + tagName.get();
|
|
- if (startTs.isPresent())
|
|
+ }
|
|
|
|
+ if (startTs.isPresent()) {
|
|
url = url + "&startTs=" + startTs.get();
|
|
url = url + "&startTs=" + startTs.get();
|
|
- if (endTs.isPresent())
|
|
+ }
|
|
|
|
+ if (endTs.isPresent()) {
|
|
url = url + "&endTs=" + endTs.get();
|
|
url = url + "&endTs=" + endTs.get();
|
|
|
|
+ }
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
|
|
|
|
JSONArray jsonArray = resp.getBody();
|
|
JSONArray jsonArray = resp.getBody();
|
|
- if (jsonArray != null)
|
|
+ if (jsonArray != null) {
|
|
return JsonObjectHelper.phrasePointData(jsonArray, pointid);
|
|
return JsonObjectHelper.phrasePointData(jsonArray, pointid);
|
|
- else {
|
|
+ } else {
|
|
return ErrorRequest.RequestListError(pointid);
|
|
return ErrorRequest.RequestListError(pointid);
|
|
}
|
|
}
|
|
} catch (HttpClientErrorException exception) {
|
|
} catch (HttpClientErrorException exception) {
|
|
@@ -1187,7 +1237,7 @@ public class EdosUtil implements IEdosUtil {
|
|
PointData po=new PointData();
|
|
PointData po=new PointData();
|
|
po.setEdnaId(pointid);
|
|
po.setEdnaId(pointid);
|
|
po.setPointValueInDouble(0.0);
|
|
po.setPointValueInDouble(0.0);
|
|
- po.setPointTime(0l);
|
|
+ po.setPointTime(0L);
|
|
pols.add(po);
|
|
pols.add(po);
|
|
return pols;
|
|
return pols;
|
|
}
|
|
}
|
|
@@ -1214,12 +1264,13 @@ public class EdosUtil implements IEdosUtil {
|
|
|
|
|
|
|
|
|
|
Long finalInterval;
|
|
Long finalInterval;
|
|
- if (pried != null)
|
|
+ if (pried != null) {
|
|
finalInterval = pried;
|
|
finalInterval = pried;
|
|
- else if (count != null)
|
|
+ } else if (count != null) {
|
|
finalInterval = (endDate - beginDate) / count;
|
|
finalInterval = (endDate - beginDate) / count;
|
|
- else
|
|
+ } else {
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
|
+ }
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -1230,28 +1281,34 @@ public class EdosUtil implements IEdosUtil {
|
|
url = baseURL + "/history/stat?null=0";
|
|
url = baseURL + "/history/stat?null=0";
|
|
}
|
|
}
|
|
|
|
|
|
- if (tagName.isPresent())
|
|
+ if (tagName.isPresent()) {
|
|
url = url + "&tagName=" + tagName.get();
|
|
url = url + "&tagName=" + tagName.get();
|
|
- else {
|
|
+ } else {
|
|
- if (thingType.isPresent())
|
|
+ if (thingType.isPresent()) {
|
|
url = url + "&thingType=" + thingType.get();
|
|
url = url + "&thingType=" + thingType.get();
|
|
- if (thingId.isPresent())
|
|
+ }
|
|
|
|
+ if (thingId.isPresent()) {
|
|
url = url + "&thingId=" + thingId.get();
|
|
url = url + "&thingId=" + thingId.get();
|
|
- if (uniformCode.isPresent())
|
|
+ }
|
|
|
|
+ if (uniformCode.isPresent()) {
|
|
url = url + "&uniformCodes=" + uniformCode.get();
|
|
url = url + "&uniformCodes=" + uniformCode.get();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (startTs.isPresent())
|
|
+ if (startTs.isPresent()) {
|
|
url = url + "&startTs=" + startTs.get();
|
|
url = url + "&startTs=" + startTs.get();
|
|
- if (endTs.isPresent())
|
|
+ }
|
|
|
|
+ if (endTs.isPresent()) {
|
|
url = url + "&endTs=" + endTs.get();
|
|
url = url + "&endTs=" + endTs.get();
|
|
- if (interval.isPresent())
|
|
+ }
|
|
|
|
+ if (interval.isPresent()) {
|
|
url = url + "&interval=" + interval.get();
|
|
url = url + "&interval=" + interval.get();
|
|
|
|
+ }
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
JSONArray jsonArray = resp.getBody();
|
|
JSONArray jsonArray = resp.getBody();
|
|
- if (jsonArray != null)
|
|
+ if (jsonArray != null) {
|
|
return JsonObjectHelper.GeneralTsDataToPointDataByStat(jsonArray, point.getNemCode(), type);
|
|
return JsonObjectHelper.GeneralTsDataToPointDataByStat(jsonArray, point.getNemCode(), type);
|
|
- else {
|
|
+ } else {
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
}
|
|
}
|
|
} catch (HttpClientErrorException exception) {
|
|
} catch (HttpClientErrorException exception) {
|
|
@@ -1268,7 +1325,7 @@ public class EdosUtil implements IEdosUtil {
|
|
PointData po=new PointData();
|
|
PointData po=new PointData();
|
|
po.setEdnaId(point.getNemCode());
|
|
po.setEdnaId(point.getNemCode());
|
|
po.setPointValueInDouble(0.0);
|
|
po.setPointValueInDouble(0.0);
|
|
- po.setPointTime(0l);
|
|
+ po.setPointTime(0L);
|
|
pols.add(po);
|
|
pols.add(po);
|
|
return pols;
|
|
return pols;
|
|
}
|
|
}
|
|
@@ -1288,12 +1345,13 @@ public class EdosUtil implements IEdosUtil {
|
|
Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
|
|
Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
|
|
|
|
|
|
Long finalInterval;
|
|
Long finalInterval;
|
|
- if (pried != null)
|
|
+ if (pried != null) {
|
|
finalInterval = pried;
|
|
finalInterval = pried;
|
|
- else if (count != null)
|
|
+ } else if (count != null) {
|
|
finalInterval = (endDate - beginDate) / count;
|
|
finalInterval = (endDate - beginDate) / count;
|
|
- else
|
|
+ } else {
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
|
|
+ }
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -1302,28 +1360,34 @@ public class EdosUtil implements IEdosUtil {
|
|
url = baseURL2 + "/history/stat?null=0";
|
|
url = baseURL2 + "/history/stat?null=0";
|
|
}
|
|
}
|
|
|
|
|
|
- if (tagName.isPresent())
|
|
+ if (tagName.isPresent()) {
|
|
url = url + "&tagName=" + tagName.get();
|
|
url = url + "&tagName=" + tagName.get();
|
|
- else {
|
|
+ } else {
|
|
- if (thingType.isPresent())
|
|
+ if (thingType.isPresent()) {
|
|
url = url + "&thingType=" + thingType.get();
|
|
url = url + "&thingType=" + thingType.get();
|
|
- if (thingId.isPresent())
|
|
+ }
|
|
|
|
+ if (thingId.isPresent()) {
|
|
url = url + "&thingId=" + thingId.get();
|
|
url = url + "&thingId=" + thingId.get();
|
|
- if (uniformCode.isPresent())
|
|
+ }
|
|
|
|
+ if (uniformCode.isPresent()) {
|
|
url = url + "&uniformCodes=" + uniformCode.get();
|
|
url = url + "&uniformCodes=" + uniformCode.get();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (startTs.isPresent())
|
|
+ if (startTs.isPresent()) {
|
|
url = url + "&startTs=" + startTs.get();
|
|
url = url + "&startTs=" + startTs.get();
|
|
- if (endTs.isPresent())
|
|
+ }
|
|
|
|
+ if (endTs.isPresent()) {
|
|
url = url + "&endTs=" + endTs.get();
|
|
url = url + "&endTs=" + endTs.get();
|
|
- if (interval.isPresent())
|
|
+ }
|
|
|
|
+ if (interval.isPresent()) {
|
|
url = url + "&interval=" + interval.get();
|
|
url = url + "&interval=" + interval.get();
|
|
|
|
+ }
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
JSONArray jsonArray = resp.getBody();
|
|
JSONArray jsonArray = resp.getBody();
|
|
- if (jsonArray != null)
|
|
+ if (jsonArray != null) {
|
|
return JsonObjectHelper.GeneralTsDataToPointDataByStat(jsonArray, point.getNemCode(), type);
|
|
return JsonObjectHelper.GeneralTsDataToPointDataByStat(jsonArray, point.getNemCode(), type);
|
|
- else {
|
|
+ } else {
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
return ErrorRequest.RequestListError(point.getNemCode());
|
|
}
|
|
}
|
|
} catch (HttpClientErrorException exception) {
|
|
} catch (HttpClientErrorException exception) {
|
|
@@ -1340,7 +1404,7 @@ public class EdosUtil implements IEdosUtil {
|
|
PointData po=new PointData();
|
|
PointData po=new PointData();
|
|
po.setEdnaId(point.getNemCode());
|
|
po.setEdnaId(point.getNemCode());
|
|
po.setPointValueInDouble(0.0);
|
|
po.setPointValueInDouble(0.0);
|
|
- po.setPointTime(0l);
|
|
+ po.setPointTime(0L);
|
|
pols.add(po);
|
|
pols.add(po);
|
|
return pols;
|
|
return pols;
|
|
}
|
|
}
|
|
@@ -1358,12 +1422,13 @@ public class EdosUtil implements IEdosUtil {
|
|
Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
|
|
Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
|
|
|
|
|
|
Long finalInterval;
|
|
Long finalInterval;
|
|
- if (count != null)
|
|
+ if (count != null) {
|
|
finalInterval = (endDate - beginDate) / count;
|
|
finalInterval = (endDate - beginDate) / count;
|
|
- else if (pried != null)
|
|
+ } else if (pried != null) {
|
|
finalInterval = pried;
|
|
finalInterval = pried;
|
|
- else
|
|
+ } else {
|
|
return null;
|
|
return null;
|
|
|
|
+ }
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
try {
|
|
try {
|
|
String url = baseURL + "/history/stat?null=0";
|
|
String url = baseURL + "/history/stat?null=0";
|
|
@@ -1371,20 +1436,24 @@ public class EdosUtil implements IEdosUtil {
|
|
url = baseURL2 + "/history/stat?null=0";
|
|
url = baseURL2 + "/history/stat?null=0";
|
|
}
|
|
}
|
|
|
|
|
|
- if (tagName.isPresent())
|
|
+ if (tagName.isPresent()) {
|
|
url = url + "&tagName=" + tagName.get();
|
|
url = url + "&tagName=" + tagName.get();
|
|
- if (startTs.isPresent())
|
|
+ }
|
|
|
|
+ if (startTs.isPresent()) {
|
|
url = url + "&startTs=" + startTs.get();
|
|
url = url + "&startTs=" + startTs.get();
|
|
- if (endTs.isPresent())
|
|
+ }
|
|
|
|
+ if (endTs.isPresent()) {
|
|
url = url + "&endTs=" + endTs.get();
|
|
url = url + "&endTs=" + endTs.get();
|
|
- if (interval.isPresent())
|
|
+ }
|
|
|
|
+ if (interval.isPresent()) {
|
|
url = url + "&interval=" + interval.get();
|
|
url = url + "&interval=" + interval.get();
|
|
|
|
+ }
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
JSONArray jsonArray = resp.getBody();
|
|
JSONArray jsonArray = resp.getBody();
|
|
- if (jsonArray != null)
|
|
+ if (jsonArray != null) {
|
|
return JsonObjectHelper.GeneralTsDataToPointDataByStat(jsonArray, pointid, type);
|
|
return JsonObjectHelper.GeneralTsDataToPointDataByStat(jsonArray, pointid, type);
|
|
- else {
|
|
+ } else {
|
|
return ErrorRequest.RequestListError(pointid);
|
|
return ErrorRequest.RequestListError(pointid);
|
|
}
|
|
}
|
|
} catch (HttpClientErrorException exception) {
|
|
} catch (HttpClientErrorException exception) {
|
|
@@ -1402,7 +1471,7 @@ public class EdosUtil implements IEdosUtil {
|
|
PointData po=new PointData();
|
|
PointData po=new PointData();
|
|
po.setEdnaId(pointid);
|
|
po.setEdnaId(pointid);
|
|
po.setPointValueInDouble(0.0);
|
|
po.setPointValueInDouble(0.0);
|
|
- po.setPointTime(0l);
|
|
+ po.setPointTime(0L);
|
|
pols.add(po);
|
|
pols.add(po);
|
|
return pols;
|
|
return pols;
|
|
}
|
|
}
|
|
@@ -1427,14 +1496,18 @@ public class EdosUtil implements IEdosUtil {
|
|
url = baseURL2 + "/history/stat?null=0";
|
|
url = baseURL2 + "/history/stat?null=0";
|
|
}
|
|
}
|
|
|
|
|
|
- if (tagName.isPresent())
|
|
+ if (tagName.isPresent()) {
|
|
url = url + "&tagName=" + tagName.get();
|
|
url = url + "&tagName=" + tagName.get();
|
|
- if (startTs.isPresent())
|
|
+ }
|
|
|
|
+ if (startTs.isPresent()) {
|
|
url = url + "&startTs=" + startTs.get();
|
|
url = url + "&startTs=" + startTs.get();
|
|
- if (endTs.isPresent())
|
|
+ }
|
|
|
|
+ if (endTs.isPresent()) {
|
|
url = url + "&endTs=" + endTs.get();
|
|
url = url + "&endTs=" + endTs.get();
|
|
- if (interval.isPresent())
|
|
+ }
|
|
|
|
+ if (interval.isPresent()) {
|
|
url = url + "&interval=" + interval.get();
|
|
url = url + "&interval=" + interval.get();
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
@@ -1650,8 +1723,9 @@ public class EdosUtil implements IEdosUtil {
|
|
throw exception;
|
|
throw exception;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- } else
|
|
+ } else {
|
|
return;
|
|
return;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1772,7 +1846,7 @@ public class EdosUtil implements IEdosUtil {
|
|
Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
|
|
Optional<Long> endTs = Optional.ofNullable(endDate * 1000);
|
|
|
|
|
|
|
|
|
|
- Long finalInterval=60l;
|
|
+ Long finalInterval= 60L;
|
|
|
|
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
Optional<Integer> interval = Optional.ofNullable(Integer.parseInt(finalInterval.toString()));
|
|
|
|
|
|
@@ -1782,15 +1856,19 @@ public class EdosUtil implements IEdosUtil {
|
|
url = baseURL2 + "/history/snap?null=0";
|
|
url = baseURL2 + "/history/snap?null=0";
|
|
}
|
|
}
|
|
|
|
|
|
- if (tagName.isPresent())
|
|
+ if (tagName.isPresent()) {
|
|
url = url + "&tagName=" + tagName.get();
|
|
url = url + "&tagName=" + tagName.get();
|
|
|
|
+ }
|
|
|
|
|
|
- if (startTs.isPresent())
|
|
+ if (startTs.isPresent()) {
|
|
url = url + "&startTs=" + startTs.get();
|
|
url = url + "&startTs=" + startTs.get();
|
|
- if (endTs.isPresent())
|
|
+ }
|
|
|
|
+ if (endTs.isPresent()) {
|
|
url = url + "&endTs=" + endTs.get();
|
|
url = url + "&endTs=" + endTs.get();
|
|
- if (interval.isPresent())
|
|
+ }
|
|
|
|
+ if (interval.isPresent()) {
|
|
url = url + "&interval=60" ;
|
|
url = url + "&interval=60" ;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|
|
ResponseEntity<JSONArray> resp = restTemplate.getForEntity(url, JSONArray.class);
|