Subversion Repositories SmartDukaan

Rev

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

Rev 33810 Rev 33817
Line 32... Line 32...
32
import com.spice.profitmandi.dao.entity.dtr.*;
32
import com.spice.profitmandi.dao.entity.dtr.*;
33
import com.spice.profitmandi.dao.entity.fofo.*;
33
import com.spice.profitmandi.dao.entity.fofo.*;
34
import com.spice.profitmandi.dao.entity.inventory.*;
34
import com.spice.profitmandi.dao.entity.inventory.*;
35
import com.spice.profitmandi.dao.entity.logistics.AST;
35
import com.spice.profitmandi.dao.entity.logistics.AST;
36
import com.spice.profitmandi.dao.entity.logistics.ASTRepository;
36
import com.spice.profitmandi.dao.entity.logistics.ASTRepository;
-
 
37
import com.spice.profitmandi.dao.entity.logistics.WarehouseProvider;
37
import com.spice.profitmandi.dao.entity.transaction.*;
38
import com.spice.profitmandi.dao.entity.transaction.*;
38
import com.spice.profitmandi.dao.entity.user.*;
39
import com.spice.profitmandi.dao.entity.user.*;
39
import com.spice.profitmandi.dao.entity.warehouse.WarehouseInventoryItem;
40
import com.spice.profitmandi.dao.entity.warehouse.WarehouseInventoryItem;
40
import com.spice.profitmandi.dao.entity.warehouse.WarehouseScan;
41
import com.spice.profitmandi.dao.entity.warehouse.WarehouseScan;
41
import com.spice.profitmandi.dao.enumuration.auth.CollectionRemark;
42
import com.spice.profitmandi.dao.enumuration.auth.CollectionRemark;
Line 62... Line 63...
62
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
63
import com.spice.profitmandi.dao.repository.cs.PositionRepository;
63
import com.spice.profitmandi.dao.repository.cs.TicketRepository;
64
import com.spice.profitmandi.dao.repository.cs.TicketRepository;
64
import com.spice.profitmandi.dao.repository.dtr.*;
65
import com.spice.profitmandi.dao.repository.dtr.*;
65
import com.spice.profitmandi.dao.repository.fofo.*;
66
import com.spice.profitmandi.dao.repository.fofo.*;
66
import com.spice.profitmandi.dao.repository.inventory.*;
67
import com.spice.profitmandi.dao.repository.inventory.*;
-
 
68
import com.spice.profitmandi.dao.repository.logistics.WarehouseProviderRepository;
67
import com.spice.profitmandi.dao.repository.transaction.*;
69
import com.spice.profitmandi.dao.repository.transaction.*;
68
import com.spice.profitmandi.dao.repository.user.AddressRepository;
70
import com.spice.profitmandi.dao.repository.user.AddressRepository;
69
import com.spice.profitmandi.dao.repository.user.UserRepository;
71
import com.spice.profitmandi.dao.repository.user.UserRepository;
70
import com.spice.profitmandi.dao.repository.warehouse.*;
72
import com.spice.profitmandi.dao.repository.warehouse.*;
71
import com.spice.profitmandi.dao.service.SidbiService;
73
import com.spice.profitmandi.dao.service.SidbiService;
Line 75... Line 77...
75
import com.spice.profitmandi.service.*;
77
import com.spice.profitmandi.service.*;
76
import com.spice.profitmandi.service.integrations.CCAvenuePaymentService;
78
import com.spice.profitmandi.service.integrations.CCAvenuePaymentService;
77
import com.spice.profitmandi.service.integrations.RazorpayPaymentService;
79
import com.spice.profitmandi.service.integrations.RazorpayPaymentService;
78
import com.spice.profitmandi.service.integrations.bharti.model.BAGInsuranceModel;
80
import com.spice.profitmandi.service.integrations.bharti.model.BAGInsuranceModel;
79
import com.spice.profitmandi.service.integrations.gstpro.GstProAuthService;
81
import com.spice.profitmandi.service.integrations.gstpro.GstProAuthService;
-
 
82
import com.spice.profitmandi.service.integrations.gstpro.GstProService;
-
 
83
import com.spice.profitmandi.service.integrations.gstpro.api.model.E_InvoiceCommon;
80
import com.spice.profitmandi.service.integrations.psismart.PsiSmartService;
84
import com.spice.profitmandi.service.integrations.psismart.PsiSmartService;
81
import com.spice.profitmandi.service.integrations.smartping.SmartPingService;
85
import com.spice.profitmandi.service.integrations.smartping.SmartPingService;
82
import com.spice.profitmandi.service.integrations.toffee.ToffeeService;
86
import com.spice.profitmandi.service.integrations.toffee.ToffeeService;
83
import com.spice.profitmandi.service.inventory.*;
87
import com.spice.profitmandi.service.inventory.*;
84
import com.spice.profitmandi.service.offers.OfferService;
88
import com.spice.profitmandi.service.offers.OfferService;
Line 1038... Line 1042...
1038
    RedisCacheManager redisFortnightlyCacheManage;
1042
    RedisCacheManager redisFortnightlyCacheManage;
1039
 
1043
 
1040
    @Autowired
1044
    @Autowired
1041
    GstProAuthService gstProAuthService;
1045
    GstProAuthService gstProAuthService;
1042
 
1046
 
-
 
1047
    @Autowired
-
 
1048
    GstProService gstProService;
-
 
1049
 
-
 
1050
    @Autowired
-
 
1051
    WarehouseProviderRepository warehouseProviderRepository;
1043
    public void test() throws Exception {
1052
    public void test() throws Exception {
1044
        List<SDCreditRequirement> sdCreditRequirements = sdCreditRequirementRepository.selectAll();
1053
        List<SDCreditRequirement> sdCreditRequirements = sdCreditRequirementRepository.selectAll();
1045
        for (SDCreditRequirement sdCreditRequirement : sdCreditRequirements) {
1054
        /*for (SDCreditRequirement sdCreditRequirement : sdCreditRequirements) {
1046
            long utilizationAmount = sdCreditService.getUtilizationAmount(sdCreditRequirement.getFofoId());
1055
            long utilizationAmount = sdCreditService.getUtilizationAmount(sdCreditRequirement.getFofoId());
1047
            if (Math.abs(sdCreditRequirement.getUtilizedAmount().doubleValue() - utilizationAmount) > 5) {
1056
            if (Math.abs(sdCreditRequirement.getUtilizedAmount().doubleValue() - utilizationAmount) > 5) {
1048
                sdCreditRequirement.setUtilizedAmount(BigDecimal.valueOf(utilizationAmount));
1057
                sdCreditRequirement.setUtilizedAmount(BigDecimal.valueOf(utilizationAmount));
1049
            }
1058
            }
1050
 
1059
 
-
 
1060
        }*/
-
 
1061
        //warehouseProviderRepository.selectAllByWarehouseId(1);
-
 
1062
        /*String sellerGstin = GstProService.SANDBOX_GST_NUMBER;
-
 
1063
        E_InvoiceCommon.RespAuthPl respAuthPl = gstProAuthService.getAuthToken(sellerGstin);
-
 
1064
        if (LocalDateTime.now().isAfter(respAuthPl.getData().TokenExpiry)) {
-
 
1065
            redisFortnightlyCacheManage.getCache("gstAuthToken").evict(sellerGstin);
-
 
1066
            respAuthPl = gstProAuthService.getAuthToken(sellerGstin);
1051
        }
1067
        }
-
 
1068
        Map<String, String> authMap = gstProAuthService.getAuthHeaders(sellerGstin);
-
 
1069
        String authToken = respAuthPl.getData().getAuthToken();
-
 
1070
        authMap.put("AuthToken", authToken);
-
 
1071
        authMap.put("QrCodeSize", "250");
-
 
1072
        authMap.put("ParseIrnResp", "1");
-
 
1073
        authMap.put("Content-Type", "application/json; charset=utf-8");
-
 
1074
        authMap.put("AuthToken", authToken);
-
 
1075
        authMap.put("QrCodeSize", "250");
-
 
1076
        authMap.put("ParseIrnResp", "1");
-
 
1077
        authMap.put("Content-Type", "application/json; charset=utf-8");
-
 
1078
 
-
 
1079
        System.out.println(gstProService.getEInvoiceByIrn(authMap, "5d95f5759fdfe48aeb86a7605727f37fc472d779a0f7bfbff98669e06dfd5ab2"));*/
-
 
1080
 
-
 
1081
        //List<Loan> loans = loanRepository.selectAllLoan();
-
 
1082
 
-
 
1083
        /*System.out.println(ageingService.getAllAgeingForWarehouseBilling(8718, Arrays.asList(34354)));
-
 
1084
        System.out.println(ageingService.getAllAgeingForWarehouseBilling(8646, Arrays.asList(36323)));
-
 
1085
        System.out.println(ageingService.getAllAgeingForWarehouseBilling(8954, Arrays.asList(34358)));*/
-
 
1086
        System.out.println(ageingService.getAgeingForWarehouseBilling(8718, Arrays.asList(new ItemIdQuantity(34354,10))));
1052
    }
1087
    }
1053
 
1088
 
1054
    public void test4() throws Exception {
1089
    public void test4() throws Exception {
1055
        List<Integer> offerIds = Arrays.asList(2882, 2881, 2880, 2879, 2878, 2877, 2876, 2875, 2874, 2873, 2872, 2871, 2870, 2869, 2868, 2867, 2866, 2865, 2864, 2863, 2862, 2861, 2860, 2859, 2858, 2857, 2856, 2855, 2854, 2853, 2852, 2851, 2850, 2849, 2847, 2846, 2845, 2844, 2843, 2842, 2841, 2840, 2839, 2838, 2837, 2836, 2835, 2834, 2833, 2832, 2831, 2830, 2829, 2828, 2827, 2826, 2825, 2824, 2823, 2822, 2821, 2820, 2819, 2818, 2817, 2816, 2815, 2814, 2813, 2812, 2811, 2810, 2809, 2808, 2807, 2806, 2805, 2804, 2803, 2802, 2801, 2800, 2799, 2798, 2797, 2796, 2795, 2794, 2793, 2792, 2791, 2790, 2789, 2788, 2787, 2786, 2785, 2784, 2783, 2782, 2781, 2780, 2777, 2776, 2775, 2774, 2773, 2772, 2771, 2770, 2769, 2768, 2767, 2766, 2765, 2764, 2763, 2762, 2761, 2760, 2759, 2758, 2757, 2756, 2755, 2754, 2753, 2752, 2751, 2750, 2749, 2748, 2747, 2746, 2745, 2744, 2723, 2722, 2721, 2720, 2719, 2718, 2717, 2716, 2715, 2714, 2713, 2712, 2711, 2710, 2709, 2708, 2707, 2706, 2705, 2704, 2703, 2702, 2701, 2700, 2699, 2698, 2697, 2696, 2695, 2694, 2693, 2692, 2691, 2690, 2494, 2493, 2492, 2491, 2490, 2489, 2488, 2487, 2486, 2485, 2484, 2483, 2482, 2481, 2480, 2479, 2478, 2477, 2476, 2475, 2474, 2473, 2472, 2471, 2470, 2469, 2466, 2465, 2464, 2463, 2462, 2461, 2460, 2459, 2458, 2457, 2456, 2455, 2454, 2453, 2452, 2451, 2450, 2449, 2448, 2447, 2446, 2445, 2444, 2443, 2442, 2441, 2440, 2439, 2407, 2406, 2405, 2404, 2403, 2402, 2401, 2400, 2399, 2398, 2397, 2396, 2395, 2394, 2393, 2392, 2391, 2390, 2389, 2388, 2387, 2386, 2385, 2384, 2383, 2382, 2381, 2117, 2116, 2115, 2114, 2113, 2112, 2111, 2110, 2109, 2108, 2107, 2106, 2105, 2104, 2103, 2102, 2101, 2100, 2099, 2098, 2077);
1090
        List<Integer> offerIds = Arrays.asList(2882, 2881, 2880, 2879, 2878, 2877, 2876, 2875, 2874, 2873, 2872, 2871, 2870, 2869, 2868, 2867, 2866, 2865, 2864, 2863, 2862, 2861, 2860, 2859, 2858, 2857, 2856, 2855, 2854, 2853, 2852, 2851, 2850, 2849, 2847, 2846, 2845, 2844, 2843, 2842, 2841, 2840, 2839, 2838, 2837, 2836, 2835, 2834, 2833, 2832, 2831, 2830, 2829, 2828, 2827, 2826, 2825, 2824, 2823, 2822, 2821, 2820, 2819, 2818, 2817, 2816, 2815, 2814, 2813, 2812, 2811, 2810, 2809, 2808, 2807, 2806, 2805, 2804, 2803, 2802, 2801, 2800, 2799, 2798, 2797, 2796, 2795, 2794, 2793, 2792, 2791, 2790, 2789, 2788, 2787, 2786, 2785, 2784, 2783, 2782, 2781, 2780, 2777, 2776, 2775, 2774, 2773, 2772, 2771, 2770, 2769, 2768, 2767, 2766, 2765, 2764, 2763, 2762, 2761, 2760, 2759, 2758, 2757, 2756, 2755, 2754, 2753, 2752, 2751, 2750, 2749, 2748, 2747, 2746, 2745, 2744, 2723, 2722, 2721, 2720, 2719, 2718, 2717, 2716, 2715, 2714, 2713, 2712, 2711, 2710, 2709, 2708, 2707, 2706, 2705, 2704, 2703, 2702, 2701, 2700, 2699, 2698, 2697, 2696, 2695, 2694, 2693, 2692, 2691, 2690, 2494, 2493, 2492, 2491, 2490, 2489, 2488, 2487, 2486, 2485, 2484, 2483, 2482, 2481, 2480, 2479, 2478, 2477, 2476, 2475, 2474, 2473, 2472, 2471, 2470, 2469, 2466, 2465, 2464, 2463, 2462, 2461, 2460, 2459, 2458, 2457, 2456, 2455, 2454, 2453, 2452, 2451, 2450, 2449, 2448, 2447, 2446, 2445, 2444, 2443, 2442, 2441, 2440, 2439, 2407, 2406, 2405, 2404, 2403, 2402, 2401, 2400, 2399, 2398, 2397, 2396, 2395, 2394, 2393, 2392, 2391, 2390, 2389, 2388, 2387, 2386, 2385, 2384, 2383, 2382, 2381, 2117, 2116, 2115, 2114, 2113, 2112, 2111, 2110, 2109, 2108, 2107, 2106, 2105, 2104, 2103, 2102, 2101, 2100, 2099, 2098, 2077);
1056
        for (Integer offerId : offerIds) {
1091
        for (Integer offerId : offerIds) {
Line 1441... Line 1476...
1441
                }
1476
                }
1442
            }
1477
            }
1443
        }
1478
        }
1444
    }
1479
    }
1445
 
1480
 
1446
    public void test2() throws Exception {
-
 
1447
        System.out.println("Starting test");
-
 
1448
        processScheme(LocalDate.of(2023, 05, 06).atStartOfDay(), LocalDate.of(2023, 05, 9).atStartOfDay(), false);
-
 
1449
        /*partnerTypeChangeService.getTypeOnDate(175139287, LocalDate.of(2023,02, 01));
-
 
1450
        partnerTypeChangeService.getTypeOnDate(175139287, LocalDate.of(2023,03, 01));
-
 
1451
        partnerTypeChangeService.getTypeOnDate(175139287, LocalDate.of(2023,04, 01));
-
 
1452
        FofoStore fs = fofoStoreRepository.selectByRetailerId(175139287);
-
 
1453
        this.rolloutMarginForStoreOnMonth(fs, LocalDate.of(2023, 2, 1));
-
 
1454
        this.rolloutMarginForStoreOnMonth(fs, LocalDate.of(2023, 3, 1));*/
-
 
1455
        //this.sendMailForSamsungRebilling();
-
 
1456
        /*List<PurchaseReturnItem> purchaseReturnItems = purchaseReturnItemRepository.selectPurchaseReturnByStatuses(Arrays.asList(PurchaseReturnStatus.DEBIT_NOTE_CREATED));
-
 
1457
        Map<Integer, List<PurchaseReturnItem>> inventoryItemsMap = purchaseReturnItems.stream().collect(Collectors.groupingBy(x -> x.getDebitNoteId()));
-
 
1458
        for (Map.Entry<Integer, List<PurchaseReturnItem>> debitNotePurcahseReturnMap : inventoryItemsMap.entrySet()) {
-
 
1459
            List<InventoryItem> inventoryItems = inventoryItemRepository.selectAllByIds(debitNotePurcahseReturnMap.getValue().stream().map(x -> x.getInventoryItemId()).collect(Collectors.toList()));
-
 
1460
            offerService.reverseAdditionalSelloutSchemes(debitNotePurcahseReturnMap.getValue().get(0).getFofoId(), inventoryItems);
-
 
1461
        }*/
-
 
1462
        //this.sendMailForAgeingAlert();
-
 
1463
        //this.sendMailForAgeingAlert();
-
 
1464
        //System.out.println(brandRegionMappingRepository.getAvailabilityToVendorWarehouse(Arrays.asList(33353), 7720));
-
 
1465
 
-
 
1466
    }
-
 
1467
 
-
 
1468
    public void sendMailForSamsungRebilling() throws Exception {
1481
    public void sendMailForSamsungRebilling() throws Exception {
1469
        List<BilledImeiModel> samsungModels = warehouseInventoryItemRepository.findByBillingDateBrand(LocalDate.now(), "Samsung");
1482
        List<BilledImeiModel> samsungModels = warehouseInventoryItemRepository.findByBillingDateBrand(LocalDate.now(), "Samsung");
1470
        LOGGER.info("SamsungModels {}", samsungModels);
1483
        LOGGER.info("SamsungModels {}", samsungModels);
1471
        samsungModels = samsungModels.stream().sorted(Comparator.comparing(x -> x.getPcmDate() == null ? -1 : 1)).collect(Collectors.toList());
1484
        samsungModels = samsungModels.stream().sorted(Comparator.comparing(x -> x.getPcmDate() == null ? -1 : 1)).collect(Collectors.toList());
1472
        if (samsungModels.size() > 0) {
1485
        if (samsungModels.size() > 0) {
Line 3692... Line 3705...
3692
    public void loanSettlement() throws Exception {
3705
    public void loanSettlement() throws Exception {
3693
        List<Loan> blockedLoans = loanRepository.selectAllActiveLoan().stream().filter(x -> x.getFreeDays() >= 365).collect(toList());
3706
        List<Loan> blockedLoans = loanRepository.selectAllActiveLoan().stream().filter(x -> x.getFreeDays() >= 365).collect(toList());
3694
        List<Loan> loans = loanRepository.selectAllActiveLoan().stream().filter(x -> x.getFreeDays() < 365).collect(toList());
3707
        List<Loan> loans = loanRepository.selectAllActiveLoan().stream().filter(x -> x.getFreeDays() < 365).collect(toList());
3695
        //Settle blocked loans only when normal loans are settled
3708
        //Settle blocked loans only when normal loans are settled
3696
        loans.addAll(blockedLoans);
3709
        loans.addAll(blockedLoans);
3697
 
-
 
-
 
3710
        //TODO:Remove this code
-
 
3711
        Loan specificLoan = loanRepository.selectByLoanId(20230);
-
 
3712
        loans.add(0, specificLoan);
-
 
3713
        //TODO:Upto here
3698
        if (!loans.isEmpty()) {
3714
        if (!loans.isEmpty()) {
3699
 
3715
 
3700
            for (Loan loan : loans) {
3716
            for (Loan loan : loans) {
3701
                double settledAmount = sdCreditService.settleLoan(loan);
3717
                double settledAmount = sdCreditService.settleLoan(loan);
3702
 
3718