| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
|
2 |
|
| 3 |
import com.mongodb.DBObject;
|
- |
|
| 4 |
import com.spice.profitmandi.common.enumuration.ActivationType;
|
3 |
import com.spice.profitmandi.common.enumuration.ActivationType;
|
| 5 |
import com.spice.profitmandi.common.enumuration.CounterSize;
|
4 |
import com.spice.profitmandi.common.enumuration.CounterSize;
|
| 6 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
5 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
| 7 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
6 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 8 |
import com.spice.profitmandi.common.model.*;
|
7 |
import com.spice.profitmandi.common.model.*;
|
| 9 |
import com.spice.profitmandi.common.util.FileUtil;
|
8 |
import com.spice.profitmandi.common.util.FileUtil;
|
| 10 |
import com.spice.profitmandi.common.util.Utils;
|
9 |
import com.spice.profitmandi.common.util.Utils;
|
| 11 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
10 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
| 12 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
11 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 13 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
12 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 14 |
import com.spice.profitmandi.dao.entity.catalog.Category;
|
- |
|
| 15 |
import com.spice.profitmandi.dao.entity.catalog.FocusedModel;
|
- |
|
| 16 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
13 |
import com.spice.profitmandi.dao.entity.catalog.*;
|
| 17 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
- |
|
| 18 |
import com.spice.profitmandi.dao.entity.cs.Region;
|
14 |
import com.spice.profitmandi.dao.entity.cs.Region;
|
| 19 |
import com.spice.profitmandi.dao.entity.fofo.*;
|
15 |
import com.spice.profitmandi.dao.entity.fofo.*;
|
| 20 |
import com.spice.profitmandi.dao.entity.inventory.SaholicCISTable;
|
16 |
import com.spice.profitmandi.dao.entity.inventory.SaholicCISTable;
|
| 21 |
import com.spice.profitmandi.dao.entity.inventory.SaholicPOItem;
|
17 |
import com.spice.profitmandi.dao.entity.inventory.SaholicPOItem;
|
| 22 |
import com.spice.profitmandi.dao.entity.transaction.Loan;
|
18 |
import com.spice.profitmandi.dao.entity.transaction.Loan;
|
| Line 1277... |
Line 1273... |
| 1277 |
}
|
1273 |
}
|
| 1278 |
|
1274 |
|
| 1279 |
private List<BrandStockPrice> getBrandStockPrices(int fofoId) throws Exception {
|
1275 |
private List<BrandStockPrice> getBrandStockPrices(int fofoId) throws Exception {
|
| 1280 |
Map<String, BrandStockPrice> brandStockPricesMap = inventoryService.getBrandWiseStockValue(fofoId);
|
1276 |
Map<String, BrandStockPrice> brandStockPricesMap = inventoryService.getBrandWiseStockValue(fofoId);
|
| 1281 |
|
1277 |
|
| 1282 |
List<DBObject> mobileBrands = mongoClient.getMongoBrands(fofoId, "", 3);
|
1278 |
List<BrandCatalog> mobileBrands = brandsService.getBrands(fofoId, null, 3);
|
| 1283 |
List<BrandStockPrice> brandStockPrices = new ArrayList<>();
|
1279 |
List<BrandStockPrice> brandStockPrices = new ArrayList<>();
|
| 1284 |
|
1280 |
|
| 1285 |
mobileBrands.stream().forEach(x -> {
|
1281 |
mobileBrands.stream().forEach(x -> {
|
| 1286 |
String brand = (String) x.get("name");
|
1282 |
String brand = x.getName();
|
| 1287 |
if (brandStockPricesMap.containsKey(brand)) {
|
1283 |
if (brandStockPricesMap.containsKey(brand)) {
|
| 1288 |
BrandStockPrice brandStockPrice = brandStockPricesMap.get(brand);
|
1284 |
BrandStockPrice brandStockPrice = brandStockPricesMap.get(brand);
|
| 1289 |
brandStockPrice.setBrandUrl((String) x.get("url"));
|
1285 |
brandStockPrice.setBrandUrl(x.getLogoUrl());
|
| 1290 |
brandStockPrice.setRank(((Double) x.get("rank")).intValue());
|
1286 |
brandStockPrice.setRank(x.getBrandCategory().getRank());
|
| 1291 |
brandStockPrices.add(brandStockPrice);
|
1287 |
brandStockPrices.add(brandStockPrice);
|
| 1292 |
}
|
1288 |
}
|
| 1293 |
});
|
1289 |
});
|
| 1294 |
|
1290 |
|
| 1295 |
return brandStockPrices.stream().filter(x -> x.getTotalQty() > 0).sorted((x, y) -> x.getRank() - y.getRank())
|
1291 |
return brandStockPrices.stream().filter(x -> x.getTotalQty() > 0).sorted((x, y) -> x.getRank() - y.getRank())
|