Subversion Repositories SmartDukaan

Rev

Rev 25156 | Rev 25164 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 25156 Rev 25157
Line 3... Line 3...
3
import java.time.LocalDate;
3
import java.time.LocalDate;
4
import java.time.LocalDateTime;
4
import java.time.LocalDateTime;
5
import java.time.LocalTime;
5
import java.time.LocalTime;
6
import java.util.ArrayList;
6
import java.util.ArrayList;
7
import java.util.Arrays;
7
import java.util.Arrays;
-
 
8
import java.util.HashMap;
8
import java.util.LinkedHashMap;
9
import java.util.LinkedHashMap;
9
import java.util.List;
10
import java.util.List;
10
import java.util.Map;
11
import java.util.Map;
11
import java.util.stream.Collectors;
12
import java.util.stream.Collectors;
12
 
13
 
Line 168... Line 169...
168
	}
169
	}
169
 
170
 
170
	private List<BrandStockPrice> getBrandStockPrices(int fofoId) throws Exception {
171
	private List<BrandStockPrice> getBrandStockPrices(int fofoId) throws Exception {
171
		Map<String, BrandStockPrice> brandStockPricesMap = inventoryService.getBrandWiseStockValue(fofoId);
172
		Map<String, BrandStockPrice> brandStockPricesMap = inventoryService.getBrandWiseStockValue(fofoId);
172
		List<InventoryItemAgingModel> models = inventoryService.getItemAgingByInterval(fofoId, Arrays.asList(30));
173
		List<InventoryItemAgingModel> models = inventoryService.getItemAgingByInterval(fofoId, Arrays.asList(30));
173
		Map<String, Integer> brandWiseQty = models.stream()
174
		/*Map<String, Integer> brandWiseQty = models.stream()
174
				.filter(x -> x.getItemType().equals(ItemType.SERIALIZED.toString())).collect(Collectors
175
				.filter(x -> x.getItemType().equals(ItemType.SERIALIZED.toString())).collect(Collectors
175
						.groupingBy(x -> x.getBrand(), Collectors.summingInt(x -> x.getValues().get(1).getQuantity())));
176
						.groupingBy(x -> x.getBrand(), Collectors.summingInt(x -> x.getValues().get(1).getQuantity())));
176
		Map<String, Double> brandWiseValue = models.stream()
177
		Map<String, Double> brandWiseValue = models.stream()
177
				.filter(x -> x.getItemType().equals(ItemType.SERIALIZED.toString()))
178
				.filter(x -> x.getItemType().equals(ItemType.SERIALIZED.toString()))
178
				.collect(Collectors.groupingBy(x -> x.getBrand(), Collectors
179
				.collect(Collectors.groupingBy(x -> x.getBrand(), Collectors
179
						.summingDouble(x -> x.getValues().get(1).getQuantity() * x.getValues().get(1).getPrice())));
180
						.summingDouble(x -> x.getValues().get(1).getQuantity() * x.getValues().get(1).getPrice())));*/
180
		List<DBObject> mobileBrands = mongoClient.getMongoBrands(fofoId, "", 3);
181
		List<DBObject> mobileBrands = mongoClient.getMongoBrands(fofoId, "", 3);
181
		List<BrandStockPrice> brandStockPrices = new ArrayList<>();
182
		List<BrandStockPrice> brandStockPrices = new ArrayList<>();
182
 
183
 
-
 
184
		Map<String, Integer> brandWiseQty = new HashMap<String, Integer>();
-
 
185
		Map<String, Double> brandWiseValue = new HashMap<String, Double>();
183
		mobileBrands.stream().forEach(x -> {
186
		mobileBrands.stream().forEach(x -> {
184
			String brand = (String) x.get("name");
187
			String brand = (String) x.get("name");
185
			if (brandStockPricesMap.containsKey(brand)) {
188
			if (brandStockPricesMap.containsKey(brand)) {
186
				BrandStockPrice brandStockPrice = brandStockPricesMap.get(brand);
189
				BrandStockPrice brandStockPrice = brandStockPricesMap.get(brand);
187
				if (brandWiseQty.get(brand) != null) {
190
				if (brandWiseQty.get(brand) != null) {