Subversion Repositories SmartDukaan

Rev

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

Rev 32792 Rev 32836
Line 227... Line 227...
227
    private MonthlyTargetRepository monthlyTargetRepository;
227
    private MonthlyTargetRepository monthlyTargetRepository;
228
 
228
 
229
    @Autowired
229
    @Autowired
230
    private SamsungUpgradeOfferRepository samsungUpgradeOfferRepository;
230
    private SamsungUpgradeOfferRepository samsungUpgradeOfferRepository;
231
    private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
231
    private static final Logger LOGGER = LogManager.getLogger(DashboardController.class);
-
 
232
 
232
    @Autowired
233
    @Autowired
233
    private SSHService sshService;
234
    private SSHService sshService;
234
 
235
 
235
    @RequestMapping(value = "/12dashboard34", method = RequestMethod.GET)
236
    @RequestMapping(value = "/12dashboard34", method = RequestMethod.GET)
236
    public String dashboard1(HttpServletRequest request, Model model, @RequestParam int fofoId) throws Exception {
237
    public String dashboard1(HttpServletRequest request, Model model, @RequestParam int fofoId) throws Exception {
Line 582... Line 583...
582
 
583
 
583
    @Autowired
584
    @Autowired
584
    OfferPayoutRepository offerPayoutRepository;
585
    OfferPayoutRepository offerPayoutRepository;
585
 
586
 
586
    @RequestMapping(value = "/partnerTotalIncomeByMonth/{yearMonth}", method = RequestMethod.GET)
587
    @RequestMapping(value = "/partnerTotalIncomeByMonth/{yearMonth}", method = RequestMethod.GET)
587
    public String getPartnerTotalIncomeByMonth(HttpServletRequest request, @PathVariable int yearMonth, Model model) throws Exception {
588
    public String getPartnerTotalIncomeByMonth(HttpServletRequest request, @PathVariable int yearMonth, Model model) throws
-
 
589
            Exception {
588
 
590
 
589
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
591
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
590
        long pendingIncome = 0;
592
        long pendingIncome = 0;
591
        long partnerPurchaseIn = 0;
593
        long partnerPurchaseIn = 0;
592
        long partnerCreditedSale = 0;
594
        long partnerCreditedSale = 0;
Line 670... Line 672...
670
 
672
 
671
        return "partner-total-income";
673
        return "partner-total-income";
672
    }
674
    }
673
 
675
 
674
    @RequestMapping(value = "/getMonthsInvestment", method = RequestMethod.GET)
676
    @RequestMapping(value = "/getMonthsInvestment", method = RequestMethod.GET)
-
 
677
    public String getMonthsInvestment(HttpServletRequest request,
675
    public String getMonthsInvestment(HttpServletRequest request, @RequestParam(name = "month", required = true, defaultValue = "0") int month, Model model) throws Exception {
678
                                      @RequestParam(name = "month", required = true, defaultValue = "0") int month, Model model) throws Exception {
676
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
679
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
677
        int fofoId = loginDetails.getFofoId();
680
        int fofoId = loginDetails.getFofoId();
678
        Map<String, Object> investment = fofoUser.getInvestmentsMonths(fofoId, month);
681
        Map<String, Object> investment = fofoUser.getInvestmentsMonths(fofoId, month);
679
 
682
 
680
        LocalDateTime currentMonthStart = LocalDateTime.now().withDayOfMonth(1);
683
        LocalDateTime currentMonthStart = LocalDateTime.now().withDayOfMonth(1);
Line 753... Line 756...
753
 
756
 
754
        return "bar_chart";
757
        return "bar_chart";
755
    }
758
    }
756
 
759
 
757
    @RequestMapping(value = "/getPriceDropDetails", method = RequestMethod.GET)
760
    @RequestMapping(value = "/getPriceDropDetails", method = RequestMethod.GET)
758
    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 {
761
    public String getPriceDropDetails(HttpServletRequest request,
-
 
762
                                      @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
-
 
763
                                      @RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
-
 
764
                                      @RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model) throws
-
 
765
            Exception {
759
 
766
 
760
        LOGGER.info("params" + fofoId + brand + yearMonth);
767
        LOGGER.info("params" + fofoId + brand + yearMonth);
761
 
768
 
762
        List<PriceDropWithDetailsByYearMonthModel> priceDropdetailsList = priceDropRepository.selectBrandPendingPriceDropWithDetailsByYearMonth(fofoId, brand, yearMonth);
769
        List<PriceDropWithDetailsByYearMonthModel> priceDropdetailsList = priceDropRepository.selectBrandPendingPriceDropWithDetailsByYearMonth(fofoId, brand, yearMonth);
763
 
770
 
Line 767... Line 774...
767
 
774
 
768
        return "price-drop-details";
775
        return "price-drop-details";
769
    }
776
    }
770
 
777
 
771
    @RequestMapping(value = "/getPriceDropDetailSixMonths", method = RequestMethod.GET)
778
    @RequestMapping(value = "/getPriceDropDetailSixMonths", method = RequestMethod.GET)
772
    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 {
779
    public String getPriceDropDetailSixMonths(HttpServletRequest request,
-
 
780
                                              @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
-
 
781
                                              @RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model) throws Exception {
773
 
782
 
774
        LOGGER.info("params" + fofoId + brand);
783
        LOGGER.info("params" + fofoId + brand);
775
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
784
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
776
        LocalDateTime startfMonthSixMonth = curDate.withDayOfMonth(1).minusMonths(12);
785
        LocalDateTime startfMonthSixMonth = curDate.withDayOfMonth(1).minusMonths(12);
777
        LocalDateTime endMonthTotal = curDate.withDayOfMonth(1).minusMonths(6);
786
        LocalDateTime endMonthTotal = curDate.withDayOfMonth(1).minusMonths(6);
Line 964... Line 973...
964
        model.addAttribute("fofoId", fofoId);
973
        model.addAttribute("fofoId", fofoId);
965
        return "activation-tabular";
974
        return "activation-tabular";
966
    }
975
    }
967
 
976
 
968
    @RequestMapping(value = "/getMonthlyActivationItemDetail", method = RequestMethod.GET)
977
    @RequestMapping(value = "/getMonthlyActivationItemDetail", method = RequestMethod.GET)
969
    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 {
978
    public String getMonthlyActivationItemDetail(HttpServletRequest request,
-
 
979
                                                 @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
-
 
980
                                                 @RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
-
 
981
                                                 @RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model) throws
-
 
982
            Exception {
970
 
983
 
971
        LOGGER.info("params" + fofoId + brand + yearMonth);
984
        LOGGER.info("params" + fofoId + brand + yearMonth);
972
 
985
 
973
        List<ActivationItemDetailModel> activationItemDetails = schemeInOutRepository.selectBrandPendingActivationItemDetails(fofoId, brand, yearMonth);
986
        List<ActivationItemDetailModel> activationItemDetails = schemeInOutRepository.selectBrandPendingActivationItemDetails(fofoId, brand, yearMonth);
974
 
987
 
Line 994... Line 1007...
994
 
1007
 
995
        return "activation-pending-item-details";
1008
        return "activation-pending-item-details";
996
    }
1009
    }
997
 
1010
 
998
    @RequestMapping(value = "/getMonthlyActivationBeforeSixMonthsItemDetail", method = RequestMethod.GET)
1011
    @RequestMapping(value = "/getMonthlyActivationBeforeSixMonthsItemDetail", method = RequestMethod.GET)
999
    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 {
1012
    public String getMonthlyActivationItemDetail(HttpServletRequest request,
-
 
1013
                                                 @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
-
 
1014
                                                 @RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model) throws Exception {
1000
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1015
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1001
 
1016
 
1002
        LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
1017
        LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
1003
 
1018
 
1004
        List<ActivationItemDetailModel> activationItemDetails = schemeInOutRepository.selectBrandPendingActivationItemDetailByYearMonth(fofoId, brand, startOfMonth);
1019
        List<ActivationItemDetailModel> activationItemDetails = schemeInOutRepository.selectBrandPendingActivationItemDetailByYearMonth(fofoId, brand, startOfMonth);
Line 1097... Line 1112...
1097
        return "upgrade-offer-tabular";
1112
        return "upgrade-offer-tabular";
1098
 
1113
 
1099
    }
1114
    }
1100
 
1115
 
1101
    @RequestMapping(value = "/getMonthlyUpgradeOfferItemDetail", method = RequestMethod.GET)
1116
    @RequestMapping(value = "/getMonthlyUpgradeOfferItemDetail", method = RequestMethod.GET)
1102
    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 {
1117
    public String getMonthlyUpgradeOfferItemDetail(HttpServletRequest request,
-
 
1118
                                                   @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
-
 
1119
                                                   @RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
-
 
1120
                                                   @RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model) throws
-
 
1121
            Exception {
1103
 
1122
 
1104
        LOGGER.info("params" + fofoId + brand + yearMonth);
1123
        LOGGER.info("params" + fofoId + brand + yearMonth);
1105
        List<UpgradeOfferItemDetailModel> offerItems = samsungUpgradeOfferRepository.selectUpgradeOfferItemDetails(fofoId, UpgradeOfferStatus.approved, brand, yearMonth);
1124
        List<UpgradeOfferItemDetailModel> offerItems = samsungUpgradeOfferRepository.selectUpgradeOfferItemDetails(fofoId, UpgradeOfferStatus.approved, brand, yearMonth);
1106
 
1125
 
1107
        model.addAttribute("offerItems", offerItems);
1126
        model.addAttribute("offerItems", offerItems);
1108
 
1127
 
1109
        return "upgrade-offer-item-detail";
1128
        return "upgrade-offer-item-detail";
1110
    }
1129
    }
1111
 
1130
 
1112
    @RequestMapping(value = "/getUpgradeOfferBeforeSixMonthItemDetail", method = RequestMethod.GET)
1131
    @RequestMapping(value = "/getUpgradeOfferBeforeSixMonthItemDetail", method = RequestMethod.GET)
1113
    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 {
1132
    public String getUpgradeOfferBeforeSixMonthItemDetail(HttpServletRequest request,
-
 
1133
                                                          @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
-
 
1134
                                                          @RequestParam(name = "brand", required = true, defaultValue = "0") String brand, Model model) throws Exception {
1114
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1135
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1115
 
1136
 
1116
        LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
1137
        LocalDateTime startOfMonth = curDate.withDayOfMonth(1).minusMonths(6);
1117
 
1138
 
1118
        List<UpgradeOfferItemDetailModel> offerItems = samsungUpgradeOfferRepository.selectUpgradeOfferItemDetailByYearMonth(fofoId, UpgradeOfferStatus.approved, brand, startOfMonth);
1139
        List<UpgradeOfferItemDetailModel> offerItems = samsungUpgradeOfferRepository.selectUpgradeOfferItemDetailByYearMonth(fofoId, UpgradeOfferStatus.approved, brand, startOfMonth);
Line 1121... Line 1142...
1121
 
1142
 
1122
        return "upgrade-offer-item-detail";
1143
        return "upgrade-offer-item-detail";
1123
    }
1144
    }
1124
 
1145
 
1125
    @RequestMapping(value = "/getAuthUserPartners", method = RequestMethod.GET)
1146
    @RequestMapping(value = "/getAuthUserPartners", method = RequestMethod.GET)
1126
    public String AuthUserPartnersDetail(HttpServletRequest request, Model model, @RequestParam int authId) throws Exception {
1147
    public String AuthUserPartnersDetail(HttpServletRequest request, Model model, @RequestParam int authId) throws
-
 
1148
            Exception {
1127
 
1149
 
1128
        Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
1150
        Map<Integer, List<Integer>> pp = csService.getAuthUserIdPartnerIdMapping();
1129
        Map<Integer, CustomRetailer> fofoIdAndPartnerMap = retailerService.getFofoRetailers(false);
1151
        Map<Integer, CustomRetailer> fofoIdAndPartnerMap = retailerService.getFofoRetailers(false);
1130
 
1152
 
1131
        Map<Integer, PartnerDetailModel> fofoIdAndallValues = partnerStatsService.getAllPartnerStats();
1153
        Map<Integer, PartnerDetailModel> fofoIdAndallValues = partnerStatsService.getAllPartnerStats();
Line 1140... Line 1162...
1140
 
1162
 
1141
        return "auth_user_partner_detail";
1163
        return "auth_user_partner_detail";
1142
    }
1164
    }
1143
 
1165
 
1144
    @RequestMapping(value = "/getWarehousePartners", method = RequestMethod.GET)
1166
    @RequestMapping(value = "/getWarehousePartners", method = RequestMethod.GET)
1145
    public String warehousePartnersDetail(HttpServletRequest request, Model model, @RequestParam int warehouseId) throws Exception {
1167
    public String warehousePartnersDetail(HttpServletRequest request, Model model, @RequestParam int warehouseId) throws
-
 
1168
            Exception {
1146
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1169
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1147
        String email = loginDetails.getEmailId();
1170
        String email = loginDetails.getEmailId();
1148
 
1171
 
1149
        Set<Integer> authfofoIds = new HashSet<>();
1172
        Set<Integer> authfofoIds = new HashSet<>();
1150
        authfofoIds = csService1.getAuthFofoIds(email, true);
1173
        authfofoIds = csService1.getAuthFofoIds(email, true);
Line 1184... Line 1207...
1184
        return "auth_user_partner_detail";
1207
        return "auth_user_partner_detail";
1185
    }
1208
    }
1186
 
1209
 
1187
 
1210
 
1188
    @RequestMapping(value = "/getWarehouseWiseBrandStock", method = RequestMethod.GET)
1211
    @RequestMapping(value = "/getWarehouseWiseBrandStock", method = RequestMethod.GET)
1189
    public String getWarehouseWiseBrandStock(HttpServletRequest request, Model model, @RequestParam List<Integer> warehouseId) throws Exception {
1212
    public String getWarehouseWiseBrandStock(HttpServletRequest request, Model
-
 
1213
            model, @RequestParam List<Integer> warehouseId) throws Exception {
1190
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1214
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1191
        String email = loginDetails.getEmailId();
1215
        String email = loginDetails.getEmailId();
1192
        Set<Integer> authfofoIds = csService1.getAuthFofoIds(email, true);
1216
        Set<Integer> authfofoIds = csService1.getAuthFofoIds(email, true);
1193
        Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository.selectActivePartnersByRetailerIds(new ArrayList<>(authfofoIds)).stream().collect(Collectors.groupingBy(
1217
        Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository.selectActivePartnersByRetailerIds(new ArrayList<>(authfofoIds)).stream().collect(Collectors.groupingBy(
1194
                FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
1218
                FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
Line 1214... Line 1238...
1214
        model.addAttribute("response1", mvcResponseSender.createResponseString(true));
1238
        model.addAttribute("response1", mvcResponseSender.createResponseString(true));
1215
        return "response";
1239
        return "response";
1216
    }
1240
    }
1217
 
1241
 
1218
    @RequestMapping(value = "/getWarehouseWiseBrandAndCategory", method = RequestMethod.GET)
1242
    @RequestMapping(value = "/getWarehouseWiseBrandAndCategory", method = RequestMethod.GET)
-
 
1243
    public String getWarehouseWiseBrandAndCategory(HttpServletRequest request, Model
1219
    public String getWarehouseWiseBrandAndCategory(HttpServletRequest request, Model model, @RequestParam List<Integer> warehouseId, @RequestParam List<String> brands, @RequestParam String category) throws Exception {
1244
            model, @RequestParam List<Integer> warehouseId, @RequestParam List<String> brands, @RequestParam String
-
 
1245
                                                           category) throws Exception {
1220
 
1246
 
1221
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1247
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1222
        List<String> listbrands = saholicInventoryCISRepository.selectAllBrand();
1248
        List<String> listbrands = saholicInventoryCISRepository.selectAllBrand();
1223
        List<String> listCategory = saholicInventoryCISRepository.selectAllSubCategory();
1249
        List<String> listCategory = saholicInventoryCISRepository.selectAllSubCategory();
1224
 
1250
 
Line 1232... Line 1258...
1232
 
1258
 
1233
        return "warehouse_brand_item_stock";
1259
        return "warehouse_brand_item_stock";
1234
    }
1260
    }
1235
 
1261
 
1236
    @RequestMapping(value = "/getWarehouseWiseItemStock", method = RequestMethod.GET)
1262
    @RequestMapping(value = "/getWarehouseWiseItemStock", method = RequestMethod.GET)
-
 
1263
    public String getWarehouseWiseItemStock(HttpServletRequest request, Model
1237
    public String getWarehouseWiseItemStock(HttpServletRequest request, Model model, @RequestParam List<Integer> warehouseId, @RequestParam List<String> brands, @RequestParam String category) throws Exception {
1264
            model, @RequestParam List<Integer> warehouseIds, @RequestParam List<String> brands, @RequestParam String
-
 
1265
                                                    category) throws Exception {
1238
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1266
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1239
        if (warehouseId.contains(0)) {
1267
        if (warehouseIds.contains(0)) {
1240
            warehouseId.addAll(warehouseMap.keySet());
1268
            warehouseIds.addAll(warehouseMap.keySet());
1241
        }
1269
        }
1242
        List<WarehouseWiseitemStockModel> warehouseWiseItemStock = saholicInventoryCISRepository.selectWarehouseItemStock(warehouseId, brands, category);
1270
        List<WarehouseWiseitemStockModel> warehouseWiseItemStock = saholicInventoryCISRepository.selectWarehouseItemStock(warehouseIds, brands, category);
1243
 
1271
 
1244
        model.addAttribute("warehouseWiseItemStock", warehouseWiseItemStock);
1272
        model.addAttribute("warehouseWiseItemStock", warehouseWiseItemStock);
1245
        model.addAttribute("warehouseMap", warehouseMap);
1273
        model.addAttribute("warehouseMap", warehouseMap);
1246
        return "warehouse_item_details";
1274
        return "warehouse_item_details";
1247
    }
1275
    }
1248
 
1276
 
1249
    @RequestMapping(value = "/getWarehouseWiseBrandPartnerSale", method = RequestMethod.GET)
1277
    @RequestMapping(value = "/getWarehouseWiseBrandPartnerSale", method = RequestMethod.GET)
1250
    public String getWarehouseWiseBrandPartnerSale(HttpServletRequest request, Model model, @RequestParam String brand) throws Exception {
1278
    public String getWarehouseWiseBrandPartnerSale(HttpServletRequest request, Model model, @RequestParam String
-
 
1279
            brand) throws Exception {
1251
 
1280
 
1252
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1281
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1253
        String email = loginDetails.getEmailId();
1282
        String email = loginDetails.getEmailId();
1254
 
1283
 
1255
        Set<Integer> authfofoIds = csService1.getAuthFofoIds(email, true);
1284
        Set<Integer> authfofoIds = csService1.getAuthFofoIds(email, true);
Line 1286... Line 1315...
1286
        model.addAttribute("selectedbrand", brand);
1315
        model.addAttribute("selectedbrand", brand);
1287
        return "warehousewise_brand_partners_sale";
1316
        return "warehousewise_brand_partners_sale";
1288
    }
1317
    }
1289
 
1318
 
1290
    @RequestMapping(value = "/getWarehouseWiseAccesoriesBrandPartnerSale", method = RequestMethod.GET)
1319
    @RequestMapping(value = "/getWarehouseWiseAccesoriesBrandPartnerSale", method = RequestMethod.GET)
1291
    public String getWarehouseWiseAccesoriesBrandPartnerSale(HttpServletRequest request, Model model, @RequestParam String brand) throws Exception {
1320
    public String getWarehouseWiseAccesoriesBrandPartnerSale(HttpServletRequest request, Model
-
 
1321
            model, @RequestParam String brand) throws Exception {
1292
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1322
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1293
        String email = loginDetails.getEmailId();
1323
        String email = loginDetails.getEmailId();
1294
        Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1324
        Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1295
        Set<Integer> authfofoIds = storeGuyMap.get(email);
1325
        Set<Integer> authfofoIds = storeGuyMap.get(email);
1296
 
1326
 
Line 1311... Line 1341...
1311
        model.addAttribute("selectedbrand", brand);
1341
        model.addAttribute("selectedbrand", brand);
1312
        return "warehousewise_accessoriesbrand_sale";
1342
        return "warehousewise_accessoriesbrand_sale";
1313
    }
1343
    }
1314
 
1344
 
1315
    @RequestMapping(value = "/getWarehouseBrandWiseItemSale", method = RequestMethod.GET)
1345
    @RequestMapping(value = "/getWarehouseBrandWiseItemSale", method = RequestMethod.GET)
-
 
1346
    public String getWarehouseBrandWiseItemSale(HttpServletRequest request, Model
1316
    public String getWarehouseBrandWiseItemSale(HttpServletRequest request, Model model, @RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
1347
            model, @RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
1317
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1348
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1318
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1349
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1319
        String email = loginDetails.getEmailId();
1350
        String email = loginDetails.getEmailId();
1320
        Set<Integer> authfofoIds = csService1.getAuthFofoIds(email, true);
1351
        Set<Integer> authfofoIds = csService1.getAuthFofoIds(email, true);
1321
        Map<Integer, WarehouseBrandWiseItemSaleModel> branditemSalesMap = fofoStoreRepository.selectWarehouseBrandItemSale(warehouseId, brand, new ArrayList<>(authfofoIds)).stream().collect(Collectors.toMap(x -> x.getItemId(), x -> x));
1352
        Map<Integer, WarehouseBrandWiseItemSaleModel> branditemSalesMap = fofoStoreRepository.selectWarehouseBrandItemSale(warehouseId, brand, new ArrayList<>(authfofoIds)).stream().collect(Collectors.toMap(x -> x.getItemId(), x -> x));
Line 1350... Line 1381...
1350
        model.addAttribute("warehouseMap", warehouseMap);
1381
        model.addAttribute("warehouseMap", warehouseMap);
1351
        return "warehouse_partner_itemwise_sale";
1382
        return "warehouse_partner_itemwise_sale";
1352
    }
1383
    }
1353
 
1384
 
1354
    @RequestMapping(value = "/getWarehouseAccesoriesBrandWiseItemSale", method = RequestMethod.GET)
1385
    @RequestMapping(value = "/getWarehouseAccesoriesBrandWiseItemSale", method = RequestMethod.GET)
-
 
1386
    public String getWarehouseAccesoriesBrandWiseItemSale(HttpServletRequest request, Model
1355
    public String getWarehouseAccesoriesBrandWiseItemSale(HttpServletRequest request, Model model, @RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
1387
            model, @RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
1356
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1388
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1357
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1389
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1358
        String email = loginDetails.getEmailId();
1390
        String email = loginDetails.getEmailId();
1359
        Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1391
        Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
1360
        Set<Integer> authfofoIds = storeGuyMap.get(email);
1392
        Set<Integer> authfofoIds = storeGuyMap.get(email);
Line 1369... Line 1401...
1369
        model.addAttribute("appContextPath", request.getContextPath());
1401
        model.addAttribute("appContextPath", request.getContextPath());
1370
        return "contact-us";
1402
        return "contact-us";
1371
    }
1403
    }
1372
 
1404
 
1373
    @RequestMapping(value = "/notifications", method = RequestMethod.GET)
1405
    @RequestMapping(value = "/notifications", method = RequestMethod.GET)
1374
    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 {
1406
    public String getNotificationsWithType(HttpServletRequest request, @RequestParam(required = false) MessageType
-
 
1407
            messageType, @RequestParam(name = "offset", defaultValue = "0") int offset,
-
 
1408
                                           @RequestParam(name = "limit", defaultValue = "20") int limit, Model model) throws Exception {
1375
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1409
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1376
        int userId = 0;
1410
        int userId = 0;
1377
        boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
1411
        boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
1378
        if (isAdmin) {
1412
        if (isAdmin) {
1379
            userId = loginDetails.getFofoId();
1413
            userId = loginDetails.getFofoId();
Line 1392... Line 1426...
1392
        LOGGER.info("notifications" + notifications);}
1426
        LOGGER.info("notifications" + notifications);}
1393
        return "notification-template";
1427
        return "notification-template";
1394
    }
1428
    }
1395
 
1429
 
1396
    @RequestMapping(value = "/notifyDocument/documentId", method = RequestMethod.GET)
1430
    @RequestMapping(value = "/notifyDocument/documentId", method = RequestMethod.GET)
-
 
1431
    public ResponseEntity<?> retailerDocumentById(HttpServletRequest request,
1397
    public ResponseEntity<?> retailerDocumentById(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.DOCUMENT_ID) int documentId, @RequestParam int cid) throws ProfitMandiBusinessException {
1432
                                                  @RequestParam(name = ProfitMandiConstants.DOCUMENT_ID) int documentId, @RequestParam int cid) throws
-
 
1433
            ProfitMandiBusinessException {
1398
        Document document = documentRepository.selectById(documentId);
1434
        Document document = documentRepository.selectById(documentId);
1399
        NotificationCampaign nc = notificationCampaignRepository.selectById(cid);
1435
        NotificationCampaign nc = notificationCampaignRepository.selectById(cid);
1400
        if (nc.getDocumentId() == null) {
1436
        if (nc.getDocumentId() == null) {
1401
            throw new ProfitMandiBusinessException("cid", nc.getId(), "not available");
1437
            throw new ProfitMandiBusinessException("cid", nc.getId(), "not available");
1402
        }
1438
        }
Line 1405... Line 1441...
1405
        }
1441
        }
1406
        return responseSender.ok(document);
1442
        return responseSender.ok(document);
1407
    }
1443
    }
1408
 
1444
 
1409
    @RequestMapping(value = "/notifyDocument/download", method = RequestMethod.GET)
1445
    @RequestMapping(value = "/notifyDocument/download", method = RequestMethod.GET)
1410
    public ResponseEntity<?> downloadRetailerDocument(HttpServletRequest request, @RequestParam int cid, Model model) throws ProfitMandiBusinessException {
1446
    public ResponseEntity<?> downloadRetailerDocument(HttpServletRequest request, @RequestParam int cid, Model model) throws
-
 
1447
            ProfitMandiBusinessException {
1411
 
1448
 
1412
        NotificationCampaign nc = notificationCampaignRepository.selectById(cid);
1449
        NotificationCampaign nc = notificationCampaignRepository.selectById(cid);
1413
 
1450
 
1414
        if (nc.getDocumentId() == null) {
1451
        if (nc.getDocumentId() == null) {
1415
            throw new ProfitMandiBusinessException("cid", nc.getId(), "not available");
1452
            throw new ProfitMandiBusinessException("cid", nc.getId(), "not available");
Line 1443... Line 1480...
1443
        final InputStreamResource inputStreamResource = new InputStreamResource(file);
1480
        final InputStreamResource inputStreamResource = new InputStreamResource(file);
1444
        return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
1481
        return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
1445
    }
1482
    }
1446
 
1483
 
1447
    @RequestMapping(value = "/getItemWiseTertiary", method = RequestMethod.GET)
1484
    @RequestMapping(value = "/getItemWiseTertiary", method = RequestMethod.GET)
-
 
1485
    public String getItemWiseTertiary(HttpServletRequest request,
1448
    public String getItemWiseTertiary(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws ProfitMandiBusinessException {
1486
                                      @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws ProfitMandiBusinessException {
1449
        List<ItemWiseTertiaryModel> itemWiseTertiary = fofoOrderRepository.SelectItemWiseTertiary(fofoId);
1487
        List<ItemWiseTertiaryModel> itemWiseTertiary = fofoOrderRepository.SelectItemWiseTertiary(fofoId);
1450
 
1488
 
1451
        LOGGER.info("itemWiseTertiary" + itemWiseTertiary);
1489
        LOGGER.info("itemWiseTertiary" + itemWiseTertiary);
1452
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1490
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1453
        model.addAttribute("customRetailer", customRetailer);
1491
        model.addAttribute("customRetailer", customRetailer);
1454
        model.addAttribute("itemWiseTertiary", itemWiseTertiary);
1492
        model.addAttribute("itemWiseTertiary", itemWiseTertiary);
1455
        return "item-wise-tertiary";
1493
        return "item-wise-tertiary";
1456
    }
1494
    }
1457
 
1495
 
1458
    @RequestMapping(value = "/getItemWiseIndent", method = RequestMethod.GET)
1496
    @RequestMapping(value = "/getItemWiseIndent", method = RequestMethod.GET)
-
 
1497
    public String getItemWiseIndent(HttpServletRequest request,
1459
    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 ProfitMandiBusinessException {
1460
 
1499
 
1461
        List<Order> unbilledOrders = transactionService.getInTransitOrders(fofoId);
1500
        List<Order> unbilledOrders = transactionService.getInTransitOrders(fofoId);
1462
        model.addAttribute("unbilledOrders", unbilledOrders);
1501
        model.addAttribute("unbilledOrders", unbilledOrders);
1463
 
1502
 
1464
        return "item-wise-indent";
1503
        return "item-wise-indent";
1465
    }
1504
    }
1466
 
1505
 
1467
    @RequestMapping(value = "/getPartnerInvestment", method = RequestMethod.GET)
1506
    @RequestMapping(value = "/getPartnerInvestment", method = RequestMethod.GET)
-
 
1507
    public String getPartnerInvestment(HttpServletRequest request,
1468
    public String getPartnerInvestment(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1508
                                       @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1469
        Map<Integer, PartnerDetailModel> partnerStats = adminUser.getPartnersStatDataFromFile();
1509
        Map<Integer, PartnerDetailModel> partnerStats = adminUser.getPartnersStatDataFromFile();
1470
        PartnerDetailModel partnerDetailModel = partnerStats.get(fofoId);
1510
        PartnerDetailModel partnerDetailModel = partnerStats.get(fofoId);
1471
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1511
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1472
        model.addAttribute("partnerDetailModel", partnerDetailModel);
1512
        model.addAttribute("partnerDetailModel", partnerDetailModel);
1473
        model.addAttribute("customRetailer", customRetailer);
1513
        model.addAttribute("customRetailer", customRetailer);
1474
        return "partner-investment";
1514
        return "partner-investment";
1475
    }
1515
    }
1476
 
1516
 
1477
    @RequestMapping(value = "/getPartnerPendingIndentItem", method = RequestMethod.GET)
1517
    @RequestMapping(value = "/getPartnerPendingIndentItem", method = RequestMethod.GET)
1478
    public String getPartnerPendingIndentItem(HttpServletRequest request, @RequestParam int warehouseId, @RequestParam int itemId, Model model) throws ProfitMandiBusinessException {
1518
    public String getPartnerPendingIndentItem(HttpServletRequest request, @RequestParam int warehouseId,
-
 
1519
                                              @RequestParam int itemId, Model model) throws ProfitMandiBusinessException {
1479
        List<PartnerPendingIndentItemModel> partnerPendingIndent = fofoStoreRepository.selectPartnerPendingIndentItem(itemId, warehouseId);
1520
        List<PartnerPendingIndentItemModel> partnerPendingIndent = fofoStoreRepository.selectPartnerPendingIndentItem(itemId, warehouseId);
1480
 
1521
 
1481
        model.addAttribute("partnerPendingIndent", partnerPendingIndent);
1522
        model.addAttribute("partnerPendingIndent", partnerPendingIndent);
1482
        return "partner-pending-indent-item";
1523
        return "partner-pending-indent-item";
1483
    }
1524
    }
1484
 
1525
 
1485
    @RequestMapping(value = "/getPatnerActivateStock", method = RequestMethod.GET)
1526
    @RequestMapping(value = "/getPatnerActivateStock", method = RequestMethod.GET)
-
 
1527
    public String getPartnerActivateStockItem(HttpServletRequest request,
1486
    public String getPartnerActivateStockItem(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1528
                                              @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1487
        List<ActivateItemModel> activateStocks = new ArrayList<>();
1529
        List<ActivateItemModel> activateStocks = new ArrayList<>();
1488
        List<InventoryItem> inventoryItems = inventoryItemRepository.selectByActivatedNotSold(fofoId);
1530
        List<InventoryItem> inventoryItems = inventoryItemRepository.selectByActivatedNotSold(fofoId);
1489
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1531
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1490
 
1532
 
1491
        for (InventoryItem inventoryItem : inventoryItems) {
1533
        for (InventoryItem inventoryItem : inventoryItems) {
Line 1504... Line 1546...
1504
        model.addAttribute("customRetailer", customRetailer);
1546
        model.addAttribute("customRetailer", customRetailer);
1505
        return "partner-activate-stock";
1547
        return "partner-activate-stock";
1506
    }
1548
    }
1507
 
1549
 
1508
    @RequestMapping(value = "/getPatnerBrandWiseMTDSale", method = RequestMethod.GET)
1550
    @RequestMapping(value = "/getPatnerBrandWiseMTDSale", method = RequestMethod.GET)
-
 
1551
    public String getPatnerBrandWiseMTDSale(HttpServletRequest request,
1509
    public String getPatnerBrandWiseMTDSale(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1552
                                            @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1510
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1553
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1511
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1554
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1512
        Map<String, Double> brandMtdAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), fofoId);
1555
        Map<String, Double> brandMtdAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), fofoId);
1513
        Map<String, Long> brandMtdQty = fofoOrderItemRepository.selectSumQuantityGroupByBrand(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), fofoId);
1556
        Map<String, Long> brandMtdQty = fofoOrderItemRepository.selectSumQuantityGroupByBrand(curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), fofoId);
1514
        Double accesoriesmtdsale = fofoOrderRepository.selectSumSaleGroupByFofoIdsForMobileOrAccessories(fofoId, curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), Optional.of(false)).get(fofoId);
1557
        Double accesoriesmtdsale = fofoOrderRepository.selectSumSaleGroupByFofoIdsForMobileOrAccessories(fofoId, curDate.withDayOfMonth(1), curDate.with(LocalTime.MAX), Optional.of(false)).get(fofoId);
Line 1523... Line 1566...
1523
        model.addAttribute("customRetailer", customRetailer);
1566
        model.addAttribute("customRetailer", customRetailer);
1524
        return "partner-brand-mtd-sale";
1567
        return "partner-brand-mtd-sale";
1525
    }
1568
    }
1526
 
1569
 
1527
    @RequestMapping(value = "/getPatnerBrandWiseLMTDSale", method = RequestMethod.GET)
1570
    @RequestMapping(value = "/getPatnerBrandWiseLMTDSale", method = RequestMethod.GET)
-
 
1571
    public String getPatnerBrandWiseLMTDSale(HttpServletRequest request,
1528
    public String getPatnerBrandWiseLMTDSale(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1572
                                             @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1529
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1573
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1530
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1574
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1531
        Map<String, Double> brandLMtdAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(
1575
        Map<String, Double> brandLMtdAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(
1532
                curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1), fofoId);
1576
                curDate.withDayOfMonth(1).minusMonths(1), curDate.with(LocalTime.MAX).minusMonths(1), fofoId);
1533
        Map<String, Long> brandLmtdQty = fofoOrderItemRepository.selectSumQuantityGroupByBrand(
1577
        Map<String, Long> brandLmtdQty = fofoOrderItemRepository.selectSumQuantityGroupByBrand(
Line 1543... Line 1587...
1543
        model.addAttribute("customRetailer", customRetailer);
1587
        model.addAttribute("customRetailer", customRetailer);
1544
        return "partner-brand-lmtd-sale";
1588
        return "partner-brand-lmtd-sale";
1545
    }
1589
    }
1546
 
1590
 
1547
    @RequestMapping(value = "/getPatnerBrandWiseLMSSale", method = RequestMethod.GET)
1591
    @RequestMapping(value = "/getPatnerBrandWiseLMSSale", method = RequestMethod.GET)
-
 
1592
    public String getPatnerBrandWiseLMSSale(HttpServletRequest request,
1548
    public String getPatnerBrandWiseLMSSale(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1593
                                            @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1549
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1594
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1550
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1595
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1551
        int lengthOfMonth = YearMonth.from(curDate.minusMonths(1)).lengthOfMonth();
1596
        int lengthOfMonth = YearMonth.from(curDate.minusMonths(1)).lengthOfMonth();
1552
 
1597
 
1553
        Map<String, Double> brandLMSAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(
1598
        Map<String, Double> brandLMSAmount = fofoOrderItemRepository.selectSumAmountGroupByBrand(
Line 1565... Line 1610...
1565
        model.addAttribute("customRetailer", customRetailer);
1610
        model.addAttribute("customRetailer", customRetailer);
1566
        return "partner-brand-lms-sale";
1611
        return "partner-brand-lms-sale";
1567
    }
1612
    }
1568
 
1613
 
1569
    @RequestMapping(value = "/getPatnerInStock", method = RequestMethod.GET)
1614
    @RequestMapping(value = "/getPatnerInStock", method = RequestMethod.GET)
-
 
1615
    public String getPatnerInStock(HttpServletRequest request,
1570
    public String getPatnerInStock(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1616
                                   @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1571
 
1617
 
1572
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1618
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1573
 
1619
 
1574
        List<InStockBrandModel> mobileStocks = currentInventorySnapshotRepository.selectSumInStockMobileGroupByBrand(fofoId);
1620
        List<InStockBrandModel> mobileStocks = currentInventorySnapshotRepository.selectSumInStockMobileGroupByBrand(fofoId);
1575
        List<InStockBrandModel> accesStock = currentInventorySnapshotRepository.selectSumInStockAccessoriesGroupByBrand(fofoId);
1621
        List<InStockBrandModel> accesStock = currentInventorySnapshotRepository.selectSumInStockAccessoriesGroupByBrand(fofoId);
Line 1584... Line 1630...
1584
        model.addAttribute("customRetailer", customRetailer);
1630
        model.addAttribute("customRetailer", customRetailer);
1585
        return "partner-instock-item";
1631
        return "partner-instock-item";
1586
    }
1632
    }
1587
 
1633
 
1588
    @RequestMapping(value = "/getOpenTicketByFofoId", method = RequestMethod.GET)
1634
    @RequestMapping(value = "/getOpenTicketByFofoId", method = RequestMethod.GET)
-
 
1635
    public String getOpenTicketByFofoId(HttpServletRequest request,
1589
    public String getOpenTicketByFofoId(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1636
                                        @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, Model model) throws Exception {
1590
        Map<Integer, AuthUser> ticketIdAuthUser = new HashMap<>();
1637
        Map<Integer, AuthUser> ticketIdAuthUser = new HashMap<>();
1591
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1638
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1592
        List<Integer> ticketIds = ticketRepository.selectAllOpenTicketByRetailer(fofoId).stream().map(x -> x.getId()).collect(Collectors.toList());
1639
        List<Integer> ticketIds = ticketRepository.selectAllOpenTicketByRetailer(fofoId).stream().map(x -> x.getId()).collect(Collectors.toList());
1593
        List<TicketAssigned> ticketAssigns = ticketAssignedRepository.selectByTicketIds(ticketIds);
1640
        List<TicketAssigned> ticketAssigns = ticketAssignedRepository.selectByTicketIds(ticketIds);
1594
 
1641
 
Line 1601... Line 1648...
1601
        model.addAttribute("customRetailer", customRetailer);
1648
        model.addAttribute("customRetailer", customRetailer);
1602
        return "open-ticket";
1649
        return "open-ticket";
1603
    }
1650
    }
1604
 
1651
 
1605
    @RequestMapping(value = "/getPartnerSecondarySale", method = RequestMethod.GET)
1652
    @RequestMapping(value = "/getPartnerSecondarySale", method = RequestMethod.GET)
-
 
1653
    public String getPartnerSecondarySale(HttpServletRequest request,
1606
    public String getPartnerSecondarySale(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, @RequestParam String timeValue, Model model) throws Exception {
1654
                                          @RequestParam(name = ProfitMandiConstants.FOFO_ID) int fofoId, @RequestParam String timeValue, Model model) throws
-
 
1655
            Exception {
1607
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1656
        LocalDateTime curDate = LocalDate.now().atStartOfDay();
1608
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1657
        CustomRetailer customRetailer = retailerService.getFofoRetailer(fofoId);
1609
        int lengthOfMonth = YearMonth.from(curDate.minusMonths(1)).lengthOfMonth();
1658
        int lengthOfMonth = YearMonth.from(curDate.minusMonths(1)).lengthOfMonth();
1610
        LocalDateTime startDate = null;
1659
        LocalDateTime startDate = null;
1611
        LocalDateTime endDate = null;
1660
        LocalDateTime endDate = null;
Line 1695... Line 1744...
1695
        model.addAttribute("accessoriesBrandSales", accessoriesBrandSales);
1744
        model.addAttribute("accessoriesBrandSales", accessoriesBrandSales);
1696
        return "accessories-brand-wise-report";
1745
        return "accessories-brand-wise-report";
1697
    }
1746
    }
1698
 
1747
 
1699
    @RequestMapping(value = "/getMobileLMSGraph", method = RequestMethod.GET)
1748
    @RequestMapping(value = "/getMobileLMSGraph", method = RequestMethod.GET)
1700
    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 {
1749
    public String getMobileLMSGraph(HttpServletRequest request, @RequestParam(required = false) int warehouseId,
-
 
1750
                                    @RequestParam(required = false) LocalDateTime date, @RequestParam(required = false) LocalDateTime endDate,
-
 
1751
                                    @RequestParam List<Integer> fofoIds, @RequestParam String filterType, Model model) throws Exception {
1701
        Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
1752
        Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
1702
                FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
1753
                FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
1703
 
1754
 
1704
        ChartModel cm;
1755
        ChartModel cm;
1705
        if (warehouseId != 0) {
1756
        if (warehouseId != 0) {
Line 1713... Line 1764...
1713
        model.addAttribute("chartMap", gson.toJson(cm));
1764
        model.addAttribute("chartMap", gson.toJson(cm));
1714
        return "brand-wise-mobile-lms-chart";
1765
        return "brand-wise-mobile-lms-chart";
1715
    }
1766
    }
1716
 
1767
 
1717
    @RequestMapping(value = "/getMobileLMSFilter", method = RequestMethod.GET)
1768
    @RequestMapping(value = "/getMobileLMSFilter", method = RequestMethod.GET)
1718
    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 {
1769
    public String getMobileLMSFilter(HttpServletRequest request,
-
 
1770
                                     @RequestParam(required = false, defaultValue = "0") int warehouseId,
-
 
1771
                                     @RequestParam(required = false) LocalDateTime date, @RequestParam(required = false) LocalDateTime endDate, Model
-
 
1772
                                             model) throws Exception {
1719
 
1773
 
1720
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1774
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1721
        String email = loginDetails.getEmailId();
1775
        String email = loginDetails.getEmailId();
1722
 
1776
 
1723
        if (date == null) {
1777
        if (date == null) {
Line 1740... Line 1794...
1740
 
1794
 
1741
        return "chart-filter-lms";
1795
        return "chart-filter-lms";
1742
    }
1796
    }
1743
 
1797
 
1744
    @RequestMapping(value = "/getMobileLMPGraph", method = RequestMethod.GET)
1798
    @RequestMapping(value = "/getMobileLMPGraph", method = RequestMethod.GET)
1745
    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 {
1799
    public String getMobileLMPGraph(HttpServletRequest request, @RequestParam(required = false) int warehouseId,
-
 
1800
                                    @RequestParam(required = false) LocalDateTime date, @RequestParam(required = false) LocalDateTime endDate,
-
 
1801
                                    @RequestParam List<Integer> fofoIds, @RequestParam String filterType, Model model) throws Exception {
1746
        Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
1802
        Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository.selectActivePartnersByRetailerIds(new ArrayList<>(fofoIds)).stream().collect(Collectors.groupingBy(
1747
                FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
1803
                FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
1748
 
1804
 
1749
        ChartModel cm;
1805
        ChartModel cm;
1750
        if (warehouseId != 0) {
1806
        if (warehouseId != 0) {
Line 1758... Line 1814...
1758
        model.addAttribute("chartMap", gson.toJson(cm));
1814
        model.addAttribute("chartMap", gson.toJson(cm));
1759
        return "brand-wise-mobile-lmp-chart";
1815
        return "brand-wise-mobile-lmp-chart";
1760
    }
1816
    }
1761
 
1817
 
1762
    @RequestMapping(value = "/getSaleCountByMilestone", method = RequestMethod.GET)
1818
    @RequestMapping(value = "/getSaleCountByMilestone", method = RequestMethod.GET)
-
 
1819
    public String getSaleCountByMilestone(HttpServletRequest request,
1763
    public String getSaleCountByMilestone(HttpServletRequest request, @RequestParam(required = false, defaultValue = "0") int warehouseId, Model model) throws Exception {
1820
                                          @RequestParam(required = false, defaultValue = "0") int warehouseId, Model model) throws Exception {
1764
 
1821
 
1765
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1822
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1766
        String email = loginDetails.getEmailId();
1823
        String email = loginDetails.getEmailId();
1767
        Set<Integer> authFofoIds = csService1.getAuthFofoIds(email, true);
1824
        Set<Integer> authFofoIds = csService1.getAuthFofoIds(email, true);
1768
 
1825
 
Line 1840... Line 1897...
1840
        return "sale-milestone";
1897
        return "sale-milestone";
1841
 
1898
 
1842
    }
1899
    }
1843
 
1900
 
1844
    @RequestMapping(value = "/getPurchaseCountByMileStone", method = RequestMethod.GET)
1901
    @RequestMapping(value = "/getPurchaseCountByMileStone", method = RequestMethod.GET)
-
 
1902
    public String getPurchaseCountByMileStone(HttpServletRequest request,
1845
    public String getPurchaseCountByMileStone(HttpServletRequest request, @RequestParam(required = false, defaultValue = "0") int warehouseId, Model model) throws Exception {
1903
                                              @RequestParam(required = false, defaultValue = "0") int warehouseId, Model model) throws Exception {
1846
 
1904
 
1847
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1905
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1848
        String email = loginDetails.getEmailId();
1906
        String email = loginDetails.getEmailId();
1849
 
1907
 
1850
        Set<Integer> authFofoIds = csService1.getAuthFofoIds(email, true);
1908
        Set<Integer> authFofoIds = csService1.getAuthFofoIds(email, true);
Line 1921... Line 1979...
1921
        return "purchase-milestone";
1979
        return "purchase-milestone";
1922
 
1980
 
1923
    }
1981
    }
1924
 
1982
 
1925
    @RequestMapping(value = "/getActivatedModelWarehouseWise", method = RequestMethod.GET)
1983
    @RequestMapping(value = "/getActivatedModelWarehouseWise", method = RequestMethod.GET)
1926
    public String getActivatedModelWarehouseWise(HttpServletRequest request, Model model, @RequestParam String brand) throws Exception {
1984
    public String getActivatedModelWarehouseWise(HttpServletRequest request, Model model, @RequestParam String
-
 
1985
            brand) throws Exception {
1927
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1986
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1928
        List<Integer> fofoIds = getFofoIds(loginDetails);
1987
        List<Integer> fofoIds = getFofoIds(loginDetails);
1929
        List<WarehouseWiseActivatedModel> warehouseWiseActivatedModels = activatedImeiRepository.selectActivatedModelGroupByWarehouse(brand, fofoIds);
1988
        List<WarehouseWiseActivatedModel> warehouseWiseActivatedModels = activatedImeiRepository.selectActivatedModelGroupByWarehouse(brand, fofoIds);
1930
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1989
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1931
 
1990
 
Line 1950... Line 2009...
1950
        model.addAttribute("activatedModels", activatedModels);
2009
        model.addAttribute("activatedModels", activatedModels);
1951
        return "activation-brandwise-report";
2010
        return "activation-brandwise-report";
1952
    }
2011
    }
1953
 
2012
 
1954
    @RequestMapping(value = "/getWarehouseBrandWiseItemActivatedModel", method = RequestMethod.GET)
2013
    @RequestMapping(value = "/getWarehouseBrandWiseItemActivatedModel", method = RequestMethod.GET)
-
 
2014
    public String getWarehouseBrandWiseItemActivatedModel(HttpServletRequest request, Model
1955
    public String getWarehouseBrandWiseItemActivatedModel(HttpServletRequest request, Model model, @RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
2015
            model, @RequestParam List<Integer> warehouseId, @RequestParam String brand) throws Exception {
1956
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
2016
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1957
        List<Integer> fofoIds = getFofoIds(loginDetails);
2017
        List<Integer> fofoIds = getFofoIds(loginDetails);
1958
 
2018
 
1959
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
2019
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
1960
        List<WarehouseBrandWiseItemActivatedModel> activatedItems = activatedImeiRepository.selectWarehouseBrandActivatedItem(warehouseId, brand, fofoIds);
2020
        List<WarehouseBrandWiseItemActivatedModel> activatedItems = activatedImeiRepository.selectWarehouseBrandActivatedItem(warehouseId, brand, fofoIds);
Line 1996... Line 2056...
1996
        }
2056
        }
1997
        return new ArrayList<>(fofoIds);
2057
        return new ArrayList<>(fofoIds);
1998
    }
2058
    }
1999
 
2059
 
2000
    @RequestMapping(value = "/getMonthWiseSale", method = RequestMethod.GET)
2060
    @RequestMapping(value = "/getMonthWiseSale", method = RequestMethod.GET)
2001
    public String getPartnerSaleByMonth(HttpServletRequest request, @RequestParam List<Integer> fofoIds, Model model) throws Exception {
2061
    public String getPartnerSaleByMonth(HttpServletRequest request, @RequestParam List<Integer> fofoIds, Model
-
 
2062
            model) throws Exception {
2002
 
2063
 
2003
        YearMonth now = YearMonth.now();
2064
        YearMonth now = YearMonth.now();
2004
        YearMonth ym = YearMonth.now().minusMonths(12);
2065
        YearMonth ym = YearMonth.now().minusMonths(12);
2005
        List<YearMonth> list = new ArrayList<>();
2066
        List<YearMonth> list = new ArrayList<>();
2006
        while (!now.isBefore(ym)) {
2067
        while (!now.isBefore(ym)) {
Line 2029... Line 2090...
2029
        return "monthly-partner-sale";
2090
        return "monthly-partner-sale";
2030
 
2091
 
2031
    }
2092
    }
2032
 
2093
 
2033
    @RequestMapping(value = "/getMonthWisePurchase", method = RequestMethod.GET)
2094
    @RequestMapping(value = "/getMonthWisePurchase", method = RequestMethod.GET)
2034
    public String getMonthWisePurchase(HttpServletRequest request, @RequestParam List<Integer> fofoIds, Model model) throws Exception {
2095
    public String getMonthWisePurchase(HttpServletRequest request, @RequestParam List<Integer> fofoIds, Model
-
 
2096
            model) throws Exception {
2035
 
2097
 
2036
        YearMonth now = YearMonth.now();
2098
        YearMonth now = YearMonth.now();
2037
        YearMonth ym = YearMonth.now().minusMonths(12);
2099
        YearMonth ym = YearMonth.now().minusMonths(12);
2038
        List<YearMonth> list = new ArrayList<>();
2100
        List<YearMonth> list = new ArrayList<>();
2039
        while (!now.isBefore(ym)) {
2101
        while (!now.isBefore(ym)) {