|
@@ -1394,8 +1394,8 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
// //批量更新
|
|
|
// turbineInfoDayService.updateBatchById(update);
|
|
|
// //批量插入或更新
|
|
|
-// turbineInfoDayService.saveOrUpdateBatch(interest);
|
|
|
-// turbineInfoDayService.saveOrUpdateBatch(update);
|
|
|
+ turbineInfoDayService.saveOrUpdateBatch(interest);
|
|
|
+ turbineInfoDayService.saveOrUpdateBatch(update);
|
|
|
}
|
|
|
|
|
|
//算额定风速
|
|
@@ -1537,8 +1537,8 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
// //批量更新
|
|
|
// turbineInfoDayService.updateBatchById(update);
|
|
|
// //批量插入或更新
|
|
|
-// turbineInfoDayService.saveOrUpdateBatch(interest);
|
|
|
-// turbineInfoDayService.saveOrUpdateBatch(update);
|
|
|
+ turbineInfoDayService.saveOrUpdateBatch(interest);
|
|
|
+ turbineInfoDayService.saveOrUpdateBatch(update);
|
|
|
|
|
|
|
|
|
|
|
@@ -1546,6 +1546,73 @@ public class JavaFunctionJobHandler extends IJobHandler {
|
|
|
// stringRedisTemplate.opsForValue().set("glqxnh", JSON.toJSONString(fitMap));
|
|
|
}
|
|
|
|
|
|
+ //环境温度
|
|
|
+ public void ambientTemperature() {
|
|
|
+ //date当天零点
|
|
|
+ DateTime timeNow = DateUtil.beginOfDay(new Date());
|
|
|
+ //date昨天零点
|
|
|
+ DateTime timeBegin = DateUtil.offsetDay(timeNow, -1);
|
|
|
+
|
|
|
+
|
|
|
+ //所有风机的温度
|
|
|
+ QueryWrapper<PointInfo> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("uniform_code", "AI072");
|
|
|
+
|
|
|
+ List<PointInfo> pointInfos = getEntity("AI072", "turbine");
|
|
|
+
|
|
|
+ //插入集合
|
|
|
+ List<TurbineInfoDay > interest = new ArrayList<>();
|
|
|
+ //更新集合
|
|
|
+ List<TurbineInfoDay > update = new ArrayList<>();
|
|
|
+
|
|
|
+
|
|
|
+ //遍历pointInfos
|
|
|
+ for (PointInfo turbine : pointInfos) {
|
|
|
+ List<PointData> pointDatas = adapter.getHistorySnap(goldenUri(), turbine.getPointKey(), timeBegin.getTime(), timeNow.getTime(), 10);
|
|
|
+ //遍历pointDatas,取出数据算平均值
|
|
|
+ double avgCutInWindSpeed = 0;
|
|
|
+ for (PointData pointData : pointDatas) {
|
|
|
+ avgCutInWindSpeed += pointData.getValue();
|
|
|
+ }
|
|
|
+ avgCutInWindSpeed /= pointDatas.size();
|
|
|
+
|
|
|
+ //存入数据库
|
|
|
+ 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.setHjwd(avgCutInWindSpeed);
|
|
|
+ System.out.println(turbineInfoDay);
|
|
|
+ interest.add(turbineInfoDay);
|
|
|
+// turbineInfoDayService.save(turbineInfoDay);
|
|
|
+ } else {
|
|
|
+ one.setHjwd(avgCutInWindSpeed);
|
|
|
+ System.out.println(one);
|
|
|
+ update.add(one);
|
|
|
+// turbineInfoDayService.updateById(one);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+// //批量插入
|
|
|
+// turbineInfoDayService.saveBatch(interest);
|
|
|
+// //批量更新
|
|
|
+// turbineInfoDayService.updateBatchById(update);
|
|
|
+// //批量插入或更新
|
|
|
+ turbineInfoDayService.saveOrUpdateBatch(interest);
|
|
|
+ turbineInfoDayService.saveOrUpdateBatch(update);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|