Subversion Repositories SmartDukaan

Rev

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

Rev 32206 Rev 32308
Line 7... Line 7...
7
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
7
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
8
import com.spice.profitmandi.common.model.*;
8
import com.spice.profitmandi.common.model.*;
9
import com.spice.profitmandi.common.web.util.ResponseSender;
9
import com.spice.profitmandi.common.web.util.ResponseSender;
10
import com.spice.profitmandi.dao.entity.auth.AuthUser;
10
import com.spice.profitmandi.dao.entity.auth.AuthUser;
11
import com.spice.profitmandi.dao.entity.catalog.Item;
11
import com.spice.profitmandi.dao.entity.catalog.Item;
-
 
12
import com.spice.profitmandi.dao.entity.catalog.Scheme;
12
import com.spice.profitmandi.dao.entity.catalog.TagListing;
13
import com.spice.profitmandi.dao.entity.catalog.TagListing;
13
import com.spice.profitmandi.dao.entity.cs.Position;
14
import com.spice.profitmandi.dao.entity.cs.Position;
14
import com.spice.profitmandi.dao.entity.cs.TicketAssigned;
15
import com.spice.profitmandi.dao.entity.cs.TicketAssigned;
15
import com.spice.profitmandi.dao.entity.dtr.Document;
16
import com.spice.profitmandi.dao.entity.dtr.Document;
16
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
17
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
Line 40... Line 41...
40
import com.spice.profitmandi.service.PartnerInvestmentService;
41
import com.spice.profitmandi.service.PartnerInvestmentService;
41
import com.spice.profitmandi.service.PartnerStatsService;
42
import com.spice.profitmandi.service.PartnerStatsService;
42
import com.spice.profitmandi.service.authentication.RoleManager;
43
import com.spice.profitmandi.service.authentication.RoleManager;
43
import com.spice.profitmandi.service.inventory.InventoryService;
44
import com.spice.profitmandi.service.inventory.InventoryService;
44
import com.spice.profitmandi.service.offers.OfferService;
45
import com.spice.profitmandi.service.offers.OfferService;
-
 
46
import com.spice.profitmandi.service.scheme.SchemeService;
45
import com.spice.profitmandi.service.transaction.TransactionService;
47
import com.spice.profitmandi.service.transaction.TransactionService;
46
import com.spice.profitmandi.service.user.RetailerService;
48
import com.spice.profitmandi.service.user.RetailerService;
47
import com.spice.profitmandi.web.model.LoginDetails;
49
import com.spice.profitmandi.web.model.LoginDetails;
48
import com.spice.profitmandi.web.util.CookiesProcessor;
50
import com.spice.profitmandi.web.util.CookiesProcessor;
49
import com.spice.profitmandi.web.util.MVCResponseSender;
51
import com.spice.profitmandi.web.util.MVCResponseSender;
Line 308... Line 310...
308
 
310
 
309
        model.addAttribute("monthSales", monthSaleMap);
311
        model.addAttribute("monthSales", monthSaleMap);
310
        return "monthSales";
312
        return "monthSales";
311
    }
313
    }
312
 
314
 
-
 
315
    @Autowired
-
 
316
    SchemeService schemeService;
-
 
317
 
313
    @RequestMapping(value = "/dashboard", method = RequestMethod.GET)
318
    @RequestMapping(value = "/dashboard", method = RequestMethod.GET)
314
    public String dashboard(HttpServletRequest request, Model model) throws Exception {
319
    public String dashboard(HttpServletRequest request, Model model) throws Exception {
315
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
320
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
316
        String email = loginDetails.getEmailId();
321
        String email = loginDetails.getEmailId();
317
        int fofoId = loginDetails.getFofoId();
322
        int fofoId = loginDetails.getFofoId();
Line 391... Line 396...
391
                LocalDateTime currentMonthEnd = currentMonthStart.withDayOfMonth(1);
396
                LocalDateTime currentMonthEnd = currentMonthStart.withDayOfMonth(1);
392
 
397
 
393
                LOGGER.info("lastMonthStart" + lastMonthStart);
398
                LOGGER.info("lastMonthStart" + lastMonthStart);
394
                LOGGER.info("currentMonthEnd" + currentMonthEnd);
399
                LOGGER.info("currentMonthEnd" + currentMonthEnd);
395
 
400
 
-
 
401
 
-
 
402
                Scheme staticScheme = schemeService.getStaticScheme(fofoId);
-
 
403
                double schemeAchievement = 0;
-
 
404
                String schemeCategory = null;
-
 
405
                if (staticScheme != null) {
-
 
406
                    schemeAchievement = orderRepository.selectBillingDatesBetweenSumGroupByRetailerId(staticScheme.getStartDateTime(), staticScheme.getEndDateTime()).get(fofoId);
-
 
407
                    if (staticScheme.getTarget() >= 2500000 && staticScheme.getTarget() < 3750000) {
-
 
408
                        schemeCategory = "SD Club";
-
 
409
                    } else if (staticScheme.getTarget() < 5000000) {
-
 
410
                        schemeCategory = "Silver";
-
 
411
                    } else if (staticScheme.getTarget() < 7500000) {
-
 
412
                        schemeCategory = "Gold - 1";
-
 
413
                    } else if (staticScheme.getTarget() < 10000000) {
-
 
414
                        schemeCategory = "Gold - 2";
-
 
415
                    } else if (staticScheme.getTarget() < 12500000) {
-
 
416
                        schemeCategory = "Diamond";
-
 
417
                    } else {
-
 
418
                        schemeCategory = "Platinum";
-
 
419
                    }
-
 
420
                }
-
 
421
 
-
 
422
 
396
                model.addAttribute("countOrder", countOrder);
423
                model.addAttribute("countOrder", countOrder);
397
                model.addAttribute("onlineDeliveredOrderSum", onlineDeliveredOrderSum.getSellingPrice());
424
                model.addAttribute("onlineDeliveredOrderSum", onlineDeliveredOrderSum.getSellingPrice());
398
 
425
 
399
                PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now());
426
                PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now());
400
                model.addAttribute("partnerType", partnerType);
427
                model.addAttribute("partnerType", partnerType);
Line 411... Line 438...
411
                Map<Integer, Double> accesoriesmtdsale = fofoOrderRepository.selectSumSaleGroupByFofoIdsForMobileOrAccessories(loginDetails.getFofoId(), curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), Optional.of(false));
438
                Map<Integer, Double> accesoriesmtdsale = fofoOrderRepository.selectSumSaleGroupByFofoIdsForMobileOrAccessories(loginDetails.getFofoId(), curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), Optional.of(false));
412
 
439
 
413
                Double accesoriesStock = currentInventorySnapshotRepository.selectSumStockGroupByFofoIdsForMobileOrAccessories(loginDetails.getFofoId(), Optional.of(false)).get(loginDetails.getFofoId());
440
                Double accesoriesStock = currentInventorySnapshotRepository.selectSumStockGroupByFofoIdsForMobileOrAccessories(loginDetails.getFofoId(), Optional.of(false)).get(loginDetails.getFofoId());
414
 
441
 
415
                model.addAttribute("accesoriesStock", String.format("%.0f", accesoriesStock));
442
                model.addAttribute("accesoriesStock", String.format("%.0f", accesoriesStock));
-
 
443
                model.addAttribute("staticScheme", staticScheme);
-
 
444
                model.addAttribute("schemeCategory", schemeCategory);
-
 
445
                model.addAttribute("schemeAchievement", schemeAchievement);
416
                model.addAttribute("brandStockPrices", fofoUser.getBrandStockPrices(loginDetails.getFofoId(), false));
446
                model.addAttribute("brandStockPrices", fofoUser.getBrandStockPrices(loginDetails.getFofoId(), false));
417
                model.addAttribute("salesMap", fofoUser.getSales(loginDetails.getFofoId()));
447
                model.addAttribute("salesMap", fofoUser.getSales(loginDetails.getFofoId()));
418
                ChartModel cm = fofoUser.getBrandChart(loginDetails.getFofoId());
448
                ChartModel cm = fofoUser.getBrandChart(loginDetails.getFofoId());
419
 
449
 
420
                LOGGER.info("chartMap" + gson.toJson(cm));
450
                LOGGER.info("chartMap" + gson.toJson(cm));
Line 451... Line 481...
451
                model.addAttribute("month", 0);
481
                model.addAttribute("month", 0);
452
                model.addAttribute("hygienePercentage", (hygieneCount * 100) / (invalidHygieneCount + hygieneCount));
482
                model.addAttribute("hygienePercentage", (hygieneCount * 100) / (invalidHygieneCount + hygieneCount));
453
                model.addAttribute("monthDays", LocalDate.now().minusDays(1).lengthOfMonth());
483
                model.addAttribute("monthDays", LocalDate.now().minusDays(1).lengthOfMonth());
454
                model.addAttribute("dayOfMonth", LocalDate.now().minusDays(1).getDayOfMonth());
484
                model.addAttribute("dayOfMonth", LocalDate.now().minusDays(1).getDayOfMonth());
455
 
485
 
-
 
486
            } catch (
456
            } catch (ProfitMandiBusinessException e) {
487
                    ProfitMandiBusinessException e) {
457
                LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
488
                LOGGER.error("FofoStore Code not found of fofoId {}", loginDetails.getFofoId());
458
 
489
 
459
            }
490
            }
460
            return "dashboard1";
491
            return "dashboard1";
461
        }
492
        }
Line 548... Line 579...
548
 
579
 
549
    @Autowired
580
    @Autowired
550
    OfferPayoutRepository offerPayoutRepository;
581
    OfferPayoutRepository offerPayoutRepository;
551
 
582
 
552
    @RequestMapping(value = "/partnerTotalIncomeByMonth/{yearMonth}", method = RequestMethod.GET)
583
    @RequestMapping(value = "/partnerTotalIncomeByMonth/{yearMonth}", method = RequestMethod.GET)
553
    public String getPartnerTotalIncomeByMonth(HttpServletRequest request, @PathVariable int yearMonth, Model model) throws Exception {
584
    public String getPartnerTotalIncomeByMonth(HttpServletRequest request, @PathVariable int yearMonth, Model
-
 
585
            model) throws Exception {
554
 
586
 
555
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
587
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
556
        long pendingIncome = 0;
588
        long pendingIncome = 0;
557
        long partnerPurchaseIn = 0;
589
        long partnerPurchaseIn = 0;
558
        long partnerCreditedSale = 0;
590
        long partnerCreditedSale = 0;
Line 636... Line 668...
636
 
668
 
637
        return "partner-total-income";
669
        return "partner-total-income";
638
    }
670
    }
639
 
671
 
640
    @RequestMapping(value = "/getMonthsInvestment", method = RequestMethod.GET)
672
    @RequestMapping(value = "/getMonthsInvestment", method = RequestMethod.GET)
-
 
673
    public String getMonthsInvestment(HttpServletRequest request,
641
    public String getMonthsInvestment(HttpServletRequest request, @RequestParam(name = "month", required = true, defaultValue = "0") int month, Model model) throws Exception {
674
                                      @RequestParam(name = "month", required = true, defaultValue = "0") int month, Model model) throws Exception {
642
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
675
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
643
        int fofoId = loginDetails.getFofoId();
676
        int fofoId = loginDetails.getFofoId();
644
        Map<String, Object> investment = fofoUser.getInvestmentsMonths(fofoId, month);
677
        Map<String, Object> investment = fofoUser.getInvestmentsMonths(fofoId, month);
645
 
678
 
646
        LocalDateTime currentMonthStart = LocalDateTime.now().withDayOfMonth(1);
679
        LocalDateTime currentMonthStart = LocalDateTime.now().withDayOfMonth(1);
Line 719... Line 752...
719
 
752
 
720
        return "bar_chart";
753
        return "bar_chart";
721
    }
754
    }
722
 
755
 
723
    @RequestMapping(value = "/getPriceDropDetails", method = RequestMethod.GET)
756
    @RequestMapping(value = "/getPriceDropDetails", method = RequestMethod.GET)
724
    public String getPriceDropDetails(HttpServletRequest request, @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId, @RequestParam(name = "brand", required = true, defaultValue = "0") String brand, @RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model) throws Exception {
757
    public String getPriceDropDetails(HttpServletRequest request,
-
 
758
                                      @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
-
 
759
                                      @RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
-
 
760
                                      @RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model) throws
-
 
761
            Exception {
725
 
762
 
726
        LOGGER.info("params" + fofoId + brand + yearMonth);
763
        LOGGER.info("params" + fofoId + brand + yearMonth);
727
 
764
 
728
        List<PriceDropWithDetailsByYearMonthModel> priceDropdetailsList = priceDropRepository.selectBrandPendingPriceDropWithDetailsByYearMonth(fofoId, brand, yearMonth);
765
        List<PriceDropWithDetailsByYearMonthModel> priceDropdetailsList = priceDropRepository.selectBrandPendingPriceDropWithDetailsByYearMonth(fofoId, brand, yearMonth);
729
 
766
 
Line 733... Line 770...
733
 
770
 
734
        return "price-drop-details";
771
        return "price-drop-details";
735
    }
772
    }
736
 
773
 
737
    @RequestMapping(value = "/getPriceDropDetailSixMonths", method = RequestMethod.GET)
774
    @RequestMapping(value = "/getPriceDropDetailSixMonths", method = RequestMethod.GET)
738
    public String getPriceDropDetailSixMonths(HttpServletRequest request, @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId, @RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model) throws Exception {
775
    public String getPriceDropDetailSixMonths(HttpServletRequest request,
-
 
776
                                              @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
-
 
777
                                              @RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model) throws
-
 
778
            Exception {
739
 
779
 
740
        LOGGER.info("params" + fofoId + brand);
780
        LOGGER.info("params" + fofoId + brand);
741
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
781
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
742
        LocalDateTime startfMonthSixMonth = curDate.withDayOfMonth(1).minusMonths(12);
782
        LocalDateTime startfMonthSixMonth = curDate.withDayOfMonth(1).minusMonths(12);
743
        LocalDateTime endMonthTotal = curDate.withDayOfMonth(1).minusMonths(6);
783
        LocalDateTime endMonthTotal = curDate.withDayOfMonth(1).minusMonths(6);
Line 930... Line 970...
930
        model.addAttribute("fofoId", fofoId);
970
        model.addAttribute("fofoId", fofoId);
931
        return "activation-tabular";
971
        return "activation-tabular";
932
    }
972
    }
933
 
973
 
934
    @RequestMapping(value = "/getMonthlyActivationItemDetail", method = RequestMethod.GET)
974
    @RequestMapping(value = "/getMonthlyActivationItemDetail", method = RequestMethod.GET)
935
    public String getMonthlyActivationItemDetail(HttpServletRequest request, @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId, @RequestParam(name = "brand", required = true, defaultValue = "0") String brand, @RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model) throws Exception {
975
    public String getMonthlyActivationItemDetail(HttpServletRequest request,
-
 
976
                                                 @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
-
 
977
                                                 @RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
-
 
978
                                                 @RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model) throws
-
 
979
            Exception {
936
 
980
 
937
        LOGGER.info("params" + fofoId + brand + yearMonth);
981
        LOGGER.info("params" + fofoId + brand + yearMonth);
938
 
982
 
939
        List<ActivationItemDetailModel> activationItemDetails = schemeInOutRepository.selectBrandPendingActivationItemDetails(fofoId, brand, yearMonth);
983
        List<ActivationItemDetailModel> activationItemDetails = schemeInOutRepository.selectBrandPendingActivationItemDetails(fofoId, brand, yearMonth);
940
 
984
 
Line 960... Line 1004...
960
 
1004
 
961
        return "activation-pending-item-details";
1005
        return "activation-pending-item-details";
962
    }
1006
    }
963
 
1007
 
964
    @RequestMapping(value = "/getMonthlyActivationBeforeSixMonthsItemDetail", method = RequestMethod.GET)
1008
    @RequestMapping(value = "/getMonthlyActivationBeforeSixMonthsItemDetail", method = RequestMethod.GET)
965
    public String getMonthlyActivationItemDetail(HttpServletRequest request, @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId, @RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model) throws Exception {
1009
    public String getMonthlyActivationItemDetail(HttpServletRequest request,
-
 
1010
                                                 @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
-
 
1011
                                                 @RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model) throws
-
 
1012
            Exception {
966
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1013
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
967
 
1014
 
968
        LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
1015
        LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
969
 
1016
 
970
        List<ActivationItemDetailModel> activationItemDetails = schemeInOutRepository.selectBrandPendingActivationItemDetailByYearMonth(fofoId, brand, startOfMonth);
1017
        List<ActivationItemDetailModel> activationItemDetails = schemeInOutRepository.selectBrandPendingActivationItemDetailByYearMonth(fofoId, brand, startOfMonth);
Line 1063... Line 1110...
1063
        return "upgrade-offer-tabular";
1110
        return "upgrade-offer-tabular";
1064
 
1111
 
1065
    }
1112
    }
1066
 
1113
 
1067
    @RequestMapping(value = "/getMonthlyUpgradeOfferItemDetail", method = RequestMethod.GET)
1114
    @RequestMapping(value = "/getMonthlyUpgradeOfferItemDetail", method = RequestMethod.GET)
1068
    public String getMonthlyUpgradeOfferItemDetail(HttpServletRequest request, @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId, @RequestParam(name = "brand", required = true, defaultValue = "0") String brand, @RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model) throws Exception {
1115
    public String getMonthlyUpgradeOfferItemDetail(HttpServletRequest request,
-
 
1116
                                                   @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
-
 
1117
                                                   @RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
-
 
1118
                                                   @RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model) throws
-
 
1119
            Exception {
1069
 
1120
 
1070
        LOGGER.info("params" + fofoId + brand + yearMonth);
1121
        LOGGER.info("params" + fofoId + brand + yearMonth);
1071
        List<UpgradeOfferItemDetailModel> offerItems = samsungUpgradeOfferRepository.selectUpgradeOfferItemDetails(fofoId, UpgradeOfferStatus.approved, brand, yearMonth);
1122
        List<UpgradeOfferItemDetailModel> offerItems = samsungUpgradeOfferRepository.selectUpgradeOfferItemDetails(fofoId, UpgradeOfferStatus.approved, brand, yearMonth);
1072
 
1123
 
1073
        model.addAttribute("offerItems", offerItems);
1124
        model.addAttribute("offerItems", offerItems);
1074
 
1125
 
1075
        return "upgrade-offer-item-detail";
1126
        return "upgrade-offer-item-detail";
1076
    }
1127
    }
1077
 
1128
 
1078
    @RequestMapping(value = "/getUpgradeOfferBeforeSixMonthItemDetail", method = RequestMethod.GET)
1129
    @RequestMapping(value = "/getUpgradeOfferBeforeSixMonthItemDetail", method = RequestMethod.GET)
1079
    public String getUpgradeOfferBeforeSixMonthItemDetail(HttpServletRequest request, @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId, @RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model) throws Exception {
1130
    public String getUpgradeOfferBeforeSixMonthItemDetail(HttpServletRequest request,
-
 
1131
                                                          @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
-
 
1132
                                                          @RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model) throws
-
 
1133
            Exception {
1080
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1134
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1081
 
1135
 
1082
        LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
1136
        LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
1083
 
1137
 
1084
        List<UpgradeOfferItemDetailModel> offerItems = samsungUpgradeOfferRepository.selectUpgradeOfferItemDetailByYearMonth(fofoId, UpgradeOfferStatus.approved, brand, startOfMonth);
1138
        List<UpgradeOfferItemDetailModel> offerItems = samsungUpgradeOfferRepository.selectUpgradeOfferItemDetailByYearMonth(fofoId, UpgradeOfferStatus.approved, brand, startOfMonth);
Line 1087... Line 1141...
1087
 
1141
 
1088
        return "upgrade-offer-item-detail";
1142
        return "upgrade-offer-item-detail";
1089
    }
1143
    }
1090
 
1144
 
1091
    @RequestMapping(value = "/getAuthUserPartners", method = RequestMethod.GET)
1145
    @RequestMapping(value = "/getAuthUserPartners", method = RequestMethod.GET)
1092
    public String AuthUserPartnersDetail(HttpServletRequest request, Model model, @RequestParam int authId) throws Exception {
1146
    public String AuthUserPartnersDetail(HttpServletRequest request, Model model, @RequestParam int authId) throws
-
 
1147
            Exception {
1093
 
1148
 
1094
        Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
1149
        Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
1095
        Map<Integer, CustomRetailer> fofoIdAndPartnerMap = retailerService.getFofoRetailers(false);
1150
        Map<Integer, CustomRetailer> fofoIdAndPartnerMap = retailerService.getFofoRetailers(false);
1096
 
1151
 
1097
        Map<Integer, PartnerDetailModel> fofoIdAndallValues = partnerStatsService.getAllPartnerStats();
1152
        Map<Integer, PartnerDetailModel> fofoIdAndallValues = partnerStatsService.getAllPartnerStats();
Line 1106... Line 1161...
1106
 
1161
 
1107
        return "auth_user_partner_detail";
1162
        return "auth_user_partner_detail";
1108
    }
1163
    }
1109
 
1164
 
1110
    @RequestMapping(value = "/getWarehousePartners", method = RequestMethod.GET)
1165
    @RequestMapping(value = "/getWarehousePartners", method = RequestMethod.GET)
1111
    public String warehousePartnersDetail(HttpServletRequest request, Model model, @RequestParam int warehouseId) throws Exception {
1166
    public String warehousePartnersDetail(HttpServletRequest request, Model model, @RequestParam int warehouseId) throws
-
 
1167
            Exception {
1112
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1168
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1113
        String email = loginDetails.getEmailId();
1169
        String email = loginDetails.getEmailId();
1114
 
1170
 
1115
        Set<Integer> authfofoIds = new HashSet<>();
1171
        Set<Integer> authfofoIds = new HashSet<>();
1116
        authfofoIds = csService1.getAuthFofoIds(email, true);
1172
        authfofoIds = csService1.getAuthFofoIds(email, true);
Line 1150... Line 1206...
1150
        return "auth_user_partner_detail";
1206
        return "auth_user_partner_detail";
1151
    }
1207
    }
1152
 
1208
 
1153
 
1209
 
1154
    @RequestMapping(value = "/getWarehouseWiseBrandStock", method = RequestMethod.GET)
1210
    @RequestMapping(value = "/getWarehouseWiseBrandStock", method = RequestMethod.GET)
1155
    public String getWarehouseWiseBrandStock(HttpServletRequest request, Model model, @RequestParam List<Integer> warehouseId) throws Exception {
1211
    public String getWarehouseWiseBrandStock(HttpServletRequest request, Model
-
 
1212
            model, @RequestParam List<Integer> warehouseId) throws Exception {
1156
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1213
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1157
        String email = loginDetails.getEmailId();
1214
        String email = loginDetails.getEmailId();
1158
        Set<Integer> authfofoIds = csService1.getAuthFofoIds(email, true);
1215
        Set<Integer> authfofoIds = csService1.getAuthFofoIds(email, true);
1159
        Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository.selectActivePartnersByRetailerIds(new ArrayList<>(authfofoIds)).stream().collect(Collectors.groupingBy(
1216
        Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository.selectActivePartnersByRetailerIds(new ArrayList<>(authfofoIds)).stream().collect(Collectors.groupingBy(
1160
                FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
1217
                FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
Line 1180... Line 1237...
1180
        model.addAttribute("response1", mvcResponseSender.createResponseString(true));
1237
        model.addAttribute("response1", mvcResponseSender.createResponseString(true));
1181
        return "response";
1238
        return "response";
1182
    }
1239
    }
1183
 
1240
 
1184
    @RequestMapping(value = "/getWarehouseWiseBrandAndCategory", method = RequestMethod.GET)
1241
    @RequestMapping(value = "/getWarehouseWiseBrandAndCategory", method = RequestMethod.GET)
-
 
1242
    public String getWarehouseWiseBrandAndCategory(HttpServletRequest request, Model
1185
    public String getWarehouseWiseBrandAndCategory(HttpServletRequest request, Model model, @RequestParam List<Integer> warehouseId, @RequestParam List<String> brands, @RequestParam String category) throws Exception {
1243
            model, @RequestParam List<Integer> warehouseId, @RequestParam List<String> brands, @RequestParam String
-
 
1244
                                                           category) throws Exception {
1186
 
1245
 
1187
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1246
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1188
        List<String> listbrands = saholicInventoryCISRepository.selectAllBrand();
1247
        List<String> listbrands = saholicInventoryCISRepository.selectAllBrand();
1189
        List<String> listCategory = saholicInventoryCISRepository.selectAllSubCategory();
1248
        List<String> listCategory = saholicInventoryCISRepository.selectAllSubCategory();
1190
 
1249
 
Line 1198... Line 1257...
1198
 
1257
 
1199
        return "warehouse_brand_item_stock";
1258
        return "warehouse_brand_item_stock";
1200
    }
1259
    }
1201
 
1260
 
1202
    @RequestMapping(value = "/getWarehouseWiseItemStock", method = RequestMethod.GET)
1261
    @RequestMapping(value = "/getWarehouseWiseItemStock", method = RequestMethod.GET)
-
 
1262
    public String getWarehouseWiseItemStock(HttpServletRequest request, Model
1203
    public String getWarehouseWiseItemStock(HttpServletRequest request, Model model, @RequestParam List<Integer> warehouseId, @RequestParam List<String> brands, @RequestParam String category) throws Exception {
1263
            model, @RequestParam List<Integer> warehouseId, @RequestParam List<String> brands, @RequestParam String
-
 
1264
                                                    category) throws Exception {
1204
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1265
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1205
        if (warehouseId.contains(0)) {
1266
        if (warehouseId.contains(0)) {
1206
            warehouseId.addAll(warehouseMap.keySet());
1267
            warehouseId.addAll(warehouseMap.keySet());
1207
        }
1268
        }
1208
        List<WarehouseWiseitemStockModel> warehouseWiseItemStock = saholicInventoryCISRepository.selectWarehouseItemStock(warehouseId, brands, category);
1269
        List<WarehouseWiseitemStockModel> warehouseWiseItemStock = saholicInventoryCISRepository.selectWarehouseItemStock(warehouseId, brands, category);
Line 1211... Line 1272...
1211
        model.addAttribute("warehouseMap", warehouseMap);
1272
        model.addAttribute("warehouseMap", warehouseMap);
1212
        return "warehouse_item_details";
1273
        return "warehouse_item_details";
1213
    }
1274
    }
1214
 
1275
 
1215
    @RequestMapping(value = "/getWarehouseWiseBrandPartnerSale", method = RequestMethod.GET)
1276
    @RequestMapping(value = "/getWarehouseWiseBrandPartnerSale", method = RequestMethod.GET)
1216
    public String getWarehouseWiseBrandPartnerSale(HttpServletRequest request, Model model, @RequestParam String brand) throws Exception {
1277
    public String getWarehouseWiseBrandPartnerSale(HttpServletRequest request, Model
-
 
1278
            model, @RequestParam String brand) throws Exception {
1217
 
1279
 
1218
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1280
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1219
        String email = loginDetails.getEmailId();
1281
        String email = loginDetails.getEmailId();
1220
 
1282
 
1221
        Set<Integer> authfofoIds = csService1.getAuthFofoIds(email, true);
1283
        Set<Integer> authfofoIds = csService1.getAuthFofoIds(email, true);
Line 1252... Line 1314...
1252
        model.addAttribute("selectedbrand", brand);
1314
        model.addAttribute("selectedbrand", brand);
1253
        return "warehousewise_brand_partners_sale";
1315
        return "warehousewise_brand_partners_sale";
1254
    }
1316
    }
1255
 
1317
 
1256
    @RequestMapping(value = "/getWarehouseWiseAccesoriesBrandPartnerSale", method = RequestMethod.GET)
1318
    @RequestMapping(value = "/getWarehouseWiseAccesoriesBrandPartnerSale", method = RequestMethod.GET)
1257
    public String getWarehouseWiseAccesoriesBrandPartnerSale(HttpServletRequest request, Model model, @RequestParam String brand) throws Exception {
1319
    public String getWarehouseWiseAccesoriesBrandPartnerSale(HttpServletRequest request, Model
-
 
1320
            model, @RequestParam String brand) throws Exception {
1258
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1321
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1259
        String email = loginDetails.getEmailId();
1322
        String email = loginDetails.getEmailId();
1260
        Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1323
        Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1261
        Set<Integer> authfofoIds = storeGuyMap.get(email);
1324
        Set<Integer> authfofoIds = storeGuyMap.get(email);
1262
 
1325
 
Line 1277... Line 1340...
1277
        model.addAttribute("selectedbrand", brand);
1340
        model.addAttribute("selectedbrand", brand);
1278
        return "warehousewise_accessoriesbrand_sale";
1341
        return "warehousewise_accessoriesbrand_sale";
1279
    }
1342
    }
1280
 
1343
 
1281
    @RequestMapping(value = "/getWarehouseBrandWiseItemSale", method = RequestMethod.GET)
1344
    @RequestMapping(value = "/getWarehouseBrandWiseItemSale", method = RequestMethod.GET)
-
 
1345
    public String getWarehouseBrandWiseItemSale(HttpServletRequest request, Model
1282
    public String getWarehouseBrandWiseItemSale(HttpServletRequest request, Model model, @RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
1346
            model, @RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
1283
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1347
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1284
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1348
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1285
        String email = loginDetails.getEmailId();
1349
        String email = loginDetails.getEmailId();
1286
        Set<Integer> authfofoIds = csService1.getAuthFofoIds(email, true);
1350
        Set<Integer> authfofoIds = csService1.getAuthFofoIds(email, true);
1287
        Map<Integer, WarehouseBrandWiseItemSaleModel> branditemSalesMap = fofoStoreRepository.selectWarehouseBrandItemSale(warehouseId, brand, new ArrayList<>(authfofoIds)).stream().collect(Collectors.toMap(x -> x.getItemId(), x -> x));
1351
        Map<Integer, WarehouseBrandWiseItemSaleModel> branditemSalesMap = fofoStoreRepository.selectWarehouseBrandItemSale(warehouseId, brand, new ArrayList<>(authfofoIds)).stream().collect(Collectors.toMap(x -> x.getItemId(), x -> x));
Line 1316... Line 1380...
1316
        model.addAttribute("warehouseMap", warehouseMap);
1380
        model.addAttribute("warehouseMap", warehouseMap);
1317
        return "warehouse_partner_itemwise_sale";
1381
        return "warehouse_partner_itemwise_sale";
1318
    }
1382
    }
1319
 
1383
 
1320
    @RequestMapping(value = "/getWarehouseAccesoriesBrandWiseItemSale", method = RequestMethod.GET)
1384
    @RequestMapping(value = "/getWarehouseAccesoriesBrandWiseItemSale", method = RequestMethod.GET)
-
 
1385
    public String getWarehouseAccesoriesBrandWiseItemSale(HttpServletRequest request, Model
1321
    public String getWarehouseAccesoriesBrandWiseItemSale(HttpServletRequest request, Model model, @RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
1386
            model, @RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
1322
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1387
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1323
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1388
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1324
        String email = loginDetails.getEmailId();
1389
        String email = loginDetails.getEmailId();
1325
        Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1390
        Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1326
        Set<Integer> authfofoIds = storeGuyMap.get(email);
1391
        Set<Integer> authfofoIds = storeGuyMap.get(email);
Line 1335... Line 1400...
1335
        model.addAttribute("appContextPath", request.getContextPath());
1400
        model.addAttribute("appContextPath", request.getContextPath());
1336
        return "contact-us";
1401
        return "contact-us";
1337
    }
1402
    }
1338
 
1403
 
1339
    @RequestMapping(value = "/notifications", method = RequestMethod.GET)
1404
    @RequestMapping(value = "/notifications", method = RequestMethod.GET)
1340
    public String getNotificationsWithType(HttpServletRequest request, @RequestParam(required = false) MessageType messageType, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "20") int limit, Model model) throws Exception {
1405
    public String getNotificationsWithType(HttpServletRequest
-
 
1406
                                                   request, @RequestParam(required = false) MessageType messageType,
-
 
1407
                                           @RequestParam(name = "offset", defaultValue = "0") int offset,
-
 
1408
                                           @RequestParam(name = "limit", defaultValue = "20") int limit, Model model) throws Exception {
1341
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1409
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1342
        int userId = 0;
1410
        int userId = 0;
1343
        boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
1411
        boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
1344
        if (isAdmin) {
1412
        if (isAdmin) {
1345
            userId = loginDetails.getFofoId();
1413
            userId = loginDetails.getFofoId();
Line 1357... Line 1425...
1357
        LOGGER.info("notifications" + notifications);
1425
        LOGGER.info("notifications" + notifications);
1358
        return "notification-template";
1426
        return "notification-template";
1359
    }
1427
    }
1360
 
1428
 
1361
    @RequestMapping(value = "/notifyDocument/documentId", method = RequestMethod.GET)
1429
    @RequestMapping(value = "/notifyDocument/documentId", method = RequestMethod.GET)
-
 
1430
    public ResponseEntity<?> retailerDocumentById(HttpServletRequest request,
1362
    public ResponseEntity<?> retailerDocumentById(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.DOCUMENT_ID) int documentId, @RequestParam int cid) throws ProfitMandiBusinessException {
1431
                                                  @RequestParam(name = ProfitMandiConstants.DOCUMENT_ID) int documentId, @RequestParam int cid) throws
-
 
1432
            ProfitMandiBusinessException {
1363
        Document document = documentRepository.selectById(documentId);
1433
        Document document = documentRepository.selectById(documentId);
1364
        NotificationCampaign nc = notificationCampaignRepository.selectById(cid);
1434
        NotificationCampaign nc = notificationCampaignRepository.selectById(cid);
1365
        if (nc.getDocumentId() == null) {
1435
        if (nc.getDocumentId() == null) {
1366
            throw new ProfitMandiBusinessException("cid", nc.getId(), "not available");
1436
            throw new ProfitMandiBusinessException("cid", nc.getId(), "not available");
1367
        }
1437
        }
Line 1370... Line 1440...
1370
        }
1440
        }
1371
        return responseSender.ok(document);
1441
        return responseSender.ok(document);
1372
    }
1442
    }
1373
 
1443
 
1374
    @RequestMapping(value = "/notifyDocument/download", method = RequestMethod.GET)
1444
    @RequestMapping(value = "/notifyDocument/download", method = RequestMethod.GET)
1375
    public ResponseEntity<?> downloadRetailerDocument(HttpServletRequest request, @RequestParam int cid, Model model) throws ProfitMandiBusinessException {
1445
    public ResponseEntity<?> downloadRetailerDocument(HttpServletRequest request, @RequestParam int cid, Model
-
 
1446
            model) throws ProfitMandiBusinessException {
1376
 
1447
 
1377
        NotificationCampaign nc = notificationCampaignRepository.selectById(cid);
1448
        NotificationCampaign nc = notificationCampaignRepository.selectById(cid);
1378
 
1449
 
1379
        if (nc.getDocumentId() == null) {
1450
        if (nc.getDocumentId() == null) {
1380
            throw new ProfitMandiBusinessException("cid", nc.getId(), "not available");
1451
            throw new ProfitMandiBusinessException("cid", nc.getId(), "not available");
Line 1387... Line 1458...
1387
            file = new FileInputStream(document.getPath() + File.separator + document.getName());
1458
            file = new FileInputStream(document.getPath() + File.separator + document.getName());
1388
        } catch (FileNotFoundException e) {
1459
        } catch (FileNotFoundException e) {
1389
            LOGGER.error("Retailer Document file not found : ", e);
1460
            LOGGER.error("Retailer Document file not found : ", e);
1390
            throw new ProfitMandiBusinessException(ProfitMandiConstants.DOCUMENT_ID, document.getId(), "RTLR_1013");
1461
            throw new ProfitMandiBusinessException(ProfitMandiConstants.DOCUMENT_ID, document.getId(), "RTLR_1013");
1391
        }
1462
        }
1392
        // ByteArrayOutputStream byteArrayOutputStream = new
1463
// ByteArrayOutputStream byteArrayOutputStream = new
1393
        // ByteArrayOutputStream();
1464
// ByteArrayOutputStream();
1394
        // ExcelUtils.writeSchemeModels(schemeModels, byteArrayOutputStream);
1465
// ExcelUtils.writeSchemeModels(schemeModels, byteArrayOutputStream);
1395
 
1466
 
1396
        final HttpHeaders headers = new HttpHeaders();
1467
        final HttpHeaders headers = new HttpHeaders();
1397
        String contentType = "";
1468
        String contentType = "";
1398
        if (document.getContentType() == ContentType.JPEG) {
1469
        if (document.getContentType() == ContentType.JPEG) {
1399
            contentType = "image/jpeg";
1470
            contentType = "image/jpeg";
Line 1408... Line 1479...
1408
        final InputStreamResource inputStreamResource = new InputStreamResource(file);
1479
        final InputStreamResource inputStreamResource = new InputStreamResource(file);
1409
        return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
1480
        return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
1410
    }
1481
    }
1411
 
1482
 
1412
    @RequestMapping(value = "/getItemWiseTertiary", method = RequestMethod.GET)
1483
    @RequestMapping(value = "/getItemWiseTertiary", method = RequestMethod.GET)
-
 
1484
    public String getItemWiseTertiary(HttpServletRequest request,
1413
    public String getItemWiseTertiary(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws ProfitMandiBusinessException {
1485
                                      @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws
-
 
1486
            ProfitMandiBusinessException {
1414
        List<ItemWiseTertiaryModel> itemWiseTertiary = fofoOrderRepository.SelectItemWiseTertiary(fofoId);
1487
        List<ItemWiseTertiaryModel> itemWiseTertiary = fofoOrderRepository.SelectItemWiseTertiary(fofoId);
1415
 
1488
 
1416
        LOGGER.info("itemWiseTertiary" + itemWiseTertiary);
1489
        LOGGER.info("itemWiseTertiary" + itemWiseTertiary);
1417
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1490
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1418
        model.addAttribute("customRetailer", customRetailer);
1491
        model.addAttribute("customRetailer", customRetailer);
1419
        model.addAttribute("itemWiseTertiary", itemWiseTertiary);
1492
        model.addAttribute("itemWiseTertiary", itemWiseTertiary);
1420
        return "item-wise-tertiary";
1493
        return "item-wise-tertiary";
1421
    }
1494
    }
1422
 
1495
 
1423
    @RequestMapping(value = "/getItemWiseIndent", method = RequestMethod.GET)
1496
    @RequestMapping(value = "/getItemWiseIndent", method = RequestMethod.GET)
-
 
1497
    public String getItemWiseIndent(HttpServletRequest request,
1424
    public String getItemWiseIndent(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws ProfitMandiBusinessException {
1498
                                    @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws
-
 
1499
            ProfitMandiBusinessException {
1425
 
1500
 
1426
        List<Order> unbilledOrders = transactionService.getInTransitOrders(fofoId);
1501
        List<Order> unbilledOrders = transactionService.getInTransitOrders(fofoId);
1427
        model.addAttribute("unbilledOrders", unbilledOrders);
1502
        model.addAttribute("unbilledOrders", unbilledOrders);
1428
 
1503
 
1429
        return "item-wise-indent";
1504
        return "item-wise-indent";
1430
    }
1505
    }
1431
 
1506
 
1432
    @RequestMapping(value = "/getPartnerInvestment", method = RequestMethod.GET)
1507
    @RequestMapping(value = "/getPartnerInvestment", method = RequestMethod.GET)
-
 
1508
    public String getPartnerInvestment(HttpServletRequest request,
1433
    public String getPartnerInvestment(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1509
                                       @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1434
        Map<Integer, PartnerDetailModel> partnerStats = adminUser.getPartnersStatDataFromFile();
1510
        Map<Integer, PartnerDetailModel> partnerStats = adminUser.getPartnersStatDataFromFile();
1435
        PartnerDetailModel partnerDetailModel = partnerStats.get(fofoId);
1511
        PartnerDetailModel partnerDetailModel = partnerStats.get(fofoId);
1436
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1512
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1437
        model.addAttribute("partnerDetailModel", partnerDetailModel);
1513
        model.addAttribute("partnerDetailModel", partnerDetailModel);
1438
        model.addAttribute("customRetailer", customRetailer);
1514
        model.addAttribute("customRetailer", customRetailer);
1439
        return "partner-investment";
1515
        return "partner-investment";
1440
    }
1516
    }
1441
 
1517
 
1442
    @RequestMapping(value = "/getPartnerPendingIndentItem", method = RequestMethod.GET)
1518
    @RequestMapping(value = "/getPartnerPendingIndentItem", method = RequestMethod.GET)
1443
    public String getPartnerPendingIndentItem(HttpServletRequest request, @RequestParam int warehouseId, @RequestParam int itemId, Model model) throws ProfitMandiBusinessException {
1519
    public String getPartnerPendingIndentItem(HttpServletRequest request, @RequestParam int warehouseId,
-
 
1520
                                              @RequestParam int itemId, Model model) throws ProfitMandiBusinessException {
1444
        List<PartnerPendingIndentItemModel> partnerPendingIndent = fofoStoreRepository.selectPartnerPendingIndentItem(itemId, warehouseId);
1521
        List<PartnerPendingIndentItemModel> partnerPendingIndent = fofoStoreRepository.selectPartnerPendingIndentItem(itemId, warehouseId);
1445
 
1522
 
1446
        model.addAttribute("partnerPendingIndent", partnerPendingIndent);
1523
        model.addAttribute("partnerPendingIndent", partnerPendingIndent);
1447
        return "partner-pending-indent-item";
1524
        return "partner-pending-indent-item";
1448
    }
1525
    }
1449
 
1526
 
1450
    @RequestMapping(value = "/getPatnerActivateStock", method = RequestMethod.GET)
1527
    @RequestMapping(value = "/getPatnerActivateStock", method = RequestMethod.GET)
-
 
1528
    public String getPartnerActivateStockItem(HttpServletRequest request,
1451
    public String getPartnerActivateStockItem(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1529
                                              @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1452
        List<ActivateItemModel> activateStocks = new ArrayList<>();
1530
        List<ActivateItemModel> activateStocks = new ArrayList<>();
1453
        List<InventoryItem> inventoryItems = inventoryItemRepository.selectByActivatedNotSold(fofoId);
1531
        List<InventoryItem> inventoryItems = inventoryItemRepository.selectByActivatedNotSold(fofoId);
1454
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1532
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1455
 
1533
 
1456
        for (InventoryItem inventoryItem : inventoryItems) {
1534
        for (InventoryItem inventoryItem : inventoryItems) {
Line 1469... Line 1547...
1469
        model.addAttribute("customRetailer", customRetailer);
1547
        model.addAttribute("customRetailer", customRetailer);
1470
        return "partner-activate-stock";
1548
        return "partner-activate-stock";
1471
    }
1549
    }
1472
 
1550
 
1473
    @RequestMapping(value = "/getPatnerBrandWiseMTDSale", method = RequestMethod.GET)
1551
    @RequestMapping(value = "/getPatnerBrandWiseMTDSale", method = RequestMethod.GET)
-
 
1552
    public String getPatnerBrandWiseMTDSale(HttpServletRequest request,
1474
    public String getPatnerBrandWiseMTDSale(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1553
                                            @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1475
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1554
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1476
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1555
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1477
        Map<String, Double> brandMtdAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), fofoId);
1556
        Map<String, Double> brandMtdAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), fofoId);
1478
        Map<String, Long> brandMtdQty = fofoOrderItemRepository.selectSumQuantityGroupByBrand(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), fofoId);
1557
        Map<String, Long> brandMtdQty = fofoOrderItemRepository.selectSumQuantityGroupByBrand(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), fofoId);
1479
        Double accesoriesmtdsale = fofoOrderRepository.selectSumSaleGroupByFofoIdsForMobileOrAccessories(fofoId, curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), Optional.of(false)).get(fofoId);
1558
        Double accesoriesmtdsale = fofoOrderRepository.selectSumSaleGroupByFofoIdsForMobileOrAccessories(fofoId, curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), Optional.of(false)).get(fofoId);
Line 1488... Line 1567...
1488
        model.addAttribute("customRetailer", customRetailer);
1567
        model.addAttribute("customRetailer", customRetailer);
1489
        return "partner-brand-mtd-sale";
1568
        return "partner-brand-mtd-sale";
1490
    }
1569
    }
1491
 
1570
 
1492
    @RequestMapping(value = "/getPatnerBrandWiseLMTDSale", method = RequestMethod.GET)
1571
    @RequestMapping(value = "/getPatnerBrandWiseLMTDSale", method = RequestMethod.GET)
-
 
1572
    public String getPatnerBrandWiseLMTDSale(HttpServletRequest request,
1493
    public String getPatnerBrandWiseLMTDSale(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1573
                                             @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1494
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1574
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1495
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1575
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1496
        Map<String, Double> brandLMtdAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(
1576
        Map<String, Double> brandLMtdAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(
1497
                curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1), fofoId);
1577
                curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1), fofoId);
1498
        Map<String, Long> brandLmtdQty = fofoOrderItemRepository.selectSumQuantityGroupByBrand(
1578
        Map<String, Long> brandLmtdQty = fofoOrderItemRepository.selectSumQuantityGroupByBrand(
Line 1508... Line 1588...
1508
        model.addAttribute("customRetailer", customRetailer);
1588
        model.addAttribute("customRetailer", customRetailer);
1509
        return "partner-brand-lmtd-sale";
1589
        return "partner-brand-lmtd-sale";
1510
    }
1590
    }
1511
 
1591
 
1512
    @RequestMapping(value = "/getPatnerBrandWiseLMSSale", method = RequestMethod.GET)
1592
    @RequestMapping(value = "/getPatnerBrandWiseLMSSale", method = RequestMethod.GET)
-
 
1593
    public String getPatnerBrandWiseLMSSale(HttpServletRequest request,
1513
    public String getPatnerBrandWiseLMSSale(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1594
                                            @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1514
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1595
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1515
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1596
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1516
        int lengthOfMonth = YearMonth.from(curDate.minusMonths(1)).lengthOfMonth();
1597
        int lengthOfMonth = YearMonth.from(curDate.minusMonths(1)).lengthOfMonth();
1517
 
1598
 
1518
        Map<String, Double> brandLMSAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(
1599
        Map<String, Double> brandLMSAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(
Line 1530... Line 1611...
1530
        model.addAttribute("customRetailer", customRetailer);
1611
        model.addAttribute("customRetailer", customRetailer);
1531
        return "partner-brand-lms-sale";
1612
        return "partner-brand-lms-sale";
1532
    }
1613
    }
1533
 
1614
 
1534
    @RequestMapping(value = "/getPatnerInStock", method = RequestMethod.GET)
1615
    @RequestMapping(value = "/getPatnerInStock", method = RequestMethod.GET)
-
 
1616
    public String getPatnerInStock(HttpServletRequest request,
1535
    public String getPatnerInStock(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1617
                                   @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1536
 
1618
 
1537
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1619
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1538
 
1620
 
1539
        List<InStockBrandModel> mobileStocks = currentInventorySnapshotRepository.selectSumInStockMobileGroupByBrand(fofoId);
1621
        List<InStockBrandModel> mobileStocks = currentInventorySnapshotRepository.selectSumInStockMobileGroupByBrand(fofoId);
1540
        List<InStockBrandModel> accesStock = currentInventorySnapshotRepository.selectSumInStockAccessoriesGroupByBrand(fofoId);
1622
        List<InStockBrandModel> accesStock = currentInventorySnapshotRepository.selectSumInStockAccessoriesGroupByBrand(fofoId);
Line 1549... Line 1631...
1549
        model.addAttribute("customRetailer", customRetailer);
1631
        model.addAttribute("customRetailer", customRetailer);
1550
        return "partner-instock-item";
1632
        return "partner-instock-item";
1551
    }
1633
    }
1552
 
1634
 
1553
    @RequestMapping(value = "/getOpenTicketByFofoId", method = RequestMethod.GET)
1635
    @RequestMapping(value = "/getOpenTicketByFofoId", method = RequestMethod.GET)
-
 
1636
    public String getOpenTicketByFofoId(HttpServletRequest request,
1554
    public String getOpenTicketByFofoId(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1637
                                        @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1555
        Map<Integer, AuthUser> ticketIdAuthUser = new HashMap<>();
1638
        Map<Integer, AuthUser> ticketIdAuthUser = new HashMap<>();
1556
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1639
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1557
        List<Integer> ticketIds = ticketRepository.selectAllOpenTicketByRetailer(fofoId).stream().map(x -> x.getId()).collect(Collectors.toList());
1640
        List<Integer> ticketIds = ticketRepository.selectAllOpenTicketByRetailer(fofoId).stream().map(x -> x.getId()).collect(Collectors.toList());
1558
        List<TicketAssigned> ticketAssigns = ticketAssignedRepository.selectByTicketIds(ticketIds);
1641
        List<TicketAssigned> ticketAssigns = ticketAssignedRepository.selectByTicketIds(ticketIds);
1559
 
1642
 
Line 1566... Line 1649...
1566
        model.addAttribute("customRetailer", customRetailer);
1649
        model.addAttribute("customRetailer", customRetailer);
1567
        return "open-ticket";
1650
        return "open-ticket";
1568
    }
1651
    }
1569
 
1652
 
1570
    @RequestMapping(value = "/getPartnerSecondarySale", method = RequestMethod.GET)
1653
    @RequestMapping(value = "/getPartnerSecondarySale", method = RequestMethod.GET)
-
 
1654
    public String getPartnerSecondarySale(HttpServletRequest request,
1571
    public String getPartnerSecondarySale(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, @RequestParam String timeValue, Model model) throws Exception {
1655
                                          @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, @RequestParam String timeValue, Model model) throws
-
 
1656
            Exception {
1572
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1657
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1573
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1658
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1574
        int lengthOfMonth = YearMonth.from(curDate.minusMonths(1)).lengthOfMonth();
1659
        int lengthOfMonth = YearMonth.from(curDate.minusMonths(1)).lengthOfMonth();
1575
        LocalDateTime startDate = null;
1660
        LocalDateTime startDate = null;
1576
        LocalDateTime endDate = null;
1661
        LocalDateTime endDate = null;
Line 1660... Line 1745...
1660
        model.addAttribute("accessoriesBrandSales", accessoriesBrandSales);
1745
        model.addAttribute("accessoriesBrandSales", accessoriesBrandSales);
1661
        return "accessories-brand-wise-report";
1746
        return "accessories-brand-wise-report";
1662
    }
1747
    }
1663
 
1748
 
1664
    @RequestMapping(value = "/getMobileLMSGraph", method = RequestMethod.GET)
1749
    @RequestMapping(value = "/getMobileLMSGraph", method = RequestMethod.GET)
1665
    public String getMobileLMSGraph(HttpServletRequest request, @RequestParam(required = false) int warehouseId, @RequestParam(required = false) LocalDateTime date, @RequestParam(required = false) LocalDateTime endDate, @RequestParam List<Integer> fofoIds, @RequestParam String filterType, Model model) throws Exception {
1750
    public String getMobileLMSGraph(HttpServletRequest request, @RequestParam(required = false) int warehouseId,
-
 
1751
                                    @RequestParam(required = false) LocalDateTime date, @RequestParam(required = false) LocalDateTime endDate,
-
 
1752
                                    @RequestParam List<Integer> fofoIds, @RequestParam String filterType, Model model) throws Exception {
1666
        Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
1753
        Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
1667
                FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
1754
                FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
1668
 
1755
 
1669
        ChartModel cm;
1756
        ChartModel cm;
1670
        if (warehouseId != 0) {
1757
        if (warehouseId != 0) {
Line 1678... Line 1765...
1678
        model.addAttribute("chartMap", gson.toJson(cm));
1765
        model.addAttribute("chartMap", gson.toJson(cm));
1679
        return "brand-wise-mobile-lms-chart";
1766
        return "brand-wise-mobile-lms-chart";
1680
    }
1767
    }
1681
 
1768
 
1682
    @RequestMapping(value = "/getMobileLMSFilter", method = RequestMethod.GET)
1769
    @RequestMapping(value = "/getMobileLMSFilter", method = RequestMethod.GET)
1683
    public String getMobileLMSFilter(HttpServletRequest request, @RequestParam(required = false, defaultValue = "0") int warehouseId, @RequestParam(required = false) LocalDateTime date, @RequestParam(required = false) LocalDateTime endDate, Model model) throws Exception {
1770
    public String getMobileLMSFilter(HttpServletRequest request,
-
 
1771
                                     @RequestParam(required = false, defaultValue = "0") int warehouseId,
-
 
1772
                                     @RequestParam(required = false) LocalDateTime date,
-
 
1773
                                     @RequestParam(required = false) LocalDateTime endDate, Model model) throws Exception {
1684
 
1774
 
1685
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1775
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1686
        String email = loginDetails.getEmailId();
1776
        String email = loginDetails.getEmailId();
1687
 
1777
 
1688
        if (date == null) {
1778
        if (date == null) {
Line 1705... Line 1795...
1705
 
1795
 
1706
        return "chart-filter-lms";
1796
        return "chart-filter-lms";
1707
    }
1797
    }
1708
 
1798
 
1709
    @RequestMapping(value = "/getMobileLMPGraph", method = RequestMethod.GET)
1799
    @RequestMapping(value = "/getMobileLMPGraph", method = RequestMethod.GET)
1710
    public String getMobileLMPGraph(HttpServletRequest request, @RequestParam(required = false) int warehouseId, @RequestParam(required = false) LocalDateTime date, @RequestParam(required = false) LocalDateTime endDate, @RequestParam List<Integer> fofoIds, @RequestParam String filterType, Model model) throws Exception {
1800
    public String getMobileLMPGraph(HttpServletRequest request, @RequestParam(required = false) int warehouseId,
-
 
1801
                                    @RequestParam(required = false) LocalDateTime date, @RequestParam(required = false) LocalDateTime endDate,
-
 
1802
                                    @RequestParam List<Integer> fofoIds, @RequestParam String filterType, Model model) throws Exception {
1711
        Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
1803
        Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
1712
                FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
1804
                FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
1713
 
1805
 
1714
        ChartModel cm;
1806
        ChartModel cm;
1715
        if (warehouseId != 0) {
1807
        if (warehouseId != 0) {
Line 1723... Line 1815...
1723
        model.addAttribute("chartMap", gson.toJson(cm));
1815
        model.addAttribute("chartMap", gson.toJson(cm));
1724
        return "brand-wise-mobile-lmp-chart";
1816
        return "brand-wise-mobile-lmp-chart";
1725
    }
1817
    }
1726
 
1818
 
1727
    @RequestMapping(value = "/getSaleCountByMilestone", method = RequestMethod.GET)
1819
    @RequestMapping(value = "/getSaleCountByMilestone", method = RequestMethod.GET)
-
 
1820
    public String getSaleCountByMilestone(HttpServletRequest request,
1728
    public String getSaleCountByMilestone(HttpServletRequest request, @RequestParam(required = false, defaultValue = "0") int warehouseId, Model model) throws Exception {
1821
                                          @RequestParam(required = false, defaultValue = "0") int warehouseId, Model model) throws Exception {
1729
 
1822
 
1730
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1823
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1731
        String email = loginDetails.getEmailId();
1824
        String email = loginDetails.getEmailId();
1732
        Set<Integer> authFofoIds = csService1.getAuthFofoIds(email, true);
1825
        Set<Integer> authFofoIds = csService1.getAuthFofoIds(email, true);
1733
 
1826
 
Line 1801... Line 1894...
1801
        return "sale-milestone";
1894
        return "sale-milestone";
1802
 
1895
 
1803
    }
1896
    }
1804
 
1897
 
1805
    @RequestMapping(value = "/getPurchaseCountByMileStone", method = RequestMethod.GET)
1898
    @RequestMapping(value = "/getPurchaseCountByMileStone", method = RequestMethod.GET)
-
 
1899
    public String getPurchaseCountByMileStone(HttpServletRequest request,
1806
    public String getPurchaseCountByMileStone(HttpServletRequest request, @RequestParam(required = false, defaultValue = "0") int warehouseId, Model model) throws Exception {
1900
                                              @RequestParam(required = false, defaultValue = "0") int warehouseId, Model model) throws Exception {
1807
 
1901
 
1808
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1902
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1809
        String email = loginDetails.getEmailId();
1903
        String email = loginDetails.getEmailId();
1810
 
1904
 
1811
        Set<Integer> authFofoIds = csService1.getAuthFofoIds(email, true);
1905
        Set<Integer> authFofoIds = csService1.getAuthFofoIds(email, true);
Line 1879... Line 1973...
1879
        return "purchase-milestone";
1973
        return "purchase-milestone";
1880
 
1974
 
1881
    }
1975
    }
1882
 
1976
 
1883
    @RequestMapping(value = "/getActivatedModelWarehouseWise", method = RequestMethod.GET)
1977
    @RequestMapping(value = "/getActivatedModelWarehouseWise", method = RequestMethod.GET)
1884
    public String getActivatedModelWarehouseWise(HttpServletRequest request, Model model, @RequestParam String brand) throws Exception {
1978
    public String getActivatedModelWarehouseWise(HttpServletRequest request, Model model, @RequestParam String
-
 
1979
            brand) throws Exception {
1885
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1980
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1886
        List<Integer> fofoIds = getFofoIds(loginDetails);
1981
        List<Integer> fofoIds = getFofoIds(loginDetails);
1887
        List<WarehouseWiseActivatedModel> warehouseWiseActivatedModels = activatedImeiRepository.selectActivatedModelGroupByWarehouse(brand, fofoIds);
1982
        List<WarehouseWiseActivatedModel> warehouseWiseActivatedModels = activatedImeiRepository.selectActivatedModelGroupByWarehouse(brand, fofoIds);
1888
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1983
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1889
 
1984
 
Line 1908... Line 2003...
1908
        model.addAttribute("activatedModels", activatedModels);
2003
        model.addAttribute("activatedModels", activatedModels);
1909
        return "activation-brandwise-report";
2004
        return "activation-brandwise-report";
1910
    }
2005
    }
1911
 
2006
 
1912
    @RequestMapping(value = "/getWarehouseBrandWiseItemActivatedModel", method = RequestMethod.GET)
2007
    @RequestMapping(value = "/getWarehouseBrandWiseItemActivatedModel", method = RequestMethod.GET)
-
 
2008
    public String getWarehouseBrandWiseItemActivatedModel(HttpServletRequest request, Model
1913
    public String getWarehouseBrandWiseItemActivatedModel(HttpServletRequest request, Model model, @RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
2009
            model, @RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
1914
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
2010
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1915
        List<Integer> fofoIds = getFofoIds(loginDetails);
2011
        List<Integer> fofoIds = getFofoIds(loginDetails);
1916
 
2012
 
1917
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
2013
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1918
        List<WarehouseBrandWiseItemActivatedModel> activatedItems = activatedImeiRepository.selectWarehouseBrandActivatedItem(warehouseId, brand, fofoIds);
2014
        List<WarehouseBrandWiseItemActivatedModel> activatedItems = activatedImeiRepository.selectWarehouseBrandActivatedItem(warehouseId, brand, fofoIds);
Line 1954... Line 2050...
1954
        }
2050
        }
1955
        return new ArrayList<>(fofoIds);
2051
        return new ArrayList<>(fofoIds);
1956
    }
2052
    }
1957
 
2053
 
1958
    @RequestMapping(value = "/getMonthWiseSale", method = RequestMethod.GET)
2054
    @RequestMapping(value = "/getMonthWiseSale", method = RequestMethod.GET)
-
 
2055
    public String getPartnerSaleByMonth(HttpServletRequest
1959
    public String getPartnerSaleByMonth(HttpServletRequest request, @RequestParam List<Integer> fofoIds, Model model) throws Exception {
2056
                                                request, @RequestParam List<Integer> fofoIds, Model model) throws Exception {
1960
 
2057
 
1961
        YearMonth now = YearMonth.now();
2058
        YearMonth now = YearMonth.now();
1962
        YearMonth ym = YearMonth.now().minusMonths(12);
2059
        YearMonth ym = YearMonth.now().minusMonths(12);
1963
        List<YearMonth> list = new ArrayList<>();
2060
        List<YearMonth> list = new ArrayList<>();
1964
        while (!now.isBefore(ym)) {
2061
        while (!now.isBefore(ym)) {
Line 1987... Line 2084...
1987
        return "monthly-partner-sale";
2084
        return "monthly-partner-sale";
1988
 
2085
 
1989
    }
2086
    }
1990
 
2087
 
1991
    @RequestMapping(value = "/getMonthWisePurchase", method = RequestMethod.GET)
2088
    @RequestMapping(value = "/getMonthWisePurchase", method = RequestMethod.GET)
-
 
2089
    public String getMonthWisePurchase(HttpServletRequest
1992
    public String getMonthWisePurchase(HttpServletRequest request, @RequestParam List<Integer> fofoIds, Model model) throws Exception {
2090
                                               request, @RequestParam List<Integer> fofoIds, Model model) throws Exception {
1993
 
2091
 
1994
        YearMonth now = YearMonth.now();
2092
        YearMonth now = YearMonth.now();
1995
        YearMonth ym = YearMonth.now().minusMonths(12);
2093
        YearMonth ym = YearMonth.now().minusMonths(12);
1996
        List<YearMonth> list = new ArrayList<>();
2094
        List<YearMonth> list = new ArrayList<>();
1997
        while (!now.isBefore(ym)) {
2095
        while (!now.isBefore(ym)) {