|
@@ -35,7 +35,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public PointData getRealData(Windpowerstationpointnew point) throws Exception {
|
|
|
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(point) && com.gyee.common.model.StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
{
|
|
|
try {
|
|
|
Optional<String> keys = Optional.ofNullable(point.getCode());
|
|
@@ -55,7 +55,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
|
JSONObject jsonArray = resp.getBody();
|
|
|
- if (com.gyee.common.model.StringUtils.isNotEmpty(jsonArray)){
|
|
|
+ if (StringUtils.isNotEmpty(jsonArray)){
|
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
|
if (list.size() > 0)
|
|
|
return list.get(0);
|
|
@@ -87,7 +87,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public List<PointData> getHistoryDatasSnap(Windpowerstationpointnew point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
|
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(point) && com.gyee.common.model.StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
{
|
|
|
Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
|
Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
|
|
@@ -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);
|
|
@@ -261,7 +261,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public List<PointData> getHistoryDatasRaw(Windpowerstationpointnew point, Long beginDate, Long endDate) throws Exception {
|
|
|
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(point) && com.gyee.common.model.StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
{
|
|
|
Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
|
Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
|
|
@@ -321,7 +321,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public PointData getRealData(Windturbinetestingpointnew point) throws Exception {
|
|
|
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(point) && com.gyee.common.model.StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
{
|
|
|
Optional<String> keys = Optional.ofNullable(point.getCode());
|
|
|
Optional<String> thingType = Optional.ofNullable(point.getModelid());
|
|
@@ -343,7 +343,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
}
|
|
|
ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
|
JSONObject jsonArray = resp.getBody();
|
|
|
- if (com.gyee.common.model.StringUtils.isNotEmpty(jsonArray)){
|
|
|
+ if (StringUtils.isNotEmpty(jsonArray)){
|
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
|
if (list.size() > 0)
|
|
|
return list.get(0);
|
|
@@ -375,7 +375,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public List<PointData> getHistoryDatasSnap(Windturbinetestingpointnew point, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
|
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(point) && com.gyee.common.model.StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
{
|
|
|
Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
|
Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
|
|
@@ -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);
|
|
@@ -499,7 +499,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
@Override
|
|
|
public List<PointData> getHistoryDatasRaw(Windturbinetestingpointnew point, Long beginDate, Long endDate) throws Exception {
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(point) && com.gyee.common.model.StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
{
|
|
|
Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
|
Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
|
|
@@ -557,7 +557,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public PointData getRealData(String pointid) throws Exception {
|
|
|
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(pointid) && !V2Config.getInitialcode().equals(pointid))
|
|
|
+ if(StringUtils.notEmp(pointid) && !V2Config.getInitialcode().equals(pointid))
|
|
|
{
|
|
|
Optional<String> keys = Optional.ofNullable(pointid);
|
|
|
String url = baseURL + "/latest?null=0";
|
|
@@ -569,7 +569,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
|
|
|
ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
|
JSONObject jsonArray = resp.getBody();
|
|
|
- if (com.gyee.common.model.StringUtils.isNotEmpty(jsonArray)){
|
|
|
+ if (StringUtils.isNotEmpty(jsonArray)){
|
|
|
List<PointData> list = JsonObjectHelper.phrasePointData(jsonArray);
|
|
|
if (list.size() > 0)
|
|
|
return list.get(0);
|
|
@@ -602,17 +602,17 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
public List<PointData> getRealData(String... pointids) throws Exception {
|
|
|
|
|
|
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(pointids) )
|
|
|
+ if(StringUtils.notEmp(pointids) )
|
|
|
{
|
|
|
List<String> idls=new ArrayList<>();
|
|
|
for(String str:pointids)
|
|
|
{
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(str) && !V2Config.getInitialcode().equals(str))
|
|
|
+ if(StringUtils.notEmp(str) && !V2Config.getInitialcode().equals(str))
|
|
|
{
|
|
|
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();
|
|
@@ -747,17 +740,17 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
public List<PointData> getRealData(List<String> pointids) throws Exception {
|
|
|
|
|
|
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(pointids) )
|
|
|
+ if(StringUtils.notEmp(pointids) )
|
|
|
{
|
|
|
List<String> idls=new ArrayList<>();
|
|
|
for(String str:pointids)
|
|
|
{
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(str) && !V2Config.getInitialcode().equals(str))
|
|
|
+ if(StringUtils.notEmp(str) && !V2Config.getInitialcode().equals(str))
|
|
|
{
|
|
|
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()) {
|
|
@@ -892,12 +877,12 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
public Map<String, Double> getRealDataMap(String... pointids) throws Exception {
|
|
|
|
|
|
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(pointids) )
|
|
|
+ if(StringUtils.notEmp(pointids) )
|
|
|
{
|
|
|
List<String> idls=new ArrayList<>();
|
|
|
for(String str:pointids)
|
|
|
{
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(str) && !V2Config.getInitialcode().equals(str))
|
|
|
+ if(StringUtils.notEmp(str) && !V2Config.getInitialcode().equals(str))
|
|
|
{
|
|
|
idls.add(str);
|
|
|
}
|
|
@@ -914,7 +899,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
return null;
|
|
|
ResponseEntity<JSONObject> resp = restTemplate.getForEntity(url, JSONObject.class);
|
|
|
JSONObject jsonArray = resp.getBody();
|
|
|
- if (com.gyee.common.model.StringUtils.isNotEmpty(jsonArray)){
|
|
|
+ if (StringUtils.isNotEmpty(jsonArray)){
|
|
|
Iterator<String> sIterator = jsonArray.keySet().iterator();
|
|
|
Map<String, Double> resultMap = new HashMap();
|
|
|
while (sIterator.hasNext()) {
|
|
@@ -978,7 +963,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public List<PointData> getHistoryDatasSnap(String pointid, Long beginDate, Long endDate, Long count, Long pried) throws Exception {
|
|
|
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(pointid) && !V2Config.getInitialcode().equals(pointid))
|
|
|
+ if(StringUtils.notEmp(pointid) && !V2Config.getInitialcode().equals(pointid))
|
|
|
{
|
|
|
Optional<String> tagName = Optional.ofNullable(pointid);
|
|
|
Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
|
|
@@ -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);
|
|
@@ -1096,7 +1081,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
public List<PointData> getHistoryDatasRaw(String pointid, Long beginDate, Long endDate) throws Exception {
|
|
|
|
|
|
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(pointid) && !V2Config.getInitialcode().equals(pointid))
|
|
|
+ if(StringUtils.notEmp(pointid) && !V2Config.getInitialcode().equals(pointid))
|
|
|
{
|
|
|
Optional<String> tagName = Optional.ofNullable(pointid);
|
|
|
Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
|
|
@@ -1144,7 +1129,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public List<PointData> getHistStat(Windturbinetestingpointnew point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
|
|
|
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(point) && com.gyee.common.model.StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
{
|
|
|
Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
|
Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
|
|
@@ -1220,7 +1205,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
@Override
|
|
|
public List<PointData> getHistStat(Windpowerstationpointnew point, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
|
|
|
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(point) && com.gyee.common.model.StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
+ if(StringUtils.notEmp(point) && StringUtils.notEmp(point.getCode()) && !V2Config.getInitialcode().equals(point.getCode()))
|
|
|
{
|
|
|
Optional<String> tagName = Optional.ofNullable(point.getCode());
|
|
|
Optional<String> thingId = Optional.ofNullable(point.getWindpowerstationid());
|
|
@@ -1290,7 +1275,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
public List<PointData> getHistStat(String pointid, Long beginDate, Long endDate, Long count, Long pried, int type) throws Exception {
|
|
|
|
|
|
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(pointid) && !V2Config.getInitialcode().equals(pointid))
|
|
|
+ if(StringUtils.notEmp(pointid) && !V2Config.getInitialcode().equals(pointid))
|
|
|
{
|
|
|
Optional<String> tagName = Optional.ofNullable(pointid);
|
|
|
Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
|
|
@@ -1349,7 +1334,7 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
public DNAStatVal[] getHistStat(String point, Long beginDate, Long endDate, Integer pried) throws Exception {
|
|
|
|
|
|
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(point) && !V2Config.getInitialcode().equals(point))
|
|
|
+ if(StringUtils.notEmp(point) && !V2Config.getInitialcode().equals(point))
|
|
|
{
|
|
|
Optional<String> tagName = Optional.ofNullable(point);
|
|
|
Optional<Long> startTs = Optional.ofNullable(beginDate * 1000);
|
|
@@ -1461,16 +1446,23 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
public DNAVal[] getRealtimeTagValues(String... tagNames) throws Exception {
|
|
|
|
|
|
|
|
|
- if (com.gyee.common.model.StringUtils.notEmp(tagNames) && tagNames.length > 0) {
|
|
|
+ if (StringUtils.notEmp(tagNames) && tagNames.length > 0) {
|
|
|
|
|
|
|
|
|
DNAVal[] result = new DNAVal[tagNames.length];
|
|
|
for (int i = 0; i < tagNames.length; i++) {
|
|
|
- if (com.gyee.common.model.StringUtils.notEmp(tagNames[i]) && !V2Config.getInitialcode().equals(tagNames[i])) {
|
|
|
+ if (StringUtils.notEmp(tagNames[i]) && !V2Config.getInitialcode().equals(tagNames[i])) {
|
|
|
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 {
|
|
@@ -1582,12 +1604,12 @@ public class EdosUtil implements IRealTimeDataBaseUtil {
|
|
|
public DNAVal[] getHistMatrix(String[] nameList, long tTime) throws Exception {
|
|
|
|
|
|
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(nameList) )
|
|
|
+ if(StringUtils.notEmp(nameList) )
|
|
|
{
|
|
|
List<String> idls=new ArrayList<>();
|
|
|
for(String str:nameList)
|
|
|
{
|
|
|
- if(com.gyee.common.model.StringUtils.notEmp(str) && !V2Config.getInitialcode().equals(str))
|
|
|
+ if(StringUtils.notEmp(str) && !V2Config.getInitialcode().equals(str))
|
|
|
{
|
|
|
idls.add(str);
|
|
|
}
|