Jelajahi Sumber

考核分数 数据填

GYEE 1 tahun lalu
induk
melakukan
f1492ed05e

+ 82 - 18
ruoyi-admin/src/main/java/com/ruoyi/web/controller/JavaFunctionJobHandler.java

@@ -130,6 +130,19 @@ public class JavaFunctionJobHandler extends IJobHandler {
         return byDate;
     }
 
+    public List<StationInfoMin> getStationinfoByMin(Date date, String stId) {
+        QueryWrapper<StationInfoMin> wrapper = new QueryWrapper<>();
+        wrapper.eq("record_date", date).eq("station_id", stId);
+        List<StationInfoMin> list = stationInfoMinService.list(wrapper);
+        if (CollUtil.isEmpty(list)) {
+            StationInfoMin day = new StationInfoMin();
+            day.setStationId(stId);
+            day.setRecordDate(date);
+            list.add(day);
+        }
+        return list;
+    }
+
 
     public StationInfoDay getStationinfoByDate(Date date, String stId) {
         QueryWrapper<StationInfoDay> wrapper = new QueryWrapper<>();
@@ -1896,7 +1909,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
             }
             ef.setPointDatas(null);
             glInfo.setPointDatas(null);
-            String key = "glqxnh:" + (end.getMonth() + 1) + ":" + wtId;
+            String key = "glqxnh:" + end.getMonth() + ":" + wtId;
             stringRedisTemplate.opsForValue().set(key, JSON.toJSONString(fit));
             CalcCache.fitcoef.put(key, new ConcurrentHashMap<>(fit));
         }
@@ -2018,6 +2031,15 @@ public class JavaFunctionJobHandler extends IJobHandler {
         }
     }
 
+    public void getSectionDataByEntity(List<PointInfo> entitys, URI uri, Date end) {
+        String collect = entitys.stream().map(PointInfo::getPointKey).collect(Collectors.joining(","));
+        Map<String, PointData> section1 = adapter.getHistorySection(uri, collect, end.getTime());
+        for (PointInfo entity : entitys) {
+            entity.setPointDatas(new ArrayList<>());
+            entity.getPointDatas().add(section1.get(entity.getPointKey()));
+        }
+    }
+
     public void getSnapDataByEntity(List<PointInfo> entity, URI uri, Date start, Date end, int interval) {
         for (PointInfo info : entity) {
             getSnapDataByEntity(info, uri, start, end, interval);
@@ -3236,7 +3258,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
     public void getRawDataByEntity(List<PointInfo> entity, URI uri, Date start, Date end) {
         for (PointInfo info : entity) {
             List<PointData> snap = adapter.getHistoryRaw(uri, info.getPointKey(), start.getTime(), end.getTime());
-            ThreadUtil.sleep(5);
+//            ThreadUtil.sleep(5);
             info.setPointDatas(snap);
         }
     }
@@ -4061,7 +4083,8 @@ public class JavaFunctionJobHandler extends IJobHandler {
         //AGC
         List<PointInfo> entityAgc = getEntity("AGC002", "booster");
         entityAgc = entityAgc.stream().filter(e -> stId.equals(e.getStationId())).collect(Collectors.toList());
-        Map<String, PointInfo> statMapAgc = getRawDataByEntity(entityAgc, goldenUri(), begin, end, PointInfo::getStationId);
+        getSectionDataByEntity(entityAgc, goldenUri(), end);
+        Map<String, PointInfo> mapAgc = entityAgc.stream().collect(Collectors.toMap(PointInfo::getStationId, Function.identity()));
         //出线
         List<PointInfo> entityCx = getEntity("AGC001", "booster");
         entityCx = entityCx.stream().filter(e -> stId.equals(e.getStationId())).collect(Collectors.toList());
@@ -4082,33 +4105,74 @@ public class JavaFunctionJobHandler extends IJobHandler {
         getSectionDataByEntity(entity, goldenUri(), begin, end);
         Map<String, List<PointInfo>> fdlsMap = entity.stream().collect(Collectors.groupingBy(PointInfo::getStationId));
 
-        List<StationInfoMin> byDate = getStationinfoByMin(end, entityAgc);
+        List<StationInfoMin> byDate = getStationinfoByMin(end, stId);
+        byDate = byDate.stream().filter(e -> stId.equals(e.getStationId())).collect(Collectors.toList());
 
         for (StationInfoMin day : byDate) {
             String id = day.getStationId();
-            PointInfo agcInfo = statMapAgc.get(id);
-            PointInfo cxInfo = statMapCx.get(id);
+//            if (day.getPjfs() == null || day.getPjfs() == 0) {
             List<PointInfo> fsInfos = fssMap.get(id);
             double pjfs = fsInfos.stream().mapToDouble(pi -> pi.getPointDatas().stream().mapToDouble(PointData::getValue).average().orElse(0.0)).average().orElse(0);
-            List<PointInfo> hjwdInfos = hjwdsMap.get(id);
-            double hjwd = hjwdInfos.stream().mapToDouble(pi -> pi.getPointDatas().stream().mapToDouble(PointData::getValue).average().orElse(0.0)).average().orElse(0);
+            day.setPjfs(pjfs);
+//            }
+//            if (day.getPjgl() == null || day.getPjgl() == 0) {
+            PointInfo cxInfo = statMapCx.get(id);
+            double cxgl = cxInfo.getPointDatas().stream().mapToDouble(PointData::getValue).average().orElse(0.0);
+            cxgl = cxgl * cxInfo.getCoef();
+
+            if (cxgl < 0 && pjfs > 3) cxgl = nihe(pjfs);
+            day.setPjgl(cxgl);
+//            }
+//            if (day.getAgc() == null || day.getAgc() == 0) {
+            PointInfo agcInfo = mapAgc.get(id);
+            double agc = agcInfo.getPointDatas().get(0).getValue() * agcInfo.getCoef();
+            if (agc < cxgl) agc = cxgl;
+            day.setAgc(agc);
+//            }
+//            if (day.getRfdl() == null || day.getRfdl() == 0) {
             List<PointInfo> fdlInfos = fdlsMap.get(id);
             double rfdl = fdlInfos.stream().mapToDouble(pi -> {
                 double v = (pi.getPointDatas().get(1).getValue() - pi.getPointDatas().get(0).getValue()) * pi.getCoef();
-                if (v < 0 || v > 720000) v = 0;
+                if (v < 0) v = 0;
+                if (v > 7500) v = 7500.0;
                 return v;
             }).sum();
-            double agc = agcInfo.getPointDatas().stream().mapToDouble(PointData::getValue).average().orElse(0.0);
-            double cxgl = cxInfo.getPointDatas().stream().mapToDouble(PointData::getValue).average().orElse(0.0);
-            day.setAgc(agc * agcInfo.getCoef());
-            day.setPjgl(cxgl * cxInfo.getCoef());
-            day.setPjfs(pjfs);
+            if (rfdl < 660 && cxgl > 0) rfdl = cxgl / 4.0;
             day.setRfdl(rfdl);
+//            }
+//            if (day.getHjwd() == null || day.getHjwd() == 0) {
+            List<PointInfo> hjwdInfos = hjwdsMap.get(id);
+            double hjwd = hjwdInfos.stream().mapToDouble(pi -> pi.getPointDatas().stream().mapToDouble(PointData::getValue).average().orElse(0.0)).average().orElse(0);
             day.setHjwd(hjwd);
+//            }
         }
         stationInfoMinService.saveOrUpdateBatch(byDate);
     }
 
+    private double nihe(double pjfs) {
+        //LJS
+        return -90.4382 * Math.pow(pjfs, 3) + 1661.275 * Math.pow(pjfs, 2) + 2245.86 * pjfs - 17011.14;
+    }
+
+    public void getPoint() {
+        //AGC
+        List<PointInfo> entityAgc = getEntity("AGC002", "booster");
+        Map<String, PointInfo> mapAgc = entityAgc.stream().collect(Collectors.toMap(PointInfo::getStationId, Function.identity()));
+        //出线
+        List<PointInfo> entityCx = getEntity("AGC001", "booster");
+        //风速
+        List<PointInfo> entityFs = getEntity("AI066", "turbine");
+        Map<String, List<PointInfo>> fssMap = entityFs.stream().collect(Collectors.groupingBy(PointInfo::getStationId));
+        //环境温度
+        List<PointInfo> entityHjwd = getEntity("AI072", "turbine");
+        Map<String, List<PointInfo>> hjwdsMap = entityHjwd.stream().collect(Collectors.groupingBy(PointInfo::getStationId));
+        //日发电量
+        List<PointInfo> entity = getEntity("Z-ZXYG-JX", "meter");
+        entity = entity.stream().filter(e -> !"".equals(e.getProjectId())).collect(Collectors.toList());
+        Map<String, List<PointInfo>> fdlsMap = entity.stream().collect(Collectors.groupingBy(PointInfo::getStationId));
+        System.out.println();
+    }
+
     public void calcPredictExamin(Date date) {
         DateTime end = DateUtil.beginOfDay(date);
         DateTime begin = DateUtil.offsetDay(end, -1);
@@ -4117,7 +4181,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
         entity.addAll(entity1);
         Map<String, EquipmentModel> map = equipmentModelService.map();
 
-        Map<String, Double> tbPowerMap = entity.stream().collect(Collectors.toMap(pi -> pi.getTurbineId(), pi -> map.get(pi.getTurbineId()).getPowerProduction()));
+        Map<String, Double> tbPowerMap = entity.stream().collect(Collectors.toMap(pi -> pi.getTurbineId(), pi -> map.get(pi.getSpare()).getPowerProduction()));
         List<PointInfo> entityGl = getEntity("AI114", "turbine");
         getSnapDataByEntity(entityGl, begin, end, 15 * 60);
         Map<String, PointInfo> glpisMap = entityGl.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
@@ -4136,8 +4200,8 @@ public class JavaFunctionJobHandler extends IJobHandler {
             DateTime hour2 = DateUtil.offsetHour(hour, 4);
             QueryWrapper<HistoryPredict> wrapper = new QueryWrapper<>();
             wrapper.lambda().eq(HistoryPredict::getPredictType, "CDQ").eq(HistoryPredict::getDataTime, hour)
-                    .between(HistoryPredict::getPredictTime, hour, hour2).orderByAsc(HistoryPredict::getDataTime);
-            List<HistoryPredict> predicts = historyPredictService.list(predictWrapper);
+                    .between(HistoryPredict::getPredictTime, hour, hour2).orderByAsc(HistoryPredict::getPredictTime);
+            List<HistoryPredict> predicts = historyPredictService.list(wrapper);
             cdqPredicts.addAll(predicts);
         }
         Map<String, List<HistoryPredict>> cdqPredictsMap = cdqPredicts.stream().collect(Collectors.groupingBy(HistoryPredict::getTurbineId));
@@ -4200,7 +4264,7 @@ public class JavaFunctionJobHandler extends IJobHandler {
                     errorPercentage = 100.0;
                 }
             } else {
-                errorPercentage = Math.abs(predictPower.get(i) - actualPower.get(i)) / predictPower.get(i) * 100;
+                errorPercentage = Math.abs(predictPower.get(i) - actualPower.get(i)) / installCapacity * 100;
             }
             if (errorPercentage > maxErrorPercentage) {
                 maxErrorPercentage = errorPercentage;

+ 5 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/PredictController.java

@@ -22,7 +22,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
-@RestController
+//@RestController
 @RequestMapping("/predict")
 public class PredictController {
 
@@ -62,6 +62,7 @@ public class PredictController {
                                    @RequestParam(value = "beginTime",required = false) String beginTime,
                                    @RequestParam(value = "endTime",required = false) String endTime,
                                    @RequestParam(value = "interval",required = false) Integer interval) {
+        //2024-10-15 00:00:00,15,2024-10-15 00:15:00
         DateTime start = DateUtil.parse(beginTime);
         DateTime end = DateUtil.parse(endTime);
         String[] names = {"AI114", "AI066", "AI060", "AI067", "AI082", "AI073", "AI004", "AI047", "AI072", "AI074"};
@@ -488,4 +489,7 @@ public class PredictController {
         }
         return true;
     }
+    //2024-11-2 00:00:00   ---2024-11-2 00:15:00,2024-11-2 00:30:00,2024-11-2 00:45:00
+    //2024-11-2 00:15:00   ---2024-11-2 00:30:00,2024-11-2 00:45:00,2024-11-2 01:00:00
+    //2024-11-2 00:30:00   ---2024-11-2 00:45:00,2024-11-2 01:00:00,2024-11-2 01:15:00
 }

+ 15 - 0
ruoyi-admin/src/main/resources/FunctionTemplate.java

@@ -1,10 +1,13 @@
 package com.ruoyi;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.DateField;
 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 cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson2.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.ruoyi.quartz.handler.IJobHandler;
@@ -18,6 +21,7 @@ import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.lang.reflect.Field;
 import java.net.URI;
 import java.util.*;
 import java.util.function.Function;
@@ -25,6 +29,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
 
+
 public class JavaFunctionJobHandler extends IJobHandler {
 
     @Resource
@@ -47,6 +52,16 @@ public class JavaFunctionJobHandler extends IJobHandler {
     private ITurbineInfoDayService turbineInfoDayService;
     @Resource
     private IProEconReportIndicatorPoolService reportIndicatorPoolService;
+    @Resource
+    private ITurbineInfoMinService turbineInfoMinService;
+    @Resource
+    private IStationInfoMinService stationInfoMinService;
+    @Resource
+    private IProBasicProjectPlanService proBasicProjectPlanService;
+    @Resource
+    private IHistoryPredictService historyPredictService;
+    @Resource
+    private IPredictExaminService predictExaminService;
 
     @Override
     public void execute() throws Exception {

+ 17 - 2
ruoyi-admin/src/test/java/com/ruoyi/GetDataTest.java

@@ -25,6 +25,7 @@ import java.util.*;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 @SpringBootTest
@@ -40,8 +41,13 @@ public class GetDataTest {
 
     @Test
     public void test2() {
-        DateTime begin = DateUtil.parse("2023-03-21");
-        DateTime end = DateUtil.parse("2024-10-30");
+//        DateTime begin = DateUtil.parse("2023-03-21");
+        DateTime begin = DateUtil.parse("2023-04-18");
+//        DateTime begin = DateUtil.parse("2024-08-08 13:30:00");
+//        DateTime end = DateUtil.parse("2024-08-08 14:00:00");
+        DateTime end = DateUtil.parse("2024-11-01");
+//        DateTime end = DateUtil.parse("2024-08-08 13:45:00");
+        //LJS,FSG,JSL
         int i = 1;
         DateTime minBegin = begin, minEnd = DateUtil.offsetMinute(begin, 15);
         while (minEnd.isBefore(end)) {
@@ -52,6 +58,15 @@ public class GetDataTest {
             minBegin = minEnd;
         }
     }
+    @Test
+    public void test5() {
+        task.getPoint();
+    }
+    @Test
+    public void test3() {
+        DateTime date = DateUtil.date();
+        task.calcPredictExamin(date);
+    }
 
     @Test
     public void test() {

+ 214 - 22
ruoyi-admin/src/test/java/com/ruoyi/JavaFunctionJobHandler.java

@@ -1,8 +1,11 @@
+/*
 package com.ruoyi;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.DateField;
 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 cn.hutool.core.util.StrUtil;
@@ -27,7 +30,7 @@ import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
-@Service
+//@Service
 public class JavaFunctionJobHandler extends IJobHandler {
 
     @Resource
@@ -54,6 +57,8 @@ public class JavaFunctionJobHandler extends IJobHandler {
     private ITurbineInfoMinService turbineInfoMinService;
     @Resource
     private IStationInfoMinService stationInfoMinService;
+    @Resource
+    private IProBasicProjectPlanService proBasicProjectPlanService;
 
     @Override
     public void execute() throws Exception {
@@ -465,6 +470,64 @@ public class JavaFunctionJobHandler extends IJobHandler {
         stationInfoDayService.saveOrUpdateBatch(byDate);
     }
 
+    public void calcStationRjhfdl(Date month) {
+        DateTime begin = DateUtil.beginOfMonth(month);
+        DateTime end = DateUtil.endOfMonth(month);
+        DateTime beginTq = DateUtil.offset(begin, DateField.YEAR, -1);
+        DateTime endTq = DateUtil.offset(end, DateField.YEAR, -1);
+
+        QueryWrapper<StationInfoDay> wrapper = new QueryWrapper<>();
+        wrapper.lambda().between(StationInfoDay::getRecordDate, begin, end);
+        List<StationInfoDay> days = stationInfoDayService.list(wrapper);
+        Map<String, Map<String, StationInfoDay>> dayMap = new HashMap<>();
+        if (CollUtil.isNotEmpty(days)) {
+            dayMap = days.stream().collect(Collectors.groupingBy(StationInfoDay::getStationId,
+                    Collectors.toMap(sid -> DateUtil.date(sid.getRecordDate()).toString(), Function.identity())));
+        }
+        wrapper.clear();
+        wrapper.lambda().between(StationInfoDay::getRecordDate, beginTq, endTq);
+        List<StationInfoDay> sids = stationInfoDayService.list(wrapper);
+        Map<String, List<StationInfoDay>> sidMap;
+        if (CollUtil.isNotEmpty(sids)) {
+            sidMap = sids.stream().collect(Collectors.groupingBy(StationInfoDay::getStationId));
+        } else {
+            sidMap = null;
+        }
+        QueryWrapper<ProBasicProjectPlan> wrapperPlan = new QueryWrapper<>();
+        wrapperPlan.lambda().eq(ProBasicProjectPlan::getYear, String.valueOf(begin.year()))
+                .eq(ProBasicProjectPlan::getMonth, String.valueOf(begin.month() + 1));
+        List<ProBasicProjectPlan> plantList = proBasicProjectPlanService.list(wrapperPlan);
+
+        for (ProBasicProjectPlan plan : plantList) {
+            String stId = plan.getWindpowerstationId();
+            Map<String, StationInfoDay> daym = dayMap.get(stId);
+            if (daym == null) daym = new HashMap<>();
+            if (sidMap == null) {
+                for (StationInfoDay day : daym.values()) {
+                    day.setJhfdl(plan.getGeneratingCapacity() / daym.size());
+                }
+            } else {
+                //去年月发电量
+                List<StationInfoDay> sidList = sidMap.get(stId);
+                double rfdlSum = sidList.stream().mapToDouble(StationInfoDay::getRfdl).sum();
+                double v = plan.getGeneratingCapacity() / rfdlSum;
+                for (StationInfoDay sid : sidList) {
+                    DateTime time = DateUtil.offset(sid.getRecordDate(), DateField.YEAR, 1);
+                    StationInfoDay day = daym.get(time.toString());
+                    if (day == null) {
+                        day = new StationInfoDay();
+                        day.setStationId(stId);
+                        day.setRecordDate(time);
+                        days.add(day);
+                    }
+                    day.setJhfdl(v * sid.getRfdl());
+                }
+            }
+
+        }
+        stationInfoDayService.saveOrUpdateBatch(days);
+    }
+
     public void calcStationZhcyRfDlSameDay() {
         //date当天零点
         DateTime time0 = DateUtil.beginOfDay(DateUtil.date());
@@ -1166,7 +1229,8 @@ public class JavaFunctionJobHandler extends IJobHandler {
         turbineInfoDayService.saveOrUpdateBatch(infoDays);
     }
 
-    /*public void calcTurbine5s(Date date) {
+    */
+/*public void calcTurbine5s(Date date) {
         //date当天零点
         DateTime time = DateUtil.beginOfDay(date);
         //date昨天零点
@@ -1220,7 +1284,8 @@ public class JavaFunctionJobHandler extends IJobHandler {
             infoDays.add(infoDay);
         }
         turbineInfoDayService.saveOrUpdateBatch(infoDays);
-    }*/
+    }*//*
+
 
     //此处加公式
     public void calcStationSspjfs() {
@@ -1256,12 +1321,15 @@ public class JavaFunctionJobHandler extends IJobHandler {
         getSnapDataByEntity(entityGl, time0, time, 15);
 
         List<PointInfo> ztMapMap = calcTurbineZt(time0, time, entityFs, entityGl);
-        Map<String, Map<String, PointInfo>> ztMapMapInfos = ztMapMap.stream().collect(Collectors.groupingBy(PointInfo::getStationId, Collectors.toMap(PointInfo::getTurbineId, Function.identity())));
+        Map<String, Map<String, PointInfo>> ztMapMapInfos = ztMapMap.stream().collect(
+                Collectors.groupingBy(PointInfo::getStationId, Collectors.toMap(PointInfo::getTurbineId, Function.identity())));
         Map<String, TurbineInfoDay> dayMap = getTurbineinfoMap(time0, entityFs);
 
         List<TurbineInfoDay> infoDays = new ArrayList<>();
-        Map<String, Map<String, List<PointData>>> fsMapMap = entityFs.stream().collect(Collectors.groupingBy(PointInfo::getStationId, Collectors.toMap(PointInfo::getTurbineId, PointInfo::getPointDatas)));
-        Map<String, Map<String, List<PointData>>> glMapMap = entityGl.stream().collect(Collectors.groupingBy(PointInfo::getStationId, Collectors.toMap(PointInfo::getTurbineId, PointInfo::getPointDatas)));
+        Map<String, Map<String, List<PointData>>> fsMapMap = entityFs.stream().collect(Collectors.groupingBy(PointInfo::getStationId,
+                Collectors.toMap(PointInfo::getTurbineId, PointInfo::getPointDatas)));
+        Map<String, Map<String, List<PointData>>> glMapMap = entityGl.stream().collect(Collectors.groupingBy(PointInfo::getStationId,
+                Collectors.toMap(PointInfo::getTurbineId, PointInfo::getPointDatas)));
 
         ztMapMapInfos.forEach((stId, ztMapInfo) -> ztMapInfo.forEach((wtId, ztInfo) -> {
             //0 待机,1 手动停机,2 正常发电,3 发电降出力,4 故障,5 故障受累,6 检修,7 检修受累,8 限电降出力,
@@ -1279,7 +1347,8 @@ public class JavaFunctionJobHandler extends IJobHandler {
             } else {
                 infoDay.setXnss(loss.get("xnss"));
             }
-            infoDay.setLlfdl(infoDay.getRfdl() + infoDay.getJhjxss() + infoDay.getFjhjxss() + infoDay.getXdss() + infoDay.getSlss() + infoDay.getXnss());
+            infoDay.setLlfdl(infoDay.getRfdl() + infoDay.getJhjxss() + infoDay.getFjhjxss() +
+                    infoDay.getXdss() + infoDay.getSlss() + infoDay.getXnss());
             infoDays.add(infoDay);
         }));
         turbineInfoDayService.saveOrUpdateBatch(infoDays);
@@ -1290,7 +1359,8 @@ public class JavaFunctionJobHandler extends IJobHandler {
         List<PointInfo> turbineZt = calcTurbineDizt(start, end, 15);
         List<PointInfo> turbineAizt = calcTurbineAizt(start, end, 15);
         turbineZt.addAll(turbineAizt);
-        Map<String, Map<String, PointInfo>> ztMapMap = turbineZt.stream().collect(Collectors.groupingBy(PointInfo::getStationId, Collectors.toMap(PointInfo::getTurbineId, Function.identity())));
+        Map<String, Map<String, PointInfo>> ztMapMap = turbineZt.stream().collect(Collectors.groupingBy(PointInfo::getStationId,
+                Collectors.toMap(PointInfo::getTurbineId, Function.identity())));
 
         //AGC
         List<PointInfo> entityAgc = getEntity("AGC002", "booster");
@@ -1304,9 +1374,12 @@ public class JavaFunctionJobHandler extends IJobHandler {
 
         Map<String, PointInfo> collectAgc = entityAgc.stream().collect(Collectors.toMap(PointInfo::getStationId, Function.identity()));
         Map<String, PointInfo> collectCx = entityCx.stream().collect(Collectors.toMap(PointInfo::getStationId, Function.identity()));
-        Map<String, Map<String, List<PointData>>> collectYlzsgd = entityYlzsgd.stream().collect(Collectors.groupingBy(PointInfo::getStationId, Collectors.toMap(PointInfo::getTurbineId, PointInfo::getPointDatas)));
-        Map<String, Map<String, PointInfo>> fsMapMap = fsInfos.stream().collect(Collectors.groupingBy(PointInfo::getStationId, Collectors.toMap(PointInfo::getTurbineId, Function.identity())));
-        Map<String, Map<String, List<PointData>>> glMapMap = glInfos.stream().collect(Collectors.groupingBy(PointInfo::getStationId, Collectors.toMap(PointInfo::getTurbineId, PointInfo::getPointDatas)));
+        Map<String, Map<String, List<PointData>>> collectYlzsgd = entityYlzsgd.stream().collect(Collectors.groupingBy(PointInfo::getStationId,
+                Collectors.toMap(PointInfo::getTurbineId, PointInfo::getPointDatas)));
+        Map<String, Map<String, PointInfo>> fsMapMap = fsInfos.stream().collect(Collectors.groupingBy(PointInfo::getStationId,
+                Collectors.toMap(PointInfo::getTurbineId, Function.identity())));
+        Map<String, Map<String, List<PointData>>> glMapMap = glInfos.stream().collect(Collectors.groupingBy(PointInfo::getStationId,
+                Collectors.toMap(PointInfo::getTurbineId, PointInfo::getPointDatas)));
 
         ztMapMap.forEach((stId, ztMap) -> {
             PointInfo agcInfo = collectAgc.get(stId);
@@ -1315,7 +1388,8 @@ public class JavaFunctionJobHandler extends IJobHandler {
 
             Map<String, List<PointData>> pdsZsglMap = new HashMap<>();
             ztMap.forEach((wtId, zt) -> {
-                List<PointData> peek = fsMap.get(wtId).getPointDatas().stream().peek(pd -> pd.setDoubleValue(NumberUtil.round(pd.getValue() > 25 ? 25.0 : pd.getValue(), 2).doubleValue())).collect(Collectors.toList());
+                List<PointData> peek = fsMap.get(wtId).getPointDatas().stream().peek(pd -> pd.setDoubleValue(NumberUtil.round(pd.getValue() > 25 ? 25.0
+                        : pd.getValue(), 2).doubleValue())).collect(Collectors.toList());
                 fsMap.get(wtId).setPointDatas(peek);
                 List<PointData> zsglSnap = fsMap.get(wtId).getPointDatas().stream().map(pd -> {
                     Double v = CalcCache.fitcoef.get(wtId).get(pd.getValue());
@@ -1335,23 +1409,23 @@ public class JavaFunctionJobHandler extends IJobHandler {
             cxInfo.setPointDatas(cxc);
 
             //风机风速、功率->场站风速、功率
-            //            List<PointData> firstFs = new ArrayList<>();
-            //            List<PointData> firstGl = new ArrayList<>();
+//            List<PointData> firstFs = new ArrayList<>();
+//            List<PointData> firstGl = new ArrayList<>();
             List<PointData> firstZsgl = new ArrayList<>();
             double v1, v2, v3;
             for (int i = 0; i < agcInfo.getPointDatas().size(); i++) {
                 int finalI = i;
-                long ts = start.getTime() + i * 15000;
-                //                v1 = fsMap.values().stream().mapToDouble(pds -> pds.getPointDatas().get(finalI).getValue()).average().orElse(0.0);
-                //                v2 = glMap.values().stream().mapToDouble(pds -> pds.getPointDatas().get(finalI).getValue()).sum();
+                long ts = start.getTime() + i * 15000L;
+//                v1 = fsMap.values().stream().mapToDouble(pds -> pds.getPointDatas().get(finalI).getValue()).average().orElse(0.0);
+//                v2 = glMap.values().stream().mapToDouble(pds -> pds.getPointDatas().get(finalI).getValue()).sum();
                 v3 = pdsZsglMap.values().stream().mapToDouble(pds -> pds.get(finalI).getValue()).sum();
-                //                firstFs.add(new PointData(ts, v1));
-                //                firstGl.add(new PointData(ts, v2));
+//                firstFs.add(new PointData(ts, v1));
+//                firstGl.add(new PointData(ts, v2));
                 firstZsgl.add(new PointData(ts, v3));
             }
 
             List<PointData> czxd = calcStationXd2(agcInfo, cxInfo.getPointDatas(), firstZsgl);
-            String ybj = "GJNY_SXGS_FSG_F_WT_0013_EQ,GJNY_SXGS_FSG_F_WT_0042_EQ,GJNY_SXGS_FSG_F_WT_0062_EQ,GJNY_SXGS_FSG_F_WT_0064_EQ";
+            String ybj = "GJNY_SXGS_XZ_F_WT_0013_EQ,GJNY_SXGS_XZ_F_WT_0023_EQ,GJNY_SXGS_XZ_F_WT_0027_EQ,GJNY_SXGS_XZ_F_WT_0034_EQ,GJNY_SXGS_XZ_F_WT_0044_EQ,GJNY_SXGS_XZ_F_WT_0060_EQ,GJNY_SXGS_XZ_F_WT_0062_EQ,GJNY_SXGS_FSG_F_WT_0005_EQ,GJNY_SXGS_FSG_F_WT_0006_EQ,GJNY_SXGS_FSG_F_WT_0038_EQ,GJNY_SXGS_FSG_F_WT_0039_EQ,GJNY_SXGS_ZZ_F_WT_0008_EQ,GJNY_SXGS_ZZ_F_WT_0015_EQ,GJNY_SXGS_ZZ_F_WT_0022_EQ,GJNY_SXGS_ZZ_F_WT_0046_EQ,GJNY_SXGS_ZZ_F_WT_0049_EQ,GJNY_SXGS_CSL_F_WT_0003_EQ,GJNY_SXGS_CSL_F_WT_0012_EQ,GJNY_SXGS_CSL_F_WT_0023_EQ,GJNY_SXGS_JSL_F_WT_0002_EQ,GJNY_SXGS_JSL_F_WT_0003_EQ,GJNY_SXGS_JSL_F_WT_0028_EQ,GJNY_SXGS_JSL_F_WT_0047_EQ,GJNY_SXGS_JSL_F_WT_0070_EQ,GJNY_SXGS_JSL_F_WT_0094_EQ,GJNY_SXGS_LJS_F_WT_0002_EQ,GJNY_SXGS_LJS_F_WT_0011_EQ,GJNY_SXGS_LJS_F_WT_0030_EQ,GJNY_SXGS_LJS_F_WT_0033_EQ";
             ztMap.forEach((wtId, ztInfo) -> {
                 if (ybj.contains(wtId)) return;
                 List<PointData> fss = fsMap.get(wtId).getPointDatas();
@@ -1364,6 +1438,14 @@ public class JavaFunctionJobHandler extends IJobHandler {
         return turbineZt;
     }
 
+    public List<PointData> calcTurbineSimpleZt(Date start, Date end, Integer interval, String tbId) {
+        List<PointInfo> turbineZt = calcTurbineDizt(start, end, interval, tbId);
+        List<PointInfo> turbineAizt = calcTurbineAizt(start, end, interval, tbId);
+        turbineZt.addAll(turbineAizt);
+        Map<String, List<PointData>> collect = turbineZt.stream().collect(Collectors.toMap(PointInfo::getTurbineId, PointInfo::getPointDatas));
+        return collect.get(tbId);//.stream().map(PointData::getValue).collect(Collectors.toList());
+    }
+
     public void calcTurbineXd(PointInfo ztInfo, List<PointData> gls, List<PointData> fss, List<PointData> ylzsgds, List<PointData> czxd) {
         Map<String, EquipmentModel> map = equipmentModelService.map();
         Double capacity = map.get(ztInfo.getSpare()).getPowerProduction();
@@ -1473,6 +1555,23 @@ public class JavaFunctionJobHandler extends IJobHandler {
         return entityAiZt;
     }
 
+    public List<PointInfo> calcTurbineAizt(Date start, Date end, int interval, String tbId) {
+        List<PointInfo> entityAiZt = getEntity("AI422", "state");
+        entityAiZt = entityAiZt.stream().filter(e -> tbId.equals(e.getTurbineId())).collect(Collectors.toList());
+        List<StateAi> list = stateAiService.list();
+        Map<String, Map<Integer, Integer>> collectAi = list.stream().collect(Collectors.groupingBy(StateAi::getModel, Collectors.toMap(StateAi::getOriginalState, StateAi::getMappingState)));
+        getSnapDataByEntity(entityAiZt, start, end, interval);
+        for (PointInfo info : entityAiZt) {
+            List<PointData> peek = info.getPointDatas().stream().peek(pd -> {
+                Integer m = collectAi.get(info.getSpare()).get((int) pd.getValue());
+                if (m == null) m = 2;
+                pd.setDoubleValue(m);
+            }).collect(Collectors.toList());
+            info.setPointDatas(peek);
+        }
+        return entityAiZt;
+    }
+
     public List<PointInfo> calcTurbineDizt(Date start, Date end, int interval) {
         List<PointInfo> entity = new ArrayList<>();
         List<PointInfo> entity0 = getEntity("MX000", "state");
@@ -1524,6 +1623,62 @@ public class JavaFunctionJobHandler extends IJobHandler {
         return entity0;
     }
 
+    public List<PointInfo> calcTurbineDizt(Date start, Date end, int interval, String tbId) {
+        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");
+        entity0 = entity0.stream().filter(e -> tbId.equals(e.getTurbineId())).collect(Collectors.toList());
+        entity1 = entity1.stream().filter(e -> tbId.equals(e.getTurbineId())).collect(Collectors.toList());
+        entity2 = entity2.stream().filter(e -> tbId.equals(e.getTurbineId())).collect(Collectors.toList());
+        entity4 = entity4.stream().filter(e -> tbId.equals(e.getTurbineId())).collect(Collectors.toList());
+        entity6 = entity6.stream().filter(e -> tbId.equals(e.getTurbineId())).collect(Collectors.toList());
+        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())));
+        wtUcPis.forEach((wtId, map) -> {
+            map.forEach((uc, pi) -> {
+                List<PointData> raw = adapter.getHistoryRaw(goldenUri(), pi.getPointKey(), start.getTime(), end.getTime());
+                List<PointData> ds = boolPointDatasFull(latest.get(pi.getPointKey()).isBooleanValue(), raw, start.getTime(), end.getTime(), interval);
+                pi.setPointDatas(ds);
+                ThreadUtil.sleep(5);
+            });
+            List<PointData> mx000 = map.get("MX000").getPointDatas();
+            PointData data0;
+            for (int i = 0; i < mx000.size(); i++) {
+                data0 = mx000.get(i);
+                if (data0.getValue() == 1.0) {
+                    data0.setDoubleValue(0.0);
+                    data0.setBooleanValue(false);
+                } else if (map.get("MX001").getPointDatas().get(i).getValue() == 1.0) {
+                    data0.setDoubleValue(1.0);
+                } else if (map.get("MX002").getPointDatas().get(i).getValue() == 1.0) {
+                    data0.setDoubleValue(2.0);
+                } else if (map.get("MX004").getPointDatas().get(i).getValue() == 1.0) {
+                    data0.setDoubleValue(4.0);
+                } else if (map.get("MX006").getPointDatas().get(i).getValue() == 1.0) {
+                    data0.setDoubleValue(6.0);
+                } else {
+                    //                    System.out.println(wtId + data0.getTs() + ":di无对应状态!");
+                    data0.setDoubleValue(2.0);
+                }
+            }
+            map.get("MX001").setPointDatas(null);
+            map.get("MX002").setPointDatas(null);
+            map.get("MX004").setPointDatas(null);
+            map.get("MX006").setPointDatas(null);
+        });
+        return entity0;
+    }
+
     public PointInfo calcTurbineAizt2(PointInfo entityAiZt, Map<String, Map<Integer, Integer>> collectAi, Date start, Date end, int interval) {
         if (entityAiZt == null) return null;
         getSnapDataByEntity(entityAiZt, start, end, interval);
@@ -3011,6 +3166,18 @@ public class JavaFunctionJobHandler extends IJobHandler {
     }
     //此处加公式
 
+    public Map<String, Double> calcRealtimeTurbineZt(String stId) {
+
+        List<PointInfo> turbineZt = calcRealtimeTurbineDizt();
+        List<PointInfo> turbineAizt = calcRealtimeTurbineAizt();
+        turbineZt.addAll(turbineAizt);
+        Map<String, Double> collect = turbineZt.stream().filter(zt -> zt.getStationId().equals(stId)).peek(t -> {
+            if (t.getPointDatas().get(0).getTs() + 35 * 60 * 1000 <= DateUtil.date().getTime()) {
+                t.getPointDatas().get(0).setDoubleValue(12.0);
+            }
+        }).collect(Collectors.toMap(PointInfo::getTurbineId, pi -> pi.getPointDatas().get(0).getValue()));
+        return collect;
+    }
     // 计算每种状态的总持续时间
     public void calcTurbineStateMin(Date date) {
         //date当天零点
@@ -3302,7 +3469,8 @@ public class JavaFunctionJobHandler extends IJobHandler {
         return iszqxd;
     }
 
-    /*public void calcStationSwGwCyRdl(Date date) {
+    */
+/*public void calcStationSwGwCyRdl(Date date) {
         //date当天零点
         DateTime time = DateUtil.beginOfDay(date);
         //date昨天零点
@@ -3338,7 +3506,8 @@ public class JavaFunctionJobHandler extends IJobHandler {
             info.setCydl(cydl);
         }
         stationInfoDayService.saveOrUpdateBatch(byDate);
-    }*/
+    }*//*
+
 
     public void writeReportPool5SPjfsLlfdlZtsj(Date date) {
         //date当天零点
@@ -3796,6 +3965,28 @@ public class JavaFunctionJobHandler extends IJobHandler {
         turbineInfoMinService.saveOrUpdateBatch(mins);
     }
 
+    public void calcTurbineSsfsQx(Date date) {
+        DateTime date0 = DateUtil.beginOfDay(date);
+        DateTime date1 = DateUtil.endOfDay(date);
+        //风速
+        List<PointInfo> entityFs = getEntity("AI066", "turbine");
+        List<String> fjs = Arrays.asList("GJNY_SXGS_FSG_F_WT_0040_EQ", "GJNY_SXGS_FSG_F_WT_0047_EQ");
+        entityFs = entityFs.stream().filter(e -> fjs.contains(e.getTurbineId())).collect(Collectors.toList());
+        getSnapDataByEntity(entityFs, date0, date1, 60);
+        int i = 0;
+        for (PointInfo et : entityFs) {
+            StrBuilder sb = new StrBuilder();
+            StrBuilder sb1 = new StrBuilder();
+            for (PointData v : et.getPointDatas()) {
+                sb.append(v.getValue()).append(",");
+                sb1.append(i).append(",");
+                i++;
+            }
+            System.out.println(sb1);
+            System.out.println(sb);
+        }
+    }
+
     public void calcStationLlglKyglSjglAgcMin(Date date, int granularity) {
         date = DateUtil.beginOfMinute(date);
         DateTime start = DateUtil.offsetMinute(date, -granularity);
@@ -3833,3 +4024,4 @@ public class JavaFunctionJobHandler extends IJobHandler {
 
 
 
+*/

+ 35 - 8
ruoyi-admin/src/test/java/com/ruoyi/NewTests.java

@@ -12,6 +12,7 @@ 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.web.controller.JavaFunctionJobHandler;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -36,8 +37,8 @@ public class NewTests {
     public void test() {
 //        task.calcTurbineRFDLSameDay();
 //        task.calcTurbine5s2SameDay();
-        /*Map<Double, Double> a1 = CalcCache.fitcoef.get("GJNY_SXGS_JSL_F_WT_0001_EQ");
-        Map<Double, Double> a3 = CalcCache.fitcoef.get("GJNY_SXGS_JSL_F_WT_0003_EQ");
+        /*Map<Double, Double> a1 = CalcCache.fitcoef.get("GJNY_SXGS_FSG_F_WT_0040_EQ");
+        Map<Double, Double> a3 = CalcCache.fitcoef.get("GJNY_SXGS_FSG_F_WT_0047_EQ");
         TreeMap<Double, Double> b1 = new TreeMap<>();
         TreeMap<Double, Double> b3 = new TreeMap<>();
         b1.putAll(a1);
@@ -59,7 +60,8 @@ public class NewTests {
         System.out.println(sb3);
         System.out.println();*/
 
-//        Date date = DateUtil.date();
+        Date date = DateUtil.parse("2024-10-10");
+        task.calcTurbineSsfsQx(date);
 //        task.ambientTemperature();
 
 //        task.calcTurbine5s2(date);
@@ -80,8 +82,8 @@ public class NewTests {
 //        calcStationZhcydl(date);
 //        calcNhglZs(date);
         // 创建日期范围生成器
-        DateTime date = DateUtil.date();
-        task.calcTurbine5s2(date);
+//        DateTime date = DateUtil.date();
+//        task.calcTurbine5s2(date);
 
 
 //        DateTime start = DateUtil.parse("2023-06-27");
@@ -145,12 +147,12 @@ public class NewTests {
     @Test
     public void test2() {
         // 创建日期范围生成器
-        DateTime start = DateUtil.parse("2024-10-12");
-        DateTime end = DateUtil.parse("2024-10-14");
+        DateTime start = DateUtil.parse("2024-10-19");
+        DateTime end = DateUtil.parse("2024-10-25");
         DateRange range = DateUtil.range(start, end, DateField.HOUR_OF_DAY);
         for (DateTime date : range) {
             System.out.println(DateUtil.date() + ":" + date);
-            task.calcAQTS(date);
+//            task.calcAQTS(date);
 //            task.calcLineRfdl(date,"GJNY_SXGS_JSL_FDC_STA");
 //            task.calcStationSwGwCyRdl(date,"GJNY_SXGS_JSL_FDC_STA");
 //            task.calcStationZhcyRfDl(date,"GJNY_SXGS_JSL_FDC_STA");
@@ -158,6 +160,7 @@ public class NewTests {
 //            task.writeReportPool(date);
 //            task.writeReportPoolProject(date);
 //            task.calcStationHourPjglRfdl(DateUtil.date());
+            task.calcTurbine5s2(date);
         }
 //        task.calcStationHourPjglRfdl(DateUtil.date());
 //        DateTime date = DateUtil.date();
@@ -167,5 +170,29 @@ public class NewTests {
 //        task.calcTurbinePjfsPjglKyglLlglMin(DateUtil.date(), 15);
 //        task.calcStationLlglKyglSjglAgcMin(date, 15);
     }
+    @Test
+    public void test3() {
+        // 创建日期范围生成器
+        DateTime start = DateUtil.parse("2024-10-01");
+        DateTime end = DateUtil.parse("2024-12-16");
+        DateRange range = DateUtil.range(start, end, DateField.MONTH);
+        for (DateTime date : range) {
+            System.out.println(DateUtil.date() + ":" + date);
+            task.calcStationRjhfdl(date);
+
+        }
+    }
+    @Test
+    public void test4() {
+//        while (true){
+//            task.calcStationRealtimeLLgl();
+//            ThreadUtil.sleep(60000);
+//        }
+
+        DateTime start = DateUtil.parse("2023-08-01");
+        DateTime end = DateUtil.parse("2023-11-01");
+        task.calcGlqxnhSurplus(start, end);
+
+    }
 
 }

+ 9 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/config/DruidConfig.java

@@ -43,12 +43,21 @@ public class DruidConfig {
         return druidProperties.dataSource(dataSource);
     }
 
+    @Bean
+    @ConfigurationProperties("spring.datasource.druid.glyc")
+    @ConditionalOnProperty(prefix = "spring.datasource.druid.glyc", name = "enabled", havingValue = "true")
+    public DataSource glycDataSource(DruidProperties druidProperties) {
+        DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
+        return druidProperties.dataSource(dataSource);
+    }
+
     @Bean(name = "dynamicDataSource")
     @Primary
     public DynamicDataSource dataSource(DataSource masterDataSource) {
         Map<Object, Object> targetDataSources = new HashMap<>();
         targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
         setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
+        setDataSource(targetDataSources, DataSourceType.GLYC.name(), "glycDataSource");
         return new DynamicDataSource(masterDataSource, targetDataSources);
     }
 

+ 1 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@@ -108,7 +108,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
                 // 过滤请求
                 .authorizeRequests()
                 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
-                .antMatchers("/login", "/register", "/captchaImage").permitAll()
+                .antMatchers("/login", "/register", "/captchaImage","/predict/*").permitAll()
                 // 静态资源,可匿名访问
                 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
                 .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

+ 3 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/PredictExamin.java

@@ -1,5 +1,7 @@
 package com.ruoyi.ucp.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import java.io.Serializable;
 import java.util.Date;
@@ -17,6 +19,7 @@ public class PredictExamin implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
+    @TableId(type = IdType.AUTO)
     private Integer id;
 
     private String modelId;

+ 32 - 1
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/StationInfoMin.java

@@ -10,7 +10,7 @@ import java.util.Date;
 
 /**
  * <p>
- * 
+ *
  * </p>
  *
  * @author gfhd
@@ -46,4 +46,35 @@ public class StationInfoMin implements Serializable {
     private Double rfdl;
 
     private Double hjwd;
+
+    public void setPjfs(Double pjfs) {
+        if (pjfs == null || pjfs < 0) pjfs = 0.0;
+        if (pjfs > 25) pjfs = 25.0;
+        this.pjfs = pjfs;
+    }
+
+    public void setPjgl(Double pjgl) {
+        if (pjgl == null) pjgl = 0.0;
+        if (pjgl < -292) pjgl = -292.0;
+        if (pjgl > 169600) pjgl = 169600.0;
+        this.pjgl = pjgl;
+    }
+
+    public void setAgc(Double agc) {
+        if (agc == null || agc < 0) agc = 0.0;
+        if (agc > 170000) agc = 170000.0;
+        this.agc = agc;
+    }
+
+    public void setRfdl(Double rfdl) {
+        if (rfdl == null || rfdl < 0) rfdl = 0.0;
+        this.rfdl = rfdl;
+    }
+
+    public void setHjwd(Double hjwd) {
+        if (hjwd == null) hjwd = 0.0;
+        if (hjwd < -30) hjwd = -30.0;
+        if (hjwd > 40) hjwd = 40.0;
+        this.hjwd = hjwd;
+    }
 }

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

@@ -12,7 +12,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @author gfhd
  * @since 2024-10-29
  */
-@DS("glyc")
 public interface IPredictExaminService extends IService<PredictExamin> {
 
 }

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

@@ -1,11 +1,17 @@
 package com.ruoyi.ucp.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.ruoyi.common.annotation.DataSource;
+import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.ucp.entity.PredictExamin;
 import com.ruoyi.ucp.mapper.PredictExaminMapper;
 import com.ruoyi.ucp.service.IPredictExaminService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.Collection;
+import java.util.List;
+
 /**
  * <p>
  *  服务实现类
@@ -15,6 +21,20 @@ import org.springframework.stereotype.Service;
  * @since 2024-10-29
  */
 @Service
+@DataSource(DataSourceType.GLYC)
 public class PredictExaminServiceImpl extends ServiceImpl<PredictExaminMapper, PredictExamin> implements IPredictExaminService {
+    @Override
+    public boolean saveBatch(Collection<PredictExamin> entityList) {
+        return super.saveBatch(entityList);
+    }
+
+    @Override
+    public boolean saveOrUpdateBatch(Collection<PredictExamin> entityList) {
+        return super.saveOrUpdateBatch(entityList);
+    }
 
+    @Override
+    public List<PredictExamin> list(Wrapper<PredictExamin> queryWrapper) {
+        return super.list(queryWrapper);
+    }
 }