瀏覽代碼

清洗处理及时率

wangb@gyee-china.com 1 年之前
父節點
當前提交
dc303b1c2e

+ 31 - 1
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/controller/Economic/EconomicController.java

@@ -137,7 +137,7 @@ public class EconomicController {
 
 
     /**
-     * 光资源分析
+     * 缺陷处理及时率
      *
      * @return
      */
@@ -165,4 +165,34 @@ public class EconomicController {
 
     }
 
+
+    /**
+     * 清理处理及时率
+     *
+     * @return
+     */
+    @GetMapping("/cleaningrate")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R cleaningrate(@RequestParam(value = "companys", required = true) String companys,
+                        @RequestParam(value = "type", required = true) String type,
+                        @RequestParam(value = "wpids", required = false) String wpids,
+                        @RequestParam(value = "windturbineids", required = false) String windturbineids,
+                        @RequestParam(value = "starttime", required = false) String starttime,
+                        @RequestParam(value = "endtime", required = false) String endtime,
+                        @RequestParam(value = "dateType", required = false) String dateType
+    ) throws Exception {
+        List<Tmelinessvo>  cleaningrate = null;
+        if (StringUtils.isEmpty(type)) type = "-2";
+        if (StringUtils.isEmpty(dateType)) dateType = "1";
+
+        cleaningrate = economicService.cleaningrate(companys,wpids, type, starttime, endtime, dateType, windturbineids);
+        if (StringUtils.isNotNull(cleaningrate)) {
+            return R.data(ResultMsg.ok(cleaningrate));
+        } else {
+            return R.error(ResultMsg.error());
+        }
+
+    }
+
 }

+ 79 - 1
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/Economic/EconomicService.java

@@ -1,5 +1,7 @@
 package com.gyee.runeconomy.service.Economic;
 
+import cn.hutool.core.date.DateUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
 import com.gyee.runeconomy.dto.*;
@@ -29,11 +31,14 @@ public class EconomicService {
     private IProEconPowerstationInfoDay1Service proEconPowerstationInfoDay1Service;//场站五损电量
 
     @Autowired
-    private IProEconPowerstationInfoDay7Service proEconPowerstationInfoDay7Service;//光伏
+    private IProEconEquipmentInfoDay1Service proEconEquipmentInfoDay1Service;//光伏
 
     @Autowired
     private IProEconFaultFaultService proEconFaultFaultService;
 
+    @Autowired
+    private IProEconCleaningInputService proEconCleaningInputService;
+
     @Resource
     private IProBasicPowerstationPointService proBasicPowerstationPointService;
 
@@ -629,4 +634,77 @@ public class EconomicService {
         return vos;
     }
 
+
+    public  List<Tmelinessvo> cleaningrate(String companys, String wpids, String type, String starttime, String endtime, String dateType, String windturbineids) throws Exception {
+
+
+        Date beginDate = DateUtils.parseDate1(starttime);
+        Date endDate = DateUtils.parseDate1(endtime);
+
+
+        List<Tmelinessvo> vos = new ArrayList<>();
+
+        List<MaxVo> qwtpj = new ArrayList<>();
+        List<Glqx> hwtpj = new ArrayList<>();
+
+        List<ProEconCleaningInput> getlist = proEconCleaningInputService.getlist(beginDate,endDate);
+
+        QueryWrapper<ProEconEquipmentInfoDay1> qw = new QueryWrapper<>();
+        qw.between("record_date", DateUtil.offsetDay(beginDate,-5), beginDate);
+        qw.like("windpowerstation_id",wpids);
+        List<ProEconEquipmentInfoDay1> qwt = proEconEquipmentInfoDay1Service.list(qw);
+
+
+        QueryWrapper<ProEconEquipmentInfoDay1> hw = new QueryWrapper<>();
+        hw.between("record_date", beginDate,DateUtil.offsetDay(beginDate,+5));
+        hw.like("windpowerstation_id",wpids);
+        List<ProEconEquipmentInfoDay1> hwt = proEconEquipmentInfoDay1Service.list(hw);
+
+
+      for (ProEconEquipmentInfoDay1 q : qwt)
+      {
+          MaxVo mvo = new MaxVo();
+          mvo.setId(q.getWindturbineId());
+          mvo.setAves(q.getRpjgl());
+          qwtpj.add(mvo);
+      }
+
+        for (ProEconEquipmentInfoDay1 h : hwt)
+        {
+            Glqx gvo = new Glqx();
+            gvo.setId(h.getWindturbineId());
+            gvo.setSjgl(h.getRpjgl());
+            hwtpj.add(gvo);
+        }
+
+
+        Map<String,List<MaxVo>> qwtls = qwtpj.stream().collect(Collectors.groupingBy(MaxVo::getId));
+
+        Map<String,List<Glqx>> hwtls = hwtpj.stream().collect(Collectors.groupingBy(Glqx::getId));
+        List<ProBasicOrganizeEquipment> collect = CacheContext.organizeEquipmentList.stream().filter(wt1 -> wpids.contains(wt1.getWindpowerstationId())).collect(Collectors.toList());
+
+        for (Map.Entry<String, List<MaxVo>> entry : qwtls.entrySet()) {
+            String qkey = entry.getKey();  //设备
+            List<MaxVo> value = entry.getValue();
+
+            double qv = value.stream().mapToDouble(MaxVo::getAves).average().orElse(0);
+
+            double hv = hwtls.get(qkey).stream().mapToDouble(Glqx::getSjgl).average().orElse(0);
+
+            Tmelinessvo vo = new Tmelinessvo();
+            vo.setWtid(qkey);
+
+            for (ProBasicOrganizeEquipment wt : collect){
+                if (qkey.equals(wt.getWindturbineId()))
+                vo.setWtname(wt.getAname());
+        }
+            vo.setFrequency(qv);
+            vo.setZfrequency(hv);
+            vo.setJsl((qv/hv)*100);
+            vos.add(vo);
+        }
+
+        return vos;
+    }
+
 }

+ 4 - 1
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/auto/IProEconCleaningInputService.java

@@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.gyee.runeconomy.model.auto.ProEconCleaningInput;
 
+import java.util.Date;
+import java.util.List;
+
 /**
  * <p>
  * 清洗录入表 服务类
@@ -15,5 +18,5 @@ import com.gyee.runeconomy.model.auto.ProEconCleaningInput;
 public interface IProEconCleaningInputService extends IService<ProEconCleaningInput> {
 
     IPage<ProEconCleaningInput> getList(String windpowerstationId, String windpowerstationName, String begindate, String planEnddate, String pageNum, String pageSize);
-
+    List<ProEconCleaningInput> getlist(Date beginDate, Date endDate);
 }

+ 10 - 0
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconCleaningInputServiceImpl.java

@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.List;
 
 /**
  * <p>
@@ -62,4 +63,13 @@ public class ProEconCleaningInputServiceImpl extends ServiceImpl<ProEconCleaning
 
         return InputPage;
     }
+
+    @Override
+    public List<ProEconCleaningInput> getlist(Date beginDate, Date endDate) {
+        QueryWrapper<ProEconCleaningInput> qw = new QueryWrapper<>();
+        qw.ge("begindate",beginDate ).le("actual_enddate", endDate);
+        Page<ProEconCleaningInput> page = new Page<>();
+        List<ProEconCleaningInput> InputPage = getBaseMapper().selectList(qw);
+        return InputPage;
+    }
 }