private void fillEngineHorsePowerMap(List<InventoryDto> inventories) { for (InventoryDto inventoryDto : inventories) { if (!engineHorsePowerMap.containsKey(inventoryDto.getStyle().getId())) { StyleDto styleDto = styleRestClient.findStyleById( inventoryDto.getStyle().getId(), RequestView.custom().add("engine").add("horsepower").buildIncludingFields()); engineHorsePowerMap.put( inventoryDto.getStyle().getId(), styleDto.getEngine().getHorsepower()); } } }
private double getInventoryHorsePowerCoeff(InventoryDto inventoryDto) { double horsePower = engineHorsePowerMap.get(inventoryDto.getStyle().getId()); return (horsePower - MIN_HORSE_POWER) / (MAX_HORSE_POWER - MIN_HORSE_POWER); }