| | |
| | | break; |
| | | case NORMALITEM: |
| | | case MERGEITEM: |
| | | dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), 60); |
| | | dateTime = calendar.getTime(); |
| | | break; |
| | | case IND: |
| | | dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), 60); |
| | |
| | | calendar.setTime(originalTime); |
| | | switch (ModelParamType.getEumByCode(columnItem.getParamType())) { |
| | | case DATAPOINT: |
| | | ApiPointDTO dataPoint = pointMap.get(columnItem.getParamId()); |
| | | if (dataPoint == null) { |
| | | return null; |
| | | } |
| | | dateTime = calendar.getTime(); |
| | | break; |
| | | case NORMALITEM: |
| | | case MERGEITEM: |
| | | dateTime = calendar.getTime(); |
| | | dateTime = calculateTime(originalTime, false, columnItem.getDataLength(), 60); |
| | | break; |
| | | case IND: |
| | | dateTime = calendar.getTime(); |
| | | break; |
| | | case PLAN: |
| | | ApiPlanItemDTO apiPlanItemDTO = planMap.get(columnItem.getParamId()); |
| | | if (apiPlanItemDTO == null) { |
| | | return null; |
| | | } |
| | | dateTime = calculateDate(originalTime, false, columnItem.getDataLength(), TimeGranularitySecEnum.getEumByCode(apiPlanItemDTO.getTimeGranularity()).getValue()); |
| | | dateTime = calendar.getTime(); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | // 数据长度 * 粒度 |
| | | calendar.add(Calendar.SECOND, timeLength * granularity); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | public Date calculateDate(Date originalTime, Boolean backward, int dataLength, int field) { |
| | | int timeLength; |
| | | if (backward) { |
| | | timeLength = (-1) * dataLength; |
| | | } else { |
| | | timeLength = dataLength - 1; |
| | | } |
| | | Date desTime = originalTime; |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(desTime); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | // 数据长度 * 粒度 |
| | | calendar.add(Calendar.SECOND, timeLength); |
| | | return calendar.getTime(); |
| | | } |
| | | } |