ソースを参照

feat(ucp): 新增报表回填功能

- 添加 ProBaseBackfill 相关实体、Mapper 和 Service
- 实现报表回填相关的接口和方法
- 新增计算测点功能,包括 ProEconEquipmentInfoJs 相关实体、Mapper 和 Service
-优化 LineInfoDay 和 TurbineInfoDay 的查询方法
-调整应用配置,增加静态资源路径
- 修改 AdapterApi 接口,增加新的数据查询方法
xushili 1 年間 前
コミット
a1f15227b6
33 ファイル変更1767 行追加164 行削除
  1. 982 104
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/JavaFunctionJobHandler.java
  2. 9 3
      ruoyi-admin/src/main/resources/application.yml
  3. 82 36
      ruoyi-admin/src/test/java/com/ruoyi/NewTests.java
  4. 1 2
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java
  5. 1 1
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzDisallowConcurrentExecution.java
  6. 1 1
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzJobExecution.java
  7. 1 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/LineInfoDay.java
  8. 56 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/MeterInfoDay.java
  9. 137 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/ProBaseBackfill.java
  10. 65 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/ProEconEquipmentInfoJs.java
  11. 12 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/StationInfoDay.java
  12. 8 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/TurbineInfoDay.java
  13. 20 6
      universal-computing-platform/src/main/java/com/ruoyi/ucp/feign/AdapterApi.java
  14. 16 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/mapper/MeterInfoDayMapper.java
  15. 16 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/mapper/ProBaseBackfillMapper.java
  16. 16 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/mapper/ProEconEquipmentInfoJsMapper.java
  17. 7 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/ILineInfoDayService.java
  18. 23 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/IMeterInfoDayService.java
  19. 16 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/IProBaseBackfillService.java
  20. 6 1
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/IProBasicProjectPlanService.java
  21. 16 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/IProEconEquipmentInfoJsService.java
  22. 6 2
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/IStationInfoDayService.java
  23. 8 1
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/ITurbineInfoDayService.java
  24. 26 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/LineInfoDayServiceImpl.java
  25. 43 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/MeterInfoDayServiceImpl.java
  26. 20 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/ProBaseBackfillServiceImpl.java
  27. 30 2
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/ProBasicProjectPlanServiceImpl.java
  28. 20 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/ProEconEquipmentInfoJsServiceImpl.java
  29. 23 1
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/StationInfoDayServiceImpl.java
  30. 0 1
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/StationInfoMinServiceImpl.java
  31. 29 3
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/TurbineInfoDayServiceImpl.java
  32. 18 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/util/DatePart.java
  33. 53 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/util/SqlUtil.java

+ 982 - 104
ruoyi-admin/src/main/java/com/ruoyi/web/controller/JavaFunctionJobHandler.java

@@ -1,11 +1,16 @@
 package com.ruoyi.web.controller;
 
-import cn.hutool.core.collection.*;
-import cn.hutool.core.date.*;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.collection.ListUtil;
+import cn.hutool.core.date.DateField;
+import cn.hutool.core.date.DateRange;
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.lang.Dict;
 import cn.hutool.core.text.StrBuilder;
 import cn.hutool.core.thread.ThreadUtil;
-import cn.hutool.core.util.*;
+import cn.hutool.core.util.NumberUtil;
+import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson2.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.ruoyi.quartz.handler.IJobHandler;
@@ -13,6 +18,8 @@ import com.ruoyi.ucp.entity.*;
 import com.ruoyi.ucp.feign.AdapterApi;
 import com.ruoyi.ucp.service.*;
 import com.ruoyi.ucp.util.CalcCache;
+import com.ruoyi.ucp.util.DatePart;
+import com.ruoyi.ucp.util.SqlUtil;
 import org.apache.commons.math3.fitting.PolynomialCurveFitter;
 import org.apache.commons.math3.fitting.WeightedObservedPoints;
 import org.slf4j.Logger;
@@ -73,6 +80,12 @@ public class JavaFunctionJobHandler extends IJobHandler {
     private IProjectInfoMin2Service projectInfoMin2Service;
     @Resource
     private IRealtimePredictService realtimePredictService;
+    @Resource
+    private IMeterInfoDayService meterInfoDayService;
+    @Resource
+    private IProEconEquipmentInfoJsService proEconEquipmentInfoJsService;
+    @Resource
+    private IProBaseBackfillService proBaseBackfillService;
 
     @Override
     public void execute() throws Exception {
@@ -188,10 +201,44 @@ public class JavaFunctionJobHandler extends IJobHandler {
         return day;
     }
 
-    public List<StationInfoDay> getStationinfoByDate(Date date, List<PointInfo> entity) {
-        QueryWrapper<StationInfoDay> wrapper = new QueryWrapper<>();
+    public List<MeterInfoDay> getMeterinfoByDate(Date date) {
+        QueryWrapper<MeterInfoDay> wrapper = new QueryWrapper<>();
         wrapper.eq("record_date", date);
-        List<StationInfoDay> list = stationInfoDayService.list(wrapper);
+        return meterInfoDayService.list(wrapper);
+    }
+
+    public List<MeterInfoDay> getMeterinfoByDate(Date date, List<PointInfo> entity) {
+        List<MeterInfoDay> list = getMeterinfoByDate(date);
+        if (CollUtil.isEmpty(list)) {
+            entity.forEach(pi -> {
+                MeterInfoDay day = new MeterInfoDay();
+                day.setStationId(pi.getStationId());
+                day.setRecordDate(date);
+                list.add(day);
+            });
+        }
+        return list;
+    }
+
+    public MeterInfoDay getMeterinfoByDate(Date date, PointInfo entity) {
+        QueryWrapper<MeterInfoDay> wrapper = new QueryWrapper<>();
+        wrapper.eq("record_date", date);
+        wrapper.eq("meter_id", entity.getUniformCode());
+        List<MeterInfoDay> list = meterInfoDayService.list(wrapper);
+        if (CollUtil.isEmpty(list)) {
+            MeterInfoDay day = new MeterInfoDay();
+            day.setStationId(entity.getStationId());
+            day.setBoosterId(entity.getBoosterId());
+            String[] split = entity.getUniformCode().split("-");
+            day.setMeterId(split[split.length - 1]);
+            day.setRecordDate(date);
+            list.add(day);
+        }
+        return list.get(0);
+    }
+
+    public List<StationInfoDay> getStationinfoByDate(Date date, List<PointInfo> entity) {
+        List<StationInfoDay> list = getStationinfoByDate(date);
         if (CollUtil.isEmpty(list)) {
             entity.forEach(pi -> {
                 StationInfoDay day = new StationInfoDay();
@@ -266,22 +313,22 @@ public class JavaFunctionJobHandler extends IJobHandler {
         return list;
     }
 
-//    public URI taosUri() {
-//        return URI.create("http://172.16.12.101:8012/ts");
-//    }
-//
-//    public URI goldenUri() {
-//        return URI.create("http://172.16.12.103:8011/ts");
-//    }
+    //    public URI taosUri() {
+    //        return URI.create("http://172.16.12.101:8012/ts");
+    //    }
+    //
+    //    public URI goldenUri() {
+    //        return URI.create("http://172.16.12.103:8011/ts");
+    //    }
 
     public URI taosUri() {
-//        return URI.create("http://10.220.1.8:8011/ts");
-        return URI.create("http://127.0.0.1:8011/ts");
+        return URI.create("http://10.220.1.8:8011/ts");
+        //        return URI.create("http://127.0.0.1:8011/ts");
     }
 
     public URI goldenUri() {
-//        return URI.create("http://10.220.1.8:8011/ts");
-        return URI.create("http://127.0.0.1:8011/ts");
+        return URI.create("http://10.220.1.8:8011/ts");
+        //        return URI.create("http://127.0.0.1:8011/ts");
     }
 
     public Map<String, String> getEntityMap(String uniformCode, String institutionType) {
@@ -300,9 +347,18 @@ public class JavaFunctionJobHandler extends IJobHandler {
     }
 
     public Map<String, TurbineInfoDay> getTurbineinfoMap(Date date, List<PointInfo> entity) {
+        List<TurbineInfoDay> list = getTurbineinfoByDate(date, entity);
+        return list.stream().collect(Collectors.toMap(TurbineInfoDay::getTurbineId, Function.identity()));
+    }
+
+    public List<TurbineInfoDay> getTurbineinfoByDate(Date date) {
         QueryWrapper<TurbineInfoDay> wrapper = new QueryWrapper<>();
         wrapper.eq("record_date", date);
-        List<TurbineInfoDay> list = turbineInfoDayService.list(wrapper);
+        return turbineInfoDayService.list(wrapper);
+    }
+
+    public List<TurbineInfoDay> getTurbineinfoByDate(Date date, List<PointInfo> entity) {
+        List<TurbineInfoDay> list = getTurbineinfoByDate(date);
         if (list.isEmpty()) {
             entity.forEach(pi -> {
                 TurbineInfoDay day = new TurbineInfoDay();
@@ -314,7 +370,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
                 list.add(day);
             });
         }
-        return list.stream().collect(Collectors.toMap(TurbineInfoDay::getTurbineId, Function.identity()));
+        return list;
     }
 
     public List<PointInfo> getEntity(String uniformCode, String institutionType) {
@@ -324,6 +380,17 @@ public class JavaFunctionJobHandler extends IJobHandler {
         return pointService.getByEntity(pi);
     }
 
+    public PointInfo getEntityOne(String uniformCode, String institutionType) {
+        List<PointInfo> entity = getEntity(uniformCode, institutionType);
+        if (CollUtil.isNotEmpty(entity)) return entity.get(0);
+        return null;
+    }
+
+    public Map<String, PointInfo> getEntity(String uniformCode, String institutionType, Function<PointInfo, String> fun) {
+        List<PointInfo> entity = getEntity(uniformCode, institutionType);
+        return entity.stream().collect(Collectors.toMap(fun, Function.identity()));
+    }
+
     public List<PointInfo> getEntityByUis(String uniformCode, String institutionType, String stId) {
         PointInfo pi = new PointInfo();
         pi.setUniformCode(uniformCode);
@@ -543,7 +610,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
             }
             wrapper.clear();
             wrapper.between("record_date", beginTq, endTq);
-//            List<StationInfoDay> sids = stationInfoDayService.list(wrapper);
+            //            List<StationInfoDay> sids = stationInfoDayService.list(wrapper);
             List<StationInfoDay> sids = null;
             Map<String, List<StationInfoDay>> sidMap;
             if (CollUtil.isNotEmpty(sids)) {
@@ -685,6 +752,54 @@ public class JavaFunctionJobHandler extends IJobHandler {
         stationInfoDayService.saveOrUpdateBatch(Collections.singleton(day));
     }
 
+    public void calcStationSwGwCyRdl_ha(Date date) {
+        //date当天零点
+        DateTime time = DateUtil.beginOfDay(date);
+        //date昨天零点
+        DateTime time0 = DateUtil.offsetDay(time, -1);
+
+        List<PointInfo> swdlEt = getEntity("Z-ZXYG-CX", "meter");
+        List<PointInfo> gwdlEt = getEntity("Z-FXYG-CX", "meter");
+        List<PointInfo> cydlEt = getEntity("Z-ZXYG-ZYB", "meter");
+        getRawDataByEntity(swdlEt, goldenUri(), time0, time);
+        getRawDataByEntity(gwdlEt, goldenUri(), time0, time);
+        getRawDataByEntity(cydlEt, goldenUri(), time0, time);
+
+        Map<String, PointInfo> swdlMap = swdlEt.stream().collect(Collectors.toMap(PointInfo::getStationId, Function.identity()));
+        Map<String, PointInfo> gwdlMap = gwdlEt.stream().collect(Collectors.toMap(PointInfo::getStationId, Function.identity()));
+        Map<String, PointInfo> cydlMap = cydlEt.stream().collect(Collectors.toMap(PointInfo::getStationId, Function.identity()));
+
+        List<StationInfoDay> byDate = getStationinfoByDate(time0, swdlEt);
+        String stId;
+        PointInfo swdlPi, gwdlPi, cydlPi;
+        for (StationInfoDay info : byDate) {
+            stId = info.getStationId();
+            swdlPi = swdlMap.get(stId);
+            gwdlPi = gwdlMap.get(stId);
+            cydlPi = cydlMap.get(stId);
+            List<PointData> swdlPds = swdlPi.getPointDatas().stream().filter(pd -> pd.getValue() != 0).collect(Collectors.toList());
+            double swdl = 0;
+            if (swdlPds.size() > 1)
+                swdl = Math.abs(swdlPds.get(0).getValue() - swdlPds.get(swdlPds.size() - 1).getValue()) * swdlPi.getCoef();
+            List<PointData> gwdlPds = gwdlPi.getPointDatas().stream().filter(pd -> pd.getValue() != 0).collect(Collectors.toList());
+            double gwdl = 0;
+            if (gwdlPds.size() > 1)
+                gwdl = Math.abs(gwdlPds.get(0).getValue() - gwdlPds.get(gwdlPds.size() - 1).getValue()) * gwdlPi.getCoef();
+            List<PointData> cydlPds = cydlPi.getPointDatas().stream().filter(pd -> pd.getValue() != 0).collect(Collectors.toList());
+            double cydl = 0;
+            if (cydlPds.size() > 1)
+                cydl = Math.abs(cydlPds.get(0).getValue() - cydlPds.get(cydlPds.size() - 1).getValue()) * cydlPi.getCoef();
+
+            if (swdl < 0 || swdl > 6000000) swdl = 0;
+            if (gwdl < 0 || gwdl > 6000000) gwdl = 0;
+            if (cydl < 0 || cydl > 6000000) cydl = 0;
+            info.setSwdl((int) swdl);
+            info.setGwdl((int) gwdl);
+            info.setZyb((int) cydl);
+        }
+        stationInfoDayService.saveOrUpdateBatch(byDate);
+    }
+
     public void calcStationSwGwCyRdl(Date date) {
         //date当天零点
         DateTime time = DateUtil.beginOfDay(date);
@@ -1314,7 +1429,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
         DateTime time0 = DateUtil.offsetDay(time, -1);
 
         List<PointInfo> entity = getEntity("AI121", "turbine");
-//        getZeroNextData(entity, time0, time);
+        //        getZeroNextData(entity, time0, time);
         getSectionDataByEntity(entity, goldenUri(), time0, time);
         Map<String, PointInfo> turMap = entity.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
         Map<String, String> fsMap = getEntityMap("AI066", "turbine");
@@ -1350,6 +1465,78 @@ public class JavaFunctionJobHandler extends IJobHandler {
         turbineInfoDayService.saveOrUpdateBatch(infoDays);
     }
 
+    public void calcLineRfdl_ha(Date date) {
+        //date当天零点
+        DateTime time = DateUtil.beginOfDay(date);
+        //date昨天零点
+        DateTime time0 = DateUtil.offsetDay(time, -1);
+
+        List<PointInfo> entity = getEntity("Z-ZXYG-JX", "meter");
+        entity = entity.stream().filter(e -> !"".equals(e.getProjectId())).collect(Collectors.toList());
+        getRawDataByEntity(entity, goldenUri(), time0, time);
+        //线路耗电量
+        List<PointInfo> entityHdl = getEntity("Z-FXYG-JX", "meter");
+        entityHdl = entityHdl.stream().filter(e -> !"".equals(e.getProjectId())).collect(Collectors.toList());
+        getRawDataByEntity(entityHdl, goldenUri(), time0, time);
+
+        Map<String, PointInfo> fdlMap = entity.stream().collect(Collectors.toMap(PointInfo::getLineId, Function.identity()));
+        Map<String, PointInfo> hdlMap = entityHdl.stream().collect(Collectors.toMap(PointInfo::getLineId, Function.identity()));
+        List<LineInfoDay> byDate = getLineinfoByDate(time0, entity);
+        for (LineInfoDay day : byDate) {
+            String lineId = day.getLineId();
+            double fdl = calcHaDl(fdlMap.get(lineId));
+            if (fdl < 0 || fdl > 30000000) fdl = 0;
+            double hdl = calcHaDl(hdlMap.get(lineId));
+            if (hdl < 0 || hdl > 30000000) fdl = 0;
+            day.setRfdl((int) fdl);
+            day.setHdl(hdl);
+        }
+        lineInfoDayService.saveOrUpdateBatch(byDate);
+    }
+
+    public void calcTurbineRFDL_ha(Date date) {
+        //date当天零点
+        DateTime time = DateUtil.beginOfDay(date);
+        //date昨天零点
+        DateTime time0 = DateUtil.offsetDay(time, -1);
+
+        List<PointInfo> entity = getEntity("AI121", "turbine");
+        //        getZeroNextData(entity, time0, time);
+        getSectionDataByEntity(entity, goldenUri(), time0, time);
+        Map<String, PointInfo> turMap = entity.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
+        Map<String, String> fsMap = getEntityMap("AI066", "turbine");
+
+        Map<String, TurbineInfoDay> byDate = getTurbineinfoMap(time0, entity);
+
+        TurbineInfoDay infoDay;
+        PointInfo rfdlPi;
+        String turbineId;
+        List<TurbineInfoDay> infoDays = new ArrayList<>();
+        List<PointData> stat;
+        for (PointInfo info : entity) {
+            turbineId = info.getTurbineId();
+            infoDay = byDate.get(turbineId);
+
+            rfdlPi = turMap.get(turbineId);
+            double v = (rfdlPi.getPointDatas().get(1).getValue() - rfdlPi.getPointDatas().get(0).getValue()) * rfdlPi.getCoef();
+            if (v < 0 || v > 1000000) {
+                v = 0;
+            } else if (v > 30000) {
+                v = v / (v % 30000 + 3);
+            }
+            infoDay.setRfdl(v);
+            stat = adapter.getHistoryRaw(goldenUri(), fsMap.get(turbineId), time0.getTime(), time.getTime());
+            if (stat == null || stat.isEmpty()) {
+                infoDay.setPjfs(0.0);
+            } else {
+                infoDay.setPjfs(stat.stream().mapToDouble(PointData::getValue).average().orElse(0));
+            }
+
+            infoDays.add(infoDay);
+        }
+        turbineInfoDayService.saveOrUpdateBatch(infoDays);
+    }
+
     /*public void calcTurbine5s(Date date) {
         //date当天零点
         DateTime time = DateUtil.beginOfDay(date);
@@ -1551,7 +1738,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
                 List<PointData> fss = fsMap.get(wtId).getPointDatas();
                 List<PointData> gls = glMapMap.get(stId).get(wtId);
                 //叶轮转速给定
-                List<PointData> ylzsgds = collectYlzsgd.get(stId).get(wtId);
+                List<PointData> ylzsgds = Optional.ofNullable(collectYlzsgd.get(stId)).map(m -> m.get(wtId)).orElse(null);
                 calcTurbineXd(ztInfo, gls, fss, ylzsgds, czxd);
             });
         });
@@ -2219,10 +2406,174 @@ public class JavaFunctionJobHandler extends IJobHandler {
         return y;
     }
 
+    public void cutInWindSpeed(Date date) {
+        //date当天零点
+        DateTime timeNow = DateUtil.beginOfDay(date);
+        //date昨天零点
+        DateTime timeBegin = DateUtil.offsetDay(timeNow, -1);
+        List<PointInfo> turbineZt = calcTurbineAizt(timeBegin, timeNow, 60);
+        List<PointInfo> turbineZtDI = calcTurbineDizt(timeBegin, timeNow, 60);
+        turbineZt.addAll(turbineZtDI);
+
+        //所有风机的风速测点
+        QueryWrapper<PointInfo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("uniform_code", "AI066");
+
+        List<PointInfo> pointInfos = getEntity("AI066", "turbine");
+        //        List<PointInfo> pointInfos = pointInfo.selectList(queryWrapper);
+
+        //定义切入风速map集合
+        ConcurrentHashMap<String, ConcurrentHashMap<String, Double>> mapIn = new ConcurrentHashMap<>();
+
+        //定义切出风速集合
+        ConcurrentHashMap<String, ConcurrentHashMap<String, Double>> mapOut = new ConcurrentHashMap<>();
+
+
+        //遍历每台风机,取出每台风机的pointDatas
+        for (PointInfo turbine : turbineZt) {
+
+            mapIn.put(turbine.getTurbineId(), new ConcurrentHashMap<>());
+            mapOut.put(turbine.getTurbineId(), new ConcurrentHashMap<>());
+
+            List<PointData> pointDatas = turbine.getPointDatas();
+
+            //风速测点key
+            String windSpeedKey = null;
+
+
+            //遍历pointInfos,找出pointData1的id和pointInfos中相等的,取出pointInfo的pointKey
+            for (PointInfo info : pointInfos) {
+                if (Objects.equals(turbine.getTurbineId(), info.getTurbineId())) {
+                    windSpeedKey = info.getPointKey();
+                }
+            }
+
+
+            //遍历pointDatas,取出当前状态和后一个状态
+            for (int k = 1; k < pointDatas.size(); k++) {
+                PointData pointData1 = pointDatas.get(k - 1);
+                PointData pointData2 = pointDatas.get(k);
+                double value1 = pointData1.getValue();
+                double value2 = pointData2.getValue();
+                //切入时间
+                long ts1;
+                //切出时间
+                long ts2;
+
+                //如果1的值为0,2的值为2,则为切入状态
+                if (value1 == 0 && value2 == 2) {
+                    ts1 = pointData2.getTs();
+                    //                    String stringDate = DateUtil.date(ts1).toString("yyyy-MM-dd HH:mm:ss");
+                    //                    System.out.println(turbine.getTurbineId() + "切入" + stringDate);
+                    //切入时间前5分钟
+                    long ts11 = ts1 - 300000;
+                    //根据风速key,从适配器取切入前5分钟的所有风速
+                    List<PointData> pointDatas1 = adapter.getHistorySnap(goldenUri(), windSpeedKey, ts11, ts1, 10);
+                    //平均所有风速即为平均切入风速
+                    double avgCutInWindSpeed = pointDatas1.stream().mapToDouble(PointData::getValue).average().orElse(0);
+                    //                    System.out.println(turbine.getTurbineId() + "切入风速" + avgCutInWindSpeed);
+
+                    //存入map集合,外层key为turbineId,内层key为ts1,value为平均切入风速
+
+                    mapIn.get(turbine.getTurbineId()).put(String.valueOf(ts1), avgCutInWindSpeed);
+
+                }
+
+                //切出
+                if (value1 == 2 && value2 != 2) {
+                    ts2 = pointData2.getTs();
+                    String stringDate = DateUtil.date(ts2).toString("yyyy-MM-dd HH:mm:ss");
+                    //                    System.out.println(turbine.getTurbineId() + "切出" + stringDate);
+                    //切出时间前5分钟
+                    long ts22 = ts2 - 300000;
+                    List<PointData> pointDatas2 = adapter.getHistorySnap(goldenUri(), windSpeedKey, ts22, ts2, 10);
+                    double avgCutOutWindSpeed = pointDatas2.stream().mapToDouble(PointData::getValue).average().orElse(0);
+                    //                    System.out.println(turbine.getTurbineId() + "切出风速" + avgCutOutWindSpeed);
+
+                    //存入map集合,外层key为turbineId,内层key为ts2,value为平均切出风速
+
+                    mapOut.get(turbine.getTurbineId()).put(String.valueOf(ts2), avgCutOutWindSpeed);
+                }
+
+            }
+            //遍历map集合,取出每个风机的所有切入风速,算一个平均值
+            ConcurrentHashMap<String, Double> mapTurbineValues = mapIn.get(turbine.getTurbineId());
+            //平均切入风速
+            double avgCutInWindSpeed = 0;
+            if (mapTurbineValues != null) {
+                AtomicReference<Double> sum = new AtomicReference<>(0.0);
+                //遍历mapTurbineValues,V大于5的舍弃,剩余算平均值
+                for (String key : mapTurbineValues.keySet()) {
+                    if (mapTurbineValues.get(key) > 5) {
+                        mapTurbineValues.remove(key);
+                    }
+                }
+                mapTurbineValues.forEach((k1, v) -> {
+                    sum.updateAndGet(v1 -> v1 + v);
+                });
+
+                //如果值为空则置0
+                if (sum.get() == 0) {
+                    avgCutInWindSpeed = 0;
+                } else {
+                    avgCutInWindSpeed = sum.get() / mapTurbineValues.size();
+                }
+                System.out.println(turbine.getTurbineId() + "切入平均风速" + avgCutInWindSpeed + "时间" + timeBegin);
+            }
+
+            //遍历map集合,取出每个风机的所有切出风速,算一个平均值
+            ConcurrentHashMap<String, Double> mapTurbineValues2 = mapOut.get(turbine.getTurbineId());
+
+            double avgCutOutWindSpeed;
+            if (mapTurbineValues2 != null) {
+                AtomicReference<Double> sum = new AtomicReference<>(0.0);
+
+                for (String key : mapTurbineValues2.keySet()) {
+                    if (mapTurbineValues2.get(key) > 5) {
+                        mapTurbineValues2.remove(key);
+                    }
+                }
+                mapTurbineValues2.forEach((k2, v) -> {
+                    sum.updateAndGet(v1 -> v1 + v);
+                });
+
+                if (sum.get() == 0) {
+                    avgCutOutWindSpeed = 0;
+                } else {
+                    avgCutOutWindSpeed = sum.get() / mapTurbineValues2.size();
+                }
+                System.out.println(turbine.getTurbineId() + "切出平均风速" + avgCutOutWindSpeed + "时间" + timeBegin);
+            }
+
+            //存入数据库
+            String turbineId = turbine.getTurbineId();
+            Date jdkDate = timeBegin.toJdkDate();
+            System.out.println(turbineId + " " + jdkDate);
+            QueryWrapper<TurbineInfoDay> turbineInfoDayQueryWrapper = new QueryWrapper<>();
+            turbineInfoDayQueryWrapper.eq("turbine_id", turbine.getTurbineId());
+            turbineInfoDayQueryWrapper.eq("record_date", timeBegin.toJdkDate());
+            TurbineInfoDay one = turbineInfoDayService.getOne(turbineInfoDayQueryWrapper);
+            System.out.println(one);
+            if (one == null) {
+                TurbineInfoDay turbineInfoDay = new TurbineInfoDay();
+                turbineInfoDay.setTurbineId(turbine.getTurbineId());
+                turbineInfoDay.setRecordDate(timeBegin.toJdkDate());
+                turbineInfoDay.setXfqrfs(avgCutInWindSpeed);
+                System.out.println(turbineInfoDay);
+                turbineInfoDayService.save(turbineInfoDay);
+            } else {
+                one.setXfqrfs(avgCutInWindSpeed);
+                System.out.println(one);
+                turbineInfoDayService.updateById(one);
+            }
+
+        }
+    }
+
 
     //切入切出风速
 
-    public void cutInWindSpeed() {
+    public void cutInWindSpeed2() {
         //date当天零点
         DateTime timeNow00 = DateUtil.beginOfDay(new Date());
         //date昨天零点
@@ -2412,10 +2763,10 @@ public class JavaFunctionJobHandler extends IJobHandler {
         }
     }
 
-    public void calcGlqxnh_edfs() {
+    public void calcGlqxnh_edfs(Date date) {
 
         //date当天零点
-        Date end = DateUtil.beginOfDay(new Date()).toJdkDate();
+        Date end = DateUtil.beginOfDay(date).toJdkDate();
         //date昨天零点
         Date start = DateUtil.offsetDay(end, -1).toJdkDate();
 
@@ -2427,20 +2778,20 @@ public class JavaFunctionJobHandler extends IJobHandler {
 
         Map<String, EquipmentModel> map = equipmentModelService.map();
 
-//        List<PointInfo> entity = new ArrayList<>();
-//        List<PointInfo> entity0 = getEntity("MX000", "state");
-//        List<PointInfo> entity1 = getEntity("MX001", "state");
-//        List<PointInfo> entity2 = getEntity("MX002", "state");
-//        List<PointInfo> entity4 = getEntity("MX004", "state");
-//        List<PointInfo> entity6 = getEntity("MX006", "state");
-//        entity.addAll(entity0);
-//        entity.addAll(entity1);
-//        entity.addAll(entity2);
-//        entity.addAll(entity4);
-//        entity.addAll(entity6);
-//        List<String> keys = entity.stream().map(PointInfo::getPointKey).collect(Collectors.toList());
-//        Map<String, PointData> latest = adapter.getHistorySection(goldenUri(), String.join(",", keys), start.getTime());
-//        Map<String, Map<String, PointInfo>> wtUcPis = entity.stream().collect(Collectors.groupingBy(PointInfo::getTurbineId, Collectors.toMap(PointInfo::getUniformCode, Function.identity())));
+        //        List<PointInfo> entity = new ArrayList<>();
+        //        List<PointInfo> entity0 = getEntity("MX000", "state");
+        //        List<PointInfo> entity1 = getEntity("MX001", "state");
+        //        List<PointInfo> entity2 = getEntity("MX002", "state");
+        //        List<PointInfo> entity4 = getEntity("MX004", "state");
+        //        List<PointInfo> entity6 = getEntity("MX006", "state");
+        //        entity.addAll(entity0);
+        //        entity.addAll(entity1);
+        //        entity.addAll(entity2);
+        //        entity.addAll(entity4);
+        //        entity.addAll(entity6);
+        //        List<String> keys = entity.stream().map(PointInfo::getPointKey).collect(Collectors.toList());
+        //        Map<String, PointData> latest = adapter.getHistorySection(goldenUri(), String.join(",", keys), start.getTime());
+        //        Map<String, Map<String, PointInfo>> wtUcPis = entity.stream().collect(Collectors.groupingBy(PointInfo::getTurbineId, Collectors.toMap(PointInfo::getUniformCode, Function.identity())));
 
         List<PointInfo> entityAiZt = getEntity("AI422", "state");
         Map<String, PointInfo> aiztMap = entityAiZt.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
@@ -2448,7 +2799,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
         Map<String, Map<Integer, Integer>> collectAi = list.stream().collect(Collectors.groupingBy(
                 StateAi::getModel, Collectors.toMap(StateAi::getOriginalState, StateAi::getMappingState)));
 
-//        Map<String, Map<Double,Double>> fitMap = new HashMap<>();
+        //        Map<String, Map<Double,Double>> fitMap = new HashMap<>();
         int i = 0;
         for (PointInfo ef : entityFs) {
             String wtId = ef.getTurbineId();
@@ -2460,30 +2811,30 @@ public class JavaFunctionJobHandler extends IJobHandler {
             ef.setPointDatas(peek);
 
             try {
-//                PointInfo turbineZt = calcTurbineDizt2(wtUcPis.get(wtId), latest, start, end, 60);
+                //                PointInfo turbineZt = calcTurbineDizt2(wtUcPis.get(wtId), latest, start, end, 60);
                 PointInfo turbineAizt = calcTurbineAizt2(aiztMap.get(wtId), collectAi, start, end, 60);
                 Map<Double, Double> fit = new TreeMap<>();
                 double capacity = 2000;
-//                if (turbineZt != null) {
-//                    System.out.println("数据处理拟合");
-//                    capacity = map.get(turbineZt.getSpare()).getPowerProduction();
-//                    fit = dataProcessAndFit(ef, glInfo, turbineZt, CalcCache.bzgl.get(turbineZt.getSpare()), capacity);
-////                fitMap.put(wtId, fit);
-//                    turbineZt.setPointDatas(null);
-//                }
+                //                if (turbineZt != null) {
+                //                    System.out.println("数据处理拟合");
+                //                    capacity = map.get(turbineZt.getSpare()).getPowerProduction();
+                //                    fit = dataProcessAndFit(ef, glInfo, turbineZt, CalcCache.bzgl.get(turbineZt.getSpare()), capacity);
+                ////                fitMap.put(wtId, fit);
+                //                    turbineZt.setPointDatas(null);
+                //                }
                 if (turbineAizt != null) {
                     System.out.println("数据处理拟合");
                     capacity = map.get(turbineAizt.getSpare()).getPowerProduction();
                     fit = dataProcessAndFit(ef, glInfo, turbineAizt, CalcCache.bzgl.get(turbineAizt.getSpare()), capacity);
-//                fitMap.put(wtId, fit);
+                    //                fitMap.put(wtId, fit);
                     turbineAizt.setPointDatas(null);
                 }
                 ef.setPointDatas(null);
                 glInfo.setPointDatas(null);
 
                 //存redis
-//            stringRedisTemplate.opsForValue().set("glqxnh:" + end.getMonth() + ":" + wtId, JSON.toJSONString(fit));
-                System.out.println("拟合曲线的大小"+fit.size()+":"+wtId);
+                //            stringRedisTemplate.opsForValue().set("glqxnh:" + end.getMonth() + ":" + wtId, JSON.toJSONString(fit));
+                System.out.println("拟合曲线的大小" + fit.size() + ":" + wtId);
 
 
                 //符合条件的风速和
@@ -2529,15 +2880,14 @@ public class JavaFunctionJobHandler extends IJobHandler {
                     turbineInfoDayService.updateById(one);
                 }
 
-            }catch (Exception e) {
+            } catch (Exception e) {
                 System.out.println(wtId + " " + start);
             }
 
 
-
         }
 
-//        stringRedisTemplate.opsForValue().set("glqxnh", JSON.toJSONString(fitMap));
+        //        stringRedisTemplate.opsForValue().set("glqxnh", JSON.toJSONString(fitMap));
     }
 
     //算额定风速
@@ -3374,7 +3724,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
                 pdsZsglMap.put(wtId, zsglSnap);
             });
             boolean b = agcInfo.getPointDatas().stream().allMatch(ad -> ad.getValue() == 0);
-            if(b){
+            if (b) {
                 PointInfo info = new PointInfo();
                 info.setPointKey(agcInfo.getPointKey());
                 getLatestByEntity(Collections.singletonList(info));
@@ -3383,7 +3733,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
                     agc.setDoubleValue(agcd * agcInfo.getCoef());
                     agc.setLongValue(0L);
                 });
-            }else {
+            } else {
                 agcInfo.getPointDatas().forEach(agc -> {
                     agc.setDoubleValue(agc.getValue() * agcInfo.getCoef());
                     agc.setLongValue(0L);
@@ -3569,17 +3919,26 @@ public class JavaFunctionJobHandler extends IJobHandler {
             infoDay.setJxMin(durations.getOrDefault(6.0, 0L) / 60000.0);
             infoDay.setXdMin(durations.getOrDefault(8.0, 0L) / 60000.0);
             infoDay.setLxMin(durations.getOrDefault(12.0, 0L) / 60000.0);
+            infoDay.setDjcs(frequency.getOrDefault(0.0, 0L));
+            infoDay.setTjcs(frequency.getOrDefault(1.0, 0L));
+            infoDay.setYxcs(frequency.getOrDefault(2.0, 0L));
+            infoDay.setGzcs(frequency.getOrDefault(4.0, 0L));
+            infoDay.setJxcs(frequency.getOrDefault(6.0, 0L));
+            infoDay.setXdcs(frequency.getOrDefault(8.0, 0L));
+            infoDay.setLxcs(frequency.getOrDefault(12.0, 0L));
         }
         turbineInfoDayService.saveOrUpdateBatch(byDate.values());
     }
 
 
     public Map<String, Map<Double, Long>> calcStateDurationFrequency(List<PointData> datas) {
-        if (CollUtil.isEmpty(datas)) return Collections.emptyMap();
-
         Map<Double, Long> durations = new HashMap<>();
         Map<Double, Long> frequency = new HashMap<>();
         Map<String, Map<Double, Long>> dlmm = new HashMap<>();
+        dlmm.put("duration", durations);
+        dlmm.put("frequency", frequency);
+        if (CollUtil.isEmpty(datas)) return dlmm;
+
         double prevState = datas.get(0).getValue(); // 初始状态
         long prevTs = datas.get(0).getTs(); // 初始时间戳
 
@@ -3601,12 +3960,272 @@ public class JavaFunctionJobHandler extends IJobHandler {
         }
         // 不要忘记计算列表中最后一个状态的持续时间(如果列表没有以状态变化结束)
         durations.put(prevState, durations.getOrDefault(prevState, 0L) + (datas.get(datas.size() - 1).getTs() - prevTs));
-
-        dlmm.put("duration", durations);
-        dlmm.put("frequency", frequency);
         return dlmm;
     }
 
+    //依赖calcTurbineStateMin
+    public void calcStationCftfsfxQfxdl(Date date) {
+        //date当天零点
+        DateTime time = DateUtil.beginOfDay(date);
+        //date昨天零点
+        DateTime time0 = DateUtil.offsetDay(time, -1);
+        List<TurbineInfoDay> byDate = getTurbineinfoByDate(time0);
+        Map<String, List<TurbineInfoDay>> tidsMap = byDate.stream().collect(Collectors.groupingBy(TurbineInfoDay::getStationId));
+        List<PointInfo> fsEt = getEntity("FCCFTFS90", "station");
+        List<PointInfo> fxEt = getEntity("FCCFTFX90", "station");
+        Map<String, PointInfo> rawFs = getRawDataByEntity(fsEt, goldenUri(), time0, time, PointInfo::getStationId);
+        Map<String, PointInfo> rawFx = getRawDataByEntity(fxEt, goldenUri(), time0, time, PointInfo::getStationId);
+        List<StationInfoDay> sids = getStationinfoByDate(time0, fsEt);
+
+        QueryWrapper<TurbineInfoDay> wrapper = new QueryWrapper<>();
+        wrapper.select("sum(xdss) xdss,station_id").eq("record_date", time0).groupBy("station_id");
+        List<TurbineInfoDay> list = turbineInfoDayService.list(wrapper);
+        Map<String, TurbineInfoDay> dayMap = list.stream().collect(Collectors.toMap(TurbineInfoDay::getStationId, Function.identity()));
+        for (StationInfoDay sid : sids) {
+            String stId = sid.getStationId();
+            List<TurbineInfoDay> tids = tidsMap.get(stId);
+            double whsj = tids.stream().mapToDouble(tid -> tid.getJxMin()).sum();
+            double gzsj = tids.stream().mapToDouble(tid -> tid.getGzMin()).sum();
+            double yxfss = (tids.size() * 24 * 60 - whsj - gzsj) / (tids.size() * 60);
+            List<PointData> fsDatas = Optional.ofNullable(rawFs.get(stId)).map(PointInfo::getPointDatas).orElse(Collections.emptyList());
+            sid.setCftfs(fsDatas.stream().mapToDouble(PointData::getValue).average().orElse(0d));
+            List<PointData> fxDatas = Optional.ofNullable(rawFx.get(stId)).map(PointInfo::getPointDatas).orElse(Collections.emptyList());
+            sid.setCftfx(fxDatas.stream().mapToDouble(PointData::getValue).average().orElse(0d));
+            sid.setYxfss(yxfss);
+            //弃风电量=限电时段全风场理论上网电量-限电时段全风场实际上网电量
+            //弃风限电率 = 弃风电量 / (风电实际发电量 + 弃风电量) × 100%
+            double xdss = dayMap.get(stId).getXdss();
+            double qfxdl = xdss * 100 / (sid.getRfdl() + xdss);
+            sid.setQfxdl(qfxdl);
+        }
+        stationInfoDayService.saveOrUpdateBatch(sids);
+    }
+
+    public void calcMeterDlHdl(Date date) {
+        //date当天零点
+        DateTime time = DateUtil.beginOfDay(date);
+        //date昨天零点
+        DateTime time0 = DateUtil.offsetDay(time, -1);
+        //1号主变高压侧正向有功
+        MeterInfoDay zbgyc1Day = calcMeterSimple("B-FXYG-ZBGYC1", time0, time, "ZB");
+        zbgyc1Day.setHdl(0d);
+        //1号主变低压侧正向有功
+        MeterInfoDay zbdyc1Day = calcMeterSimple("B-ZXYG-ZBDYC1", time0, time, "ZB");
+        calcMeterSimple("B-FXYG-ZBDYC1", time0, time, zbdyc1Day);
+        //2号主变高压侧正向有功
+        MeterInfoDay zbgyc2Day = calcMeterSimple("B-ZXYG-ZBGYC2", time0, time, "ZB");
+        calcMeterSimple("B-FXYG-ZBGYC2", time0, time, zbgyc2Day);
+        //2号主变低压侧正向有功
+        MeterInfoDay zbdyc2Day = calcMeterSimple("B-ZXYG-ZBDYC2", time0, time, "ZB");
+        calcMeterSimple("B-FXYG-ZBDYC2", time0, time, zbdyc2Day);
+        //1号接地变兼站用变 B-ZXYG-ZDB1 B-FXYG-ZDB1
+        MeterInfoDay jdb1Day = calcMeterSimple("B-ZXYG-ZDB1", time0, time, "ZYB");
+        calcMeterSimple("B-FXYG-ZDB1", time0, time, jdb1Day);
+        //2号接地变 B-ZXYG-ZDB1 B-FXYG-ZDB1
+        MeterInfoDay jdb2Day = calcMeterSimple("B-ZXYG-ZDB2", time0, time, "JDB");
+        calcMeterSimple("B-FXYG-ZDB2", time0, time, jdb2Day);
+        //1号SVG B-ZXYG-SVG1 B-FXYG-SVG1
+        MeterInfoDay svg1Day = calcMeterSimple("B-ZXYG-SVG1", time0, time, "SVG");
+        calcMeterSimple("B-FXYG-SVG1", time0, time, svg1Day);
+        //2号SVG B-ZXYG-SVG2 B-FXYG-SVG2
+        MeterInfoDay svg2Day = calcMeterSimple("B-ZXYG-SVG2", time0, time, "SVG");
+        calcMeterSimple("B-FXYG-SVG2", time0, time, svg2Day);
+
+        List<MeterInfoDay> save = new ArrayList<>();
+        save.add(zbdyc1Day);
+        save.add(zbgyc2Day);
+        save.add(zbdyc2Day);
+        meterInfoDayService.saveOrUpdateBatch(save);
+    }
+
+    public void calcStationKqmd(Date date, String uniform_code) {
+        //date当天零点
+        DateTime time = DateUtil.beginOfDay(date);
+        //date昨天零点
+        DateTime time0 = DateUtil.offsetDay(time, -1);
+        List<PointInfo> wdEt = getEntity("FCCFTWD", "station");
+        List<PointInfo> yqEt = getEntity("FCCFTYQ", "station");
+        Map<String, PointInfo> rawWd = getRawDataByEntity(wdEt, goldenUri(), time0, time, PointInfo::getStationId);
+        Map<String, PointInfo> secYq = getSectionDataByEntity(yqEt, goldenUri(), time0, time, PointInfo::getStationId);
+        List<StationInfoDay> sids = getStationinfoByDate(time0, wdEt);
+        for (StationInfoDay sid : sids) {
+            String stId = sid.getStationId();
+            List<PointData> wdData = rawWd.get(stId).getPointDatas();
+            List<PointData> yqData = secYq.get(stId).getPointDatas();
+            double wd = wdData.stream().mapToDouble(PointData::getValue).average().orElse(0d);
+            double yq = yqData.stream().mapToDouble(PointData::getValue).average().orElse(0d);
+            double md = 1.293 * (yq * 100 / 101325) * (273.15 / (wd + 273.15));
+            sid.setKqmd(md);
+        }
+        stationInfoDayService.saveOrUpdateBatch(sids);
+    }
+
+    public MeterInfoDay calcMeterSimple(String uniform_code, DateTime time0, DateTime time, String parent_id) {
+        PointInfo et = getEntityOne(uniform_code, "meter");
+        getRawDataByEntity(Collections.singletonList(et), goldenUri(), time0, time);
+        MeterInfoDay day = getMeterinfoByDate(time0, et);
+        day.setParentId(parent_id);
+        day.setFdl(calcHaDl(et));
+        return day;
+    }
+
+    public void calcMeterSimple(String uniform_code, DateTime time0, DateTime time, MeterInfoDay day) {
+        PointInfo et = getEntityOne(uniform_code, "meter");
+        getRawDataByEntity(Collections.singletonList(et), goldenUri(), time0, time);
+        day.setHdl(calcHaDl(et));
+    }
+
+    public double calcHaDl(PointInfo pi) {
+        List<PointData> pds = Optional.ofNullable(pi).map(PointInfo::getPointDatas).orElse(Collections.emptyList());
+        pds = pi.getPointDatas().stream().filter(pd -> pd.getValue() != 0).collect(Collectors.toList());
+        if (pds.size() < 2) return 0;
+        double dl = Math.abs(pds.get(0).getValue() - pds.get(pds.size() - 1).getValue()) * pi.getCoef();
+        return dl;
+    }
+
+    public void calcStationKydlzql(Date date) {
+        //date昨天零点
+        DateTime begin = DateUtil.offsetDay(DateUtil.beginOfDay(date), -1);
+        //date昨天晚
+        DateTime end = DateUtil.offsetDay(DateUtil.endOfDay(date), -1);
+
+        //实际功率
+        QueryWrapper<StationInfoMin> minWrapper = new QueryWrapper<>();
+        minWrapper.between("record_date", begin, end).orderByAsc("record_date");
+        List<StationInfoMin> minList = stationInfoMinService.list(minWrapper);
+        Map<String, List<StationInfoMin>> minMap = minList.stream().collect(Collectors.groupingBy(StationInfoMin::getStationId));
+        List<PointInfo> entityGl = getEntity("AGC001", "booster");
+        Map<String, Double> glpisMap = entityGl.stream().collect(Collectors.toMap(PointInfo::getStationId, PointInfo::getSpare2));
+
+        List<PointInfo> entityKyfdl = getEntity("FCKYFDL", "station");
+        getRawDataByEntity(entityKyfdl, taosUri(), begin, end);
+        Map<String, PointInfo> kyfdlMap = entityKyfdl.stream().collect(Collectors.toMap(PointInfo::getStationId, Function.identity()));
+        List<PointInfo> entityCzzt = getEntity("AGC009", "booster");
+        getRawDataByEntity(entityCzzt, taosUri(), begin, end);
+        Map<String, PointInfo> czztMap = entityCzzt.stream().collect(Collectors.toMap(PointInfo::getStationId, Function.identity()));
+        Map<String, Map<DateTime, List<Double>>> czztMapMap = new HashMap<>();
+        czztMap.forEach((stId, pi) -> {
+            Map<DateTime, List<Double>> ztMap = new HashMap<>();
+            long b = begin.getTime();
+            long e = end.getTime();
+            long b0 = b;
+            long e0 = b + 15 * 60 * 1000;
+            while (e0 < e) {
+                for (PointData pd : pi.getPointDatas()) {
+                    long ts = pd.getTs();
+                    if (ts >= b0 && ts < e0) {
+                        List<Double> doubles = ztMap.computeIfAbsent(DateUtil.date(b0), k -> new ArrayList<>());
+                        doubles.add(pd.getValue());
+                    } else if (ts >= e0 && ts < e0 + 15 * 60 * 1000) {
+                        List<Double> doubles = ztMap.computeIfAbsent(DateUtil.date(e0), k -> new ArrayList<>());
+                        doubles.add(pd.getValue());
+                        b0 = e0;
+                        e0 += 15 * 60 * 1000;
+                    } else {
+                        b0 = e0;
+                        e0 += 15 * 60 * 1000;
+                    }
+                }
+                if (pi.getPointDatas().isEmpty()) {
+                    b0 = e0;
+                    e0 += 15 * 60 * 1000;
+                }
+            }
+            czztMapMap.put(stId, ztMap);
+        });
+
+        List<StationInfoDay> sids = getStationinfoByDate(begin, entityGl);
+        for (StationInfoDay sid : sids) {
+            String stId = sid.getStationId();
+            Double capacity = glpisMap.get(stId) * 1000;
+            List<StationInfoMin> mins = minMap.get(stId);
+            Map<DateTime, List<Double>> dtlMap = czztMapMap.get(stId);
+            PointInfo kyfdlPi = kyfdlMap.get(stId);
+            List<PointData> kyfdlDatas = Optional.ofNullable(kyfdlPi).map(PointInfo::getPointDatas).orElse(Collections.emptyList());
+            Map<Long, List<PointData>> kydlMap = kyfdlDatas.stream().collect(Collectors.groupingBy(pd -> pd.getTs() % (15 * 60 * 1000)));
+            double actualPower = 0, availablePower = 0;
+            for (StationInfoMin min : mins) {
+                List<Double> doubles = dtlMap.get(min.getRecordDate());
+                List<PointData> kypd = kydlMap.get(min.getRecordDate().getTime());
+                //限电
+                if (calcXdRate(doubles) > 0.6) continue;
+                actualPower += min.getRfdl();
+                availablePower += kypd.stream().mapToDouble(PointData::getValue).sum();
+            }
+            double accuracy = calcKydlAccuracy(actualPower, availablePower * kyfdlPi.getCoef(), capacity);
+            sid.setKydlzql(accuracy * 100);
+        }
+        stationInfoDayService.saveOrUpdateBatch(sids);
+    }
+
+    //依赖calcTurbineStateMin
+    public void calcTurbineJfplFxYxfssBll(Date date) {
+        //date当天零点
+        DateTime time = DateUtil.beginOfDay(date);
+        //date昨天零点
+        DateTime time0 = DateUtil.offsetDay(time, -1);
+        //风速
+        List<PointInfo> entityFs = getEntity("AI066", "turbine");
+        Map<String, PointInfo> rawDataFs = getRawDataByEntity(entityFs, goldenUri(), time0, time, PointInfo::getTurbineId);
+        List<TurbineInfoDay> byDate = getTurbineinfoByDate(time0);
+        //风向
+        List<PointInfo> entityFx = getEntity("DI1392", "turbine");
+        Map<String, PointInfo> rawDataFx = getRawDataByEntity(entityFx, goldenUri(), time0, time, PointInfo::getTurbineId);
+
+        for (TurbineInfoDay day : byDate) {
+            String tbId = day.getTurbineId();
+            List<PointData> pds = Optional.ofNullable(rawDataFs.get(tbId))
+                    .map(PointInfo::getPointDatas).orElse(Collections.emptyList());
+            long jfsc = calcDuration(pds, pd -> pd.getValue() < 3d);
+            day.setJfpl(jfsc / (1000 * 60 * 60 * 24d));
+            double yxfss = (24 * 60 - day.getJxMin() - day.getGzMin()) / 60;
+            day.setYxfss(yxfss);
+            List<PointData> pdsFx = Optional.ofNullable(rawDataFx.get(tbId))
+                    .map(PointInfo::getPointDatas).orElse(Collections.emptyList());
+            double fx = pdsFx.stream().mapToDouble(PointData::getValue).average().orElse(0d);
+            day.setFx(fx);
+            //暴露率 = (运行小时 / 可用小时) × 100%
+            double bll = day.getYxMin() * 100 / (24 * 60 - day.getGzMin() - day.getJxMin());
+            day.setBll(bll);
+        }
+        turbineInfoDayService.saveOrUpdateBatch(byDate);
+    }
+
+    //依赖calcTurbineRfdl、calcTurbineStateMin、calcTurbine5s2
+    public void calcTurbineLyxs(Date date) {
+        //date当天零点
+        DateTime time = DateUtil.beginOfDay(date);
+        //date昨天零点
+        DateTime time0 = DateUtil.offsetDay(time, -1);
+        List<TurbineInfoDay> byDate = getTurbineinfoByDate(time0);
+        Map<String, PointInfo> entityAiZt = getEntity("AI422", "state", PointInfo::getTurbineId);
+
+        for (TurbineInfoDay day : byDate) {
+            String tbId = day.getTurbineId();
+            double lyxs = day.getRfdl() / entityAiZt.get(tbId).getSpare2();
+            double klyl = (24 * 60 - day.getGzMin()) / (24 * 60);
+            double fnlyl = day.getRfdl() / day.getLlfdl();
+            day.setLyxs(lyxs);
+            day.setKlyl(klyl);
+            day.setFnlyl(fnlyl);
+        }
+        turbineInfoDayService.saveOrUpdateBatch(byDate);
+    }
+
+    public long calcDuration(List<PointData> pds, Function<PointData, Boolean> fun) {
+        if (CollUtil.isEmpty(pds)) return 0;
+        pds.sort(Comparator.comparingLong(PointData::getTs));
+        long result = 0;
+        PointData prevPd = pds.get(0);
+        for (PointData pd : pds) {
+            if (fun.apply(prevPd)) {
+                result += pd.getTs() - prevPd.getTs();
+            }
+            prevPd = pd;
+        }
+        return result;
+    }
+
     public Map<Double, Long> calculateStateDurations(List<PointData> datas) {
         if (CollUtil.isEmpty(datas)) return Collections.emptyMap();
 
@@ -3759,6 +4378,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
         entity.addAll(entity2);
         entity.addAll(entity4);
         entity.addAll(entity6);
+        if (CollUtil.isEmpty(entity)) return new HashMap<>();
         entity = entity.stream().filter(pi -> stId.equals(pi.getStationId())).collect(Collectors.toList());
         if (CollUtil.isEmpty(entity)) return new HashMap<>();
         String keys = entity.stream().map(PointInfo::getPointKey).collect(Collectors.joining(","));
@@ -4663,6 +5283,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
         entity.addAll(entity2);
         entity.addAll(entity4);
         entity.addAll(entity6);
+        if (CollUtil.isEmpty(entity)) return result;
         String keys = entity.stream().map(PointInfo::getPointKey).collect(Collectors.joining(","));
         Map<String, PointData> latest = adapter.getHistorySection(goldenUri(), keys, time.getTime());
 
@@ -5361,6 +5982,11 @@ public class JavaFunctionJobHandler extends IJobHandler {
         return entity.stream().filter(e -> id.equals(fun.apply(e))).collect(Collectors.toList());
     }
 
+    public void filterPointInfo2(List<PointInfo> entity, String id, Function<PointInfo, String> fun) {
+        entity = entity.stream().filter(e -> id.equals(fun.apply(e))).collect(Collectors.toList());
+        System.out.println();
+    }
+
     public List<PointInfo> sortPointInfo(List<PointInfo> entity, Function<PointInfo, String> fun) {
         return entity.stream().sorted(Comparator.comparing(fun)).collect(Collectors.toList());
     }
@@ -6281,47 +6907,299 @@ public class JavaFunctionJobHandler extends IJobHandler {
         }
     }
 
-//    public void calcTurbineJfplPjfxGlyzxxs(Date date) {
-//        //静风频率,平均风向、功率一致性系数
-//        //date当天零点
-//        DateTime time = DateUtil.beginOfDay(date);
-//        //date昨天零点
-//        DateTime time0 = DateUtil.offsetDay(time, -1);
-//
-//        List<PointInfo> entityFx = getEntity("AI066", "turbine");
-//        getStatDataByEntity();
-//        getZeroNextData(entity, time0, time);
-//        Map<String, PointInfo> turMap = entity.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
-//        Map<String, String> fsMap = getEntityMap("AI066", "turbine");
-//
-//        Map<String, TurbineInfoDay> byDate = getTurbineinfoMap(time0, entity);
-//
-//        TurbineInfoDay infoDay;
-//        PointInfo rfdlPi;
-//        String turbineId;
-//        List<TurbineInfoDay> infoDays = new ArrayList<>();
-//        DoubleStatData stat;
-//        for (PointInfo info : entity) {
-//            turbineId = info.getTurbineId();
-//            infoDay = byDate.get(turbineId);
-//
-//            rfdlPi = turMap.get(turbineId);
-//            double v = (rfdlPi.getPointDatas().get(1).getValue() - rfdlPi.getPointDatas().get(0).getValue()) * rfdlPi.getCoef();
-//            if (v < 0 || v > 1000000) {
-//                v = 0;
-//            } else if (v > 30000) {
-//                v = v / (v % 30000 + 3);
-//            }
-//            infoDay.setRfdl(v);
-//            stat = adapter.getHistoryStat(goldenUri(), fsMap.get(turbineId), time0.getTime(), time.getTime());
-//            if (stat == null) {
-//                infoDay.setPjfs(0.0);
-//            } else {
-//                infoDay.setPjfs(stat.getAvg().getValue());
-//            }
-//
-//            infoDays.add(infoDay);
-//        }
-//        turbineInfoDayService.saveOrUpdateBatch(infoDays);
-//    }
+    //计算惠安报表汇总
+    public void calcHaBbHzSs(Date date) {
+
+    }
+
+    //计算惠安报表汇总实时
+    public void calcHaBbHz(Date date) {
+        DateTime begin = DateUtil.beginOfDay(date);
+        DateTime yesterday = DateUtil.offsetDay(begin, -1);
+        //计算指标配置
+        QueryWrapper<ProBaseBackfill> fillWrapper = new QueryWrapper<>();
+        fillWrapper.lambda().eq(ProBaseBackfill::getPushTime, "12");
+        List<ProBaseBackfill> fills = proBaseBackfillService.list(fillWrapper);
+        Map<String, Map<String, Map<String, ProBaseBackfill>>> fillMapMap = fills.stream().collect(Collectors.groupingBy(ProBaseBackfill::getType,
+                Collectors.groupingBy(ProBaseBackfill::getTaskDescription, Collectors.toMap(ProBaseBackfill::getOperatingMode, Function.identity()))));
+        //指标保存表
+        QueryWrapper<ProEconEquipmentInfoJs> eijWrapper = new QueryWrapper<>();
+        eijWrapper.lambda().eq(ProEconEquipmentInfoJs::getRecordDate, yesterday);
+        List<ProEconEquipmentInfoJs> eijs = proEconEquipmentInfoJsService.list(eijWrapper);
+        Map<String, ProEconEquipmentInfoJs> eijMap = eijs.stream().collect(Collectors.toMap(ProEconEquipmentInfoJs::getMeterId, Function.identity()));
+        //风机日月发电量
+        Map<String, ProBaseBackfill> fillMapFdlR = fillMapMap.get("FDL").get("日");
+        Map<String, ProBaseBackfill> fillMapFdlY = fillMapMap.get("FDL").get("月");
+        Map<String, ProBaseBackfill> fillMapFdlN = fillMapMap.get("FDL").get("年");
+        Map<String, ProBaseBackfill> fillMapFdlR2 = fillMapMap.get("FDLFJ").get("日");
+        Map<String, ProBaseBackfill> fillMapFdlY2 = fillMapMap.get("FDLFJ").get("月");
+        Map<String, ProBaseBackfill> fillMapFdlN2 = fillMapMap.get("FDLFJ").get("年");
+        List<TurbineInfoDay> tidsR = turbineInfoDayService.getDatasByPartSelects(date, DatePart.DAY, "rfdl", TurbineInfoDay::getTurbineId);
+        for (TurbineInfoDay day : tidsR) {
+            String tbId = day.getTurbineId();
+            ProBaseBackfill fill = fillMapFdlR.get(tbId);
+            ProEconEquipmentInfoJs js = getPeeijs(fill, eijMap, yesterday);
+            js.setStopCode(day.getRfdl());
+        }
+        List<TurbineInfoDay> tidsY = turbineInfoDayService.getDatasByPartSelects(date, DatePart.MONTH, "rfdl", TurbineInfoDay::getTurbineId);
+        for (TurbineInfoDay day : tidsY) {
+            String tbId = day.getTurbineId();
+            ProBaseBackfill fill = fillMapFdlY.get(tbId);
+            ProEconEquipmentInfoJs js = getPeeijs(fill, eijMap, yesterday);
+            js.setStopCode(day.getRfdl());
+        }
+        //实际发电量	SJFDL,上网电量	SWDL,购网电量	GWDL,场用电量	CYDL,场用电率	CYDL,综合场用电量	ZHCYDL
+        //综合场用电率	ZHCYDL,平均风速	PJFS,定检维护电量	DJWHDL,故障损失电量	GZSSDL,计划发电量	JHFDL
+        //利用小时数	LYXSS,设备可利用率	SBKLYL,受累损失电量	SLSSDL,限电量	XDL,限电率	XDL
+        Map<String, ProBaseBackfill> fillMapR17 = fillMapMap.get("HDL").get("日");
+        Map<String, ProBaseBackfill> fillMapY01 = fillMapMap.get("SJFDL").get("月");
+        Map<String, ProBaseBackfill> fillMapY02 = fillMapMap.get("SWDL").get("月");
+        Map<String, ProBaseBackfill> fillMapY03 = fillMapMap.get("GWDL").get("月");
+        Map<String, ProBaseBackfill> fillMapY04 = fillMapMap.get("CYDL").get("月");
+        Map<String, ProBaseBackfill> fillMapY05 = fillMapMap.get("CYDLV").get("月");
+        Map<String, ProBaseBackfill> fillMapY06 = fillMapMap.get("ZHCYDL").get("月");
+        Map<String, ProBaseBackfill> fillMapY07 = fillMapMap.get("ZHCYDLV").get("月");
+        Map<String, ProBaseBackfill> fillMapY08 = fillMapMap.get("PJFS").get("月");
+        Map<String, ProBaseBackfill> fillMapY09 = fillMapMap.get("DJWHDL").get("月");
+        Map<String, ProBaseBackfill> fillMapY10 = fillMapMap.get("GZSSDL").get("月");
+        Map<String, ProBaseBackfill> fillMapY11 = fillMapMap.get("JHFDL").get("月");
+        Map<String, ProBaseBackfill> fillMapY12 = fillMapMap.get("LYXSS").get("月");
+        Map<String, ProBaseBackfill> fillMapY13 = fillMapMap.get("SBKLYL").get("月");
+        Map<String, ProBaseBackfill> fillMapY14 = fillMapMap.get("SLSSDL").get("月");
+        Map<String, ProBaseBackfill> fillMapY15 = fillMapMap.get("XDL").get("月");
+        Map<String, ProBaseBackfill> fillMapY16 = fillMapMap.get("XDLV").get("月");
+        Map<String, ProBaseBackfill> fillMapY17 = fillMapMap.get("HDL").get("月");
+        Map<String, ProBaseBackfill> fillMapN01 = fillMapMap.get("SJFDL").get("年");
+        Map<String, ProBaseBackfill> fillMapN02 = fillMapMap.get("SWDL").get("年");
+        Map<String, ProBaseBackfill> fillMapN03 = fillMapMap.get("GWDL").get("年");
+        Map<String, ProBaseBackfill> fillMapN04 = fillMapMap.get("CYDL").get("年");
+        Map<String, ProBaseBackfill> fillMapN05 = fillMapMap.get("CYDLV").get("年");
+        Map<String, ProBaseBackfill> fillMapN06 = fillMapMap.get("ZHCYDL").get("年");
+        Map<String, ProBaseBackfill> fillMapN07 = fillMapMap.get("ZHCYDLV").get("年");
+        Map<String, ProBaseBackfill> fillMapN08 = fillMapMap.get("PJFS").get("年");
+        Map<String, ProBaseBackfill> fillMapN09 = fillMapMap.get("DJWHDL").get("年");
+        Map<String, ProBaseBackfill> fillMapN10 = fillMapMap.get("GZSSDL").get("年");
+        Map<String, ProBaseBackfill> fillMapN11 = fillMapMap.get("JHFDL").get("年");
+        Map<String, ProBaseBackfill> fillMapN12 = fillMapMap.get("LYXSS").get("年");
+        Map<String, ProBaseBackfill> fillMapN13 = fillMapMap.get("SBKLYL").get("年");
+        Map<String, ProBaseBackfill> fillMapN14 = fillMapMap.get("SLSSDL").get("年");
+        Map<String, ProBaseBackfill> fillMapN15 = fillMapMap.get("XDL").get("年");
+        Map<String, ProBaseBackfill> fillMapN16 = fillMapMap.get("XDLV").get("年");
+        String select1 = SqlUtil.getSelectSum("swdl,gwdl,cydl,rfdl,hdl");
+        String select2 = SqlUtil.getSelectAvg("pjfs,klyl") + "," + SqlUtil.getSelectSum("gzss,xdss,lyxs");
+        String select3 = SqlUtil.getSelectSum("fdl,hdl");
+        String select4 = SqlUtil.getSelectSum("rfdl_fj");
+        //线路
+        List<LineInfoDay> lidsRXl = lineInfoDayService.getDatasByPartSelects(date, DatePart.DAY, select1, LineInfoDay::getLineId);
+        List<LineInfoDay> lidsYXl = lineInfoDayService.getDatasByPartSelects(date, DatePart.MONTH, select1, LineInfoDay::getLineId);
+        List<LineInfoDay> lidsYQc = lineInfoDayService.getDatasByPartSelects(date, DatePart.MONTH, select1, LineInfoDay::getProjectId);
+        List<LineInfoDay> lidsRCz = lineInfoDayService.getDatasByPartSelects(date, DatePart.DAY, select1, LineInfoDay::getStationId);
+        List<LineInfoDay> lidsYCz = lineInfoDayService.getDatasByPartSelects(date, DatePart.MONTH, select1, LineInfoDay::getStationId);
+        List<LineInfoDay> lidsNQc = lineInfoDayService.getDatasByPartSelects(date, DatePart.YEAR, select1, LineInfoDay::getProjectId);
+        List<LineInfoDay> lidsNCz = lineInfoDayService.getDatasByPartSelects(date, DatePart.YEAR, select1, LineInfoDay::getStationId);
+        //风机
+        List<TurbineInfoDay> tidsRXl = turbineInfoDayService.getDatasByPartSelects(date, DatePart.DAY, select2, TurbineInfoDay::getLineId);
+        List<TurbineInfoDay> tidsYXl = turbineInfoDayService.getDatasByPartSelects(date, DatePart.MONTH, select2, TurbineInfoDay::getLineId);
+        List<TurbineInfoDay> tidsYQc = turbineInfoDayService.getDatasByPartSelects(date, DatePart.MONTH, select2, TurbineInfoDay::getProjectId);
+        List<TurbineInfoDay> tidsYCz = turbineInfoDayService.getDatasByPartSelects(date, DatePart.MONTH, select2, TurbineInfoDay::getStationId);
+        List<TurbineInfoDay> tidsNQc = turbineInfoDayService.getDatasByPartSelects(date, DatePart.YEAR, select2, TurbineInfoDay::getProjectId);
+        List<TurbineInfoDay> tidsNCz = turbineInfoDayService.getDatasByPartSelects(date, DatePart.YEAR, select2, TurbineInfoDay::getStationId);
+        //场站
+        List<StationInfoDay> sidR = stationInfoDayService.getDatasByPartSelects(date, DatePart.DAY, select4, StationInfoDay::getStationId);
+        List<StationInfoDay> sidY = stationInfoDayService.getDatasByPartSelects(date, DatePart.MONTH, select4, StationInfoDay::getStationId);
+        List<StationInfoDay> sidN = stationInfoDayService.getDatasByPartSelects(date, DatePart.YEAR, select4, StationInfoDay::getStationId);
+        //电计量
+        List<MeterInfoDay> midsRMt = meterInfoDayService.getDatasByPartSelects(date, DatePart.DAY, select3, MeterInfoDay::getMeterId);
+        List<MeterInfoDay> midsYMt = meterInfoDayService.getDatasByPartSelects(date, DatePart.MONTH, select3, MeterInfoDay::getMeterId);
+        List<MeterInfoDay> midsRPrt = meterInfoDayService.getDatasByPartSelects(date, DatePart.DAY, select3, MeterInfoDay::getParentId);
+        List<MeterInfoDay> midsYPrt = meterInfoDayService.getDatasByPartSelects(date, DatePart.MONTH, select3, MeterInfoDay::getParentId);
+        //计划电量
+        List<ProBasicProjectPlan> plantsYQc = proBasicProjectPlanService.getDatasByPartSelect(date, DatePart.MONTH, "projectid");
+        List<ProBasicProjectPlan> plantsYCz = proBasicProjectPlanService.getDatasByPartSelect(date, DatePart.MONTH, "station");
+        List<ProBasicProjectPlan> plantsNQc = proBasicProjectPlanService.getDatasByPartSelect(date, DatePart.YEAR, "projectid");
+        List<ProBasicProjectPlan> plantsNCz = proBasicProjectPlanService.getDatasByPartSelect(date, DatePart.YEAR, "station");
+        //发电量日
+        lineCalcHz(midsRMt, fillMapFdlR, MeterInfoDay::getMeterId, MeterInfoDay::getFdl, eijMap, yesterday);
+        lineCalcHz(sidR, fillMapFdlR2, StationInfoDay::getStationId, StationInfoDay::getRfdlFj, eijMap, yesterday);
+        lineCalcHz(sidR, fillMapFdlR, StationInfoDay::getStationId, sid-> Double.valueOf(sid.getRfdl()), eijMap, yesterday);
+        lineCalcHz(lidsRXl, fillMapFdlR, LineInfoDay::getLineId, lid-> Double.valueOf(lid.getRfdl()), eijMap, yesterday);
+        lineCalcHz(tidsRXl, fillMapFdlR2, TurbineInfoDay::getLineId, TurbineInfoDay::getRfdl, eijMap, yesterday);
+        //发电量月
+        lineCalcHz(midsYMt, fillMapFdlY, MeterInfoDay::getMeterId, MeterInfoDay::getFdl, eijMap, yesterday);
+        lineCalcHz(sidY, fillMapFdlY2, StationInfoDay::getStationId, StationInfoDay::getRfdlFj, eijMap, yesterday);
+        lineCalcHz(sidY, fillMapFdlY, StationInfoDay::getStationId, sid-> Double.valueOf(sid.getRfdl()), eijMap, yesterday);
+        lineCalcHz(lidsYXl, fillMapFdlY, LineInfoDay::getLineId, lid-> Double.valueOf(lid.getRfdl()), eijMap, yesterday);
+        lineCalcHz(tidsYXl, fillMapFdlY2, TurbineInfoDay::getLineId, TurbineInfoDay::getRfdl, eijMap, yesterday);
+        //发电量年
+        lineCalcHz(sidN, fillMapFdlN2, StationInfoDay::getStationId, StationInfoDay::getRfdlFj, eijMap, yesterday);
+        lineCalcHz(sidN, fillMapFdlN, StationInfoDay::getStationId, sid-> Double.valueOf(sid.getRfdl()), eijMap, yesterday);
+        //耗电量日
+        lineCalcHz(midsRMt, fillMapR17, MeterInfoDay::getMeterId, MeterInfoDay::getHdl, eijMap, yesterday);
+        lineCalcHz(lidsRXl, fillMapR17, LineInfoDay::getLineId, LineInfoDay::getHdl, eijMap, yesterday);
+        lineCalcHz(lidsRCz, fillMapR17, LineInfoDay::getStationId, LineInfoDay::getHdl, eijMap, yesterday);
+        lineCalcHz(midsRPrt, fillMapR17, MeterInfoDay::getParentId, MeterInfoDay::getHdl, eijMap, yesterday);
+        //耗电量月
+        lineCalcHz(midsYMt, fillMapY17, MeterInfoDay::getMeterId, MeterInfoDay::getHdl, eijMap, yesterday);
+        lineCalcHz(lidsYXl, fillMapY17, LineInfoDay::getLineId, LineInfoDay::getHdl, eijMap, yesterday);
+        lineCalcHz(lidsYCz, fillMapY17, LineInfoDay::getStationId, LineInfoDay::getHdl, eijMap, yesterday);
+        lineCalcHz(midsYPrt, fillMapY17, MeterInfoDay::getParentId, MeterInfoDay::getHdl, eijMap, yesterday);
+        //期次月
+        lineCalcHz(lidsYQc, fillMapY01, LineInfoDay::getProjectId, lid -> Double.valueOf(lid.getRfdl()), eijMap, yesterday);
+        lineCalcHz(lidsYQc, fillMapY02, LineInfoDay::getProjectId, LineInfoDay::getSwdl, eijMap, yesterday);
+        lineCalcHz(lidsYQc, fillMapY03, LineInfoDay::getProjectId, LineInfoDay::getGwdl, eijMap, yesterday);
+        lineCalcHz(lidsYQc, fillMapY04, LineInfoDay::getProjectId, LineInfoDay::getCydl, eijMap, yesterday);
+        lineCalcHz(lidsYQc, fillMapY05, LineInfoDay::getProjectId, lid -> lid.getCydl() / lid.getRfdl() * 100, eijMap, yesterday);
+        lineCalcHz(lidsYQc, fillMapY06, LineInfoDay::getProjectId, lid -> lid.getRfdl() - lid.getSwdl() + lid.getGwdl(), eijMap, yesterday);
+        lineCalcHz(lidsYQc, fillMapY07, LineInfoDay::getProjectId, lid -> (lid.getRfdl() - lid.getSwdl() + lid.getGwdl()) / lid.getRfdl(), eijMap, yesterday);
+        lineCalcHz(tidsYQc, fillMapY08, TurbineInfoDay::getProjectId, TurbineInfoDay::getPjfs, eijMap, yesterday);
+        lineCalcHz(lidsYQc, fillMapY09, LineInfoDay::getProjectId, lid -> 0d, eijMap, yesterday);
+        lineCalcHz(tidsYQc, fillMapY10, TurbineInfoDay::getProjectId, TurbineInfoDay::getGzss, eijMap, yesterday);
+        lineCalcHz(plantsYQc, fillMapY11, ProBasicProjectPlan::getProjectId, pbpp -> pbpp.getGeneratingCapacity() / plantsYQc.size(), eijMap, yesterday);
+        lineCalcHz(tidsYQc, fillMapY12, TurbineInfoDay::getProjectId, TurbineInfoDay::getLyxs, eijMap, yesterday);
+        lineCalcHz(tidsYQc, fillMapY13, TurbineInfoDay::getProjectId, TurbineInfoDay::getKlyl, eijMap, yesterday);
+        lineCalcHz(lidsYQc, fillMapY14, LineInfoDay::getProjectId, lid -> 0d, eijMap, yesterday);
+        lineCalcHz(tidsYQc, fillMapY15, TurbineInfoDay::getProjectId, TurbineInfoDay::getXdss, eijMap, yesterday);
+        lineCalcHz(tidsYQc, fillMapY16, TurbineInfoDay::getProjectId, TurbineInfoDay::getXdss, eijMap, yesterday);
+        lineCalcHz2(lidsYQc, fillMapY16, LineInfoDay::getProjectId, lid -> Double.valueOf(lid.getRfdl()), eijMap, yesterday);
+        //期次年
+        lineCalcHz(lidsNQc, fillMapN01, LineInfoDay::getProjectId, lid -> Double.valueOf(lid.getRfdl()), eijMap, yesterday);
+        lineCalcHz(lidsNQc, fillMapN02, LineInfoDay::getProjectId, LineInfoDay::getSwdl, eijMap, yesterday);
+        lineCalcHz(lidsNQc, fillMapN03, LineInfoDay::getProjectId, LineInfoDay::getGwdl, eijMap, yesterday);
+        lineCalcHz(lidsNQc, fillMapN04, LineInfoDay::getProjectId, LineInfoDay::getCydl, eijMap, yesterday);
+        lineCalcHz(lidsNQc, fillMapN05, LineInfoDay::getProjectId, lid -> lid.getCydl() / lid.getRfdl() * 100, eijMap, yesterday);
+        lineCalcHz(lidsNQc, fillMapN06, LineInfoDay::getProjectId, lid -> lid.getRfdl() - lid.getSwdl() + lid.getGwdl(), eijMap, yesterday);
+        lineCalcHz(lidsNQc, fillMapN07, LineInfoDay::getProjectId, lid -> (lid.getRfdl() - lid.getSwdl() + lid.getGwdl()) / lid.getRfdl(), eijMap, yesterday);
+        lineCalcHz(tidsNQc, fillMapN08, TurbineInfoDay::getProjectId, TurbineInfoDay::getPjfs, eijMap, yesterday);
+        lineCalcHz(lidsNQc, fillMapN09, LineInfoDay::getProjectId, lid -> 0d, eijMap, yesterday);
+        lineCalcHz(tidsNQc, fillMapN10, TurbineInfoDay::getProjectId, TurbineInfoDay::getGzss, eijMap, yesterday);
+        lineCalcHz(plantsNQc, fillMapN11, ProBasicProjectPlan::getProjectId, pbpp -> pbpp.getGeneratingCapacity() / plantsNQc.size(), eijMap, yesterday);
+        lineCalcHz(tidsNQc, fillMapN12, TurbineInfoDay::getProjectId, TurbineInfoDay::getLyxs, eijMap, yesterday);
+        lineCalcHz(tidsNQc, fillMapN13, TurbineInfoDay::getProjectId, TurbineInfoDay::getKlyl, eijMap, yesterday);
+        lineCalcHz(lidsNQc, fillMapN14, LineInfoDay::getProjectId, lid -> 0d, eijMap, yesterday);
+        lineCalcHz(tidsNQc, fillMapN15, TurbineInfoDay::getProjectId, TurbineInfoDay::getXdss, eijMap, yesterday);
+        lineCalcHz(tidsNQc, fillMapN16, TurbineInfoDay::getProjectId, TurbineInfoDay::getXdss, eijMap, yesterday);
+        lineCalcHz2(lidsNQc, fillMapN16, LineInfoDay::getProjectId, lid -> Double.valueOf(lid.getRfdl()), eijMap, yesterday);
+        //场站月
+        lineCalcHz(lidsYCz, fillMapY01, LineInfoDay::getStationId, lid -> Double.valueOf(lid.getRfdl()), eijMap, yesterday);
+        lineCalcHz(lidsYCz, fillMapY02, LineInfoDay::getStationId, LineInfoDay::getSwdl, eijMap, yesterday);
+        lineCalcHz(lidsYCz, fillMapY03, LineInfoDay::getStationId, LineInfoDay::getGwdl, eijMap, yesterday);
+        lineCalcHz(lidsYCz, fillMapY04, LineInfoDay::getStationId, LineInfoDay::getCydl, eijMap, yesterday);
+        lineCalcHz(lidsYCz, fillMapY05, LineInfoDay::getStationId, lid -> lid.getCydl() / lid.getRfdl() * 100, eijMap, yesterday);
+        lineCalcHz(lidsYCz, fillMapY06, LineInfoDay::getStationId, lid -> lid.getRfdl() - lid.getSwdl() + lid.getGwdl(), eijMap, yesterday);
+        lineCalcHz(lidsYCz, fillMapY07, LineInfoDay::getStationId, lid -> (lid.getRfdl() - lid.getSwdl() + lid.getGwdl()) / lid.getRfdl(), eijMap, yesterday);
+        lineCalcHz(tidsYCz, fillMapY08, TurbineInfoDay::getStationId, TurbineInfoDay::getPjfs, eijMap, yesterday);
+        lineCalcHz(lidsYCz, fillMapY09, LineInfoDay::getStationId, lid -> 0d, eijMap, yesterday);
+        lineCalcHz(tidsYCz, fillMapY10, TurbineInfoDay::getStationId, TurbineInfoDay::getGzss, eijMap, yesterday);
+        lineCalcHz(plantsYCz, fillMapY11, ProBasicProjectPlan::getWindpowerstationId, pbpp -> pbpp.getGeneratingCapacity() / plantsYCz.size(), eijMap, yesterday);
+        lineCalcHz(tidsYCz, fillMapY12, TurbineInfoDay::getStationId, TurbineInfoDay::getLyxs, eijMap, yesterday);
+        lineCalcHz(tidsYCz, fillMapY13, TurbineInfoDay::getStationId, TurbineInfoDay::getKlyl, eijMap, yesterday);
+        lineCalcHz(lidsYCz, fillMapY14, LineInfoDay::getStationId, lid -> 0d, eijMap, yesterday);
+        lineCalcHz(tidsYCz, fillMapY15, TurbineInfoDay::getStationId, TurbineInfoDay::getXdss, eijMap, yesterday);
+        lineCalcHz(tidsYCz, fillMapY16, TurbineInfoDay::getStationId, TurbineInfoDay::getXdss, eijMap, yesterday);
+        lineCalcHz2(lidsYCz, fillMapY16, LineInfoDay::getStationId, lid -> Double.valueOf(lid.getRfdl()), eijMap, yesterday);
+        //场站年
+        lineCalcHz(lidsNCz, fillMapN01, LineInfoDay::getStationId, lid -> Double.valueOf(lid.getRfdl()), eijMap, yesterday);
+        lineCalcHz(lidsNCz, fillMapN02, LineInfoDay::getStationId, LineInfoDay::getSwdl, eijMap, yesterday);
+        lineCalcHz(lidsNCz, fillMapN03, LineInfoDay::getStationId, LineInfoDay::getGwdl, eijMap, yesterday);
+        lineCalcHz(lidsNCz, fillMapN04, LineInfoDay::getStationId, LineInfoDay::getCydl, eijMap, yesterday);
+        lineCalcHz(lidsNCz, fillMapN05, LineInfoDay::getStationId, lid -> lid.getCydl() / lid.getRfdl() * 100, eijMap, yesterday);
+        lineCalcHz(lidsNCz, fillMapN06, LineInfoDay::getStationId, lid -> lid.getRfdl() - lid.getSwdl() + lid.getGwdl(), eijMap, yesterday);
+        lineCalcHz(lidsNCz, fillMapN07, LineInfoDay::getStationId, lid -> (lid.getRfdl() - lid.getSwdl() + lid.getGwdl()) / lid.getRfdl(), eijMap, yesterday);
+        lineCalcHz(tidsNCz, fillMapN08, TurbineInfoDay::getStationId, TurbineInfoDay::getPjfs, eijMap, yesterday);
+        lineCalcHz(lidsNCz, fillMapN09, LineInfoDay::getStationId, lid -> 0d, eijMap, yesterday);
+        lineCalcHz(tidsNCz, fillMapN10, TurbineInfoDay::getStationId, TurbineInfoDay::getGzss, eijMap, yesterday);
+        lineCalcHz(plantsNCz, fillMapN11, ProBasicProjectPlan::getWindpowerstationId, pbpp -> pbpp.getGeneratingCapacity() / plantsNCz.size(), eijMap, yesterday);
+        lineCalcHz(tidsNCz, fillMapN12, TurbineInfoDay::getStationId, TurbineInfoDay::getLyxs, eijMap, yesterday);
+        lineCalcHz(tidsNCz, fillMapN13, TurbineInfoDay::getStationId, TurbineInfoDay::getKlyl, eijMap, yesterday);
+        lineCalcHz(lidsNCz, fillMapN14, LineInfoDay::getStationId, lid -> 0d, eijMap, yesterday);
+        lineCalcHz(tidsNCz, fillMapN15, TurbineInfoDay::getStationId, TurbineInfoDay::getXdss, eijMap, yesterday);
+        lineCalcHz(tidsNCz, fillMapN16, TurbineInfoDay::getStationId, TurbineInfoDay::getXdss, eijMap, yesterday);
+        lineCalcHz2(lidsNCz, fillMapN16, LineInfoDay::getStationId, lid -> Double.valueOf(lid.getRfdl()), eijMap, yesterday);
+
+    }
+
+    public <T> void lineCalcHz(List<T> items, Map<String, ProBaseBackfill> fillMap, Function<T, String> type, Function<T, Double> algorithm, Map<String, ProEconEquipmentInfoJs> eijMap, DateTime yesterday) {
+        for (T item : items) {
+            String id = type.apply(item);
+            ProBaseBackfill fill = fillMap.get(id);
+            if (fill == null) continue;
+            ProEconEquipmentInfoJs js = getPeeijs(fill, eijMap, yesterday);
+            js.setStopCode(algorithm.apply(item));
+        }
+    }
+
+    public <T> void lineCalcHz2(List<T> items, Map<String, ProBaseBackfill> fillMap, Function<T, String> type, Function<T, Double> algorithm, Map<String, ProEconEquipmentInfoJs> eijMap, DateTime yesterday) {
+        for (T item : items) {
+            String id = type.apply(item);
+            ProBaseBackfill fill = fillMap.get(id);
+            if (fill == null) continue;
+            ProEconEquipmentInfoJs js = getPeeijs(fill, eijMap, yesterday);
+            js.setStopCode(js.getStopCode() / algorithm.apply(item));
+        }
+    }
+
+    //    public void lineCalcHz(List<LineInfoDay> lids, Map<String, ProBaseBackfill> fillMap, Function<LineInfoDay, String> type, Function<LineInfoDay, Double> algorithm, Map<String, ProEconEquipmentInfoJs> eijMap, DateTime yesterday) {
+    //        for (LineInfoDay day : lids) {
+    //            String id = type.apply(day);
+    //            ProBaseBackfill fill = fillMap.get(id);
+    //            ProEconEquipmentInfoJs js = getPeeijs(fill, eijMap, yesterday);
+    //            js.setStopCode(algorithm.apply(day));
+    //        }
+    //    }
+
+    public ProEconEquipmentInfoJs getPeeijs(ProBaseBackfill fill, Map<String, ProEconEquipmentInfoJs> eijMap, DateTime day) {
+        ProEconEquipmentInfoJs js = eijMap.get(fill.getCode());
+        if (js == null) {
+            js = new ProEconEquipmentInfoJs();
+            js.setRecordDate(day);
+            js.setWpid(fill.getStation());
+            js.setMeterId(fill.getCode());
+            js.setMeterName(fill.getOperatingMode());
+            eijMap.put(fill.getCode(), js);
+        }
+        return js;
+    }
+    //    public void calcTurbineJfplPjfxGlyzxxs(Date date) {
+    //        //静风频率,平均风向、功率一致性系数
+    //        //date当天零点
+    //        DateTime time = DateUtil.beginOfDay(date);
+    //        //date昨天零点
+    //        DateTime time0 = DateUtil.offsetDay(time, -1);
+    //
+    //        List<PointInfo> entityFx = getEntity("AI066", "turbine");
+    //        getStatDataByEntity();
+    //        getZeroNextData(entity, time0, time);
+    //        Map<String, PointInfo> turMap = entity.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
+    //        Map<String, String> fsMap = getEntityMap("AI066", "turbine");
+    //
+    //        Map<String, TurbineInfoDay> byDate = getTurbineinfoMap(time0, entity);
+    //
+    //        TurbineInfoDay infoDay;
+    //        PointInfo rfdlPi;
+    //        String turbineId;
+    //        List<TurbineInfoDay> infoDays = new ArrayList<>();
+    //        DoubleStatData stat;
+    //        for (PointInfo info : entity) {
+    //            turbineId = info.getTurbineId();
+    //            infoDay = byDate.get(turbineId);
+    //
+    //            rfdlPi = turMap.get(turbineId);
+    //            double v = (rfdlPi.getPointDatas().get(1).getValue() - rfdlPi.getPointDatas().get(0).getValue()) * rfdlPi.getCoef();
+    //            if (v < 0 || v > 1000000) {
+    //                v = 0;
+    //            } else if (v > 30000) {
+    //                v = v / (v % 30000 + 3);
+    //            }
+    //            infoDay.setRfdl(v);
+    //            stat = adapter.getHistoryStat(goldenUri(), fsMap.get(turbineId), time0.getTime(), time.getTime());
+    //            if (stat == null) {
+    //                infoDay.setPjfs(0.0);
+    //            } else {
+    //                infoDay.setPjfs(stat.getAvg().getValue());
+    //            }
+    //
+    //            infoDays.add(infoDay);
+    //        }
+    //        turbineInfoDayService.saveOrUpdateBatch(infoDays);
+    //    }
 }

+ 9 - 3
ruoyi-admin/src/main/resources/application.yml

@@ -10,7 +10,7 @@ ruoyi:
   demoEnabled: true
   # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
 #  profile: /home/ruoyi
-  profile: D:/ruoyi/
+  profile: C:/ruoyi/
   # 获取ip地址开关
   addressEnabled: false
   # 验证码类型 math 数组计算 char 字符验证
@@ -57,12 +57,18 @@ spring:
   mvc:
     pathmatch:
       matching-strategy: ant-path-matcher
+#    static-path-pattern: /**
+  web:
+    resources:
+      static-locations: classpath:/static-bd/
+#  resource:
+#    static-locations: classpath:/static-bd/
   # 资源信息
   messages:
     # 国际化资源文件路径
     basename: i18n/messages
   profiles:
-    active: druid
+    active: druid3
   # 文件上传
   servlet:
     multipart:
@@ -110,7 +116,7 @@ token:
   # 令牌密钥
   secret: abcdefghijklmnopqrstuvwxyz
   # 令牌有效期(默认30分钟)
-  expireTime: 60
+  expireTime: 36000
 
 # MyBatis配置
 #mybatis:

+ 82 - 36
ruoyi-admin/src/test/java/com/ruoyi/NewTests.java

@@ -4,26 +4,26 @@ import cn.hutool.core.date.DateField;
 import cn.hutool.core.date.DateRange;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.text.StrBuilder;
 import cn.hutool.core.thread.ThreadUtil;
-import cn.hutool.core.util.NumberUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.ruoyi.ucp.entity.*;
-import com.ruoyi.ucp.feign.AdapterApi;
-import com.ruoyi.ucp.service.*;
-import com.ruoyi.ucp.util.CalcCache;
+import com.baomidou.mybatisplus.core.toolkit.LambdaUtils;
+import com.baomidou.mybatisplus.core.toolkit.support.LambdaMeta;
+import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
+import com.ruoyi.ucp.entity.StationInfoMin;
+import com.ruoyi.ucp.entity.TurbineInfoDay;
+import com.ruoyi.ucp.service.IStationInfoMinService;
 import com.ruoyi.web.controller.JavaFunctionJobHandler;
+import org.apache.ibatis.reflection.property.PropertyNamer;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import javax.annotation.Resource;
-import java.net.URI;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.function.Function;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 @SpringBootTest//classes = RuoYiApp.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT
@@ -139,10 +139,6 @@ public class NewTests {
 //        writeReportPool(date);
 
 //        task.calcStationSspjfs();
-        /*while (true) {
-            task.calcRealtimeTurbineZt();
-            ThreadUtil.sleep(1000);
-        }*/
 //        task.calcRealtimeTurbineZt();
     }
 
@@ -186,6 +182,19 @@ public class NewTests {
         }
     }
 
+    public static void main(String[] args) {
+        QueryWrapper<TurbineInfoDay> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().select(TurbineInfoDay::getRecordDate);
+        System.out.println();
+    }
+
+    private static void aadd(SFunction<TurbineInfoDay,String> a) {
+        LambdaMeta meta = LambdaUtils.extract(a);
+        String fieldName = PropertyNamer.methodToProperty(meta.getImplMethodName());
+        String string = a.toString();
+        System.out.println(a);
+    }
+
     @Test
     public void test4() {
 //        while (true){
@@ -204,7 +213,7 @@ public class NewTests {
         stIds.add("GJNY_SXGS_LJS_FDC_STA");
         for (DateTime date : range) {
 //            task.calcTurbineStateMin(date);
-            task.predictExaminBc(stIds,date);
+            task.predictExaminBc(stIds, date);
         }
 //        task.calcGlqxnhSurplus(start, end);
 
@@ -223,28 +232,16 @@ public class NewTests {
         task.calcTurbineStateMin(date);
         task.writeReportPool5SPjfsLlfdlZtsj(date);
         //风机日切入
-        task.cutInWindSpeed();
+        task.cutInWindSpeed(date);
         //风机日额定风速
-        task.calcGlqxnh_edfs();
+        task.calcGlqxnh_edfs(date);
         task.calcPredictExamin2(date);
     }
 
-    public static void main(String[] args) {
-        long value1 = 10L;
-        long value2 = 3L;
-
-        double result = (double) value1 / value2;
-        System.out.println();
-    }
-
     @Test
     public void test6() {
-        DateTime begin = DateUtil.parse("2024-12-04 00:00:00");
-        DateTime end = DateUtil.parse("2024-12-05 00:00:00");
-//        DateTime date = DateUtil.date();
-//        DateTime begin = DateUtil.beginOfDay(date);
-//        begin = DateUtil.offsetMinute(begin, 15);
-//        DateTime end = date;
+        DateTime begin = DateUtil.parse("2024-09-20 19:00:00");
+        DateTime end = DateUtil.parse("2024-12-25 09:00:00");
         DateTime minEnd = begin;
         while (minEnd.isBefore(end)) {
             minEnd = DateUtil.offsetMinute(begin, 15);
@@ -254,6 +251,7 @@ public class NewTests {
             begin = minEnd;
         }
     }
+
     @Test
     public void test7() {
         DateTime begin = DateUtil.parse("2024-01-01");
@@ -267,8 +265,8 @@ public class NewTests {
         stIds.add("GJNY_SXGS_ZZ_FDC_STA");
         stIds.add("GJNY_SXGS_XZ_FDC_STA");
         stIds.add("GJNY_SXGS_LJS_FDC_STA");
-        QueryWrapper<StationInfoMin> wrapper=new QueryWrapper<>();
-        wrapper.lambda().between(StationInfoMin::getRecordDate,begin,end);
+        QueryWrapper<StationInfoMin> wrapper = new QueryWrapper<>();
+        wrapper.lambda().between(StationInfoMin::getRecordDate, begin, end);
         List<StationInfoMin> list = stationInfoMinService.list(wrapper);
         Map<String, List<StationInfoMin>> collect = list.stream().collect(Collectors.groupingBy(m -> DateUtil.date(m.getRecordDate()).toString()));
         while (minEnd.isBefore(end)) {
@@ -279,6 +277,7 @@ public class NewTests {
             minBegin = minEnd;
         }
     }
+
     @Test
     public void test8() {
         DateTime begin = DateUtil.parse("2024-11-05 14:30:00");
@@ -292,8 +291,8 @@ public class NewTests {
         stIds.add("GJNY_SXGS_ZZ_FDC_STA");
         stIds.add("GJNY_SXGS_XZ_FDC_STA");
         stIds.add("GJNY_SXGS_LJS_FDC_STA");
-        QueryWrapper<StationInfoMin> wrapper=new QueryWrapper<>();
-        wrapper.lambda().between(StationInfoMin::getRecordDate,begin,end);
+        QueryWrapper<StationInfoMin> wrapper = new QueryWrapper<>();
+        wrapper.lambda().between(StationInfoMin::getRecordDate, begin, end);
         List<StationInfoMin> list = stationInfoMinService.list(wrapper);
         Map<String, List<StationInfoMin>> collect = list.stream().collect(Collectors.groupingBy(m -> DateUtil.date(m.getRecordDate()).toString()));
         while (minEnd.isBefore(end)) {
@@ -304,4 +303,51 @@ public class NewTests {
             minBegin = minEnd;
         }
     }
+
+    @Test
+    public void test9() {
+        DateTime date = DateUtil.date();
+        task.calcLineRfdlSameDay();
+        task.calcStationSwGwCyDlSameDay();
+        task.calcStationZhcyRfDlSameDay();
+        task.calcLineSwGWCyDlSameDay();
+    }
+
+    @Test
+    public void test10() {
+//        DateTime date = DateUtil.date();
+        // 创建日期范围生成器
+        DateTime start = DateUtil.parse("2024-12-12");
+        DateTime end = DateUtil.parse("2024-12-25");
+        DateRange range = DateUtil.range(start, end, DateField.DAY_OF_YEAR);
+        for (DateTime date : range) {
+            System.out.println(DateUtil.date() + ":" + date);
+            task.calcTurbineRFDL_ha(date);
+            task.calcLineRfdl_ha(date);
+            //上网购网厂用电量
+            task.calcStationSwGwCyRdl_ha(date);
+            //计算综合厂用电量
+            task.calcStationZhcyRfDl(date);
+            //风机日环境温度
+            task.ambientTemperature();
+            //计算日发电量--风机汇总方式
+            task.calcStationRfdlFj(date);
+            task.calcLineSwGWCyDl(date);
+            task.calcTurbine5s2(date);
+            //风机状态时间
+            task.calcTurbineStateMin(date);
+            //风机日切入
+            task.cutInWindSpeed(date);
+            //风机日额定风速
+            task.calcGlqxnh_edfs(date);
+        }
+    }
+
+    @Test
+    public void test11() {
+        while (true) {
+            task.calcRealtimeTurbineZt();
+            ThreadUtil.sleep(1000);
+        }
+    }
 }

+ 1 - 2
ruoyi-quartz/src/main/java/com/ruoyi/quartz/service/impl/SysJobServiceImpl.java

@@ -15,7 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import javax.annotation.PostConstruct;
 import java.util.List;
 
 /**
@@ -34,7 +33,7 @@ public class SysJobServiceImpl implements ISysJobService {
     /**
      * 项目启动时,初始化定时器 主要是防止手动修改数据库导致未同步到定时任务处理(注:不能手动修改数据库ID和任务组名,否则会导致脏数据)
      */
-    @PostConstruct
+//    @PostConstruct
     public void init() throws SchedulerException, TaskException {
         scheduler.clear();
         List<SysJob> jobList = jobMapper.selectJobAll();

+ 1 - 1
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzDisallowConcurrentExecution.java

@@ -13,6 +13,6 @@ import org.quartz.JobExecutionContext;
 public class QuartzDisallowConcurrentExecution extends AbstractQuartzJob {
     @Override
     protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception {
-        JobInvokeUtil.invokeMethod2(sysJob);
+//        JobInvokeUtil.invokeMethod2(sysJob);
     }
 }

+ 1 - 1
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzJobExecution.java

@@ -11,6 +11,6 @@ import org.quartz.JobExecutionContext;
 public class QuartzJobExecution extends AbstractQuartzJob {
     @Override
     protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception {
-        JobInvokeUtil.invokeMethod2(sysJob);
+//        JobInvokeUtil.invokeMethod2(sysJob);
     }
 }

+ 1 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/LineInfoDay.java

@@ -38,5 +38,6 @@ public class LineInfoDay implements Serializable {
     private double  gwdl;
     private double  cydl;
     private double  zyb;
+    private double  hdl;
 
 }

+ 56 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/MeterInfoDay.java

@@ -0,0 +1,56 @@
+package com.ruoyi.ucp.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-12-19
+ */
+@Data
+@TableName("meter_info_day")
+public class MeterInfoDay implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    /**
+     * 场站
+     */
+    private String meterId;
+
+    private String parentId;
+
+    private String stationId;
+
+    private String boosterId;
+
+    /**
+     * 时间
+     */
+    private Date recordDate;
+
+    /**
+     * 发电量
+     */
+    private Double fdl;
+
+    /**
+     * 耗电量
+     */
+    private Double hdl;
+}

+ 137 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/ProBaseBackfill.java

@@ -0,0 +1,137 @@
+package com.ruoyi.ucp.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 报表回填
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-12-24
+ */
+@TableName("pro_base_backfill")
+public class ProBaseBackfill implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    private String id;
+
+    /**
+     * 测点
+     */
+    private String code;
+
+    /**
+     * 场站
+     */
+    private String station;
+
+    /**
+     * 推送/自建
+     */
+    private String type;
+
+    /**
+     * 定时推送
+     */
+    private Boolean scheduledPush;
+
+    /**
+     * 推送时间
+     */
+    private String pushTime;
+
+    /**
+     * 任务描述
+     */
+    private String taskDescription;
+
+    /**
+     * 运行模式
+     */
+    private String operatingMode;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getStation() {
+        return station;
+    }
+
+    public void setStation(String station) {
+        this.station = station;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public Boolean getScheduledPush() {
+        return scheduledPush;
+    }
+
+    public void setScheduledPush(Boolean scheduledPush) {
+        this.scheduledPush = scheduledPush;
+    }
+
+    public String getPushTime() {
+        return pushTime;
+    }
+
+    public void setPushTime(String pushTime) {
+        this.pushTime = pushTime;
+    }
+
+    public String getTaskDescription() {
+        return taskDescription;
+    }
+
+    public void setTaskDescription(String taskDescription) {
+        this.taskDescription = taskDescription;
+    }
+
+    public String getOperatingMode() {
+        return operatingMode;
+    }
+
+    public void setOperatingMode(String operatingMode) {
+        this.operatingMode = operatingMode;
+    }
+
+    @Override
+    public String toString() {
+        return "ProBaseBackfill{" +
+            "id = " + id +
+            ", code = " + code +
+            ", station = " + station +
+            ", type = " + type +
+            ", scheduledPush = " + scheduledPush +
+            ", pushTime = " + pushTime +
+            ", taskDescription = " + taskDescription +
+            ", operatingMode = " + operatingMode +
+        "}";
+    }
+}

+ 65 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/ProEconEquipmentInfoJs.java

@@ -0,0 +1,65 @@
+package com.ruoyi.ucp.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * 计算测点
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-12-24
+ */
+@Data
+@TableName("pro_econ_equipment_info_js")
+public class ProEconEquipmentInfoJs implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    @TableId(type=IdType.ASSIGN_ID)
+    private String id;
+
+    /**
+     * 日期
+     */
+    private Date recordDate;
+
+    /**
+     * 风场编号
+     */
+    private String wpid;
+
+    /**
+     * 测点
+     */
+    private String meterId;
+
+    /**
+     * 测点描述
+     */
+    private String meterName;
+
+    /**
+     * 测点数值
+     */
+    private Double stopCode;
+
+    /**
+     * 参考值
+     */
+    private Double stopCodeModify;
+
+    /**
+     * 回填测点
+     */
+    private String backCode;
+}

+ 12 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/StationInfoDay.java

@@ -48,4 +48,16 @@ public class StationInfoDay implements Serializable {
     private Integer zyb;
 
     private Double jhfdl;
+
+    private Double yxfss;
+
+    private Double cftfs;
+
+    private Double cftfx;
+
+    private Double kydlzql;
+
+    private Double qfxdl;
+
+    private Double kqmd;
 }

+ 8 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/TurbineInfoDay.java

@@ -56,4 +56,12 @@ public class TurbineInfoDay implements Serializable {
     private Long jxcs;
     private Long xdcs;
     private Long lxcs;
+    private Double jfpl;
+    private Double glyzxxs;
+    private Double fx;
+    private Double yxfss;
+    private Double lyxs;
+    private Double klyl;
+    private Double fnlyl;
+    private Double bll;
 }

+ 20 - 6
universal-computing-platform/src/main/java/com/ruoyi/ucp/feign/AdapterApi.java

@@ -17,8 +17,12 @@ public interface AdapterApi {
     @GetMapping("/latest2")
     List<PointData> getLatest2(URI baseUri, @RequestParam("keys") String keys);
 
-    @GetMapping("/latest")
-    Map<String, PointData> getLatest(URI baseUri, @RequestParam("keys") String keys);
+//    @GetMapping("/latest")
+//    Map<String, PointData> getLatest(URI baseUri, @RequestParam("keys") String keys);
+
+    @PostMapping("/latests")
+//    @Headers("Content-Type: application/json; charset=UTF-8")
+    Map<String, PointData> getLatest(URI baseUri, @RequestBody String keys);
 
     @GetMapping("/history/snap")
     List<PointData> getHistorySnap(URI baseUri, @RequestParam("tagName") String tagName,
@@ -43,17 +47,27 @@ public interface AdapterApi {
                                          @RequestParam("endTs") long endTs,
                                          @RequestParam("interval") int interval);
 
-    @GetMapping("/history/section")
-    Map<String, PointData> getHistorySection(URI baseUri, @RequestParam("tagNames") String tagNames,
+//    @GetMapping("/history/section")
+//    Map<String, PointData> getHistorySection(URI baseUri, @RequestParam("tagNames") String tagNames,
+//                                             @RequestParam("ts") long ts);
+
+    @PostMapping("/history/section")
+    Map<String, PointData> getHistorySection(URI baseUri, @RequestBody String tagNames,
                                              @RequestParam("ts") long ts);
 
     @GetMapping("/history/section2")
     List<PointData> getHistorySection2(URI baseUri, @RequestParam("tagName") String tagName,
                                        @RequestParam("ts") long ts);
 
-    @PostMapping("/latest2")
+//    @PostMapping("/latest2")
+//    Boolean writeHistory(URI baseUri, @RequestBody PointData tsData);
+//
+//    @PostMapping("/latest2/batch")
+//    Boolean writeHistoryBatch(URI baseUri, @RequestBody List<PointData> tsData);
+
+    @PostMapping("/save")
     Boolean writeHistory(URI baseUri, @RequestBody PointData tsData);
 
-    @PostMapping("/latest2/batch")
+    @PostMapping("/save/batch")
     Boolean writeHistoryBatch(URI baseUri, @RequestBody List<PointData> tsData);
 }

+ 16 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/mapper/MeterInfoDayMapper.java

@@ -0,0 +1,16 @@
+package com.ruoyi.ucp.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.ucp.entity.MeterInfoDay;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-12-19
+ */
+public interface MeterInfoDayMapper extends BaseMapper<MeterInfoDay> {
+
+}

+ 16 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/mapper/ProBaseBackfillMapper.java

@@ -0,0 +1,16 @@
+package com.ruoyi.ucp.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.ucp.entity.ProBaseBackfill;
+
+/**
+ * <p>
+ * 报表回填 Mapper 接口
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-12-24
+ */
+public interface ProBaseBackfillMapper extends BaseMapper<ProBaseBackfill> {
+
+}

+ 16 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/mapper/ProEconEquipmentInfoJsMapper.java

@@ -0,0 +1,16 @@
+package com.ruoyi.ucp.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.ucp.entity.ProEconEquipmentInfoJs;
+
+/**
+ * <p>
+ * 计算测点 Mapper 接口
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-12-24
+ */
+public interface ProEconEquipmentInfoJsMapper extends BaseMapper<ProEconEquipmentInfoJs> {
+
+}

+ 7 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/ILineInfoDayService.java

@@ -1,9 +1,13 @@
 package com.ruoyi.ucp.service;
 
+import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ruoyi.ucp.entity.LineInfoDay;
 import com.ruoyi.ucp.entity.PointInfo;
+import com.ruoyi.ucp.util.DatePart;
 
+import java.util.Date;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -17,4 +21,7 @@ import java.util.Map;
 public interface ILineInfoDayService extends IService<LineInfoDay> {
 
     public Map<String, LineInfoDay> getByEntity(PointInfo pointInfo);
+
+    Map<String, LineInfoDay> getDatasByPartSelect(Date date, DatePart datePart, String selects, SFunction<LineInfoDay,String> groupId);
+    List<LineInfoDay> getDatasByPartSelects(Date date, DatePart datePart, String selects, SFunction<LineInfoDay,String>... groupIds);
 }

+ 23 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/IMeterInfoDayService.java

@@ -0,0 +1,23 @@
+package com.ruoyi.ucp.service;
+
+import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.ucp.entity.MeterInfoDay;
+import com.ruoyi.ucp.util.DatePart;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-12-19
+ */
+public interface IMeterInfoDayService extends IService<MeterInfoDay> {
+
+
+    List<MeterInfoDay> getDatasByPartSelects(Date date, DatePart datePart, String selects, SFunction<MeterInfoDay,String>... groupIds);
+}

+ 16 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/IProBaseBackfillService.java

@@ -0,0 +1,16 @@
+package com.ruoyi.ucp.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.ucp.entity.ProBaseBackfill;
+
+/**
+ * <p>
+ * 报表回填 服务类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-12-24
+ */
+public interface IProBaseBackfillService extends IService<ProBaseBackfill> {
+
+}

+ 6 - 1
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/IProBasicProjectPlanService.java

@@ -1,7 +1,11 @@
 package com.ruoyi.ucp.service;
 
-import com.ruoyi.ucp.entity.ProBasicProjectPlan;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.ucp.entity.ProBasicProjectPlan;
+import com.ruoyi.ucp.util.DatePart;
+
+import java.util.Date;
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +17,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IProBasicProjectPlanService extends IService<ProBasicProjectPlan> {
 
+    List<ProBasicProjectPlan> getDatasByPartSelect(Date date, DatePart datePart, String groupId);
 }

+ 16 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/IProEconEquipmentInfoJsService.java

@@ -0,0 +1,16 @@
+package com.ruoyi.ucp.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.ucp.entity.ProEconEquipmentInfoJs;
+
+/**
+ * <p>
+ * 计算测点 服务类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-12-24
+ */
+public interface IProEconEquipmentInfoJsService extends IService<ProEconEquipmentInfoJs> {
+
+}

+ 6 - 2
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/IStationInfoDayService.java

@@ -1,9 +1,12 @@
 package com.ruoyi.ucp.service;
 
+import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.ruoyi.ucp.entity.PointInfo;
 import com.ruoyi.ucp.entity.StationInfoDay;
+import com.ruoyi.ucp.util.DatePart;
 
+import java.util.Date;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -15,5 +18,6 @@ import java.util.Map;
  * @since 2024-03-05
  */
 public interface IStationInfoDayService extends IService<StationInfoDay> {
-    Map<String, StationInfoDay> getByEntity(PointInfo pointInfo);
+    Map<String, StationInfoDay> getDatasByPartSelect(Date date, DatePart datePart, String selects, SFunction<StationInfoDay,String> groupId);
+    List<StationInfoDay> getDatasByPartSelects(Date date, DatePart datePart, String selects, SFunction<StationInfoDay,String> groupId);
 }

+ 8 - 1
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/ITurbineInfoDayService.java

@@ -1,7 +1,13 @@
 package com.ruoyi.ucp.service;
 
+import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ruoyi.ucp.entity.TurbineInfoDay;
+import com.ruoyi.ucp.util.DatePart;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -12,5 +18,6 @@ import com.ruoyi.ucp.entity.TurbineInfoDay;
  * @since 2024-05-29
  */
 public interface ITurbineInfoDayService extends IService<TurbineInfoDay> {
-
+    List<TurbineInfoDay> getDatasByPartSelects(Date date, DatePart datePart, String selects, SFunction<TurbineInfoDay,String>... groupIds);
+    Map<String, TurbineInfoDay> getDatasByPartSelect(Date date, DatePart datePart, String selects, SFunction<TurbineInfoDay,String> groupId);
 }

+ 26 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/LineInfoDayServiceImpl.java

@@ -1,7 +1,10 @@
 package com.ruoyi.ucp.service.impl;
 
+import cn.hutool.core.date.DateTime;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.annotation.DataSource;
 import com.ruoyi.common.enums.DataSourceType;
@@ -9,9 +12,12 @@ import com.ruoyi.ucp.entity.LineInfoDay;
 import com.ruoyi.ucp.entity.PointInfo;
 import com.ruoyi.ucp.mapper.LineInfoDayMapper;
 import com.ruoyi.ucp.service.ILineInfoDayService;
+import com.ruoyi.ucp.util.DatePart;
+import com.ruoyi.ucp.util.SqlUtil;
 import org.springframework.stereotype.Service;
 
 import java.util.Collection;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.function.Function;
@@ -64,4 +70,24 @@ public class LineInfoDayServiceImpl extends ServiceImpl<LineInfoDayMapper, LineI
     public List<LineInfoDay> list(Wrapper<LineInfoDay> queryWrapper) {
         return super.list(queryWrapper);
     }
+
+    public Map<String, LineInfoDay> getDatasByPartSelect(Date date, DatePart datePart, String selects, SFunction<LineInfoDay,String> groupId) {
+        DateTime[] beginEnd = SqlUtil.getBeginEnd(date, datePart);
+        QueryWrapper<LineInfoDay> wrapper = new QueryWrapper<>();
+        wrapper.select(selects);
+        wrapper.lambda().between(LineInfoDay::getRecordDate, beginEnd[0], beginEnd[1])
+                .select(groupId).groupBy(groupId);
+        List<LineInfoDay> days = baseMapper.selectList(wrapper);
+        return days.stream().collect(Collectors.toMap(groupId, Function.identity()));
+    }
+    public List<LineInfoDay> getDatasByPartSelects(Date date, DatePart datePart, String selects, SFunction<LineInfoDay,String>... groupIds) {
+        DateTime[] beginEnd = SqlUtil.getBeginEnd(date, datePart);
+        QueryWrapper<LineInfoDay> wrapper = new QueryWrapper<>();
+        wrapper.select(selects);
+        for (SFunction<LineInfoDay, String> groupId : groupIds) {
+            wrapper.lambda().select(groupId).groupBy(groupId);
+        }
+        wrapper.lambda().between(LineInfoDay::getRecordDate, beginEnd[0], beginEnd[1]);
+        return baseMapper.selectList(wrapper);
+    }
 }

+ 43 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/MeterInfoDayServiceImpl.java

@@ -0,0 +1,43 @@
+package com.ruoyi.ucp.service.impl;
+
+import cn.hutool.core.date.DateTime;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.ucp.entity.MeterInfoDay;
+import com.ruoyi.ucp.mapper.MeterInfoDayMapper;
+import com.ruoyi.ucp.service.IMeterInfoDayService;
+import com.ruoyi.ucp.util.DatePart;
+import com.ruoyi.ucp.util.SqlUtil;
+import org.springframework.stereotype.Service;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-12-19
+ */
+@Service
+public class MeterInfoDayServiceImpl extends ServiceImpl<MeterInfoDayMapper, MeterInfoDay> implements IMeterInfoDayService {
+    @Override
+    public boolean saveOrUpdateBatch(Collection<MeterInfoDay> entityList) {
+        return super.saveOrUpdateBatch(entityList);
+    }
+
+    public List<MeterInfoDay> getDatasByPartSelects(Date date, DatePart datePart, String selects, SFunction<MeterInfoDay,String>... groupIds) {
+        DateTime[] beginEnd = SqlUtil.getBeginEnd(date, datePart);
+        QueryWrapper<MeterInfoDay> wrapper = new QueryWrapper<>();
+        wrapper.select(selects);
+        for (SFunction<MeterInfoDay, String> groupId : groupIds) {
+            wrapper.lambda().select(groupId).groupBy(groupId);
+        }
+        wrapper.lambda().between(MeterInfoDay::getRecordDate, beginEnd[0], beginEnd[1]);
+        return baseMapper.selectList(wrapper);
+    }
+}

+ 20 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/ProBaseBackfillServiceImpl.java

@@ -0,0 +1,20 @@
+package com.ruoyi.ucp.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.ucp.entity.ProBaseBackfill;
+import com.ruoyi.ucp.mapper.ProBaseBackfillMapper;
+import com.ruoyi.ucp.service.IProBaseBackfillService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 报表回填 服务实现类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-12-24
+ */
+@Service
+public class ProBaseBackfillServiceImpl extends ServiceImpl<ProBaseBackfillMapper, ProBaseBackfill> implements IProBaseBackfillService {
+
+}

+ 30 - 2
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/ProBasicProjectPlanServiceImpl.java

@@ -1,15 +1,19 @@
 package com.ruoyi.ucp.service.impl;
 
-import com.baomidou.dynamic.datasource.annotation.DS;
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.annotation.DataSource;
 import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.ucp.entity.ProBasicProjectPlan;
 import com.ruoyi.ucp.mapper.ProBasicProjectPlanMapper;
 import com.ruoyi.ucp.service.IProBasicProjectPlanService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.ucp.util.DatePart;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -32,4 +36,28 @@ public class ProBasicProjectPlanServiceImpl extends ServiceImpl<ProBasicProjectP
     public List<ProBasicProjectPlan> list() {
         return super.list();
     }
+
+    @Override
+    public List<ProBasicProjectPlan> getDatasByPartSelect(Date date, DatePart datePart, String groupId) {
+        DateTime begin = DateUtil.beginOfDay(date);
+        QueryWrapper<ProBasicProjectPlan> wrapperPlan = new QueryWrapper<>();
+        wrapperPlan.select("sum(generating_capacity) generating_capacity,"+groupId).groupBy(groupId)
+                .eq("year", String.valueOf(begin.year()));
+        switch (groupId){
+            case "station":
+                wrapperPlan.likeRight("project_id","_EG");
+                break;
+            case "project":
+                wrapperPlan.likeRight("project_id","_STA");
+                break;
+        }
+        switch (datePart){
+            case MONTH:
+                wrapperPlan.eq("month", String.valueOf(begin.month() + 1));
+                break;
+            case YEAR:
+                break;
+        }
+        return baseMapper.selectList(wrapperPlan);
+    }
 }

+ 20 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/ProEconEquipmentInfoJsServiceImpl.java

@@ -0,0 +1,20 @@
+package com.ruoyi.ucp.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.ucp.entity.ProEconEquipmentInfoJs;
+import com.ruoyi.ucp.mapper.ProEconEquipmentInfoJsMapper;
+import com.ruoyi.ucp.service.IProEconEquipmentInfoJsService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 计算测点 服务实现类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-12-24
+ */
+@Service
+public class ProEconEquipmentInfoJsServiceImpl extends ServiceImpl<ProEconEquipmentInfoJsMapper, ProEconEquipmentInfoJs> implements IProEconEquipmentInfoJsService {
+
+}

+ 23 - 1
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/StationInfoDayServiceImpl.java

@@ -1,7 +1,10 @@
 package com.ruoyi.ucp.service.impl;
 
+import cn.hutool.core.date.DateTime;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.annotation.DataSource;
 import com.ruoyi.common.enums.DataSourceType;
@@ -9,10 +12,13 @@ import com.ruoyi.ucp.entity.PointInfo;
 import com.ruoyi.ucp.entity.StationInfoDay;
 import com.ruoyi.ucp.mapper.StationInfoDayMapper;
 import com.ruoyi.ucp.service.IStationInfoDayService;
+import com.ruoyi.ucp.util.DatePart;
+import com.ruoyi.ucp.util.SqlUtil;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Collection;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.function.Function;
@@ -30,7 +36,6 @@ import java.util.stream.Collectors;
 @DataSource(DataSourceType.SLAVE)
 public class StationInfoDayServiceImpl extends ServiceImpl<StationInfoDayMapper, StationInfoDay> implements IStationInfoDayService {
 
-    @Override
     public Map<String, StationInfoDay> getByEntity(PointInfo pointInfo) {
         LambdaQueryWrapper<StationInfoDay> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(pointInfo.getStationId() != null, StationInfoDay::getStationId, pointInfo.getStationId());
@@ -55,4 +60,21 @@ public class StationInfoDayServiceImpl extends ServiceImpl<StationInfoDayMapper,
     public List<StationInfoDay> list(Wrapper<StationInfoDay> queryWrapper) {
         return super.list(queryWrapper);
     }
+
+    public Map<String, StationInfoDay> getDatasByPartSelect(Date date, DatePart datePart, String selects, SFunction<StationInfoDay,String> groupId) {
+        DateTime[] beginEnd = SqlUtil.getBeginEnd(date, datePart);
+        QueryWrapper<StationInfoDay> wrapper = new QueryWrapper<>();
+        wrapper.select(selects);
+        wrapper.lambda().between(StationInfoDay::getRecordDate, beginEnd[0], beginEnd[1])
+                .select(groupId).groupBy(groupId);
+        List<StationInfoDay> days = baseMapper.selectList(wrapper);
+        return days.stream().collect(Collectors.toMap(groupId, Function.identity()));
+    }
+    public List<StationInfoDay> getDatasByPartSelects(Date date, DatePart datePart, String selects, SFunction<StationInfoDay,String> groupId) {
+        DateTime[] beginEnd = SqlUtil.getBeginEnd(date, datePart);
+        QueryWrapper<StationInfoDay> wrapper = new QueryWrapper<>();
+        wrapper.select(selects);
+        wrapper.lambda().select(groupId).between(StationInfoDay::getRecordDate, beginEnd[0], beginEnd[1]).groupBy(groupId);
+        return baseMapper.selectList(wrapper);
+    }
 }

+ 0 - 1
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/StationInfoMinServiceImpl.java

@@ -1,7 +1,6 @@
 package com.ruoyi.ucp.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.annotation.DataSource;
 import com.ruoyi.common.enums.DataSourceType;

+ 29 - 3
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/TurbineInfoDayServiceImpl.java

@@ -1,17 +1,25 @@
 package com.ruoyi.ucp.service.impl;
 
+import cn.hutool.core.date.DateTime;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.annotation.DataSource;
 import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.ucp.entity.TurbineInfoDay;
 import com.ruoyi.ucp.mapper.TurbineInfoDayMapper;
 import com.ruoyi.ucp.service.ITurbineInfoDayService;
+import com.ruoyi.ucp.util.DatePart;
+import com.ruoyi.ucp.util.SqlUtil;
 import org.springframework.stereotype.Service;
 
 import java.util.Collection;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -47,11 +55,29 @@ public class TurbineInfoDayServiceImpl extends ServiceImpl<TurbineInfoDayMapper,
         return super.updateById(entity);
     }
 
-
-
-
     @Override
     public boolean saveOrUpdateBatch(Collection<TurbineInfoDay> entityList) {
         return super.saveOrUpdateBatch(entityList);
     }
+
+    public List<TurbineInfoDay> getDatasByPartSelects(Date date, DatePart datePart, String selects, SFunction<TurbineInfoDay,String>... groupIds) {
+        DateTime[] beginEnd = SqlUtil.getBeginEnd(date, datePart);
+        QueryWrapper<TurbineInfoDay> wrapper = new QueryWrapper<>();
+        wrapper.select(selects);
+        for (SFunction<TurbineInfoDay, String> groupId : groupIds) {
+            wrapper.lambda().select(groupId).groupBy(groupId);
+        }
+        wrapper.lambda().between(TurbineInfoDay::getRecordDate, beginEnd[0], beginEnd[1]);
+        return baseMapper.selectList(wrapper);
+    }
+
+    public Map<String, TurbineInfoDay> getDatasByPartSelect(Date date, DatePart datePart, String selects, SFunction<TurbineInfoDay,String> groupId) {
+        DateTime[] beginEnd = SqlUtil.getBeginEnd(date, datePart);
+        QueryWrapper<TurbineInfoDay> wrapper = new QueryWrapper<>();
+        wrapper.select(selects);
+        wrapper.lambda().between(TurbineInfoDay::getRecordDate, beginEnd[0], beginEnd[1])
+                .select(groupId).groupBy(groupId);
+        List<TurbineInfoDay> days = baseMapper.selectList(wrapper);
+        return days.stream().collect(Collectors.toMap(groupId, Function.identity()));
+    }
 }

+ 18 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/util/DatePart.java

@@ -0,0 +1,18 @@
+package com.ruoyi.ucp.util;
+
+public enum DatePart {
+    DAY("日"),
+    MONTH("月"),
+    YEAR("年"),
+    CURRENT("本期");
+
+    private final String label;
+
+    DatePart(String label) {
+        this.label = label;
+    }
+
+    public String getLabel() {
+        return label;
+    }
+}

+ 53 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/util/SqlUtil.java

@@ -0,0 +1,53 @@
+package com.ruoyi.ucp.util;
+
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+
+import java.util.Date;
+
+public class SqlUtil {
+    public static String getSelectSum(String selects) {
+        String[] split = selects.split(",");
+        StringBuilder sb = new StringBuilder();
+        for (String s : split) {
+            sb.append("sum(").append(s).append(") ").append(s).append(",");
+        }
+        sb.deleteCharAt(sb.length()-1);
+        return sb.toString();
+    }
+
+    public static String getSelectAvg(String selects) {
+        String[] split = selects.split(",");
+        StringBuilder sb = new StringBuilder();
+        for (String s : split) {
+            sb.append("avg(").append(s).append(") ").append(s).append(",");
+        }
+        sb.deleteCharAt(sb.length()-1);
+        return sb.toString();
+    }
+    public static DateTime[] getBeginEnd(Date date, DatePart datePart) {
+        DateTime[] split = new DateTime[2];
+        DateTime begin = null,end = null;
+        switch (datePart){
+            case DAY:
+                begin = DateUtil.beginOfDay(date);
+                end = DateUtil.endOfDay(date);
+                break;
+            case MONTH:
+                begin = DateUtil.beginOfMonth(date);
+                end = DateUtil.endOfMonth(date);
+                break;
+            case YEAR:
+                begin = DateUtil.beginOfYear(date);
+                end = DateUtil.endOfYear(date);
+                break;
+            case CURRENT:
+                begin = DateUtil.beginOfDay(date);
+                end = DateUtil.date(date);
+                break;
+        }
+        split[0]=begin;
+        split[1]=end;
+        return split;
+    }
+}