Subversion Repositories SmartDukaan

Rev

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

Rev 34791 Rev 34852
Line 146... Line 146...
146
import java.time.temporal.ChronoField;
146
import java.time.temporal.ChronoField;
147
import java.time.temporal.ChronoUnit;
147
import java.time.temporal.ChronoUnit;
148
import java.util.*;
148
import java.util.*;
149
import java.util.Map.Entry;
149
import java.util.Map.Entry;
150
import java.util.stream.Collectors;
150
import java.util.stream.Collectors;
-
 
151
import java.util.stream.IntStream;
151
import java.util.stream.Stream;
152
import java.util.stream.Stream;
152
 
153
 
153
import static java.util.stream.Collectors.*;
154
import static java.util.stream.Collectors.*;
154
 
155
 
155
 
156
 
Line 1108... Line 1109...
1108
    }
1109
    }
1109
 
1110
 
1110
 
1111
 
1111
    public void test() throws Exception {
1112
    public void test() throws Exception {
1112
        //System.out.println(tagListingRepository.getModelSchemesByCatalogIdsAndType(175135707, PartnerType.GOLD,Arrays.asList(1024715), LocalDateTime.now()));
1113
        //System.out.println(tagListingRepository.getModelSchemesByCatalogIdsAndType(175135707, PartnerType.GOLD,Arrays.asList(1024715), LocalDateTime.now()));
-
 
1114
        List<Integer> priceDropIds = IntStream.rangeClosed(1396, 1413)
-
 
1115
                .boxed()
-
 
1116
                .collect(Collectors.toList());
-
 
1117
        for (Integer priceDropId : priceDropIds) {
-
 
1118
            System.out.println(priceDropId);
-
 
1119
            PriceDrop priceDrop = priceDropRepository.selectById(priceDropId);
-
 
1120
            System.out.println(priceDrop);
-
 
1121
            priceDropService.processPD(priceDrop);
-
 
1122
        }
-
 
1123
        //System.out.println(partnerTypeChangeService.getTypeOnDate(175139962, LocalDate.of(2025,Month.JULY,28)));
-
 
1124
        //System.out.println(partnerTypeChangeRepository.getRecentChange(175139962, LocalDate.of(2025,Month.JULY,28)));
1113
 
1125
 
1114
        //System.out.println(partnerTypeChangeService.getTypeOnDate(175138843, LocalDate.of(2025,06,30)));
-
 
1115
        //System.out.println(partnerTypeChangeService.getTypeOnDate(175138843, LocalDate.of(2025,06,30).plusDays(1)));
1126
        //System.out.println(partnerTypeChangeService.getTypeOnDate(175138843, LocalDate.of(2025,06,30).plusDays(1)));
1116
        this.rolloutMarginForStoreOnMonth(fofoStoreRepository.selectByRetailerId(175138843), LocalDate.of(2025,6,1));
1127
        //this.rolloutMarginForStoreOnMonth(fofoStoreRepository.selectByRetailerId(175138843), LocalDate.of(2025,6,1));
1117
        //Utils.sendMailWithAttachments( mailSender,"amit.gupta@smartdukaan.com", null, "Hello World!", "Test Mail", null);
1128
        //Utils.sendMailWithAttachments( mailSender,"amit.gupta@smartdukaan.com", null, "Hello World!", "Test Mail", null);
1118
        //sdCreditService.updateRisk();
1129
        //sdCreditService.updateRisk();
1119
        /*PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(175139309,
1130
        /*PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(175139309,
1120
                YearMonth.of(2025, 5).atDay(1));
1131
                YearMonth.of(2025, 5).atDay(1));
1121
        System.out.println(partnerType);
1132
        System.out.println(partnerType);
Line 3749... Line 3760...
3749
    }
3760
    }
3750
 
3761
 
3751
    private static final NavigableMap<Double, Double> discountMap = new TreeMap<>();
3762
    private static final NavigableMap<Double, Double> discountMap = new TreeMap<>();
3752
 
3763
 
3753
    static {
3764
    static {
3754
        discountMap.put(4 * ProfitMandiConstants.ONE_LAC - 1, 0.2);   // Up to 6 -> 20%
3765
        discountMap.put(4 * ProfitMandiConstants.ONE_LAC - 1, 0.2);    // Up to 3,99,999 -> 20%
3755
        discountMap.put(10 * ProfitMandiConstants.ONE_LAC - 1, 0.25);  // 6-10 -> 25%
3766
        discountMap.put(10 * ProfitMandiConstants.ONE_LAC - 1, 0.25);  // 4,00,000 to 9,99,999 -> 25%
3756
        discountMap.put(20 * ProfitMandiConstants.ONE_LAC - 1, 0.3); // Above 10 -> 30%
3767
        discountMap.put(20 * ProfitMandiConstants.ONE_LAC - 1, 0.3);   // 10,00,000 to 19,99,999 -> 30%
3757
        discountMap.put(Double.MAX_VALUE, 0.4); // Above 10 -> 40%
3768
        discountMap.put(Double.MAX_VALUE, 0.4);                        // 20,00,000 and above -> 40%
3758
    }
3769
    }
3759
 
3770
 
3760
    public BigDecimal getSuggestedLimit(double investmentValue) {
3771
    public BigDecimal getSuggestedLimit(double investmentValue) {
3761
        double percentageValue = discountMap.ceilingEntry(investmentValue).getValue();
3772
        double percentageValue = discountMap.ceilingEntry(investmentValue).getValue();
3762
        return this.getSuggestedAmount(investmentValue, percentageValue);
3773
        return this.getSuggestedAmount(investmentValue, percentageValue);