Subversion Repositories SmartDukaan

Rev

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

Rev 32908 Rev 33010
Line 1381... Line 1381...
1381
        model.addAttribute("startDate", currentDate.minusDays(30).toLocalDate());
1381
        model.addAttribute("startDate", currentDate.minusDays(30).toLocalDate());
1382
        model.addAttribute("endDate", LocalDate.now());
1382
        model.addAttribute("endDate", LocalDate.now());
1383
        model.addAttribute("focoSaleReportList", focoSaleReportList);
1383
        model.addAttribute("focoSaleReportList", focoSaleReportList);
1384
        return "foco-sale-report";
1384
        return "foco-sale-report";
1385
    }
1385
    }
-
 
1386
    @RequestMapping(value = "/franchiseeSalesFetchReportByDate", method = RequestMethod.GET)
-
 
1387
    public String getfranchiseeSalesFetchReport(HttpServletRequest request,
-
 
1388
                                                  @RequestParam(name = "startDate", required = true, defaultValue = "") LocalDate startDate,
-
 
1389
                                                  @RequestParam(name = "endDate", required = true, defaultValue = "") LocalDate endDate, Model model)
-
 
1390
            throws Exception {
-
 
1391
        LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
-
 
1392
 
-
 
1393
        List<List<?>> rows = new ArrayList<>();
-
 
1394
 
-
 
1395
        LocalDateTime currentDate = LocalDate.now().atStartOfDay();
-
 
1396
        FofoStore fs = fofoStoreRepository.selectByRetailerId(fofoDetails.getFofoId());
-
 
1397
        List<FocoSaleReportModel> focoSaleReportList = fofoOrderRepository.selectFocoSaleReport(fofoDetails.getFofoId(),
-
 
1398
                fs.getCode(), startDate.atStartOfDay(), endDate.atStartOfDay());
-
 
1399
        LOGGER.info("focoSaleReportList {}", focoSaleReportList);
-
 
1400
 
-
 
1401
        model.addAttribute("startDate", currentDate.minusDays(30).toLocalDate());
-
 
1402
        model.addAttribute("endDate", LocalDate.now());
-
 
1403
        model.addAttribute("focoSaleReportList", focoSaleReportList);
-
 
1404
        return "foco-sale-report";
-
 
1405
    }
-
 
1406
 
1386
 
1407
 
1387
    @RequestMapping(value = "/downloadFranchiseeSales", method = RequestMethod.GET)
1408
    @RequestMapping(value = "/downloadFranchiseeSales", method = RequestMethod.GET)
1388
    public ResponseEntity<?> getdownloadFranchiseeSales(HttpServletRequest request,
1409
    public ResponseEntity<?> getdownloadFranchiseeSales(HttpServletRequest request,
1389
                                                        @RequestParam(name = "startDate", required = true, defaultValue = "") LocalDate startDate,
1410
                                                        @RequestParam(name = "startDate", required = true, defaultValue = "") LocalDate startDate,
1390
                                                        @RequestParam(name = "endDate", required = true, defaultValue = "") LocalDate endDate, Model model)
1411
                                                        @RequestParam(name = "endDate", required = true, defaultValue = "") LocalDate endDate, Model model)
Line 1536... Line 1557...
1536
 
1557
 
1537
        List<SchemePayoutReportModel> schemePayoutReports = fofoOrderRepository
1558
        List<SchemePayoutReportModel> schemePayoutReports = fofoOrderRepository
1538
                .selectSchemePayoutReport(fofoDetails.getFofoId(), startDate, currentDate);
1559
                .selectSchemePayoutReport(fofoDetails.getFofoId(), startDate, currentDate);
1539
        LOGGER.info("schemePayoutReports {}", schemePayoutReports);
1560
        LOGGER.info("schemePayoutReports {}", schemePayoutReports);
1540
 
1561
 
-
 
1562
 
-
 
1563
 
-
 
1564
       model.addAttribute("startDate", currentDate.minusMonths(3).toLocalDate());
-
 
1565
        model.addAttribute("endDate", LocalDate.now());
-
 
1566
        model.addAttribute("schemePayoutReports", schemePayoutReports);
-
 
1567
 
-
 
1568
        return "scheme-payout-report";
-
 
1569
    }
-
 
1570
    @RequestMapping(value = "/schemePayoutFetchReportByDate", method = RequestMethod.GET)
-
 
1571
    public String getschemePayoutFetchReport(HttpServletRequest request,
-
 
1572
                                            @RequestParam(name = "startDate", required = true, defaultValue = "") LocalDate startDate,
-
 
1573
                                            @RequestParam(name = "endDate", required = true, defaultValue = "") LocalDate endDate, Model model)
-
 
1574
            throws Exception {
-
 
1575
        LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
-
 
1576
 
-
 
1577
        List<List<?>> rows = new ArrayList<>();
-
 
1578
 
-
 
1579
        LocalDateTime currentDate = LocalDate.now().atStartOfDay();
-
 
1580
        List<SchemePayoutReportModel> schemePayoutReports = fofoOrderRepository
-
 
1581
                .selectSchemePayoutReport(fofoDetails.getFofoId(), startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
-
 
1582
        LOGGER.info("schemePayoutReports {}", schemePayoutReports);
-
 
1583
 
1541
        model.addAttribute("startDate", currentDate.minusMonths(3).toLocalDate());
1584
        model.addAttribute("startDate", currentDate.minusMonths(3).toLocalDate());
1542
        model.addAttribute("endDate", LocalDate.now());
1585
        model.addAttribute("endDate", LocalDate.now());
1543
        model.addAttribute("schemePayoutReports", schemePayoutReports);
1586
        model.addAttribute("schemePayoutReports", schemePayoutReports);
1544
 
1587
 
1545
        return "scheme-payout-report";
1588
        return "scheme-payout-report";
1546
    }
1589
    }
1547
 
1590
 
-
 
1591
    @RequestMapping(value = "/offerPayoutReport", method = RequestMethod.GET)
-
 
1592
    public String getOfferPayoutReport(HttpServletRequest request, Model model) throws Exception {
-
 
1593
        LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
-
 
1594
 
-
 
1595
        LocalDateTime currentDate = LocalDate.now().atStartOfDay();
-
 
1596
        LocalDateTime startDate = currentDate.minusMonths(3).toLocalDate().atStartOfDay();
-
 
1597
 
-
 
1598
        List<OfferPayoutDumpReportModel> offerPayoutDumpReports = fofoOrderRepository
-
 
1599
                .selectOfferPayoutDumpReport(fofoDetails.getFofoId(), startDate, currentDate);
-
 
1600
        LOGGER.info("offerPayoutDumpReports {}", offerPayoutDumpReports);
-
 
1601
 
-
 
1602
        model.addAttribute("startDate", currentDate.minusMonths(3).toLocalDate());
-
 
1603
        model.addAttribute("endDate", LocalDate.now());
-
 
1604
        model.addAttribute("offerPayoutDumpReports", offerPayoutDumpReports);
-
 
1605
 
-
 
1606
        return "offer-payout-dump-report";
-
 
1607
    }
-
 
1608
    @RequestMapping(value = "/offerPayoutFetchReportByDate", method = RequestMethod.GET)
-
 
1609
    public String getOfferPayoutFetchReport(HttpServletRequest request,
-
 
1610
                                                       @RequestParam(name = "startDate", required = true, defaultValue = "") LocalDate startDate,
-
 
1611
                                                       @RequestParam(name = "endDate", required = true, defaultValue = "") LocalDate endDate, Model model)
-
 
1612
            throws Exception {
-
 
1613
        LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
-
 
1614
 
-
 
1615
        List<List<?>> rows = new ArrayList<>();
-
 
1616
 
-
 
1617
        LocalDateTime currentDate = LocalDate.now().atStartOfDay();
-
 
1618
        List<OfferPayoutDumpReportModel> offerPayoutDumpReports = fofoOrderRepository
-
 
1619
                .selectOfferPayoutDumpReport(fofoDetails.getFofoId(), startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
-
 
1620
        LOGGER.info("offerPayoutDumpReports {}", offerPayoutDumpReports);
-
 
1621
 
-
 
1622
        model.addAttribute("startDate", currentDate.minusMonths(3).toLocalDate());
-
 
1623
        model.addAttribute("endDate", LocalDate.now());
-
 
1624
        model.addAttribute("offerPayoutDumpReports", offerPayoutDumpReports);
-
 
1625
 
-
 
1626
 
-
 
1627
        return "offer-payout-dump-report";
-
 
1628
    }
-
 
1629
 
-
 
1630
 
1548
    @RequestMapping(value = "/selectPartnerBillingSummaryReport", method = RequestMethod.GET)
1631
    @RequestMapping(value = "/selectPartnerBillingSummaryReport", method = RequestMethod.GET)
1549
    public String getselectPartnerBillingSummaryReport(HttpServletRequest request, Model model) throws Exception {
1632
    public String getselectPartnerBillingSummaryReport(HttpServletRequest request, Model model) throws Exception {
1550
        LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
1633
        LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
1551
 
1634
 
1552
        LocalDateTime currentDate = LocalDate.now().atStartOfDay();
1635
        LocalDateTime currentDate = LocalDate.now().atStartOfDay();
Line 1647... Line 1730...
1647
 
1730
 
1648
        ResponseEntity<?> responseEntity = orderService.downloadReportInCsv(baos, rows, "Billing Statement Report");
1731
        ResponseEntity<?> responseEntity = orderService.downloadReportInCsv(baos, rows, "Billing Statement Report");
1649
 
1732
 
1650
        return responseEntity;
1733
        return responseEntity;
1651
 
1734
 
-
 
1735
 
1652
    }
1736
    }
1653
 
1737
 
1654
    @RequestMapping(value = "/invoiceSchemeOutSummaryReport", method = RequestMethod.GET)
1738
    @RequestMapping(value = "/invoiceSchemeOutSummaryReport", method = RequestMethod.GET)
1655
    public String getInvoiceSchemeOutSummaryReport(HttpServletRequest request, Model model) throws Exception {
1739
    public String getInvoiceSchemeOutSummaryReport(HttpServletRequest request, Model model) throws Exception {
1656
        LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
1740
        LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
Line 1696... Line 1780...
1696
                "invoice wise scheme out Summary Report");
1780
                "invoice wise scheme out Summary Report");
1697
 
1781
 
1698
        return responseEntity;
1782
        return responseEntity;
1699
    }
1783
    }
1700
 
1784
 
1701
    @RequestMapping(value = "/schemePayoutReportDownload", method = RequestMethod.GET)
1785
   @RequestMapping(value = "/schemePayoutReportDownload", method = RequestMethod.GET)
1702
    public ResponseEntity<?> getSchemePayoutReportDownload(HttpServletRequest request,
1786
    public ResponseEntity<?> getSchemePayoutReportDownload(HttpServletRequest request,
1703
                                                           @RequestParam(name = "startDate", required = true, defaultValue = "") LocalDate startDate,
1787
                                                           @RequestParam(name = "startDate", required = true, defaultValue = "") LocalDate startDate,
1704
                                                           @RequestParam(name = "endDate", required = true, defaultValue = "") LocalDate endDate, Model model)
1788
                                                           @RequestParam(name = "endDate", required = true, defaultValue = "") LocalDate endDate, Model model)
1705
            throws Exception {
1789
            throws Exception {
1706
        LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
1790
        LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
1707
 
1791
 
1708
        List<List<?>> rows = new ArrayList<>();
1792
        List<List<?>> rows = new ArrayList<>();
1709
        LocalDateTime currentDate = LocalDate.now().atStartOfDay();
-
 
1710
        LocalDateTime currentStartMonth = currentDate.minusMonths(3).toLocalDate().atStartOfDay();
-
 
-
 
1793
 
1711
 
1794
 
1712
        List<SchemePayoutReportModel> schemePayoutReports = fofoOrderRepository
1795
        List<SchemePayoutReportModel> schemePayoutReports = fofoOrderRepository
1713
                .selectSchemePayoutReport(fofoDetails.getFofoId(), currentStartMonth, currentDate);
1796
                .selectSchemePayoutReport(fofoDetails.getFofoId(), startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
1714
        LOGGER.info("schemePayoutReports {}", schemePayoutReports);
1797
        LOGGER.info("schemePayoutReports {}", schemePayoutReports);
1715
 
1798
 
1716
        for (SchemePayoutReportModel spr : schemePayoutReports) {
1799
        for (SchemePayoutReportModel spr : schemePayoutReports) {
1717
 
1800
 
1718
            rows.add(Arrays.asList(spr.getId(), spr.getSerialNumber(), spr.getBrand(), spr.getModelName(),
1801
            rows.add(Arrays.asList(spr.getId(), spr.getSerialNumber(), spr.getBrand(), spr.getModelName(),
Line 1730... Line 1813...
1730
        ResponseEntity<?> responseEntity = orderService.downloadReportInCsv(baos, rows, "Scheme Payout Summary Report");
1813
        ResponseEntity<?> responseEntity = orderService.downloadReportInCsv(baos, rows, "Scheme Payout Summary Report");
1731
 
1814
 
1732
        return responseEntity;
1815
        return responseEntity;
1733
    }
1816
    }
1734
 
1817
 
-
 
1818
 
-
 
1819
 
-
 
1820
    @RequestMapping(value = "/offerPayoutDumpReportDownload", method = RequestMethod.GET)
-
 
1821
    public ResponseEntity<?> getOfferPayoutDumpReportDownload(HttpServletRequest request,
-
 
1822
                                                           @RequestParam(name = "startDate", required = true, defaultValue = "") LocalDate startDate,
-
 
1823
                                                           @RequestParam(name = "endDate", required = true, defaultValue = "") LocalDate endDate, Model model)
-
 
1824
            throws Exception {
-
 
1825
        LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
-
 
1826
 
-
 
1827
        List<List<?>> rows = new ArrayList<>();
-
 
1828
 
-
 
1829
 
-
 
1830
        List<OfferPayoutDumpReportModel> offerPayoutReports = fofoOrderRepository
-
 
1831
                .selectOfferPayoutDumpReport(fofoDetails.getFofoId(), startDate.atStartOfDay(), endDate.atTime(LocalTime.MAX));
-
 
1832
 
-
 
1833
 
-
 
1834
        for (OfferPayoutDumpReportModel opdr : offerPayoutReports) {
-
 
1835
 
-
 
1836
            rows.add(Arrays.asList(opdr.getId(),  opdr.getBrand(), opdr.getModelName(),
-
 
1837
                    opdr.getModelNumber(), opdr.getColor(), opdr.getSerialNumber(), opdr.getOfferId(),
-
 
1838
                    opdr.getName(), opdr.getType(),
-
 
1839
                    opdr.getSlabAmount(), opdr.getAmount(),opdr.getDescription(),
-
 
1840
                    opdr.getCreateTimestamp(), opdr.getRejectTimestamp()));
-
 
1841
 
-
 
1842
        }
-
 
1843
        org.apache.commons.io.output.ByteArrayOutputStream baos = FileUtil.getCSVByteStream(Arrays.asList("Id",
-
 
1844
                "Brand", "Model Name", "Model Number", "Color","Serial number",
-
 
1845
                "Offer Id", "Name", "Type", "Slab Amount","Amount",
-
 
1846
                "Description", "Credited On", "Rejected On"), rows);
-
 
1847
 
-
 
1848
        ResponseEntity<?> responseEntity = orderService.downloadReportInCsv(baos, rows, "Offer Payout Summary Report");
-
 
1849
 
-
 
1850
        return responseEntity;
-
 
1851
    }
-
 
1852
 
-
 
1853
 
-
 
1854
 
-
 
1855
 
1735
    @GetMapping("/getAllOnlineOrder")
1856
    @GetMapping("/getAllOnlineOrder")
1736
    public String getAllOrders(HttpServletRequest request, @RequestParam(required = false) LocalDate date, Model model)
1857
    public String getAllOrders(HttpServletRequest request, @RequestParam(required = false) LocalDate date, Model model)
1737
            throws ProfitMandiBusinessException {
1858
            throws ProfitMandiBusinessException {
1738
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1859
        LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
1739
        boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());
1860
        boolean isAdmin = roleManager.isAdmin(loginDetails.getRoleIds());