| Line 40... |
Line 40... |
| 40 |
|
40 |
|
| 41 |
import com.mongodb.DBObject;
|
41 |
import com.mongodb.DBObject;
|
| 42 |
import com.spice.profitmandi.common.enumuration.CounterSize;
|
42 |
import com.spice.profitmandi.common.enumuration.CounterSize;
|
| 43 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
43 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 44 |
import com.spice.profitmandi.common.model.BrandStockPrice;
|
44 |
import com.spice.profitmandi.common.model.BrandStockPrice;
|
| - |
|
45 |
import com.spice.profitmandi.common.model.CatalogIdAggregateValue;
|
| 45 |
import com.spice.profitmandi.common.model.CatalogListingModel;
|
46 |
import com.spice.profitmandi.common.model.CatalogListingModel;
|
| 46 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
47 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 47 |
import com.spice.profitmandi.common.model.ItemIdAvailability;
|
48 |
import com.spice.profitmandi.common.model.ItemIdAvailability;
|
| 48 |
import com.spice.profitmandi.common.model.PlannedModel;
|
49 |
import com.spice.profitmandi.common.model.PlannedModel;
|
| 49 |
import com.spice.profitmandi.common.model.StockAllocationModel;
|
50 |
import com.spice.profitmandi.common.model.StockAllocationModel;
|
| Line 51... |
Line 52... |
| 51 |
import com.spice.profitmandi.common.util.Utils;
|
52 |
import com.spice.profitmandi.common.util.Utils;
|
| 52 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
53 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
| 53 |
import com.spice.profitmandi.dao.entity.catalog.FocusedModel;
|
54 |
import com.spice.profitmandi.dao.entity.catalog.FocusedModel;
|
| 54 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
55 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 55 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
56 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| - |
|
57 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
| - |
|
58 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
| 56 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
59 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 57 |
import com.spice.profitmandi.dao.entity.fofo.MonthlyPlanned;
|
60 |
import com.spice.profitmandi.dao.entity.fofo.MonthlyPlanned;
|
| 58 |
import com.spice.profitmandi.dao.entity.fofo.PlannedDetail;
|
61 |
import com.spice.profitmandi.dao.entity.fofo.PlannedDetail;
|
| 59 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
62 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| 60 |
import com.spice.profitmandi.dao.entity.user.User;
|
63 |
import com.spice.profitmandi.dao.entity.user.User;
|
| Line 449... |
Line 452... |
| 449 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
452 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 450 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
453 |
Set<Integer> roleIds = loginDetails.getRoleIds();
|
| 451 |
LOGGER.info("Counter size is {}", counterSize);
|
454 |
LOGGER.info("Counter size is {}", counterSize);
|
| 452 |
LOGGER.info("Fofo Id is {}", fofoId);
|
455 |
LOGGER.info("Fofo Id is {}", fofoId);
|
| 453 |
boolean isAdmin = roleManager.isAdmin(roleIds);
|
456 |
boolean isAdmin = roleManager.isAdmin(roleIds);
|
| - |
|
457 |
|
| - |
|
458 |
Map<String, Object> equalsMap = new HashMap<>();
|
| - |
|
459 |
equalsMap.put("categoryId", 10006);
|
| - |
|
460 |
|
| - |
|
461 |
Map<String, List<?>> notEqualsMap = new HashMap<>();
|
| - |
|
462 |
|
| - |
|
463 |
Map<String, List<?>> notEqualsJoinMap = new HashMap<>();
|
| 454 |
Map<Integer, Integer> itemCisMap;
|
464 |
Map<Integer, Integer> currentStockMap;
|
| - |
|
465 |
|
| 455 |
if (!isAdmin && fofoId == 0) {
|
466 |
if (!isAdmin && fofoId == 0) {
|
| 456 |
fofoId = cookiesProcessor.getCookiesObject(request).getFofoId();
|
467 |
fofoId = cookiesProcessor.getCookiesObject(request).getFofoId();
|
| 457 |
List<ItemIdAvailability> currentInventorySnapshots = currentInventorySnapshotRepository
|
468 |
Map<String, Object> equalsStockJoinMap = new HashMap<>();
|
| 458 |
.selectItemsStock(fofoId);
|
469 |
equalsStockJoinMap.put("fofoId", fofoId);
|
| 459 |
LOGGER.info("currentInventorySnapshots" + currentInventorySnapshots);
|
470 |
currentStockMap = itemRepository
|
| 460 |
itemCisMap = currentInventorySnapshots.stream().filter(x -> x.getAvailability() > 0)
|
471 |
.selectItems(CurrentInventorySnapshot.class, "itemId", equalsMap, notEqualsMap, equalsStockJoinMap,
|
| - |
|
472 |
notEqualsJoinMap, "availability")
|
| 461 |
.collect(Collectors.toMap(x -> x.getItemId(), x -> x.getAvailability()));
|
473 |
.stream().collect(Collectors.toMap(x -> x.getCatalogId(), x -> (int) x.getAggregateValue()));
|
| 462 |
|
474 |
|
| 463 |
} else {
|
475 |
} else {
|
| 464 |
if (fofoId == 0) {
|
476 |
if (fofoId == 0) {
|
| - |
|
477 |
|
| 465 |
List<ItemIdAvailability> currentInventorySnapshots = currentInventorySnapshotRepository
|
478 |
Map<String, Object> equalsStockJoinMap = new HashMap<>();
|
| - |
|
479 |
equalsStockJoinMap.put("fofoId", fofoId);
|
| - |
|
480 |
|
| 466 |
.selectItemsStock();
|
481 |
currentStockMap = itemRepository
|
| 467 |
LOGGER.info("currentInventorySnapshots2" + currentInventorySnapshots);
|
482 |
.selectItems(CurrentInventorySnapshot.class, "itemId", equalsMap, notEqualsMap,
|
| 468 |
itemCisMap = currentInventorySnapshots.stream().filter(x -> x.getAvailability() > 0)
|
483 |
equalsStockJoinMap, notEqualsJoinMap, "availability")
|
| 469 |
.collect(Collectors.toMap(x -> x.getItemId(), x -> x.getAvailability()));
|
484 |
.stream().collect(Collectors.toMap(x -> x.getCatalogId(), x -> (int) x.getAggregateValue()));
|
| - |
|
485 |
|
| 470 |
} else {
|
486 |
} else {
|
| - |
|
487 |
|
| 471 |
List<ItemIdAvailability> currentInventorySnapshots = currentInventorySnapshotRepository
|
488 |
Map<String, Object> equalsStockJoinMap = new HashMap<>();
|
| 472 |
.selectItemsStock(fofoId);
|
489 |
equalsStockJoinMap.put("fofoId", fofoId);
|
| - |
|
490 |
|
| - |
|
491 |
currentStockMap = itemRepository
|
| 473 |
LOGGER.info("currentInventorySnapshots3" + currentInventorySnapshots);
|
492 |
.selectItems(CurrentInventorySnapshot.class, "itemId", equalsMap, notEqualsMap,
|
| 474 |
itemCisMap = currentInventorySnapshots.stream().filter(x -> x.getAvailability() > 0)
|
493 |
equalsStockJoinMap, notEqualsJoinMap, "availability")
|
| 475 |
.collect(Collectors.toMap(x -> x.getItemId(), x -> x.getAvailability()));
|
494 |
.stream().collect(Collectors.toMap(x -> x.getCatalogId(), x -> (int) x.getAggregateValue()));
|
| - |
|
495 |
|
| 476 |
}
|
496 |
}
|
| 477 |
}
|
497 |
}
|
| - |
|
498 |
|
| 478 |
Map<Integer, Integer> currentStock = null;
|
499 |
LOGGER.info("currentStock" + currentStockMap);
|
| 479 |
if (!itemCisMap.isEmpty()) {
|
- |
|
| 480 |
currentStock = itemRepository.selectByIds(itemCisMap.keySet()).stream().collect(Collectors
|
- |
|
| 481 |
.groupingBy(x -> x.getCatalogItemId(), Collectors.summingInt(x -> itemCisMap.get(x.getId()))));
|
- |
|
| 482 |
}
|
- |
|
| 483 |
List<StockAllocationModel> stockAllocationList;
|
500 |
List<StockAllocationModel> stockAllocationList;
|
| 484 |
if (fofoId > 0) {
|
501 |
if (fofoId > 0) {
|
| 485 |
stockAllocationList = stockAllocationService.getStockAllocation(fofoId, true);
|
502 |
stockAllocationList = stockAllocationService.getStockAllocation(fofoId, true);
|
| 486 |
} else {
|
503 |
} else {
|
| 487 |
stockAllocationList = stockAllocationService.getStockAllocation(counterSize, true);
|
504 |
stockAllocationList = stockAllocationService.getStockAllocation(counterSize, true);
|
| 488 |
}
|
505 |
}
|
| 489 |
LOGGER.info("Stock Allocation list is {}", stockAllocationList);
|
- |
|
| 490 |
|
- |
|
| 491 |
Map<Integer, StockAllocationModel> itemStockAllocationMap = stockAllocationList.stream()
|
506 |
Map<Integer, StockAllocationModel> itemStockAllocationMap = stockAllocationList.stream()
|
| 492 |
.collect(Collectors.toMap(x -> x.getCatalogId(), x -> x));
|
507 |
.collect(Collectors.toMap(x -> x.getCatalogId(), x -> x));
|
| 493 |
Map<Integer, Integer> itemsInTransit = null;
|
508 |
Map<Integer, Integer> itemsInTransit = null;
|
| 494 |
LOGGER.info("Item Stock Allocation Model Map {}", itemStockAllocationMap);
|
- |
|
| - |
|
509 |
|
| 495 |
List<TagListing> tagListings = tagListingRepository.selectAll(true);
|
510 |
List<TagListing> tagListings = tagListingRepository.selectAll(true);
|
| 496 |
if (!isAdmin) {
|
511 |
if (!isAdmin) {
|
| 497 |
tagListings = new ArrayList<>(tagListings);
|
512 |
tagListings = new ArrayList<>(tagListings);
|
| 498 |
List<Order> inTransitOrders = orderRepository.selectOrders(fofoId, validOrderStatusList);
|
513 |
List<Order> inTransitOrders = orderRepository.selectOrders(fofoId, validOrderStatusList);
|
| 499 |
inTransitOrders = this.filterValidOrders(inTransitOrders);
|
514 |
inTransitOrders = this.filterValidOrders(inTransitOrders);
|
| Line 505... |
Line 520... |
| 505 |
Iterator<TagListing> iterator = tagListings.iterator();
|
520 |
Iterator<TagListing> iterator = tagListings.iterator();
|
| 506 |
int totalPcs = 0;
|
521 |
int totalPcs = 0;
|
| 507 |
int toBeOrdered = 0;
|
522 |
int toBeOrdered = 0;
|
| 508 |
float totalAmount = 0;
|
523 |
float totalAmount = 0;
|
| 509 |
Map<Integer, CatalogListingModel> catalogListingMap = new HashMap<>();
|
524 |
Map<Integer, CatalogListingModel> catalogListingMap = new HashMap<>();
|
| - |
|
525 |
|
| 510 |
Map<Integer, FocusedModel> focusedModelMap = focusedModelRepository.selectAll().stream()
|
526 |
Map<Integer, FocusedModel> focusedModelMap = focusedModelRepository.selectAll().stream()
|
| 511 |
.collect(Collectors.toMap(FocusedModel::getCatalogId, Function.identity()));
|
527 |
.collect(Collectors.toMap(FocusedModel::getCatalogId, Function.identity()));
|
| 512 |
LOGGER.info("fofoId" + loginDetails.getFofoId());
|
- |
|
| 513 |
Map<Integer, Item> items = itemRepository
|
- |
|
| 514 |
.selectByIds(tagListings.stream().map(x -> x.getItemId()).collect(Collectors.toSet())).stream()
|
- |
|
| 515 |
.collect(Collectors.toMap(x -> x.getId(), x -> x));
|
- |
|
| 516 |
|
528 |
|
| 517 |
List<Integer> fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
- |
|
| 518 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
- |
|
| 519 |
.collect(Collectors.toList());
|
- |
|
| 520 |
|
- |
|
| 521 |
Map<Integer, Integer> fofoOrderMap = fofoOrderItemRepository.selectByOrderIds(fofoOrderIds).stream()
|
- |
|
| 522 |
.collect(Collectors.groupingBy(y -> y.getItemId(), Collectors.summingInt(y -> y.getQuantity())));
|
- |
|
| 523 |
LOGGER.info("fofoOrderMap" + fofoOrderMap);
|
- |
|
| 524 |
Map<Integer, Integer> last15DaysMap = null;
|
- |
|
| 525 |
if (!fofoOrderMap.isEmpty()) {
|
- |
|
| 526 |
last15DaysMap = itemRepository.selectByIds(fofoOrderMap.keySet()).stream().collect(Collectors
|
- |
|
| 527 |
.groupingBy(x -> x.getCatalogItemId(), Collectors.summingInt(x -> fofoOrderMap.get(x.getId()))));
|
- |
|
| 528 |
}
|
- |
|
| 529 |
LOGGER.info("last15DaysMap" + last15DaysMap);
|
- |
|
| 530 |
MonthlyPlanned monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(loginDetails.getFofoId(),
|
529 |
MonthlyPlanned monthlyPlanned = monthlyPlannedRepository.selectByFofoIdYearMonth(loginDetails.getFofoId(),
|
| 531 |
LocalDate.now().withDayOfMonth(1));
|
530 |
LocalDate.now().withDayOfMonth(1));
|
| 532 |
Map<Integer, Integer> plannedDetailMap = null;
|
531 |
Map<Integer, Integer> plannedDetailMap = null;
|
| 533 |
if (monthlyPlanned != null) {
|
532 |
if (monthlyPlanned != null) {
|
| 534 |
plannedDetailMap = plannedDetailRepository.selectByPlannedId(monthlyPlanned.getId()).stream()
|
533 |
plannedDetailMap = plannedDetailRepository.selectByPlannedId(monthlyPlanned.getId()).stream()
|
| 535 |
.collect(Collectors.toMap(x -> x.getCatalogId(), x -> x.getQuantity()));
|
534 |
.collect(Collectors.toMap(x -> x.getCatalogId(), x -> x.getQuantity()));
|
| 536 |
|
535 |
|
| 537 |
}
|
536 |
}
|
| 538 |
|
537 |
|
| - |
|
538 |
List<Integer> fofoOrderIds = fofoOrderRepository.selectByFofoIdBetweenCreatedTimeStamp(loginDetails.getFofoId(),
|
| - |
|
539 |
LocalDateTime.now().minusDays(15), LocalDateTime.now()).stream().map(x -> x.getId())
|
| 539 |
while (iterator.hasNext()) {
|
540 |
.collect(Collectors.toList());
|
| - |
|
541 |
LOGGER.info("fofoOrderIds" + fofoOrderIds);
|
| 540 |
TagListing tagListing = iterator.next();
|
542 |
Map<String, Object> equalsJoinMap = new HashMap<>();
|
| - |
|
543 |
equalsJoinMap.put("orderId", fofoOrderIds);
|
| 541 |
|
544 |
|
| 542 |
Item item = items.get(tagListing.getItemId());
|
545 |
Map<Integer, Integer> last15daysMap = itemRepository
|
| - |
|
546 |
.selectItems(FofoOrderItem.class, "itemId", equalsMap, notEqualsMap, equalsJoinMap, notEqualsJoinMap,
|
| 543 |
// itemRepository.select
|
547 |
"quantity")
|
| - |
|
548 |
.stream().collect(Collectors.toMap(x -> x.getCatalogId(), x -> (int) x.getAggregateValue()));
|
| - |
|
549 |
|
| 544 |
// catalogTagListingMap
|
550 |
LOGGER.info("last15daysMap" + last15daysMap);
|
| 545 |
|
551 |
|
| 546 |
if (item.getBrand() == null || item.getCategoryId() != 10006) {
|
552 |
Map<Integer, TagListing> taglistingMap = tagListings.stream()
|
| 547 |
iterator.remove();
|
553 |
.collect(Collectors.toMap(x -> x.getItemId(), x -> x));
|
| 548 |
continue;
|
554 |
List<Item> items = itemRepository.selectByIds(taglistingMap.keySet());
|
| - |
|
555 |
Map<Integer, List<Item>> catalogIdItemMap = items.stream().collect(
|
| - |
|
556 |
Collectors.groupingBy(x -> x.getCatalogItemId(), Collectors.mapping(y -> y, Collectors.toList())));
|
| 549 |
}
|
557 |
|
| - |
|
558 |
LOGGER.info("itemId" + new ArrayList<>(taglistingMap.keySet()));
|
| - |
|
559 |
Map<String, Object> equalsItemJoinMap = new HashMap<>();
|
| - |
|
560 |
equalsItemJoinMap.put("itemId", new ArrayList<>(taglistingMap.keySet()));
|
| 550 |
|
561 |
|
| - |
|
562 |
List<CatalogIdAggregateValue> tagListingCatalogIds = itemRepository.selectItems(TagListing.class, "itemId",
|
| 551 |
int catalogId = item.getCatalogItemId();
|
563 |
equalsMap, notEqualsMap, equalsItemJoinMap, notEqualsJoinMap, "tagId");
|
| 552 |
|
564 |
|
| - |
|
565 |
for (CatalogIdAggregateValue catalogIdAggregateValue : tagListingCatalogIds) {
|
| - |
|
566 |
int catalogId = catalogIdAggregateValue.getCatalogId();
|
| - |
|
567 |
Item item = catalogIdItemMap.get(catalogId).get(0);
|
| - |
|
568 |
TagListing tagListing = taglistingMap.get(item.getId());
|
| 553 |
CatalogListingModel catalogListingModel = catalogListingMap.get(catalogId);
|
569 |
CatalogListingModel catalogListingModel = catalogListingMap.get(catalogId);
|
| 554 |
if (!catalogListingMap.containsKey(catalogId)) {
|
570 |
if (!catalogListingMap.containsKey(catalogId)) {
|
| 555 |
catalogListingModel = new CatalogListingModel();
|
571 |
catalogListingModel = new CatalogListingModel();
|
| 556 |
catalogListingModel.setCatalogId(catalogId);
|
572 |
catalogListingModel.setCatalogId(catalogId);
|
| 557 |
catalogListingModel.setDp(tagListing.getSellingPrice());
|
573 |
catalogListingModel.setDp(tagListing.getSellingPrice());
|
| Line 569... |
Line 585... |
| 569 |
catalogListingModel.setAllocatedQuantity(stockAllocationQuantity);
|
585 |
catalogListingModel.setAllocatedQuantity(stockAllocationQuantity);
|
| 570 |
}
|
586 |
}
|
| 571 |
} else {
|
587 |
} else {
|
| 572 |
catalogListingModel.setAllocatedQuantity(stockAllocationQuantity);
|
588 |
catalogListingModel.setAllocatedQuantity(stockAllocationQuantity);
|
| 573 |
}
|
589 |
}
|
| - |
|
590 |
|
| 574 |
if (last15DaysMap != null) {
|
591 |
if (last15daysMap != null) {
|
| 575 |
Integer last15DaysSale = last15DaysMap.get(catalogId);
|
592 |
Integer last15DaysSale = last15daysMap.get(catalogId);
|
| 576 |
|
593 |
|
| 577 |
if (last15DaysSale != null) {
|
594 |
if (last15DaysSale != null) {
|
| 578 |
catalogListingModel.setLast15DaysSale(last15DaysSale);
|
595 |
catalogListingModel.setLast15DaysSale(last15DaysSale);
|
| 579 |
} else {
|
596 |
} else {
|
| 580 |
catalogListingModel.setLast15DaysSale(0);
|
597 |
catalogListingModel.setLast15DaysSale(0);
|
| Line 601... |
Line 618... |
| 601 |
|
618 |
|
| 602 |
catalogListingMap.put(catalogId, catalogListingModel);
|
619 |
catalogListingMap.put(catalogId, catalogListingModel);
|
| 603 |
|
620 |
|
| 604 |
}
|
621 |
}
|
| 605 |
int itemAvailability = 0;
|
622 |
int itemAvailability = 0;
|
| 606 |
if (currentStock != null) {
|
623 |
if (currentStockMap != null) {
|
| 607 |
Integer qty = currentStock.get(catalogId);
|
624 |
Integer qty = currentStockMap.get(catalogId);
|
| 608 |
itemAvailability = qty == null ? 0 : qty;
|
625 |
itemAvailability = qty == null ? 0 : qty;
|
| 609 |
catalogListingModel.setStockInHand(itemAvailability);
|
626 |
catalogListingModel.setStockInHand(itemAvailability);
|
| 610 |
} else {
|
627 |
} else {
|
| 611 |
catalogListingModel.setStockInHand(0);
|
628 |
catalogListingModel.setStockInHand(0);
|
| 612 |
}
|
629 |
}
|
| 613 |
Integer inTransitQuantity = itemsInTransit.get(item.getId());
|
630 |
Integer inTransitQuantity = itemsInTransit.get(item.getId());
|
| 614 |
int inTransitQty = (inTransitQuantity == null ? 0 : inTransitQuantity);
|
631 |
int inTransitQty = (inTransitQuantity == null ? 0 : inTransitQuantity);
|
| 615 |
catalogListingModel.setInTransitQuantity(catalogListingModel.getInTransitQuantity() + inTransitQty);
|
632 |
catalogListingModel.setInTransitQuantity(catalogListingModel.getInTransitQuantity() + inTransitQty);
|
| 616 |
|
633 |
|
| 617 |
if (catalogListingModel.getAllocatedQuantity() > 0) {
|
- |
|
| 618 |
toBeOrdered = Math.max(catalogListingModel.getToBeOrdered() - inTransitQty - itemAvailability, 0);
|
- |
|
| 619 |
catalogListingModel.setToBeOrdered(toBeOrdered);
|
- |
|
| 620 |
}
|
- |
|
| 621 |
}
|
634 |
}
|
| 622 |
|
635 |
|
| 623 |
Map<Integer, CustomRetailer> customRetailersMap = retailerService.getFofoRetailers();
|
636 |
Map<Integer, CustomRetailer> customRetailersMap = retailerService.getFofoRetailers();
|
| 624 |
if (fofoId > 0) {
|
637 |
if (fofoId > 0) {
|
| 625 |
CustomRetailer customRetailer = customRetailersMap.get(fofoId);
|
638 |
CustomRetailer customRetailer = customRetailersMap.get(fofoId);
|
| Line 632... |
Line 645... |
| 632 |
model.addAttribute("counterSize", counterSize.toString());
|
645 |
model.addAttribute("counterSize", counterSize.toString());
|
| 633 |
}
|
646 |
}
|
| 634 |
String customRetailers = JSONObject.valueToString(customRetailersMap.values());
|
647 |
String customRetailers = JSONObject.valueToString(customRetailersMap.values());
|
| 635 |
|
648 |
|
| 636 |
List<CatalogListingModel> catalogModelList = new ArrayList<>(catalogListingMap.values());
|
649 |
List<CatalogListingModel> catalogModelList = new ArrayList<>(catalogListingMap.values());
|
| 637 |
List<CatalogListingModel> catalogModel = catalogModelList.stream()
|
- |
|
| 638 |
.filter(x -> !(x.getBrand().equals("Live Demo"))).collect(Collectors.toList());
|
- |
|
| 639 |
|
650 |
|
| 640 |
Comparator<CatalogListingModel> firstCmp = Comparator.comparing(CatalogListingModel::getMinimumQty,
|
651 |
Comparator<CatalogListingModel> firstCmp = Comparator.comparing(CatalogListingModel::getMinimumQty,
|
| 641 |
Comparator.reverseOrder());
|
652 |
Comparator.reverseOrder());
|
| 642 |
LOGGER.info("monthlyPlanned" + monthlyPlanned);
|
653 |
LOGGER.info("monthlyPlanned" + monthlyPlanned);
|
| - |
|
654 |
model.addAttribute("catalogTagListings",
|
| 643 |
model.addAttribute("catalogTagListings", catalogModel.stream().sorted(firstCmp).collect(Collectors.toList()));
|
655 |
catalogModelList.stream().sorted(firstCmp).collect(Collectors.toList()));
|
| 644 |
model.addAttribute("isAdmin", roleManager.isAdmin(roleIds));
|
656 |
model.addAttribute("isAdmin", roleManager.isAdmin(roleIds));
|
| 645 |
model.addAttribute("brandStockPrices",this.getBrandStockPrices(loginDetails.getFofoId()));
|
657 |
// model.addAttribute("brandStockPrices",this.getBrandStockPrices(loginDetails.getFofoId()));
|
| 646 |
model.addAttribute("customRetailers", customRetailers);
|
658 |
model.addAttribute("customRetailers", customRetailers);
|
| 647 |
model.addAttribute("totalAmount", totalAmount);
|
659 |
model.addAttribute("totalAmount", totalAmount);
|
| 648 |
model.addAttribute("monthlyPlanned", monthlyPlanned);
|
660 |
model.addAttribute("monthlyPlanned", monthlyPlanned);
|
| 649 |
model.addAttribute("totalPcs", totalPcs);
|
661 |
model.addAttribute("totalPcs", totalPcs);
|
| 650 |
return "open-indent";
|
662 |
return "open-indent";
|
| - |
|
663 |
|
| 651 |
}
|
664 |
}
|
| 652 |
|
665 |
|
| 653 |
private List<Order> filterValidOrders(List<Order> lastOrdersList) {
|
666 |
private List<Order> filterValidOrders(List<Order> lastOrdersList) {
|
| 654 |
Iterator<Order> orderIterator = lastOrdersList.iterator();
|
667 |
Iterator<Order> orderIterator = lastOrdersList.iterator();
|
| 655 |
while (orderIterator.hasNext()) {
|
668 |
while (orderIterator.hasNext()) {
|
| Line 905... |
Line 918... |
| 905 |
focusedModelRepository.deleteById(catalogId);
|
918 |
focusedModelRepository.deleteById(catalogId);
|
| 906 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
919 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 907 |
return "response";
|
920 |
return "response";
|
| 908 |
}
|
921 |
}
|
| 909 |
|
922 |
|
| - |
|
923 |
/*
|
| 910 |
private List<BrandStockPrice> getBrandStockPrices(int fofoId) throws Exception {
|
924 |
* private List<BrandStockPrice> getBrandStockPrices(int fofoId) throws
|
| - |
|
925 |
* Exception { Map<String, BrandStockPrice> brandStockPricesMap =
|
| 911 |
Map<String, BrandStockPrice> brandStockPricesMap = inventoryService.getBrandWiseStockValue(fofoId);
|
926 |
* inventoryService.getBrandWiseStockValue(fofoId);
|
| 912 |
|
927 |
*
|
| 913 |
List<DBObject> mobileBrands = mongoClient.getMongoBrands(fofoId, "", 3);
|
928 |
* List<DBObject> mobileBrands = mongoClient.getMongoBrands(fofoId, "", 3);
|
| 914 |
List<BrandStockPrice> brandStockPrices = new ArrayList<>();
|
929 |
* List<BrandStockPrice> brandStockPrices = new ArrayList<>();
|
| 915 |
|
930 |
*
|
| 916 |
mobileBrands.stream().forEach(x -> {
|
- |
|
| 917 |
String brand = (String) x.get("name");
|
931 |
* mobileBrands.stream().forEach(x -> { String brand = (String) x.get("name");
|
| 918 |
if (brandStockPricesMap.containsKey(brand)) {
|
932 |
* if (brandStockPricesMap.containsKey(brand)) { BrandStockPrice brandStockPrice
|
| 919 |
BrandStockPrice brandStockPrice = brandStockPricesMap.get(brand);
|
933 |
* = brandStockPricesMap.get(brand); brandStockPrice.setBrandUrl((String)
|
| 920 |
brandStockPrice.setBrandUrl((String) x.get("url"));
|
- |
|
| 921 |
brandStockPrice.setRank(((Double) x.get("rank")).intValue());
|
934 |
* x.get("url")); brandStockPrice.setRank(((Double) x.get("rank")).intValue());
|
| 922 |
brandStockPrices.add(brandStockPrice);
|
935 |
* brandStockPrices.add(brandStockPrice); } });
|
| 923 |
}
|
936 |
*
|
| 924 |
});
|
- |
|
| 925 |
|
- |
|
| 926 |
return brandStockPrices.stream().filter(x -> x.getTotalQty() > 0).sorted((x, y) -> x.getRank() - y.getRank())
|
937 |
* return brandStockPrices.stream().filter(x -> x.getTotalQty() > 0).sorted((x,
|
| 927 |
.collect(Collectors.toList());
|
938 |
* y) -> x.getRank() - y.getRank()) .collect(Collectors.toList()); }
|
| 928 |
}
|
939 |
*/
|
| 929 |
|
940 |
|
| 930 |
}
|
941 |
}
|
| 931 |
|
942 |
|