Selaa lähdekoodia

增加计划电量月取值

wangb 2 vuotta sitten
vanhempi
commit
2290cb7151

+ 1 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProBasicProjectPlanService.java

@@ -16,4 +16,5 @@ import java.util.List;
 public interface IProBasicProjectPlanService extends IService<ProBasicProjectPlan> {
     public List<ProBasicProjectPlan> getProjectPlanList(String year, String pageNum, String pageSize);
     List<ProBasicProjectPlan> getList(String year);
+    List<ProBasicProjectPlan> getmonthList(String month);
 }

+ 14 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProBasicProjectPlanServiceImpl.java

@@ -11,6 +11,7 @@ import com.gyee.runeconomy.service.auto.IProBasicProjectPlanService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.Calendar;
 import java.util.List;
 
 /**
@@ -45,4 +46,17 @@ public class ProBasicProjectPlanServiceImpl extends ServiceImpl<ProBasicProjectP
         List<ProBasicProjectPlan> list = baseMapper.selectList(qw);
         return list;
     }
+
+    @Override
+    public List<ProBasicProjectPlan> getmonthList(String month) {
+        QueryWrapper<ProBasicProjectPlan> qw = new QueryWrapper<>();
+        Calendar cal = Calendar.getInstance();
+        int currentyear = cal.get(Calendar.YEAR);
+        if (StringUtils.isNotEmpty(month)){
+            qw.like("month",month);
+            qw.like("year",currentyear);
+        }
+        List<ProBasicProjectPlan> list = baseMapper.selectList(qw);
+        return list;
+    }
 }

+ 36 - 37
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/MonitorService.java

@@ -1464,8 +1464,7 @@ public class MonitorService {
                 List<PointData> twols = edosUtil.getHistMatrix(year, twoDate.getTime() / 1000);
 
                 List<PointData> sj = new ArrayList<>();
-                if(!currentls.isEmpty() && !onels.isEmpty() && !twols.isEmpty())
-                {
+                if (!currentls.isEmpty() && !onels.isEmpty() && !twols.isEmpty()) {
                     sj.add(currentls.get(0));
                     sj.add(onels.get(0));
                     sj.add(twols.get(0));
@@ -1490,9 +1489,9 @@ public class MonitorService {
                     vo2.setHours(i);  //时间戳
                     vo2.setName(wpId);
                     vos.add(vo2);
-            }
+                }
 
-                if (!sj.isEmpty() && sj.size()==3) {
+                if (!sj.isEmpty() && sj.size() == 3) {
                     temp0 = sj.get(0).getPointValueInDouble();
                     temp1 = sj.get(1).getPointValueInDouble();
                     temp2 = sj.get(2).getPointValueInDouble();
@@ -1506,46 +1505,21 @@ public class MonitorService {
 
             if (timetype.contains("month")) {
 
-                int month1 = DateUtils.getMonth(new Date());///4
+                int month1 = DateUtils.getMonth(new Date());//4
                 DateUtils.getMonthLast(new Date());//4.30
                 Date date = DateUtils.getCurrentDate();
 
-                for(int i = month1;i > 0;i--){
+                for (int i = month1; i > 0; i--) {
 
                     PointData data = edosUtil.getSectionData(month, DateUtils.getEndOfDay(DateUtils.getMonthLast(date)).getTime());
                     PowercurveVo vo1 = new PowercurveVo();
-                    vo1.setYfdl(DoubleUtils.keepPrecision(data.getPointValueInDouble(),2));
+                    vo1.setYfdl(DoubleUtils.keepPrecision(data.getPointValueInDouble(), 2));
                     vo1.setHours(i);
                     vos.add(vo1);
-                    date = DateUtils.addMonths(date,-1);
+                    date = DateUtils.addMonths(date, -1);
                 }
-                SortUtils.sort(vos,"hours",SortUtils.ASC);
-
-//                List<PointData> currentls = edosUtil.getHistMatrix(month, currentDatemonth.getTime() / 1000);
-//                List<PointData> onels = edosUtil.getHistMatrix(month, oneDatemonth.getTime() / 1000);
-//                List<PointData> twols = edosUtil.getHistMatrix(month, twoDatemonth.getTime() / 1000);
-
-//                List<PointData> sj = new ArrayList<>();
-//                if(!currentls.isEmpty() && !onels.isEmpty() && !twols.isEmpty())
-//                {
-//                    sj.add(currentls.get(0));
-//                    sj.add(onels.get(0));
-//                    sj.add(twols.get(0));
-//                }
+                SortUtils.sort(vos, "hours", SortUtils.ASC);
 
-//
-//                double temp0 = 0;
-//                double temp1 = 0;
-//                double temp2 = 0;
-//
-//                if (!sj.isEmpty() && sj.size()==3) {
-//                    temp0 = sj.get(0).getPointValueInDouble();
-//                    temp1 = sj.get(1).getPointValueInDouble();
-//                    temp2 = sj.get(2).getPointValueInDouble();
-//                    vos.get(0).setYfdl(StringUtils.round(temp0 / zjrl, 2));
-//                    vos.get(1).setYfdl(StringUtils.round(temp1 / zjrl, 2));
-//                    vos.get(2).setYfdl(StringUtils.round(temp2 / zjrl, 2));
-//                }
 
             }
         }
@@ -1553,9 +1527,6 @@ public class MonitorService {
     }
 
 
-
-
-
     //计划电量
     public List<ProjectplanVo> planvalue(String wpId, String timetype) throws Exception {
 
@@ -1639,6 +1610,34 @@ public class MonitorService {
 
                 }
             }
+
+            if (timetype.contains("month")) {
+
+                if (!wplist.isEmpty()) {
+                    int day = 0;
+                    int month2 = DateUtils.getMonth(new Date());//4
+                    for (int i = month2; i > 0; i--) {
+                        double bnjhdlsum = 0.0;
+                        double bnsjdlsum = 0.0;
+                        day = i;
+                        for (ProBasicPowerstation wpls : wplist) {
+                            List<ProBasicProjectPlan> currentls = proBasicProjectPlanService.getmonthList(String.valueOf(day)); //本月所有集合
+                            //本年所有集合
+                            List<ProBasicProjectPlan> currentjh = currentls.stream().filter(wp -> wp.getWindpowerstationId().equals(wpls.getId())).collect(Collectors.toList());
+                            bnjhdlsum += currentjh.stream().mapToDouble(ProBasicProjectPlan::getGeneratingCapacity).sum(); //本月计划电量合
+                            bnsjdlsum += currentjh.stream().mapToDouble(ProBasicProjectPlan::getOutageHours).sum(); //本月实际电量合
+                        }
+                        ProjectplanVo vo = new ProjectplanVo();
+                        vo.setJhdl(StringUtils.round(bnjhdlsum,2));
+                        vo.setSjdl(StringUtils.round(bnsjdlsum,2));
+                        vo.setHours(i);
+                        vos.add(vo);
+                        SortUtils.sort(vos, "hours", SortUtils.ASC);
+                    }
+                }
+
+
+            }
         }
         return vos;