| | |
| | | ApiPointValueQueryDTO pointValueQueryDTO = new ApiPointValueQueryDTO(); |
| | | pointValueQueryDTO.setStart(startTime); |
| | | pointValueQueryDTO.setEnd(endTime); |
| | | pointValueQueryDTO.setPointNo(powerNetDropdownEntity.getCurCos()); |
| | | pointValueQueryDTO.setPointNo(powerNetDropdownEntity.getExt1()); |
| | | List<ApiPointValueDTO> hisValue = dataPointApi.queryPointHistoryValue(pointValueQueryDTO); |
| | | if (CollectionUtils.isEmpty(hisValue)) { |
| | | log.info("hisValue is null"); |
| | |
| | | ApiPointValueDTO curValue = null; |
| | | Collections.reverse(hisValue); |
| | | for (ApiPointValueDTO valueDTO : hisValue) { |
| | | curValue = valueDTO; |
| | | if ((queryDto.getCurDemand().doubleValue() - valueDTO.getV()) <= 0.0001) { |
| | | curValue = valueDTO; |
| | | log.info("curValue is find"); |
| | | break; |
| | | } |
| | | } |
| | |
| | | log.info("curValue=" + curValue); |
| | | for (PowerNetDropdownEntity netDropdown : dropdownList) { |
| | | PowerDemandQueryRespDTO dto = ConvertUtils.sourceToTarget(netDropdown, PowerDemandQueryRespDTO.class); |
| | | if (!CollectionUtils.isEmpty(pointsHisValues.get(netDropdown.getExt1()))) { |
| | | Map<String, BigDecimal> pointValueMap = new HashMap<>(); |
| | | pointsHisValues.get(netDropdown.getExt1()).forEach(item -> { |
| | | pointValueMap.put(item.get("time").toString(), DecimalUtil.toBigDecimal(item.get("value"))); |
| | | |
| | | if (CollectionUtils.isEmpty(pointsHisValues.get(netDropdown.getCurCos()))) { |
| | | continue; |
| | | }); |
| | | dto.setCurDemand(pointValueMap.get(DateUtils.format(curValue.getT(),DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND))); |
| | | dto.setDataTime(curValue.getT()); |
| | | } |
| | | Map<String, BigDecimal> pointValueMap = new HashMap<>(); |
| | | pointsHisValues.get(netDropdown.getCurCos()).forEach(item -> { |
| | | pointValueMap.put(item.get("time").toString(), DecimalUtil.toBigDecimal(item.get("value"))); |
| | | |
| | | }); |
| | | dto.setCurDemand(pointValueMap.get(DateUtils.format(curValue.getT(),DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND))); |
| | | dto.setDataTime(curValue.getT()); |
| | | result.add(dto); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | for (String code : dto.getCodeList()) { |
| | | PowerNetFactorQuery powerNetFactorQuery = null; |
| | | PowerNetFactorQuery powerNetFactorQuery = new PowerNetFactorQuery(); |
| | | PowerDemandEntity powerDemandEntity = powerDemandService.getByCode(code); |
| | | PowerNetDropdownEntity powerNetDropdownEntity = powerNetDropdownService.getByNodeCode(code); |
| | | if (powerDemandEntity != null) { |