Subversion Repositories SmartDukaan

Rev

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

Rev 34181 Rev 34388
Line 44... Line 44...
44
import com.spice.profitmandi.service.SshServer.SSHService;
44
import com.spice.profitmandi.service.SshServer.SSHService;
45
import com.spice.profitmandi.service.authentication.RoleManager;
45
import com.spice.profitmandi.service.authentication.RoleManager;
46
import com.spice.profitmandi.service.catalog.BrandsService;
46
import com.spice.profitmandi.service.catalog.BrandsService;
47
import com.spice.profitmandi.service.integrations.psismart.PsiSmartService;
47
import com.spice.profitmandi.service.integrations.psismart.PsiSmartService;
48
import com.spice.profitmandi.service.inventory.InventoryService;
48
import com.spice.profitmandi.service.inventory.InventoryService;
49
import com.spice.profitmandi.service.offers.ItemCriteria;
-
 
50
import com.spice.profitmandi.service.offers.OfferService;
49
import com.spice.profitmandi.service.offers.OfferService;
51
import com.spice.profitmandi.service.scheme.SchemeService;
50
import com.spice.profitmandi.service.scheme.SchemeService;
52
import com.spice.profitmandi.service.transaction.TransactionService;
51
import com.spice.profitmandi.service.transaction.TransactionService;
53
import com.spice.profitmandi.service.user.RetailerService;
52
import com.spice.profitmandi.service.user.RetailerService;
54
import com.spice.profitmandi.web.model.LoginDetails;
53
import com.spice.profitmandi.web.model.LoginDetails;
Line 481... Line 480...
481
                model.addAttribute("staticScheme", staticScheme);
480
                model.addAttribute("staticScheme", staticScheme);
482
                model.addAttribute("schemeCategory", schemeCategory);
481
                model.addAttribute("schemeCategory", schemeCategory);
483
                model.addAttribute("schemeAchievement", schemeAchievement);
482
                model.addAttribute("schemeAchievement", schemeAchievement);
484
                model.addAttribute("brandStockPrices", fofoUser.getBrandStockPrices(loginDetails.getFofoId(), false));
483
                model.addAttribute("brandStockPrices", fofoUser.getBrandStockPrices(loginDetails.getFofoId(), false));
485
                model.addAttribute("salesMap", fofoUser.getSales(loginDetails.getFofoId()));
484
                model.addAttribute("salesMap", fofoUser.getSales(loginDetails.getFofoId()));
486
                ChartModel cm = fofoUser.getBrandChart(loginDetails.getFofoId());
485
                ChartModel cm = fofoUser.getBrandChart(loginDetails.getFofoId(),null,null,false);
487
 
486
 
488
                LOGGER.info("chartMap" + gson.toJson(cm));
487
                LOGGER.info("chartMap" + gson.toJson(cm));
489
                model.addAttribute("chartMap", gson.toJson(cm));
488
                model.addAttribute("chartMap", gson.toJson(cm));
490
 
489
 
491
                List<CreateOfferRequest> publishedOffers = offerService.getPublishedOffers(loginDetails.getFofoId(), YearMonth.from(LocalDateTime.now()));
490
                List<CreateOfferRequest> publishedOffers = offerService.getPublishedOffers(loginDetails.getFofoId(), YearMonth.from(LocalDateTime.now()));
Line 780... Line 779...
780
 
779
 
781
        return "purchase_chart";
780
        return "purchase_chart";
782
    }
781
    }
783
 
782
 
784
    @RequestMapping(value = "/getBarChart", method = RequestMethod.GET)
783
    @RequestMapping(value = "/getBarChart", method = RequestMethod.GET)
785
    public String getBarChart(HttpServletRequest request, Model model) throws Exception {
784
    public String getBarChart(HttpServletRequest request, @RequestParam(required = false) LocalDate from, @RequestParam(required = false) LocalDate to,@RequestParam(required = false) Boolean isQuantity ,Model model) throws Exception {
786
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
785
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
787
        int fofoId = loginDetails.getFofoId();
786
        int fofoId = loginDetails.getFofoId();
-
 
787
        LocalDateTime curDate = from == null ? LocalDate.now().atStartOfDay().withDayOfMonth(1) : from.atStartOfDay();
-
 
788
        LocalDateTime lastDate = to == null ? LocalDate.now().atStartOfDay().with(LocalTime.MAX) : to.atStartOfDay();
-
 
789
        isQuantity = isQuantity==null?false:isQuantity;
788
        ChartModel cm = fofoUser.getBrandChart(fofoId);
790
        ChartModel cm = fofoUser.getBrandChart(fofoId, from, to,isQuantity);
789
 
-
 
-
 
791
        LOGGER.info("from" + curDate);
-
 
792
        LOGGER.info("to" + lastDate);
790
        LOGGER.info("chartMap" + gson.toJson(cm));
793
        LOGGER.info("chartMap" + gson.toJson(cm));
791
        model.addAttribute("chartMap", gson.toJson(cm));
794
        model.addAttribute("chartMap", gson.toJson(cm));
792
 
-
 
-
 
795
        model.addAttribute("from", curDate.toLocalDate());
-
 
796
        model.addAttribute("to", lastDate.toLocalDate());
-
 
797
        model.addAttribute("fofoId", fofoId);
-
 
798
        model.addAttribute("isQuantity",isQuantity);
793
        return "bar_chart";
799
        return "bar_chart";
794
    }
800
    }
795
 
801
 
-
 
802
    @GetMapping(value = "/brandWiseFofoSaleData")
-
 
803
    public String getBarChartModelWise(HttpServletRequest request,
-
 
804
                                       @RequestParam LocalDate from,
-
 
805
                                       @RequestParam LocalDate to,
-
 
806
                                       @RequestParam String brand,
-
 
807
                                       @RequestParam boolean isQuantity,
-
 
808
                                       @RequestParam int fofoId, Model model) throws Exception {
-
 
809
        ChartModel cm = fofoUser.getModelBrandChart(fofoId, brand, from, to,isQuantity);
-
 
810
 
-
 
811
        LOGGER.info("chartMap" + gson.toJson(cm));
-
 
812
 
-
 
813
        model.addAttribute("chartMap", gson.toJson(cm));
-
 
814
        return "bar_chart_model_wise";
-
 
815
    }
-
 
816
 
796
    @RequestMapping(value = "/getPriceDropDetails", method = RequestMethod.GET)
817
    @RequestMapping(value = "/getPriceDropDetails", method = RequestMethod.GET)
797
    public String getPriceDropDetails(HttpServletRequest request,
818
    public String getPriceDropDetails(HttpServletRequest request,
798
                                      @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
819
                                      @RequestParam(name = "fofoId", required = true, defaultValue = "0") int fofoId,
799
                                      @RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
820
                                      @RequestParam(name = "brand", required = true, defaultValue = "0") String brand,
800
                                      @RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model) throws
821
                                      @RequestParam(name = "yearMonth", required = false, defaultValue = "0") String yearMonth, Model model) throws