Subversion Repositories SmartDukaan

Rev

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

Rev 33220 Rev 33225
Line 703... Line 703...
703
                .filter(x -> !WalletService.CN_WALLET_REFERENCES.contains(x.getReferenceType())).sorted(Comparator.comparing(UserWalletHistory::getId)).collect(Collectors.toList());
703
                .filter(x -> !WalletService.CN_WALLET_REFERENCES.contains(x.getReferenceType())).sorted(Comparator.comparing(UserWalletHistory::getId)).collect(Collectors.toList());
704
        //LOGGER.info("Data - {}", history.stream().filter(x -> x.getReferenceType().equals(WalletReferenceType.OTHERS)).collect(Collectors.groupingBy(x -> x.getBusinessTimestamp().toLocalDate())));
704
        //LOGGER.info("Data - {}", history.stream().filter(x -> x.getReferenceType().equals(WalletReferenceType.OTHERS)).collect(Collectors.groupingBy(x -> x.getBusinessTimestamp().toLocalDate())));
705
 
705
 
706
        InputStream is = getClass().getClassLoader().getResourceAsStream("account-statement.xlsx");
706
        InputStream is = getClass().getClassLoader().getResourceAsStream("account-statement.xlsx");
707
        CustomRetailer customRetailer = retailerService.getAllFofoRetailers().get(fofoId);
707
        CustomRetailer customRetailer = retailerService.getAllFofoRetailers().get(fofoId);
708
        List<StatementDetailModel> details = orderRepository.selectDetailsBetween(fofoId, startDate, endDate);
708
        List<StatementDetailModel> billedStatementDetails = orderRepository.selectDetailsBetween(fofoId, startDate, endDate);
709
        Map<Integer, Float> openingAmountMap = transactionService.getPendingIndentValueMap(startDate, Optional.of(fofoId));
709
        Map<Integer, Float> openingAmountMap = transactionService.getPendingIndentValueMap(startDate, Optional.of(fofoId));
710
        Map<Integer, Float> closingAmountMap = transactionService.getPendingIndentValueMap(endDate, Optional.of(fofoId));
710
        Map<Integer, Float> closingAmountMap = transactionService.getPendingIndentValueMap(endDate, Optional.of(fofoId));
711
 
711
 
712
        float openingPendingAmount = openingAmountMap.get(fofoId) == null ? 0 : openingAmountMap.get(fofoId);
712
        float openingPendingAmount = openingAmountMap.get(fofoId) == null ? 0 : openingAmountMap.get(fofoId);
713
        float closingPendingAmount = closingAmountMap.get(fofoId) == null ? 0 : closingAmountMap.get(fofoId);
713
        float closingPendingAmount = closingAmountMap.get(fofoId) == null ? 0 : closingAmountMap.get(fofoId);
714
        LOGGER.info("Opening - {}, Closing - {}", openingPendingAmount, closingPendingAmount);
714
        LOGGER.info("Opening - {}, Closing - {}", openingPendingAmount, closingPendingAmount);
715
        ByteArrayOutputStream byteArrayOutputStream = this.populateData(is, openingBalance + openingPendingAmount, closingBalance + closingPendingAmount,
715
        ByteArrayOutputStream byteArrayOutputStream = this.populateData(is, openingBalance + openingPendingAmount, closingBalance + closingPendingAmount,
716
                customRetailer, history, startDate, endDate, details);
716
                customRetailer, history, startDate, endDate, billedStatementDetails);
717
 
717
 
718
        final HttpHeaders headers = new HttpHeaders();
718
        final HttpHeaders headers = new HttpHeaders();
719
        headers.set("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
719
        headers.set("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
720
        headers.set("Content-disposition", "inline; filename=account-statement." + StringUtils.toHyphenatedString(startDate.toLocalDate()) + "-" + StringUtils.toHyphenatedString(endDate.toLocalDate()) + ".xlsx");
720
        headers.set("Content-disposition", "inline; filename=account-statement." + StringUtils.toHyphenatedString(startDate.toLocalDate()) + "-" + StringUtils.toHyphenatedString(endDate.toLocalDate()) + ".xlsx");
721
        headers.setContentLength(byteArrayOutputStream.toByteArray().length);
721
        headers.setContentLength(byteArrayOutputStream.toByteArray().length);