Subversion Repositories SmartDukaan

Rev

Rev 23929 | Rev 24131 | 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;
4
import java.text.MessageFormat;
5
import java.time.LocalDate;
6
 
7
import javax.mail.MessagingException;
8
 
23756 amit.gupta 9
import org.apache.logging.log4j.LogManager;
10
import org.apache.logging.log4j.Logger;
11
import org.springframework.beans.factory.annotation.Autowired;
12
import org.springframework.scheduling.annotation.Scheduled;
13
import org.springframework.stereotype.Component;
14
 
15
import com.smartdukaan.cron.monitored.NagiosMonitorTasks;
24121 govind 16
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
23756 amit.gupta 17
 
18
@Component
19
public class ScheduledSkeleton {
23794 govind 20
 
23756 amit.gupta 21
	private static final Logger log = LogManager.getLogger(ScheduledSkeleton.class);
22
 
23
	@Autowired
24
	ScheduledTasks scheduledTasks;
25
 
26
	@Autowired
27
	NagiosMonitorTasks nagiosMonitorTasks;
28
 
23761 amit.gupta 29
	@Scheduled(cron = "0 15 0 * * *")
23756 amit.gupta 30
	public void reconcileRecharge() throws Exception {
31
		scheduledTasks.reconcileRecharge();
32
	}
33
 
23759 amit.gupta 34
	@Scheduled(cron = "0 05 0 1,16 * ?")
23756 amit.gupta 35
	public void processRechargeCashback() throws Throwable {
36
		scheduledTasks.processRechargeCashback();
37
	}
23794 govind 38
 
39
	/*
40
	 * Value so big so that it got to run only once.
23756 amit.gupta 41
	 * 
42
	 */
23929 amit.gupta 43
 
44
	@Scheduled(cron = "0 0 9 * * *")
23794 govind 45
	public void migrateLineItems() throws Throwable {
23756 amit.gupta 46
		log.info("Started run Once");
23929 amit.gupta 47
		scheduledTasks.sendPartnerInvestmentDetails();
23756 amit.gupta 48
	}
24121 govind 49
 
50
	@Scheduled(cron="0 0 23 * * ?")
51
	public void sendMail() throws MessagingException, ProfitMandiBusinessException, IOException
52
	{
53
		log.info("sending mail");
54
		String message=MessageFormat.format("Sale Target summary for {1}", LocalDate.now());
55
		scheduledTasks.sendMailWithAttachments("adeel.yazdani@smartdukaan.com", "Daily Sale Report", message);
56
	}
23756 amit.gupta 57
}