| Line 12... |
Line 12... |
| 12 |
import java.time.YearMonth;
|
12 |
import java.time.YearMonth;
|
| 13 |
import java.time.ZoneOffset;
|
13 |
import java.time.ZoneOffset;
|
| 14 |
import java.time.format.DateTimeFormatter;
|
14 |
import java.time.format.DateTimeFormatter;
|
| 15 |
import java.util.ArrayList;
|
15 |
import java.util.ArrayList;
|
| 16 |
import java.util.Arrays;
|
16 |
import java.util.Arrays;
|
| - |
|
17 |
import java.util.Comparator;
|
| 17 |
import java.util.HashMap;
|
18 |
import java.util.HashMap;
|
| 18 |
import java.util.HashSet;
|
19 |
import java.util.HashSet;
|
| 19 |
import java.util.LinkedHashMap;
|
20 |
import java.util.LinkedHashMap;
|
| 20 |
import java.util.List;
|
21 |
import java.util.List;
|
| 21 |
import java.util.Map;
|
22 |
import java.util.Map;
|
| Line 75... |
Line 76... |
| 75 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
76 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 76 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
77 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
| 77 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
78 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
| 78 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTargetDetails;
|
79 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTargetDetails;
|
| 79 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
80 |
import com.spice.profitmandi.dao.entity.fofo.PartnerType;
|
| - |
|
81 |
import com.spice.profitmandi.dao.entity.fofo.PurchaseReturnItem;
|
| 80 |
import com.spice.profitmandi.dao.entity.inventory.ReporticoCacheTable;
|
82 |
import com.spice.profitmandi.dao.entity.inventory.ReporticoCacheTable;
|
| 81 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
83 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| 82 |
import com.spice.profitmandi.dao.entity.user.Lead;
|
84 |
import com.spice.profitmandi.dao.entity.user.Lead;
|
| 83 |
import com.spice.profitmandi.dao.enumuration.catalog.ItemCriteriaType;
|
85 |
import com.spice.profitmandi.dao.enumuration.catalog.ItemCriteriaType;
|
| 84 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
86 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| Line 495... |
Line 497... |
| 495 |
}
|
497 |
}
|
| 496 |
return String.valueOf(finalval);
|
498 |
return String.valueOf(finalval);
|
| 497 |
|
499 |
|
| 498 |
}
|
500 |
}
|
| 499 |
|
501 |
|
| - |
|
502 |
/*
|
| 500 |
private List<BrandStockPrice> getBrandStockPrices(int fofoId) throws Exception {
|
503 |
* private List<BrandStockPrice> getBrandStockPrices(int fofoId) throws
|
| - |
|
504 |
* Exception { Map<String, BrandStockPrice> brandStockPricesMap =
|
| 501 |
Map<String, BrandStockPrice> brandStockPricesMap = inventoryService.getBrandWiseStockValue(fofoId);
|
505 |
* inventoryService.getBrandWiseStockValue(fofoId);
|
| 502 |
|
506 |
*
|
| 503 |
List<DBObject> mobileBrands = mongoClient.getAllBrandsToDisplay(3);
|
507 |
* List<DBObject> mobileBrands = mongoClient.getAllBrandsToDisplay(3);
|
| 504 |
List<BrandStockPrice> brandStockPrices = new ArrayList<>();
|
508 |
* List<BrandStockPrice> brandStockPrices = new ArrayList<>();
|
| 505 |
|
509 |
*
|
| 506 |
mobileBrands.stream().forEach(x -> {
|
- |
|
| 507 |
String brand = (String) x.get("name");
|
510 |
* mobileBrands.stream().forEach(x -> { String brand = (String) x.get("name");
|
| 508 |
if (brandStockPricesMap.containsKey(brand)) {
|
511 |
* if (brandStockPricesMap.containsKey(brand)) { BrandStockPrice brandStockPrice
|
| 509 |
BrandStockPrice brandStockPrice = brandStockPricesMap.get(brand);
|
512 |
* = brandStockPricesMap.get(brand); brandStockPrice.setBrandUrl((String)
|
| 510 |
brandStockPrice.setBrandUrl((String) x.get("url"));
|
- |
|
| 511 |
brandStockPrice.setRank(((Double) x.get("rank")).intValue());
|
513 |
* x.get("url")); brandStockPrice.setRank(((Double) x.get("rank")).intValue());
|
| 512 |
brandStockPrices.add(brandStockPrice);
|
514 |
* brandStockPrices.add(brandStockPrice); } });
|
| 513 |
}
|
515 |
*
|
| 514 |
});
|
- |
|
| 515 |
|
- |
|
| 516 |
return brandStockPrices.stream().filter(x -> x.getTotalQty() > 0).sorted((x, y) -> x.getRank() - y.getRank())
|
516 |
* return brandStockPrices.stream().filter(x -> x.getTotalQty() > 0).sorted((x,
|
| 517 |
.collect(Collectors.toList());
|
517 |
* y) -> x.getRank() - y.getRank()) .collect(Collectors.toList()); }
|
| 518 |
}
|
518 |
*/
|
| 519 |
|
519 |
|
| 520 |
@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
|
520 |
@RequestMapping(value = "/dashboard", method = RequestMethod.GET)
|
| 521 |
public String dashboard(HttpServletRequest request, Model model) throws Exception {
|
521 |
public String dashboard(HttpServletRequest request, Model model) throws Exception {
|
| 522 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
522 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 523 |
String email = loginDetails.getEmailId();
|
523 |
String email = loginDetails.getEmailId();
|
| Line 551... |
Line 551... |
| 551 |
inventoryItemRepository.selectCountByActivatedNotSold(loginDetails.getFofoId()));
|
551 |
inventoryItemRepository.selectCountByActivatedNotSold(loginDetails.getFofoId()));
|
| 552 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
552 |
LocalDateTime curDate = LocalDate.now().atStartOfDay();
|
| 553 |
Map<Integer, Double> accesoriesmtdsale = fofoOrderRepository
|
553 |
Map<Integer, Double> accesoriesmtdsale = fofoOrderRepository
|
| 554 |
.selectSumSaleGroupByFofoIdsForMobileOrAccessories(loginDetails.getFofoId(),
|
554 |
.selectSumSaleGroupByFofoIdsForMobileOrAccessories(loginDetails.getFofoId(),
|
| 555 |
curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), Optional.of(false));
|
555 |
curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), Optional.of(false));
|
| 556 |
LOGGER.info("accesoriesmtdsale" + accesoriesmtdsale);
|
- |
|
| - |
|
556 |
|
| 557 |
Double accesoriesStock = currentInventorySnapshotRepository
|
557 |
Double accesoriesStock = currentInventorySnapshotRepository
|
| 558 |
.selectSumStockGroupByFofoIdsForMobileOrAccessories(loginDetails.getFofoId(),
|
558 |
.selectSumStockGroupByFofoIdsForMobileOrAccessories(loginDetails.getFofoId(),
|
| 559 |
Optional.of(false))
|
559 |
Optional.of(false))
|
| 560 |
.get(loginDetails.getFofoId());
|
560 |
.get(loginDetails.getFofoId());
|
| 561 |
|
561 |
|
| 562 |
model.addAttribute("accesoriesStock", String.format("%.0f", accesoriesStock));
|
562 |
model.addAttribute("accesoriesStock", String.format("%.0f", accesoriesStock));
|
| - |
|
563 |
// model.addAttribute("brandStockPrices",
|
| 563 |
model.addAttribute("brandStockPrices", this.getBrandStockPrices(loginDetails.getFofoId()));
|
564 |
// this.getBrandStockPrices(loginDetails.getFofoId()));
|
| 564 |
model.addAttribute("salesMap", this.getSales(loginDetails.getFofoId()));
|
565 |
model.addAttribute("salesMap", this.getSales(loginDetails.getFofoId()));
|
| 565 |
ChartModel cm = this.getBrandChart(loginDetails.getFofoId());
|
566 |
ChartModel cm = this.getBrandChart(loginDetails.getFofoId());
|
| 566 |
|
567 |
|
| 567 |
LOGGER.info("chartMap" + gson.toJson(cm));
|
568 |
LOGGER.info("chartMap" + gson.toJson(cm));
|
| 568 |
model.addAttribute("chartMap", gson.toJson(cm));
|
569 |
model.addAttribute("chartMap", gson.toJson(cm));
|
| 569 |
// this.setInvestments
|
- |
|
| 570 |
//
|
570 |
|
| 571 |
model.addAttribute("investments", this.getInvestments(loginDetails.getFofoId()));
|
571 |
model.addAttribute("investments", this.getInvestments(loginDetails.getFofoId()));
|
| 572 |
model.addAttribute("isInvestmentOk", partnerInvestmentService.isInvestmentOk(loginDetails.getFofoId(),
|
572 |
model.addAttribute("isInvestmentOk", partnerInvestmentService.isInvestmentOk(loginDetails.getFofoId(),
|
| 573 |
10, ProfitMandiConstants.CUTOFF_INVESTMENT));
|
573 |
10, ProfitMandiConstants.CUTOFF_INVESTMENT));
|
| 574 |
|
574 |
|
| 575 |
// Hardcoded for valentine
|
- |
|
| 576 |
// Hardcoded for valentine
|
- |
|
| 577 |
|
- |
|
| 578 |
List<Offer> offers = offerRepository.selectOfferByStatus(true);
|
575 |
List<Offer> offers = offerRepository.selectOfferByStatus(true);
|
| 579 |
if (!offers.isEmpty()) {
|
576 |
if (!offers.isEmpty()) {
|
| 580 |
List<CreateOfferRequest> cors = new ArrayList<>();
|
577 |
List<CreateOfferRequest> cors = new ArrayList<>();
|
| 581 |
for (Offer offer : offers) {
|
578 |
for (Offer offer : offers) {
|
| 582 |
|
579 |
|
| Line 809... |
Line 806... |
| 809 |
Map<Integer, PartnerDetailModel> warehousePartnerDetailMap = null;
|
806 |
Map<Integer, PartnerDetailModel> warehousePartnerDetailMap = null;
|
| 810 |
ReporticoCacheTable rctSaholic = null;
|
807 |
ReporticoCacheTable rctSaholic = null;
|
| 811 |
ReporticoCacheTable rctPartneStat = null;
|
808 |
ReporticoCacheTable rctPartneStat = null;
|
| 812 |
|
809 |
|
| 813 |
Map<Integer, WarehouseWiseStockModel> warehouseStockMap = new HashMap<>();
|
810 |
Map<Integer, WarehouseWiseStockModel> warehouseStockMap = new HashMap<>();
|
| - |
|
811 |
LinkedHashMap<Integer, WarehouseWiseStockModel> warehouseStockSortedMap = new LinkedHashMap<>();
|
| - |
|
812 |
|
| 814 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
813 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
| 815 |
LinkedHashMap<Integer, String> wm = new LinkedHashMap<Integer, String>();
|
814 |
LinkedHashMap<Integer, String> wm = new LinkedHashMap<Integer, String>();
|
| - |
|
815 |
|
| 816 |
Map<String, BrandWisePartnerSaleModel> partnersBrandSaleMap = null;
|
816 |
Map<String, BrandWisePartnerSaleModel> partnersBrandSaleMap = null;
|
| 817 |
List<BrandWisePartnerSaleModel> accessoriesBrandSales = null;
|
817 |
List<BrandWisePartnerSaleModel> accessoriesBrandSales = null;
|
| - |
|
818 |
|
| 818 |
for (Map.Entry<Integer, String> entry : warehouseMap.entrySet()) {
|
819 |
for (Map.Entry<Integer, String> entry : warehouseMap.entrySet()) {
|
| 819 |
wm.put(entry.getKey(), entry.getValue());
|
820 |
wm.put(entry.getKey(), entry.getValue());
|
| 820 |
}
|
821 |
}
|
| 821 |
|
822 |
|
| 822 |
wm.put(0, "Total Values");
|
823 |
wm.put(0, "Total Values");
|
| 823 |
long stockValue = 0;
|
824 |
long stockValue = 0;
|
| 824 |
long stockQty = 0;
|
825 |
long stockQty = 0;
|
| 825 |
long pendingIndent = 0;
|
826 |
long pendingIndent = 0;
|
| 826 |
long tertiary = 0;
|
827 |
long tertiary = 0;
|
| 827 |
if (positions.size() > 0) {
|
- |
|
| 828 |
if (positions.stream()
|
- |
|
| 829 |
.filter(x -> x.getEscalationType().equals(EscalationType.L3)
|
- |
|
| 830 |
|| x.getEscalationType().equals(EscalationType.L4)
|
- |
|
| 831 |
|| x.getEscalationType().equals(EscalationType.L5))
|
- |
|
| 832 |
.count() > 0) {
|
- |
|
| 833 |
|
- |
|
| 834 |
List<WarehouseWiseStockModel> warehouseStocks = saholicInventoryCISRepository
|
- |
|
| 835 |
.selectGroupByWarehouse();
|
- |
|
| 836 |
|
- |
|
| 837 |
warehouseStockMap = warehouseStocks.stream()
|
- |
|
| 838 |
.collect(Collectors.toMap(x -> x.getWarehouseId(), x -> x));
|
- |
|
| 839 |
|
- |
|
| 840 |
if (!warehouseStocks.isEmpty()) {
|
- |
|
| 841 |
for (WarehouseWiseStockModel warehouseStock : warehouseStocks) {
|
- |
|
| 842 |
stockValue += warehouseStock.getStockValue();
|
- |
|
| 843 |
stockQty += warehouseStock.getStockQty();
|
- |
|
| 844 |
pendingIndent += warehouseStock.getPendingIndent();
|
- |
|
| 845 |
tertiary += warehouseStock.getTertiary();
|
- |
|
| 846 |
}
|
- |
|
| 847 |
WarehouseWiseStockModel ws = new WarehouseWiseStockModel();
|
- |
|
| 848 |
ws.setStockQty(stockQty);
|
- |
|
| 849 |
ws.setStockValue(stockValue);
|
- |
|
| 850 |
ws.setPendingIndent(pendingIndent);
|
- |
|
| 851 |
ws.setTertiary(tertiary);
|
- |
|
| 852 |
ws.setWarehouseId(0);
|
- |
|
| 853 |
warehouseStockMap.put(0, ws);
|
- |
|
| 854 |
|
828 |
|
| - |
|
829 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
|
| - |
|
830 |
Set<Integer> fofoIds = storeGuyMap.get(authUser.getEmailId());
|
| - |
|
831 |
|
| - |
|
832 |
LOGGER.info("fofoIds" + fofoIds);
|
| - |
|
833 |
|
| - |
|
834 |
if (fofoIds != null) {
|
| - |
|
835 |
|
| - |
|
836 |
Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
|
| - |
|
837 |
.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream()
|
| - |
|
838 |
.collect(Collectors.groupingBy(FofoStore::getWarehouseId,
|
| - |
|
839 |
Collectors.mapping(FofoStore::getId, Collectors.toList())));
|
| - |
|
840 |
// warehouseStock
|
| - |
|
841 |
List<WarehouseWiseStockModel> warehouseStocks = saholicInventoryCISRepository
|
| - |
|
842 |
.selectGroupByWarehouse(new ArrayList<>(warehouseIdFofoIdMap.keySet()));
|
| - |
|
843 |
|
| - |
|
844 |
warehouseStockMap = warehouseStocks.stream().collect(Collectors.toMap(x -> x.getWarehouseId(), x -> x));
|
| - |
|
845 |
|
| - |
|
846 |
if (!warehouseStockMap.isEmpty()) {
|
| - |
|
847 |
for (Entry<Integer, WarehouseWiseStockModel> warehouseStock : warehouseStockMap.entrySet()) {
|
| - |
|
848 |
stockValue += warehouseStock.getValue().getStockValue();
|
| - |
|
849 |
stockQty += warehouseStock.getValue().getStockQty();
|
| - |
|
850 |
pendingIndent += warehouseStock.getValue().getPendingIndent();
|
| - |
|
851 |
tertiary += warehouseStock.getValue().getTertiary();
|
| 855 |
}
|
852 |
}
|
| - |
|
853 |
WarehouseWiseStockModel ws = new WarehouseWiseStockModel();
|
| - |
|
854 |
ws.setStockQty(stockQty);
|
| - |
|
855 |
ws.setStockValue(stockValue);
|
| - |
|
856 |
ws.setPendingIndent(pendingIndent);
|
| - |
|
857 |
ws.setTertiary(tertiary);
|
| - |
|
858 |
ws.setWarehouseId(0);
|
| - |
|
859 |
warehouseStockMap.put(0, ws);
|
| 856 |
|
860 |
|
| - |
|
861 |
}
|
| - |
|
862 |
|
| 857 |
warehousePartnerDetailMap = this.getWarehousePartnerDetail();
|
863 |
warehouseStockMap.entrySet().stream().sorted(Map.Entry.comparingByKey(Comparator.reverseOrder()))
|
| - |
|
864 |
.forEachOrdered(x -> warehouseStockSortedMap.put(x.getKey(), x.getValue()));
|
| - |
|
865 |
|
| 858 |
rctSaholic = reporticoCacheTableRepository.selectByTableName("SaholicInventoryCIS");
|
866 |
rctSaholic = reporticoCacheTableRepository.selectByTableName("SaholicInventoryCIS");
|
| - |
|
867 |
|
| - |
|
868 |
// warehouseStock
|
| - |
|
869 |
warehousePartnerDetailMap = this.getWarehousePartnerDetail(warehouseIdFofoIdMap);
|
| 859 |
rctPartneStat = reporticoCacheTableRepository.selectByTableName("partnerStat");
|
870 |
rctPartneStat = reporticoCacheTableRepository.selectByTableName("partnerStat");
|
| 860 |
|
871 |
|
| 861 |
partnersBrandSaleMap = fofoStoreRepository.selectGroupByBrandWarehousePartnerSale().stream()
|
872 |
partnersBrandSaleMap = fofoStoreRepository
|
| - |
|
873 |
.selectGroupByBrandWarehousePartnerSale(new ArrayList<>(fofoIds)).stream()
|
| 862 |
.collect(Collectors.toMap(x -> x.getBrand(), x -> x));
|
874 |
.collect(Collectors.toMap(x -> x.getBrand(), x -> x));
|
| 863 |
|
875 |
|
| 864 |
List<BrandWiseUnbilledActivateStockModel> unbilledActivatedStock = fofoStoreRepository
|
876 |
List<BrandWiseUnbilledActivateStockModel> unbilledActivatedStock = fofoStoreRepository
|
| 865 |
.selectUnbilledActivateStockGroupByBrand();
|
877 |
.selectUnbilledActivateStockGroupByBrand(new ArrayList<>(fofoIds));
|
| 866 |
for (BrandWiseUnbilledActivateStockModel un : unbilledActivatedStock) {
|
878 |
for (BrandWiseUnbilledActivateStockModel un : unbilledActivatedStock) {
|
| 867 |
BrandWisePartnerSaleModel bpt = partnersBrandSaleMap.get(un.getBrand());
|
879 |
BrandWisePartnerSaleModel bpt = partnersBrandSaleMap.get(un.getBrand());
|
| 868 |
if (bpt != null) {
|
880 |
if (bpt != null) {
|
| 869 |
bpt.setAmtd(un.getUnbilledMtd());
|
881 |
bpt.setAmtd(un.getUnbilledMtd());
|
| 870 |
bpt.setUamtdQty(un.getUnbilledMTDQty());
|
882 |
bpt.setUamtdQty(un.getUnbilledMTDQty());
|
| 871 |
} else {
|
883 |
} else {
|
| 872 |
bpt = new BrandWisePartnerSaleModel();
|
884 |
bpt = new BrandWisePartnerSaleModel();
|
| 873 |
bpt.setBrand(un.getBrand());
|
885 |
bpt.setBrand(un.getBrand());
|
| 874 |
bpt.setAmtd(un.getUnbilledMtd());
|
886 |
bpt.setAmtd(un.getUnbilledMtd());
|
| 875 |
bpt.setUamtdQty(un.getUnbilledMTDQty());
|
887 |
bpt.setUamtdQty(un.getUnbilledMTDQty());
|
| 876 |
bpt.setLms(0);
|
888 |
bpt.setLms(0);
|
| 877 |
bpt.setLmtd(0);
|
889 |
bpt.setLmtd(0);
|
| 878 |
bpt.setMtd(0);
|
890 |
bpt.setMtd(0);
|
| 879 |
bpt.setMtdQty(0);
|
891 |
bpt.setMtdQty(0);
|
| 880 |
bpt.setLmtd(0);
|
892 |
bpt.setLmtd(0);
|
| 881 |
bpt.setLmtdQty(0);
|
893 |
bpt.setLmtdQty(0);
|
| 882 |
partnersBrandSaleMap.put(un.getBrand(), bpt);
|
894 |
partnersBrandSaleMap.put(un.getBrand(), bpt);
|
| 883 |
}
|
- |
|
| 884 |
}
|
895 |
}
|
| 885 |
accessoriesBrandSales = fofoStoreRepository.selectGroupByBrandAccesoriesWarehousePartnerSale();
|
- |
|
| 886 |
}
|
896 |
}
|
| - |
|
897 |
accessoriesBrandSales = fofoStoreRepository
|
| - |
|
898 |
.selectGroupByBrandAccesoriesWarehousePartnerSale(new ArrayList<>(fofoIds));
|
| - |
|
899 |
|
| 887 |
}
|
900 |
}
|
| 888 |
|
901 |
|
| 889 |
if (Arrays.asList("amit.gupta@shop2020.in", "tejbeer.kaur@shop2020.in", "manish.tiwari@smartdukaan.com")
|
902 |
if (Arrays.asList("amit.gupta@shop2020.in", "tejbeer.kaur@shop2020.in", "manish.tiwari@smartdukaan.com")
|
| 890 |
.contains(email)) {
|
903 |
.contains(email))
|
| - |
|
904 |
|
| - |
|
905 |
{
|
| 891 |
menus = menuRepository.selectAll();
|
906 |
menus = menuRepository.selectAll();
|
| 892 |
} else if (positions.size() > 0) {
|
907 |
} else if (positions.size() > 0) {
|
| 893 |
if (positions.stream().filter(x -> x.getEscalationType().equals(EscalationType.L5)).count() > 0) {
|
908 |
if (positions.stream().filter(x -> x.getEscalationType().equals(EscalationType.L5)).count() > 0) {
|
| 894 |
menus = menuRepository.selectAll();
|
909 |
menus = menuRepository.selectAll();
|
| 895 |
} else {
|
910 |
} else {
|
| Line 929... |
Line 944... |
| 929 |
model.addAttribute("rctPartneStat", rctPartneStat);
|
944 |
model.addAttribute("rctPartneStat", rctPartneStat);
|
| 930 |
|
945 |
|
| 931 |
model.addAttribute("reporticoDate", rctSaholic);
|
946 |
model.addAttribute("reporticoDate", rctSaholic);
|
| 932 |
model.addAttribute("warehousePartnerDetailMap", warehousePartnerDetailMap);
|
947 |
model.addAttribute("warehousePartnerDetailMap", warehousePartnerDetailMap);
|
| 933 |
model.addAttribute("warehouseMap", wm);
|
948 |
model.addAttribute("warehouseMap", wm);
|
| 934 |
model.addAttribute("warehouseStockMap", warehouseStockMap);
|
949 |
model.addAttribute("warehouseStockMap", warehouseStockSortedMap);
|
| 935 |
model.addAttribute("brandSalesMap", partnersBrandSaleMap);
|
950 |
model.addAttribute("brandSalesMap", partnersBrandSaleMap);
|
| 936 |
|
951 |
|
| 937 |
model.addAttribute("accessoriesBrandSales", accessoriesBrandSales);
|
952 |
model.addAttribute("accessoriesBrandSales", accessoriesBrandSales);
|
| 938 |
|
953 |
|
| 939 |
} catch (ProfitMandiBusinessException e) {
|
954 |
} catch (ProfitMandiBusinessException e) {
|
| Line 942... |
Line 957... |
| 942 |
LOGGER.info("menu" + menuList);
|
957 |
LOGGER.info("menu" + menuList);
|
| 943 |
model.addAttribute("menu", menuList);
|
958 |
model.addAttribute("menu", menuList);
|
| 944 |
return "admin";
|
959 |
return "admin";
|
| 945 |
}
|
960 |
}
|
| 946 |
|
961 |
|
| 947 |
/*
|
- |
|
| 948 |
* @RequestMapping(value = "/getL1AuthUser", method = RequestMethod.GET) public
|
- |
|
| 949 |
* String L1AuthUsersDetail(HttpServletRequest request, Model
|
- |
|
| 950 |
* model, @RequestParam int authId) throws Exception {
|
- |
|
| 951 |
*
|
- |
|
| 952 |
* Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
- |
|
| 953 |
*
|
- |
|
| 954 |
* LocalDateTime curDate = LocalDate.now().atStartOfDay(); Map<Integer, Double>
|
- |
|
| 955 |
* lmtdSale = fofoOrderItemRepository.selectSumAmountGroupByRetailer(
|
- |
|
| 956 |
* curDate.withDayOfMonth(1).minusMonths(1),
|
- |
|
| 957 |
* curDate.with(LocalTime.MAX).minusMonths(1), 0, false); Map<Integer, Double>
|
- |
|
| 958 |
* mtdSale =
|
- |
|
| 959 |
* fofoOrderItemRepository.selectSumAmountGroupByRetailer(curDate.withDayOfMonth
|
- |
|
| 960 |
* (1), curDate.with(LocalTime.MAX), 0, false); Map<Integer, List<Integer>>
|
- |
|
| 961 |
* L2L1Mapping = csService.getL1L2Mapping();
|
- |
|
| 962 |
*
|
- |
|
| 963 |
* LOGGER.info("L2L1Mapping" + L2L1Mapping); List<Integer> l1authIds =
|
- |
|
| 964 |
* L2L1Mapping.get(authId);
|
- |
|
| 965 |
*
|
- |
|
| 966 |
* Map<Integer, Object> authIdAndallValues = new LinkedHashMap<>(); Map<Integer,
|
- |
|
| 967 |
* Object> authIdAndAuthUserMap = new LinkedHashMap<>();
|
- |
|
| 968 |
*
|
- |
|
| 969 |
* Map<Integer, Long> ticketMap =
|
- |
|
| 970 |
* ticketRepository.selectAllNotClosedTicketsGroupByRetailer(); for (Integer
|
- |
|
| 971 |
* l1AuthId : l1authIds) {
|
- |
|
| 972 |
*
|
- |
|
| 973 |
* double totallmtdAmount = 0; double totalmtdAmount = 0; int totalTicketCount =
|
- |
|
| 974 |
* 0; float totalTodayInvestment = 0; float totalStockInInvestment = 0; double
|
- |
|
| 975 |
* currentMonthRatingAllPartners = 0; Map<Integer, Long> leadCount =
|
- |
|
| 976 |
* leadRepository.selectByAssignAuthIdAndStatus(l1AuthId, LeadStatus.followUp)
|
- |
|
| 977 |
* .stream().collect(Collectors.groupingBy(Lead::getAssignTo,
|
- |
|
| 978 |
* Collectors.counting()));
|
- |
|
| 979 |
*
|
- |
|
| 980 |
* AuthUser authUser = authRepository.selectById(l1AuthId);
|
- |
|
| 981 |
*
|
- |
|
| 982 |
* authIdAndAuthUserMap.put(l1AuthId, authUser);
|
- |
|
| 983 |
*
|
- |
|
| 984 |
* List<Integer> fofoIds = pp.get(l1AuthId);
|
- |
|
| 985 |
*
|
- |
|
| 986 |
* Map<Integer, PartnerDailyInvestment> partnerInvestentMap =
|
- |
|
| 987 |
* partnerInvestmentService .getInvestment(fofoIds,
|
- |
|
| 988 |
* 0).stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
- |
|
| 989 |
*
|
- |
|
| 990 |
* for (Integer fId : fofoIds) { try { PartnerDailyInvestment investment =
|
- |
|
| 991 |
* partnerInvestentMap.get(fId); totalTodayInvestment +=
|
- |
|
| 992 |
* investment.getTotalInvestment(); totalStockInInvestment +=
|
- |
|
| 993 |
* investment.getInStockAmount(); } catch (Exception e) { }
|
- |
|
| 994 |
*
|
- |
|
| 995 |
* double currentMonthRating = hygieneDataRepository.selectRatingAvg(fId,
|
- |
|
| 996 |
* curDate.withDayOfMonth(1).minusMonths(1),
|
- |
|
| 997 |
* curDate.plusMonths(1).withDayOfMonth(1));
|
- |
|
| 998 |
*
|
- |
|
| 999 |
* currentMonthRatingAllPartners += currentMonthRating;
|
- |
|
| 1000 |
*
|
- |
|
| 1001 |
* fofoIds.size();
|
- |
|
| 1002 |
*
|
- |
|
| 1003 |
* Double lmtdAmount = lmtdSale.get(fId); Double mtdAmount = mtdSale.get(fId);
|
- |
|
| 1004 |
* Long ticketCount = ticketMap.get(fId); if (ticketCount != null) {
|
- |
|
| 1005 |
* totalTicketCount += ticketCount; }
|
- |
|
| 1006 |
*
|
- |
|
| 1007 |
* if (lmtdAmount != null) { totallmtdAmount += lmtdAmount; }
|
- |
|
| 1008 |
*
|
- |
|
| 1009 |
* if (mtdAmount != null) { totalmtdAmount += mtdAmount; }
|
- |
|
| 1010 |
*
|
- |
|
| 1011 |
* } LOGGER.info("currentMonthRatingAllPartners" +
|
- |
|
| 1012 |
* currentMonthRatingAllPartners); LOGGER.info("size" + fofoIds.size()); double
|
- |
|
| 1013 |
* totalHygieneRating = currentMonthRatingAllPartners / fofoIds.size();
|
- |
|
| 1014 |
*
|
- |
|
| 1015 |
* LOGGER.info("totalHygieneRating" + totalHygieneRating);
|
- |
|
| 1016 |
*
|
- |
|
| 1017 |
* PartnerDetailModel pm = new PartnerDetailModel();
|
- |
|
| 1018 |
* pm.setLmtd(totallmtdAmount); pm.setMtd(totalmtdAmount); if
|
- |
|
| 1019 |
* (leadCount.get(l1AuthId) != null) {
|
- |
|
| 1020 |
* pm.setLeads(leadCount.get(l1AuthId).intValue()); } else { pm.setLeads(0); }
|
- |
|
| 1021 |
*
|
- |
|
| 1022 |
* pm.setInvestment(totalTodayInvestment);
|
- |
|
| 1023 |
* pm.setStockInInvestment(totalStockInInvestment);
|
- |
|
| 1024 |
* pm.setTicket(totalTicketCount); pm.setHygiene((double)
|
- |
|
| 1025 |
* Math.round(totalHygieneRating)); authIdAndallValues.put(l1AuthId, pm);
|
- |
|
| 1026 |
*
|
- |
|
| 1027 |
* } model.addAttribute("authIdAndallValues", authIdAndallValues);
|
- |
|
| 1028 |
* model.addAttribute("authIdAndAuthUserMap", authIdAndAuthUserMap);
|
- |
|
| 1029 |
* LOGGER.info("authIdAndallValues" + authIdAndallValues);
|
- |
|
| 1030 |
*
|
- |
|
| 1031 |
* return "auth_user_detail"; }
|
- |
|
| 1032 |
*/
|
- |
|
| 1033 |
|
- |
|
| 1034 |
@RequestMapping(value = "/getAuthUserPartners", method = RequestMethod.GET)
|
962 |
@RequestMapping(value = "/getAuthUserPartners", method = RequestMethod.GET)
|
| 1035 |
public String AuthUserPartnersDetail(HttpServletRequest request, Model model, @RequestParam int authId)
|
963 |
public String AuthUserPartnersDetail(HttpServletRequest request, Model model, @RequestParam int authId)
|
| 1036 |
throws Exception {
|
964 |
throws Exception {
|
| 1037 |
|
965 |
|
| 1038 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
966 |
Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
|
| Line 1053... |
Line 981... |
| 1053 |
}
|
981 |
}
|
| 1054 |
|
982 |
|
| 1055 |
@RequestMapping(value = "/getWarehousePartners", method = RequestMethod.GET)
|
983 |
@RequestMapping(value = "/getWarehousePartners", method = RequestMethod.GET)
|
| 1056 |
public String warehousePartnersDetail(HttpServletRequest request, Model model, @RequestParam int warehouseId)
|
984 |
public String warehousePartnersDetail(HttpServletRequest request, Model model, @RequestParam int warehouseId)
|
| 1057 |
throws Exception {
|
985 |
throws Exception {
|
| - |
|
986 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
987 |
String email = loginDetails.getEmailId();
|
| - |
|
988 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
|
| - |
|
989 |
Set<Integer> authfofoIds = storeGuyMap.get(email);
|
| - |
|
990 |
|
| - |
|
991 |
Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
|
| - |
|
992 |
.selectActivePartnersByRetailerIds(new ArrayList<>(authfofoIds)).stream().collect(Collectors.groupingBy(
|
| - |
|
993 |
FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
|
| 1058 |
|
994 |
|
| 1059 |
Map<Integer, CustomRetailer> fofoIdAndPartnerMap = retailerService.getFofoRetailers(false);
|
995 |
Map<Integer, CustomRetailer> fofoIdAndPartnerMap = retailerService.getFofoRetailers(false);
|
| 1060 |
Map<Integer, PartnerDetailModel> fofoIdAndallValues = this.getPartnersStatDataFromFile();
|
996 |
Map<Integer, PartnerDetailModel> fofoIdAndallValues = this.getPartnersStatDataFromFile();
|
| 1061 |
if (warehouseId != 0) {
|
997 |
if (warehouseId != 0) {
|
| - |
|
998 |
List<Integer> fofoIds = warehouseIdFofoIdMap.get(warehouseId);
|
| 1062 |
|
999 |
/*
|
| - |
|
1000 |
* List<Integer> fofoIds =
|
| 1063 |
List<Integer> fofoIds = fofoStoreRepository.selectActivePartnerByWarehouse(warehouseId).stream()
|
1001 |
* fofoStoreRepository.selectActivePartnerByWarehouse(warehouseId).stream()
|
| 1064 |
.map(x -> x.getId()).collect(Collectors.toList());
|
1002 |
* .map(x -> x.getId()).collect(Collectors.toList());
|
| - |
|
1003 |
*/
|
| 1065 |
fofoIdAndallValues = fofoIdAndallValues.entrySet().stream().filter(x -> fofoIds.contains(x.getKey()))
|
1004 |
fofoIdAndallValues = fofoIdAndallValues.entrySet().stream().filter(x -> fofoIds.contains(x.getKey()))
|
| 1066 |
.collect(Collectors.toMap(x -> x.getKey(), x -> x.getValue()));
|
1005 |
.collect(Collectors.toMap(x -> x.getKey(), x -> x.getValue()));
|
| 1067 |
} else {
|
1006 |
} else {
|
| - |
|
1007 |
fofoIdAndallValues = fofoIdAndallValues.entrySet().stream()
|
| - |
|
1008 |
.filter(x -> new ArrayList<>(authfofoIds).contains(x.getKey()))
|
| - |
|
1009 |
.collect(Collectors.toMap(x -> x.getKey(), x -> x.getValue()));
|
| 1068 |
}
|
1010 |
}
|
| 1069 |
|
1011 |
|
| 1070 |
model.addAttribute("fofoIdAndallValues", fofoIdAndallValues);
|
1012 |
model.addAttribute("fofoIdAndallValues", fofoIdAndallValues);
|
| 1071 |
model.addAttribute("fofoIdAndPartnerMap", fofoIdAndPartnerMap);
|
1013 |
model.addAttribute("fofoIdAndPartnerMap", fofoIdAndPartnerMap);
|
| 1072 |
|
1014 |
|
| 1073 |
return "auth_user_partner_detail";
|
1015 |
return "auth_user_partner_detail";
|
| 1074 |
}
|
1016 |
}
|
| 1075 |
|
1017 |
|
| 1076 |
@RequestMapping(value = "/getWarehouseWiseBrandStock", method = RequestMethod.GET)
|
1018 |
@RequestMapping(value = "/getWarehouseWiseBrandStock", method = RequestMethod.GET)
|
| 1077 |
public String getWarehouseWiseBrandStock(HttpServletRequest request, Model model, @RequestParam int warehouseId)
|
1019 |
public String getWarehouseWiseBrandStock(HttpServletRequest request, Model model,
|
| 1078 |
throws Exception {
|
1020 |
@RequestParam List<Integer> warehouseId) throws Exception {
|
| - |
|
1021 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
1022 |
String email = loginDetails.getEmailId();
|
| - |
|
1023 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
|
| - |
|
1024 |
Set<Integer> authfofoIds = storeGuyMap.get(email);
|
| 1079 |
|
1025 |
|
| - |
|
1026 |
Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository
|
| - |
|
1027 |
.selectActivePartnersByRetailerIds(new ArrayList<>(authfofoIds)).stream().collect(Collectors.groupingBy(
|
| - |
|
1028 |
FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
|
| 1080 |
List<WarehouseWiseBrandStockModel> warehouseWiseBrandStock = saholicInventoryCISRepository
|
1029 |
List<WarehouseWiseBrandStockModel> warehouseWiseBrandStock = new ArrayList<>();
|
| - |
|
1030 |
if (!warehouseId.contains(0)) {
|
| - |
|
1031 |
warehouseWiseBrandStock = saholicInventoryCISRepository.selectGroupByWarehouseAndBrand(warehouseId);
|
| - |
|
1032 |
} else {
|
| - |
|
1033 |
LOGGER.info("warehouseIdFofoIdMap" + warehouseIdFofoIdMap.keySet());
|
| - |
|
1034 |
warehouseWiseBrandStock = saholicInventoryCISRepository
|
| 1081 |
.selectGroupByWarehouseAndBrand(warehouseId);
|
1035 |
.selectGroupByWarehouseAndBrand(new ArrayList<>(warehouseIdFofoIdMap.keySet()));
|
| - |
|
1036 |
|
| - |
|
1037 |
}
|
| 1082 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
1038 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
| 1083 |
model.addAttribute("warehouseWiseBrandStock", warehouseWiseBrandStock);
|
1039 |
model.addAttribute("warehouseWiseBrandStock", warehouseWiseBrandStock);
|
| 1084 |
model.addAttribute("warehouseId", warehouseId);
|
1040 |
model.addAttribute("warehouseId", warehouseId);
|
| 1085 |
model.addAttribute("warehouseMap", warehouseMap);
|
1041 |
model.addAttribute("warehouseMap", warehouseMap);
|
| 1086 |
|
1042 |
|
| Line 1092... |
Line 1048... |
| 1092 |
inventoryService.getItemAvailabilityAndIndent();
|
1048 |
inventoryService.getItemAvailabilityAndIndent();
|
| 1093 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
1049 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 1094 |
return "response";
|
1050 |
return "response";
|
| 1095 |
}
|
1051 |
}
|
| 1096 |
|
1052 |
|
| 1097 |
public Map<Integer, PartnerDetailModel> getWarehousePartnerDetail() throws Exception {
|
1053 |
public Map<Integer, PartnerDetailModel> getWarehousePartnerDetail(Map<Integer, List<Integer>> warehousePartnerMap)
|
| - |
|
1054 |
throws Exception {
|
| 1098 |
|
1055 |
|
| 1099 |
Map<Integer, PartnerDetailModel> warehouseIdAndallValues = new LinkedHashMap<>();
|
1056 |
Map<Integer, PartnerDetailModel> warehouseIdAndallValues = new LinkedHashMap<>();
|
| 1100 |
Map<Integer, List<FofoStore>> warehousePartnerMap = fofoStoreRepository.getWarehousePartnerMap();
|
1057 |
// Map<Integer, List<FofoStore>> warehousePartnerMap =
|
| - |
|
1058 |
// fofoStoreRepository.getWarehousePartnerMap();
|
| 1101 |
Map<Integer, PartnerDetailModel> partnerStats = this.getPartnersStatDataFromFile();
|
1059 |
Map<Integer, PartnerDetailModel> partnerStats = this.getPartnersStatDataFromFile();
|
| - |
|
1060 |
List<Integer> allfofoIds = new ArrayList<>();
|
| 1102 |
if (partnerStats != null) {
|
1061 |
if (partnerStats != null) {
|
| 1103 |
for (Entry<Integer, List<FofoStore>> warehouse : warehousePartnerMap.entrySet()) {
|
1062 |
for (Entry<Integer, List<Integer>> warehouse : warehousePartnerMap.entrySet()) {
|
| 1104 |
List<Integer> fofoIds = warehouse.getValue().stream().map(x -> x.getId()).collect(Collectors.toList());
|
1063 |
List<Integer> fofoIds = warehouse.getValue().stream().map(x -> x).collect(Collectors.toList());
|
| - |
|
1064 |
allfofoIds.addAll(fofoIds);
|
| 1105 |
List<PartnerDetailModel> partnerDetails = fofoIds.stream().map(x -> partnerStats.get(x))
|
1065 |
List<PartnerDetailModel> partnerDetails = fofoIds.stream().map(x -> partnerStats.get(x))
|
| 1106 |
.collect(Collectors.toList());
|
1066 |
.collect(Collectors.toList());
|
| 1107 |
if (partnerDetails != null && !partnerDetails.isEmpty()) {
|
1067 |
if (partnerDetails != null && !partnerDetails.isEmpty()) {
|
| 1108 |
PartnerDetailModel partnerDetailModel = partnerStatsService.getAggregateStats(partnerDetails);
|
1068 |
PartnerDetailModel partnerDetailModel = partnerStatsService.getAggregateStats(partnerDetails);
|
| 1109 |
warehouseIdAndallValues.put(warehouse.getKey(), partnerDetailModel);
|
1069 |
warehouseIdAndallValues.put(warehouse.getKey(), partnerDetailModel);
|
| 1110 |
}
|
1070 |
}
|
| 1111 |
|
1071 |
|
| 1112 |
}
|
1072 |
}
|
| - |
|
1073 |
List<PartnerDetailModel> allPartnerDetails = allfofoIds.stream().map(x -> partnerStats.get(x))
|
| - |
|
1074 |
.collect(Collectors.toList());
|
| - |
|
1075 |
LOGGER.info("allPartnerDetails" + allPartnerDetails);
|
| 1113 |
PartnerDetailModel partnerDetailModel = partnerStatsService
|
1076 |
PartnerDetailModel partnerDetailModel = partnerStatsService
|
| 1114 |
.getAggregateStats(new ArrayList<>(partnerStats.values()));
|
1077 |
.getAggregateStats(new ArrayList<>(allPartnerDetails));
|
| 1115 |
warehouseIdAndallValues.put(0, partnerDetailModel);
|
1078 |
warehouseIdAndallValues.put(0, partnerDetailModel);
|
| 1116 |
}
|
1079 |
}
|
| 1117 |
return warehouseIdAndallValues;
|
1080 |
return warehouseIdAndallValues;
|
| 1118 |
}
|
1081 |
}
|
| 1119 |
|
1082 |
|
| Line 1221... |
Line 1184... |
| 1221 |
}
|
1184 |
}
|
| 1222 |
|
1185 |
|
| 1223 |
@RequestMapping(value = "/getWarehouseWiseBrandPartnerSale", method = RequestMethod.GET)
|
1186 |
@RequestMapping(value = "/getWarehouseWiseBrandPartnerSale", method = RequestMethod.GET)
|
| 1224 |
public String getWarehouseWiseBrandPartnerSale(HttpServletRequest request, Model model, @RequestParam String brand)
|
1187 |
public String getWarehouseWiseBrandPartnerSale(HttpServletRequest request, Model model, @RequestParam String brand)
|
| 1225 |
throws Exception {
|
1188 |
throws Exception {
|
| - |
|
1189 |
|
| - |
|
1190 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
1191 |
String email = loginDetails.getEmailId();
|
| - |
|
1192 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
|
| - |
|
1193 |
Set<Integer> authfofoIds = storeGuyMap.get(email);
|
| - |
|
1194 |
|
| 1226 |
Map<Integer, WarehouseWiseBrandSaleModel> warehouseWiseBrandPartnerSales = fofoStoreRepository
|
1195 |
Map<Integer, WarehouseWiseBrandSaleModel> warehouseWiseBrandPartnerSales = fofoStoreRepository
|
| 1227 |
.selectGroupByWarehouseBrandWisePartnerSale(brand).stream()
|
1196 |
.selectGroupByWarehouseBrandWisePartnerSale(brand, new ArrayList<>(authfofoIds)).stream()
|
| 1228 |
.collect(Collectors.toMap(x -> x.getWarehouseId(), x -> x));
|
1197 |
.collect(Collectors.toMap(x -> x.getWarehouseId(), x -> x));
|
| 1229 |
|
1198 |
|
| 1230 |
List<WarehouseWiseBrandUnbilledActivatedModel> unbilledStock = fofoStoreRepository
|
1199 |
List<WarehouseWiseBrandUnbilledActivatedModel> unbilledStock = fofoStoreRepository
|
| 1231 |
.selectUnbilledActivateStockGroupByWarehouse(brand);
|
1200 |
.selectUnbilledActivateStockGroupByWarehouse(brand, new ArrayList<>(authfofoIds));
|
| 1232 |
|
1201 |
|
| 1233 |
for (WarehouseWiseBrandUnbilledActivatedModel un : unbilledStock) {
|
1202 |
for (WarehouseWiseBrandUnbilledActivatedModel un : unbilledStock) {
|
| 1234 |
WarehouseWiseBrandSaleModel bpt = warehouseWiseBrandPartnerSales.get(un.getWarehouseId());
|
1203 |
WarehouseWiseBrandSaleModel bpt = warehouseWiseBrandPartnerSales.get(un.getWarehouseId());
|
| 1235 |
if (bpt != null) {
|
1204 |
if (bpt != null) {
|
| 1236 |
bpt.setAmtd(un.getUnbilledMtd());
|
1205 |
bpt.setAmtd(un.getUnbilledMtd());
|
| Line 1260... |
Line 1229... |
| 1260 |
}
|
1229 |
}
|
| 1261 |
|
1230 |
|
| 1262 |
@RequestMapping(value = "/getWarehouseWiseAccesoriesBrandPartnerSale", method = RequestMethod.GET)
|
1231 |
@RequestMapping(value = "/getWarehouseWiseAccesoriesBrandPartnerSale", method = RequestMethod.GET)
|
| 1263 |
public String getWarehouseWiseAccesoriesBrandPartnerSale(HttpServletRequest request, Model model,
|
1232 |
public String getWarehouseWiseAccesoriesBrandPartnerSale(HttpServletRequest request, Model model,
|
| 1264 |
@RequestParam String brand) throws Exception {
|
1233 |
@RequestParam String brand) throws Exception {
|
| - |
|
1234 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
1235 |
String email = loginDetails.getEmailId();
|
| - |
|
1236 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
|
| - |
|
1237 |
Set<Integer> authfofoIds = storeGuyMap.get(email);
|
| 1265 |
List<WarehouseWiseBrandSaleModel> warehouseWiseBrandPartnerSales = fofoStoreRepository
|
1238 |
List<WarehouseWiseBrandSaleModel> warehouseWiseBrandPartnerSales = fofoStoreRepository
|
| 1266 |
.selectGroupByWarehouseAccesoriesBrandWisePartnerSale(brand);
|
1239 |
.selectGroupByWarehouseAccesoriesBrandWisePartnerSale(brand, new ArrayList<>(authfofoIds));
|
| 1267 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
1240 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
| 1268 |
|
1241 |
|
| 1269 |
Set<String> brands = inventoryService.getAllTagListingBrands();
|
1242 |
Set<String> brands = inventoryService.getAllTagListingBrands();
|
| 1270 |
model.addAttribute("warehouseWiseBrandPartnerSales", warehouseWiseBrandPartnerSales);
|
1243 |
model.addAttribute("warehouseWiseBrandPartnerSales", warehouseWiseBrandPartnerSales);
|
| 1271 |
model.addAttribute("warehouseMap", warehouseMap);
|
1244 |
model.addAttribute("warehouseMap", warehouseMap);
|
| Line 1276... |
Line 1249... |
| 1276 |
|
1249 |
|
| 1277 |
@RequestMapping(value = "/getWarehouseBrandWiseItemSale", method = RequestMethod.GET)
|
1250 |
@RequestMapping(value = "/getWarehouseBrandWiseItemSale", method = RequestMethod.GET)
|
| 1278 |
public String getWarehouseBrandWiseItemSale(HttpServletRequest request, Model model,
|
1251 |
public String getWarehouseBrandWiseItemSale(HttpServletRequest request, Model model,
|
| 1279 |
@RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
|
1252 |
@RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
|
| 1280 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
1253 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
| - |
|
1254 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
1255 |
String email = loginDetails.getEmailId();
|
| - |
|
1256 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
|
| - |
|
1257 |
Set<Integer> authfofoIds = storeGuyMap.get(email);
|
| 1281 |
Map<Integer, WarehouseBrandWiseItemSaleModel> branditemSalesMap = fofoStoreRepository
|
1258 |
Map<Integer, WarehouseBrandWiseItemSaleModel> branditemSalesMap = fofoStoreRepository
|
| 1282 |
.selectWarehouseBrandItemSale(warehouseId, brand).stream()
|
1259 |
.selectWarehouseBrandItemSale(warehouseId, brand, new ArrayList<>(authfofoIds)).stream()
|
| 1283 |
.collect(Collectors.toMap(x -> x.getItemId(), x -> x));
|
1260 |
.collect(Collectors.toMap(x -> x.getItemId(), x -> x));
|
| 1284 |
;
|
- |
|
| 1285 |
|
1261 |
|
| 1286 |
List<WarehouseBrandItemUnbilledActivatedModel> unbilledItems = fofoStoreRepository
|
1262 |
List<WarehouseBrandItemUnbilledActivatedModel> unbilledItems = fofoStoreRepository
|
| 1287 |
.selectWarehouseBrandItemUnbilledActivateStock(warehouseId, brand);
|
1263 |
.selectWarehouseBrandItemUnbilledActivateStock(warehouseId, brand, new ArrayList<>(authfofoIds));
|
| 1288 |
|
1264 |
|
| 1289 |
for (WarehouseBrandItemUnbilledActivatedModel un : unbilledItems) {
|
1265 |
for (WarehouseBrandItemUnbilledActivatedModel un : unbilledItems) {
|
| 1290 |
WarehouseBrandWiseItemSaleModel bpt = branditemSalesMap.get(un.getItemId());
|
1266 |
WarehouseBrandWiseItemSaleModel bpt = branditemSalesMap.get(un.getItemId());
|
| 1291 |
if (bpt != null) {
|
1267 |
if (bpt != null) {
|
| 1292 |
bpt.setAmtd(un.getAmtd());
|
1268 |
bpt.setAmtd(un.getAmtd());
|
| Line 1317... |
Line 1293... |
| 1317 |
|
1293 |
|
| 1318 |
@RequestMapping(value = "/getWarehouseAccesoriesBrandWiseItemSale", method = RequestMethod.GET)
|
1294 |
@RequestMapping(value = "/getWarehouseAccesoriesBrandWiseItemSale", method = RequestMethod.GET)
|
| 1319 |
public String getWarehouseAccesoriesBrandWiseItemSale(HttpServletRequest request, Model model,
|
1295 |
public String getWarehouseAccesoriesBrandWiseItemSale(HttpServletRequest request, Model model,
|
| 1320 |
@RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
|
1296 |
@RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
|
| 1321 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
1297 |
Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
|
| - |
|
1298 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
1299 |
String email = loginDetails.getEmailId();
|
| - |
|
1300 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
|
| - |
|
1301 |
Set<Integer> authfofoIds = storeGuyMap.get(email);
|
| 1322 |
List<WarehouseBrandWiseItemSaleModel> branditemSales = fofoStoreRepository
|
1302 |
List<WarehouseBrandWiseItemSaleModel> branditemSales = fofoStoreRepository
|
| 1323 |
.selectWarehouseAccesoriesBrandItemSale(warehouseId, brand);
|
1303 |
.selectWarehouseAccesoriesBrandItemSale(warehouseId, brand, new ArrayList<>(authfofoIds));
|
| 1324 |
model.addAttribute("branditemSales", branditemSales);
|
1304 |
model.addAttribute("branditemSales", branditemSales);
|
| 1325 |
model.addAttribute("warehouseMap", warehouseMap);
|
1305 |
model.addAttribute("warehouseMap", warehouseMap);
|
| 1326 |
return "warehouse_accessories_itemwsie_sale";
|
1306 |
return "warehouse_accessories_itemwsie_sale";
|
| 1327 |
}
|
1307 |
}
|
| 1328 |
|
1308 |
|