Subversion Repositories SmartDukaan

Rev

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

Rev 34528 Rev 34617
Line 23... Line 23...
23
import com.spice.profitmandi.dao.enumuration.fofo.Milestone;
23
import com.spice.profitmandi.dao.enumuration.fofo.Milestone;
24
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
24
import com.spice.profitmandi.dao.enumuration.transaction.OrderStatus;
25
import com.spice.profitmandi.dao.model.SamsungUpgradeOfferModel;
25
import com.spice.profitmandi.dao.model.SamsungUpgradeOfferModel;
26
import com.spice.profitmandi.dao.model.*;
26
import com.spice.profitmandi.dao.model.*;
27
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
27
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
28
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
28
import com.spice.profitmandi.dao.repository.catalog.*;
29
import com.spice.profitmandi.dao.repository.catalog.OfferRepository;
-
 
30
import com.spice.profitmandi.dao.repository.catalog.SamsungUpgradeOfferRepository;
-
 
31
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
-
 
32
import com.spice.profitmandi.dao.repository.cs.*;
29
import com.spice.profitmandi.dao.repository.cs.*;
33
import com.spice.profitmandi.dao.repository.dtr.*;
30
import com.spice.profitmandi.dao.repository.dtr.*;
34
import com.spice.profitmandi.dao.repository.fofo.*;
31
import com.spice.profitmandi.dao.repository.fofo.*;
35
import com.spice.profitmandi.dao.repository.inventory.ReporticoCacheTableRepository;
32
import com.spice.profitmandi.dao.repository.inventory.ReporticoCacheTableRepository;
36
import com.spice.profitmandi.dao.repository.inventory.SaholicInventoryCISRepository;
33
import com.spice.profitmandi.dao.repository.inventory.SaholicInventoryCISRepository;
Line 44... Line 41...
44
import com.spice.profitmandi.service.SshServer.SSHService;
41
import com.spice.profitmandi.service.SshServer.SSHService;
45
import com.spice.profitmandi.service.authentication.RoleManager;
42
import com.spice.profitmandi.service.authentication.RoleManager;
46
import com.spice.profitmandi.service.catalog.BrandsService;
43
import com.spice.profitmandi.service.catalog.BrandsService;
47
import com.spice.profitmandi.service.integrations.psismart.PsiSmartService;
44
import com.spice.profitmandi.service.integrations.psismart.PsiSmartService;
48
import com.spice.profitmandi.service.inventory.InventoryService;
45
import com.spice.profitmandi.service.inventory.InventoryService;
-
 
46
import com.spice.profitmandi.service.offers.ItemCriteria;
49
import com.spice.profitmandi.service.offers.OfferService;
47
import com.spice.profitmandi.service.offers.OfferService;
50
import com.spice.profitmandi.service.scheme.SchemeService;
48
import com.spice.profitmandi.service.scheme.SchemeService;
51
import com.spice.profitmandi.service.transaction.TransactionService;
49
import com.spice.profitmandi.service.transaction.TransactionService;
52
import com.spice.profitmandi.service.user.RetailerService;
50
import com.spice.profitmandi.service.user.RetailerService;
53
import com.spice.profitmandi.web.model.LoginDetails;
51
import com.spice.profitmandi.web.model.LoginDetails;
Line 336... Line 334...
336
    PartnerRegionRepository partnerRegionRepository;
334
    PartnerRegionRepository partnerRegionRepository;
337
 
335
 
338
    @Autowired
336
    @Autowired
339
    PrintResourceRepository printResourceRepository;
337
    PrintResourceRepository printResourceRepository;
340
 
338
 
-
 
339
    @Autowired
-
 
340
    CatalogRepository catalogRepository;
-
 
341
 
341
    @RequestMapping(value = "/dashboard", method = RequestMethod.GET)
342
    @RequestMapping(value = "/dashboard", method = RequestMethod.GET)
342
    public String dashboard(HttpServletRequest request, Model model) throws Exception {
343
    public String dashboard(HttpServletRequest request, Model model) throws Exception {
343
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
344
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
344
        String email = loginDetails.getEmailId();
345
        String email = loginDetails.getEmailId();
345
        int fofoId = loginDetails.getFofoId();
346
        int fofoId = loginDetails.getFofoId();
Line 485... Line 486...
485
                ChartModel cm = fofoUser.getBrandChart(loginDetails.getFofoId(),null,null,false);
486
                ChartModel cm = fofoUser.getBrandChart(loginDetails.getFofoId(),null,null,false);
486
 
487
 
487
                LOGGER.info("chartMap" + gson.toJson(cm));
488
                LOGGER.info("chartMap" + gson.toJson(cm));
488
                model.addAttribute("chartMap", gson.toJson(cm));
489
                model.addAttribute("chartMap", gson.toJson(cm));
489
 
490
 
490
                List<CreateOfferRequest> publishedOffers = offerService.getPublishedOffers(loginDetails.getFofoId(), YearMonth.from(LocalDateTime.now()));
491
                List<CreateOfferRequest> createOffers = offerService.getPublishedOffers(loginDetails.getFofoId(), YearMonth.from(LocalDateTime.now()));
-
 
492
                List<CreateOfferRequest> publishedOffers = null;
-
 
493
 
-
 
494
                publishedOffers = createOffers.stream().filter(createOffer -> createOffer.getTargetSlabs().stream()
-
 
495
                        .map(x -> x.getItemCriteriaPayouts())
-
 
496
                        .flatMap(List::stream)
-
 
497
                        .map(ItemCriteriaPayout::getItemCriteria)
-
 
498
                        .map(ItemCriteria::getCatalogIds)
-
 
499
                        .flatMap(List::stream)
-
 
500
                        .noneMatch(catalogId -> catalogRepository.selectCatalogById(catalogId).getBrand().equals("Live Demo"))).collect(Collectors.toList());
-
 
501
 
491
                model.addAttribute("publishedOffers", publishedOffers);
502
                model.addAttribute("publishedOffers", publishedOffers);
492
                model.addAttribute("investments", fofoUser.getInvestments(loginDetails.getFofoId()));
503
                model.addAttribute("investments", fofoUser.getInvestments(loginDetails.getFofoId()));
493
                model.addAttribute("isInvestmentOk", partnerInvestmentService.isInvestmentOk(loginDetails.getFofoId(), ProfitMandiConstants.MIN_INVESTMENT_PERCENTAGE, ProfitMandiConstants.CUTOFF_INVESTMENT));
504
                model.addAttribute("isInvestmentOk", partnerInvestmentService.isInvestmentOk(loginDetails.getFofoId(), ProfitMandiConstants.MIN_INVESTMENT_PERCENTAGE, ProfitMandiConstants.CUTOFF_INVESTMENT));
494
 
505
 
495
                double currentMonthRating = hygieneDataRepository.selectRatingAvg(loginDetails.getFofoId(), DateRangeModel.of(currentMonthStart, currentMonthEnd)) / 2;
506
                double currentMonthRating = hygieneDataRepository.selectRatingAvg(loginDetails.getFofoId(), DateRangeModel.of(currentMonthStart, currentMonthEnd)) / 2;