|
|
@@ -0,0 +1,286 @@
|
|
|
+package com.ruoyi.ucp.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.ruoyi.ucp.entity.ProEconEquipmentInfoDay5;
|
|
|
+import com.ruoyi.ucp.mapper.ProEconEquipmentInfoDay5Mapper;
|
|
|
+import com.ruoyi.ucp.service.IProEconEquipmentInfoDay5Service;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 三率 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author shilin
|
|
|
+ * @since 2022-11-01
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class ProEconEquipmentInfoDay5ServiceImpl extends ServiceImpl<ProEconEquipmentInfoDay5Mapper, ProEconEquipmentInfoDay5> implements IProEconEquipmentInfoDay5Service {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private ProEconEquipmentInfoDay5Mapper proEconEquipmentInfoDay5Mapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ProEconEquipmentInfoDay5> getResetTimelyRateList(String companyId, String windpowerstationId, String beginDate, String endDate) {
|
|
|
+//
|
|
|
+// QueryWrapper<ProEconEquipmentInfoDay5> qw = new QueryWrapper<>();
|
|
|
+// StringBuilder sb = new StringBuilder();
|
|
|
+// sb.append("windpowerstation_id, sum(TIMERATE20) TIMERATE20, sum(TIMERATE16) TIMERATE16, sum(TIMERATE17) TIMERATE17,sum(TIMERATE18) TIMERATE18, sum(TIMERATE19) TIMERATE19 ");
|
|
|
+//
|
|
|
+// qw.select(sb.toString());
|
|
|
+//
|
|
|
+// qw.ge("record_date", DateUtils.parseDate(beginDate)).le("record_date", DateUtils.parseDate(endDate));
|
|
|
+// //判断后缀是区域还是公司
|
|
|
+// if (StringUtils.isNotEmpty(companyId) && companyId.endsWith("_ZGS")) {
|
|
|
+// qw.lambda().eq(ProEconEquipmentInfoDay5::getCompanyId, companyId);
|
|
|
+// }
|
|
|
+// if (StringUtils.isNotEmpty(companyId) && companyId.endsWith("_RGN")) {
|
|
|
+// qw.lambda().eq(ProEconEquipmentInfoDay5::getRegionId, companyId);
|
|
|
+// }
|
|
|
+//
|
|
|
+// //场站模糊查询
|
|
|
+// if (StringUtils.isNotEmpty(windpowerstationId)) {
|
|
|
+// qw.lambda().like(ProEconEquipmentInfoDay5::getWindpowerstationId, windpowerstationId);
|
|
|
+// }
|
|
|
+// //分组查询
|
|
|
+// qw.lambda().groupBy(ProEconEquipmentInfoDay5::getWindpowerstationId);
|
|
|
+// List<ProEconEquipmentInfoDay5> list = baseMapper.selectList(qw);
|
|
|
+//
|
|
|
+// return list;
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Override
|
|
|
+// public List<ProEconEquipmentInfoDay5> getStateConversionRateList(String companyId, String windpowerstationId, String beginDate, String endDate) {
|
|
|
+//
|
|
|
+//
|
|
|
+ QueryWrapper<ProEconEquipmentInfoDay5> qw = new QueryWrapper<>();
|
|
|
+// StringBuilder sb = new StringBuilder();
|
|
|
+// sb.append("windpowerstation_id,sum(TIMERATE13) TIMERATE13,sum(TIMERATE1) TIMERATE1,sum(TIMERATE2) TIMERATE2,sum(TIMERATE3) TIMERATE3,sum(TIMERATE4) TIMERATE4,sum(TIMERATE14) TIMERATE14,sum(TIMERATE5) TIMERATE5,sum(TIMERATE6) TIMERATE6,sum(TIMERATE7) TIMERATE7,sum(TIMERATE8) TIMERATE8,sum(TIMERATE15) TIMERATE15,sum(TIMERATE9) TIMERATE9,sum(TIMERATE10) TIMERATE10,sum(TIMERATE11) TIMERATE11,sum(TIMERATE12) TIMERATE12");
|
|
|
+//
|
|
|
+// qw.select(sb.toString());
|
|
|
+// qw.ge("record_date", DateUtils.parseDate(beginDate)).le("record_date", DateUtils.parseDate(endDate));
|
|
|
+// //判断后缀是区域还是公司
|
|
|
+// if (StringUtils.isNotEmpty(companyId) && companyId.endsWith("_ZGS")) {
|
|
|
+// qw.lambda().eq(ProEconEquipmentInfoDay5::getCompanyId, companyId);
|
|
|
+// }
|
|
|
+// if (StringUtils.isNotEmpty(companyId) && companyId.endsWith("_RGN")) {
|
|
|
+// qw.lambda().eq(ProEconEquipmentInfoDay5::getRegionId, companyId);
|
|
|
+// }
|
|
|
+//
|
|
|
+// //场站模糊查询
|
|
|
+// if (StringUtils.isNotEmpty(windpowerstationId)) {
|
|
|
+// qw.lambda().like(ProEconEquipmentInfoDay5::getWindpowerstationId, windpowerstationId);
|
|
|
+// }
|
|
|
+// //分组查询
|
|
|
+// qw.lambda().groupBy(ProEconEquipmentInfoDay5::getWindpowerstationId);
|
|
|
+ List<ProEconEquipmentInfoDay5> list = baseMapper.selectList(qw);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ProEconEquipmentInfoDay5> getStateRateList(String time) {
|
|
|
+
|
|
|
+ QueryWrapper<ProEconEquipmentInfoDay5> qw = new QueryWrapper<>();
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.append("sum(TIMERATE20) TIMERATE20, sum(TIMERATE16) TIMERATE16, sum(TIMERATE17) TIMERATE17,sum(TIMERATE18) TIMERATE18, sum(TIMERATE19) TIMERATE19 ");
|
|
|
+
|
|
|
+ qw.select(sb.toString());
|
|
|
+ qw.eq("to_char(record_date,'yyyy-MM')", time);
|
|
|
+ qw.groupBy("to_char(record_date,'yyyy-MM')");
|
|
|
+ List<ProEconEquipmentInfoDay5> list = baseMapper.selectList(qw);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ProEconEquipmentInfoDay5> getthreeStateRateList(String time) {
|
|
|
+ QueryWrapper<ProEconEquipmentInfoDay5> qw = new QueryWrapper<>();
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.append("sum(TIMERATE5) TIMERATE5, sum(TIMERATE6) TIMERATE6, sum(TIMERATE7) TIMERATE7,sum(TIMERATE8) TIMERATE8, sum(TIMERATE14) TIMERATE14");
|
|
|
+
|
|
|
+ qw.select(sb.toString());
|
|
|
+ qw.eq("to_char(record_date,'yyyy-MM')", time);
|
|
|
+ qw.groupBy("to_char(record_date,'yyyy-MM')");
|
|
|
+ List<ProEconEquipmentInfoDay5> list = baseMapper.selectList(qw);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ProEconEquipmentInfoDay5> getsyStateRateList(String time) {
|
|
|
+ // 将字符串时间转换为LocalDate,然后减去一个月
|
|
|
+ LocalDate date = LocalDate.parse(time + "-01"); // 假设time格式为"yyyy-MM"
|
|
|
+ LocalDate previousMonth = date.minusMonths(1);
|
|
|
+ String previousMonthStr = previousMonth.format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
|
|
+
|
|
|
+ QueryWrapper<ProEconEquipmentInfoDay5> qw = new QueryWrapper<>();
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.append("sum(TIMERATE20) TIMERATE20, sum(TIMERATE16) TIMERATE16, sum(TIMERATE17) TIMERATE17,sum(TIMERATE18) TIMERATE18, sum(TIMERATE19) TIMERATE19 ");
|
|
|
+
|
|
|
+ qw.select(sb.toString());
|
|
|
+ qw.eq("to_char(record_date,'yyyy-MM')", previousMonthStr);
|
|
|
+ qw.groupBy("to_char(record_date,'yyyy-MM')");
|
|
|
+ List<ProEconEquipmentInfoDay5> list = baseMapper.selectList(qw);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ProEconEquipmentInfoDay5> getsythreeStateRateList(String time) {
|
|
|
+ // 将字符串时间转换为LocalDate,然后减去一个月
|
|
|
+ LocalDate date = LocalDate.parse(time + "-01"); // 假设time格式为"yyyy-MM"
|
|
|
+ LocalDate previousMonth = date.minusMonths(1);
|
|
|
+ String previousMonthStr = previousMonth.format(DateTimeFormatter.ofPattern("yyyy-MM"));
|
|
|
+
|
|
|
+ QueryWrapper<ProEconEquipmentInfoDay5> qw = new QueryWrapper<>();
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ sb.append("sum(TIMERATE5) TIMERATE5, sum(TIMERATE6) TIMERATE6, sum(TIMERATE7) TIMERATE7,sum(TIMERATE8) TIMERATE8, sum(TIMERATE14) TIMERATE14");
|
|
|
+
|
|
|
+ qw.select(sb.toString());
|
|
|
+ qw.eq("to_char(record_date,'yyyy-MM')", previousMonthStr);
|
|
|
+ qw.groupBy("to_char(record_date,'yyyy-MM')");
|
|
|
+ List<ProEconEquipmentInfoDay5> list = baseMapper.selectList(qw);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ProEconEquipmentInfoDay5> getStateRatebottomList(String time) {
|
|
|
+ QueryWrapper<ProEconEquipmentInfoDay5> qw = new QueryWrapper<>();
|
|
|
+ qw.select("windturbine_id,sum(TIMERATE16) TIMERATE16 "); // 按风机分组
|
|
|
+ qw.eq("to_char(record_date,'yyyy-MM')", time);
|
|
|
+ qw.groupBy("windturbine_id"); // 按风机ID分组
|
|
|
+ qw.orderByAsc("sum(TIMERATE16)"); // 按总发电量降序排列
|
|
|
+ qw.last("LIMIT 3"); // 限制返回前3条记录
|
|
|
+ List<ProEconEquipmentInfoDay5> list = baseMapper.selectList(qw);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ProEconEquipmentInfoDay5> getthreeStateRatebottomList(String time) {
|
|
|
+ QueryWrapper<ProEconEquipmentInfoDay5> qw = new QueryWrapper<>();
|
|
|
+ qw.select("windturbine_id,sum(TIMERATE5) TIMERATE5 "); // 按风机分组
|
|
|
+ qw.eq("to_char(record_date,'yyyy-MM')", time);
|
|
|
+ qw.groupBy("windturbine_id"); // 按风机ID分组
|
|
|
+ qw.orderByAsc("sum(TIMERATE5)"); // 按总发电量降序排列
|
|
|
+ qw.last("LIMIT 3"); // 限制返回前3条记录
|
|
|
+ List<ProEconEquipmentInfoDay5> list = baseMapper.selectList(qw);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void initial(ProEconEquipmentInfoDay5 pepd) {
|
|
|
+ /**
|
|
|
+ * 小于3米5分钟转换及时次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate1(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 小于3米10分钟转换及时次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate2(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 小于3米15分钟转换及时次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate3(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 小于3米20分钟转换及时次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate4(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 大于3米5分钟转换及时次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate5(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 大于3米10分钟转换及时次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate6(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 大于3米15分钟转换及时次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate7(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 大于3米20分钟转换及时次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate8(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 大于4米5分钟转换及时次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate9(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 大于4米10分钟转换及时次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate10(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 大于4米15分钟转换及时次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate11(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 大于4米20分钟转换及时次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate12(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 小于3米状态转换总次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate13(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 大于3米状态转换总次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate14(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 大于4米状态转换总次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate15(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 5分钟复位及时次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate16(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 10分钟复位及时次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate17(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 15分钟复位及时次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate18(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 20分钟复位及时次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate19(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 总复位次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate20(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 故障消缺及时次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate21(0.0);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 故障消缺总次数
|
|
|
+ */
|
|
|
+ pepd.setTimerate22(0.0);
|
|
|
+ }
|
|
|
+}
|