Subversion Repositories SmartDukaan

Rev

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

Rev 33287 Rev 33295
Line 1027... Line 1027...
1027
 
1027
 
1028
    @Autowired
1028
    @Autowired
1029
    InvoiceService invoiceService;
1029
    InvoiceService invoiceService;
1030
 
1030
 
1031
    public void test() throws Exception {
1031
    public void test() throws Exception {
-
 
1032
        CreditAccount   creditAccount = creditAccountRepository.selectByFofoIdAndGateway(175139723, Gateway.SDDIRECT);
-
 
1033
        CurrentPartnerDailyInvestment currentPartnerDailyInvestment  = currentPartnerDailyInvestmentRepository.selectAll().stream().filter(x->x.getFofoId()==175139723).findFirst().get();
-
 
1034
        BigDecimal bigDecimal = this.getSuggestedAmount(creditAccount,currentPartnerDailyInvestment, new ArrayList<>());
-
 
1035
        System.out.println("Amount - " + bigDecimal.toString());
-
 
1036
 
1032
        transactionService.moveOrdersFulfimentWarehouseByBillingWarehouseId(7573);
1037
        //transactionService.moveOrdersFulfimentWarehouseByBillingWarehouseId(7573);
1033
    }
1038
    }
1034
 
1039
 
1035
    public void test3() throws Exception {
1040
    public void test3() throws Exception {
1036
        List<Long> payoutIds = Arrays.asList();
1041
        List<Long> payoutIds = Arrays.asList();
1037
        List<OfferPayout> offerPayouts = offerPayoutRepository.selectAllByIds(payoutIds);
1042
        List<OfferPayout> offerPayouts = offerPayoutRepository.selectAllByIds(payoutIds);
Line 3838... Line 3843...
3838
        for (Entry<Integer, CustomRetailer> customRetailerEntry : customRetailerMap.entrySet()) {
3843
        for (Entry<Integer, CustomRetailer> customRetailerEntry : customRetailerMap.entrySet()) {
3839
            int fofoId = customRetailerEntry.getKey();
3844
            int fofoId = customRetailerEntry.getKey();
3840
            LocalDateTime firstBillingDate = transactionRepository.getFirstBillingDate(fofoId);
3845
            LocalDateTime firstBillingDate = transactionRepository.getFirstBillingDate(fofoId);
3841
 
3846
 
3842
            CreditAccount creditAccount = creditAccountMap.get(fofoId);
3847
            CreditAccount creditAccount = creditAccountMap.get(fofoId);
3843
            if(creditAccount==null) continue;
-
 
3844
 
3848
 
3845
            CurrentPartnerDailyInvestment currentPartnerDailyInvestment = currentPartnerDailyInvestmentMap.get(fofoId);
3849
            CurrentPartnerDailyInvestment currentPartnerDailyInvestment = currentPartnerDailyInvestmentMap.get(fofoId);
3846
            List<FofoSidbiSanction> fofoSidbiSanctions = fofoSidbiSanctionMap.get(fofoId);
3850
            List<FofoSidbiSanction> fofoSidbiSanctions = fofoSidbiSanctionMap.get(fofoId);
3847
            BigDecimal suggestedAmount = this.getSuggestedAmount(creditAccount, currentPartnerDailyInvestment, fofoSidbiSanctions);
3851
            BigDecimal suggestedAmount = this.getSuggestedAmount(creditAccount, currentPartnerDailyInvestment, fofoSidbiSanctions);
3848
            SDCreditRequirement sdCreditRequirement = sdCreditRequirementMap.get(fofoId);
3852
            SDCreditRequirement sdCreditRequirement = sdCreditRequirementMap.get(fofoId);
Line 3894... Line 3898...
3894
 
3898
 
3895
    private BigDecimal getSuggestedAmount(CreditAccount creditAccount, CurrentPartnerDailyInvestment currentPartnerDailyInvestment, List<FofoSidbiSanction> fofoSidbiSanctions) {
3899
    private BigDecimal getSuggestedAmount(CreditAccount creditAccount, CurrentPartnerDailyInvestment currentPartnerDailyInvestment, List<FofoSidbiSanction> fofoSidbiSanctions) {
3896
        BigDecimal suggestedAmount = BigDecimal.ZERO;
3900
        BigDecimal suggestedAmount = BigDecimal.ZERO;
3897
        //1 LAC
3901
        //1 LAC
3898
        double limitValue = 100000;
3902
        double limitValue = 100000;
3899
        if (creditAccount.getGateway().equals(Gateway.SDDIRECT)) {
3903
        if (creditAccount == null || creditAccount.getGateway().equals(Gateway.SDDIRECT)) {
3900
 
3904
 
3901
            if (currentPartnerDailyInvestment != null) {
3905
            if (currentPartnerDailyInvestment != null) {
3902
                suggestedAmount = BigDecimal.valueOf(Math.min(currentPartnerDailyInvestment.getTotalInvestment() * 0.1, limitValue));
3906
                suggestedAmount = BigDecimal.valueOf(Math.min(currentPartnerDailyInvestment.getTotalInvestment() * 0.1, limitValue));
3903
            }
3907
            }
3904
            if (suggestedAmount.doubleValue() < 0) {
3908
            if (suggestedAmount.doubleValue() < 0) {