Просмотр исходного кода

综合分析-复位及时率和消缺及时率更换数据源

wangb 1 месяц назад
Родитель
Сommit
6fa1616802

+ 2 - 1
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProEconBrownoutsEvent2Service.java

@@ -6,6 +6,7 @@ import com.gyee.runeconomy.dto.response.QxjslDTO;
 import com.gyee.runeconomy.model.auto.ProEconBrownoutsEvent2;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -25,5 +26,5 @@ public interface IProEconBrownoutsEvent2Service extends IService<ProEconBrownout
     List<FwjslDTO> getResetTimelyRateInfo(String companyId, String windpowerstationId, String beginDate, String endDate);
     List<FwjslDTO> getWtResetTimelyRateInfo(String companyId, String windpowerstationId, String beginDate, String endDate);
 
-
+    Map<String, Double> getFwXq(String yearmonth, String yearmon);
 }

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

@@ -251,4 +251,49 @@ public class ProEconBrownoutsEvent2ServiceImpl extends ServiceImpl<ProEconBrowno
     }
 
 
+    @Override
+    public Map<String, Double> getFwXq(String yearmonth,String yearmon) {
+        DateTime ym = DateUtil.parse(yearmonth, "yyyy-MM");
+
+        DateTime begin = DateUtil.beginOfMonth(ym);
+        if ("year".equals(yearmon)) {
+            begin = DateUtil.beginOfYear(ym);
+        }
+        Date date = new Date();
+        DateTime end = DateUtil.beginOfDay(date);
+
+        QueryWrapper<ProEconBrownoutsEvent2> qw = new QueryWrapper<>();
+        qw.lambda().in(ProEconBrownoutsEvent2::getStopTypeId, "维护", "故障")
+                .between(ProEconBrownoutsEvent2::getStartTime, DateUtil.beginOfDay(begin), DateUtil.beginOfDay(end));
+        List<ProEconBrownoutsEvent2> brownouts = list(qw);
+        Map<String, List<ProEconBrownoutsEvent2>> collect = brownouts.stream().collect(Collectors.groupingBy(ProEconBrownoutsEvent2::getStopTypeId));
+        List<ProEconBrownoutsEvent2> fw = collect.get("维护");
+        List<ProEconBrownoutsEvent2> xq = collect.get("故障");
+        Map<String, Double> map = new HashMap<>();
+        map.put("维护", 0.0);
+        map.put("故障", 0.0);
+        if (null != fw && !fw.isEmpty()) {
+            double i = 0.0;
+            for (ProEconBrownoutsEvent2 f : fw) {
+                if (f.getStopHours() <= 1) {
+                    i++;
+                }
+            }
+            map.put("维护", NumberUtil.round((i / fw.size()) * 100, 2).doubleValue());
+        }
+        if (null != xq && !xq.isEmpty()) {
+            double i = 0.0;
+            for (ProEconBrownoutsEvent2 f : xq) {
+                if (f.getStopHours() <= 24) {
+                    i++;
+                }
+            }
+            map.put("故障", NumberUtil.round((i / xq.size()) * 100, 2).doubleValue());
+        }
+        return map;
+    }
+
+
+
+
 }

+ 11 - 4
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/specific/SpecificService.java

@@ -61,6 +61,9 @@ public class SpecificService {
     @Resource
     private IStationInfoMonthService stationInfoMonthService;
 
+    @Resource
+    private IProEconBrownoutsEvent2Service proEconBrownoutsEvent2Service;
+
 
     /**
      * 获取专题分析上面部分
@@ -1116,6 +1119,8 @@ public class SpecificService {
         qw2.eq("to_char(record_date,'yyyy-MM')", yearmonth);
         qw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id");
         List<ProEconPowerstationInfoDay4> dyList = proEconPowerstationInfoDay4Service.list(qw);
+        String yearmon = "month" ;
+        Map<String, Double> fwXq = proEconBrownoutsEvent2Service.getFwXq(yearmonth,yearmon);
         List<StationInfoMonth> list = stationInfoMonthService.list(qw2);
         if (StringUtils.isNotEmpty(dyList)) {
             dyList.stream().forEach(i -> {
@@ -1128,9 +1133,9 @@ public class SpecificService {
                     leftVo.setMtbf(0.0);
                     leftVo.setMttr(0.0);
                 }
-                leftVo.setFwjsl(DoubleUtils.keepPrecision(i.getYfwjsl().doubleValue(), 2));
+                leftVo.setFwjsl(fwXq.get("维护"));
                 leftVo.setZtzhl(DoubleUtils.keepPrecision(i.getYztzhjsl().doubleValue(), 2));
-                leftVo.setXqjsl(DoubleUtils.keepPrecision(i.getYgzxqjsl().doubleValue(), 2));
+                leftVo.setXqjsl(fwXq.get("故障"));
 
                 monthresultList.add(leftVo);
             });
@@ -1246,6 +1251,8 @@ public class SpecificService {
         qw.groupBy("to_char(record_date,'yyyy'),foreign_key_id");
         qw2.groupBy("to_char(record_date,'yyyy'),station_id");
         List<ProEconPowerstationInfoDay4> dyList = proEconPowerstationInfoDay4Service.list(qw);
+        String yearmon = "year" ;
+        Map<String, Double> fwXq = proEconBrownoutsEvent2Service.getFwXq(yearmonth,yearmon);
         List<StationInfoMonth> list = stationInfoMonthService.list(qw2);
         if (StringUtils.isNotEmpty(dyList)) {
             dyList.stream().forEach(i -> {
@@ -1258,9 +1265,9 @@ public class SpecificService {
                     rightVo.setMtbf(0.0);
                     rightVo.setMttr(0.0);
                 }
-                rightVo.setFwjsl(DoubleUtils.keepPrecision(i.getNfwjsl().doubleValue(), 2));
+                rightVo.setFwjsl(fwXq.get("维护"));
                 rightVo.setZtzhl(DoubleUtils.keepPrecision(i.getNztzhjsl().doubleValue(), 2));
-                rightVo.setXqjsl(DoubleUtils.keepPrecision(i.getNgzxqjsl().doubleValue(), 2));
+                rightVo.setXqjsl(fwXq.get("故障"));
 
                 yearresultList.add(rightVo);
             });