Commit 30bbe5cc authored by 朱晨阳's avatar 朱晨阳

Merge remote-tracking branch 'origin/developer' into developer

parents 308d2a9d 34a7b02a
...@@ -2999,6 +2999,7 @@ public class CommonServiceImpl { ...@@ -2999,6 +2999,7 @@ public class CommonServiceImpl {
if (500 == newList.size() || i == pvHealthIndices.size() - 1) { // 载体list达到要求,进行批量操作 if (500 == newList.size() || i == pvHealthIndices.size() - 1) { // 载体list达到要求,进行批量操作
// 调用批量插入 // 调用批量插入
pvHealthIndexMapper.saveBatchHealthIndexList(newList, "pv_health_index_moment", analysisType); pvHealthIndexMapper.saveBatchHealthIndexList(newList, "pv_health_index_moment", analysisType);
pvHealthIndexMapper.saveBatchHealthIndexListNew(newList, "pv_health_index_moment_new", analysisType);
idxFanHealthIndexMapper.saveBatchHealthIndexLatestInfoPv(newList); idxFanHealthIndexMapper.saveBatchHealthIndexLatestInfoPv(newList);
newList.clear();// 每次批量操作后,清空载体list,等待下次的数据填入 newList.clear();// 每次批量操作后,清空载体list,等待下次的数据填入
} }
......
...@@ -19,6 +19,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex; ...@@ -19,6 +19,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -107,9 +108,9 @@ public class TdengineTimeServiceImpl { ...@@ -107,9 +108,9 @@ public class TdengineTimeServiceImpl {
idxFanHealthIndexMapper.deleteAllDataByTableName("fan_health_index_latest_data", WarningPeriodEnum.HOUR.getName()); idxFanHealthIndexMapper.deleteAllDataByTableName("fan_health_index_latest_data", WarningPeriodEnum.HOUR.getName());
String recDate = DateUtil.format(new Date(), "yyyy-MM-dd HH:00:00"); String recDate = DateUtil.format(new Date(), "yyyy-MM-dd HH:00:00");
// 8小时 + 59分钟 // 8小时 + 59分钟
String startTime = DateUtils.dateFormat(DateUtils.dateAddMinutes(new Date(), -541), DateUtils.DATE_TIME_PATTERN); String startTime = DateUtils.dateFormat(DateUtils.dateAddMinutes(new Date(), -539), DateUtils.DATE_TIME_PATTERN);
log.debug("开始时间为----------------------",startTime); log.debug("开始时间为----------------------{}",startTime);
log.debug("整点存库时间为----------------------",recDate); log.debug("整点存库时间为----------------------{}",recDate);
// // 测点 // // 测点
// List<IdxBizFanHealthLevel> levelList = idxBizFanHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "测点").last("limit 4")); // List<IdxBizFanHealthLevel> levelList = idxBizFanHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "测点").last("limit 4"));
// List<FanHealthIndex> fanHealthIndices = fanHealthIndexService.getInfoListByGroupByCdFan(startTime, "fan_health_index_moment", "测点"); // List<FanHealthIndex> fanHealthIndices = fanHealthIndexService.getInfoListByGroupByCdFan(startTime, "fan_health_index_moment", "测点");
...@@ -117,7 +118,7 @@ public class TdengineTimeServiceImpl { ...@@ -117,7 +118,7 @@ public class TdengineTimeServiceImpl {
// 测点 // 测点
List<IdxBizFanHealthLevel> levelList = idxBizFanHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "测点").last("limit 4")); List<IdxBizFanHealthLevel> levelList = idxBizFanHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "测点").last("limit 4"));
List<FanHealthIndex> healthIndices = fanHealthIndexMapper.getInfoListByGroupByCdFan(startTime, "fan_health_index_moment", "测点"); List<FanHealthIndex> healthIndices = fanHealthIndexMapper.getInfoListByGroupByCdFan(startTime, "fan_health_index_moment", "测点");
log.debug("风电小时测点数据为----------------------",healthIndices); log.debug("风电小时测点数据为----------------------{}",healthIndices);
saveBatchFan(healthIndices, "fan_health_index_hour", recDate, WarningPeriodEnum.HOUR.getName(), levelList); saveBatchFan(healthIndices, "fan_health_index_hour", recDate, WarningPeriodEnum.HOUR.getName(), levelList);
// 子系统 // 子系统
List<IdxBizFanHealthLevel> levelListZxt = idxBizFanHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "子系统").last("limit 4")); List<IdxBizFanHealthLevel> levelListZxt = idxBizFanHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "子系统").last("limit 4"));
...@@ -140,20 +141,24 @@ public class TdengineTimeServiceImpl { ...@@ -140,20 +141,24 @@ public class TdengineTimeServiceImpl {
// 测点 // 测点
List<IdxBizPvHealthLevel> pvlevelList = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "测点").last("limit 4")); List<IdxBizPvHealthLevel> pvlevelList = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "测点").last("limit 4"));
List<PvHealthIndex> pvHealthIndices = pvHealthIndexMapper.getInfoListByGroupByCdPv(startTime, "pv_health_index_moment", "测点"); List<PvHealthIndex> pvHealthIndices = pvHealthIndexMapper.getInfoListByGroupByCdPv(startTime, "pv_health_index_moment", "测点");
log.debug("光伏小时测点数据为----------------------",pvHealthIndices); log.debug("光伏小时测点数据为----------------------{}",pvHealthIndices);
saveBatchPv(pvHealthIndices, "pv_health_index_hour", recDate, WarningPeriodEnum.HOUR.getName(), pvlevelList); saveBatchPv(pvHealthIndices, "pv_health_index_hour", recDate, WarningPeriodEnum.HOUR.getName(), pvlevelList);
saveBatchPvNew(pvHealthIndices, "pv_health_index_hour_new", recDate, WarningPeriodEnum.HOUR.getName(), pvlevelList);
// 设备 // 设备
List<IdxBizPvHealthLevel> pvLevelListSb = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "设备").last("limit 4")); List<IdxBizPvHealthLevel> pvLevelListSb = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "设备").last("limit 4"));
List<PvHealthIndex> pvHealthIndicesSb = pvHealthIndexService.getInfoListByGroupBySbPv(startTime, "pv_health_index_hour", "测点"); List<PvHealthIndex> pvHealthIndicesSb = pvHealthIndexService.getInfoListByGroupBySbPv(startTime, "pv_health_index_hour", "测点");
saveBatchPv(pvHealthIndicesSb, "pv_health_index_hour", recDate, WarningPeriodEnum.HOUR.getName(), pvLevelListSb); saveBatchPv(pvHealthIndicesSb, "pv_health_index_hour", recDate, WarningPeriodEnum.HOUR.getName(), pvLevelListSb);
saveBatchPvNew(pvHealthIndicesSb, "pv_health_index_hour_new", recDate, WarningPeriodEnum.HOUR.getName(), pvLevelListSb);
// 子阵 // 子阵
List<IdxBizPvHealthLevel> pvLevelListZz = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "子阵").last("limit 4")); List<IdxBizPvHealthLevel> pvLevelListZz = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "子阵").last("limit 4"));
List<PvHealthIndex> pvHealthIndicesZz = pvHealthIndexService.getInfoListByGroupByZzPv(startTime, "pv_health_index_hour", "设备"); List<PvHealthIndex> pvHealthIndicesZz = pvHealthIndexService.getInfoListByGroupByZzPv(startTime, "pv_health_index_hour", "设备");
saveBatchPv(pvHealthIndicesZz, "pv_health_index_hour", recDate, WarningPeriodEnum.HOUR.getName(), pvLevelListZz); saveBatchPv(pvHealthIndicesZz, "pv_health_index_hour", recDate, WarningPeriodEnum.HOUR.getName(), pvLevelListZz);
saveBatchPvNew(pvHealthIndicesZz, "pv_health_index_hour_new", recDate, WarningPeriodEnum.HOUR.getName(), pvLevelListZz);
// 场站 // 场站
List<IdxBizPvHealthLevel> pvLevelListCz = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "场站").last("limit 4")); List<IdxBizPvHealthLevel> pvLevelListCz = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "场站").last("limit 4"));
List<PvHealthIndex> pvHealthIndicesCz = pvHealthIndexService.getInfoListByGroupByCzPv(startTime, "pv_health_index_hour", "子阵"); List<PvHealthIndex> pvHealthIndicesCz = pvHealthIndexService.getInfoListByGroupByCzPv(startTime, "pv_health_index_hour", "子阵");
saveBatchPv(pvHealthIndicesCz, "pv_health_index_hour", recDate, WarningPeriodEnum.HOUR.getName(), pvLevelListCz); saveBatchPv(pvHealthIndicesCz, "pv_health_index_hour", recDate, WarningPeriodEnum.HOUR.getName(), pvLevelListCz);
saveBatchPvNew(pvHealthIndicesCz, "pv_health_index_hour_new", recDate, WarningPeriodEnum.HOUR.getName(), pvLevelListCz);
// 区域 // 区域
List<HealthIndexDTO> healthIndexQyDTOS = fanHealthIndexService.getInfoListByGroupByQy(startTime,"fan_health_index_hour", "pv_health_index_hour","场站"); List<HealthIndexDTO> healthIndexQyDTOS = fanHealthIndexService.getInfoListByGroupByQy(startTime,"fan_health_index_hour", "pv_health_index_hour","场站");
...@@ -164,6 +169,7 @@ public class TdengineTimeServiceImpl { ...@@ -164,6 +169,7 @@ public class TdengineTimeServiceImpl {
List<IdxBizPvHealthLevel> pvLevelListQy = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "片区").last("limit 4")); List<IdxBizPvHealthLevel> pvLevelListQy = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "片区").last("limit 4"));
List<PvHealthIndex> pvHealthIndicesQy = healthIndexQyDTOS.stream().map(o -> fanHealthIndexService.toPvHealthIndex(o)).collect(Collectors.toList()); List<PvHealthIndex> pvHealthIndicesQy = healthIndexQyDTOS.stream().map(o -> fanHealthIndexService.toPvHealthIndex(o)).collect(Collectors.toList());
saveBatchPv(pvHealthIndicesQy, "pv_health_index_hour", recDate, WarningPeriodEnum.HOUR.getName(), pvLevelListQy); saveBatchPv(pvHealthIndicesQy, "pv_health_index_hour", recDate, WarningPeriodEnum.HOUR.getName(), pvLevelListQy);
saveBatchPvNew(pvHealthIndicesQy, "pv_health_index_hour_new", recDate, WarningPeriodEnum.HOUR.getName(), pvLevelListQy);
// 全域【所有 / 全国】 // 全域【所有 / 全国】
List<HealthIndexDTO> healthIndexQgDTOS = fanHealthIndexService.getInfoListByGroupByQg(startTime, "fan_health_index_hour", "pv_health_index_hour", "片区"); List<HealthIndexDTO> healthIndexQgDTOS = fanHealthIndexService.getInfoListByGroupByQg(startTime, "fan_health_index_hour", "pv_health_index_hour", "片区");
...@@ -174,6 +180,7 @@ public class TdengineTimeServiceImpl { ...@@ -174,6 +180,7 @@ public class TdengineTimeServiceImpl {
List<IdxBizPvHealthLevel> pvLevelListQg = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "全域").last("limit 4")); List<IdxBizPvHealthLevel> pvLevelListQg = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "全域").last("limit 4"));
List<PvHealthIndex> pvHealthIndicesQg = healthIndexQgDTOS.stream().map(o -> fanHealthIndexService.toPvHealthIndex(o)).collect(Collectors.toList()); List<PvHealthIndex> pvHealthIndicesQg = healthIndexQgDTOS.stream().map(o -> fanHealthIndexService.toPvHealthIndex(o)).collect(Collectors.toList());
saveBatchPv(pvHealthIndicesQg, "pv_health_index_hour", recDate, WarningPeriodEnum.HOUR.getName(), pvLevelListQg); saveBatchPv(pvHealthIndicesQg, "pv_health_index_hour", recDate, WarningPeriodEnum.HOUR.getName(), pvLevelListQg);
saveBatchPvNew(pvHealthIndicesQg, "pv_health_index_hour_new", recDate, WarningPeriodEnum.HOUR.getName(), pvLevelListQg);
//预警生成 //预警生成
healthStatusIndicatorServiceImpl.healthWarningHour(); healthStatusIndicatorServiceImpl.healthWarningHour();
...@@ -222,18 +229,22 @@ public class TdengineTimeServiceImpl { ...@@ -222,18 +229,22 @@ public class TdengineTimeServiceImpl {
List<IdxBizPvHealthLevel> pvlevelList = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "测点").last("limit 4")); List<IdxBizPvHealthLevel> pvlevelList = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "测点").last("limit 4"));
List<PvHealthIndex> pvHealthIndices = pvHealthIndexMapper.getInfoListByGroupByCdPv(startTime, "pv_health_index_hour", "测点"); List<PvHealthIndex> pvHealthIndices = pvHealthIndexMapper.getInfoListByGroupByCdPv(startTime, "pv_health_index_hour", "测点");
saveBatchPv(pvHealthIndices, "pv_health_index_day", recDate, WarningPeriodEnum.DAY.getName(), pvlevelList); saveBatchPv(pvHealthIndices, "pv_health_index_day", recDate, WarningPeriodEnum.DAY.getName(), pvlevelList);
saveBatchPvNew(pvHealthIndices, "pv_health_index_day_new", recDate, WarningPeriodEnum.DAY.getName(), pvlevelList);
// 设备 // 设备
List<IdxBizPvHealthLevel> pvLevelListSb = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "设备").last("limit 4")); List<IdxBizPvHealthLevel> pvLevelListSb = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "设备").last("limit 4"));
List<PvHealthIndex> pvHealthIndicesSb = pvHealthIndexService.getInfoListByGroupBySbPv(startTime, "pv_health_index_day", "测点"); List<PvHealthIndex> pvHealthIndicesSb = pvHealthIndexService.getInfoListByGroupBySbPv(startTime, "pv_health_index_day", "测点");
saveBatchPv(pvHealthIndicesSb, "pv_health_index_day", recDate, WarningPeriodEnum.DAY.getName(), pvLevelListSb); saveBatchPv(pvHealthIndicesSb, "pv_health_index_day", recDate, WarningPeriodEnum.DAY.getName(), pvLevelListSb);
saveBatchPvNew(pvHealthIndicesSb, "pv_health_index_day_new", recDate, WarningPeriodEnum.DAY.getName(), pvLevelListSb);
// 子阵 // 子阵
List<IdxBizPvHealthLevel> pvLevelListZz = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "子阵").last("limit 4")); List<IdxBizPvHealthLevel> pvLevelListZz = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "子阵").last("limit 4"));
List<PvHealthIndex> pvHealthIndicesZz = pvHealthIndexService.getInfoListByGroupByZzPv(startTime, "pv_health_index_day", "设备"); List<PvHealthIndex> pvHealthIndicesZz = pvHealthIndexService.getInfoListByGroupByZzPv(startTime, "pv_health_index_day", "设备");
saveBatchPv(pvHealthIndicesZz, "pv_health_index_day", recDate, WarningPeriodEnum.DAY.getName(), pvLevelListZz); saveBatchPv(pvHealthIndicesZz, "pv_health_index_day", recDate, WarningPeriodEnum.DAY.getName(), pvLevelListZz);
saveBatchPvNew(pvHealthIndicesZz, "pv_health_index_day_new", recDate, WarningPeriodEnum.DAY.getName(), pvLevelListZz);
// 场站 // 场站
List<IdxBizPvHealthLevel> pvLevelListCz = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "场站").last("limit 4")); List<IdxBizPvHealthLevel> pvLevelListCz = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "场站").last("limit 4"));
List<PvHealthIndex> pvHealthIndicesCz = pvHealthIndexService.getInfoListByGroupByCzPv(startTime, "pv_health_index_day", "子阵"); List<PvHealthIndex> pvHealthIndicesCz = pvHealthIndexService.getInfoListByGroupByCzPv(startTime, "pv_health_index_day", "子阵");
saveBatchPv(pvHealthIndicesCz, "pv_health_index_day", recDate, WarningPeriodEnum.DAY.getName(), pvLevelListCz); saveBatchPv(pvHealthIndicesCz, "pv_health_index_day", recDate, WarningPeriodEnum.DAY.getName(), pvLevelListCz);
saveBatchPvNew(pvHealthIndicesCz, "pv_health_index_day_new", recDate, WarningPeriodEnum.DAY.getName(), pvLevelListCz);
// 区域 // 区域
List<HealthIndexDTO> healthIndexQyDTOS = fanHealthIndexService.getInfoListByGroupByQy(startTime,"fan_health_index_day", "pv_health_index_day","场站"); List<HealthIndexDTO> healthIndexQyDTOS = fanHealthIndexService.getInfoListByGroupByQy(startTime,"fan_health_index_day", "pv_health_index_day","场站");
...@@ -244,6 +255,7 @@ public class TdengineTimeServiceImpl { ...@@ -244,6 +255,7 @@ public class TdengineTimeServiceImpl {
List<IdxBizPvHealthLevel> pvLevelListQy = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "片区").last("limit 4")); List<IdxBizPvHealthLevel> pvLevelListQy = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "片区").last("limit 4"));
List<PvHealthIndex> pvHealthIndicesQy = healthIndexQyDTOS.stream().map(o -> fanHealthIndexService.toPvHealthIndex(o)).collect(Collectors.toList()); List<PvHealthIndex> pvHealthIndicesQy = healthIndexQyDTOS.stream().map(o -> fanHealthIndexService.toPvHealthIndex(o)).collect(Collectors.toList());
saveBatchPv(pvHealthIndicesQy, "pv_health_index_day", recDate, WarningPeriodEnum.DAY.getName(), pvLevelListQy); saveBatchPv(pvHealthIndicesQy, "pv_health_index_day", recDate, WarningPeriodEnum.DAY.getName(), pvLevelListQy);
saveBatchPvNew(pvHealthIndicesQy, "pv_health_index_day_new", recDate, WarningPeriodEnum.DAY.getName(), pvLevelListQy);
// 全域【所有 / 全国】 // 全域【所有 / 全国】
List<HealthIndexDTO> healthIndexQgDTOS = fanHealthIndexService.getInfoListByGroupByQg(startTime, "fan_health_index_day", "pv_health_index_day", "片区"); List<HealthIndexDTO> healthIndexQgDTOS = fanHealthIndexService.getInfoListByGroupByQg(startTime, "fan_health_index_day", "pv_health_index_day", "片区");
...@@ -254,6 +266,7 @@ public class TdengineTimeServiceImpl { ...@@ -254,6 +266,7 @@ public class TdengineTimeServiceImpl {
List<IdxBizPvHealthLevel> pvLevelListQg = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "全域").last("limit 4")); List<IdxBizPvHealthLevel> pvLevelListQg = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "全域").last("limit 4"));
List<PvHealthIndex> pvHealthIndicesQg = healthIndexQgDTOS.stream().map(o -> fanHealthIndexService.toPvHealthIndex(o)).collect(Collectors.toList()); List<PvHealthIndex> pvHealthIndicesQg = healthIndexQgDTOS.stream().map(o -> fanHealthIndexService.toPvHealthIndex(o)).collect(Collectors.toList());
saveBatchPv(pvHealthIndicesQg, "pv_health_index_day", recDate, WarningPeriodEnum.DAY.getName(), pvLevelListQg); saveBatchPv(pvHealthIndicesQg, "pv_health_index_day", recDate, WarningPeriodEnum.DAY.getName(), pvLevelListQg);
saveBatchPvNew(pvHealthIndicesQg, "pv_health_index_day_new", recDate, WarningPeriodEnum.DAY.getName(), pvLevelListQg);
//预警生成 //预警生成
healthStatusIndicatorServiceImpl.healthWarningDay(); healthStatusIndicatorServiceImpl.healthWarningDay();
...@@ -301,6 +314,29 @@ public class TdengineTimeServiceImpl { ...@@ -301,6 +314,29 @@ public class TdengineTimeServiceImpl {
} }
} }
@Async
private void saveBatchFanNew(List<FanHealthIndex> fanHealthIndices,
String tableName,
String recDate,
String analysisType,
List<IdxBizFanHealthLevel> levelList) {
ArrayList<FanHealthIndex> newList = new ArrayList<>();
for (int i = 0; i < fanHealthIndices.size(); i++) {
FanHealthIndex fanHealthIndex = fanHealthIndices.get(i);
fanHealthIndex.setRecDate(recDate);
fanHealthIndex.setAnalysisTime(recDate);
fanHealthIndex.setAnalysisType(analysisType);
fanHealthIndex.setHealthLevel(getHealthLevelByScore(levelList, fanHealthIndex.getHealthIndex()));
//分批次处理
newList.add(fanHealthIndex);//循环将数据填入载体list
if (500 == newList.size() || i == fanHealthIndices.size() - 1) { //载体list达到要求,进行批量操作
//调用批量插入
fanHealthIndexMapper.saveBatchHealthIndexListNew(newList, tableName, analysisType);
newList.clear();//每次批量操作后,清空载体list,等待下次的数据填入
}
}
}
/** /**
* 光伏 - 按时刻生成设备、子阵、场站和片区数据 * 光伏 - 按时刻生成设备、子阵、场站和片区数据
*/ */
...@@ -310,14 +346,17 @@ public class TdengineTimeServiceImpl { ...@@ -310,14 +346,17 @@ public class TdengineTimeServiceImpl {
List<IdxBizPvHealthLevel> levelListSb = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "设备").last("limit 4")); List<IdxBizPvHealthLevel> levelListSb = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "设备").last("limit 4"));
List<PvHealthIndex> fanHealthIndicesSb = pvHealthIndexService.getInfoListByGroupBySbPv(startTime, "pv_health_index_moment", "测点"); List<PvHealthIndex> fanHealthIndicesSb = pvHealthIndexService.getInfoListByGroupBySbPv(startTime, "pv_health_index_moment", "测点");
saveBatchPv(fanHealthIndicesSb, "pv_health_index_moment", recDate, WarningPeriodEnum.MINUTES.getName(), levelListSb); saveBatchPv(fanHealthIndicesSb, "pv_health_index_moment", recDate, WarningPeriodEnum.MINUTES.getName(), levelListSb);
saveBatchPvNew(fanHealthIndicesSb, "pv_health_index_moment_new", recDate, WarningPeriodEnum.MINUTES.getName(), levelListSb);
// 子阵 // 子阵
List<IdxBizPvHealthLevel> levelListZz = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "子阵").last("limit 4")); List<IdxBizPvHealthLevel> levelListZz = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "子阵").last("limit 4"));
List<PvHealthIndex> fanHealthIndicesZz = pvHealthIndexService.getInfoListByGroupByZzPv(startTime, "pv_health_index_moment", "设备"); List<PvHealthIndex> fanHealthIndicesZz = pvHealthIndexService.getInfoListByGroupByZzPv(startTime, "pv_health_index_moment", "设备");
saveBatchPv(fanHealthIndicesZz, "pv_health_index_moment", recDate, WarningPeriodEnum.MINUTES.getName(), levelListZz); saveBatchPv(fanHealthIndicesZz, "pv_health_index_moment", recDate, WarningPeriodEnum.MINUTES.getName(), levelListZz);
saveBatchPvNew(fanHealthIndicesZz, "pv_health_index_moment_new", recDate, WarningPeriodEnum.MINUTES.getName(), levelListZz);
// 场站 // 场站
List<IdxBizPvHealthLevel> levelListCz = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "场站").last("limit 4")); List<IdxBizPvHealthLevel> levelListCz = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "场站").last("limit 4"));
List<PvHealthIndex> fanHealthIndicesCz = pvHealthIndexService.getInfoListByGroupByCzPv(startTime, "pv_health_index_moment", "子阵"); List<PvHealthIndex> fanHealthIndicesCz = pvHealthIndexService.getInfoListByGroupByCzPv(startTime, "pv_health_index_moment", "子阵");
saveBatchPv(fanHealthIndicesCz, "pv_health_index_moment", recDate, WarningPeriodEnum.MINUTES.getName(), levelListCz); saveBatchPv(fanHealthIndicesCz, "pv_health_index_moment", recDate, WarningPeriodEnum.MINUTES.getName(), levelListCz);
saveBatchPvNew(fanHealthIndicesCz, "pv_health_index_moment_new", recDate, WarningPeriodEnum.MINUTES.getName(), levelListCz);
// // 片区 // // 片区
// List<IdxBizPvHealthLevel> levelListQy = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "片区").last("limit 4")); // List<IdxBizPvHealthLevel> levelListQy = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "片区").last("limit 4"));
// List<PvHealthIndex> fanHealthIndicesQy = pvHealthIndexService.getInfoListByGroupByQyPv(startTime, "pv_health_index_moment", "场站"); // List<PvHealthIndex> fanHealthIndicesQy = pvHealthIndexService.getInfoListByGroupByQyPv(startTime, "pv_health_index_moment", "场站");
...@@ -447,7 +486,28 @@ public class TdengineTimeServiceImpl { ...@@ -447,7 +486,28 @@ public class TdengineTimeServiceImpl {
} }
} }
} }
@Async
private void saveBatchPvNew(List<PvHealthIndex> pvHealthIndices,
String tableName,
String recDate,
String analysisType,
List<IdxBizPvHealthLevel> levelList) {
ArrayList<PvHealthIndex> newList = new ArrayList<>();
for (int i = 0; i < pvHealthIndices.size(); i++) {
PvHealthIndex item = pvHealthIndices.get(i);
item.setRecDate(recDate);
item.setAnalysisTime(recDate);
item.setAnalysisType(analysisType);
item.setHealthLevel(getHealthLevelByScorePv(levelList, item.getHealthIndex()));
//分批次处理
newList.add(item);//循环将数据填入载体list
if (500 == newList.size() || i == pvHealthIndices.size() - 1) { //载体list达到要求,进行批量操作
//调用批量插入
pvHealthIndexMapper.saveBatchHealthIndexListNew(newList, tableName, analysisType);
newList.clear();//每次批量操作后,清空载体list,等待下次的数据填入
}
}
}
public void insertMomentDataTest(String startTime) { public void insertMomentDataTest(String startTime) {
//s 489分钟 为 8小时 + 19分钟 //s 489分钟 为 8小时 + 19分钟
...@@ -516,6 +576,7 @@ public class TdengineTimeServiceImpl { ...@@ -516,6 +576,7 @@ public class TdengineTimeServiceImpl {
List<IdxBizPvHealthLevel> pvLevelListQy = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "片区").last("limit 4")); List<IdxBizPvHealthLevel> pvLevelListQy = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "片区").last("limit 4"));
List<PvHealthIndex> pvHealthIndicesQy = healthIndexQyDTOS.stream().map(o -> fanHealthIndexService.toPvHealthIndex(o)).collect(Collectors.toList()); List<PvHealthIndex> pvHealthIndicesQy = healthIndexQyDTOS.stream().map(o -> fanHealthIndexService.toPvHealthIndex(o)).collect(Collectors.toList());
saveBatchPv(pvHealthIndicesQy, "pv_health_index_moment", recDate, WarningPeriodEnum.MINUTES.getName(), pvLevelListQy); saveBatchPv(pvHealthIndicesQy, "pv_health_index_moment", recDate, WarningPeriodEnum.MINUTES.getName(), pvLevelListQy);
saveBatchPvNew(pvHealthIndicesQy, "pv_health_index_moment_new", recDate, WarningPeriodEnum.MINUTES.getName(), pvLevelListQy);
// 全域【所有 / 全国】 // 全域【所有 / 全国】
List<HealthIndexDTO> healthIndexQgDTOS = fanHealthIndexService.getInfoListByGroupByQg(startTime, "fan_health_index_moment", "pv_health_index_moment", "片区"); List<HealthIndexDTO> healthIndexQgDTOS = fanHealthIndexService.getInfoListByGroupByQg(startTime, "fan_health_index_moment", "pv_health_index_moment", "片区");
...@@ -526,6 +587,7 @@ public class TdengineTimeServiceImpl { ...@@ -526,6 +587,7 @@ public class TdengineTimeServiceImpl {
List<IdxBizPvHealthLevel> pvLevelListQg = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "全域").last("limit 4")); List<IdxBizPvHealthLevel> pvLevelListQg = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "全域").last("limit 4"));
List<PvHealthIndex> pvHealthIndicesQg = healthIndexQgDTOS.stream().map(o -> fanHealthIndexService.toPvHealthIndex(o)).collect(Collectors.toList()); List<PvHealthIndex> pvHealthIndicesQg = healthIndexQgDTOS.stream().map(o -> fanHealthIndexService.toPvHealthIndex(o)).collect(Collectors.toList());
saveBatchPv(pvHealthIndicesQg, "pv_health_index_moment", recDate, WarningPeriodEnum.MINUTES.getName(), pvLevelListQg); saveBatchPv(pvHealthIndicesQg, "pv_health_index_moment", recDate, WarningPeriodEnum.MINUTES.getName(), pvLevelListQg);
saveBatchPvNew(pvHealthIndicesQg, "pv_health_index_moment_new", recDate, WarningPeriodEnum.MINUTES.getName(), pvLevelListQg);
} }
public void insertMomentDataAllTest(String startTime) throws ParseException { public void insertMomentDataAllTest(String startTime) throws ParseException {
...@@ -556,5 +618,6 @@ public class TdengineTimeServiceImpl { ...@@ -556,5 +618,6 @@ public class TdengineTimeServiceImpl {
List<IdxBizPvHealthLevel> pvLevelListQg = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "全域").last("limit 4")); List<IdxBizPvHealthLevel> pvLevelListQg = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "全域").last("limit 4"));
List<PvHealthIndex> pvHealthIndicesQg = healthIndexQgDTOS.stream().map(o -> fanHealthIndexService.toPvHealthIndex(o)).collect(Collectors.toList()); List<PvHealthIndex> pvHealthIndicesQg = healthIndexQgDTOS.stream().map(o -> fanHealthIndexService.toPvHealthIndex(o)).collect(Collectors.toList());
saveBatchPv(pvHealthIndicesQg, "pv_health_index_day", recDate, WarningPeriodEnum.DAY.getName(), pvLevelListQg); saveBatchPv(pvHealthIndicesQg, "pv_health_index_day", recDate, WarningPeriodEnum.DAY.getName(), pvLevelListQg);
saveBatchPvNew(pvHealthIndicesQg, "pv_health_index_day_new", recDate, WarningPeriodEnum.DAY.getName(), pvLevelListQg);
} }
} }
...@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexDay; ...@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexDay;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -107,4 +108,5 @@ public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> { ...@@ -107,4 +108,5 @@ public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> {
@Param("tableName") String tableName, @Param("tableName") String tableName,
@Param("analysisObjectType") String analysisObjectType); @Param("analysisObjectType") String analysisObjectType);
int saveBatchHealthIndexListNew(@Param("list") List<FanHealthIndex> list, @Param("tableName") String tableName, @Param("analysisType") String analysisType);
} }
...@@ -30,6 +30,7 @@ public interface PvHealthIndexMapper extends BaseMapper<PvHealthIndex> { ...@@ -30,6 +30,7 @@ public interface PvHealthIndexMapper extends BaseMapper<PvHealthIndex> {
List<PvHealthIndex> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subarray")String subarray, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop); List<PvHealthIndex> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subarray")String subarray, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
int saveBatchHealthIndexList(@Param("list") List<PvHealthIndex> list, @Param("tableName") String tableName, @Param("analysisType") String analysisType); int saveBatchHealthIndexList(@Param("list") List<PvHealthIndex> list, @Param("tableName") String tableName, @Param("analysisType") String analysisType);
int saveBatchHealthIndexListNew(@Param("list") List<PvHealthIndex> list, @Param("tableName") String tableName, @Param("analysisType") String analysisType);
// int saveBatchHealthIndexLatestInfo(@Param("list") List<PvHealthIndex> list, @Param("tableName") String tableName); // int saveBatchHealthIndexLatestInfo(@Param("list") List<PvHealthIndex> list, @Param("tableName") String tableName);
......
...@@ -554,4 +554,35 @@ ...@@ -554,4 +554,35 @@
analysis_obj_type = #{analysisObjectType} analysis_obj_type = #{analysisObjectType}
and ts > #{startTime} and ts > #{startTime}
</select> </select>
<insert id="saveBatchHealthIndexListNew" >
insert into
${tableName}
using fan_health_index_data_new TAGS (#{analysisType})
values
<foreach collection="list" separator="," item="item" index="index">
(
now,
#{item.recDate, jdbcType=VARCHAR},
#{item.analysisObjType, jdbcType=VARCHAR},
#{item.analysisObjSeq, jdbcType=VARCHAR},
#{item.weight, jdbcType=FLOAT},
#{item.healthIndex, jdbcType=FLOAT},
#{item.healthLevel, jdbcType=VARCHAR},
#{item.analysisStartTime, jdbcType=VARCHAR},
#{item.analysisEndTime, jdbcType=VARCHAR},
#{item.area, jdbcType=VARCHAR},
#{item.station, jdbcType=VARCHAR},
#{item.subSystem, jdbcType=VARCHAR},
#{item.number, jdbcType=VARCHAR},
#{item.equipmentName, jdbcType=VARCHAR},
#{item.gatewayId, jdbcType=VARCHAR},
#{item.indexAddress, jdbcType=VARCHAR},
#{item.anomaly, jdbcType=FLOAT},
#{item.pointName, jdbcType=VARCHAR},
#{item.analysisTime, jdbcType=VARCHAR},
#{item.kks, jdbcType=VARCHAR},
#{item.orgCode, jdbcType=VARCHAR}
)
</insert>
</mapper> </mapper>
...@@ -318,4 +318,36 @@ ...@@ -318,4 +318,36 @@
analysis_obj_type = #{analysisObjectType} analysis_obj_type = #{analysisObjectType}
and ts > #{startTime} and ts > #{startTime}
</select> </select>
<insert id="saveBatchHealthIndexListNew">
insert into ${tableName}
using pv_health_index_data_new TAGS (#{analysisType})
values
<foreach collection="list" separator="," item="item" index="index">
(
now,
#{item.recDate, jdbcType=VARCHAR},
#{item.analysisObjType, jdbcType=VARCHAR},
#{item.analysisObjSeq, jdbcType=VARCHAR},
#{item.weight, jdbcType=FLOAT},
#{item.healthIndex, jdbcType=FLOAT},
#{item.healthLevel, jdbcType=VARCHAR},
#{item.analysisStartTime, jdbcType=VARCHAR},
#{item.analysisEndTime, jdbcType=VARCHAR},
#{item.area, jdbcType=VARCHAR},
#{item.station, jdbcType=VARCHAR},
#{item.subarray, jdbcType=VARCHAR},
#{item.manufacturer, jdbcType=VARCHAR},
#{item.deviceType, jdbcType=VARCHAR},
#{item.equipmentName, jdbcType=VARCHAR},
#{item.gatewayId, jdbcType=VARCHAR},
#{item.indexAddress, jdbcType=VARCHAR},
#{item.anomaly, jdbcType=FLOAT},
#{item.pointName, jdbcType=VARCHAR},
#{item.analysisTime, jdbcType=VARCHAR},
#{item.kks, jdbcType=VARCHAR},
#{item.orgCode, jdbcType=VARCHAR}
)
</foreach>
</insert>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment