|
@@ -1,11 +1,13 @@
|
|
|
package com.gyee.frame.service.app.targetdetail;
|
|
|
|
|
|
import com.gyee.frame.model.auto.Weatherfd;
|
|
|
+import com.gyee.frame.model.auto.Weatherfh;
|
|
|
import com.gyee.frame.model.auto.Windpowerinfoday;
|
|
|
import com.gyee.frame.model.custom.PointData;
|
|
|
import com.gyee.frame.model.enumeration.Messagetype;
|
|
|
import com.gyee.frame.netty.websocket.util.SocketToolService;
|
|
|
import com.gyee.frame.service.WeatherfdService;
|
|
|
+import com.gyee.frame.service.WeatherfhService;
|
|
|
import com.gyee.frame.service.WindpowerinfodayService;
|
|
|
import com.gyee.frame.util.DateUtils;
|
|
|
import com.gyee.frame.util.IRealTimeDataBaseUtil;
|
|
@@ -33,6 +35,8 @@ public class TargetdetailService extends SocketToolService {
|
|
|
@Resource
|
|
|
private WeatherfdService weatherfdService;
|
|
|
@Resource
|
|
|
+ private WeatherfhService weatherfhService;
|
|
|
+ @Resource
|
|
|
private WindpowerinfodayService windpowerinfodayService;
|
|
|
public static Map<String,String> targetdetail_target_pointMap = new HashMap<>();
|
|
|
public static Map<String,String> targetdetail_curve_pointMap = new HashMap<>();
|
|
@@ -165,8 +169,47 @@ public class TargetdetailService extends SocketToolService {
|
|
|
String id=temp[0];
|
|
|
String wpid=temp[1];
|
|
|
|
|
|
- set7DayValues(pointDataMap, ip, id, wpid);
|
|
|
+ if(id.equals("ycfs"))
|
|
|
+ {
|
|
|
+ setDayValues(pointDataMap, ip, id, wpid);
|
|
|
+ }else {
|
|
|
+ set7DayValues(pointDataMap, ip, id, wpid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }else if(pointid.indexOf("divq")!=-1)
|
|
|
+ {
|
|
|
+ pointid=pointid.substring(5);
|
|
|
+ Long count = (endTime.getTime() - beginTime.getTime()) / 1000L / 3600L;
|
|
|
+ List<PointData> ls = mongodb.getHistoryDatasSnap(pointid,
|
|
|
+ beginTime.getTime() / 1000, endTime.getTime() / 1000 + 3600L,
|
|
|
+ (long) count+1, 3600L);
|
|
|
+ for (int i = 0; i < ls.size(); i++) {
|
|
|
+ ls.get(i).setPointTime(ls.get(i).getPointTime() - 3600);
|
|
|
+ double temp= new BigDecimal(ls.get(i).getPointValueInDouble()).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
+ ls.get(i).setPointValueInDouble(temp);
|
|
|
+ }
|
|
|
+ if(ls.size()>0) {
|
|
|
+ ls.remove(0);
|
|
|
+ }
|
|
|
+ pointDataMap.put(ip,ls);
|
|
|
+
|
|
|
+ }else if(pointid.indexOf("divw")!=-1)
|
|
|
+ {
|
|
|
+ pointid=pointid.substring(5);
|
|
|
+ Long count = (endTime.getTime() - beginTime.getTime()) / 1000L / 3600L;
|
|
|
+ List<PointData> ls = mongodb.getHistoryDatasSnap(pointid,
|
|
|
+ beginTime.getTime() / 1000, endTime.getTime() / 1000 + 3600L,
|
|
|
+ (long) count+1, 3600L);
|
|
|
+ for (int i = 0; i < ls.size(); i++) {
|
|
|
+ ls.get(i).setPointTime(ls.get(i).getPointTime() - 3600);
|
|
|
+ double temp= new BigDecimal(ls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
+ ls.get(i).setPointValueInDouble(temp);
|
|
|
+ }
|
|
|
+ if(ls.size()>0) {
|
|
|
+ ls.remove(0);
|
|
|
}
|
|
|
+ pointDataMap.put(ip,ls);
|
|
|
|
|
|
}else
|
|
|
{
|
|
@@ -220,6 +263,38 @@ public class TargetdetailService extends SocketToolService {
|
|
|
set7DayValues(pointDataMap, ip, id, wpid);
|
|
|
}
|
|
|
|
|
|
+ }else if(pointid.indexOf("divq")!=-1)
|
|
|
+ {
|
|
|
+ pointid=pointid.substring(5);
|
|
|
+ List<PointData> ls = mongodb.getHistoryDatasSnap(pointid,
|
|
|
+ beginTime.getTime() / 1000, endTime.getTime() / 1000 + 3600L*24,
|
|
|
+ 8L, 3600 * 24L);
|
|
|
+ for (int i = 0; i < ls.size(); i++) {
|
|
|
+ ls.get(i).setPointTime(ls.get(i).getPointTime() - 24 * 3600);
|
|
|
+ double temp= new BigDecimal(ls.get(i).getPointValueInDouble()).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
+ ls.get(i).setPointValueInDouble(temp);
|
|
|
+ }
|
|
|
+ if(ls.size()>0) {
|
|
|
+ ls.remove(0);
|
|
|
+ }
|
|
|
+ pointDataMap.put(ip,ls);
|
|
|
+
|
|
|
+ }else if(pointid.indexOf("divw")!=-1)
|
|
|
+ {
|
|
|
+ pointid=pointid.substring(5);
|
|
|
+ List<PointData> ls = mongodb.getHistoryDatasSnap(pointid,
|
|
|
+ beginTime.getTime() / 1000, endTime.getTime() / 1000 + 3600L*24,
|
|
|
+ 8L, 3600 * 24L);
|
|
|
+ for (int i = 0; i < ls.size(); i++) {
|
|
|
+ ls.get(i).setPointTime(ls.get(i).getPointTime() - 24 * 3600);
|
|
|
+ double temp= new BigDecimal(ls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
+ ls.get(i).setPointValueInDouble(temp);
|
|
|
+ }
|
|
|
+ if(ls.size()>0) {
|
|
|
+ ls.remove(0);
|
|
|
+ }
|
|
|
+ pointDataMap.put(ip,ls);
|
|
|
+
|
|
|
}else
|
|
|
{
|
|
|
List<PointData> ls = mongodb.getHistoryDatasSnap(pointid,
|
|
@@ -335,5 +410,31 @@ public class TargetdetailService extends SocketToolService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void setDayValues(Map<String, List<PointData>> pointDataMap, String ip, String id, String wpid) throws ParseException {
|
|
|
+ switch (id) {
|
|
|
+ case "ycfs":
|
|
|
+ if(wpid.equals("0"))
|
|
|
+ {
|
|
|
+ wpid="MHS_FDC";
|
|
|
+ }
|
|
|
+ List<Weatherfh> list=weatherfhService.listDayHour(wpid);
|
|
|
+ List<PointData> vos=new ArrayList<>();
|
|
|
+ if(!list.isEmpty())
|
|
|
+ {
|
|
|
+ for (Weatherfh fh:list)
|
|
|
+ {
|
|
|
+ PointData vo=new PointData();
|
|
|
+ vo.setPointTime(fh.getRecodedata().getTime());
|
|
|
+ vo.setPointValueInDouble(fh.getSpeed());
|
|
|
+ vos.add(vo);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ pointDataMap.put(ip, vos);
|
|
|
+ break;
|
|
|
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|