|
@@ -1,513 +0,0 @@
|
|
|
-package com.gyee.benchmarkinghistroy.service;
|
|
|
-
|
|
|
-import com.gyee.benchmarkinghistroy.init.CacheContext;
|
|
|
-import com.gyee.benchmarkinghistroy.model.auto.*;
|
|
|
-import com.gyee.benchmarkinghistroy.service.auto.*;
|
|
|
-import com.gyee.benchmarkinghistroy.util.realtimesource.EdosUtil;
|
|
|
-import com.gyee.common.contant.Contant;
|
|
|
-import com.gyee.common.model.PointData;
|
|
|
-import com.gyee.common.model.StringUtils;
|
|
|
-
|
|
|
-import com.gyee.common.util.DateUtils;
|
|
|
-import com.gyee.common.util.RandomUtil;
|
|
|
-import com.gyee.common.vo.benchmark.OpeVo;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-import java.text.ParseException;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-/**
|
|
|
- * @ClassName : BenchmarkingHistroyService
|
|
|
- * @Author : xieshengjie
|
|
|
- * @Date: 2021/9/29 18:18
|
|
|
- * @Description : 对标管理service
|
|
|
- */
|
|
|
-@Service
|
|
|
-public class BenchmarkingHistroyService {
|
|
|
-
|
|
|
- private final String TYPE_DATE = "date";
|
|
|
- private final String TYPE_WIND = "wind";
|
|
|
- private final String TYPE_PROJECT = "project";
|
|
|
- private final String TYPE_LINE = "line";
|
|
|
- private final String TYPE_WINDTURBINE = "windturbine";
|
|
|
-
|
|
|
- private EdosUtil edosUtil = new EdosUtil();
|
|
|
- @Resource
|
|
|
- private IEquipmentdayinfoService equipmentdayinfoService;
|
|
|
- @Resource
|
|
|
- private IEquipmentdaydetailedService equipmentdaydetailedService;
|
|
|
- @Resource
|
|
|
- private IDutyscheduleService dutyscheduleService;
|
|
|
- @Resource
|
|
|
- private IOperationrecordService operationrecordService;
|
|
|
- @Resource
|
|
|
- private IBenchmarkingbetweenService benchmarkingbetweenService;
|
|
|
- @Resource
|
|
|
- private IBenchmarkService benchmarkService;
|
|
|
- @Resource
|
|
|
- private IWindpowerinfodayService windpowerinfodayService;
|
|
|
- @Resource
|
|
|
- private IWindpowerinfoday3Service windpowerinfoday3Service;
|
|
|
- @Resource
|
|
|
- private IWpmttrandmtbfdayService wpmttrandmtbfdayService;
|
|
|
- @Resource
|
|
|
- private IWindpowerspecificinfodayService windpowerspecificinfodayService;
|
|
|
- @Resource
|
|
|
- private IWindpowerstationthewindinfoService windpowerstationthewindinfoService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 保存日信息表
|
|
|
- * @param beginDate
|
|
|
- * @param endDate
|
|
|
- */
|
|
|
- public void saveEquipmentdayinfo(String beginDate,String endDate){
|
|
|
- Map<String, Map<String, Windturbinetestingpointai2>> wtpAimap = CacheContext.wtpAimap;
|
|
|
- List<Windturbine> wtls = CacheContext.wtls.stream().filter(i->i.getWindpowerstationid().endsWith("FDC")).collect(Collectors.toList());
|
|
|
- String[] uniformcodes = Contant.WXSS.split(",");
|
|
|
- List<String> days = getDays(beginDate, endDate);
|
|
|
-
|
|
|
- for (String d : days) {
|
|
|
- Map<String,Object> delMap = new HashMap<>();
|
|
|
- delMap.put("recorddate",DateUtils.parseDate(d));
|
|
|
- equipmentdayinfoService.removeByMap(delMap);
|
|
|
- List<Equipmentdayinfo> resultList = new ArrayList<>();
|
|
|
- Date date = DateUtils.parseDate(d);
|
|
|
- Date addDays = DateUtils.addDays(date, 1);
|
|
|
- Date begin = DateUtils.getStartOfDay(addDays);
|
|
|
- Date end = DateUtils.addSeconds(begin, 1);
|
|
|
-
|
|
|
- wtls.stream().filter(i->i.getWindpowerstationid().endsWith("FDC")).forEach(wt->{
|
|
|
- Map<String,Double> wtDataMap = new HashMap<>();
|
|
|
- Map<String, Windturbinetestingpointai2> nmap = wtpAimap.get(wt.getId());
|
|
|
- for (String uniformcode : uniformcodes) {
|
|
|
- try {
|
|
|
- Windturbinetestingpointai2 windturbinetestingpointai2 = nmap.get(uniformcode);
|
|
|
- if (windturbinetestingpointai2!=null){
|
|
|
- List<PointData> pointDatas = edosUtil.getHistoryDatasSnap(windturbinetestingpointai2, begin.getTime()/1000, end.getTime()/1000,1l,1l);
|
|
|
- Optional<PointData> first = pointDatas.stream().findFirst();
|
|
|
- Double value = first.isPresent()?first.get().getPointValueInDouble():0;
|
|
|
- wtDataMap.put(wt.getId()+"_"+uniformcode,value);
|
|
|
- }else {
|
|
|
- System.out.println(wt.getId()+"----"+uniformcode);
|
|
|
- }
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- Equipmentdayinfo equipmentdayinfo = new Equipmentdayinfo();
|
|
|
- equipmentdayinfo.setId(StringUtils.getUUID());
|
|
|
- equipmentdayinfo.setWindturbineid(wt.getId());
|
|
|
- equipmentdayinfo.setLineid(wt.getLineid());
|
|
|
- equipmentdayinfo.setProjectid(wt.getProjectid());
|
|
|
- equipmentdayinfo.setWindpowerstationid(wt.getWindpowerstationid());
|
|
|
- equipmentdayinfo.setRecorddate(DateUtils.parseDate(d));
|
|
|
- equipmentdayinfo.setGenecapacity(wtDataMap.get(wt.getId()+"_RFDL"));
|
|
|
- equipmentdayinfo.setSpeed(wtDataMap.get(wt.getId()+"_AI022"));
|
|
|
- //维护:RJXSSDL-ZS,RLZSSDL-ZS
|
|
|
- equipmentdayinfo.setDaynhwhssdl(wtDataMap.get(wt.getId()+"_RJXSSDL-ZS") + wtDataMap.get(wt.getId()+"_RLZSSDL-ZS"));
|
|
|
- //故障:RGZSSDL-ZS,NSZSSDL-ZS
|
|
|
- equipmentdayinfo.setDaynhgzssdl(wtDataMap.get(wt.getId()+"_RGZSSDL-ZS") + wtDataMap.get(wt.getId()+"_NSZSSDL-ZS"));
|
|
|
- //限电:RQFSSDL-ZS,RXDSSDL-ZS
|
|
|
- equipmentdayinfo.setDaynhxdssdl(wtDataMap.get(wt.getId()+"_RQFSSDL-ZS") + wtDataMap.get(wt.getId()+"_RXDSSDL-ZS"));
|
|
|
- //性能:RDJSSDL-ZS,RSTSSDL-ZS,RXNSSDL-ZS,RQXSSDL-ZS(集团项目需把发电欠发去掉)
|
|
|
- equipmentdayinfo.setDaynhqfdl(wtDataMap.get(wt.getId()+"_RDJSSDL-ZS") + wtDataMap.get(wt.getId()+"_RSTSSDL-ZS") + wtDataMap.get(wt.getId()+"_RXNSSDL-ZS") + wtDataMap.get(wt.getId()+"_RQXSSDL-ZS"));
|
|
|
- //受累:RWZSSDL-ZS,RTZSSDL-ZS
|
|
|
- equipmentdayinfo.setDaynhcfdl(wtDataMap.get(wt.getId()+"_RWZSSDL-ZS") + wtDataMap.get(wt.getId()+"_RTZSSDL-ZS"));
|
|
|
- equipmentdayinfo.setTherogenecapacity(equipmentdayinfo.getGenecapacity()+equipmentdayinfo.getDaynhwhssdl()+equipmentdayinfo.getDaynhgzssdl()+equipmentdayinfo.getDaynhxdssdl()+equipmentdayinfo.getDaynhqfdl()+equipmentdayinfo.getDaynhcfdl());
|
|
|
- resultList.add(equipmentdayinfo);
|
|
|
- });
|
|
|
- equipmentdayinfoService.saveBatch(resultList);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 保存日信息明细
|
|
|
- * @param beginDate
|
|
|
- * @param endDate
|
|
|
- */
|
|
|
- public void saveEquipmentdaydetailed(String beginDate,String endDate){
|
|
|
- Map<String, Map<String, Windturbinetestingpointai2>> wtpAimap = CacheContext.wtpAimap;
|
|
|
- List<Windturbine> wtls = CacheContext.wtls;
|
|
|
- String[] uniformcodes = Contant.WXSS.split(",");
|
|
|
- List<String> days = getDays(beginDate, endDate);
|
|
|
- for (String d : days) {
|
|
|
- Map<String,Object> delMap = new HashMap<>();
|
|
|
- delMap.put("recorddate",DateUtils.parseDate(d));
|
|
|
- equipmentdaydetailedService.removeByMap(delMap);
|
|
|
- List<Equipmentdaydetailed> resultList = new ArrayList<>();
|
|
|
- Date date = DateUtils.parseDate(d);
|
|
|
- Date addDays = DateUtils.addDays(date, 1);
|
|
|
- Date begin = DateUtils.getStartOfDay(addDays);
|
|
|
- Date end = DateUtils.addSeconds(begin, 1);
|
|
|
- wtls.stream().filter(i->i.getWindpowerstationid().endsWith("FDC")).forEach(wt->{
|
|
|
- Map<String,Double> wtDataMap = new HashMap<>();
|
|
|
- Map<String, Windturbinetestingpointai2> nmap = wtpAimap.get(wt.getId());
|
|
|
- for (String uniformcode : uniformcodes) {
|
|
|
- try {
|
|
|
- Windturbinetestingpointai2 windturbinetestingpointai2 = nmap.get(uniformcode);
|
|
|
- List<PointData> pointDatas = edosUtil.getHistoryDatasSnap(windturbinetestingpointai2, begin.getTime()/1000, end.getTime()/1000,1l,1l);
|
|
|
- Optional<PointData> first = pointDatas.stream().findFirst();
|
|
|
- Double value = first.isPresent()?first.get().getPointValueInDouble():0;
|
|
|
- wtDataMap.put(wt.getId()+"_"+uniformcode,value);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- Equipmentdaydetailed equipmentdayinfo = new Equipmentdaydetailed();
|
|
|
- equipmentdayinfo.setId(StringUtils.getUUID());
|
|
|
- equipmentdayinfo.setWindturbineid(wt.getId());
|
|
|
- equipmentdayinfo.setLineid(wt.getLineid());
|
|
|
- equipmentdayinfo.setProjectid(wt.getProjectid());
|
|
|
- equipmentdayinfo.setWindpowerstationid(wt.getWindpowerstationid());
|
|
|
- equipmentdayinfo.setRecorddate(DateUtils.parseDate(d));
|
|
|
- equipmentdayinfo.setGenecapacity(wtDataMap.get(wt.getId()+"_RFDL"));
|
|
|
- equipmentdayinfo.setSpeed(wtDataMap.get(wt.getId()+"_AI022"));
|
|
|
- //维护:RJXSSDL-ZS,RLZSSDL-ZS
|
|
|
- equipmentdayinfo.setDaynhwhssdl1(wtDataMap.get(wt.getId()+"_RJXSSDL-ZS"));
|
|
|
- equipmentdayinfo.setDaynhwhssdl2(wtDataMap.get(wt.getId()+"_RLZSSDL-ZS"));
|
|
|
- //故障:RGZSSDL-ZS,NSZSSDL-ZS
|
|
|
- equipmentdayinfo.setDaynhgzssdl1(wtDataMap.get(wt.getId()+"_RGZSSDL-ZS"));
|
|
|
- equipmentdayinfo.setDaynhgzssdl2(wtDataMap.get(wt.getId()+"_NSZSSDL-ZS"));
|
|
|
- //限电:RQFSSDL-ZS,RXDSSDL-ZS
|
|
|
- equipmentdayinfo.setDaynhxdssdl1(wtDataMap.get(wt.getId()+"_RQFSSDL-ZS"));
|
|
|
- equipmentdayinfo.setDaynhxdssdl2(wtDataMap.get(wt.getId()+"_RXDSSDL-ZS"));
|
|
|
- //性能:RDJSSDL-ZS,RSTSSDL-ZS,RXNSSDL-ZS,RQXSSDL-ZS
|
|
|
- equipmentdayinfo.setDaynhqfdl1(wtDataMap.get(wt.getId()+"_RDJSSDL-ZS"));
|
|
|
- equipmentdayinfo.setDaynhqfdl2(wtDataMap.get(wt.getId()+"_RSTSSDL-ZS"));
|
|
|
- equipmentdayinfo.setDaynhqfdl3(wtDataMap.get(wt.getId()+"_RXNSSDL-ZS"));
|
|
|
- equipmentdayinfo.setDaynhqfdl4(wtDataMap.get(wt.getId()+"_RQXSSDL-ZS"));
|
|
|
- //受累:RWZSSDL-ZS,RTZSSDL-ZS
|
|
|
- equipmentdayinfo.setDaynhcfdl1(wtDataMap.get(wt.getId()+"_RWZSSDL-ZS"));
|
|
|
- equipmentdayinfo.setDaynhcfdl2(wtDataMap.get(wt.getId()+"_RTZSSDL-ZS"));
|
|
|
-
|
|
|
- equipmentdayinfo.setTherogenecapacity(equipmentdayinfo.getGenecapacity()+equipmentdayinfo.getDaynhwhssdl1()+equipmentdayinfo.getDaynhwhssdl2()
|
|
|
- +equipmentdayinfo.getDaynhgzssdl1()+equipmentdayinfo.getDaynhgzssdl2()
|
|
|
- +equipmentdayinfo.getDaynhxdssdl1()+equipmentdayinfo.getDaynhxdssdl2()
|
|
|
- +equipmentdayinfo.getDaynhqfdl1()+equipmentdayinfo.getDaynhqfdl2()+equipmentdayinfo.getDaynhqfdl3()+equipmentdayinfo.getDaynhqfdl4()
|
|
|
- +equipmentdayinfo.getDaynhcfdl1()+equipmentdayinfo.getDaynhcfdl2());
|
|
|
- resultList.add(equipmentdayinfo);
|
|
|
- });
|
|
|
- equipmentdaydetailedService.saveBatch(resultList);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 保存值际操作指令表
|
|
|
- * @param beginDate
|
|
|
- * @param endDate
|
|
|
- */
|
|
|
- public void saveOperationrecord(String beginDate,String endDate) throws ParseException {
|
|
|
- List<String> days = getDays(beginDate, endDate);
|
|
|
- for (String day : days) {
|
|
|
- Date date = DateUtils.parseDate(day);
|
|
|
- Date startOfDay = DateUtils.getStartOfDay(date);
|
|
|
- Date endOfDay = DateUtils.getEndOfDay(date);
|
|
|
- Map<String, Object> params1 = new HashMap<>();
|
|
|
- params1.put("createdate", date);
|
|
|
- List<Dutyschedule> dutyList = dutyscheduleService.listByMap(params1);
|
|
|
- params1.remove("createdate");
|
|
|
- params1.put("time",date);
|
|
|
- operationrecordService.removeByMap(params1);
|
|
|
- Map<String, Map<String, Windturbinetestingpointai2>> wtpointMap = CacheContext.wtpAimap;
|
|
|
- String[] points = Contant.opePoints.split(",");
|
|
|
- List<Windturbine> wtls = CacheContext.wtls;
|
|
|
- List<OpeVo> resuList = new ArrayList<>();
|
|
|
- for (Windturbine wt : wtls) {
|
|
|
- if (wt.getWindpowerstationid().endsWith("GDC")){
|
|
|
- continue;
|
|
|
- }
|
|
|
- for (String point : points) {
|
|
|
- Windturbinetestingpointai2 windturbinetestingpointai2 = wtpointMap.get(wt.getId()).get(point);
|
|
|
- try {
|
|
|
- List<PointData> pointDatas = edosUtil.getHistoryDatasRaw(windturbinetestingpointai2.getId(), startOfDay.getTime()/1000, endOfDay.getTime()/1000);
|
|
|
- pointDatas.stream().forEach(pointData -> {
|
|
|
- OpeVo vo = new OpeVo();
|
|
|
- vo.setWtid(wt.getId());
|
|
|
- vo.setTime(DateUtils.parseLongToDate(pointData.getPointTime()*1000));
|
|
|
- vo.setValue(pointData.getPointValueInDouble());
|
|
|
- resuList.add(vo);
|
|
|
- });
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- for (Dutyschedule duty : dutyList) {
|
|
|
- for (OpeVo vo : resuList) {
|
|
|
- if (isTimeRange(duty,vo.getTime())) {
|
|
|
- Operationrecord operationrecord = new Operationrecord();
|
|
|
- operationrecord.setDutyname(duty.getName());
|
|
|
- operationrecord.setWtid(vo.getWtid());
|
|
|
- operationrecord.setTime(vo.getTime());
|
|
|
- operationrecord.setValue(vo.getValue());
|
|
|
- operationrecordService.save(operationrecord);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 保存值际五损
|
|
|
- * @param beginDate
|
|
|
- * @param endDate
|
|
|
- */
|
|
|
- public void saveBeanchmarkList(String beginDate,String endDate) throws Exception {
|
|
|
- List<String> days = getDays(beginDate, endDate);
|
|
|
- for (String day : days) {
|
|
|
- Date date = DateUtils.parseDate(day);
|
|
|
- Date startOfDay = DateUtils.getStartOfDay(date);
|
|
|
- Date endOfDay = DateUtils.getEndOfDay(date);
|
|
|
-
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- params.put("theday", date);
|
|
|
- benchmarkingbetweenService.removeByMap(params);
|
|
|
- Map<String, Object> params1 = new HashMap<>();
|
|
|
- params1.put("createdate", date);
|
|
|
- List<Dutyschedule> dutyList = dutyscheduleService.listByMap(params1);
|
|
|
- String[] points = Contant.benchPoints.split(",");
|
|
|
- Map<String, Windpowerstationtestingpoint2> wpmap = CacheContext.wppointmap.get("0");
|
|
|
- SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- Map<String, Map<String, Double>> remap = new HashMap<>();
|
|
|
-
|
|
|
- for (Dutyschedule dutyschedule : dutyList) {
|
|
|
- String[] begins = dutyschedule.getBegin().split(",");
|
|
|
- String[] ends = dutyschedule.getEnd().split(",");
|
|
|
- Map<String, Double> map = new HashMap<>();
|
|
|
- for (int i = 0; i < begins.length; i++) {
|
|
|
- Date begin = df.parse(day + " " + begins[i] + ":00");
|
|
|
- Date end = df.parse(day + " " + ends[i] + ":00");
|
|
|
- for (String point : points) {
|
|
|
- Windpowerstationtestingpoint2 windpowerstationtestingpoint2 = wpmap.get(point);
|
|
|
- List<PointData> maxs = edosUtil.getHistStat(windpowerstationtestingpoint2.getCode(), begin.getTime() / 1000, end.getTime() / 1000, (long) 1, null, 0);
|
|
|
- List<PointData> mins = edosUtil.getHistStat(windpowerstationtestingpoint2.getCode(), begin.getTime() / 1000, end.getTime() / 1000, (long) 1, null, 1);
|
|
|
- double ssdl = 0;
|
|
|
- if (StringUtils.isNotEmpty(maxs) && StringUtils.isNotEmpty(mins)) {
|
|
|
- ssdl = (maxs.get(0).getPointValueInDouble() - mins.get(0).getPointValueInDouble()) / 10000;
|
|
|
- }
|
|
|
- if (!map.containsKey(point)) {
|
|
|
- map.put(point, ssdl);
|
|
|
- } else {
|
|
|
- map.put(point, map.get(point) + ssdl);
|
|
|
- }
|
|
|
- }
|
|
|
- Windpowerstationtestingpoint2 windpowerstationtestingpoint2 = wpmap.get("RFDL");
|
|
|
- List<PointData> maxs = edosUtil.getHistStat(windpowerstationtestingpoint2.getCode(), begin.getTime() / 1000, end.getTime() / 1000, (long) 1, null, 0);
|
|
|
- List<PointData> mins = edosUtil.getHistStat(windpowerstationtestingpoint2.getCode(), begin.getTime() / 1000, end.getTime() / 1000, (long) 1, null, 1);
|
|
|
- double fdl = 0;
|
|
|
- if (StringUtils.isNotEmpty(maxs) && StringUtils.isNotEmpty(mins)) {
|
|
|
- fdl = maxs.get(0).getPointValueInDouble() - mins.get(0).getPointValueInDouble();
|
|
|
- }
|
|
|
- if (!map.containsKey("RFDL")) {
|
|
|
- map.put("RFDL", fdl);
|
|
|
- } else {
|
|
|
- map.put("RFDL", map.get("RFDL") + fdl);
|
|
|
- }
|
|
|
- remap.put(dutyschedule.getName(), map);
|
|
|
- }
|
|
|
- }
|
|
|
- Set<String> dutyset = remap.keySet();
|
|
|
- for (String duty : dutyset) {
|
|
|
- Benchmarkingbetween bench = new Benchmarkingbetween();
|
|
|
- bench.setDutyname(duty);
|
|
|
- bench.setTheday(date);
|
|
|
- Map<String, Double> pointmap = remap.get(duty);
|
|
|
- bench.setPerformanceloss(pointmap.get("RSDJZSDL") + pointmap.get("RSSTZSDL") + pointmap.get("RXNZSDL") + pointmap.get("RSQXZSDL"));
|
|
|
- bench.setFaultloss(pointmap.get("RGZZSDL") + pointmap.get("RSZZSDL"));
|
|
|
- bench.setMainloss(pointmap.get("RJXZSDL") + pointmap.get("RLZZSDL"));
|
|
|
- bench.setRationingloss(pointmap.get("RQFZSDL") + pointmap.get("RXDZSDL"));
|
|
|
- bench.setInvolvesloss(pointmap.get("RWZZSDL") + pointmap.get("RTZZSDL"));
|
|
|
- bench.setGeneratity(pointmap.get("RFDL"));
|
|
|
- bench.setTheoreticalgeneratity(bench.getPerformanceloss() + bench.getFaultloss() + bench.getMainloss() + bench.getRationingloss() + bench.getInvolvesloss() + bench.getGeneratity());
|
|
|
- benchmarkingbetweenService.save(bench);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 保存对标管理首页大表
|
|
|
- * @param beginDate
|
|
|
- * @param endDate
|
|
|
- */
|
|
|
- public void saveBenchmark(String beginDate,String endDate){
|
|
|
- List<Windpowerstation> wplist = CacheContext.wplist;
|
|
|
- List<String> days = getDays(beginDate, endDate);
|
|
|
- for (String day : days) {
|
|
|
- Date date = DateUtils.parseDate(day);
|
|
|
- Map<String,Object> selMap = new HashMap<>();
|
|
|
- selMap.put("recorddate",date);
|
|
|
- benchmarkService.removeByMap(selMap);
|
|
|
-
|
|
|
- //获取数据
|
|
|
- List<Windpowerinfoday> windpowerinfodays = windpowerinfodayService.listByMap(selMap);
|
|
|
- List<Windpowerinfoday3> windpowerinfoday3s = windpowerinfoday3Service.listByMap(selMap);
|
|
|
- List<Wpmttrandmtbfday> wpmttrandmtbfdays = wpmttrandmtbfdayService.listByMap(selMap);
|
|
|
- List<Windpowerspecificinfoday> windpowerspecificinfodays = windpowerspecificinfodayService.listByMap(selMap);
|
|
|
- List<Windpowerstationthewindinfo> windpowerstationthewindinfos = windpowerstationthewindinfoService.listByMap(selMap);
|
|
|
- //封装结果list一起存储
|
|
|
- List<Benchmark> resultList = new ArrayList<>();
|
|
|
-
|
|
|
- //赋值
|
|
|
- wplist.stream().forEach(wp -> {
|
|
|
- Benchmark benchmark = new Benchmark();
|
|
|
- benchmark.setId(StringUtils.getUUID());
|
|
|
- benchmark.setForeignkeyid(wp.getId()); //场站
|
|
|
- benchmark.setRecorddate(date);
|
|
|
- benchmark.setMark(RandomUtil.getRandomForDoubleBounded(80.0,95.0));
|
|
|
- benchmark.setCapacity(wp.getCapacity());
|
|
|
- benchmark.setUnits(wp.getQuantity());
|
|
|
- double fdl = 0.0;
|
|
|
- double swdl = 0.0;
|
|
|
- double gwdl = 0.0;
|
|
|
- double gzdl = 0.0;
|
|
|
- double whdl = 0.0;
|
|
|
- double xddl = 0.0;
|
|
|
- double xndl = 0.0;
|
|
|
- double sldl = 0.0;
|
|
|
- double zhcydl = 0.0;
|
|
|
- double gzcs = 0.0;
|
|
|
- double gzsj = 0.0;
|
|
|
- double rlsj = 0.0;
|
|
|
- double sbklyl = 0.0;
|
|
|
- double dxkyxs = 0.0;
|
|
|
- double yfwcs = 0.0;
|
|
|
- double sjfwcs = 0.0;
|
|
|
- double yzhcs = 0.0;
|
|
|
- double sjzhcs = 0.0;
|
|
|
- double yxqcs = 0.0;
|
|
|
- double sjxqcs = 0.0;
|
|
|
- double speed = 0.0;
|
|
|
- double jfpl = 0.0;
|
|
|
- double jfcs = 0.0;
|
|
|
- List<Windpowerinfoday> infodayList = windpowerinfodays.stream().filter(i -> i.getForeignkeyid().equals(wp.getId())).collect(Collectors.toList());
|
|
|
- if (StringUtils.isNotNull(infodayList) && StringUtils.isNotEmpty(infodayList)){
|
|
|
- Windpowerinfoday windpowerinfoday = infodayList.get(0);
|
|
|
- fdl = windpowerinfoday.getGeneratingcapacity();
|
|
|
- swdl = windpowerinfoday.getGridelectricity();
|
|
|
- gwdl = windpowerinfoday.getBuyelectricity();
|
|
|
- zhcydl = fdl + gwdl - swdl;
|
|
|
- sbklyl = windpowerinfoday.getDaysbklyl();
|
|
|
- dxkyxs = windpowerinfoday.getDaydxkyxs();
|
|
|
- speed = windpowerinfoday.getSpeed();
|
|
|
- }
|
|
|
- List<Windpowerinfoday3> infoday3List = windpowerinfoday3s.stream().filter(i -> i.getForeignkeyid().equals(wp.getId())).collect(Collectors.toList());
|
|
|
- if (StringUtils.isNotNull(infoday3List) && StringUtils.isNotEmpty(infoday3List)){
|
|
|
- Windpowerinfoday3 windpowerinfoday3 = infoday3List.get(0);
|
|
|
- gzdl = windpowerinfoday3.getDaynhgzssdl()/10000;
|
|
|
- whdl = windpowerinfoday3.getDaynhwhssdl()/10000;
|
|
|
- xddl = windpowerinfoday3.getDaynhxdssdl()/10000;
|
|
|
- xndl = windpowerinfoday3.getDaynhqfdl()/10000;
|
|
|
- //sldl = windpowerinfoday3.getDaynhcfdl()/10000;
|
|
|
- }
|
|
|
- List<Wpmttrandmtbfday> wpmttrandmtbfdayList = wpmttrandmtbfdays.stream().filter(i -> i.getWpid().equals(wp.getId())).collect(Collectors.toList());
|
|
|
- if (StringUtils.isNotNull(wpmttrandmtbfdayList) && StringUtils.isNotEmpty(wpmttrandmtbfdayList)){
|
|
|
- Wpmttrandmtbfday wpmttrandmtbfday = wpmttrandmtbfdayList.get(0);
|
|
|
- gzcs = wpmttrandmtbfday.getStoprtimes();
|
|
|
- gzsj = wpmttrandmtbfday.getStophours();
|
|
|
- rlsj = wpmttrandmtbfday.getWthours();
|
|
|
- }
|
|
|
- List<Windpowerspecificinfoday> windpowerspecificinfodayList = windpowerspecificinfodays.stream().filter(i -> i.getWindpowerstationid().equals(wp.getId())).collect(Collectors.toList());
|
|
|
- if (StringUtils.isNotNull(windpowerspecificinfodayList) && StringUtils.isNotEmpty(windpowerspecificinfodayList)){
|
|
|
- Windpowerspecificinfoday windpowerspecificinfoday = windpowerspecificinfodayList.get(0);
|
|
|
- yfwcs = windpowerspecificinfoday.getTheoresettimes();
|
|
|
- sjfwcs = windpowerspecificinfoday.getResettimes();
|
|
|
- yzhcs = windpowerspecificinfoday.getTheoconversiontimes();
|
|
|
- sjzhcs = windpowerspecificinfoday.getConversiontimes();
|
|
|
- yxqcs = windpowerspecificinfoday.getTheofaultcount();
|
|
|
- sjxqcs = windpowerspecificinfoday.getRightcount();
|
|
|
- }
|
|
|
- List<Windpowerstationthewindinfo> windpowerstationthewindinfoList = windpowerstationthewindinfos.stream().filter(i -> i.getWindpowerstationid().equals(wp.getId())).collect(Collectors.toList());
|
|
|
- if (StringUtils.isNotNull(windpowerstationthewindinfoList) && StringUtils.isNotEmpty(windpowerstationthewindinfoList)){
|
|
|
- Windpowerstationthewindinfo windpowerstationthewindinfo = windpowerstationthewindinfoList.get(0);
|
|
|
- jfcs = windpowerstationthewindinfo.getCa();
|
|
|
- jfpl = windpowerstationthewindinfo.getCb();
|
|
|
- }
|
|
|
-
|
|
|
- benchmark.setActualpower(fdl);
|
|
|
- benchmark.setDaynhgzssdl(gzdl);
|
|
|
- benchmark.setDaynhwhssdl(whdl);
|
|
|
- benchmark.setDaynhxdssdl(xddl);
|
|
|
- benchmark.setDaynhqfdl(xndl);
|
|
|
- benchmark.setDaynhcfdl(sldl);
|
|
|
- benchmark.setTheoreticalpower(benchmark.getActualpower()+benchmark.getDaynhgzssdl()+benchmark.getDaynhwhssdl()+benchmark.getDaynhxdssdl()+benchmark.getDaynhqfdl()+benchmark.getDaynhcfdl());
|
|
|
- benchmark.setWindenergy(benchmark.getTheoreticalpower()!=0?benchmark.getActualpower()/benchmark.getTheoreticalpower()*100:0.0);
|
|
|
- benchmark.setPowerlossrate(benchmark.getTheoreticalpower()!=0?benchmark.getDaynhxdssdl()/benchmark.getTheoreticalpower()*100:0.0);
|
|
|
- benchmark.setPerformancelossrate(benchmark.getTheoreticalpower()!=0?benchmark.getDaynhqfdl()/benchmark.getTheoreticalpower()*100:0.0);
|
|
|
- benchmark.setComprehensiverate(benchmark.getActualpower()!=0?zhcydl/benchmark.getActualpower()*100:0.0);
|
|
|
- benchmark.setUtilizationhours(benchmark.getActualpower()/benchmark.getCapacity()*10);
|
|
|
- benchmark.setWindpoweraccuracy(RandomUtil.getRandomForDoubleBounded(91.0,99.0));
|
|
|
- benchmark.setAgccurvefollowing(RandomUtil.getRandomForDoubleBounded(91.0,99.0));
|
|
|
- benchmark.setMttr(gzcs!=0?gzsj/gzcs:0.0);
|
|
|
- benchmark.setMtbf(gzcs!=0?rlsj/gzcs:0.0);
|
|
|
- benchmark.setMttf(benchmark.getMtbf()-benchmark.getMttr());
|
|
|
- benchmark.setAvailability(sbklyl);
|
|
|
- benchmark.setAvailabilityfactor(dxkyxs);
|
|
|
- benchmark.setFailurelossrate(benchmark.getTheoreticalpower()!=0?benchmark.getDaynhgzssdl()/benchmark.getTheoreticalpower()*100:0.0);
|
|
|
- benchmark.setMainlossrate(benchmark.getTheoreticalpower()!=0?benchmark.getDaynhwhssdl()/benchmark.getTheoreticalpower()*100:0.0);
|
|
|
- benchmark.setHiddentimely(RandomUtil.getRandomForDoubleBounded(70.0,99.0));
|
|
|
- benchmark.setResettimelyrate(yfwcs!=0?sjfwcs/yfwcs*100:0.0);
|
|
|
- benchmark.setStatetransitionrate(yzhcs!=0?sjzhcs/yzhcs*100:0.0);
|
|
|
- benchmark.setEliminationrate(yxqcs!=0?sjxqcs/yxqcs*100:0.0);
|
|
|
- benchmark.setSpeed(speed);
|
|
|
- benchmark.setStaticwindfrequency(jfpl);
|
|
|
- benchmark.setEffectivewindhourrate(0.0);
|
|
|
- resultList.add(benchmark);
|
|
|
- });
|
|
|
-
|
|
|
- benchmarkService.saveBatch(resultList);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 判断实际操作指令时间是否属于某个值班
|
|
|
- * @param duty
|
|
|
- * @param time
|
|
|
- * @return
|
|
|
- * @throws ParseException
|
|
|
- */
|
|
|
- private boolean isTimeRange(Dutyschedule duty,Date time) throws ParseException {
|
|
|
- SimpleDateFormat df = new SimpleDateFormat("HH:mm");
|
|
|
- Date now = df.parse(df.format(time));
|
|
|
- String[] begins=duty.getBegin().split(",");
|
|
|
- String[] ends=duty.getEnd().split(",");
|
|
|
- for (int i=0 ; i<begins.length;i++) {
|
|
|
- Date begin = df.parse(begins[i]);
|
|
|
- Date end = df.parse(ends[i]);
|
|
|
- Calendar nowTime = Calendar.getInstance();
|
|
|
- nowTime.setTime(now);
|
|
|
- Calendar beginTime = Calendar.getInstance();
|
|
|
- beginTime.setTime(begin);
|
|
|
- Calendar endTime = Calendar.getInstance();
|
|
|
- endTime.setTime(end);
|
|
|
- if (nowTime.before(endTime) && nowTime.after(beginTime)) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- return false;
|
|
|
-
|
|
|
- }
|
|
|
- /**
|
|
|
- * 获取两日期间日期list
|
|
|
- *
|
|
|
- * @param beginDate
|
|
|
- * @param endDate
|
|
|
- * @return
|
|
|
- */
|
|
|
- public static List<String> getDays(String beginDate, String endDate) {
|
|
|
- List<String> days = null;
|
|
|
- if (StringUtils.isNotEmpty(beginDate) && StringUtils.isNotEmpty(endDate)) {
|
|
|
- days = DateUtils.getDays(beginDate, endDate);
|
|
|
- } else {
|
|
|
- days = new ArrayList<>();
|
|
|
- days.add(DateUtils.getYesterdayStr("yyyy-MM-dd"));
|
|
|
- }
|
|
|
- return days;
|
|
|
- }
|
|
|
-}
|