| | |
| | | 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)); |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |