|
@@ -56,7 +56,7 @@ public class EconomicService {
|
|
|
* @return
|
|
|
* @throws ParseException
|
|
|
*/
|
|
|
- public Map<String, Object> getEconomyPointInfo(Date date,String companyId, String type, String statype, String datetype) throws ParseException {
|
|
|
+ public Map<String, Object> getEconomyPointInfo(Date date, String companyId, String type, String statype, String datetype) throws ParseException {
|
|
|
|
|
|
|
|
|
//获取当前时间
|
|
@@ -345,18 +345,13 @@ public class EconomicService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public List<Glqx> curveFittingList(String companys,String wpids, String type, String starttime, String endtime, String dateType, String windturbineids) throws Exception {
|
|
|
- Map<String, List<List<Glqx>>> resultMap = new HashMap<>();
|
|
|
+ public List<Glqx> curveFittingList(String companys, String wpids, String type, String starttime, String endtime, String dateType, String windturbineids) throws Exception {
|
|
|
|
|
|
-
|
|
|
- List<ProBasicOrganizeEquipment> wtls = CacheContext.organizeEquipmentList;
|
|
|
+ List<ProBasicOrganizeEquipment> wtls = CacheContext.organizeEquipmentList.stream().filter(
|
|
|
+ oe -> (oe.getNemName().contains("逆变器") || oe.getNemName().contains("风机"))).collect(Collectors.toList());
|
|
|
List<EconomicVo> wt = new ArrayList<>();
|
|
|
-
|
|
|
- List<List<Glqx>> tempList = new ArrayList<>();
|
|
|
- ;
|
|
|
List<Glqx> vo = new ArrayList<Glqx>();
|
|
|
|
|
|
-
|
|
|
Date beginDate = DateUtils.parseDate1(starttime);
|
|
|
Date endDate = DateUtils.parseDate1(endtime);
|
|
|
Date current = com.gyee.common.util.DateUtils.getCurrentDate();
|
|
@@ -366,12 +361,14 @@ public class EconomicService {
|
|
|
|
|
|
|
|
|
for (ProBasicOrganizeEquipment wt1 : wtls) {
|
|
|
- if (wpids.contains(wt1.getWindpowerstationId())) {
|
|
|
- EconomicVo vo1 = new EconomicVo();
|
|
|
- vo1.setId(wt1.getWindturbineId());
|
|
|
- vo1.setName(wt1.getNemName());
|
|
|
- wt.add(vo1);
|
|
|
- }else if (wpids.isEmpty() && companys.contains("RGN")){
|
|
|
+ if (!windturbineids.isEmpty()) {
|
|
|
+ if (wpids.contains(wt1.getWindpowerstationId()) && windturbineids.contains(wt1.getWindturbineId())) {
|
|
|
+ EconomicVo vo1 = new EconomicVo();
|
|
|
+ vo1.setId(wt1.getWindturbineId());
|
|
|
+ vo1.setName(wt1.getNemName());
|
|
|
+ wt.add(vo1);
|
|
|
+ }
|
|
|
+ } else if (wpids.isEmpty() && companys.contains("RGN")) {
|
|
|
EconomicVo vo1 = new EconomicVo();
|
|
|
vo1.setId(wt1.getWindturbineId());
|
|
|
vo1.setName(wt1.getNemName());
|
|
@@ -382,16 +379,14 @@ public class EconomicService {
|
|
|
|
|
|
for (EconomicVo wt2 : wt) {
|
|
|
|
|
|
-
|
|
|
- if (windturbineids.contains(wt2.getId())) {
|
|
|
-
|
|
|
ProBasicEquipmentPoint sjgl = null;
|
|
|
ProBasicEquipmentPoint llgl = null;
|
|
|
|
|
|
if (type.equals("-2")) {
|
|
|
sjgl = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIG007);
|
|
|
llgl = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIG007);
|
|
|
- }if (type.equals("-1")){
|
|
|
+ }
|
|
|
+ if (type.equals("-1")) {
|
|
|
sjgl = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIG007);
|
|
|
llgl = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIG007);
|
|
|
}
|
|
@@ -434,23 +429,22 @@ public class EconomicService {
|
|
|
vo.add(vos);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
|
|
|
return vo;
|
|
|
}
|
|
|
|
|
|
|
|
|
- public List<Glqx> irradiance(String companys,String wpids, String type, String starttime, String endtime, String dateType, String windturbineids) throws Exception {
|
|
|
-
|
|
|
- List<ProBasicOrganizeEquipment> wtls = CacheContext.organizeEquipmentList;
|
|
|
- List<EconomicVo> wt = new ArrayList<>();
|
|
|
- ;
|
|
|
- List<Glqx> vo = new ArrayList<Glqx>();
|
|
|
+ public Map<String, Object>irradiance(String companys,String wpids, String type, String starttime, String endtime, String dateType, String windturbineids) throws Exception {
|
|
|
|
|
|
+// List<ProBasicOrganizeEquipment> wtls = CacheContext.organizeEquipmentList;
|
|
|
|
|
|
+ List<ProBasicOrganizeTree> eqs = CacheContext.proBasicOrganizeTrees;
|
|
|
+ List<ProBasicOrganizeTree> wtls = eqs.stream()
|
|
|
+ .filter(v -> "EMI".equals(v.getEqType()) && v.getParentCode().equals(wpids))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<EconomicVo> wt = new ArrayList<>();
|
|
|
+ List<Glqx> vo = new ArrayList<>();
|
|
|
Date beginDate = DateUtils.parseDate1(starttime);
|
|
|
Date endDate = DateUtils.parseDate1(endtime);
|
|
|
Date current = com.gyee.common.util.DateUtils.getCurrentDate();
|
|
@@ -458,71 +452,72 @@ public class EconomicService {
|
|
|
endDate = current;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- for (ProBasicOrganizeEquipment wt1 : wtls) {
|
|
|
- if (wpids.contains(wt1.getWindpowerstationId())) {
|
|
|
+ for (ProBasicOrganizeTree wt1 : wtls) {
|
|
|
+ if (wpids.contains(wt1.getParentCode()) && windturbineids.isEmpty()) {
|
|
|
EconomicVo vo1 = new EconomicVo();
|
|
|
- vo1.setId(wt1.getWindturbineId());
|
|
|
+ vo1.setId(wt1.getNemCode());
|
|
|
vo1.setName(wt1.getNemName());
|
|
|
wt.add(vo1);
|
|
|
- }else if (wpids.isEmpty() && companys.contains("RGN")){
|
|
|
+ } else if (wpids.contains(wt1.getParentCode()) && windturbineids.contains(wt1.getId())) {
|
|
|
EconomicVo vo1 = new EconomicVo();
|
|
|
- vo1.setId(wt1.getWindturbineId());
|
|
|
+ vo1.setId(wt1.getNemCode());
|
|
|
+ vo1.setName(wt1.getNemName());
|
|
|
+ wt.add(vo1);
|
|
|
+ } else if (wpids.isEmpty() && companys.contains("RGN")) {
|
|
|
+ EconomicVo vo1 = new EconomicVo();
|
|
|
+ vo1.setId(wt1.getNemCode());
|
|
|
vo1.setName(wt1.getNemName());
|
|
|
wt.add(vo1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
for (EconomicVo wt2 : wt) {
|
|
|
+ ProBasicEquipmentPoint pjgzd = null;
|
|
|
+ if (type.equals("-2")) {
|
|
|
+ pjgzd = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIEMI002);
|
|
|
+ }
|
|
|
+ if (type.equals("-1")) {
|
|
|
+ pjgzd = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIEMI002);
|
|
|
+ }
|
|
|
+ if (pjgzd.getId() == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
- if (windturbineids.contains(wt2.getId())) {
|
|
|
-
|
|
|
- ProBasicEquipmentPoint pjgzd = null;
|
|
|
-
|
|
|
- if (type.equals("-2")) {
|
|
|
- pjgzd = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIEMI002);
|
|
|
- }if (type.equals("-1")){
|
|
|
- pjgzd = proBasicEquipmentPointService.getEquipmentPoint(wt2.getId(), ContantXk.AIEMI002);
|
|
|
- }
|
|
|
- if (pjgzd.getId() == null) {
|
|
|
- continue;
|
|
|
+ List<PointData> pjgzdls = edosUtil.getHistoryDatasSnap(pjgzd, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L);
|
|
|
+ double temp1 = 0;
|
|
|
+ for (int i = 0; i < pjgzdls.size(); i++) {
|
|
|
+ Glqx vos = new Glqx();
|
|
|
+ vos.setPjgzd(0.0);
|
|
|
+ vos.setName("0");
|
|
|
+ vos.setId("0");
|
|
|
+ vos.setTime(2023);
|
|
|
+ temp1 = pjgzdls.get(i).getPointValueInDouble();
|
|
|
+ if (pjgzd.getWindturbineId().contains(wt2.getId())) {
|
|
|
+ vos.setTime(pjgzdls.get(i).getPointTime());
|
|
|
+ vos.setId(wt2.getId());
|
|
|
+ vos.setName(wt2.getName());
|
|
|
+ vos.setPjgzd(StringUtils.round(temp1, 2));
|
|
|
}
|
|
|
+ vo.add(vos);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ List<Double> pjgzdList = vo.stream()
|
|
|
+ .map(Glqx::getPjgzd) // 获取pjgzd字段的值
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
|
- List<PointData> pjgzdls = edosUtil.getHistoryDatasSnap(pjgzd, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L);
|
|
|
- double temp1 = 0;
|
|
|
- for (int i = 0; i < pjgzdls.size(); i++) {
|
|
|
-
|
|
|
- Glqx vos = new Glqx();
|
|
|
- vos.setPjgzd(0.0);
|
|
|
- vos.setName("0");
|
|
|
- vos.setId("0");
|
|
|
- vos.setTime(2023);
|
|
|
-
|
|
|
- temp1 = pjgzdls.get(i).getPointValueInDouble();
|
|
|
-
|
|
|
- if (pjgzd.getWindturbineId().contains(wt2.getId())) {
|
|
|
-// Date date = new Date(pjgzdls.get(i).getPointTime());
|
|
|
-// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
-// String formattedDate = sdf.format(date);
|
|
|
- vos.setTime(pjgzdls.get(i).getPointTime());
|
|
|
-// vos.setTime(formattedDate);
|
|
|
- vos.setId(wt2.getId());
|
|
|
- vos.setName(wt2.getName());
|
|
|
- vos.setPjgzd(StringUtils.round(temp1, 2));
|
|
|
- }
|
|
|
-
|
|
|
- vo.add(vos);
|
|
|
- }
|
|
|
-
|
|
|
+// 使用stream流筛选最大值、最小值、平均值,并放入新的列表中
|
|
|
+ List<Double> result = new ArrayList<>();
|
|
|
+ result.add(pjgzdList.stream().max(Double::compareTo).orElse(null));
|
|
|
+ result.add(pjgzdList.stream().min(Double::compareTo).orElse(null));
|
|
|
+ result.add(pjgzdList.stream().mapToDouble(Double::doubleValue).average().orElse(0));
|
|
|
|
|
|
- }
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+// map.put("result", result);
|
|
|
+ map.put("list", vo);
|
|
|
|
|
|
- }
|
|
|
- return vo;
|
|
|
+ return map;
|
|
|
}
|
|
|
|
|
|
|
|
|
- }
|
|
|
+}
|