| | |
| | | return BigDecimal.ZERO; |
| | | } else if (dataList.size() < dto.getLength()) { |
| | | log.info("补全数据,dataList.size()=" + dataList.size()); |
| | | dataList = completionData(dto.getLength(), dataList, startTime, endTime, pointDTO); |
| | | dataList = completionData(dto.getLength(), dataList, startTime, endTime, momentPoint.getMinfreqid()); |
| | | } |
| | | double total = dataList.stream().mapToDouble(ApiPointValueDTO::getV).sum(); |
| | | if (listGood != null) { |
| | |
| | | return new BigDecimal(total).divide(new BigDecimal(dto.getDivisor()), 2, BigDecimal.ROUND_HALF_UP); |
| | | } |
| | | |
| | | private List<ApiPointValueDTO> completionData(int length, List<ApiPointValueDTO> dataList, Date startTime, Date endTime, ApiPointDTO pointDTO) { |
| | | private List<ApiPointValueDTO> completionData(int length, List<ApiPointValueDTO> dataList, Date startTime, Date endTime, String minfreqid) { |
| | | if (CollectionUtils.isEmpty(dataList) || length == dataList.size()) { |
| | | return dataList; |
| | | } else if (length < dataList.size()) { |
| | |
| | | List<ApiPointValueDTO> result = new ArrayList<>(); |
| | | long start = startTime.getTime(); |
| | | long end = endTime.getTime(); |
| | | long oneMin = 1000L * DataPointFreqEnum.getEumByCode(pointDTO.getMinfreqid()).getValue(); |
| | | long oneMin = 1000L * DataPointFreqEnum.getEumByCode(minfreqid).getValue(); |
| | | long mins = (end - start) / oneMin; |
| | | |
| | | //找出缺少项 |