فهرست منبع

消缺及时率重新计算

wangb 3 ماه پیش
والد
کامیت
6f4daf91b3

+ 47 - 59
runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/goodness/WindturbineGoodnessDetailController.java

@@ -36,11 +36,7 @@ import java.util.*;
 @Api(value = "单机信息总览详细信息", tags = "单机信息总览详细信息")
 public class WindturbineGoodnessDetailController {
     @Resource
-    private IProEconWindturbineGoodnessService proEconWindturbineGoodnessService;
-    @Resource
     private IProEconWtwindDayInfoService proEconWtwindDayInfoService;
-    @Resource
-    private IProEconWtAlysisDayService proEconWtAlysisDayService;
 
     @Resource
     private IProEconWtCurveFittingMonthService proEconWtCurveFittingMonthService;
@@ -76,63 +72,55 @@ public class WindturbineGoodnessDetailController {
             Date firstDayOfMonth = Date.from(firstOfMonth.atStartOfDay(ZoneId.systemDefault()).toInstant());
             LocalDate localdate2 = localDate.withDayOfYear(1);
             Date firstDayOfYear = Date.from(localdate2.atStartOfDay(ZoneId.systemDefault()).toInstant());
-            QueryWrapper<ProEconWtAlysisDay> queryWrapper = new QueryWrapper<>();
-            queryWrapper.eq("record_date", date).eq("windturbine_id", wtId);
-            List<ProEconWtAlysisDay> wtadls = proEconWtAlysisDayService.list(queryWrapper);
-            //                    .stream().filter(i->i.getWindturbineId().equals(wtId )
-            //           && i.getRecordDate().compareTo(date)==0
-            //            ).collect(Collectors.toList());
-            if (!wtadls.isEmpty()) {
-                wtday = wtadls.get(0);
-
-                QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
-                qw.lambda().eq(TurbineInfoDay::getRecordDate, date).eq(TurbineInfoDay::getTurbineId, wtId);
-                List<TurbineInfoDay> turbineInfoDays = turbineInfoDayService.list(qw);
-
-                TurbineInfoDay ytb = turbineInfoDayService.getTurbineSingle(wtId, firstDayOfMonth, date);
-                TurbineInfoDay ntb = turbineInfoDayService.getTurbineSingle(wtId, firstDayOfYear, date);
-
-                TurbineInfoDay tb = turbineInfoDays.get(0);
-                wtday.setRfdl(NumberUtil.round(tb.getRfdl() / 1000, 2).doubleValue());
-                wtday.setRyfdl(NumberUtil.round(tb.getLlfdl() / 1000, 2).doubleValue());
-                wtday.setRpjfs(NumberUtil.round(tb.getPjfs(), 2).doubleValue());
-                wtday.setRyxxs(NumberUtil.round((tb.getYxMin() + tb.getXdMin()) / 60, 2).doubleValue());
-                wtday.setRjxxs(NumberUtil.round(tb.getJxMin() / 60, 2).doubleValue());
-                wtday.setRgzxs(NumberUtil.round(tb.getGzMin() / 60, 2).doubleValue());
-                wtday.setRdjxs(NumberUtil.round(tb.getDjMin() / 60, 2).doubleValue());
-                wtday.setRzdxs(NumberUtil.round(tb.getLxMin() / 60, 2).doubleValue());
-                wtday.setRyxfs(NumberUtil.round(tb.getYxfss(), 2).doubleValue());
-                wtday.setRssdl(NumberUtil.round((tb.getGzss() + tb.getSlss() + tb.getXdss() + tb.getJhjxss() + tb.getFjhjxss() + tb.getXnss()) / 1000, 2).doubleValue());
-                wtday.setRtjcs(NumberUtil.round(tb.getGzcs(), 2).doubleValue());
-                wtday.setRsbklyl(NumberUtil.round(tb.getKlyl(), 2).doubleValue());
-                wtday.setRpjwd(NumberUtil.round(tb.getHjwd(), 2).doubleValue());
-                wtday.setRbbhcs(NumberUtil.round(tb.getTjMin() / 60, 2).doubleValue());
-                wtday.setYfdl(NumberUtil.round(ytb.getRfdl() / 1000, 2).doubleValue());
-                wtday.setYyfdl(NumberUtil.round(ytb.getLlfdl() / 1000, 2).doubleValue());
-                wtday.setYpjfs(NumberUtil.round(ytb.getPjfs(), 2).doubleValue());
-                wtday.setYyxxs(NumberUtil.round((ytb.getYxMin() + ytb.getXdMin()) / 60, 2).doubleValue());
-                wtday.setYdjxs(NumberUtil.round(ytb.getDjMin() / 60, 2).doubleValue());
-                wtday.setYgzxs(NumberUtil.round(ytb.getGzMin() / 60, 2).doubleValue());
-                wtday.setYjxxs(NumberUtil.round(ytb.getJxMin() / 60, 2).doubleValue());
-                wtday.setYzdxs(NumberUtil.round(ytb.getLxMin() / 60, 2).doubleValue());
-                wtday.setYyxfs(NumberUtil.round(ytb.getYxfss(), 2).doubleValue());
-                wtday.setYtjcs(NumberUtil.round(ytb.getGzcs(), 2).doubleValue());
-                wtday.setYsbklyl(NumberUtil.round(ytb.getKlyl(), 2).doubleValue());
-                wtday.setYbbhcs(NumberUtil.round(ytb.getTjMin() / 60, 2).doubleValue());
-                wtday.setNfdl(NumberUtil.round(ntb.getRfdl() / 1000, 2).doubleValue());
-                wtday.setNyfdl(NumberUtil.round(ntb.getLlfdl() / 1000, 2).doubleValue());
-                wtday.setNpjfs(NumberUtil.round(ntb.getPjfs(), 2).doubleValue());
-                wtday.setNyxxs(NumberUtil.round((ntb.getYxMin() + ntb.getXdMin()) / 60, 2).doubleValue());
-                wtday.setNgzxs(NumberUtil.round(ntb.getGzMin() / 60, 2).doubleValue());
-                wtday.setNjxxs(NumberUtil.round(ntb.getJxMin() / 60, 2).doubleValue());
-                wtday.setNzdxs(NumberUtil.round(ntb.getTjMin() / 60, 2).doubleValue());
-                wtday.setNdjxs(NumberUtil.round(ntb.getDjMin() / 60, 2).doubleValue());
-                wtday.setNyxfs(NumberUtil.round(ntb.getYxfss(), 2).doubleValue());
-                //停机小时
-                wtday.setNbbhcs(NumberUtil.round(ntb.getTjMin() / 60, 2).doubleValue());
-            }
 
+            QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
+            qw.lambda().eq(TurbineInfoDay::getRecordDate, date).eq(TurbineInfoDay::getTurbineId, wtId);
+            List<TurbineInfoDay> turbineInfoDays = turbineInfoDayService.list(qw);
+
+            TurbineInfoDay ytb = turbineInfoDayService.getTurbineSingle(wtId, firstDayOfMonth, date);
+            TurbineInfoDay ntb = turbineInfoDayService.getTurbineSingle(wtId, firstDayOfYear, date);
+
+            TurbineInfoDay tb = turbineInfoDays.get(0);
+            wtday.setRfdl(NumberUtil.round(tb.getRfdl() / 1000, 2).doubleValue());
+            wtday.setRyfdl(NumberUtil.round(tb.getLlfdl() / 1000, 2).doubleValue());
+            wtday.setRpjfs(NumberUtil.round(tb.getPjfs(), 2).doubleValue());
+            wtday.setRyxxs(NumberUtil.round((tb.getYxMin() + tb.getXdMin()) / 60, 2).doubleValue());
+            wtday.setRjxxs(NumberUtil.round(tb.getJxMin() / 60, 2).doubleValue());
+            wtday.setRgzxs(NumberUtil.round(tb.getGzMin() / 60, 2).doubleValue());
+            wtday.setRdjxs(NumberUtil.round(tb.getDjMin() / 60, 2).doubleValue());
+            wtday.setRzdxs(NumberUtil.round(tb.getLxMin() / 60, 2).doubleValue());
+            wtday.setRyxfs(NumberUtil.round(tb.getYxfss(), 2).doubleValue());
+            wtday.setRssdl(NumberUtil.round((tb.getGzss() + tb.getSlss() + tb.getXdss() + tb.getJhjxss() + tb.getFjhjxss() + tb.getXnss()) / 1000, 2).doubleValue());
+            wtday.setRtjcs(NumberUtil.round(tb.getGzcs(), 2).doubleValue());
+            wtday.setRsbklyl(NumberUtil.round(tb.getKlyl(), 2).doubleValue());
+            wtday.setRpjwd(NumberUtil.round(tb.getHjwd(), 2).doubleValue());
+            wtday.setRbbhcs(NumberUtil.round(tb.getTjMin() / 60, 2).doubleValue());
+            wtday.setYfdl(NumberUtil.round(ytb.getRfdl() / 1000, 2).doubleValue());
+            wtday.setYyfdl(NumberUtil.round(ytb.getLlfdl() / 1000, 2).doubleValue());
+            wtday.setYpjfs(NumberUtil.round(ytb.getPjfs(), 2).doubleValue());
+            wtday.setYyxxs(NumberUtil.round((ytb.getYxMin() + ytb.getXdMin()) / 60, 2).doubleValue());
+            wtday.setYdjxs(NumberUtil.round(ytb.getDjMin() / 60, 2).doubleValue());
+            wtday.setYgzxs(NumberUtil.round(ytb.getGzMin() / 60, 2).doubleValue());
+            wtday.setYjxxs(NumberUtil.round(ytb.getJxMin() / 60, 2).doubleValue());
+            wtday.setYzdxs(NumberUtil.round(ytb.getLxMin() / 60, 2).doubleValue());
+            wtday.setYyxfs(NumberUtil.round(ytb.getYxfss(), 2).doubleValue());
+            wtday.setYtjcs(NumberUtil.round(ytb.getGzcs(), 2).doubleValue());
+            wtday.setYsbklyl(NumberUtil.round(ytb.getKlyl(), 2).doubleValue());
+            wtday.setYbbhcs(NumberUtil.round(ytb.getTjMin() / 60, 2).doubleValue());
+            wtday.setNfdl(NumberUtil.round(ntb.getRfdl() / 1000, 2).doubleValue());
+            wtday.setNyfdl(NumberUtil.round(ntb.getLlfdl() / 1000, 2).doubleValue());
+            wtday.setNpjfs(NumberUtil.round(ntb.getPjfs(), 2).doubleValue());
+            wtday.setNyxxs(NumberUtil.round((ntb.getYxMin() + ntb.getXdMin()) / 60, 2).doubleValue());
+            wtday.setNgzxs(NumberUtil.round(ntb.getGzMin() / 60, 2).doubleValue());
+            wtday.setNjxxs(NumberUtil.round(ntb.getJxMin() / 60, 2).doubleValue());
+            wtday.setNzdxs(NumberUtil.round(ntb.getTjMin() / 60, 2).doubleValue());
+            wtday.setNdjxs(NumberUtil.round(ntb.getDjMin() / 60, 2).doubleValue());
+            wtday.setNyxfs(NumberUtil.round(ntb.getYxfss(), 2).doubleValue());
+            //停机小时
+            wtday.setNbbhcs(NumberUtil.round(ntb.getTjMin() / 60, 2).doubleValue());
         }
+
+//        }
         if (null != wtday) {
             return R.data(ResultMsg.ok(wtday));
         } else {

+ 7 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/threerate/ThreeRateController.java

@@ -6,10 +6,12 @@ import com.gyee.runeconomy.dto.R;
 import com.gyee.runeconomy.dto.ResultMsg;
 import com.gyee.runeconomy.dto.response.FwjslDTO;
 import com.gyee.runeconomy.dto.response.QxjslDTO;
+import com.gyee.runeconomy.service.auto.IProEconBrownoutsEvent2Service;
 import com.gyee.runeconomy.service.threerate.ThreeRateService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import java.util.List;
 import java.util.Map;
 
@@ -29,6 +31,9 @@ public class ThreeRateController {
     @Autowired
     private ThreeRateService threeRateService;
 
+    @Resource
+    private IProEconBrownoutsEvent2Service proEconBrownoutsEvent2Service;
+
 
     /**
      * 复位及时率
@@ -98,6 +103,8 @@ public class ThreeRateController {
             @RequestParam(value = "endDate", required = true) String endDate
     ) {
         List<QxjslDTO> resultlist = threeRateService.getDefectsEliminatRateList(companyId, windpowerstationId, beginDate, endDate);
+//        QxjslDTO resultlist = proEconBrownoutsEvent2Service.getDefectsEliminatRateList(companyId, windpowerstationId, beginDate, endDate);
+
         if (StringUtils.isNotNull(resultlist)) {
             return R.data(ResultMsg.ok(resultlist));
         } else {

+ 5 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProEconBrownoutsEvent2Service.java

@@ -1,6 +1,7 @@
 package com.gyee.runeconomy.service.auto;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.runeconomy.dto.response.QxjslDTO;
 import com.gyee.runeconomy.model.auto.ProEconBrownoutsEvent2;
 
 /**
@@ -13,4 +14,8 @@ import com.gyee.runeconomy.model.auto.ProEconBrownoutsEvent2;
  */
 public interface IProEconBrownoutsEvent2Service extends IService<ProEconBrownoutsEvent2> {
 
+
+    QxjslDTO getDefectsEliminatRateList(String companyId, String windpowerstationId, String beginDate, String endDate);
+
+
 }

+ 34 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconBrownoutsEvent2ServiceImpl.java

@@ -1,11 +1,16 @@
 package com.gyee.runeconomy.service.auto.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.runeconomy.dto.response.QxjslDTO;
+import com.gyee.runeconomy.init.CacheContext;
 import com.gyee.runeconomy.mapper.auto.ProEconBrownoutsEvent2Mapper;
 import com.gyee.runeconomy.model.auto.ProEconBrownoutsEvent2;
 import com.gyee.runeconomy.service.auto.IProEconBrownoutsEvent2Service;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 与停机事件关联(限电停机时),数据库中无关联,程序控制 服务实现类
@@ -17,4 +22,33 @@ import org.springframework.stereotype.Service;
 @Service
 public class ProEconBrownoutsEvent2ServiceImpl extends ServiceImpl<ProEconBrownoutsEvent2Mapper, ProEconBrownoutsEvent2> implements IProEconBrownoutsEvent2Service {
 
+    @Override
+    public QxjslDTO getDefectsEliminatRateList(String companyId, String windpowerstationId, String beginDate, String endDate) {
+        QueryWrapper<ProEconBrownoutsEvent2> qw = new QueryWrapper<>();
+        qw.lambda().eq(ProEconBrownoutsEvent2::getStopTypeId, "故障停机")
+                .between(ProEconBrownoutsEvent2::getStartTime, beginDate, endDate);
+        List<ProEconBrownoutsEvent2> brownouts = list(qw);
+
+        QxjslDTO qx = new QxjslDTO();
+        qx.setOrdernum(1);
+        qx.setWpid(CacheContext.wpls.get(0).getName());
+        qx.setGzCount(0L);
+        qx.setXqCount(0L);
+        qx.setXqjsl(0.0);
+        if (null != brownouts && !brownouts.isEmpty()) {
+            qx.setGzCount((long) brownouts.size());
+            long xqcs = 0;
+            for (ProEconBrownoutsEvent2 bro : brownouts) {
+                if (bro.getStopHours() <= 24) {
+                    xqcs++;
+                }
+            }
+            qx.setXqCount(xqcs);
+            qx.setXqjsl((xqcs / (double) brownouts.size() * 100));
+        }
+
+        return qx;
+    }
+
+
 }