Subversion Repositories SmartDukaan

Rev

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

Rev 34993 Rev 35021
Line 6... Line 6...
6
import com.razorpay.Payment;
6
import com.razorpay.Payment;
7
import com.smartdukaan.cron.itelImeiActivation.ItelImeiActivationNewService;
7
import com.smartdukaan.cron.itelImeiActivation.ItelImeiActivationNewService;
8
import com.smartdukaan.cron.itelImeiActivation.ItelImeiActivationService;
8
import com.smartdukaan.cron.itelImeiActivation.ItelImeiActivationService;
9
import com.smartdukaan.cron.itelImeiActivation.TecnoImeiActivation;
9
import com.smartdukaan.cron.itelImeiActivation.TecnoImeiActivation;
10
import com.smartdukaan.cron.migrations.RunOnceTasks;
10
import com.smartdukaan.cron.migrations.RunOnceTasks;
-
 
11
import com.smartdukaan.cron.scheduled.ambreports.AbmReportSender;
11
import com.smartdukaan.cron.scheduled.runnables.PurchaseMigration;
12
import com.smartdukaan.cron.scheduled.runnables.PurchaseMigration;
12
import com.spice.profitmandi.common.enumuration.*;
13
import com.spice.profitmandi.common.enumuration.*;
13
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
14
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
14
import com.spice.profitmandi.common.model.*;
15
import com.spice.profitmandi.common.model.*;
15
import com.spice.profitmandi.common.services.ReporticoService;
16
import com.spice.profitmandi.common.services.ReporticoService;
16
import com.spice.profitmandi.common.services.mandii.MandiiService;
17
import com.spice.profitmandi.common.services.mandii.MandiiService;
17
import com.spice.profitmandi.common.util.FileUtil;
-
 
18
import com.spice.profitmandi.common.util.FormattingUtils;
-
 
19
import com.spice.profitmandi.common.util.PdfUtils;
-
 
20
import com.spice.profitmandi.common.util.Utils;
18
import com.spice.profitmandi.common.util.*;
21
import com.spice.profitmandi.common.util.Utils.Attachment;
19
import com.spice.profitmandi.common.util.Utils.Attachment;
22
import com.spice.profitmandi.common.web.client.RestClient;
20
import com.spice.profitmandi.common.web.client.RestClient;
23
import com.spice.profitmandi.dao.Interface.Campaign;
21
import com.spice.profitmandi.dao.Interface.Campaign;
24
import com.spice.profitmandi.dao.cart.CartService;
22
import com.spice.profitmandi.dao.cart.CartService;
25
import com.spice.profitmandi.dao.cart.SmartCartService;
23
import com.spice.profitmandi.dao.cart.SmartCartService;
Line 839... Line 837...
839
 
837
 
840
    public void resetHardLimit() {
838
    public void resetHardLimit() {
841
        sdCreditService.resetHardLimit();
839
        sdCreditService.resetHardLimit();
842
    }
840
    }
843
 
841
 
-
 
842
    public void testInvoiceFormat() throws ProfitMandiBusinessException {
-
 
843
        InvoicePdfModel invoicePdfModel = orderService.getInvoicePdfModel(560280);
-
 
844
        //System.out.println(InvoiceFormatter.buildInvoiceLines(invoicePdfModel, InvoiceFormatter.WIDTH_80MM));
-
 
845
    }
-
 
846
 
844
    /*public void processCashDiscount() throws ProfitMandiBusinessException {
847
    /*public void processCashDiscount() throws ProfitMandiBusinessException {
845
        System.out.println("processing cash discount");
848
        System.out.println("processing cash discount");
846
        List<Loan> loansSettledYesterday = loanRepository.selectLoansSettledOn(LocalDate.now().minusDays(1));
849
        List<Loan> loansSettledYesterday = loanRepository.selectLoansSettledOn(LocalDate.now().minusDays(1));
847
        loansSettledYesterday.addAll(loanRepository.selectLoansSettledOn(LocalDate.now()));
850
        loansSettledYesterday.addAll(loanRepository.selectLoansSettledOn(LocalDate.now()));
848
        Map<Integer, List<Loan>> partnerSettledLoans = loansSettledYesterday.stream().collect(Collectors.groupingBy(x -> x.getFofoId()));
851
        Map<Integer, List<Loan>> partnerSettledLoans = loansSettledYesterday.stream().collect(Collectors.groupingBy(x -> x.getFofoId()));
Line 1106... Line 1109...
1106
            }
1109
            }
1107
            schemeService.processSchemeOut(scanRecord.getOrderId(), scanRecord.getFofoId());
1110
            schemeService.processSchemeOut(scanRecord.getOrderId(), scanRecord.getFofoId());
1108
        }
1111
        }
1109
    }
1112
    }
1110
 
1113
 
-
 
1114
    @Autowired
-
 
1115
    AbmReportSender abmReportSender;
1111
 
1116
 
1112
    public void test() throws Exception {
1117
    public void sendOverDueReport() {
1113
        //System.out.println(tagListingRepository.getModelSchemesByCatalogIdsAndType(175135707, PartnerType.GOLD,Arrays.asList(1024715), LocalDateTime.now()));
-
 
1114
        /*List<Integer> priceDropIds = Arrays.asList(1414);
1118
        List<Loan> loans = loanRepository.selectAllActiveLoan();
1115
        for (Integer priceDropId : priceDropIds) {
-
 
1116
            System.out.println(priceDropId);
-
 
1117
            PriceDrop priceDrop = priceDropRepository.selectById(priceDropId);
1119
        Map<Integer, List<Loan>> partnerLoansMap = loans.stream().filter(x->x.isOverdue()).collect(Collectors.groupingBy(x->x.getFofoId()));
1118
            System.out.println(priceDrop);
1120
        //sdCreditService.getDueDateCrossLoan()
1119
            priceDropService.processPD(priceDrop);
1121
        partnerLoansMap.entrySet().stream().forEach(x->{
1120
        }*/
-
 
1121
        /*System.out.println(partnerTypeChangeService.getTypeOnDate(175139962, LocalDate.of(2025,Month.JULY,28)));
-
 
1122
        System.out.println(partnerTypeChangeRepository.getRecentChange(175139962, LocalDate.of(2025,Month.JULY,28)));*/
-
 
1123
 
-
 
1124
        LocalDate startOfPreviousMonth = LocalDate.now().with(ChronoField.DAY_OF_MONTH, 1).minusMonths(1);
-
 
1125
 
1122
 
1126
        //List<FofoStore> stores = fofoStoreRepository.selectActiveStores();
-
 
1127
        List<Integer> storeIds = Arrays.asList(175139176, 175139026, 175139683, 175139770);
-
 
1128
        for (Integer storeId : storeIds) {
1123
            x.getKey();
1129
            FofoStore store = fofoStoreRepository.selectByRetailerId(storeId);
-
 
1130
            this.rolloutMarginForStoreOnMonth(store, startOfPreviousMonth);
1124
            x.getValue().size();
1131
        }
1125
        });
1132
 
-
 
1133
        //System.out.println(partnerTypeChangeService.getTypeOnDate(175138843, LocalDate.of(2025,06,30).plusDays(1)));
-
 
1134
        //this.rolloutMarginForStoreOnMonth(fofoStoreRepository.selectByRetailerId(175138843), LocalDate.of(2025,6,1));
-
 
1135
        //Utils.sendMailWithAttachments( mailSender,"amit.gupta@smartdukaan.com", null, "Hello World!", "Test Mail", null);
-
 
1136
        //sdCreditService.updateRisk();
-
 
1137
        /*PartnerType partnerType = partnerTypeChangeService.getTypeOnDate(175139309,
-
 
1138
                YearMonth.of(2025, 5).atDay(1));
-
 
1139
        System.out.println(partnerType);
-
 
1140
        System.out.println(partnerType.nextPartnerTypes());*/
-
 
1141
        //this.whatsappTest();
-
 
1142
        //this.reve();
-
 
1143
        //this.rolloutOppoPayout();
-
 
1144
        //this.debitLoanAmountFromWallet();
-
 
1145
        //List<TotalLoanAmountDueModel> totalLoanAmountDueModels = loanRepository.getDueLoansByFofoId(175139438);
-
 
1146
        //System.out.println(totalLoanAmountDueModels);
-
 
1147
        //runOnceTasks.findCNDiff();
-
 
1148
        /*this.updatePartnerLimit();
-
 
1149
        System.out.println(getSuggestedLimit(300000d));
-
 
1150
        System.out.println(getSuggestedLimit(400000d));
-
 
1151
        System.out.println(getSuggestedLimit(500000d));
-
 
1152
        System.out.println(getSuggestedLimit(600000d));
-
 
1153
        System.out.println(getSuggestedLimit(700000d));
-
 
1154
        System.out.println(getSuggestedLimit(1500000d));
-
 
1155
        System.out.println(getSuggestedLimit(2000000d));
-
 
1156
        System.out.println(getSuggestedLimit(2500000d));*/
-
 
1157
        //System.setProperty("https.protocols", "TLSv1.2");
-
 
1158
 
-
 
1159
 
-
 
1160
        /*URL url = new URL("https://www.howsmyssl.com/a/check");
-
 
1161
        HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
-
 
1162
        InputStream inputStream = conn.getInputStream();
-
 
1163
 
1126
 
1164
        byte[] responseBytes = toByteArray(inputStream);
-
 
1165
        String response = new String(responseBytes, "UTF-8");
-
 
-
 
1127
    }
1166
 
1128
 
-
 
1129
    public void test() throws Exception {
-
 
1130
       // abmReportSender.sendAbmSmartCartReport();
-
 
1131
            //this.sendOverDueReport();
1167
        System.out.println(response);
1132
        List<Integer> orderIds = Arrays.asList(1929879,1932372,1932377,1932386,1932396,1935221,1935563,1935564,1945144,1955256,1955271,1955294,1961255,1961256,1972821,1972823,1972824,1972825,1972826,1974250,1974252,1974253,1974254,1974255,1974256,1974242,1974244,1974245,1974246,1974247,1974248,1976610,1978095,1978136,1978130,1978174,1978156,1978158,1978167,1978169,1978160,1978179,1978175,1978180,1978201,1978200,1978202,1978192,1978198,1978207,1978204,1978457,1979781,1979783,1979784,1979787,1982412,1982413,1986531,1986532,1986533,1991006,1991628,1991629,2016001,2018921,2042948,2047031,2058500,2058522,2058519,2058520,2058546,2058559,2058568,2058575,2058574,2058598,2058594,2058618,2058633,2066491,2067110,2067113,2067118,2067120,2067123,2067132,2067125,2067127,2069974,2069970,2069976,2069985,2069987);
-
 
1133
        for (Integer orderId : orderIds) {
-
 
1134
            System.out.println("Refund Started - " + orderId);
-
 
1135
            orderRepository.refundOrder(orderId, "vinay.p", "Long awaited cancellation", OrderStatus.CANCELLED_DUE_TO_LOW_INVENTORY);
-
 
1136
            System.out.println("Refund Ended");
-
 
1137
        }
1168
 
1138
 
1169
        Utils.sendMailWithAttachments(googleMailSender, new String[]{"amit.gupta@smartdukaan.com"}, null, "DTDC AWb", "PFA");*/
1139
        //Utils.sendMailWithAttachments(googleMailSender, new String[]{"amit.gupta@smartdukaan.com"}, null, "DTDC AWb", "PFA");*/
1170
    }
1140
    }
1171
 
1141
 
1172
    @Autowired
1142
    @Autowired
1173
    LoanTransactionRepository loanTransactionRepository;
1143
    LoanTransactionRepository loanTransactionRepository;
1174
 
1144