wangb@gyee-china.com 1 год назад
Родитель
Сommit
01f686d209

+ 53 - 9
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/Application/ApplicationService.java

@@ -1,6 +1,5 @@
 package com.gyee.runeconomy.service.Application;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.StringUtils;
 import com.gyee.runeconomy.init.CacheContext;
@@ -71,7 +70,7 @@ public class ApplicationService {
         Calendar cal = Calendar.getInstance();
         int dqnf = cal.get(Calendar.YEAR);//本年
 
-        //发电量
+        //发电量
         ProBasicPowerstationPoint rfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wpId, ContantXk.RFDL);
         rfdl = edosUtil.getRealData(rfdlvalue).getPointValueInDouble();
 
@@ -121,17 +120,62 @@ public class ApplicationService {
         long longDate = System.currentTimeMillis();
         Date nowDate = new Date(longDate);
 
-        List<List> list = new ArrayList<>();
+        //当前月份
+        LocalDate currentDate = LocalDate.now();
+        int currentMonth = currentDate.getMonthValue();
+
+        //当前年份
+        Calendar cal = Calendar.getInstance();
+        int dqnf = cal.get(Calendar.YEAR);//本年
+
+        List<Double> list = new ArrayList<>();
+        Map<String,Object> map = new HashMap<>();
         List<ProBasicPowerstation> wpls =  CacheContext.wpls;
 
+
+        double rfdl = 0.0;
+        double yfdl = 0.0;
+        double nfdl = 0.0;
+
+        double rjhdl = 0.0;
+        double yjhdl = 0.0;
+        double njhdl = 0.0;
+
+
+        List<ProBasicProjectPlan> plans = planService.getmonthList(String.valueOf(currentMonth));
+        List<ProBasicProjectPlan> planyear = planService.getList(String.valueOf(dqnf));
+
         for (ProBasicPowerstation wp : wpls){
-            List<ProEconPowerstationInfoDay5> qwt = null;
-            QueryWrapper<ProEconPowerstationInfoDay5> qw = new QueryWrapper<>();
-            qw.lambda().eq(ProEconPowerstationInfoDay5::getForeignKeyId,wp.getId());
-            qw.lambda().eq(ProEconPowerstationInfoDay5::getRecordDate,nowDate);
-            qwt = proEconPowerstationInfoDay5Service.list(qw);
-            list.add(qwt);
 
+            list = new ArrayList<>();
+
+            //日发电量
+            ProBasicPowerstationPoint rfdlvalue = proBasicPowerstationPointService.getPowerstationPoint(wp.getId(), ContantXk.RFDL);
+            rfdl = edosUtil.getRealData(rfdlvalue).getPointValueInDouble();
+
+            List<ProEconPowerstationInfoDay5> getdrlist = proEconPowerstationInfoDay5Service.getdrlist(wp.getId());
+            for (ProEconPowerstationInfoDay5  dr : getdrlist){
+
+                yfdl += dr.getYfdldb().doubleValue();
+                nfdl += dr.getNfdldb().doubleValue();
+            }
+
+
+            List<ProBasicProjectPlan> collect = plans.stream().filter(p -> p.getWindpowerstationId().equals(wp.getId())).collect(Collectors.toList());
+            List<ProBasicProjectPlan> year = planyear.stream().filter(p -> p.getWindpowerstationId().equals(wp.getId())).collect(Collectors.toList());
+            yjhdl =  collect.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum();
+            njhdl = year.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum();
+            rjhdl = yjhdl / 30;
+
+            list.add(rfdl);
+            list.add(yfdl);
+            list.add(nfdl);
+
+            list.add(rjhdl);
+            list.add(yjhdl);
+            list.add(njhdl);
+
+            map.put(wp.getId(),list);
         }