|
@@ -1,18 +1,26 @@
|
|
|
package com.gyee.ghost.service.auto;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
|
+import com.gyee.common.model.PointData;
|
|
|
import com.gyee.common.model.StringUtils;
|
|
|
import com.gyee.common.util.CommonUtils;
|
|
|
import com.gyee.common.util.DateUtils;
|
|
|
import com.gyee.common.util.DoubleUtils;
|
|
|
import com.gyee.common.util.SortUtils;
|
|
|
+import com.gyee.common.vo.analysis.DeskObject;
|
|
|
import com.gyee.ghost.contant.Contant;
|
|
|
import com.gyee.ghost.init.CacheContext;
|
|
|
import com.gyee.ghost.model.auto.*;
|
|
|
+import com.gyee.ghost.util.realtimesource.ClassUtil;
|
|
|
import com.gyee.ghost.util.realtimesource.IEdosUtil;
|
|
|
+import com.gyee.ghost.util.realtimesource.StringUtil;
|
|
|
+import com.gyee.ghost.vo.InitVo;
|
|
|
import com.gyee.ghost.vo.NatureVo;
|
|
|
+import com.gyee.ghost.vo.WindturbineVo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
@@ -36,6 +44,8 @@ public class GhostService {
|
|
|
private IShutdowneventService shutdowneventService;
|
|
|
@Resource
|
|
|
private IEdosUtil edosUtil;
|
|
|
+ @Resource
|
|
|
+ private IFreedomService freedomService;
|
|
|
/**
|
|
|
* 存储fanoperation运行分析表
|
|
|
*/
|
|
@@ -65,7 +75,7 @@ public class GhostService {
|
|
|
Fanoperation fanoperation = new Fanoperation();
|
|
|
fanoperation.setId(CommonUtils.getUUID());
|
|
|
fanoperation.setWindturbineid(wt.getId());
|
|
|
- fanoperation.setWindturbinename(wt.getName());
|
|
|
+ fanoperation.setWindturbinename(wt.getCode());
|
|
|
fanoperation.setWindpowerstationid(wt.getWindpowerstationid());
|
|
|
Optional<Windturbineinfoday> optionalWindturbineinfoday = windturbineinfodayList.stream().filter(w -> w.getWindturbineid().equals(wt.getId())).findFirst();
|
|
|
Optional<Windturbineinfoday3> optionalWindturbineinfoday3 = windturbineinfoday3List.stream().filter(w -> w.getWindturbineid().equals(wt.getId())).findFirst();
|
|
@@ -132,7 +142,7 @@ public class GhostService {
|
|
|
Nature nature = new Nature();
|
|
|
nature.setId(CommonUtils.getUUID());
|
|
|
nature.setWindturbineid(wt.getId());
|
|
|
- nature.setWindturbinename(wt.getName());
|
|
|
+ nature.setWindturbinename(wt.getCode());
|
|
|
nature.setWindpowerstationid(wt.getWindpowerstationid());
|
|
|
|
|
|
Optional<Windturbineinfoday> optionalWindturbineinfoday = windturbineinfodayList.stream().filter(w -> w.getWindturbineid().equals(wt.getId())).findFirst();
|
|
@@ -258,7 +268,7 @@ public class GhostService {
|
|
|
shutdowneventList.stream().forEach(shutdownevent->{
|
|
|
String stoptypeid = shutdownevent.getStoptypeid();
|
|
|
shutdownevent.setStoptypeid(stopmap.get(stoptypeid));
|
|
|
- shutdownevent.setWindturbineid(wtmap.get(shutdownevent.getWindturbineid()).getName());
|
|
|
+ shutdownevent.setWindturbineid(wtmap.get(shutdownevent.getWindturbineid()).getCode());
|
|
|
resultList.add(shutdownevent);
|
|
|
});
|
|
|
SortUtils.sort(resultList,"stoptime",SortUtils.DESC);
|
|
@@ -295,7 +305,7 @@ public class GhostService {
|
|
|
|
|
|
NatureVo vo = new NatureVo();
|
|
|
vo.setWindturbineId(wt.getId());
|
|
|
- vo.setWindturbineName(wtmap.get(wt.getId()).getName());
|
|
|
+ vo.setWindturbineName(wtmap.get(wt.getId()).getCode());
|
|
|
vo.setWindDirection(wtDataMap.get(wt.getId()+"_AI010"));
|
|
|
vo.setSpeed(wtDataMap.get(wt.getId()+"_AI022"));
|
|
|
vo.setPower(wtDataMap.get(wt.getId()+"_AI130"));
|
|
@@ -332,4 +342,75 @@ public class GhostService {
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ public List<Freedom> points() {
|
|
|
+ return freedomService.list();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public List<Object> freedomList(String wtid, Long beginDate, Long endDate, Integer interval, String uniformcodes) throws Exception {
|
|
|
+ String[] codes = uniformcodes.split(",");
|
|
|
+ Map<String, Map<String, Windturbinetestingpointai>> wtpAimap = CacheContext.wtpAimap;
|
|
|
+
|
|
|
+ Map<String, Windturbinetestingpointai> windturbinetestingpointaiMap = wtpAimap.get(wtid);
|
|
|
+
|
|
|
+
|
|
|
+ List<Object> resultList = new ArrayList<>();
|
|
|
+
|
|
|
+ Map<String,List<PointData>> pointDataMap = new HashMap<>();
|
|
|
+ for (int i =0;i<codes.length;i++){
|
|
|
+ Windturbinetestingpointai windturbinetestingpointai = windturbinetestingpointaiMap.get(StringUtils.upperCase(codes[i]));
|
|
|
+ if (StringUtils.isNotNull(windturbinetestingpointai)){
|
|
|
+ try {
|
|
|
+ List<PointData> historyDatas = edosUtil.getHistoryDatasSnap(windturbinetestingpointai, beginDate / 1000, endDate / 1000, null, interval * 60l);
|
|
|
+ pointDataMap.put(codes[i],historyDatas);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ List<PointData> pointData = pointDataMap.get(codes[0]);
|
|
|
+ if (StringUtils.isNotNull(pointData)){
|
|
|
+ for (int i = 0;i<pointData.size();i++){
|
|
|
+ InitVo initVo = new InitVo();
|
|
|
+ initVo.setWtid(wtid);
|
|
|
+ initVo.setWtname(CacheContext.wtmap.get(wtid).getCode());
|
|
|
+ LinkedHashMap addMap = new LinkedHashMap();
|
|
|
+ LinkedHashMap addValMap = new LinkedHashMap();
|
|
|
+
|
|
|
+ addMap.put("time", Class.forName("java.lang.Long"));
|
|
|
+ addValMap.put("time", pointData.get(i).getPointTime()*1000);
|
|
|
+
|
|
|
+ for (int j=0;j<codes.length;j++){
|
|
|
+ addMap.put(StringUtils.upperCase(codes[j]), Class.forName("java.lang.Double"));
|
|
|
+ addValMap.put(StringUtils.upperCase(codes[j]), DoubleUtils.keepPrecision(pointDataMap.get(codes[j]).get(i).getPointValueInDouble(),2));
|
|
|
+ }
|
|
|
+ Object o = new ClassUtil().dynamicClass(initVo, addMap, addValMap);
|
|
|
+ resultList.add(o);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return resultList;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public List<WindturbineVo> wtls() {
|
|
|
+ List<Windturbine> wtls = CacheContext.wtls;
|
|
|
+ List<Windpowerstation> wpls = CacheContext.wpls;
|
|
|
+ List<WindturbineVo> volist = new ArrayList<>();
|
|
|
+
|
|
|
+ wpls.stream().forEach(wp->{
|
|
|
+ WindturbineVo vo = new WindturbineVo();
|
|
|
+ vo.setId(wp.getId());
|
|
|
+ vo.setCode(wp.getName());
|
|
|
+ List<Windturbine> windturbines = wtls.stream().filter(wt -> wt.getWindpowerstationid().equals(wp.getId())).collect(Collectors.toList());
|
|
|
+ vo.setData(windturbines);
|
|
|
+ volist.add(vo);
|
|
|
+ });
|
|
|
+
|
|
|
+ return volist;
|
|
|
+ }
|
|
|
}
|