|
@@ -2,6 +2,7 @@ package com.gyee.ghost.service.auto;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import com.gyee.common.model.PointData;
|
|
|
import com.gyee.common.model.StringUtils;
|
|
|
import com.gyee.common.util.CommonUtils;
|
|
@@ -9,6 +10,7 @@ import com.gyee.common.util.DateUtils;
|
|
|
import com.gyee.common.util.DoubleUtils;
|
|
|
import com.gyee.common.util.SortUtils;
|
|
|
import com.gyee.common.vo.analysis.DeskObject;
|
|
|
+import com.gyee.ghost.config.ResultCode;
|
|
|
import com.gyee.ghost.contant.Contant;
|
|
|
import com.gyee.ghost.init.CacheContext;
|
|
|
import com.gyee.ghost.model.auto.*;
|
|
@@ -16,8 +18,10 @@ import com.gyee.ghost.util.realtimesource.ClassUtil;
|
|
|
import com.gyee.ghost.util.realtimesource.IEdosUtil;
|
|
|
import com.gyee.ghost.util.realtimesource.StringUtil;
|
|
|
import com.gyee.ghost.vo.InitVo;
|
|
|
+import com.gyee.ghost.vo.InvolvedVo;
|
|
|
import com.gyee.ghost.vo.NatureVo;
|
|
|
import com.gyee.ghost.vo.WindturbineVo;
|
|
|
+import io.swagger.models.auth.In;
|
|
|
import javafx.beans.binding.BooleanBinding;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -51,6 +55,10 @@ public class GhostService {
|
|
|
private IFaultrecordService faultrecordService;
|
|
|
@Resource
|
|
|
private IMainrecordService mainrecordService;
|
|
|
+ @Resource
|
|
|
+ private IInvolvedService involvedService;
|
|
|
+ @Resource
|
|
|
+ private IInvolvedstatusService involvedstatusService;
|
|
|
/**
|
|
|
* 存储fanoperation运行分析表
|
|
|
*/
|
|
@@ -528,6 +536,81 @@ public class GhostService {
|
|
|
return mainrecord;
|
|
|
}
|
|
|
|
|
|
+ public List<Involved> involvedlist(String wpid, Long begin, Long end) {
|
|
|
+ QueryWrapper<Involved> queryWrapper = new QueryWrapper<>();
|
|
|
+ if (StringUtils.isNotEmpty(wpid)){
|
|
|
+ queryWrapper.eq("wpid",wpid);
|
|
|
+ }
|
|
|
+ queryWrapper.ge("begindate",DateUtils.parseLongToDate(begin)).le("enddate",DateUtils.parseLongToDate(end));
|
|
|
+ List<Involved> involvedList = involvedService.list(queryWrapper);
|
|
|
+ return involvedList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean involvedremove(String id) {
|
|
|
+ boolean b = involvedService.removeById(id);
|
|
|
+ return b;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean involvedadd(InvolvedVo involvedVo) {
|
|
|
+ Map<String, Windpowerstation> wpmap = CacheContext.wpmap;
|
|
|
+ Map<String, Project> promap = CacheContext.promap;
|
|
|
+ Map<String, Line> lineMap = CacheContext.lineMap;
|
|
|
+
|
|
|
+ Long begin = involvedVo.getBegin();
|
|
|
+ Long end = involvedVo.getEnd();
|
|
|
+ List<Line> lines = involvedVo.getLines();
|
|
|
+ Double ssdl = involvedVo.getSsdl();
|
|
|
+ String type = involvedVo.getType();
|
|
|
+ List<Involved> resultList = new ArrayList<>();
|
|
|
+ double zcapacity = lines.stream().mapToDouble(line -> lineMap.get(line.getId()).getCapacity()).sum();
|
|
|
+ lines.stream().forEach(line->{
|
|
|
+ Involved involved = new Involved();
|
|
|
+ involved.setId(CommonUtils.getUUID());
|
|
|
+ involved.setLinename(lineMap.get(line.getId()).getName());
|
|
|
+ involved.setLineid(line.getId());
|
|
|
+ involved.setProjectid(lineMap.get(line.getId()).getProjectid());
|
|
|
+ involved.setProjectname(promap.get(lineMap.get(line.getId()).getProjectid()).getName());
|
|
|
+ involved.setWpid(promap.get(lineMap.get(line.getId()).getProjectid()).getWindpowerstationid());
|
|
|
+ involved.setWpname(wpmap.get(promap.get(lineMap.get(line.getId()).getProjectid()).getWindpowerstationid()).getCode());
|
|
|
+ involved.setBegindate(DateUtils.parseLongToDate(begin));
|
|
|
+ involved.setEnddate(DateUtils.parseLongToDate(end));
|
|
|
+ involved.setFaulttype(type);
|
|
|
+ involved.setPowerloss(ssdl*(lineMap.get(line.getId()).getCapacity()/zcapacity));
|
|
|
+ double hours = DateUtils.hoursDiff2(DateUtils.parseLongToDate(begin), DateUtils.parseLongToDate(end));
|
|
|
+ involved.setFaultduration(hours);
|
|
|
+ resultList.add(involved);
|
|
|
+ });
|
|
|
+ boolean b = involvedService.saveBatch(resultList);
|
|
|
+ return b;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean involvedupdate(Involved involved) {
|
|
|
+ involved.setBegindate(involved.getBegindate());
|
|
|
+ involved.setEnddate(involved.getEnddate());
|
|
|
+ involved.setFaulttype(involved.getFaulttype());
|
|
|
+ involved.setPowerloss(involved.getPowerloss());
|
|
|
+ double hours = DateUtils.hoursDiff2(involved.getBegindate(), involved.getEnddate());
|
|
|
+ involved.setFaultduration(hours);
|
|
|
+ boolean b = involvedService.saveOrUpdate(involved);
|
|
|
+ return b;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Involved involvedget(String id) {
|
|
|
+ Involved involved = involvedService.getById(id);
|
|
|
+ return involved;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<Line> getLines(String wpid) {
|
|
|
+ List<Line> lines = CacheContext.lines;
|
|
|
+ Map<String, Project> promap = CacheContext.promap;
|
|
|
+ return lines.stream().filter(line->promap.get(line.getProjectid()).getWindpowerstationid().equals(wpid)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<Involvedstatus> getslStatus() {
|
|
|
+ List<Involvedstatus> list = involvedstatusService.list();
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
// public List<Shutdownevent> stoplist(String wpid, String wtid, String stoptypeid, Long begin, Long end, Integer type) {
|
|
|
// Date begindate = DateUtils.parseLongToDate(begin);
|