|
@@ -5,11 +5,15 @@ import com.alibaba.fastjson.TypeReference;
|
|
|
import com.gyee.benchmarkingweb.init.CacheContext;
|
|
|
import com.gyee.benchmarkingweb.model.auto.Windturbine;
|
|
|
import com.gyee.benchmarkingweb.util.redis.RedisService;
|
|
|
+import com.gyee.common.util.DoubleUtils;
|
|
|
import com.gyee.common.util.SortUtils;
|
|
|
import com.gyee.common.vo.curve.CurveVo;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
+import java.text.NumberFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -32,7 +36,6 @@ public class PerformanceService {
|
|
|
String zzsgl = redisService.get("ZZSGL");
|
|
|
Map<String,Map<Double,Double>> zzsglMap = JSONObject.parseObject(zzsgl, new TypeReference<Map<String, Map<Double,Double>>>() {
|
|
|
});
|
|
|
-
|
|
|
if (type.equals("0")){
|
|
|
List<CurveVo> tempList = new ArrayList<>();
|
|
|
if (zzsglMap.containsKey(wtids)){
|
|
@@ -43,8 +46,8 @@ public class PerformanceService {
|
|
|
CurveVo vo = new CurveVo();
|
|
|
vo.setWtid(wtids);
|
|
|
vo.setSpeed(speed);
|
|
|
- vo.setTheorypower(zsglmap.get(speed));
|
|
|
- vo.setEnsurepower(bzglmap.containsKey(speed)?bzglmap.get(speed):zsglmap.get(speed));
|
|
|
+ vo.setTheorypower(DoubleUtils.keepPrecision(zsglmap.get(speed),2));
|
|
|
+ vo.setEnsurepower(DoubleUtils.keepPrecision(bzglmap.containsKey(speed)?bzglmap.get(speed):zsglmap.get(speed),2));
|
|
|
tempList.add(vo);
|
|
|
});
|
|
|
SortUtils.sort(tempList,"speed",SortUtils.ASC);
|
|
@@ -54,13 +57,15 @@ public class PerformanceService {
|
|
|
String[] wts = wtids.split(",");
|
|
|
Arrays.stream(wts).forEach(wt->{
|
|
|
List<CurveVo> tempList = new ArrayList<>();
|
|
|
+ if(zzsglMap.get(wt) == null || zzsglMap.size() == 0)
|
|
|
+ return;
|
|
|
Map<Double, Double> zsglmap = zzsglMap.get(wt);
|
|
|
Set<Double> speeds = zsglmap.keySet();
|
|
|
speeds.stream().forEach(speed->{
|
|
|
CurveVo vo = new CurveVo();
|
|
|
vo.setWtid(wt);
|
|
|
vo.setSpeed(speed);
|
|
|
- vo.setTheorypower(zsglmap.get(speed));
|
|
|
+ vo.setTheorypower(DoubleUtils.keepPrecision(zsglmap.get(speed),2));
|
|
|
tempList.add(vo);
|
|
|
});
|
|
|
SortUtils.sort(tempList,"speed",SortUtils.ASC);
|