| | |
| | | list = notExecuteData; |
| | | } |
| | | } else { |
| | | if (notExecuteData != null && !notExecuteData.isEmpty()) |
| | | if (notExecuteData != null && !notExecuteData.isEmpty()) { |
| | | list.addAll(notExecuteData); |
| | | } |
| | | } |
| | | } else { |
| | | LambdaQueryWrapper<MdcEquipmentRunningSection> queryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 计算一段时间内的数据 |
| | | */ |
| | | @Override |
| | | public List<MdcEquipmentRunningSection> listEquipmentRunningSection(String equipmentid, long start, long end) { |
| | | return this.baseMapper.listEquipmentRunningSection(equipmentid, start, end); |
| | | } |
| | | |
| | | @Override |
| | | public List<MdcEquipmentRunningSection> listRunningSectionFromLog(String equipmentid, long start, long end) { |
| | | if (StringUtils.isBlank(equipmentid) || start <= 0 || end <= 0) { |
| | | return null; |
| | | } |
| | | Date startTime = DateUtils.toDate(DateUtils.longToDate(start), DateUtils.STR_DATE_TIME_SMALL); |
| | | Date endTime = DateUtils.toDate(DateUtils.longToDate(end), DateUtils.STR_DATE_TIME_SMALL); |
| | | EquipmentLog equipmentLog = equipmentLogService.getRow(equipmentid, startTime); |
| | | if (equipmentLog == null) { |
| | | return null; |
| | | } |
| | | List<EquipmentLog> logList = new ArrayList<>(); |
| | | EquipmentLog equipmentOne = new EquipmentLog(); |
| | | equipmentOne.setEquipmentId(equipmentid); |
| | | equipmentOne.setOporation(equipmentLog.getOporation()); |
| | | equipmentOne.setCollectTime(startTime); |
| | | logList.add(equipmentOne); |
| | | List<EquipmentLog> logListLast = equipmentLogService.findEquipmentLogByEndTime(equipmentid, startTime); |
| | | if (logListLast == null || logListLast.isEmpty()) { |
| | | EquipmentLog two = new EquipmentLog(); |
| | | two.setEquipmentId(equipmentid); |
| | | two.setOporation(equipmentLog.getOporation()); |
| | | two.setCollectTime(endTime); |
| | | logList.add(two); |
| | | } else { |
| | | for (EquipmentLog log : logListLast) { |
| | | if (log.getCollectTime().getTime() <= endTime.getTime()) { |
| | | logList.add(log); |
| | | } |
| | | } |
| | | } |
| | | if (logList.get(logList.size() - 1).getCollectTime().getTime() < endTime.getTime()) { |
| | | EquipmentLog two = new EquipmentLog(); |
| | | two.setEquipmentId(equipmentid); |
| | | two.setOporation(logList.get(logList.size() - 1).getOporation()); |
| | | two.setCollectTime(endTime); |
| | | logList.add(two); |
| | | } |
| | | //点数据转为段数据 |
| | | List<MdcEquipmentRunningSection> erts = parseLogToRunningTrace(logList); |
| | | if (erts.isEmpty()) { |
| | | return Collections.emptyList(); |
| | | } |
| | | //整合加工和待机时间小于n秒的数据 |
| | | erts = mergeLessMinTimeRecords(erts, null); |
| | | List<MdcEquipmentRunningSection> running = mergeRunningTrace(erts); |
| | | if (running != null || !running.isEmpty()) { |
| | | this.ergodicTrim(running); |
| | | } |
| | | return running; |
| | | } |
| | | |
| | | private Map<String, List<MdcEquipmentRunningSectionDto>> logCharts(MdcEquipmentRunningSectionVo equipmentRunningSectionVo, String date) { |
| | | Map<String, List<MdcEquipmentRunningSectionDto>> map = new HashMap<>(); |
| | | Map<String, List<MdcEquipmentRunningSectionDto>> map = new HashMap<>(); |
| | | List<MdcEquipmentRunningSectionDto> normal = new ArrayList<>(); |
| | | List<MdcEquipmentRunningSectionDto> waring = new ArrayList<>(); |
| | | //运行 |