|
@@ -3,10 +3,8 @@ package com.gyee.frame.service.peranalysis;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
import com.gyee.frame.common.cache.IGlobalCache;
|
|
|
-import com.gyee.frame.common.spring.InitialRunner;
|
|
|
import com.gyee.frame.model.auto.Freedom;
|
|
|
import com.gyee.frame.model.auto.Windpowerstationpointnew;
|
|
|
-import com.gyee.frame.model.custom.InitVo;
|
|
|
import com.gyee.frame.model.custom.PointData;
|
|
|
import com.gyee.frame.model.custom.PointPerSisVo;
|
|
|
import com.gyee.frame.util.*;
|
|
@@ -27,54 +25,40 @@ public class PointPerSisService {
|
|
|
|
|
|
IRealTimeDataBaseUtil realApiUtil = RealTimeDataBaseFactory.createRealTimeDataBase();
|
|
|
|
|
|
- public List<PointPerSisVo> freedomList(String station, Long beginDate, Long endDate, Integer interval, String uniformcodes) throws Exception {
|
|
|
+ public List<PointPerSisVo> freedomList(String wtid, Long beginDate, Long endDate, Integer interval, String uniformcodes) throws Exception {
|
|
|
List<PointPerSisVo> vos = new ArrayList<>();
|
|
|
|
|
|
{
|
|
|
- String[] codes = uniformcodes.split(",");
|
|
|
|
|
|
- String wpString = (String) (globalCache.get(station));
|
|
|
+ String[] wtids = wtid.split(",");
|
|
|
+ for (String w : wtids) {
|
|
|
+ String[] codes = uniformcodes.split(",");
|
|
|
|
|
|
- Map<String, Windpowerstationpointnew> windturbinetestingpointaiMap = JSONObject.parseObject(wpString, new TypeReference<Map<String, Windpowerstationpointnew>>() {
|
|
|
- });
|
|
|
+ String wpString = (String) (globalCache.get(w));
|
|
|
|
|
|
+ Map<String, Windpowerstationpointnew> windturbinetestingpointaiMap = JSONObject.parseObject(wpString, new TypeReference<Map<String, Windpowerstationpointnew>>() {
|
|
|
+ });
|
|
|
|
|
|
- List<Object> resultList = new ArrayList<>();
|
|
|
+ PointPerSisVo vo = new PointPerSisVo();
|
|
|
+ vo.setWtid(w);
|
|
|
|
|
|
- Map<String, List<PointData>> pointDataMap = new HashMap<>();
|
|
|
- for (int i = 0; i < codes.length; i++) {
|
|
|
- Windpowerstationpointnew windturbinetestingpointai = windturbinetestingpointaiMap.get(StringUtils.upperCase(codes[i]));
|
|
|
- if (StringUtils.isNotNull(windturbinetestingpointai)) {
|
|
|
- try {
|
|
|
- List<PointData> historyDatas = realApiUtil.getHistoryDatasSnap(windturbinetestingpointai, beginDate / 1000, endDate / 1000, null, interval * 60l);
|
|
|
- pointDataMap.put(codes[i], historyDatas);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ Map<String, List<PointData>> pointDataMap = new HashMap<>();
|
|
|
+ for (int i = 0; i < codes.length; i++) {
|
|
|
+ Windpowerstationpointnew windturbinetestingpointai = windturbinetestingpointaiMap.get(StringUtils.upperCase(codes[i]));
|
|
|
+ if (StringUtils.isNotNull(windturbinetestingpointai)) {
|
|
|
+ try {
|
|
|
+ List<PointData> historyDatas = realApiUtil.getHistoryDatasSnap(windturbinetestingpointai, beginDate / 1000, endDate / 1000, null, interval * 60l);
|
|
|
+ pointDataMap.put(codes[i], historyDatas);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ vo.setPointDataMap(pointDataMap);
|
|
|
+ vos.add(vo);
|
|
|
}
|
|
|
|
|
|
- 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(station);
|
|
|
- initVo.setWtname(InitialRunner.wtmap.get(station).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 vos;
|
|
|
|
|
|
}
|