Subversion Repositories SmartDukaan

Rev

Rev 24564 | Rev 24653 | 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;
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 {
24568 amit.gupta 40
		scheduledTasks.processScheme(LocalDateTime.now().minusDays(21), LocalDateTime.now());
24420 amit.gupta 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
 
24568 amit.gupta 53
	/*@Scheduled(cron = "0 0 1 * * *")
23794 govind 54
	public void migrateLineItems() throws Throwable {
23756 amit.gupta 55
		log.info("Started run Once");
23929 amit.gupta 56
		scheduledTasks.sendPartnerInvestmentDetails();
24568 amit.gupta 57
	}*/
24131 govind 58
 
24420 amit.gupta 59
	@Scheduled(cron = " 0 0 23 * * *")
24131 govind 60
	public void sendMail() throws MessagingException, ProfitMandiBusinessException, IOException {
24121 govind 61
		log.info("sending mail");
24188 govind 62
 
63
		List<SaleHeadDetails> saleHeadDetails = fofoStoreRepository.selectAllSalesHeadDetails();
64
		for (SaleHeadDetails saleHeadDetail : saleHeadDetails) {
24174 govind 65
			scheduledTasks.sendMailToSalesHeadAboutTargetAndSales(saleHeadDetail);
24135 govind 66
		}
24188 govind 67
 
24121 govind 68
	}
24188 govind 69
 
24420 amit.gupta 70
	@Scheduled(cron = "0 30 23 * * *")
24188 govind 71
	public void sendMailToPartner() throws MessagingException, ProfitMandiBusinessException, IOException,
72
			EncryptedDocumentException, InvalidFormatException {
73
		log.info("sending mail To Partner");
74
 
75
		scheduledTasks.sendMailToPartnerAboutTargetAndSales();
76
	}
24564 amit.gupta 77
	@Scheduled(cron="0 0/30 * * * *")
24533 govind 78
	public void escalateTicket() throws ProfitMandiBusinessException
79
	{
80
		scheduledTasks.escalateTicket();
81
	}
23756 amit.gupta 82
}