Subversion Repositories SmartDukaan

Rev

Rev 24655 | Rev 24664 | 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
 
24420 amit.gupta 36
	@Scheduled(cron = "0 0 1 * * *")
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
 
24568 amit.gupta 51
	/*@Scheduled(cron = "0 0 1 * * *")
23794 govind 52
	public void migrateLineItems() throws Throwable {
23756 amit.gupta 53
		log.info("Started run Once");
23929 amit.gupta 54
		scheduledTasks.sendPartnerInvestmentDetails();
24568 amit.gupta 55
	}*/
24131 govind 56
 
24420 amit.gupta 57
	@Scheduled(cron = " 0 0 23 * * *")
24131 govind 58
	public void sendMail() throws MessagingException, ProfitMandiBusinessException, IOException {
24121 govind 59
		log.info("sending mail");
24188 govind 60
 
61
		List<SaleHeadDetails> saleHeadDetails = fofoStoreRepository.selectAllSalesHeadDetails();
62
		for (SaleHeadDetails saleHeadDetail : saleHeadDetails) {
24174 govind 63
			scheduledTasks.sendMailToSalesHeadAboutTargetAndSales(saleHeadDetail);
24135 govind 64
		}
24188 govind 65
 
24121 govind 66
	}
24188 govind 67
 
24420 amit.gupta 68
	@Scheduled(cron = "0 30 23 * * *")
24188 govind 69
	public void sendMailToPartner() throws MessagingException, ProfitMandiBusinessException, IOException,
70
			EncryptedDocumentException, InvalidFormatException {
71
		log.info("sending mail To Partner");
72
 
73
		scheduledTasks.sendMailToPartnerAboutTargetAndSales();
74
	}
24564 amit.gupta 75
	@Scheduled(cron="0 0/30 * * * *")
24533 govind 76
	public void escalateTicket() throws ProfitMandiBusinessException
77
	{
24653 govind 78
		log.info("escalate ticket");
24533 govind 79
		scheduledTasks.escalateTicket();
80
	}
24653 govind 81
	@Scheduled(cron="0 30 10 * * *")
82
	public void alertTicketToUser() throws Exception
83
	{
84
		log.info("alert for ticket");
85
		scheduledTasks.alertforTicket();
86
	}
24657 govind 87
	@Scheduled(cron="0 0 15,19,21 ? * *")
24653 govind 88
	public void dailySaleNotification() throws Exception
89
	{
90
		log.info("daily send Notification");
91
		scheduledTasks.sendDailySalesReportNotificationToPartner();
92
	}
93
 
23756 amit.gupta 94
}