| | |
| | | dtos.add(dto); |
| | | } |
| | | } |
| | | return dtos; |
| | | |
| | | List<MdcEquipmentRunningSectionDto> result = new ArrayList<>(); |
| | | //合并相同状态数据 |
| | | for (int i = 0; i < dtos.size() - 1; i++) { |
| | | MdcEquipmentRunningSectionDto mdcEquipmentRunningSectionDto = dtos.get(i); |
| | | MdcEquipmentRunningSectionDto next = dtos.get(i + 1); |
| | | if (mdcEquipmentRunningSectionDto.getStatus().equals(next.getStatus()) && mdcEquipmentRunningSectionDto.getEndTime().equals(next.getStartTime())) { |
| | | MdcEquipmentRunningSectionDto equipmentRunningSectionDto = new MdcEquipmentRunningSectionDto(); |
| | | BeanUtils.copyProperties(mdcEquipmentRunningSectionDto, equipmentRunningSectionDto); |
| | | equipmentRunningSectionDto.setEndTime(next.getEndTime()); |
| | | equipmentRunningSectionDto.setDuration(mdcEquipmentRunningSectionDto.getDuration() + next.getDuration()); |
| | | result.add(equipmentRunningSectionDto); |
| | | i++; |
| | | } else { |
| | | result.add(mdcEquipmentRunningSectionDto); |
| | | } |
| | | } |
| | | if (dtos.size() > 1) { |
| | | MdcEquipmentRunningSectionDto a = dtos.get(dtos.size() - 2); |
| | | MdcEquipmentRunningSectionDto b = dtos.get(dtos.size() - 1); |
| | | if (!a.getStatus().equals(b.getStatus()) && a.getEndTime().equals(b.getStartTime())) { |
| | | result.add(dtos.get(dtos.size() - 1)); |
| | | } |
| | | } else if (dtos.size() == 1){ |
| | | result.addAll(dtos); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | |
| | | //获取running运行的日志记录 |
| | | List<MdcEquipmentRunningSection> list = this.equipmentRunningTracesLog(equipment.getEquipmentid()); |
| | | if (list != null && !list.isEmpty()) { |
| | | List<MdcEquipmentRunningSection> equipList = addSequenceNumber(list); //添加程序号 |
| | | this.ergodicTrim(equipList); |
| | | super.saveBatch(equipList); |
| | | try { |
| | | List<MdcEquipmentRunningSection> equipList = addSequenceNumber(list); //添加程序号 |
| | | this.ergodicTrim(equipList); |
| | | super.saveBatch(equipList); |
| | | } catch (Exception e) { |
| | | log.error("添加程序号出现异常:", e); |
| | | } |
| | | } |
| | | //获取报警的日志记录 |
| | | List<MdcEquipmentRunningSection> errorList = this.equipmentRunningTracesErrorLog(equipment.getEquipmentid()); |
| | |
| | | ert.setStartTime(logList.get(i).getCollectTime()); |
| | | ert.setEndTime(logList.get(i + 1).getCollectTime()); |
| | | ert.setDuration(DateUtils.differentSecond(ert.getStartTime(), ert.getEndTime())); |
| | | // if (ert.getDuration() > 0) { |
| | | |
| | | erts.add(ert); |
| | | // } |
| | | |
| | | } else { |
| | | long count = differentSecond / 86400; |
| | | if (count % 86400 > 0) { |