Subversion Repositories SmartDukaan

Rev

Rev 24679 | Rev 24784 | 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
 
24121 govind 3
import java.io.IOException;
24420 amit.gupta 4
import java.time.LocalDateTime;
24135 govind 5
import java.util.List;
24121 govind 6
 
7
import javax.mail.MessagingException;
8
 
23756 amit.gupta 9
import org.apache.logging.log4j.LogManager;
10
import org.apache.logging.log4j.Logger;
24188 govind 11
import org.apache.poi.EncryptedDocumentException;
12
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
23756 amit.gupta 13
import org.springframework.beans.factory.annotation.Autowired;
14
import org.springframework.scheduling.annotation.Scheduled;
15
import org.springframework.stereotype.Component;
16
 
17
import com.smartdukaan.cron.monitored.NagiosMonitorTasks;
24121 govind 18
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
24135 govind 19
import com.spice.profitmandi.dao.entity.fofo.SaleHeadDetails;
20
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
23756 amit.gupta 21
 
22
@Component
23
public class ScheduledSkeleton {
23794 govind 24
 
23756 amit.gupta 25
	private static final Logger log = LogManager.getLogger(ScheduledSkeleton.class);
26
 
27
	@Autowired
28
	ScheduledTasks scheduledTasks;
29
 
30
	@Autowired
31
	NagiosMonitorTasks nagiosMonitorTasks;
24188 govind 32
 
24135 govind 33
	@Autowired
34
	private FofoStoreRepository fofoStoreRepository;
23756 amit.gupta 35
 
24679 amit.gupta 36
	@Scheduled(cron = "0 0 2 * * *")
24420 amit.gupta 37
	public void processDailySchemes() throws Exception {
24568 amit.gupta 38
		scheduledTasks.processScheme(LocalDateTime.now().minusDays(21), LocalDateTime.now());
24420 amit.gupta 39
	}
40
 
23761 amit.gupta 41
	@Scheduled(cron = "0 15 0 * * *")
23756 amit.gupta 42
	public void reconcileRecharge() throws Exception {
43
		scheduledTasks.reconcileRecharge();
44
	}
45
 
23759 amit.gupta 46
	@Scheduled(cron = "0 05 0 1,16 * ?")
23756 amit.gupta 47
	public void processRechargeCashback() throws Throwable {
48
		scheduledTasks.processRechargeCashback();
49
	}
23794 govind 50
 
24679 amit.gupta 51
	@Scheduled(cron = "0 0 1 * * *")
24681 amit.gupta 52
	public void sendPartnerInvestmentDetails() throws Throwable {
23929 amit.gupta 53
		scheduledTasks.sendPartnerInvestmentDetails();
24679 amit.gupta 54
	}
24681 amit.gupta 55
 
56
	@Scheduled(cron = "0 0 8 * * *")
57
	public void sendStockAgeingReport() throws Throwable {
58
		scheduledTasks.sendAgeingReport();
59
	}
24131 govind 60
 
24420 amit.gupta 61
	@Scheduled(cron = " 0 0 23 * * *")
24131 govind 62
	public void sendMail() throws MessagingException, ProfitMandiBusinessException, IOException {
24121 govind 63
		log.info("sending mail");
24188 govind 64
 
65
		List<SaleHeadDetails> saleHeadDetails = fofoStoreRepository.selectAllSalesHeadDetails();
66
		for (SaleHeadDetails saleHeadDetail : saleHeadDetails) {
24174 govind 67
			scheduledTasks.sendMailToSalesHeadAboutTargetAndSales(saleHeadDetail);
24135 govind 68
		}
24188 govind 69
 
24121 govind 70
	}
24188 govind 71
 
24420 amit.gupta 72
	@Scheduled(cron = "0 30 23 * * *")
24188 govind 73
	public void sendMailToPartner() throws MessagingException, ProfitMandiBusinessException, IOException,
74
			EncryptedDocumentException, InvalidFormatException {
75
		log.info("sending mail To Partner");
76
 
77
		scheduledTasks.sendMailToPartnerAboutTargetAndSales();
78
	}
24564 amit.gupta 79
	@Scheduled(cron="0 0/30 * * * *")
24533 govind 80
	public void escalateTicket() throws ProfitMandiBusinessException
81
	{
24653 govind 82
		log.info("escalate ticket");
24533 govind 83
		scheduledTasks.escalateTicket();
84
	}
24664 govind 85
	@Scheduled(cron="0 0 11 * * *")
24653 govind 86
	public void alertTicketToUser() throws Exception
87
	{
88
		log.info("alert for ticket");
89
		scheduledTasks.alertforTicket();
90
	}
24678 govind 91
	@Scheduled(cron="0 0 15,17,19,23 ? * *")
24653 govind 92
	public void dailySaleNotification() throws Exception
93
	{
94
		log.info("daily send Notification");
95
		scheduledTasks.sendDailySalesReportNotificationToPartner();
96
	}
97
 
23756 amit.gupta 98
}