| Line 269... |
Line 269... |
| 269 |
@RequestParam(value = "q", required = false) String queryTerm,
|
269 |
@RequestParam(value = "q", required = false) String queryTerm,
|
| 270 |
@RequestParam(value = "hotDeal", required = false) boolean hotDeal) throws Throwable {
|
270 |
@RequestParam(value = "hotDeal", required = false) boolean hotDeal) throws Throwable {
|
| 271 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
271 |
List<FofoCatalogResponse> dealResponse = new ArrayList<>();
|
| 272 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
272 |
UserInfo userInfo = (UserInfo) request.getAttribute("userInfo");
|
| 273 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(userInfo.getRetailerId());
|
273 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(userInfo.getRetailerId());
|
| 274 |
sort = "w" + fs.getWarehouseId() + "_i desc";
|
274 |
sort = "w" + fs.getWarehouseId() + "_i desc";
|
| 275 |
logger.info("log me");
|
275 |
logger.info("log me");
|
| 276 |
dealResponse = this.getCatalogResponse(
|
276 |
dealResponse = this.getCatalogResponse(
|
| 277 |
solrService.getSolrDocs(queryTerm, categoryId, offset, limit, sort, brand, subCategoryId, hotDeal),
|
277 |
solrService.getSolrDocs(queryTerm, categoryId, offset, limit, sort, brand, subCategoryId, hotDeal),
|
| 278 |
hotDeal, userInfo.getRetailerId());
|
278 |
hotDeal, userInfo.getRetailerId());
|
| 279 |
logger.info(dealResponse);
|
279 |
logger.info(dealResponse);
|
| Line 609... |
Line 609... |
| 609 |
}
|
609 |
}
|
| 610 |
} else {
|
610 |
} else {
|
| 611 |
FofoAvailabilityInfo fdi = new FofoAvailabilityInfo();
|
611 |
FofoAvailabilityInfo fdi = new FofoAvailabilityInfo();
|
| 612 |
List<SaholicCIS> currentAvailability = itemAvailabilityMap.get(itemId);
|
612 |
List<SaholicCIS> currentAvailability = itemAvailabilityMap.get(itemId);
|
| 613 |
List<SaholicPOItem> poItemAvailability = null;
|
613 |
List<SaholicPOItem> poItemAvailability = null;
|
| 614 |
if(poItemAvailabilityMap!=null) {
|
614 |
if (poItemAvailabilityMap != null) {
|
| 615 |
poItemAvailability = poItemAvailabilityMap.get(itemId);
|
615 |
poItemAvailability = poItemAvailabilityMap.get(itemId);
|
| 616 |
}
|
616 |
}
|
| 617 |
if(currentAvailability!=null) {
|
617 |
if (currentAvailability != null) {
|
| 618 |
allColorNetAvailability += currentAvailability.stream()
|
618 |
allColorNetAvailability += currentAvailability.stream()
|
| 619 |
.collect(Collectors.summingInt(SaholicCIS::getNetavailability));
|
619 |
.collect(Collectors.summingInt(SaholicCIS::getNetavailability));
|
| 620 |
}
|
620 |
}
|
| 621 |
if(poItemAvailability!=null) {
|
621 |
if (poItemAvailability != null) {
|
| - |
|
622 |
allColorNetAvailability += poItemAvailability.stream()
|
| 622 |
allColorNetAvailability += poItemAvailability.stream().collect(Collectors.summingInt(SaholicPOItem::getUnfulfilledQty));
|
623 |
.collect(Collectors.summingInt(SaholicPOItem::getUnfulfilledQty));
|
| 623 |
}
|
624 |
}
|
| 624 |
Map<Integer, SaholicCIS> map = null;
|
625 |
Map<Integer, SaholicCIS> map = null;
|
| 625 |
if (currentAvailability != null) {
|
626 |
if (currentAvailability != null) {
|
| 626 |
for(SaholicCIS saholicCIS : currentAvailability ) {
|
627 |
for (SaholicCIS saholicCIS : currentAvailability) {
|
| - |
|
628 |
saholicCIS.setWarehouseName(
|
| 627 |
saholicCIS.setWarehouseName(ProfitMandiConstants.WAREHOUSE_MAP.get(saholicCIS.getWarehouseFrom()));
|
629 |
ProfitMandiConstants.WAREHOUSE_MAP.get(saholicCIS.getWarehouseFrom()));
|
| 628 |
}
|
630 |
}
|
| 629 |
map = currentAvailability.stream()
|
631 |
map = currentAvailability.stream()
|
| 630 |
.collect(Collectors.toMap(SaholicCIS::getWarehouseFrom, x -> x));
|
632 |
.collect(Collectors.toMap(SaholicCIS::getWarehouseFrom, x -> x));
|
| 631 |
if (poItemAvailability != null) {
|
633 |
if (poItemAvailability != null) {
|
| 632 |
for (SaholicPOItem saholicPOItem : poItemAvailability) {
|
634 |
for (SaholicPOItem saholicPOItem : poItemAvailability) {
|
| 633 |
if (map.containsKey(saholicPOItem.getWarehouseFrom())) {
|
635 |
if (map.containsKey(saholicPOItem.getWarehouseFrom())) {
|
| 634 |
map.get(saholicPOItem.getWarehouseFrom())
|
636 |
map.get(saholicPOItem.getWarehouseFrom())
|
| 635 |
.setPopendingQty(saholicPOItem.getUnfulfilledQty());
|
637 |
.setPopendingQty(saholicPOItem.getUnfulfilledQty());
|
| - |
|
638 |
map.get(saholicPOItem.getWarehouseFrom())
|
| 636 |
map.get(saholicPOItem.getWarehouseFrom()).setWarehouseName(ProfitMandiConstants.WAREHOUSE_MAP.get(saholicPOItem.getWarehouseFrom()));
|
639 |
.setWarehouseName(ProfitMandiConstants.WAREHOUSE_MAP
|
| - |
|
640 |
.get(saholicPOItem.getWarehouseFrom()));
|
| 637 |
} else {
|
641 |
} else {
|
| 638 |
SaholicCIS saholicCIS = new SaholicCIS();
|
642 |
SaholicCIS saholicCIS = new SaholicCIS();
|
| 639 |
saholicCIS.setAvailability(0);
|
643 |
saholicCIS.setAvailability(0);
|
| 640 |
saholicCIS.setReserved(0);
|
644 |
saholicCIS.setReserved(0);
|
| 641 |
saholicCIS.setItemId(itemId);
|
645 |
saholicCIS.setItemId(itemId);
|
| 642 |
saholicCIS.setPopendingQty(saholicPOItem.getUnfulfilledQty());
|
646 |
saholicCIS.setPopendingQty(saholicPOItem.getUnfulfilledQty());
|
| 643 |
saholicCIS.setWarehouseFrom(saholicPOItem.getWarehouseFrom());
|
647 |
saholicCIS.setWarehouseFrom(saholicPOItem.getWarehouseFrom());
|
| 644 |
saholicCIS.setWarehouseName(ProfitMandiConstants.WAREHOUSE_MAP.get(saholicPOItem.getWarehouseFrom()));
|
648 |
saholicCIS.setWarehouseName(ProfitMandiConstants.WAREHOUSE_MAP
|
| - |
|
649 |
.get(saholicPOItem.getWarehouseFrom()));
|
| 645 |
map.put(saholicPOItem.getWarehouseFrom(), saholicCIS);
|
650 |
map.put(saholicPOItem.getWarehouseFrom(), saholicCIS);
|
| 646 |
}
|
651 |
}
|
| 647 |
}
|
652 |
}
|
| 648 |
}
|
653 |
}
|
| 649 |
} else {
|
654 |
} else {
|
| Line 654... |
Line 659... |
| 654 |
saholicCIS.setAvailability(0);
|
659 |
saholicCIS.setAvailability(0);
|
| 655 |
saholicCIS.setReserved(0);
|
660 |
saholicCIS.setReserved(0);
|
| 656 |
saholicCIS.setItemId(itemId);
|
661 |
saholicCIS.setItemId(itemId);
|
| 657 |
saholicCIS.setPopendingQty(saholicPOItem.getUnfulfilledQty());
|
662 |
saholicCIS.setPopendingQty(saholicPOItem.getUnfulfilledQty());
|
| 658 |
saholicCIS.setWarehouseFrom(saholicPOItem.getWarehouseFrom());
|
663 |
saholicCIS.setWarehouseFrom(saholicPOItem.getWarehouseFrom());
|
| - |
|
664 |
saholicCIS.setWarehouseName(
|
| 659 |
saholicCIS.setWarehouseName(ProfitMandiConstants.WAREHOUSE_MAP.get(saholicPOItem.getWarehouseFrom()));
|
665 |
ProfitMandiConstants.WAREHOUSE_MAP.get(saholicPOItem.getWarehouseFrom()));
|
| 660 |
map.put(saholicPOItem.getWarehouseFrom(), saholicCIS);
|
666 |
map.put(saholicPOItem.getWarehouseFrom(), saholicCIS);
|
| 661 |
}
|
667 |
}
|
| 662 |
}
|
668 |
}
|
| 663 |
|
669 |
|
| 664 |
}
|
670 |
}
|
| Line 695... |
Line 701... |
| 695 |
fdi.setTagId(childItem.getInt("tagId_i"));
|
701 |
fdi.setTagId(childItem.getInt("tagId_i"));
|
| 696 |
fdi.setItem_id(itemId);
|
702 |
fdi.setItem_id(itemId);
|
| 697 |
Float cashBack = schemeService.getItemSchemeCashBack().get(itemId);
|
703 |
Float cashBack = schemeService.getItemSchemeCashBack().get(itemId);
|
| 698 |
cashBack = cashBack == null ? 0 : cashBack;
|
704 |
cashBack = cashBack == null ? 0 : cashBack;
|
| 699 |
fdi.setCashback(cashBack);
|
705 |
fdi.setCashback(cashBack);
|
| - |
|
706 |
fdi.setAvailability(0);
|
| 700 |
fdi.setMinBuyQuantity(1);
|
707 |
fdi.setMinBuyQuantity(1);
|
| 701 |
if (hotDeal) {
|
- |
|
| 702 |
if (currentAvailability != null) {
|
708 |
if (currentAvailability != null) {
|
| 703 |
fdi.setAvailability(currentAvailability.stream()
|
709 |
fdi.setAvailability(currentAvailability.stream()
|
| 704 |
.collect(Collectors.summingInt(SaholicCIS::getNetavailability)));
|
710 |
.collect(Collectors.summingInt(SaholicCIS::getNetavailability)));
|
| 705 |
} else {
|
- |
|
| 706 |
fdi.setAvailability(0);
|
- |
|
| 707 |
}
|
- |
|
| 708 |
} else {
|
- |
|
| 709 |
fdi.setAvailability(100);
|
- |
|
| 710 |
Item item = null;
|
- |
|
| 711 |
try {
|
- |
|
| 712 |
item = itemRepository.selectById(itemId);
|
- |
|
| 713 |
} catch(Exception e) {
|
- |
|
| 714 |
e.printStackTrace();
|
- |
|
| 715 |
continue;
|
- |
|
| 716 |
}
|
- |
|
| 717 |
// In case its tampered glass moq should be 5
|
- |
|
| 718 |
if (item.getCategoryId() == 10020) {
|
- |
|
| 719 |
fdi.setMinBuyQuantity(5);
|
- |
|
| 720 |
}
|
- |
|
| 721 |
}
|
711 |
}
|
| 722 |
fdi.setQuantityStep(1);
|
712 |
fdi.setQuantityStep(1);
|
| 723 |
fdi.setMaxQuantity(Math.min(fdi.getAvailability(), 100));
|
713 |
fdi.setMaxQuantity(Math.min(fdi.getAvailability(), 100));
|
| 724 |
fofoAvailabilityInfoMap.put(itemId, fdi);
|
714 |
fofoAvailabilityInfoMap.put(itemId, fdi);
|
| 725 |
}
|
715 |
}
|
| 726 |
}
|
716 |
}
|
| 727 |
if (fdiAnyColour != null) {
|
717 |
if (fdiAnyColour != null) {
|
| 728 |
if(allColorNetAvailability<=0) {
|
718 |
if (allColorNetAvailability <= 0) {
|
| 729 |
for (Map.Entry<Integer, FofoAvailabilityInfo> entry : fofoAvailabilityInfoMap.entrySet()) {
|
719 |
for (Map.Entry<Integer, FofoAvailabilityInfo> entry : fofoAvailabilityInfoMap.entrySet()) {
|
| 730 |
entry.getValue().setColorClass("grey");
|
720 |
entry.getValue().setColorClass("grey");
|
| 731 |
}
|
721 |
}
|
| 732 |
} else {
|
722 |
} else {
|
| 733 |
fdiAnyColour.setColorClass(modelColorClass);
|
723 |
fdiAnyColour.setColorClass(modelColorClass);
|