Subversion Repositories SmartDukaan

Rev

Rev 23929 | Rev 24131 | 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.text.MessageFormat;
import java.time.LocalDate;

import javax.mail.MessagingException;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
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;

@Component
public class ScheduledSkeleton {

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

        @Autowired
        ScheduledTasks scheduledTasks;

        @Autowired
        NagiosMonitorTasks nagiosMonitorTasks;

        @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();
        }

        /*
         * Value so big so that it got to run only once.
         * 
         */

        @Scheduled(cron = "0 0 9 * * *")
        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");
                String message=MessageFormat.format("Sale Target summary for {1}", LocalDate.now());
                scheduledTasks.sendMailWithAttachments("adeel.yazdani@smartdukaan.com", "Daily Sale Report", message);
        }
}