| 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;
|
| 24135 |
govind |
6 |
import java.util.List;
|
| 24121 |
govind |
7 |
|
|
|
8 |
import javax.mail.MessagingException;
|
|
|
9 |
|
| 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 |
|
|
|
16 |
import com.smartdukaan.cron.monitored.NagiosMonitorTasks;
|
| 24121 |
govind |
17 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 24135 |
govind |
18 |
import com.spice.profitmandi.dao.entity.fofo.SaleHeadDetails;
|
|
|
19 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 23756 |
amit.gupta |
20 |
|
|
|
21 |
@Component
|
|
|
22 |
public class ScheduledSkeleton {
|
| 23794 |
govind |
23 |
|
| 23756 |
amit.gupta |
24 |
private static final Logger log = LogManager.getLogger(ScheduledSkeleton.class);
|
|
|
25 |
|
|
|
26 |
@Autowired
|
|
|
27 |
ScheduledTasks scheduledTasks;
|
|
|
28 |
|
|
|
29 |
@Autowired
|
|
|
30 |
NagiosMonitorTasks nagiosMonitorTasks;
|
| 24135 |
govind |
31 |
|
|
|
32 |
@Autowired
|
|
|
33 |
private FofoStoreRepository fofoStoreRepository;
|
| 23756 |
amit.gupta |
34 |
|
| 23761 |
amit.gupta |
35 |
@Scheduled(cron = "0 15 0 * * *")
|
| 23756 |
amit.gupta |
36 |
public void reconcileRecharge() throws Exception {
|
|
|
37 |
scheduledTasks.reconcileRecharge();
|
|
|
38 |
}
|
|
|
39 |
|
| 23759 |
amit.gupta |
40 |
@Scheduled(cron = "0 05 0 1,16 * ?")
|
| 23756 |
amit.gupta |
41 |
public void processRechargeCashback() throws Throwable {
|
|
|
42 |
scheduledTasks.processRechargeCashback();
|
|
|
43 |
}
|
| 23794 |
govind |
44 |
|
|
|
45 |
/*
|
|
|
46 |
* Value so big so that it got to run only once.
|
| 23756 |
amit.gupta |
47 |
*
|
|
|
48 |
*/
|
| 23929 |
amit.gupta |
49 |
|
|
|
50 |
@Scheduled(cron = "0 0 9 * * *")
|
| 23794 |
govind |
51 |
public void migrateLineItems() throws Throwable {
|
| 23756 |
amit.gupta |
52 |
log.info("Started run Once");
|
| 23929 |
amit.gupta |
53 |
scheduledTasks.sendPartnerInvestmentDetails();
|
| 23756 |
amit.gupta |
54 |
}
|
| 24131 |
govind |
55 |
|
| 24136 |
govind |
56 |
@Scheduled(cron = " 0 0 23 ? * *")
|
| 24131 |
govind |
57 |
public void sendMail() throws MessagingException, ProfitMandiBusinessException, IOException {
|
| 24121 |
govind |
58 |
log.info("sending mail");
|
| 24131 |
govind |
59 |
String message = MessageFormat.format("Sale Target summary for {0}", LocalDate.now());
|
| 24135 |
govind |
60 |
List<SaleHeadDetails> saleHeadDetails=fofoStoreRepository.selectAllSalesHeadDetails();
|
|
|
61 |
for(SaleHeadDetails saleHeadDetail:saleHeadDetails)
|
|
|
62 |
{
|
|
|
63 |
if(saleHeadDetail.getName().equals("Kamal"))
|
|
|
64 |
{
|
| 24136 |
govind |
65 |
String[] to= {saleHeadDetail.getEmail(),"mohinder.mutreja@smartdukaan.com"};
|
| 24135 |
govind |
66 |
scheduledTasks.sendMailWithAttachmentsForSalesHead(to, "Daily Sale Report", message,saleHeadDetail.getName());
|
|
|
67 |
}
|
|
|
68 |
else
|
|
|
69 |
{
|
| 24136 |
govind |
70 |
String[] to= {saleHeadDetail.getEmail()};
|
| 24135 |
govind |
71 |
scheduledTasks.sendMailWithAttachmentsForSalesHead(to, "Daily Sale Report", message,saleHeadDetail.getName());
|
|
|
72 |
}
|
|
|
73 |
}
|
|
|
74 |
|
| 24121 |
govind |
75 |
}
|
| 23756 |
amit.gupta |
76 |
}
|