| | |
| | | if (CollectionUtils.isEmpty(result)) { |
| | | return success(result); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.DAY_OF_MONTH, 1); |
| | | calendar.set(Calendar.HOUR_OF_DAY, 0); |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | |
| | | for (PowerDemandDTO dto : result) { |
| | | List<String> points = new ArrayList<>(); |
| | | if (StringUtils.isNotBlank(dto.getCurDemand())) { |
| | |
| | | if (StringUtils.isNotBlank(dto.getActivePower())) { |
| | | points.add(dto.getActivePower()); |
| | | } |
| | | |
| | | if (!CollectionUtils.isEmpty(points)) { |
| | | |
| | | Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(points); |
| | | |
| | | if (pointsRealValue.get(dto.getCurDemand()) != null) { |
| | | dto.setCurDemand(pointsRealValue.get(dto.getCurDemand()).toString()); |
| | | } |
| | |
| | | } |
| | | |
| | | if (!StringUtils.isEmpty(dto.getMaxDemand())) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.DAY_OF_MONTH, 1); |
| | | calendar.set(Calendar.HOUR_OF_DAY, 0); |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | Date start = calendar.getTime(); |
| | | ApiPointValueQueryDTO apiPointValueQueryDTO = new ApiPointValueQueryDTO(); |
| | | apiPointValueQueryDTO.setStart(start); |
| | | apiPointValueQueryDTO.setEnd(new Date()); |
| | | apiPointValueQueryDTO.setPointNo(dto.getMaxDemand()); |
| | | |
| | | List<ApiPointValueDTO> monthValues = dataPointApi.queryPointHistoryValue(apiPointValueQueryDTO); |
| | | double max = 0; |
| | | for (int i = 0; i < monthValues.size() - 1; i++) { |
| | | if (max < monthValues.get(i).getV()) { |
| | | max = monthValues.get(i).getV(); |
| | | } |
| | | Map<String, Object> maxValue = dataPointApi.queryPointMaxValue(apiPointValueQueryDTO); |
| | | if (maxValue != null) { |
| | | dto.setMaxDemand(maxValue.get(dto.getMaxDemand()) == null ? "" : maxValue.get(dto.getMaxDemand()).toString()); |
| | | } |
| | | dto.setMaxDemand(String.valueOf(max)); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | return success(result); |
| | | } |
| | | |