|
|
@@ -10,10 +10,7 @@ import com.coffee.bus.entity.BusHospitalEntity;
|
|
|
import com.coffee.bus.enums.DeviceAlarmEnum;
|
|
|
import com.coffee.bus.mapper.BusDeviceAlarmMapper;
|
|
|
import com.coffee.bus.mapper.BusHospitalMapper;
|
|
|
-import com.coffee.bus.service.dto.AlarmQuery;
|
|
|
-import com.coffee.bus.service.dto.DeviceAlarmQuery;
|
|
|
-import com.coffee.bus.service.dto.DeviceAlarmResult;
|
|
|
-import com.coffee.bus.service.dto.DeviceUse;
|
|
|
+import com.coffee.bus.service.dto.*;
|
|
|
import com.coffee.common.crud.BaseService;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -87,27 +84,42 @@ public class LocalBusDeviceAlarmService extends BaseService<BusDeviceAlarmMapper
|
|
|
List<DeviceUse> deviceUseList = new ArrayList<>();
|
|
|
|
|
|
// 获取 报警所有信息数量
|
|
|
- List<DeviceAlarmResult> alarmResults = busDeviceAlarmMapper.selectAlarmCount(query);
|
|
|
+ List<DeviceAlarmCountResult> alarmResults = busDeviceAlarmMapper.selectAlarmCount(query);
|
|
|
|
|
|
- Map<String,List<DeviceAlarmResult>> alarmMap= new HashMap<>();
|
|
|
-
|
|
|
- for (DeviceAlarmResult deviceAlarmResult : alarmResults
|
|
|
+ //处理报警信息
|
|
|
+ Map<String,Map<String,String>> alarmMap= new HashMap<>();
|
|
|
+ for (DeviceAlarmCountResult deviceAlarmResult : alarmResults
|
|
|
) {
|
|
|
- List<DeviceAlarmResult> list = alarmMap.get(deviceAlarmResult.getTenantId());
|
|
|
- if(list == null){
|
|
|
- list = new ArrayList<>();
|
|
|
+ Map<String, String> map = alarmMap.get(deviceAlarmResult.getTenantId());
|
|
|
+ if(map == null){
|
|
|
+ map = new HashMap<>();
|
|
|
}
|
|
|
- list.add(deviceAlarmResult);
|
|
|
- alarmMap.put(deviceAlarmResult.getTenantId(),list);
|
|
|
+ map.put(deviceAlarmResult.toString(),deviceAlarmResult.getAlarmCount());
|
|
|
+ alarmMap.put(deviceAlarmResult.getTenantId(),map);
|
|
|
}
|
|
|
+ // 获取告警信息
|
|
|
+ List<DeviceWarnCountResult> warnResults = busDeviceAlarmMapper.selectWarnCount(query);
|
|
|
+ //处理告警信息
|
|
|
+ for (DeviceWarnCountResult deviceWarnCountResult : warnResults
|
|
|
+ ) {
|
|
|
+ Map<String, String> map = alarmMap.get(deviceWarnCountResult.getTenantId());
|
|
|
+ if(map == null){
|
|
|
+ map = new HashMap<>();
|
|
|
+ }
|
|
|
+ map.put("warnWillFinished",deviceWarnCountResult.getWarnWillFinished());
|
|
|
+ map.put("warnLowBattery",deviceWarnCountResult.getWarnLowBattery());
|
|
|
+ map.put("warnAnalgesicPoor",deviceWarnCountResult.getWarnAnalgesicPoor());
|
|
|
|
|
|
+
|
|
|
+ alarmMap.put(deviceWarnCountResult.getTenantId(),map);
|
|
|
+ }
|
|
|
+ System.out.println("++"+alarmMap.get(1));
|
|
|
// 遍历医院
|
|
|
for (BusHospitalEntity hospital:hospitalEntities
|
|
|
) {
|
|
|
DeviceUse deviceUse = new DeviceUse();
|
|
|
deviceUse.setAddress(hospital.getAddress());
|
|
|
deviceUse.setName(hospital.getName());
|
|
|
- deviceUse.setList(alarmMap.get(hospital.getId()));
|
|
|
deviceUseList.add(deviceUse);
|
|
|
}
|
|
|
|