|
@@ -40,46 +40,28 @@ public class PerformanceCurvefittingService {
|
|
|
public Map<String, List<CurveVo>> curvefitting(String windturbineIds, String type,String dateType) {
|
|
|
Map<String, List<CurveVo>> resultMap = new HashMap<>();
|
|
|
Map<String, ProBasicEquipment> wtmap = CacheContext.wtmap;
|
|
|
+ if (type.equals("-1")) {
|
|
|
+ String zbzgl = redisService.get("ZLLGL");
|
|
|
+ Map<String, Map<Double, ZllglDTO>> zbzglMap = JSONObject.parseObject(zbzgl, new TypeReference<Map<String, Map<Double, ZllglDTO>>>() {
|
|
|
+ });
|
|
|
+ Map<String, Map<Double, Double>> znhglMap = getWtCurveFitting(windturbineIds, dateType);
|
|
|
|
|
|
- String zbzgl = redisService.get("ZLLGL");
|
|
|
- Map<String, Map<Double, ZllglDTO>> zbzglMap = JSONObject.parseObject(zbzgl, new TypeReference<Map<String, Map<Double, ZllglDTO>>>() {
|
|
|
- });
|
|
|
- Map<String,Map<Double,Double>> znhglMap = getWtCurveFitting(windturbineIds,dateType);
|
|
|
- if (type.equals("0")){
|
|
|
List<CurveVo> tempList = new ArrayList<>();
|
|
|
- if (znhglMap.containsKey(windturbineIds)){
|
|
|
+ if (znhglMap.containsKey(windturbineIds)) {
|
|
|
Map<Double, Double> zsglmap = znhglMap.get(windturbineIds);
|
|
|
Map<Double, ZllglDTO> bzglmap = zbzglMap.get(wtmap.get(windturbineIds).getModelId());
|
|
|
Set<Double> speeds = zsglmap.keySet();
|
|
|
- speeds.stream().forEach(speed->{
|
|
|
+ speeds.stream().forEach(speed -> {
|
|
|
CurveVo vo = new CurveVo();
|
|
|
vo.setWtid(windturbineIds);
|
|
|
vo.setSpeed(speed);
|
|
|
- vo.setTheorypower(DoubleUtils.keepPrecision(zsglmap.get(speed),2));
|
|
|
- vo.setEnsurepower(DoubleUtils.keepPrecision(bzglmap.containsKey(speed)?bzglmap.get(speed).getEnsurePower():zsglmap.get(speed),2));
|
|
|
+ vo.setTheorypower(DoubleUtils.keepPrecision(zsglmap.get(speed), 2));
|
|
|
+ vo.setEnsurepower(DoubleUtils.keepPrecision(bzglmap.containsKey(speed) ? bzglmap.get(speed).getEnsurePower() : zsglmap.get(speed), 2));
|
|
|
tempList.add(vo);
|
|
|
});
|
|
|
- SortUtils.sort(tempList,"speed",SortUtils.ASC);
|
|
|
- resultMap.put(windturbineIds,tempList);
|
|
|
+ SortUtils.sort(tempList, "speed", SortUtils.ASC);
|
|
|
+ resultMap.put(windturbineIds, tempList);
|
|
|
}
|
|
|
- }else {
|
|
|
- String[] wts = windturbineIds.split(",");
|
|
|
- Arrays.stream(wts).forEach(wt->{
|
|
|
- List<CurveVo> tempList = new ArrayList<>();
|
|
|
- if(znhglMap.get(wt) == null || znhglMap.size() == 0)
|
|
|
- return;
|
|
|
- Map<Double, Double> zsglmap = znhglMap.get(wt);
|
|
|
- Set<Double> speeds = zsglmap.keySet();
|
|
|
- speeds.stream().forEach(speed->{
|
|
|
- CurveVo vo = new CurveVo();
|
|
|
- vo.setWtid(wt);
|
|
|
- vo.setSpeed(speed);
|
|
|
- vo.setTheorypower(DoubleUtils.keepPrecision(zsglmap.get(speed),2));
|
|
|
- tempList.add(vo);
|
|
|
- });
|
|
|
- SortUtils.sort(tempList,"speed",SortUtils.ASC);
|
|
|
- resultMap.put(wt,tempList);
|
|
|
- });
|
|
|
}
|
|
|
|
|
|
return resultMap;
|