Subversion Repositories SmartDukaan

Rev

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

Rev 25152 Rev 25156
Line 168... Line 168...
168
	}
168
	}
169
 
169
 
170
	private List<BrandStockPrice> getBrandStockPrices(int fofoId) throws Exception {
170
	private List<BrandStockPrice> getBrandStockPrices(int fofoId) throws Exception {
171
		Map<String, BrandStockPrice> brandStockPricesMap = inventoryService.getBrandWiseStockValue(fofoId);
171
		Map<String, BrandStockPrice> brandStockPricesMap = inventoryService.getBrandWiseStockValue(fofoId);
172
		List<InventoryItemAgingModel> models = inventoryService.getItemAgingByInterval(fofoId, Arrays.asList(30));
172
		List<InventoryItemAgingModel> models = inventoryService.getItemAgingByInterval(fofoId, Arrays.asList(30));
173
		Map<String,Integer> brandWiseQty = models.stream()
173
		Map<String, Integer> brandWiseQty = models.stream()
174
				.filter(x->x.getItemType().equals(ItemType.SERIALIZED.toString()))
174
				.filter(x -> x.getItemType().equals(ItemType.SERIALIZED.toString())).collect(Collectors
175
				.collect(
-
 
176
						Collectors.groupingBy(x->x.getBrand(), 
-
 
177
						Collectors.summingInt(x->x.getValues().get(1).getQuantity())));
175
						.groupingBy(x -> x.getBrand(), Collectors.summingInt(x -> x.getValues().get(1).getQuantity())));
178
		Map<String,Double> brandWiseValue = models.stream()
176
		Map<String, Double> brandWiseValue = models.stream()
179
				.filter(x->x.getItemType().equals(ItemType.SERIALIZED.toString()))
177
				.filter(x -> x.getItemType().equals(ItemType.SERIALIZED.toString()))
180
				.collect(
-
 
181
						Collectors.groupingBy(x->x.getBrand(), 
178
				.collect(Collectors.groupingBy(x -> x.getBrand(), Collectors
182
								Collectors.summingDouble(x->x.getValues().get(1).getQuantity()*x.getValues().get(1).getPrice())));
179
						.summingDouble(x -> x.getValues().get(1).getQuantity() * x.getValues().get(1).getPrice())));
183
		List<DBObject> mobileBrands = mongoClient.getMongoBrands(fofoId, "", 3);
180
		List<DBObject> mobileBrands = mongoClient.getMongoBrands(fofoId, "", 3);
184
		List<BrandStockPrice> brandStockPrices = new ArrayList<>();
181
		List<BrandStockPrice> brandStockPrices = new ArrayList<>();
185
		
182
 
186
		mobileBrands.stream().forEach(x -> {
183
		mobileBrands.stream().forEach(x -> {
187
			String brand = (String) x.get("name");
184
			String brand = (String) x.get("name");
188
			if (brandStockPricesMap.containsKey(brand)) {
185
			if (brandStockPricesMap.containsKey(brand)) {
189
				BrandStockPrice brandStockPrice = brandStockPricesMap.get(brand);
186
				BrandStockPrice brandStockPrice = brandStockPricesMap.get(brand);
-
 
187
				if (brandWiseQty.get(brand) != null) {
190
				brandStockPrice.setAgedQty(brandWiseQty.get(brand));
188
					brandStockPrice.setAgedQty(brandWiseQty.get(brand));
191
				brandStockPrice.setAgedValue(brandWiseValue.get(brand));
189
					brandStockPrice.setAgedValue(brandWiseValue.get(brand));
-
 
190
				}
192
				brandStockPrice.setBrandUrl((String) x.get("url"));
191
				brandStockPrice.setBrandUrl((String) x.get("url"));
193
				brandStockPrice.setRank(((Double) x.get("rank")).intValue());
192
				brandStockPrice.setRank(((Double) x.get("rank")).intValue());
194
				brandStockPrices.add(brandStockPrice);
193
				brandStockPrices.add(brandStockPrice);
195
			} else {
194
			} else {
196
			}
195
			}
Line 198... Line 197...
198
 
197
 
199
		return brandStockPrices.stream().sorted((x, y) -> y.getRank() - x.getRank()).collect(Collectors.toList());
198
		return brandStockPrices.stream().sorted((x, y) -> y.getRank() - x.getRank()).collect(Collectors.toList());
200
	}
199
	}
201
 
200
 
202
	@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
201
	@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
203
	public String dashboard(HttpServletRequest request, Model model)
202
	public String dashboard(HttpServletRequest request, Model model) throws Exception {
204
			throws Exception {
-
 
205
 
203
 
206
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
204
		LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
207
 
205
 
208
		FofoStore fofoStore = null;
206
		FofoStore fofoStore = null;
209
		try {
207
		try {