|
@@ -1,5 +1,6 @@
|
|
|
package com.gyee.wisdom.alarm.sharding.service;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -11,6 +12,7 @@ import com.gyee.wisdom.alarm.sharding.mapper.AlarmHisotryMapper;
|
|
|
import com.gyee.wisdom.alarm.sharding.mapper.AlarmSnapMapper;
|
|
|
import com.gyee.wisdom.alarm.sharding.mapper.FaultHisotryMapper;
|
|
|
import com.gyee.wisdom.alarm.sharding.mapper.FaultSnapMapper;
|
|
|
+import com.gyee.wisdom.alarm.sharding.model.AlarmHome;
|
|
|
import com.gyee.wisdom.alarm.sharding.util.SnowflakeGenerator;
|
|
|
import com.gyee.wisdom.common.utils.DateUtil;
|
|
|
import com.gyee.wisdom.common.utils.StringUtil;
|
|
@@ -513,4 +515,40 @@ public class AlarmSnapService extends ServiceImpl<AlarmSnapMapper, AlarmSnap> {
|
|
|
return alarmSnapMapper.getRecentAlarm(category1, lastUpdateTime);
|
|
|
}
|
|
|
|
|
|
+ public Map<String,List<AlarmHome>> selectAlarmSnapCount(String stationId){
|
|
|
+
|
|
|
+ Map<String,List<AlarmHome>> stringListMap = new HashMap<>();
|
|
|
+ QueryWrapper<AlarmSnap> wrapper = new QueryWrapper<>();
|
|
|
+ if (StringUtil.isNotBlank(stationId))
|
|
|
+ wrapper.eq("STATIONID", stationId);
|
|
|
+ wrapper.eq("ISOPENED",1);
|
|
|
+ List<AlarmSnap> alarmSnaps = baseMapper.selectList(wrapper);
|
|
|
+ if (alarmSnaps.size() > 0){
|
|
|
+ Map<String,List<AlarmSnap>> map = alarmSnaps.stream().collect(Collectors.groupingBy(AlarmSnap::getCategory1));
|
|
|
+ for (Map.Entry<String,List<AlarmSnap>> entry : map.entrySet()) {
|
|
|
+ List<AlarmHome> alarmHomes = new ArrayList<>();
|
|
|
+ for (AlarmSnap alarmSnap : entry.getValue()) {
|
|
|
+ AlarmHome alarmHome = new AlarmHome();
|
|
|
+ alarmHome.setWindpowerstationName(alarmSnap.getStationName());
|
|
|
+ alarmHome.setModelid(alarmSnap.getModelId());
|
|
|
+ alarmHome.setWindturbineid(alarmSnap.getWindturbineId());
|
|
|
+ alarmHome.setStationid(alarmSnap.getStationId());
|
|
|
+ alarmHome.setDescription(alarmSnap.getAlertText());
|
|
|
+ alarmHome.setLastUpdateTime(alarmSnap.getLastUpdateTime());
|
|
|
+ alarmHome.setName(alarmSnap.getAlertText());
|
|
|
+ alarmHomes.add(alarmHome);
|
|
|
+ }
|
|
|
+ stringListMap.put(entry.getKey(), alarmHomes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return stringListMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<AlarmSnap> getAlarmSnap(String key) {
|
|
|
+ QueryWrapper<AlarmSnap> wrapper = new QueryWrapper<>();
|
|
|
+ if (StringUtil.isNotBlank(key))
|
|
|
+ wrapper.eq("WINDTURBINEID", key);
|
|
|
+ List<AlarmSnap> alarmSnaps = baseMapper.selectList(wrapper);
|
|
|
+ return alarmSnaps;
|
|
|
+ }
|
|
|
}
|