Subversion Repositories SmartDukaan

Rev

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

Rev 35466 Rev 35480
Line 1428... Line 1428...
1428
    public String warehousePartnersDetail(HttpServletRequest request, Model model, @RequestParam int warehouseId) throws
1428
    public String warehousePartnersDetail(HttpServletRequest request, Model model, @RequestParam int warehouseId) throws
1429
            Exception {
1429
            Exception {
1430
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1430
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1431
        String email = loginDetails.getEmailId();
1431
        String email = loginDetails.getEmailId();
1432
 
1432
 
1433
        Set<Integer> authfofoIds = new HashSet<>();
1433
        Set<Integer> authfofoIds = csService1.getAuthFofoIds(email, true);
-
 
1434
        if (authfofoIds == null) {
1434
        authfofoIds = csService1.getAuthFofoIds(email, true);
1435
            authfofoIds = new HashSet<>();
-
 
1436
        }
1435
        Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository.selectActivePartnersByRetailerIds(new ArrayList<>(authfofoIds)).stream().collect(Collectors.groupingBy(
1437
        Map<Integer, List<Integer>> warehouseIdFofoIdMap = fofoStoreRepository.selectActivePartnersByRetailerIds(new ArrayList<>(authfofoIds)).stream().collect(Collectors.groupingBy(
1436
                FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
1438
                FofoStore::getWarehouseId, Collectors.mapping(FofoStore::getId, Collectors.toList())));
1437
 
1439
 
1438
        if (!warehouseIdFofoIdMap.containsKey(7573)) {
1440
        if (!warehouseIdFofoIdMap.containsKey(7573)) {
1439
            warehouseIdFofoIdMap.put(7573, new ArrayList<>());
1441
            warehouseIdFofoIdMap.put(7573, new ArrayList<>());
1440
        }
1442
        }
1441
 
1443
 
1442
        Map<Integer, CustomRetailer> fofoIdAndPartnerMap = retailerService.getFofoRetailers(false);
1444
        Map<Integer, CustomRetailer> fofoIdAndPartnerMap = retailerService.getFofoRetailers(false);
1443
        Map<Integer, PartnerDetailModel> fofoIdAndallValues = adminUser.getPartnersStatDataFromFile();
1445
        Map<Integer, PartnerDetailModel> fofoIdAndallValues = adminUser.getPartnersStatDataFromFile();
-
 
1446
        if (fofoIdAndallValues == null) {
-
 
1447
            fofoIdAndallValues = new HashMap<>();
-
 
1448
        }
1444
        if (warehouseId != 0) {
1449
        if (warehouseId != 0) {
1445
            List<Integer> fofoIds = warehouseIdFofoIdMap.get(warehouseId);
1450
            List<Integer> fofoIds = warehouseIdFofoIdMap.get(warehouseId);
1446
            /*
-
 
1447
             * List<Integer> fofoIds =
1451
            if (fofoIds != null) {
1448
             * fofoStoreRepository.selectActivePartnerByWarehouse(warehouseId).stream()
-
 
1449
             * .map(x -> x.getId()).collect(Collectors.toList());
-
 
1450
             */
-
 
1451
            fofoIdAndallValues = fofoIdAndallValues.entrySet().stream().filter(x -> fofoIds.contains(x.getKey())).collect(Collectors.toMap(x -> x.getKey(), x -> x.getValue()));
1452
                fofoIdAndallValues = fofoIdAndallValues.entrySet().stream().filter(x -> fofoIds.contains(x.getKey())).collect(Collectors.toMap(x -> x.getKey(), x -> x.getValue()));
1452
        } else {
1453
            }
1453
 
-
 
1454
            List<Integer> fofoIds = new ArrayList<>(authfofoIds);
-
 
1455
            fofoIdAndallValues = fofoIdAndallValues.entrySet().stream().filter(x -> fofoIds.contains(x.getKey())).collect(Collectors.toMap(x -> x.getKey(), x -> x.getValue()));
-
 
1456
        }
1454
        }
-
 
1455
        // warehouseId=0 means show all partner stats - no filtering needed
1457
        ChartInvestmentModel cm = adminUser.getAllStatePartnerType(fofoIdAndallValues);
1456
        ChartInvestmentModel cm = adminUser.getAllStatePartnerType(fofoIdAndallValues);
1458
        model.addAttribute("chartPieMap", gson.toJson(cm));
1457
        model.addAttribute("chartPieMap", gson.toJson(cm));
1459
 
1458
 
1460
        LOGGER.info("adminUserChart" + gson.toJson(cm));
1459
        LOGGER.info("adminUserChart" + gson.toJson(cm));
1461
 
1460