Subversion Repositories SmartDukaan

Rev

Rev 37472 | Rev 37499 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
23756 amit.gupta 1
package com.smartdukaan.cron.scheduled;
2
 
30049 amit.gupta 3
import com.smartdukaan.cron.migrations.RunOnceTasks;
34948 ranu 4
import com.smartdukaan.cron.scheduled.ambreports.AbmReportSender;
30049 amit.gupta 5
import com.smartdukaan.cron.scheduled.leadsync.LeadSyncRunner;
32832 amit.gupta 6
import com.smartdukaan.cron.scheduled.ordertracking.OrderTrackingService;
32907 amit.gupta 7
import com.smartdukaan.cron.scheduled.purchaseorder.POScheduler;
34443 vikas.jang 8
import com.spice.profitmandi.common.model.ProfitMandiConstants;
34241 tejus.loha 9
import com.spice.profitmandi.dao.service.PurSaleService;
23756 amit.gupta 10
import org.apache.logging.log4j.LogManager;
11
import org.apache.logging.log4j.Logger;
12
import org.springframework.beans.factory.annotation.Autowired;
13
import org.springframework.scheduling.annotation.Scheduled;
14
import org.springframework.stereotype.Component;
15
 
30049 amit.gupta 16
import java.time.LocalDate;
17
import java.time.LocalDateTime;
34756 amit.gupta 18
import java.time.LocalTime;
36993 amit 19
import java.time.YearMonth;
30049 amit.gupta 20
import java.util.Date;
23756 amit.gupta 21
 
22
@Component
30887 amit.gupta 23
//@ConditionalOnProperty(name = "scheduled", havingValue = "true", matchIfMissing = true)
23756 amit.gupta 24
public class ScheduledSkeleton {
23794 govind 25
 
32048 tejbeer 26
    private static final Logger log = LogManager.getLogger(ScheduledSkeleton.class);
23756 amit.gupta 27
 
32048 tejbeer 28
    @Autowired
29
    private ScheduledTasks scheduledTasks;
28205 tejbeer 30
 
32048 tejbeer 31
    @Autowired
36361 amit 32
    private BatchScheduledTasks batchScheduledTasks;
33
 
34
    @Autowired
34321 ranu 35
    private ScheduledTasksTest scheduledTasksTest;
36
 
37
    @Autowired
34948 ranu 38
    private AbmReportSender abmReportSender;
39
 
40
    @Autowired
32048 tejbeer 41
    private LeadSyncRunner leadSyncRunner;
24841 govind 42
 
32048 tejbeer 43
    @Autowired
44
    private Reconciliation reconciliation;
25822 amit.gupta 45
 
32048 tejbeer 46
    @Autowired
47
    private RunOnceTasks runOnceTasks;
23756 amit.gupta 48
 
32048 tejbeer 49
    @Autowired
50
    private TicketRelatedScheduledTask ticketRelatedScheduledTask;
24841 govind 51
 
32048 tejbeer 52
    @Autowired
53
    private OnBoardingRelatedSchelduleTask onBoardingRelatedSchelduleTask;
28921 tejbeer 54
 
32048 tejbeer 55
    @Scheduled(cron = "0 0 2 * * *")
56
    public void processDailySchemes() throws Exception {
29757 tejbeer 57
 
32048 tejbeer 58
        int maxMinusDays = 5;
59
        int currentDayOfMonth = LocalDate.now().getDayOfMonth();
60
        int minusDays = currentDayOfMonth > maxMinusDays ? maxMinusDays : currentDayOfMonth - 1;
61
        if (minusDays > 0) {
62
            scheduledTasks.processScheme(LocalDateTime.now().minusDays(minusDays), LocalDateTime.now(), false);
63
        }
29673 manish 64
 
32048 tejbeer 65
    }
24841 govind 66
 
37292 amit 67
    /** Daily 00:20: re-index models whose hot-deal window opened today or closed yesterday. */
37258 amit 68
    @Scheduled(cron = "0 20 0 * * *")
69
    public void syncHotDealFlags() throws Exception {
70
        try {
71
            scheduledTasks.syncHotDealFlags();
72
        } catch (Exception e) {
73
            log.error("syncHotDealFlags failed", e);
74
        }
75
    }
76
 
32048 tejbeer 77
    @Scheduled(cron = "0 15 0 * * *")
78
    public void runOnceTasks() throws Exception {
29757 tejbeer 79
 
32048 tejbeer 80
        scheduledTasks.reconcileRecharge();
29757 tejbeer 81
 
32048 tejbeer 82
    }
25822 amit.gupta 83
 
32048 tejbeer 84
    /*
85
     * @Scheduled(cron = "0 0 8 * * *") public void mailDashboardScreenshots()
86
     * throws Exception { runOnceTasks.mailDashboardScreenshots(); }
87
     */
25721 tejbeer 88
 
32048 tejbeer 89
    @Scheduled(cron = "0 05 0 1,16 * ?")
90
    public void processRechargeCashback() throws Throwable {
29673 manish 91
 
32048 tejbeer 92
        scheduledTasks.processRechargeCashback();
29673 manish 93
 
32048 tejbeer 94
    }
23794 govind 95
 
32048 tejbeer 96
    @Scheduled(cron = "0 0 6 * * *")
97
    public void sendPartnerInvestmentDetails() throws Exception {
98
        scheduledTasks.sendPartnerInvestmentDetails();
99
        long secs = (new Date().getTime()) / 1000;
100
        log.info("sendPartnerInvestmentDetails" + LocalDateTime.now());
29757 tejbeer 101
 
32048 tejbeer 102
    }
28921 tejbeer 103
 
36993 amit 104
    // Monthly margins CN dry-run at 06:00 on the 1st. dryRun=true forces the harmless dev path
105
    // (no IRN, no PDF, no DB persist, no partner mail) even on prod. The real pipeline is run
106
    // manually via `--sendCreditNote --live`.
107
    @Scheduled(cron = "0 0 6 1 * ?")
108
    public void monthlyMarginsCnDryRun() throws Exception {
109
 
110
        scheduledTasks.sendCreditNote(YearMonth.now().minusMonths(1), true);
111
 
112
    }
113
 
37234 vikas 114
    @Scheduled(cron = "0 30 6 * * *")
34648 ranu 115
    public void generateBiReport() throws Exception {
116
        scheduledTasksTest.generateBiReport();
117
    }
34939 ranu 118
    @Scheduled(cron = "0 30 4 * * *")
119
    public void createFofoSmartCartSuggestion() throws Exception {
120
        scheduledTasksTest.createFofoSmartCartSuggestion();
121
    }
35980 amit 122
    /*@Scheduled(cron = "0 0 6,22 * * *")
34948 ranu 123
    public void sendAbmSmartCartReport() throws Exception {
124
        abmReportSender.sendAbmSmartCartReport();
35980 amit 125
    }*/
34648 ranu 126
 
32048 tejbeer 127
    @Scheduled(cron = "0 0 10,15,17 * * *")
128
    public void sendIndentTertiaryReport() throws Exception {
29757 tejbeer 129
 
32048 tejbeer 130
        scheduledTasks.sendIndentTertiary();
29757 tejbeer 131
 
32048 tejbeer 132
    }
28921 tejbeer 133
 
32048 tejbeer 134
    @Scheduled(cron = "0 0 6 * * *")
135
    public void checkPartnerActiveStoreByStatus() throws Exception {
29673 manish 136
 
32048 tejbeer 137
        scheduledTasks.checkPartnerActiveStore();
29673 manish 138
 
32048 tejbeer 139
    }
26790 tejbeer 140
 
37040 ranu 141
    @Scheduled(cron = "0 30 23 * * *")
142
    public void updatePartnerActivationTypeByMonthlySale() throws Exception {
143
 
144
        scheduledTasks.updatePartnerActivationTypeByMonthlySale();
145
 
146
    }
147
 
37172 amit 148
    // 23:45 — after updatePartnerActivationTypeByMonthlySale (23:30), so the
149
    // REVIVAL agenda mirror reads today's activation_type state.
150
    @Scheduled(cron = "0 45 23 * * *")
151
    public void updatePjpAgendaInstances() throws Exception {
152
 
153
        scheduledTasks.updatePjpAgendaInstances();
154
 
155
    }
156
 
32048 tejbeer 157
    // @Scheduled(cron = "0 0 8 * * *")
158
    public void sendStockAgeingReport() throws Throwable {
29757 tejbeer 159
 
32048 tejbeer 160
        scheduledTasks.sendAgeingReport();
29757 tejbeer 161
 
32048 tejbeer 162
    }
24131 govind 163
 
32048 tejbeer 164
    @Scheduled(cron = "0 0 11 * * *")
165
    public void escalateTicket() throws Exception {
166
        log.info("escalate ticket");
167
        ticketRelatedScheduledTask.escalateTicket();
29757 tejbeer 168
 
32048 tejbeer 169
    }
24841 govind 170
 
32048 tejbeer 171
    @Scheduled(cron = "0 0 11 * * *")
172
    public void alertTicketToUser() throws Exception {
173
        log.info("alert for ticket");
29673 manish 174
 
32048 tejbeer 175
        ticketRelatedScheduledTask.alertforTicket();
29673 manish 176
 
32048 tejbeer 177
    }
24841 govind 178
 
34904 ranu 179
    //@Scheduled(cron = "0 0 14,18,23 ? * *")
32048 tejbeer 180
    public void dailySaleNotification() throws Exception {
181
        log.info("daily send Notification");
29673 manish 182
 
32048 tejbeer 183
        scheduledTasks.sendDailySalesNotificationToPartner(null);
29757 tejbeer 184
 
32048 tejbeer 185
    }
24841 govind 186
 
32048 tejbeer 187
    /*
188
     * @Scheduled(cron = "0 0 6 * * *") public void dailyReconciliation() throws
189
     * Exception { reconciliation.dailyReconciliation(); }
190
     */
28205 tejbeer 191
 
32048 tejbeer 192
    @Scheduled(cron = "0 0 1 * * *")
193
    public void selectFinServiceFollowUpDateByCurrDate() throws Exception {
194
        log.info("selectFinServiceFollowUpDateByCurrDate");
195
        scheduledTasks.selectFinServiceFollowUpDateByCurrDate(LocalDate.now());
30049 amit.gupta 196
 
32048 tejbeer 197
    }
30049 amit.gupta 198
 
32165 amit.gupta 199
    @Scheduled(cron = "0 0 4 * * *")
32048 tejbeer 200
    public void processActivation() throws Exception {
29757 tejbeer 201
 
32048 tejbeer 202
        scheduledTasks.processActivation();
29757 tejbeer 203
 
32048 tejbeer 204
    }
25721 tejbeer 205
 
32048 tejbeer 206
    // TODO: Change it back to first of every month
207
    // @Scheduled(cron = "0 0 1 1 * *")
208
    @Scheduled(cron = "0 0 1 2 * *")
209
    public void rollOutUpgardedMargins() throws Exception {
35522 amit 210
        scheduledTasks.rollOutUpgardedMarginsNextMonth(null);
30788 amit.gupta 211
 
32048 tejbeer 212
    }
30788 amit.gupta 213
 
34241 tejus.loha 214
    @Scheduled(fixedDelay = 60 * 1000)
32048 tejbeer 215
    public void sendNotification() throws Throwable {
29757 tejbeer 216
 
32048 tejbeer 217
        log.info("send Notification");
29673 manish 218
 
32048 tejbeer 219
        scheduledTasks.sendNotification();
220
        log.info("send Notification Done");
29673 manish 221
 
32048 tejbeer 222
    }
28205 tejbeer 223
 
34669 amit.gupta 224
    //@Scheduled(cron = "0 */15 * * * *")
32048 tejbeer 225
    public void checkRazorPayPaymentStatus() throws Throwable {
29757 tejbeer 226
 
32048 tejbeer 227
        scheduledTasks.checkRazorPayPaymentStatus();
29673 manish 228
 
32048 tejbeer 229
    }
28377 tejbeer 230
 
36292 amit 231
    @Scheduled(fixedDelay = 5 * 1000)
33426 amit.gupta 232
    //@Scheduled(cron = "0 5 23 * * *")
32048 tejbeer 233
    public void updateIrnsToInvoices() throws Throwable {
234
        runOnceTasks.updateIrnsToInvoices();
235
    }
31612 tejbeer 236
 
32048 tejbeer 237
    // No longer needed
238
    // @Scheduled(cron = "0 */10 * * * *")
239
    public void attachToffeeInvoices() throws Throwable {
29757 tejbeer 240
 
32048 tejbeer 241
        scheduledTasks.attachToffeeInvoices();
29757 tejbeer 242
 
32048 tejbeer 243
    }
24841 govind 244
 
35568 amit 245
    // REMOVED: ticketClosed() scheduler - now handled by TicketRelatedScheduledTask.autoCloseResolvedTickets()
246
    // which uses 8 working days instead of 7 calendar days and runs as part of processAllTicketTasks()
26283 tejbeer 247
 
32048 tejbeer 248
    @Scheduled(cron = "0 0 8 * * *")
249
    public void checkfocusedModelInPartnerStock() throws Throwable {
250
        log.info("startTime" + LocalDateTime.now());
29757 tejbeer 251
 
32048 tejbeer 252
        scheduledTasks.checkfocusedModelInPartnerStock();
25721 tejbeer 253
 
32048 tejbeer 254
        log.info("endTime" + LocalDateTime.now());
255
    }
28205 tejbeer 256
 
32048 tejbeer 257
    @Scheduled(cron = "0 0 8,10,12,14,16,18,20 * * *")
258
    public void notifyLead() throws Throwable {
29757 tejbeer 259
 
32048 tejbeer 260
        scheduledTasks.notifyLead();
29757 tejbeer 261
 
32048 tejbeer 262
        // scheduledTasks.notifyVisits();
263
    }
25721 tejbeer 264
 
32048 tejbeer 265
    // No longer scheduled
266
    // @Scheduled(cron = "0 0 1 * * *")
267
    public void fetchImeiActivation() throws Throwable {
29673 manish 268
 
32048 tejbeer 269
        runOnceTasks.fetchImeiActivation(0);
29757 tejbeer 270
 
32048 tejbeer 271
    }
26790 tejbeer 272
 
32411 amit.gupta 273
    @Scheduled(cron = "0 0 7 * * *")
274
    //Send all lead owners the report for scheduled followups missed
275
    public void sendUnscheduledFollowUpMail() throws Exception {
276
        scheduledTasks.sendUnscheduledFollowUpMail();
277
    }
278
 
32048 tejbeer 279
    @Scheduled(cron = "0 0 1 * * *")
280
    public void checkValidateReferral() throws Throwable {
281
        log.info("startTime" + LocalDateTime.now());
29673 manish 282
 
32048 tejbeer 283
        scheduledTasks.checkValidateReferral();
29757 tejbeer 284
 
32048 tejbeer 285
        log.info("endTime" + LocalDateTime.now());
286
    }
26790 tejbeer 287
 
32048 tejbeer 288
    // @Scheduled(cron = "0 0 8 * * *")
289
    public void partnerProblemAlert() throws Throwable {
290
        log.info("startTime" + LocalDateTime.now());
29673 manish 291
 
32048 tejbeer 292
        scheduledTasks.partnerProblemAlert();
29673 manish 293
 
32048 tejbeer 294
        log.info("endTime" + LocalDateTime.now());
295
    }
28921 tejbeer 296
 
35109 ranu 297
    @Scheduled(cron = "0 0 10 * * *")
32048 tejbeer 298
    public void onboardingEventDelays() throws Throwable {
299
        log.info("startTime" + LocalDateTime.now());
29757 tejbeer 300
 
32048 tejbeer 301
        onBoardingRelatedSchelduleTask.onboardingEventDelays();
29757 tejbeer 302
 
32048 tejbeer 303
        log.info("endTime" + LocalDateTime.now());
304
    }
28921 tejbeer 305
 
36065 aman 306
    @Scheduled(cron = "0 30 10 * * *")
307
    public void sendStockDeliveredTrainingNotification() {
308
        log.info("sendStockDeliveredTrainingNotification startTime " + LocalDateTime.now());
309
        onBoardingRelatedSchelduleTask.sendStockDeliveredTrainingNotification();
310
        log.info("sendStockDeliveredTrainingNotification endTime " + LocalDateTime.now());
311
    }
312
 
36003 aman 313
    @Scheduled(cron = "0 0 9 * * ?")
314
    public void sendDelayAlertEmail() {
315
        log.info("sendDelayAlertEmail startTime " + LocalDateTime.now());
316
        onBoardingRelatedSchelduleTask.sendDelayAlertEmail();
317
        log.info("sendDelayAlertEmail endTime " + LocalDateTime.now());
318
    }
319
 
32048 tejbeer 320
    @Scheduled(cron = "0 0 8 * * *")
321
    public void brandingAlert() throws Throwable {
322
        log.info("startTime" + LocalDateTime.now());
29673 manish 323
 
32048 tejbeer 324
        onBoardingRelatedSchelduleTask.brandingAlert();
29673 manish 325
 
32048 tejbeer 326
        log.info("endTime" + LocalDateTime.now());
327
    }
28921 tejbeer 328
 
32048 tejbeer 329
    @Scheduled(cron = "0 0 8 * * *")
330
    public void fullPaymentPendingAlert() throws Throwable {
331
        log.info("startTime" + LocalDateTime.now());
29757 tejbeer 332
 
32048 tejbeer 333
        onBoardingRelatedSchelduleTask.fullPaymentPendingAlert();
29757 tejbeer 334
 
32048 tejbeer 335
        log.info("endTime" + LocalDateTime.now());
336
    }
28921 tejbeer 337
 
32048 tejbeer 338
    @Scheduled(cron = "0 */5 * * * *")
339
    public void onBoardingCompleteEventEmail() throws Throwable {
340
        log.info("startTime" + LocalDateTime.now());
29673 manish 341
 
32048 tejbeer 342
        onBoardingRelatedSchelduleTask.onBoardingCompleteEventEmail();
29673 manish 343
 
32048 tejbeer 344
        log.info("endTime" + LocalDateTime.now());
345
    }
29040 tejbeer 346
 
32048 tejbeer 347
    @Scheduled(cron = "0 */5 * * * *")
348
    public void updateSaholicCISTable() throws Throwable {
349
        log.info("updateSaholicCISTable startTime" + LocalDateTime.now());
350
        runOnceTasks.updateSaholicCISTable();
351
        log.info("updateSaholicCISTable endTime" + LocalDateTime.now());
352
    }
30667 amit.gupta 353
 
34241 tejus.loha 354
    @Autowired
355
    PurSaleService purSaleService;
356
 
35133 ranu 357
    @Scheduled(cron = "0 0 6,22 * * ?")
34241 tejus.loha 358
    public void send10DaysEgedStockReport() throws Throwable {
34275 tejus.loha 359
        log.info("moreThen10DaysEgedStockReport startTime" + LocalDateTime.now());
360
        scheduledTasks.send10OrMoreOlderStockReport();
361
        log.info("moreThen10DaysEgedStockReport endTime" + LocalDateTime.now());
34241 tejus.loha 362
    }
363
 
35616 amit 364
    @Scheduled(fixedDelay = 5 * 60 * 1000)
32048 tejbeer 365
    public void fetchPartnerStat() throws Throwable {
366
        scheduledTasks.fetchParnterStats();
367
    }
30390 amit.gupta 368
 
37472 amit 369
    @Scheduled(cron = "0 0 23 * * *")
32214 jai.hind 370
    public void checkItelImeiActivationNew() throws Throwable {
371
        log.info("startTime" + LocalDate.now());
372
 
373
        log.info("startTimecheckItelImeiActivation" + LocalDate.now());
374
        scheduledTasks.checkItelImeiActivationNew(LocalDate.now(), 90);
375
        long secs = (new Date().getTime()) / 1000;
376
        log.info("endTimecheckItelImeiActivation" + LocalDate.now());
377
 
378
    }
379
 
37472 amit 380
    /**
381
     * Vivo: one full pass a day, then nothing until tomorrow.
382
     *
383
     * Was two parallel jobs every 5 minutes capped at 50 and 10 imeis, which never
384
     * finished a pass over a 9,510-row pool and retried a failed lookup five minutes
385
     * later instead of the next day. Vivo stays on its own schedule and its own thread:
386
     * it is direct HTTP plus the captcha solver, no ChromeDriver, so it does not
387
     * contend for the resource the oppo/realme pass is rationing.
388
     *
389
     * ~9,510 imeis at roughly 2.5s each is about 6.6 hours.
390
     */
391
    @Scheduled(cron = "0 15 0 * * *")
32048 tejbeer 392
    public void vivoImeiActivation() throws Throwable {
393
        log.info("startTimevivoImeiActivation" + LocalDateTime.now());
29757 tejbeer 394
 
32048 tejbeer 395
        scheduledTasks.checkImeiActivation();
37472 amit 396
 
32048 tejbeer 397
        log.info("endTimevivoImeiActivation" + LocalDateTime.now());
29757 tejbeer 398
 
32048 tejbeer 399
    }
29255 tejbeer 400
 
37482 amit 401
    /**
402
     * Itel activation from Carlcare, Transsion's own after-sales endpoint. 50 imeis every 5
403
     * minutes, which spreads the work over the whole day rather than bursting: 14,400 lookups a
404
     * day against a pending pool of ~10,400.
405
     *
406
     * The 5-minute cadence is safe here in a way it was not for vivo, whose comment below records
407
     * why that pattern ran away: there, a failed lookup wrote no row, so createTimestamp was not
408
     * bumped and the same imei was eligible again five minutes later. This service stamps the row
409
     * on EVERY outcome, failures included, so each tick advances past the imeis it asked about
410
     * and a failure costs one retry tomorrow rather than one every five minutes.
411
     *
412
     * It is one plain signed GET per imei -- no captcha solver, no ChromeDriver -- so it does not
413
     * contend with the oppo/realme pass. Both this and the 23:00 DCR pull write Itel rows and
414
     * need no coordination: the pool query returns only imeis whose activationTimestamp is still
415
     * null, so whatever one has filled has already left the other's pool.
416
     */
417
    @Scheduled(fixedDelay = 5 * 60 * 1000)
418
    public void carlcareImeiActivation() throws Throwable {
419
        scheduledTasks.checkCarlcareImeiActivation();
420
    }
421
 
32048 tejbeer 422
    @Scheduled(cron = "0 0 8 * * *")
423
    public void reviewUncontactablePartner() throws Throwable {
424
        log.info("startTime" + LocalDateTime.now());
30421 tejbeer 425
 
32048 tejbeer 426
        scheduledTasks.reviewUncontactablePartner();
30421 tejbeer 427
 
32048 tejbeer 428
    }
30421 tejbeer 429
 
33928 ranu 430
    @Scheduled(cron = "0 0 7 * * *")
431
    public void setMovementWiseRbmTodayTargets() throws Throwable {
34669 amit.gupta 432
        log.info("today targets startTime {}", LocalDateTime.now());
33928 ranu 433
 
434
        scheduledTasks.persistRbmTodayTargets();
435
 
436
    }
437
 
33986 ranu 438
    @Scheduled(cron = "0 0 21 * * *")
439
    public void setMovementWiseRbmTodayAchievements() throws Throwable {
34669 amit.gupta 440
        log.info("today achievement startTime {}", LocalDateTime.now());
33986 ranu 441
 
442
        scheduledTasks.persistRbmTodayAchievements();
443
 
444
    }
445
 
33078 ranu 446
    @Scheduled(cron = "0 0 8 * * *")
447
    public void reviewNonSdBuyingBrand() throws Throwable {
448
        log.info("startTime" + LocalDateTime.now());
449
 
450
        scheduledTasks.reviewNonSdBuyingBrand();
451
 
452
    }
453
 
32048 tejbeer 454
    @Autowired
455
    private StandAlone standAlone;
30352 amit.gupta 456
 
32832 amit.gupta 457
    @Autowired
458
    OrderTrackingService orderTrackingService;
459
 
37472 amit 460
    // ONE thread, ONE full pass a day, for oppo and realme together.
461
    //
462
    // This replaces four @Scheduled jobs (oppo and realme x secondary and tertiary,
463
    // every 5 minutes), and it supersedes the r37447 / r37448 / r37449 argument about
464
    // how many ChromeDrivers to run. That argument was about the wrong variable.
465
    //
466
    // The revert in r37449 was sized on lookups ATTEMPTED per day, and the re-merge that
467
    // followed blamed the resulting collapse on CPU contention pushing the captcha
468
    // render past the element waits. The logs do not support contention:
469
    //
470
    //   29 Aug        imeis   canvas timeouts   captcha ok   distinct imeis   asks each
471
    //   oppo          4,350                 0       ~100%            4,238        1.03
472
    //   realme        4,524             3,390         19%            1,004        4.50
473
    //
474
    // Same box, same six cores, same driver count, same captcha vendor, load average
475
    // 0.9 -- and oppo took ZERO timeouts in all 24 hours, including the 15:00-23:00
476
    // window in which realme solved nothing at all. Realme's own canvas wait is 15s
477
    // against oppo's 8s, so the LONGER wait is the one expiring.
478
    //
479
    // What realme's timeout rate actually tracks is its own daily request volume, and
480
    // it resets at midnight: 920/day -> 0.3%, 3,467/day -> 28%, 4,524/day -> 75%. That
481
    // is realme.com declining to serve the widget, not a busy box.
482
    //
483
    // The 4.5 asks per imei is why it ran away. A failed lookup never reaches
484
    // dateMap.put, so no row is written, so createTimestamp is not bumped, so the same
485
    // imei was eligible again five minutes later -- more requests hardened the block,
486
    // which caused more failures, which caused more requests. A snapshotted daily pass
487
    // bounds that by construction: a failure costs one retry tomorrow, never one in
488
    // five minutes, however the far end behaves.
489
    //
490
    // Judge this change on dates written, not on timeout count.
491
    @Scheduled(cron = "0 30 0 * * *")
492
    public void oppoRealmeImeiActivation() throws Throwable {
493
        log.info("startTimeOppoRealmeImeiActivation {}", LocalDateTime.now());
30352 amit.gupta 494
 
37472 amit 495
        standAlone.checkBrowserImeiActivation();
37448 amit 496
 
37472 amit 497
        log.info("endTimeOppoRealmeImeiActivation {}", LocalDateTime.now());
34421 amit.gupta 498
    }
499
 
32801 amit.gupta 500
    @Scheduled(cron = "0 0 * * * *")
32048 tejbeer 501
    public void markBlueDartOrderDelivered() throws Throwable {
502
        log.info("startTime" + LocalDateTime.now());
32832 amit.gupta 503
        orderTrackingService.markBlueDartOrderDelivered();
32048 tejbeer 504
        log.info("endTime" + LocalDateTime.now());
505
    }
31117 tejbeer 506
 
32881 amit.gupta 507
    @Scheduled(cron = "0 15 * * * *")
32048 tejbeer 508
    public void markDelhiveryOrderDelivered() throws Throwable {
29673 manish 509
 
32048 tejbeer 510
        log.info("startTime" + LocalDateTime.now());
32832 amit.gupta 511
        orderTrackingService.markDelhiveryOrderDelivered();
29673 manish 512
 
32048 tejbeer 513
        log.info("endTime" + LocalDateTime.now());
514
    }
29308 tejbeer 515
 
32048 tejbeer 516
    @Scheduled(cron = "0 0 4 * * *")
517
    public void processPriceDrop() throws Throwable {
518
        scheduledTasks.processPriceDrop();
519
    }
30637 amit.gupta 520
 
32048 tejbeer 521
    @Scheduled(cron = "0 0 0 * * *")
522
    public void calculateInterestAccured() throws Throwable {
34710 amit.gupta 523
        scheduledTasks.loanSettlement();
32048 tejbeer 524
        scheduledTasks.calculateInterestAccured();
525
    }
30859 tejbeer 526
 
32117 tejbeer 527
    //  @Scheduled(cron = "0 */5 2-22 * * *")
33181 amit.gupta 528
    @Scheduled(fixedDelay = 1 * 60 * 1000)
32531 amit.gupta 529
    //@Scheduled(cron = "0 0 23 * * *")
32048 tejbeer 530
    public void loanSettlement() throws Throwable {
34756 amit.gupta 531
        LocalTime now = LocalTime.now();
34767 amit.gupta 532
        LocalTime start = LocalTime.of(9, 0);
34757 amit.gupta 533
        LocalTime end = LocalTime.of(23, 0);
34756 amit.gupta 534
 
535
        if (now.isBefore(start) || now.isAfter(end)) {
34762 amit.gupta 536
            System.out.println("Task skipped during restricted hours: " + now);
537
        } else {
34756 amit.gupta 538
            scheduledTasks.loanSettlement();
539
            System.out.println("Task executed at " + now);
540
        }
32048 tejbeer 541
    }
30859 tejbeer 542
 
32048 tejbeer 543
    @Scheduled(cron = "0 */15 * * * *")
544
    public void ccAvenueSettlement() throws Throwable {
545
        scheduledTasks.settleCCAvePayments();
546
    }
31332 amit.gupta 547
 
32048 tejbeer 548
    @Scheduled(cron = "0 0 6 * * *")
549
    public void dailyLoanAlert() throws Throwable {
550
        scheduledTasks.dailyLoanAlert();
551
    }
30896 amit.gupta 552
 
35106 ranu 553
    @Scheduled(cron = "0 0 11 * * *")
34162 ranu 554
    public void groupHidCatalogsByWeeks() throws Throwable {
555
        scheduledTasks.groupHidCatalogsByWeeks();
556
    }
557
 
36113 ranu 558
    @Scheduled(cron = "0 0 9 * * MON")  // Every Monday at 9:00 AM
34321 ranu 559
    public void sendFeebackSalesAndRbm() throws Throwable {
560
        scheduledTasksTest.sendRbmFeedbackSummaryEmail();
561
        scheduledTasksTest.sendSalesFeedbackSummaryEmail();
562
    }
563
 
32165 amit.gupta 564
    //Look out for imeis that have activation pending based of sale and mark create new SIO out of them
32048 tejbeer 565
    @Scheduled(cron = "0 0 1 * * *")
566
    public void processActivatedImeisForSchemes() throws Throwable {
567
        scheduledTasks.processActivatedImeisForSchemes();
568
    }
34241 tejus.loha 569
 
33357 amit.gupta 570
    //On every fifth update deductions
33435 amit.gupta 571
    @Scheduled(cron = "0 30 6 5 * ?")
33357 amit.gupta 572
    public void processSidbiDeductions() throws Throwable {
573
        scheduledTasks.processSidbiDeductions();
574
    }
34669 amit.gupta 575
 
34374 amit.gupta 576
    //Dont reset it for now as proposed by TV
577
    //@Scheduled(cron = "0 30 6 4 * ?")
33904 amit.gupta 578
    public void resetHardLimit() throws Throwable {
579
        scheduledTasks.resetHardLimit();
580
    }
581
 
34830 ranu 582
    @Scheduled(cron = "0 0/20 * * * *")
32048 tejbeer 583
    public void updatePartnerLimit() throws Throwable {
36361 amit 584
        batchScheduledTasks.updatePartnerLimitWithBatch();
32048 tejbeer 585
    }
30929 tejbeer 586
 
34253 ranu 587
    @Scheduled(cron = "0 0 9,14,18 * * *")
33874 ranu 588
    public void createOpeningStockPartyWise() throws Throwable {
589
        scheduledTasks.createOpeningStockPartyWise();
590
    }
30936 tejbeer 591
 
32842 amit.gupta 592
    //Loans due/overdue/default notifications sent to parnters
593
    @Scheduled(cron = "0 0 11 * * *")
32822 ranu 594
    public void sendMailWhatsAppAfterLoanDueDate() throws Throwable {
595
        scheduledTasks.sendMailWhatsAppAfterLoanDueDate();
596
    }
34241 tejus.loha 597
 
32842 amit.gupta 598
    @Scheduled(cron = "0 0 8 * * *")
599
    public void alertForDueDate() throws Throwable {
600
        scheduledTasks.alertForDueDate();
601
    }
32822 ranu 602
 
35133 ranu 603
    @Scheduled(cron = "0 0 4,21 * * *")
32048 tejbeer 604
    public void notifyLoanDueDateCross() throws Throwable {
605
        scheduledTasks.notifyLoanDueDateCross();
606
    }
30936 tejbeer 607
 
35133 ranu 608
    @Scheduled(cron = "0 0 4,21 * * *")
32048 tejbeer 609
    public void notifyDefaultLoans() throws Throwable {
610
        scheduledTasks.notifyDefaultLoans();
611
    }
30936 tejbeer 612
 
34910 ranu 613
   // @Scheduled(cron = "0 0 23 * * *")
32048 tejbeer 614
    public void hygineAlertForInternalTeam() throws Throwable {
615
        scheduledTasks.hygineAlertForInternalTeam();
31206 tejbeer 616
 
32048 tejbeer 617
    }
31206 tejbeer 618
 
32048 tejbeer 619
    @Scheduled(cron = "0 0 23 * * *")
620
    public void hygineAlertForPartner() throws Throwable {
621
        scheduledTasks.hygineAlertForPartner();
31206 tejbeer 622
 
32048 tejbeer 623
    }
31206 tejbeer 624
 
32048 tejbeer 625
    @Scheduled(cron = "0 0 0 * * MON")
626
    public void monthlyTargetForPartner() throws Throwable {
627
        scheduledTasks.monthlyTargetForPartner();
31249 tejbeer 628
 
32048 tejbeer 629
    }
31249 tejbeer 630
 
32048 tejbeer 631
    @Scheduled(cron = "0 0 0 * * MON")
632
    public void monthlyTargetForInternalTeam() throws Throwable {
633
        scheduledTasks.monthlyTargetForInternalTeam();
31249 tejbeer 634
 
32048 tejbeer 635
    }
31612 tejbeer 636
 
32048 tejbeer 637
    @Scheduled(cron = "0 0 6 * * *")
638
    public void sendSamsungRebilling() throws Throwable {
639
        scheduledTasks.sendMailForSamsungRebilling();
640
    }
31931 amit.gupta 641
 
32048 tejbeer 642
    @Scheduled(cron = "0 10 8 * * *")
643
    public void sendMailForAgeingAlert() throws Throwable {
644
        scheduledTasks.sendMailForAgeingAlert();
645
    }
646
 
647
    @Scheduled(cron = "0 0 8 * * *")
648
    public void sendFilteredRetailerPerformance() throws Throwable {
649
        scheduledTasks.sendFilteredRetailerPerformance();
650
    }
32690 amit.gupta 651
 
33444 ranu 652
    @Scheduled(cron = "0 0 0 * * MON")
653
    public void findAllLiveDemoBrandItemsByBillingDate() throws Throwable {
654
        scheduledTasks.findAllLiveDemoBrandItemsByBillingDate();
655
    }
34241 tejus.loha 656
 
33464 ranu 657
    @Scheduled(cron = "0 10 6 * * *")
658
    public void findTodayPocoBillingItems() throws Throwable {
659
        scheduledTasks.findTodayPocoBillingItems();
660
    }
32690 amit.gupta 661
 
662
    @Scheduled(cron = "0 0 12 * * *")
663
    public void rejectPriceDropsOfApprovedImeis() throws Throwable {
37083 amit 664
        batchScheduledTasks.reprocessPriceDropsWithBatch();
32690 amit.gupta 665
    }
32907 amit.gupta 666
 
667
    @Autowired
668
    POScheduler poScheduler;
34241 tejus.loha 669
 
32907 amit.gupta 670
    @Scheduled(cron = "0 0 1 * * *")
33643 amit.gupta 671
    public void autoClosePO() {
32907 amit.gupta 672
        poScheduler.autoClosePurchaseOrders();
673
    }
32048 tejbeer 674
    /*
675
     * @Scheduled(cron = "0 0 9 * * *") public void onBoardingDocumentsPending()
676
     * throws Throwable { log.info("startTime" + LocalDateTime.now());
677
     * onBoardingRelatedSchelduleTask.onBoardingDocumentsPending();
678
     * log.info("endTime" + LocalDateTime.now()); }
679
     */
34443 vikas.jang 680
 
34547 vikas.jang 681
    @Scheduled(cron = "0 50 23 * * *")
34443 vikas.jang 682
    public void bidConfirmation() throws Throwable {
34547 vikas.jang 683
        log.info("running bid cron at 23:50PM");
34443 vikas.jang 684
        runOnceTasks.processBids(ProfitMandiConstants.BID_CRON_ENUM.YESTERDAY);
685
    }
686
 
34547 vikas.jang 687
    @Scheduled(cron = "0 0 19 * * *")
34443 vikas.jang 688
    public void processLiquidationBids() throws Throwable {
34547 vikas.jang 689
        log.info("running bid cron at 07:00PM");
34443 vikas.jang 690
        runOnceTasks.processBids(ProfitMandiConstants.BID_CRON_ENUM.TODAY);
691
    }
692
 
34547 vikas.jang 693
    @Scheduled(cron = "0 30 21 * * *")
34443 vikas.jang 694
    public void bidPurchaseOrder() throws Throwable {
34547 vikas.jang 695
        log.info("running bid cron at 09:30PM");
34443 vikas.jang 696
        runOnceTasks.processBids(ProfitMandiConstants.BID_CRON_ENUM.TODAY);
697
    }
34547 vikas.jang 698
 
34669 amit.gupta 699
    /*@Scheduled(cron = "0 0 12 * * *")
700
    public void processCashDiscount() throws Throwable {
701
        scheduledTasks.processCashDiscount();
702
    }*/
703
 
34563 vikas.jang 704
    @Scheduled(cron = "0 0 9,17 * * *")
34547 vikas.jang 705
    public void bidConsolidatedMessage() throws Throwable {
706
        log.info("Running bid cron at 09:00 AM or 05:00 PM");
707
        runOnceTasks.consolidatedBiddingMessage();
34563 vikas.jang 708
    }
34770 vikas.jang 709
 
710
    @Scheduled(cron = "0 0 8 * * *")
34836 vikas 711
    public void yesterdayTrackingReport() throws Throwable {
712
        log.info("Running yesterday employee tracking cron at 08:00 AM");
713
        runOnceTasks.yesterdayTrackingReport();
34770 vikas.jang 714
    }
34836 vikas 715
 
35178 amit 716
    @Scheduled(cron = "0 10 8 * * *")
35177 amit 717
    public void partnerCreditExposureReport() throws Throwable {
718
        log.info("Running yesterday employee tracking cron at 08:00 AM");
719
        runOnceTasks.sendCreditExposureReport();
720
    }
721
 
36552 ranu 722
    @Scheduled(cron = "0 0 22,16 * * *")
34836 vikas 723
    public void dailyTrackingReport() throws Throwable {
36552 ranu 724
        log.info("Running daily employee tracking cron at 10:00 PM and 04:00 PM");
34836 vikas 725
        runOnceTasks.dailyTrackingReport();
726
    }
35105 vikas 727
 
34792 amit.gupta 728
    @Scheduled(cron = "0 0 0 1 1,4,7,10 *")
729
    public void sendUpdateMobileBrandMarketShareQuaterlyMail() throws Throwable {
34791 aman.kumar 730
        log.info("Running Marketshare update remined quaterly");
731
        scheduledTasks.sendUpdateMobileBrandMarketShareQuaterlyMail();
732
    }
35105 vikas 733
 
734
    @Scheduled(cron = "0 0 * * * *")
735
    public void checkRewardsEligibility() throws Throwable {
736
        log.info("Running Rewards Disburse daily");
737
        runOnceTasks.checkRewardsEligibility();
738
    }
35326 amit 739
 
740
    @Scheduled(cron="0 0 20 * * *")
741
    public void sendTrialExpiry() {
742
        scheduledTasks.sendTrialExpiry();
743
    }
35666 vikas 744
 
745
    @Scheduled(cron = "0 0 0 * * *")
746
    public void fetchOffersByItem() {
747
        scheduledTasks.cachePinelabsOffers();
748
    }
35788 vikas 749
 
750
    @Scheduled(cron = "0 0 0 * * *")
751
    public void syncProductsToShopify() throws Exception {
36058 ranu 752
        scheduledTasks.syncProductsToShopifyByWarehouseId(ProfitMandiConstants.WAREHOUSE_NAME_MAP.get("UP-WEST/NOIDA"));
35788 vikas 753
    }
36511 amit 754
 
37162 vikas 755
    @Scheduled(cron = "0 0 6,18 * * *")
756
    public void syncInventoryToShopify() throws Exception {
757
        scheduledTasks.syncInventoryToShopifyByWarehouseId(ProfitMandiConstants.WAREHOUSE_NAME_MAP.get("UP-WEST/NOIDA"));
758
    }
759
 
36511 amit 760
    @Autowired
761
    private WarehouseStockReconciliation warehouseStockReconciliation;
762
 
763
    @Scheduled(cron = "0 30 5 * * *")
764
    public void reconcileInventorySnapshot() throws Exception {
765
        log.info("reconcileInventorySnapshot");
766
        warehouseStockReconciliation.reconcile();
767
    }
37159 amit 768
 
769
    @Autowired
770
    private PartnerIdentityIntegrityMonitor partnerIdentityIntegrityMonitor;
771
 
772
    @Scheduled(cron = "0 0 7 * * *")
773
    public void partnerIdentityIntegrityMonitor() throws Exception {
774
        log.info("partnerIdentityIntegrityMonitor");
775
        partnerIdentityIntegrityMonitor.monitor();
776
    }
23756 amit.gupta 777
}