| | |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | public List<DataValueVO> completionData(int length, List<DataValueVO> dataEntityList, Date startTime, Date endTime, String paramId,String paramType) { |
| | | public List<DataValueVO> completionData(int length, List<DataValueVO> dataEntityList, Date startTime, Date endTime, |
| | | String paramId, String paramType) { |
| | | if (CollectionUtils.isEmpty(dataEntityList) || length == dataEntityList.size()) { |
| | | return dataEntityList; |
| | | }else if (length < dataEntityList.size()){ |
| | | return dataEntityList.subList(dataEntityList.size()-length,dataEntityList.size()); |
| | | } else if (length < dataEntityList.size()) { |
| | | return dataEntityList.subList(dataEntityList.size() - length, dataEntityList.size()); |
| | | } |
| | | |
| | | List<DataValueVO> completionDataEntityList = new ArrayList<>(); |
| | |
| | | long mins = 0L; |
| | | |
| | | switch (ModelParamType.getEumByCode(paramType)) { |
| | | case PREDICTITEM: |
| | | case NORMALITEM: |
| | | case MERGEITEM: |
| | | // 预测值 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(startTime); |
| | | calendar.set(Calendar.HOUR_OF_DAY,0); |
| | | calendar.set(Calendar.MINUTE,0); |
| | | calendar.set(Calendar.SECOND,0); |
| | | calendar.add(Calendar.DAY_OF_YEAR,1); |
| | | calendar.set(Calendar.HOUR_OF_DAY, 0); |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.add(Calendar.DAY_OF_YEAR, 1); |
| | | startTime = calendar.getTime(); |
| | | start = startTime.getTime(); |
| | | |
| | | calendar.setTime(endTime); |
| | | calendar.set(Calendar.HOUR_OF_DAY,0); |
| | | calendar.set(Calendar.MINUTE,0); |
| | | calendar.set(Calendar.SECOND,0); |
| | | calendar.set(Calendar.HOUR_OF_DAY, 0); |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | endTime = calendar.getTime(); |
| | | end = endTime.getTime(); |
| | | |
| | | |
| | | oneMin = 24 * 60 * 60 * 1000; |
| | | mins = ((end - start) / oneMin); |
| | |
| | | // 测点值 |
| | | ApiPointDTO dataPoint = dataPointApi.getInfoById(paramId); |
| | | oneMin = 1000L * DataPointFreqEnum.getEumByCode(dataPoint.getMinfreqid()).getValue(); |
| | | |
| | | // 设置时间偏移量 |
| | | start = start - (start % oneMin) + oneMin; |
| | | end = end - (end % oneMin) + oneMin; |
| | | |
| | | |
| | | mins = ((end - start) / oneMin); |
| | | break; |
| | | case IND: |
| | |
| | | oneMin = 24 * 60 * 60 * 1000; |
| | | Calendar calendar2 = Calendar.getInstance(); |
| | | calendar2.setTime(startTime); |
| | | calendar2.set(Calendar.HOUR_OF_DAY,0); |
| | | calendar2.set(Calendar.MINUTE,0); |
| | | calendar2.set(Calendar.SECOND,0); |
| | | calendar2.set(Calendar.HOUR_OF_DAY, 0); |
| | | calendar2.set(Calendar.MINUTE, 0); |
| | | calendar2.set(Calendar.SECOND, 0); |
| | | start = calendar2.getTime().getTime(); |
| | | |
| | | calendar2.setTime(endTime); |
| | | calendar2.set(Calendar.HOUR_OF_DAY,0); |
| | | calendar2.set(Calendar.MINUTE,0); |
| | | calendar2.set(Calendar.SECOND,0); |
| | | calendar2.set(Calendar.HOUR_OF_DAY, 0); |
| | | calendar2.set(Calendar.MINUTE, 0); |
| | | calendar2.set(Calendar.SECOND, 0); |
| | | end = calendar2.getTime().getTime(); |
| | | |
| | | |
| | | mins = ((end - start) / oneMin); |
| | | break; |
| | | default: |
| | |
| | | |
| | | //找出缺少项 |
| | | Map<Long, Double> dataMap = new LinkedHashMap<>(); |
| | | for (int i = 0; i < mins; i ++) { |
| | | for (int i = 0; i < mins; i++) { |
| | | Long key = start + oneMin * i; |
| | | Double value = sourceDataMap.get(key); |
| | | dataMap.put(key, value); |
| | |
| | | } else if (item.getValue() == null) { |
| | | item.setValue(lastItem.getValue()); |
| | | } |
| | | k ++; |
| | | k++; |
| | | lastItem = item; |
| | | |
| | | DataValueVO dataEntity = new DataValueVO(); |