Subversion Repositories SmartDukaan

Rev

Rev 24676 | Rev 24678 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.smartdukaan.cron.scheduled;

import java.io.IOException;
import java.time.LocalDateTime;
import java.util.List;

import javax.mail.MessagingException;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.smartdukaan.cron.monitored.NagiosMonitorTasks;
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
import com.spice.profitmandi.dao.entity.fofo.SaleHeadDetails;
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;

@Component
public class ScheduledSkeleton {

        private static final Logger log = LogManager.getLogger(ScheduledSkeleton.class);

        @Autowired
        ScheduledTasks scheduledTasks;

        @Autowired
        NagiosMonitorTasks nagiosMonitorTasks;

        @Autowired
        private FofoStoreRepository fofoStoreRepository;

        @Scheduled(cron = "0 0 1 * * *")
        public void processDailySchemes() throws Exception {
                scheduledTasks.processScheme(LocalDateTime.now().minusDays(21), LocalDateTime.now());
        }
        
        @Scheduled(cron = "0 15 0 * * *")
        public void reconcileRecharge() throws Exception {
                scheduledTasks.reconcileRecharge();
        }

        @Scheduled(cron = "0 05 0 1,16 * ?")
        public void processRechargeCashback() throws Throwable {
                scheduledTasks.processRechargeCashback();
        }

        /*@Scheduled(cron = "0 0 1 * * *")
        public void migrateLineItems() throws Throwable {
                log.info("Started run Once");
                scheduledTasks.sendPartnerInvestmentDetails();
        }*/

        @Scheduled(cron = " 0 0 23 * * *")
        public void sendMail() throws MessagingException, ProfitMandiBusinessException, IOException {
                log.info("sending mail");

                List<SaleHeadDetails> saleHeadDetails = fofoStoreRepository.selectAllSalesHeadDetails();
                for (SaleHeadDetails saleHeadDetail : saleHeadDetails) {
                        scheduledTasks.sendMailToSalesHeadAboutTargetAndSales(saleHeadDetail);
                }

        }

        @Scheduled(cron = "0 30 23 * * *")
        public void sendMailToPartner() throws MessagingException, ProfitMandiBusinessException, IOException,
                        EncryptedDocumentException, InvalidFormatException {
                log.info("sending mail To Partner");

                scheduledTasks.sendMailToPartnerAboutTargetAndSales();
        }
        @Scheduled(cron="0 0/30 * * * *")
        public void escalateTicket() throws ProfitMandiBusinessException
        {
                log.info("escalate ticket");
                scheduledTasks.escalateTicket();
        }
        @Scheduled(cron="0 0 11 * * *")
        public void alertTicketToUser() throws Exception
        {
                log.info("alert for ticket");
                scheduledTasks.alertforTicket();
        }
        @Scheduled(cron="0 0 15,19,23 ? * *")
        public void dailySaleNotification() throws Exception
        {
                log.info("daily send Notification");
                scheduledTasks.sendDailySalesReportNotificationToPartner();
        }
        
}