|
@@ -7,19 +7,16 @@ import com.gyee.benchmarkingimpala.common.StringUtils;
|
|
|
import com.gyee.benchmarkingimpala.contant.Contant;
|
|
|
import com.gyee.benchmarkingimpala.init.CacheContext;
|
|
|
import com.gyee.benchmarkingimpala.model.auto.*;
|
|
|
-import com.gyee.benchmarkingimpala.model.vo.FjjxbVo;
|
|
|
-import com.gyee.benchmarkingimpala.model.vo.FjjxbmxVo;
|
|
|
-import com.gyee.benchmarkingimpala.model.vo.WxsslVo;
|
|
|
-import com.gyee.benchmarkingimpala.service.auto.IEquipmentdaydetailedService;
|
|
|
-import com.gyee.benchmarkingimpala.service.auto.IEquipmentdayinfoService;
|
|
|
+import com.gyee.benchmarkingimpala.model.vo.*;
|
|
|
+import com.gyee.benchmarkingimpala.service.auto.*;
|
|
|
import com.gyee.benchmarkingimpala.util.DateUtils;
|
|
|
import com.gyee.benchmarkingimpala.util.SortUtils;
|
|
|
import com.gyee.benchmarkingimpala.util.taos.EdosUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.jdbc.core.BatchUpdateUtils;
|
|
|
-import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -32,11 +29,25 @@ import java.util.stream.Collectors;
|
|
|
*/
|
|
|
@Service
|
|
|
public class BenchmarkingService {
|
|
|
+
|
|
|
+ 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();
|
|
|
@Autowired
|
|
|
private IEquipmentdayinfoService equipmentdayinfoService;
|
|
|
@Autowired
|
|
|
private IEquipmentdaydetailedService equipmentdaydetailedService;
|
|
|
+ @Autowired
|
|
|
+ private IDutyscheduleService dutyscheduleService;
|
|
|
+ @Autowired
|
|
|
+ private IOperationrecordService operationrecordService;
|
|
|
+ @Autowired
|
|
|
+ private IBenchmarkingbetweenService benchmarkingbetweenService;
|
|
|
+
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -172,6 +183,167 @@ public class BenchmarkingService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 保存值际操作指令表
|
|
|
+ * @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 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
|
|
@@ -452,6 +624,7 @@ public class BenchmarkingService {
|
|
|
List<Project> projects = CacheContext.projects.stream().filter(i -> wpids.contains(i.getWindpowerstationid())).collect(Collectors.toList());
|
|
|
return projects;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 根据项目查询线路列表
|
|
|
* @param projects
|
|
@@ -601,13 +774,11 @@ public class BenchmarkingService {
|
|
|
qw.eq("windpowerstationid",wpid);
|
|
|
}
|
|
|
qw.groupBy("recorddate");
|
|
|
- List<WxsslVo> wxsslVoList = getWxsslSortVos(qw,resultList);
|
|
|
+ List<WxsslVo> wxsslVoList = getWxsslSortVos(qw,resultList,TYPE_DATE);
|
|
|
return wxsslVoList;
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 场际对标
|
|
|
* @param wpids
|
|
@@ -625,102 +796,91 @@ public class BenchmarkingService {
|
|
|
qw.in("windpowerstationid",wpList);
|
|
|
}
|
|
|
qw.groupBy("windpowerstationid");
|
|
|
- List<WxsslVo> wxsslVoList = getWxsslSortVos(qw,resultList);
|
|
|
+ List<WxsslVo> wxsslVoList = getWxsslSortVos(qw,resultList,TYPE_WIND);
|
|
|
return wxsslVoList;
|
|
|
}
|
|
|
|
|
|
-// /**
|
|
|
-// * 项目对标
|
|
|
-// * @param wpids
|
|
|
-// * @param projectids
|
|
|
-// * @param beginDate
|
|
|
-// * @param endDate
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// public List<WxsslVo> xmdb(String wpids, String projectids, String beginDate, String endDate) {
|
|
|
-// StringBuilder sb = new StringBuilder();
|
|
|
-//
|
|
|
-// sb.append("select projectid as name ,sum(genecapacity) fdl,sum(therogenecapacity) llfdl,sum(daynhwhssdl) jxssdl,sum(daynhgzssdl) gzssdl,sum(daynhxdssdl) xdssdl,sum(daynhqfdl) xnssdl,sum(daynhcfdl) slssdl " +
|
|
|
-// " from gyee_test.equipmentdayinfo where recorddate>=to_date('");
|
|
|
-// sb.append(beginDate).append("','yyyy-MM-dd') and recorddate<=to_date('");
|
|
|
-// sb.append(endDate).append("','yyyy-MM-dd') ");
|
|
|
-// if (StringUtils.isNotEmpty(wpids)){
|
|
|
-// sb.append(" and (");
|
|
|
-// String[] wpArray = wpids.split(",");
|
|
|
-// for (String s : wpArray) {
|
|
|
-// sb.append(" windpowerstationid = '").append(s).append("' or");
|
|
|
-// }
|
|
|
-// sb = new StringBuilder(sb.substring(0, sb.length() - 2));
|
|
|
-// sb.append(")");
|
|
|
-// }
|
|
|
-// if (StringUtils.isNotEmpty(projectids)){
|
|
|
-// sb.append(" and (");
|
|
|
-// String[] wpArray = wpids.split(",");
|
|
|
-// for (String s : wpArray) {
|
|
|
-// sb.append(" projectid = '").append(s).append("' or");
|
|
|
-// }
|
|
|
-// sb = new StringBuilder(sb.substring(0, sb.length() - 2));
|
|
|
-// sb.append(")");
|
|
|
-// }
|
|
|
-// sb.append(" group by projectid");
|
|
|
-// List<WxsslVo> wxsslVoList = getWxsslSortVos(sb);
|
|
|
-// return wxsslVoList;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 线路对标
|
|
|
-// * @param wpids
|
|
|
-// * @param projectids
|
|
|
-// * @param lineids
|
|
|
-// * @param beginDate
|
|
|
-// * @param endDate
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// public List<WxsslVo> xldb(String wpids, String projectids, String lineids, String beginDate, String endDate) {
|
|
|
-// StringBuilder sb = new StringBuilder();
|
|
|
-//
|
|
|
-// sb.append("select lineid as name ,sum(genecapacity) fdl,sum(therogenecapacity) llfdl,sum(daynhwhssdl) jxssdl,sum(daynhgzssdl) gzssdl,sum(daynhxdssdl) xdssdl,sum(daynhqfdl) xnssdl,sum(daynhcfdl) slssdl " +
|
|
|
-// " from gyee_test.equipmentdayinfo where recorddate>=to_date('");
|
|
|
-// sb.append(beginDate).append("','yyyy-MM-dd') and recorddate<=to_date('");
|
|
|
-// sb.append(endDate).append("','yyyy-MM-dd') ");
|
|
|
-// if (StringUtils.isNotEmpty(wpids)){
|
|
|
-// sb.append(" and (");
|
|
|
-// String[] wpArray = wpids.split(",");
|
|
|
-// for (String s : wpArray) {
|
|
|
-// sb.append(" windpowerstationid = '").append(s).append("' or");
|
|
|
-// }
|
|
|
-// sb = new StringBuilder(sb.substring(0, sb.length() - 2));
|
|
|
-// sb.append(")");
|
|
|
-// }
|
|
|
-// if (StringUtils.isNotEmpty(projectids)){
|
|
|
-// sb.append(" and (");
|
|
|
-// String[] wpArray = wpids.split(",");
|
|
|
-// for (String s : wpArray) {
|
|
|
-// sb.append(" projectid = '").append(s).append("' or");
|
|
|
-// }
|
|
|
-// sb = new StringBuilder(sb.substring(0, sb.length() - 2));
|
|
|
-// sb.append(")");
|
|
|
-// }
|
|
|
-// if (StringUtils.isNotEmpty(lineids)){
|
|
|
-// sb.append(" and (");
|
|
|
-// String[] wpArray = wpids.split(",");
|
|
|
-// for (String s : wpArray) {
|
|
|
-// sb.append(" lineid = '").append(s).append("' or");
|
|
|
-// }
|
|
|
-// sb = new StringBuilder(sb.substring(0, sb.length() - 2));
|
|
|
-// sb.append(")");
|
|
|
-// }
|
|
|
-// sb.append(" group by lineid");
|
|
|
-// List<WxsslVo> wxsslVoList = getWxsslSortVos(sb);
|
|
|
-// return wxsslVoList;
|
|
|
-// }
|
|
|
-//
|
|
|
- private List<WxsslVo> getWxsslSortVos(QueryWrapper<Equipmentdayinfo> qw,List<WxsslVo> resultList) {
|
|
|
+ /**
|
|
|
+ * 项目对标
|
|
|
+ * @param wpids
|
|
|
+ * @param projectids
|
|
|
+ * @param beginDate
|
|
|
+ * @param endDate
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<WxsslVo> xmdb(String wpids, String projectids, String beginDate, String endDate) {
|
|
|
+ List<WxsslVo> resultList = new ArrayList<>();
|
|
|
+ QueryWrapper<Equipmentdayinfo> qw = new QueryWrapper<>();
|
|
|
+ qw.select("projectid,sum(genecapacity) genecapacity,sum(therogenecapacity) therogenecapacity,sum(daynhwhssdl) daynhwhssdl,sum(daynhgzssdl) daynhgzssdl,sum(daynhxdssdl) daynhxdssdl,sum(daynhqfdl) daynhqfdl,sum(daynhcfdl) daynhcfdl");
|
|
|
+ qw.ge("recorddate",DateUtils.parseDate(beginDate)).le("recorddate",DateUtils.parseDate(endDate));
|
|
|
+ if (StringUtils.isNotEmpty(wpids)){
|
|
|
+ List<String> wpList = Arrays.asList(wpids.split(","));
|
|
|
+ qw.in("windpowerstationid",wpList);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(projectids)){
|
|
|
+ List<String> projectList = Arrays.asList(projectids.split(","));
|
|
|
+ qw.in("projectid",projectList);
|
|
|
+ }
|
|
|
+ qw.groupBy("projectid");
|
|
|
+ List<WxsslVo> wxsslVoList = getWxsslSortVos(qw,resultList,TYPE_PROJECT);
|
|
|
+ return wxsslVoList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 线路对标
|
|
|
+ * @param wpids
|
|
|
+ * @param projectids
|
|
|
+ * @param lineids
|
|
|
+ * @param beginDate
|
|
|
+ * @param endDate
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<WxsslVo> xldb(String wpids, String projectids, String lineids, String beginDate, String endDate) {
|
|
|
+
|
|
|
+ List<WxsslVo> resultList = new ArrayList<>();
|
|
|
+ QueryWrapper<Equipmentdayinfo> qw = new QueryWrapper<>();
|
|
|
+ qw.select("lineid,sum(genecapacity) genecapacity,sum(therogenecapacity) therogenecapacity,sum(daynhwhssdl) daynhwhssdl,sum(daynhgzssdl) daynhgzssdl,sum(daynhxdssdl) daynhxdssdl,sum(daynhqfdl) daynhqfdl,sum(daynhcfdl) daynhcfdl");
|
|
|
+ qw.ge("recorddate",DateUtils.parseDate(beginDate)).le("recorddate",DateUtils.parseDate(endDate));
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(wpids)){
|
|
|
+ List<String> wpList = Arrays.asList(wpids.split(","));
|
|
|
+ qw.in("windpowerstationid",wpList);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(projectids)){
|
|
|
+ List<String> projectList = Arrays.asList(projectids.split(","));
|
|
|
+ qw.in("projectid",projectList);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(lineids)){
|
|
|
+ List<String> lineList = Arrays.asList(lineids.split(","));
|
|
|
+ qw.in("lineid",lineList);
|
|
|
+
|
|
|
+ }
|
|
|
+ qw.groupBy("lineid");
|
|
|
+ List<WxsslVo> wxsslVoList = getWxsslSortVos(qw,resultList,TYPE_LINE);
|
|
|
+ return wxsslVoList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据查询条件和类型,查询处五项损失并封装到结果list
|
|
|
+ * @param qw
|
|
|
+ * @param resultList
|
|
|
+ * @param type
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<WxsslVo> getWxsslSortVos(QueryWrapper<Equipmentdayinfo> qw, List<WxsslVo> resultList, String type) {
|
|
|
|
|
|
List<Equipmentdayinfo> list = equipmentdayinfoService.list(qw);
|
|
|
list.stream().forEach(i->{
|
|
|
WxsslVo vo = new WxsslVo();
|
|
|
- vo.setId(i.getId());
|
|
|
+ if (type.equals(TYPE_WIND)){
|
|
|
+ vo.setId(i.getWindpowerstationid());
|
|
|
+ }else if(type.equals(TYPE_PROJECT)){
|
|
|
+ vo.setId(i.getProjectid());
|
|
|
+ }else if(type.equals(TYPE_LINE)){
|
|
|
+ vo.setId(i.getLineid());
|
|
|
+ }else if(type.equals(TYPE_WINDTURBINE)){
|
|
|
+ vo.setId(i.getWindturbineid());
|
|
|
+ }
|
|
|
vo.setDate(i.getRecorddate());
|
|
|
vo.setFdl(i.getGenecapacity());
|
|
|
vo.setLlfdl(i.getTherogenecapacity());
|
|
@@ -792,6 +952,92 @@ public class BenchmarkingService {
|
|
|
return resultList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 值际操作指令list
|
|
|
+ * @param beginDate
|
|
|
+ * @param endDate
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<Operation> findOperecords(String beginDate, String endDate) {
|
|
|
+ List<Operation> resultList = new ArrayList<>();
|
|
|
+ Date begin = DateUtils.parseDate(beginDate);
|
|
|
+ Date end = DateUtils.getEndOfDay(DateUtils.parseDate(endDate));
|
|
|
+ List<Operationrecord> opeList = operationrecordService.listByBeginAndEnd(begin, end);
|
|
|
+ QueryWrapper<Dutyschedule> wrapper = new QueryWrapper();
|
|
|
+ wrapper.select("max(id) id,name,max(begin) begin,max(end) end,max(createdate) createdate");
|
|
|
+ wrapper.le("createdate",end).ge("createdate",begin).groupBy("name");
|
|
|
+ List<Dutyschedule> dutyList= dutyscheduleService.list(wrapper);
|
|
|
+ for (Dutyschedule duty : dutyList) {
|
|
|
+ Operation ope = new Operation();
|
|
|
+ ope.setNameOfDuty(duty.getName());
|
|
|
+ List<Operationrecord> opeVos= opeList.stream().filter(v -> v.getDutyname().equals(duty.getName())).collect(Collectors.toList());
|
|
|
+ ope.setStartCount(opeVos.stream().filter(vo -> vo.getValue()==1.0).collect(Collectors.toList()).size());
|
|
|
+ ope.setStopCount(opeVos.stream().filter(vo -> vo.getValue()==2.0).collect(Collectors.toList()).size());
|
|
|
+ ope.setResetCount(opeVos.stream().filter(vo -> vo.getValue()==3.0).collect(Collectors.toList()).size());
|
|
|
+ ope.setMaintainCount(opeVos.stream().filter(vo -> vo.getValue()==4.0).collect(Collectors.toList()).size());
|
|
|
+ ope.setUnmaintainCount(opeVos.stream().filter(vo -> vo.getValue()==5.0).collect(Collectors.toList()).size());
|
|
|
+ ope.setGpmaintainCount(opeVos.stream().filter(vo -> vo.getValue()==6.0).collect(Collectors.toList()).size());
|
|
|
+ ope.setGpfaultCount(opeVos.stream().filter(vo -> vo.getValue()==7.0).collect(Collectors.toList()).size());
|
|
|
+ ope.setGponsiteinvolvementMaintainCount(opeVos.stream().filter(vo -> vo.getValue()==8.0).collect(Collectors.toList()).size());
|
|
|
+ ope.setGponsiteinvolvementFaultCount(opeVos.stream().filter(vo -> vo.getValue()==9.0).collect(Collectors.toList()).size());
|
|
|
+ ope.setGpoffsiteaffectedgridCount(opeVos.stream().filter(vo -> vo.getValue()==100).collect(Collectors.toList()).size());
|
|
|
+ ope.setGpweatherOutsideCount(opeVos.stream().filter(vo -> vo.getValue()==11.0).collect(Collectors.toList()).size());
|
|
|
+ ope.setUngpCount(opeVos.stream().filter(vo -> vo.getValue()==12.0).collect(Collectors.toList()).size());
|
|
|
+ resultList.add(ope);
|
|
|
+ }
|
|
|
+ return resultList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 值际点击钻取
|
|
|
+ * @param beginDate
|
|
|
+ * @param endDate
|
|
|
+ * @param dutyname
|
|
|
+ * @param direct
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<Operationrecord> drillOperecords(String beginDate, String endDate, String dutyname, String direct) {
|
|
|
+ Date begin = DateUtils.parseDate(beginDate);
|
|
|
+ Date end = DateUtils.getEndOfDay(DateUtils.parseDate(endDate));
|
|
|
+ List<Operationrecord> opeList = operationrecordService.listByBeginAndEnd(begin,end);
|
|
|
+ List<Operationrecord> resuList = opeList.stream().filter(ope -> ope.getDutyname().equals(dutyname) && ope.getValue() == Double.parseDouble(direct)).collect(Collectors.toList());
|
|
|
+ return resuList;
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 值际五项损失
|
|
|
+ * @param beginDate
|
|
|
+ * @param endDate
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<Benchmarkingbetween> findbenchlist(String beginDate, String endDate) {
|
|
|
+ Date begin = DateUtils.parseDate(beginDate);
|
|
|
+ Date end = DateUtils.parseDate(endDate);
|
|
|
+ List<Benchmarkingbetween> resuList = benchmarkingbetweenService.findByBeginAndEnd(begin,end);
|
|
|
+ return resuList;
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 对标管理详情页面
|
|
|
+ * @param id
|
|
|
+ * @param beginDate
|
|
|
+ * @param endDate
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<WxsslVo> details(String id, String beginDate, String endDate) {
|
|
|
+ List<WxsslVo> resultList = new ArrayList<>();
|
|
|
+ QueryWrapper<Equipmentdayinfo> qw = new QueryWrapper<>();
|
|
|
+ qw.select("windturbineid,sum(genecapacity) genecapacity,sum(therogenecapacity) therogenecapacity,sum(daynhwhssdl) daynhwhssdl,sum(daynhgzssdl) daynhgzssdl,sum(daynhxdssdl) daynhxdssdl,sum(daynhqfdl) daynhqfdl,sum(daynhcfdl) daynhcfdl");
|
|
|
+ qw.ge("recorddate",DateUtils.parseDate(beginDate)).le("recorddate",DateUtils.parseDate(endDate));
|
|
|
+ if (id.endsWith("FDC")){
|
|
|
+ qw.eq("windpowerstationid",id);
|
|
|
+ }else if(id.endsWith("GC")){
|
|
|
+ qw.eq("projectid",id);
|
|
|
+ }else if(id.endsWith("XL")){
|
|
|
+ qw.eq("lineid",id);
|
|
|
+ }
|
|
|
+ qw.groupBy("windturbineid");
|
|
|
+ List<WxsslVo> wxsslVoList = getWxsslSortVos(qw,resultList,TYPE_WINDTURBINE);
|
|
|
+ return wxsslVoList;
|
|
|
+ }
|
|
|
}
|