malijun 5 ay önce
ebeveyn
işleme
e3b32bdfc7

+ 41 - 4
ruoyi-admin/src/test/java/com/ruoyi/JavaFunctionJobHandler.java

@@ -1242,6 +1242,10 @@ public class JavaFunctionJobHandler extends IJobHandler {
         ConcurrentHashMap<String, ConcurrentHashMap<String, Double>> mapOut = new ConcurrentHashMap<>();
 
 
+        //插入集合
+        List<TurbineInfoDay > interest = new ArrayList<>();
+        //更新集合
+        List<TurbineInfoDay > update = new ArrayList<>();
         //遍历每台风机,取出每台风机的pointDatas
         for (PointInfo turbine : turbineZt) {
 
@@ -1373,14 +1377,25 @@ public class JavaFunctionJobHandler extends IJobHandler {
                 turbineInfoDay.setRecordDate(timeBegin.toJdkDate());
                 turbineInfoDay.setXfqrfs(avgCutInWindSpeed);
                 System.out.println(turbineInfoDay);
-                turbineInfoDayService.save(turbineInfoDay);
+
+                interest.add(turbineInfoDay);
+//                turbineInfoDayService.save(turbineInfoDay);
             } else {
                 one.setXfqrfs(avgCutInWindSpeed);
                 System.out.println(one);
-                turbineInfoDayService.updateById(one);
+//                turbineInfoDayService.updateById(one);
+                update.add(one);
             }
 
         }
+
+        //        //批量插入
+//        turbineInfoDayService.saveBatch(interest);
+//        //批量更新
+//        turbineInfoDayService.updateBatchById(update);
+//        //批量插入或更新
+//        turbineInfoDayService.saveOrUpdateBatch(interest);
+//        turbineInfoDayService.saveOrUpdateBatch(update);
     }
 
     //算额定风速
@@ -1422,6 +1437,14 @@ public class JavaFunctionJobHandler extends IJobHandler {
 
 //        Map<String, Map<Double,Double>> fitMap = new HashMap<>();
         int i = 0;
+
+        //插入集合
+        List<TurbineInfoDay > interest = new ArrayList<>();
+        //更新集合
+        List<TurbineInfoDay > update = new ArrayList<>();
+
+
+
         for (PointInfo ef : entityFs) {
             String wtId = ef.getTurbineId();
             PointInfo glInfo = glMap.get(wtId);
@@ -1491,11 +1514,13 @@ public class JavaFunctionJobHandler extends IJobHandler {
                     turbineInfoDay.setRecordDate(start);
                     turbineInfoDay.setEdfs(agValue);
                     System.out.println(turbineInfoDay);
-                    turbineInfoDayService.save(turbineInfoDay);
+//                    turbineInfoDayService.save(turbineInfoDay);
+                    interest.add(turbineInfoDay);
                 } else {
                     one.setEdfs(agValue);
                     System.out.println(one);
-                    turbineInfoDayService.updateById(one);
+//                    turbineInfoDayService.updateById(one);
+                    update.add(one);
                 }
 
             }catch (Exception e) {
@@ -1506,6 +1531,18 @@ public class JavaFunctionJobHandler extends IJobHandler {
 
         }
 
+
+        //        //批量插入
+//        turbineInfoDayService.saveBatch(interest);
+//        //批量更新
+//        turbineInfoDayService.updateBatchById(update);
+//        //批量插入或更新
+//        turbineInfoDayService.saveOrUpdateBatch(interest);
+//        turbineInfoDayService.saveOrUpdateBatch(update);
+
+
+
+
 //        stringRedisTemplate.opsForValue().set("glqxnh", JSON.toJSONString(fitMap));
     }