Subversion Repositories SmartDukaan

Rev

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

Rev 34261 Rev 34435
Line 613... Line 613...
613
    }
613
    }
614
 
614
 
615
    @RequestMapping(value = "/wallet/statement", method = RequestMethod.GET)
615
    @RequestMapping(value = "/wallet/statement", method = RequestMethod.GET)
616
    public String getWalletStatement(HttpServletRequest request, @RequestParam LocalDateTime startDate, @RequestParam LocalDateTime endDate, Model model, @RequestParam(defaultValue = "0") int fofoId) throws Exception {
616
    public String getWalletStatement(HttpServletRequest request, @RequestParam LocalDateTime startDate, @RequestParam LocalDateTime endDate, Model model, @RequestParam(defaultValue = "0") int fofoId) throws Exception {
617
        boolean isAdmin = roleManager.isAdmin(cookiesProcessor.getCookiesObject(request).getRoleIds());
617
        boolean isAdmin = roleManager.isAdmin(cookiesProcessor.getCookiesObject(request).getRoleIds());
618
        if (fofoId > 0) {
618
//        if (fofoId > 0) {
619
            if (!isAdmin) {
619
//            if (!isAdmin) {
620
                throw new ProfitMandiBusinessException("Unauthorised access", "PartnerId", "Permission Denied");
620
//                throw new ProfitMandiBusinessException("Unauthorised access", "PartnerId", "Permission Denied");
621
            }
621
//            }
622
        } else {
622
//        } else {
623
            fofoId = cookiesProcessor.getCookiesObject(request).getFofoId();
623
//            fofoId = cookiesProcessor.getCookiesObject(request).getFofoId();
624
        }
624
//        }
-
 
625
        fofoId = cookiesProcessor.getCookiesObject(request).getFofoId();
625
        float openingBalance = walletService.getOpeningTill(fofoId, startDate);
626
        float openingBalance = walletService.getOpeningTill(fofoId, startDate);
626
        float closingBalance = walletService.getOpeningTill(fofoId, endDate);
627
        float closingBalance = walletService.getOpeningTill(fofoId, endDate);
627
        List<UserWalletHistory> uwhList = walletService.getPaginatedUserWalletHistoryByRetailerId(fofoId, startDate, endDate, 0, 0);
628
        List<UserWalletHistory> uwhList = walletService.getPaginatedUserWalletHistoryByRetailerId(fofoId, startDate, endDate, 0, 0);
628
        Collections.reverse(uwhList);
629
        Collections.reverse(uwhList);
629
        model.addAttribute("opening", openingBalance);
630
        model.addAttribute("opening", openingBalance);
Line 730... Line 731...
730
    }
731
    }
731
 
732
 
732
    @RequestMapping(value = "/account/statement", method = RequestMethod.GET)
733
    @RequestMapping(value = "/account/statement", method = RequestMethod.GET)
733
    public ResponseEntity<?> getAccountStatement(HttpServletRequest request, @RequestParam LocalDateTime startDate, @RequestParam LocalDateTime endDate, Model model, @RequestParam(defaultValue = "0") int fofoId) throws Exception {
734
    public ResponseEntity<?> getAccountStatement(HttpServletRequest request, @RequestParam LocalDateTime startDate, @RequestParam LocalDateTime endDate, Model model, @RequestParam(defaultValue = "0") int fofoId) throws Exception {
734
        boolean isAdmin = roleManager.isAdmin(cookiesProcessor.getCookiesObject(request).getRoleIds());
735
        boolean isAdmin = roleManager.isAdmin(cookiesProcessor.getCookiesObject(request).getRoleIds());
735
        if (fofoId > 0) {
736
//        if (fofoId > 0) {
736
            if (!isAdmin) {
737
//            if (!isAdmin) {
737
                throw new ProfitMandiBusinessException("Unauthorised access", "PartnerId", "Permission Denied");
738
//                throw new ProfitMandiBusinessException("Unauthorised access", "PartnerId", "Permission Denied");
738
            }
739
//            }
739
        } else {
740
//        } else {
740
            fofoId = cookiesProcessor.getCookiesObject(request).getFofoId();
741
//            fofoId = cookiesProcessor.getCookiesObject(request).getFofoId();
741
        }
742
//        }
-
 
743
        fofoId = cookiesProcessor.getCookiesObject(request).getFofoId();
742
        float openingBalance = walletService.getOpeningTill(fofoId, startDate);
744
        float openingBalance = walletService.getOpeningTill(fofoId, startDate);
743
        float closingBalance = walletService.getOpeningTill(fofoId, endDate);
745
        float closingBalance = walletService.getOpeningTill(fofoId, endDate);
744
        UserWallet uw = walletService.getUserWallet(fofoId);
746
        UserWallet uw = walletService.getUserWallet(fofoId);
745
        LOGGER.info("Start date - {}, end Date - {}", startDate, endDate);
747
        LOGGER.info("Start date - {}, end Date - {}", startDate, endDate);
746
        List<UserWalletHistory> history = userWalletHistoryRepository.selectPaginatedByWalletId(uw.getId(), startDate, endDate, 0, 0);
748
        List<UserWalletHistory> history = userWalletHistoryRepository.selectPaginatedByWalletId(uw.getId(), startDate, endDate, 0, 0);