|
@@ -44,6 +44,8 @@ public class MonitorService {
|
|
@Resource
|
|
@Resource
|
|
private IProEconTargetdataFristService proEconTargetdataFristService;
|
|
private IProEconTargetdataFristService proEconTargetdataFristService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private IProBasicPowerPointService powerPointService;
|
|
private final String QS = "0";
|
|
private final String QS = "0";
|
|
private final String FD = "-1";
|
|
private final String FD = "-1";
|
|
private final String GF = "-2";
|
|
private final String GF = "-2";
|
|
@@ -1261,46 +1263,207 @@ public class MonitorService {
|
|
Date beginDate = com.gyee.common.util.DateUtils.getSamedayZero(); //当日零点
|
|
Date beginDate = com.gyee.common.util.DateUtils.getSamedayZero(); //当日零点
|
|
Date endDate = com.gyee.common.util.DateUtils.getCurrentDate(); //当前时间
|
|
Date endDate = com.gyee.common.util.DateUtils.getCurrentDate(); //当前时间
|
|
|
|
|
|
|
|
+
|
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
|
+ calendar.setTime(new Date()); // 设置时间为当前时间
|
|
|
|
+ calendar.add(Calendar.DAY_OF_YEAR, 1); // 将日期加一天
|
|
|
|
+
|
|
|
|
+ // 设置时、分、秒、毫秒为0,即获取当天后一天的0点时间值
|
|
|
|
+ calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
|
+ calendar.set(Calendar.MINUTE, 0);
|
|
|
|
+ calendar.set(Calendar.SECOND, 0);
|
|
|
|
+ calendar.set(Calendar.MILLISECOND, 0);
|
|
|
|
+
|
|
|
|
+ Date nextDayZeroTime = calendar.getTime();
|
|
|
|
+
|
|
int day = DateUtils.getCurrentHour();//4
|
|
int day = DateUtils.getCurrentHour();//4
|
|
|
|
|
|
List<PowercurveVo> vos = new ArrayList<PowercurveVo>();
|
|
List<PowercurveVo> vos = new ArrayList<PowercurveVo>();
|
|
-
|
|
|
|
- for (int i = 0; i < day; i++) {
|
|
|
|
|
|
+ List<PowercurveVo> vos1 = new ArrayList<PowercurveVo>();
|
|
|
|
+ for (int i = 0; i < 24; i++) {
|
|
PowercurveVo vo = new PowercurveVo();
|
|
PowercurveVo vo = new PowercurveVo();
|
|
- vo.setLlgl(0.0); //理论功率
|
|
|
|
- vo.setSjgl(0.0); //实际功率
|
|
|
|
- vo.setSsfs(0.0); //实时风速
|
|
|
|
|
|
+// vo.setLlgl(0.0); //理论功率
|
|
|
|
+// vo.setSjgl(0.0); //实际功率
|
|
|
|
+// vo.setSsfs(0.0); //实时风速
|
|
vo.setBzgl(0.0); //保证功率
|
|
vo.setBzgl(0.0); //保证功率
|
|
vo.setHours(i); //时间戳
|
|
vo.setHours(i); //时间戳
|
|
vo.setName(wpId);
|
|
vo.setName(wpId);
|
|
vos.add(vo);
|
|
vos.add(vo);
|
|
}
|
|
}
|
|
|
|
+ for (int i = 0; i < 24; i++) {
|
|
|
|
+ PowercurveVo vo1 = new PowercurveVo();
|
|
|
|
+// vo.setLlgl(0.0); //理论功率
|
|
|
|
+// vo.setSjgl(0.0); //实际功率
|
|
|
|
+// vo.setSsfs(0.0); //实时风速
|
|
|
|
+ vo1.setBzgl(0.0); //保证功率
|
|
|
|
+ vo1.setHours(i); //时间戳
|
|
|
|
+ vo1.setName(wpId);
|
|
|
|
+ vos1.add(vo1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<ProBasicProject> pjlist = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ for (ProBasicProject pj : CacheContext.pjls) {
|
|
|
|
+ if (wpId.equals(pj.getWindpowerstationId())) {
|
|
|
|
+ pjlist.add(pj);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
- ProBasicPowerstationPoint bzgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.SSZBZGL);
|
|
|
|
ProBasicPowerstationPoint llgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.SSZNHGLZS);
|
|
ProBasicPowerstationPoint llgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.SSZNHGLZS);
|
|
ProBasicPowerstationPoint sjgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.SSZGL);
|
|
ProBasicPowerstationPoint sjgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.SSZGL);
|
|
|
|
|
|
- List<PointData> bzglls = edosUtil.getHistoryDatasSnap(bzgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 3600L);
|
|
|
|
- double temp1 = 0;
|
|
|
|
- for (int i = 0; i < bzglls.size(); i++) {
|
|
|
|
- temp1 = bzglls.get(i).getPointValueInDouble();
|
|
|
|
- vos.get(i).setBzgl(StringUtils.round(temp1, 2));
|
|
|
|
|
|
+ QueryWrapper<ProBasicPowerPoint> qw = new QueryWrapper<>();
|
|
|
|
+ List<ProBasicPowerPoint> powerls = new ArrayList<>();
|
|
|
|
+ List<ProBasicPowerPoint> qyls = null;
|
|
|
|
+ powerls = powerPointService.getBaseMapper().selectList(qw);
|
|
|
|
+
|
|
|
|
+ List<ProBasicPowerPoint> sxfd = powerls.stream().filter(i -> i.getTypeId().equals("SXJ_RGN-1")).collect(Collectors.toList());
|
|
|
|
+ List<ProBasicPowerPoint> sxgf = powerls.stream().filter(i -> i.getTypeId().equals("SXJ_RGN-2")).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ if (wpId.equals("SXJ_RGN0")){
|
|
|
|
+ qyls = powerls;
|
|
|
|
+ }else if (wpId.equals("SXJ_RGN-1")){
|
|
|
|
+ qyls = sxfd;
|
|
|
|
+ }else if (wpId.equals("SXJ_RGN-2")){
|
|
|
|
+ qyls = sxgf;
|
|
}
|
|
}
|
|
|
|
+ if (wpId.contains("SXJ_RGN")) {
|
|
|
|
+
|
|
|
|
+ List<List<PowercurveVo>> ls = new ArrayList<>();
|
|
|
|
+ for (ProBasicPowerPoint pp : qyls) {
|
|
|
|
+ if (pp.getWindpowerstationId().contains("MLJ_FDC_STA") ||pp.getWindpowerstationId().contains("FS_GDC_STA"))continue;
|
|
|
|
+ ProBasicPowerstationPoint ycgl = proBasicPowerstationPointService.getPowerstationPoint(pp.getWindpowerstationId(), ContantXk.GLYC);
|
|
|
|
+ List<PointData> ycglls = edosUtil.getHistoryDatasSnap(ycgl, beginDate.getTime() / 1000, nextDayZeroTime.getTime() / 1000, null, 3600L);
|
|
|
|
+ vos = new ArrayList<>();
|
|
|
|
+ double temp1 = 0;
|
|
|
|
+ for (int i = 0; i < ycglls.size(); i++) {
|
|
|
|
+// PointData po =new PointData();
|
|
|
|
+// po.setPointTime(ycglls.get(i).getPointTime()*1000);
|
|
|
|
+ temp1 = ycglls.get(i).getPointValueInDouble();
|
|
|
|
+ PowercurveVo vo = new PowercurveVo();
|
|
|
|
+ vo.setHours(i);
|
|
|
|
+ vo.setBzgl(StringUtils.round(temp1, 2));
|
|
|
|
+ vos.add(vo);
|
|
|
|
+ }
|
|
|
|
+ ls.add(vos);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<PowercurveVo> voList = ls.get(0);
|
|
|
|
+ for (int i = 1; i < ls.size(); i++) {
|
|
|
|
+ for (int j = 0; j < voList.size(); j++) {
|
|
|
|
+ if (i < ls.size() && j < ls.get(i).size()) {
|
|
|
|
+ voList.get(j).setBzgl(voList.get(j).getBzgl() + ls.get(i).get(j).getBzgl());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ double temp5 =0;
|
|
|
|
+ for (int i = 0; i < voList.size(); i++) {
|
|
|
|
+ temp5 = voList.get(i).getBzgl();
|
|
|
|
+ if (i < vos.size()) {
|
|
|
|
+ vos.get(i).setBzgl(StringUtils.round(temp5, 2));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<PointData> llglls = edosUtil.getHistoryDatasSnap(llgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 3600L);
|
|
|
|
+ double temp2 = 0;
|
|
|
|
+ for (int i = 0; i < llglls.size(); i++) {
|
|
|
|
+ temp2 = llglls.get(i).getPointValueInDouble();
|
|
|
|
+ if (i < vos.size()) {
|
|
|
|
+ vos.get(i).setLlgl(StringUtils.round(temp2 / 1000, 2));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ List<PointData> sjglls = edosUtil.getHistoryDatasSnap(sjgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 3600L);
|
|
|
|
+ double temp4 = 0;
|
|
|
|
+ for (int i = 0; i < sjglls.size(); i++) {
|
|
|
|
+ temp4 = sjglls.get(i).getPointValueInDouble();
|
|
|
|
+ if (i < vos.size()) {
|
|
|
|
+ vos.get(i).setSjgl(StringUtils.round(temp4 / 1000, 2));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
- List<PointData> llglls = edosUtil.getHistoryDatasSnap(llgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 3600L);
|
|
|
|
- double temp2 = 0;
|
|
|
|
- for (int i = 0; i < llglls.size(); i++) {
|
|
|
|
- temp2 = llglls.get(i).getPointValueInDouble();
|
|
|
|
- vos.get(i).setLlgl(StringUtils.round(temp2, 2));
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (!wpId.contains("SXJ_RGN")) {
|
|
|
|
+ //单场请求特殊场站进行处理
|
|
|
|
+ if (wpId.contains("GJY") || wpId.contains("PTZ") || wpId.contains("NJL") || wpId.contains("TZ_GDC_STA") || wpId.contains("SY_GDC_STA")) {
|
|
|
|
+ Map<String, Object> map1 = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ for (ProBasicProject pj : pjlist) {
|
|
|
|
+ if (pj.getId().contains("GJYF02") || pj.getId().contains("TZG02") || pj.getId().contains("TZG03") || pj.getId().contains("TZG04"))
|
|
|
|
+ continue;
|
|
|
|
+ ProBasicPowerstationPoint bzgl = proBasicPowerstationPointService.getPowerstationPoint(pj.getId(), ContantXk.GLYC);
|
|
|
|
+ List<PointData> bzglls = edosUtil.getHistoryDatasSnap(bzgl, beginDate.getTime() / 1000, nextDayZeroTime.getTime() / 1000, null, 3600L);
|
|
|
|
+ if (bzglls != null && !bzglls.isEmpty() && bzglls.get(0).getPointName() != null) {
|
|
|
|
+ double temp1 = 0;
|
|
|
|
+ for (int i = 0; i < bzglls.size(); i++) {
|
|
|
|
+
|
|
|
|
+ temp1 = bzglls.get(i).getPointValueInDouble();
|
|
|
|
+ if (!pj.getId().contains("01")) {
|
|
|
|
+ if (i < vos.size()) {
|
|
|
|
+ vos.get(i).setBzgl(StringUtils.round(temp1, 2));
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ if (i < vos.size()) {
|
|
|
|
+ vos1.get(i).setBzgl(StringUtils.round(temp1, 2));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- List<PointData> sjglls = edosUtil.getHistoryDatasSnap(sjgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 3600L);
|
|
|
|
- double temp4 = 0;
|
|
|
|
- for (int i = 0; i < sjglls.size(); i++) {
|
|
|
|
- temp4 = sjglls.get(i).getPointValueInDouble();
|
|
|
|
- vos.get(i).setSjgl(StringUtils.round(temp4, 2));
|
|
|
|
|
|
+ }
|
|
|
|
+ if (map1.containsKey(wpId)) {
|
|
|
|
+ List<PowercurveVo> previousVos1 = (List<PowercurveVo>) map1.get(wpId);
|
|
|
|
+ for (int i = 0; i < vos.size(); i++) {
|
|
|
|
+ PowercurveVo previousVo1 = previousVos1.get(i);
|
|
|
|
+ PowercurveVo currentVo1 = vos.get(i);
|
|
|
|
+ if (previousVo1 != null && currentVo1 != null) {
|
|
|
|
+ if (previousVo1.getBzgl() != null && currentVo1.getBzgl() != null) {
|
|
|
|
+ currentVo1.setBzgl(MathUtil.twoBit((previousVo1.getBzgl() + currentVo1.getBzgl())));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ map1.put(wpId, vos1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ //正常场站请求
|
|
|
|
+ ProBasicPowerstationPoint bzgl = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.GLYC);
|
|
|
|
|
|
|
|
+ List<PointData> bzglls = edosUtil.getHistoryDatasSnap(bzgl, beginDate.getTime() / 1000, nextDayZeroTime.getTime() / 1000, null, 3600L);
|
|
|
|
+ double temp1 = 0;
|
|
|
|
+ for (int i = 0; i < bzglls.size(); i++) {
|
|
|
|
+ temp1 = bzglls.get(i).getPointValueInDouble();
|
|
|
|
+ if (i < vos.size()) {
|
|
|
|
+ vos.get(i).setBzgl(StringUtils.round(temp1, 2));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<PointData> llglls = edosUtil.getHistoryDatasSnap(llgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 3600L);
|
|
|
|
+ double temp2 = 0;
|
|
|
|
+ for (int i = 0; i < llglls.size(); i++) {
|
|
|
|
+ temp2 = llglls.get(i).getPointValueInDouble();
|
|
|
|
+ if (i < vos.size()) {
|
|
|
|
+ vos.get(i).setLlgl(StringUtils.round(temp2 /1000, 2));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ List<PointData> sjglls = edosUtil.getHistoryDatasSnap(sjgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 3600L);
|
|
|
|
+ double temp4 = 0;
|
|
|
|
+ for (int i = 0; i < sjglls.size(); i++) {
|
|
|
|
+ temp4 = sjglls.get(i).getPointValueInDouble();
|
|
|
|
+ if (i < vos.size()) {
|
|
|
|
+ vos.get(i).setSjgl(StringUtils.round(temp4 /1000, 2));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return vos;
|
|
return vos;
|
|
}
|
|
}
|