|
@@ -1,5 +1,7 @@
|
|
|
package com.gyee.runeconomy.service;
|
|
package com.gyee.runeconomy.service;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
import com.gyee.common.util.DateUtils;
|
|
import com.gyee.common.util.DateUtils;
|
|
@@ -41,14 +43,14 @@ public class PerformanceCurvefittingService {
|
|
|
private IProEconWtCurveFittingYearService proEconWtCurveFittingYearService;
|
|
private IProEconWtCurveFittingYearService proEconWtCurveFittingYearService;
|
|
|
|
|
|
|
|
|
|
|
|
|
- public Map<String, List<CurveVo>> curveFittingList(String windturbineIds, String type, String dateType) {
|
|
|
|
|
|
|
+ public Map<String, List<CurveVo>> curveFittingList(String windturbineIds, String type, String dateType, String recorddate) {
|
|
|
Map<String, List<CurveVo>> resultMap = new HashMap<>();
|
|
Map<String, List<CurveVo>> resultMap = new HashMap<>();
|
|
|
Map<String, ProBasicEquipment> wtmap = CacheContext.wtmap;
|
|
Map<String, ProBasicEquipment> wtmap = CacheContext.wtmap;
|
|
|
if (type.equals("-1")) {
|
|
if (type.equals("-1")) {
|
|
|
String zbzgl = redisService.get("ZLLGL");
|
|
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, ZllglDTO>> zbzglMap = JSONObject.parseObject(zbzgl, new TypeReference<Map<String, Map<Double, ZllglDTO>>>() {
|
|
|
});
|
|
});
|
|
|
- Map<String, Map<Double, Double>> znhglMap = getWtCurveFitting(windturbineIds, dateType);
|
|
|
|
|
|
|
+ Map<String, Map<Double, Double>> znhglMap = getWtCurveFitting(windturbineIds, dateType, recorddate);
|
|
|
|
|
|
|
|
List<CurveVo> tempList = new ArrayList<>();
|
|
List<CurveVo> tempList = new ArrayList<>();
|
|
|
if (znhglMap.containsKey(windturbineIds)) {
|
|
if (znhglMap.containsKey(windturbineIds)) {
|
|
@@ -110,6 +112,81 @@ public class PerformanceCurvefittingService {
|
|
|
*
|
|
*
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
|
|
+ private Map<String, Map<Double, Double>> getWtCurveFitting(String windturbineIds, String dateType, String recorddate) {
|
|
|
|
|
+
|
|
|
|
|
+ String[] wts = windturbineIds.split(",");
|
|
|
|
|
+ Map<String, Map<Double, Double>> zzsglMap = new HashMap<>();
|
|
|
|
|
+ String strdate = DateUtils.toDate1(new Date());
|
|
|
|
|
+ Date date = DateUtils.parseDate(strdate);
|
|
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
|
|
+
|
|
|
|
|
+ int year = calendar.get(Calendar.YEAR);
|
|
|
|
|
+ int month = calendar.get(Calendar.MONTH) + 1;
|
|
|
|
|
+
|
|
|
|
|
+ Arrays.stream(wts).forEach(wt -> {
|
|
|
|
|
+ Map<Double, Double> doubleMap = new HashMap<>();
|
|
|
|
|
+ switch (dateType) {
|
|
|
|
|
+
|
|
|
|
|
+ case "1":
|
|
|
|
|
+// String dayCurve = redisService.get("dayCurve_" + wt);
|
|
|
|
|
+// List<ProEconWtCurveFitting> daylist = JSONObject.parseObject(dayCurve, new TypeReference<List<ProEconWtCurveFitting>>() {
|
|
|
|
|
+// });
|
|
|
|
|
+ DateTime dateTime = DateUtil.parse(recorddate);
|
|
|
|
|
+ List<ProEconWtCurveFitting> daylist = proEconWtCurveFittingService.getProEconWtCurveFittingList(wt, dateTime);
|
|
|
|
|
+// List<ProEconWtCurveFitting> daylist = proEconWtCurveFittingService.getProEconWtCurveFittingList(wt,date);
|
|
|
|
|
+
|
|
|
|
|
+ if (null != daylist) {
|
|
|
|
|
+ daylist.stream().forEach(w -> {
|
|
|
|
|
+ doubleMap.put(w.getSpeed(), w.getActualPower());
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ zzsglMap.put(wt, doubleMap);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "2":
|
|
|
|
|
+
|
|
|
|
|
+// String monthCurve = redisService.get("monthCurve_" + wt);
|
|
|
|
|
+// List<ProEconWtCurveFittingMonth> monthlist = JSONObject.parseObject(monthCurve, new TypeReference<List<ProEconWtCurveFittingMonth>>() {
|
|
|
|
|
+// });
|
|
|
|
|
+ DateTime dateMonth = DateUtil.parse(recorddate, "yyyy-MM");
|
|
|
|
|
+ int year1 = DateUtil.year(dateMonth);
|
|
|
|
|
+ int month1 = DateUtil.month(dateMonth);
|
|
|
|
|
+ List<ProEconWtCurveFittingMonth> monthlist = proEconWtCurveFittingMonthService.getProEconWtCurveFittingMonthList(wt, String.valueOf(month1 + 1), String.valueOf(year1));
|
|
|
|
|
+// List<ProEconWtCurveFittingMonth> monthlist = proEconWtCurveFittingMonthService.getProEconWtCurveFittingMonthList(wt,String.valueOf(month),String.valueOf(year));
|
|
|
|
|
+
|
|
|
|
|
+ if (null != monthlist) {
|
|
|
|
|
+ monthlist.stream().forEach(w -> {
|
|
|
|
|
+ doubleMap.put(w.getSpeed(), w.getActualPower());
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ zzsglMap.put(wt, doubleMap);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "3":
|
|
|
|
|
+// String yearCurve = redisService.get("yearCurve_" + wt);
|
|
|
|
|
+// List<ProEconWtCurveFittingYear> yearslist = JSONObject.parseObject(yearCurve, new TypeReference<List<ProEconWtCurveFittingYear>>() {
|
|
|
|
|
+// });
|
|
|
|
|
+ DateTime dateYear = DateUtil.parse(recorddate, "yyyy");
|
|
|
|
|
+ int year2 = DateUtil.year(dateYear);
|
|
|
|
|
+ List<ProEconWtCurveFittingYear> yearslist = proEconWtCurveFittingYearService.getProEconWtCurveFittingYearList(wt, String.valueOf(year));
|
|
|
|
|
+// List<ProEconWtCurveFittingYear> yearslist = proEconWtCurveFittingYearService.getProEconWtCurveFittingYearList(wt,String.valueOf(year));
|
|
|
|
|
+
|
|
|
|
|
+ if (null != yearslist) {
|
|
|
|
|
+ yearslist.stream().forEach(w -> {
|
|
|
|
|
+ doubleMap.put(w.getSpeed(), w.getActualPower());
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ zzsglMap.put(wt, doubleMap);
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ return zzsglMap;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取风机拟合曲线
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
private Map<String, Map<Double, Double>> getWtCurveFitting(String windturbineIds, String dateType) {
|
|
private Map<String, Map<Double, Double>> getWtCurveFitting(String windturbineIds, String dateType) {
|
|
|
|
|
|
|
|
String[] wts = windturbineIds.split(",");
|
|
String[] wts = windturbineIds.split(",");
|