|
@@ -6,17 +6,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.gyee.backconfig.model.auto.Indicators;
|
|
|
import com.gyee.backconfig.mapper.auto.IndicatorsMapper;
|
|
|
-import com.gyee.backconfig.model.auto.Project;
|
|
|
-import com.gyee.backconfig.model.auto.Standardpoint;
|
|
|
import com.gyee.backconfig.model.auto.Windpowerstationpointnew;
|
|
|
import com.gyee.backconfig.service.auto.*;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.gyee.backconfig.util.realtimedate.EdosUtil;
|
|
|
import com.gyee.common.model.PointData;
|
|
|
import com.gyee.common.model.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.web.client.HttpClientErrorException;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import javax.xml.crypto.Data;
|
|
@@ -38,6 +35,9 @@ public class IndicatorsServiceImpl extends ServiceImpl<IndicatorsMapper, Indicat
|
|
|
private static String baseURL = "http://10.81.3.152:8011/ts";
|
|
|
|
|
|
@Autowired
|
|
|
+ private EdosUtil goldenUtil;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private IStandardpointService standardpointService;
|
|
|
|
|
|
@Autowired
|
|
@@ -80,7 +80,7 @@ public class IndicatorsServiceImpl extends ServiceImpl<IndicatorsMapper, Indicat
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public boolean addOrUpdate(Indicators indicators) {
|
|
|
+ public boolean addOrUpdate(Indicators indicators) throws Exception{
|
|
|
// boolean b = this.saveOrUpdate(indicators);
|
|
|
boolean b = false;
|
|
|
if(null==indicators.getId()){
|
|
@@ -96,12 +96,8 @@ public class IndicatorsServiceImpl extends ServiceImpl<IndicatorsMapper, Indicat
|
|
|
point.setEdnaId(stationlist.get(0).getCode());
|
|
|
point.setPointTime(indicators.getCreatetime().getTime());
|
|
|
point.setPointValueInDouble(Double.valueOf(indicators.getValue()));
|
|
|
- b = addSinglePoint(point);
|
|
|
+ goldenUtil.sendSinglePoint(point);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
return b;
|
|
|
}
|
|
|
|
|
@@ -113,34 +109,4 @@ public class IndicatorsServiceImpl extends ServiceImpl<IndicatorsMapper, Indicat
|
|
|
}
|
|
|
|
|
|
|
|
|
- public boolean addSinglePoint(PointData point) {
|
|
|
- String url = baseURL + "/latest";
|
|
|
- try {
|
|
|
- String result = restTemplate.postForObject(url, convertPointData(point), String.class);
|
|
|
- } catch (HttpClientErrorException exception) {
|
|
|
- if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
|
|
|
- return false;
|
|
|
- } else {
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private JSONObject convertPointData(PointData pd) {
|
|
|
- JSONObject jo = new JSONObject();
|
|
|
- jo.put("tagName", pd.getEdnaId());
|
|
|
- JSONObject joo = new JSONObject();
|
|
|
- joo.put("ts", pd.getPointTime()*1000);
|
|
|
- joo.put("status", 0);
|
|
|
- joo.put("doubleValue", pd.getPointValueInDouble());
|
|
|
- jo.put("tsData", joo);
|
|
|
- return jo;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|