| 23756 |
amit.gupta |
1 |
package com.smartdukaan.cron.scheduled;
|
|
|
2 |
|
| 24121 |
govind |
3 |
import java.io.IOException;
|
|
|
4 |
import java.text.MessageFormat;
|
|
|
5 |
import java.time.LocalDate;
|
| 24420 |
amit.gupta |
6 |
import java.time.LocalDateTime;
|
| 24135 |
govind |
7 |
import java.util.List;
|
| 24121 |
govind |
8 |
|
|
|
9 |
import javax.mail.MessagingException;
|
|
|
10 |
|
| 23756 |
amit.gupta |
11 |
import org.apache.logging.log4j.LogManager;
|
|
|
12 |
import org.apache.logging.log4j.Logger;
|
| 24188 |
govind |
13 |
import org.apache.poi.EncryptedDocumentException;
|
|
|
14 |
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
| 23756 |
amit.gupta |
15 |
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
16 |
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
17 |
import org.springframework.stereotype.Component;
|
|
|
18 |
|
|
|
19 |
import com.smartdukaan.cron.monitored.NagiosMonitorTasks;
|
| 24121 |
govind |
20 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 24135 |
govind |
21 |
import com.spice.profitmandi.dao.entity.fofo.SaleHeadDetails;
|
|
|
22 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 23756 |
amit.gupta |
23 |
|
|
|
24 |
@Component
|
|
|
25 |
public class ScheduledSkeleton {
|
| 23794 |
govind |
26 |
|
| 23756 |
amit.gupta |
27 |
private static final Logger log = LogManager.getLogger(ScheduledSkeleton.class);
|
|
|
28 |
|
|
|
29 |
@Autowired
|
|
|
30 |
ScheduledTasks scheduledTasks;
|
|
|
31 |
|
|
|
32 |
@Autowired
|
|
|
33 |
NagiosMonitorTasks nagiosMonitorTasks;
|
| 24188 |
govind |
34 |
|
| 24135 |
govind |
35 |
@Autowired
|
|
|
36 |
private FofoStoreRepository fofoStoreRepository;
|
| 23756 |
amit.gupta |
37 |
|
| 24420 |
amit.gupta |
38 |
@Scheduled(cron = "0 0 1 * * *")
|
|
|
39 |
public void processDailySchemes() throws Exception {
|
|
|
40 |
scheduledTasks.processScheme(LocalDateTime.now().minusDays(2), LocalDateTime.now());
|
|
|
41 |
}
|
|
|
42 |
|
| 23761 |
amit.gupta |
43 |
@Scheduled(cron = "0 15 0 * * *")
|
| 23756 |
amit.gupta |
44 |
public void reconcileRecharge() throws Exception {
|
|
|
45 |
scheduledTasks.reconcileRecharge();
|
|
|
46 |
}
|
|
|
47 |
|
| 23759 |
amit.gupta |
48 |
@Scheduled(cron = "0 05 0 1,16 * ?")
|
| 23756 |
amit.gupta |
49 |
public void processRechargeCashback() throws Throwable {
|
|
|
50 |
scheduledTasks.processRechargeCashback();
|
|
|
51 |
}
|
| 23794 |
govind |
52 |
|
|
|
53 |
/*
|
|
|
54 |
* Value so big so that it got to run only once.
|
| 23756 |
amit.gupta |
55 |
*
|
|
|
56 |
*/
|
| 23929 |
amit.gupta |
57 |
|
| 24420 |
amit.gupta |
58 |
@Scheduled(cron = "0 0 1 * * *")
|
| 23794 |
govind |
59 |
public void migrateLineItems() throws Throwable {
|
| 23756 |
amit.gupta |
60 |
log.info("Started run Once");
|
| 23929 |
amit.gupta |
61 |
scheduledTasks.sendPartnerInvestmentDetails();
|
| 23756 |
amit.gupta |
62 |
}
|
| 24131 |
govind |
63 |
|
| 24420 |
amit.gupta |
64 |
@Scheduled(cron = " 0 0 23 * * *")
|
| 24131 |
govind |
65 |
public void sendMail() throws MessagingException, ProfitMandiBusinessException, IOException {
|
| 24121 |
govind |
66 |
log.info("sending mail");
|
| 24188 |
govind |
67 |
|
|
|
68 |
List<SaleHeadDetails> saleHeadDetails = fofoStoreRepository.selectAllSalesHeadDetails();
|
|
|
69 |
for (SaleHeadDetails saleHeadDetail : saleHeadDetails) {
|
| 24174 |
govind |
70 |
scheduledTasks.sendMailToSalesHeadAboutTargetAndSales(saleHeadDetail);
|
| 24135 |
govind |
71 |
}
|
| 24188 |
govind |
72 |
|
| 24121 |
govind |
73 |
}
|
| 24188 |
govind |
74 |
|
| 24420 |
amit.gupta |
75 |
@Scheduled(cron = "0 30 23 * * *")
|
| 24188 |
govind |
76 |
public void sendMailToPartner() throws MessagingException, ProfitMandiBusinessException, IOException,
|
|
|
77 |
EncryptedDocumentException, InvalidFormatException {
|
|
|
78 |
log.info("sending mail To Partner");
|
|
|
79 |
|
|
|
80 |
scheduledTasks.sendMailToPartnerAboutTargetAndSales();
|
|
|
81 |
}
|
| 24540 |
govind |
82 |
@Scheduled(cron="0 0/30 * 1/1 * ?")
|
| 24533 |
govind |
83 |
public void escalateTicket() throws ProfitMandiBusinessException
|
|
|
84 |
{
|
|
|
85 |
scheduledTasks.escalateTicket();
|
|
|
86 |
}
|
| 23756 |
amit.gupta |
87 |
}
|