public List getProductList()

in src/productservice/productservice-provider/src/main/java/com/alibabacloud/hipstershop/productservice/controller/ProductController.java [71:94]


    public List<Product> getProductList() {
        List<Product> productList= productServiceApi.getAllProduct().stream().sorted(new Comparator<ProductInfo>() {
            @Override
            public int compare(ProductInfo o1, ProductInfo o2) {
                return o2.getPrice() - o1.getPrice();
            }
        }).map(ProductInfo::getProduct).collect(Collectors.toList());

        if(demoVersion){
            for(Product product : productList){
                if("/img/products/1.png".equals(product.getPicture())){
                    product.setPicture("/img/products/air-plant.jpg");
                }
                if("/img/products/2.png".equals(product.getPicture())){
                    product.setPicture("/img/products/barista-kit.jpg");
                }
                if("/img/products/3.png".equals(product.getPicture())){
                    product.setPicture("/img/products/camera-lens.jpg");
                }
            }
        }

        return productList;
    }