Subversion Repositories SmartDukaan

Rev

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

Rev 35299 Rev 35326
Line 846... Line 846...
846
    public void testInvoiceFormat() throws ProfitMandiBusinessException {
846
    public void testInvoiceFormat() throws ProfitMandiBusinessException {
847
        InvoicePdfModel invoicePdfModel = orderService.getInvoicePdfModel(560280);
847
        InvoicePdfModel invoicePdfModel = orderService.getInvoicePdfModel(560280);
848
        //System.out.println(InvoiceFormatter.buildInvoiceLines(invoicePdfModel, InvoiceFormatter.WIDTH_80MM));
848
        //System.out.println(InvoiceFormatter.buildInvoiceLines(invoicePdfModel, InvoiceFormatter.WIDTH_80MM));
849
    }
849
    }
850
 
850
 
-
 
851
    public void sendTrialExpiry() {
-
 
852
        List<FofoStore> stores = fofoStoreRepository.selectAllTrial();
-
 
853
        List<FofoStore> twoDaysToExpiry = stores.stream().filter(x->x.getTrialEnd().minusDays(2).equals(LocalDate.now())).collect(Collectors.toList());
-
 
854
 
-
 
855
        List<FofoStore> fiveDaysToExpiry = stores.stream().filter(x->x.getTrialEnd().minusDays(5).equals(LocalDate.now())).collect(Collectors.toList());
-
 
856
        List<FofoStore> expiredToday = stores.stream().filter(x->x.getTrialEnd().equals(LocalDate.now())).collect(Collectors.toList());
-
 
857
        List<FofoStore> expired = stores.stream().filter(x->x.getTrialEnd().isAfter(LocalDate.now())).collect(Collectors.toList());
-
 
858
    }
-
 
859
 
851
    /*public void processCashDiscount() throws ProfitMandiBusinessException {
860
    /*public void processCashDiscount() throws ProfitMandiBusinessException {
852
        System.out.println("processing cash discount");
861
        System.out.println("processing cash discount");
853
        List<Loan> loansSettledYesterday = loanRepository.selectLoansSettledOn(LocalDate.now().minusDays(1));
862
        List<Loan> loansSettledYesterday = loanRepository.selectLoansSettledOn(LocalDate.now().minusDays(1));
854
        loansSettledYesterday.addAll(loanRepository.selectLoansSettledOn(LocalDate.now()));
863
        loansSettledYesterday.addAll(loanRepository.selectLoansSettledOn(LocalDate.now()));
855
        Map<Integer, List<Loan>> partnerSettledLoans = loansSettledYesterday.stream().collect(Collectors.groupingBy(x -> x.getFofoId()));
864
        Map<Integer, List<Loan>> partnerSettledLoans = loansSettledYesterday.stream().collect(Collectors.groupingBy(x -> x.getFofoId()));
Line 1150... Line 1159...
1150
 
1159
 
1151
    public void test() throws Exception {
1160
    public void test() throws Exception {
1152
        //System.out.println(trialFormRepository.selectByEmailOrMobile("9990381568"));
1161
        //System.out.println(trialFormRepository.selectByEmailOrMobile("9990381568"));
1153
        /*CreditBlockedExceptionPartner creditBlockedExceptionPartner = creditBlockedExceptionPartnersRepository.select(175139430);
1162
        /*CreditBlockedExceptionPartner creditBlockedExceptionPartner = creditBlockedExceptionPartnersRepository.select(175139430);
1154
        System.out.println(creditBlockedExceptionPartner);*/
1163
        System.out.println(creditBlockedExceptionPartner);*/
1155
 
-
 
-
 
1164
        this.updatePartnerLimit(175139595);
1156
        sdCreditService.resetHardLimit();
1165
        //sdCreditService.resetHardLimit();
1157
        //migrations.migrateSerialInvoiceMap();
1166
        //migrations.migrateSerialInvoiceMap();
1158
        //runOnceTasks.checkRewardsEligibility();
1167
        //runOnceTasks.checkRewardsEligibility();
1159
        //hybridEncryptor.getJwt();
1168
        //hybridEncryptor.getJwt();
1160
        /*System.out.printf("Date|Transaction Id|Serial Number|Sale Amount|Swipe Payout|Discount Payout%n");
1169
        /*System.out.printf("Date|Transaction Id|Serial Number|Sale Amount|Swipe Payout|Discount Payout%n");
1161
        for(int i=0;i<10;i++){
1170
        for(int i=0;i<10;i++){
Line 3745... Line 3754...
3745
 
3754
 
3746
    public void processSidbiDeductions() throws ProfitMandiBusinessException {
3755
    public void processSidbiDeductions() throws ProfitMandiBusinessException {
3747
        //sidbiService.migrateSanctions();
3756
        //sidbiService.migrateSanctions();
3748
        sidbiService.processDeductions();
3757
        sidbiService.processDeductions();
3749
    }
3758
    }
-
 
3759
    public void updatePartnerLimit(int fofoId) throws ProfitMandiBusinessException {
-
 
3760
        LocalDateTime firstBillingDate = transactionRepository.getFirstBillingDate(fofoId);
-
 
3761
 
-
 
3762
        CreditAccount creditAccount = creditAccountRepository.selectByFofoIdAndGateway(fofoId, Gateway.SDDIRECT);
-
 
3763
        long utilizationAmount = sdCreditService.getUtilizationAmount(fofoId);
-
 
3764
        PartnerDailyInvestment partnerDailyInvestment = partnerInvestmentService.getInvestment(fofoId, 0);
-
 
3765
        BigDecimal suggestedAmount = this.getSuggestedAmount(creditAccount, partnerDailyInvestment, utilizationAmount, null);
-
 
3766
        SDCreditRequirement sdCreditRequirement = sdCreditRequirementRepository.selectByFofoId(fofoId);
-
 
3767
 
-
 
3768
        LOGGER.info("suggestedAmount {} ", suggestedAmount);
-
 
3769
 
-
 
3770
        if (sdCreditRequirement == null) {
-
 
3771
            sdCreditRequirement = new SDCreditRequirement();
-
 
3772
            sdCreditRequirement.setFofoId(fofoId);
-
 
3773
            sdCreditRequirement.setCreditDays(15);
-
 
3774
            sdCreditRequirement.setInterestRate(ProfitMandiConstants.NEW_INTEREST_RATE);
-
 
3775
            sdCreditRequirement.setRisk(CreditRisk.HIGH_RISK);
-
 
3776
            sdCreditRequirement.setUtilizedAmount(BigDecimal.ZERO);
-
 
3777
            sdCreditRequirement.setCreateTimestamp(LocalDateTime.now());
-
 
3778
            sdCreditRequirement.setUpdateTimestamp(LocalDateTime.now());
-
 
3779
            sdCreditRequirementRepository.persist(sdCreditRequirement);
-
 
3780
        }
-
 
3781
 
-
 
3782
        CreditRisk creditRisk = sdCreditService.getCurrentRisk(sdCreditRequirement, firstBillingDate);
-
 
3783
 
-
 
3784
        sdCreditRequirement.setRisk(creditRisk);
-
 
3785
        LOGGER.info("Suggested Amount - {}", suggestedAmount);
-
 
3786
        sdCreditRequirement.setSuggestedLimit(suggestedAmount);
-
 
3787
        if (!sdCreditRequirement.isHardLimit()) {
-
 
3788
            sdCreditRequirement.setLimit(suggestedAmount);
-
 
3789
        }
-
 
3790
        BigDecimal utilizedLimit = new BigDecimal(sdCreditService.getUtilizationAmount(fofoId));
3750
 
3791
 
-
 
3792
        BigDecimal availableLimit = sdCreditRequirement.getLimit().subtract(utilizedLimit);
-
 
3793
 
-
 
3794
        LOGGER.info("utilizedLimit {} ", utilizedLimit);
-
 
3795
 
-
 
3796
        LOGGER.info("availableLimit {} ", availableLimit);
-
 
3797
 
-
 
3798
        sdCreditRequirement.setUtilizedAmount(utilizedLimit);
-
 
3799
 
-
 
3800
        sdCreditRequirement.setUpdateTimestamp(LocalDateTime.now());
-
 
3801
 
-
 
3802
        if (creditAccount != null) {
-
 
3803
 
-
 
3804
            creditAccount.setInterestRate(sdCreditRequirement.getInterestRate().floatValue());
-
 
3805
            creditAccount.setSanctionedAmount(sdCreditRequirement.getLimit().floatValue());
-
 
3806
            creditAccount.setAvailableAmount(availableLimit.floatValue());
-
 
3807
            creditAccount.setFreeDays(sdCreditRequirement.getFreeDays());
-
 
3808
            creditAccount.setUpdatedOn(LocalDateTime.now());
-
 
3809
        }
-
 
3810
 
-
 
3811
    }
3751
    public void updatePartnerLimit() throws ProfitMandiBusinessException {
3812
    public void updatePartnerLimit() throws ProfitMandiBusinessException {
3752
        Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
3813
        Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
3753
        Map<Integer, BigDecimal> fofoSidbiLimitMap = sidbiService.getSuggestedLimitMap();
3814
        Map<Integer, BigDecimal> fofoSidbiLimitMap = sidbiService.getSuggestedLimitMap();
3754
        Map<Integer, SDCreditRequirement> sdCreditRequirementMap = sdCreditRequirementRepository.selectAll().stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
3815
        Map<Integer, SDCreditRequirement> sdCreditRequirementMap = sdCreditRequirementRepository.selectAll().stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
3755
        Map<Integer, CreditAccount> creditAccountMap = creditAccountRepository.selectAllByGateways(Arrays.asList(Gateway.SIDBI, Gateway.SDDIRECT))
3816
        Map<Integer, CreditAccount> creditAccountMap = creditAccountRepository.selectAllByGateways(Arrays.asList(Gateway.SIDBI, Gateway.SDDIRECT))