| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author: LiuS |
| | |
| | | List<MdcEquipmentRunningSection> mdcEquipmentRunningSections = mdcEquipmentRunningSectionService.findAlarmList(vo); |
| | | Map<String, MdcAlarmAnalyzeDto> map = new HashMap<>(); |
| | | for (MdcEquipmentRunningSection mdcEquipmentRunningSection : mdcEquipmentRunningSections) { |
| | | if (map.containsKey(mdcEquipmentRunningSection.getAlarm())) { |
| | | MdcAlarmAnalyzeDto mdcAlarmAnalyzeDto = map.get(mdcEquipmentRunningSection.getAlarm()); |
| | | mdcAlarmAnalyzeDto.setCount(mdcAlarmAnalyzeDto.getCount() + 1); |
| | | mdcAlarmAnalyzeDto.setTimeCount(mdcAlarmAnalyzeDto.getTimeCount().add(new BigDecimal(mdcEquipmentRunningSection.getDuration()))); |
| | | map.put(mdcEquipmentRunningSection.getAlarm(), mdcAlarmAnalyzeDto); |
| | | } else { |
| | | MdcAlarmAnalyzeDto mdcAlarmAnalyzeDto = new MdcAlarmAnalyzeDto(); |
| | | mdcAlarmAnalyzeDto.setAlarmCode(mdcEquipmentRunningSection.getAlarm()); |
| | | mdcAlarmAnalyzeDto.setCount(1); |
| | | mdcAlarmAnalyzeDto.setTimeCount(new BigDecimal(mdcEquipmentRunningSection.getDuration())); |
| | | //查询报警号内容 |
| | | List<MdcEquipment> list = mdcEquipmentService.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, mdcEquipmentRunningSection.getEquipmentId())); |
| | | List<MdcAlarmInfo> mdcAlarmInfo = mdcAlarmInfoService.list(new LambdaQueryWrapper<MdcAlarmInfo>().eq(MdcAlarmInfo::getDriveType, list.get(0).getDriveType()).eq(MdcAlarmInfo::getAlarmCode, mdcEquipmentRunningSection.getAlarm()).eq(MdcAlarmInfo::getIsUse, 0)); |
| | | if (mdcAlarmInfo != null && !mdcAlarmInfo.isEmpty()) { |
| | | mdcAlarmAnalyzeDto.setAlarmContent(mdcAlarmInfo.get(0).getAlarmContent()); |
| | | if (mdcEquipmentRunningSection.getDuration() > 300) { |
| | | if (map.containsKey(mdcEquipmentRunningSection.getAlarm())) { |
| | | MdcAlarmAnalyzeDto mdcAlarmAnalyzeDto = map.get(mdcEquipmentRunningSection.getAlarm()); |
| | | mdcAlarmAnalyzeDto.setCount(mdcAlarmAnalyzeDto.getCount() + 1); |
| | | mdcAlarmAnalyzeDto.setTimeCount(mdcAlarmAnalyzeDto.getTimeCount().add(new BigDecimal(mdcEquipmentRunningSection.getDuration()))); |
| | | map.put(mdcEquipmentRunningSection.getAlarm(), mdcAlarmAnalyzeDto); |
| | | } else { |
| | | MdcAlarmAnalyzeDto mdcAlarmAnalyzeDto = new MdcAlarmAnalyzeDto(); |
| | | mdcAlarmAnalyzeDto.setAlarmCode(mdcEquipmentRunningSection.getAlarm()); |
| | | mdcAlarmAnalyzeDto.setCount(1); |
| | | mdcAlarmAnalyzeDto.setTimeCount(new BigDecimal(mdcEquipmentRunningSection.getDuration())); |
| | | //查询报警号内容 |
| | | List<MdcEquipment> list = mdcEquipmentService.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, mdcEquipmentRunningSection.getEquipmentId())); |
| | | List<MdcAlarmInfo> mdcAlarmInfo = mdcAlarmInfoService.list(new LambdaQueryWrapper<MdcAlarmInfo>().eq(MdcAlarmInfo::getDriveType, list.get(0).getDriveType()).eq(MdcAlarmInfo::getAlarmCode, mdcEquipmentRunningSection.getAlarm()).eq(MdcAlarmInfo::getIsUse, 0)); |
| | | if (mdcAlarmInfo != null && !mdcAlarmInfo.isEmpty()) { |
| | | mdcAlarmAnalyzeDto.setAlarmContent(mdcAlarmInfo.get(0).getAlarmContent()); |
| | | } |
| | | map.put(mdcEquipmentRunningSection.getAlarm(), mdcAlarmAnalyzeDto); |
| | | } |
| | | map.put(mdcEquipmentRunningSection.getAlarm(), mdcAlarmAnalyzeDto); |
| | | } |
| | | } |
| | | if (!map.isEmpty()) { |
| | |
| | | } |
| | | String startDate = DateUtils.format(DateUtils.toDate(vo.getStartDate(), DateUtils.STRDATE), DateUtils.STR_DATE) + " 00:00:00"; |
| | | String endDate = DateUtils.format(DateUtils.addDays(DateUtils.toDate(vo.getEndDate(), DateUtils.STRDATE), 1), DateUtils.STR_DATE) + " 00:00:00"; |
| | | return mdcEquipmentRunningSectionService.selectAlarmList(vo, startDate, endDate); |
| | | List<MdcAlarmListDto> alarmList = mdcEquipmentRunningSectionService.selectAlarmList(vo, startDate, endDate); |
| | | alarmList = alarmList.stream().filter(mdcAlarmListDto -> mdcAlarmListDto.getDuration() > 300).collect(Collectors.toList()); |
| | | return alarmList; |
| | | } |
| | | } |