Subversion Repositories SmartDukaan

Rev

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

Rev 33501 Rev 33705
Line 342... Line 342...
342
        model.addAttribute("webApiPort", webApiPort);
342
        model.addAttribute("webApiPort", webApiPort);
343
        model.addAttribute("webApiScheme", webApiScheme);
343
        model.addAttribute("webApiScheme", webApiScheme);
344
        model.addAttribute("webApiRoot", webApiRoot);
344
        model.addAttribute("webApiRoot", webApiRoot);
345
        model.addAttribute("googleApiKey", googleApiKey);
345
        model.addAttribute("googleApiKey", googleApiKey);
346
 
346
 
347
        List<PartnerRegion> partnerRegion = partnerRegionRepository.selectByfofoId(fofoId);
-
 
348
        LocalDateTime currentDate = LocalDateTime.now();
-
 
349
        List<PrintResource> printResources = printResourceRepository.selectPrintResourcesByFofoRegion(partnerRegion.get(0).getRegionId(), currentDate);
-
 
350
        LOGGER.info("printresourcesList {}", printResources);
-
 
351
        model.addAttribute("printResources", printResources);
-
 
352
 
-
 
353
        if (isAdmin) {
347
        if (isAdmin) {
354
            return adminUser.adminPanel(loginDetails.getFofoId(), email, model);
348
            return adminUser.adminPanel(loginDetails.getFofoId(), email, model);
355
        } else {
349
        } else {
356
            FofoStore fofoStore = null;
350
            FofoStore fofoStore;
-
 
351
            List<PartnerRegion> partnerRegion = partnerRegionRepository.selectByfofoId(fofoId);
-
 
352
            LocalDateTime currentDate = LocalDateTime.now();
-
 
353
            List<PrintResource> printResources = printResourceRepository.selectPrintResourcesByFofoRegion(partnerRegion.get(0).getRegionId(), currentDate);
-
 
354
            LOGGER.info("printresourcesList {}", printResources);
-
 
355
            model.addAttribute("printResources", printResources);
357
            try {
356
            try {
358
                fofoStore = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
357
                fofoStore = fofoStoreRepository.selectByRetailerId(loginDetails.getFofoId());
359
                if (!fofoStore.isActive()) {
358
                if (!fofoStore.isActive()) {
360
                    return "redirect:/login";
359
                    return "redirect:/login";
361
                }
360
                }
Line 420... Line 419...
420
                LocalDateTime currentMonthEnd = currentMonthStart.withDayOfMonth(1);
419
                LocalDateTime currentMonthEnd = currentMonthStart.withDayOfMonth(1);
421
 
420
 
422
                LOGGER.info("lastMonthStart" + lastMonthStart);
421
                LOGGER.info("lastMonthStart" + lastMonthStart);
423
                LOGGER.info("currentMonthEnd" + currentMonthEnd);
422
                LOGGER.info("currentMonthEnd" + currentMonthEnd);
424
 
423
 
425
 
-
 
426
                Scheme staticScheme = schemeService.getStaticScheme(fofoId);
424
                Scheme staticScheme = schemeService.getStaticScheme(fofoId);
427
                double schemeAchievement = 0;
425
                double schemeAchievement = 0;
428
                String schemeCategory = null;
426
                String schemeCategory = null;
429
                if (staticScheme != null) {
427
                if (staticScheme != null) {
430
                    Map<Integer, Double> schemeAchievementMap = orderRepository.selectBillingDatesBetweenSumGroupByRetailerId(staticScheme.getStartDateTime(), staticScheme.getEndDateTime());
428
                    Map<Integer, Double> schemeAchievementMap = orderRepository.selectBillingDatesBetweenSumGroupByRetailerId(staticScheme.getStartDateTime(), staticScheme.getEndDateTime());
431
                    if (schemeAchievementMap.get(fofoId) != null) {
429
                    if (schemeAchievementMap.get(fofoId) != null) {
432
                        schemeAchievement = schemeAchievementMap.get(fofoId);
430
                        schemeAchievement = schemeAchievementMap.get(fofoId);
433
                        if (staticScheme.getTarget() >= 2500000 && staticScheme.getTarget() < 3750000) {
431
                        if (staticScheme.getTarget() >= 120000 && staticScheme.getTarget() < 2000000) {
434
                            schemeCategory = "SD Club";
432
                            schemeCategory = "Bronze Club";
435
                        } else if (staticScheme.getTarget() < 5000000) {
433
                        } else if (staticScheme.getTarget() < 3000000) {
436
                            schemeCategory = "Silver";
434
                            schemeCategory = "Silver Club";
437
                        } else if (staticScheme.getTarget() < 7500000) {
435
                        } else if (staticScheme.getTarget() < 4000000) {
438
                            schemeCategory = "Gold - 1";
436
                            schemeCategory = "Gold Club";
-
 
437
                        } else if (staticScheme.getTarget() < 6000000) {
-
 
438
                            schemeCategory = "Rising Star Club";
439
                        } else if (staticScheme.getTarget() < 10000000) {
439
                        } else if (staticScheme.getTarget() < 8000000) {
440
                            schemeCategory = "Gold - 2";
440
                            schemeCategory = "Super Star Club";
441
                        } else if (staticScheme.getTarget() < 12500000) {
441
                        } else if (staticScheme.getTarget() < 12500000) {
442
                            schemeCategory = "Diamond";
442
                            schemeCategory = "Diamond Club";
-
 
443
                        } else if (staticScheme.getTarget() < 28000000) {
-
 
444
                            schemeCategory = "Platinum Club";
443
                        } else {
445
                        } else {
444
                            schemeCategory = "Platinum";
446
                            schemeCategory = "Premium Club";
445
                        }
447
                        }
446
                    }
448
                    }
447
                }
449
                }
448
 
450
 
449
 
451