Subversion Repositories SmartDukaan

Rev

Rev 24131 | Rev 24136 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 24131 Rev 24135
Line 1... Line 1...
1
package com.smartdukaan.cron.scheduled;
1
package com.smartdukaan.cron.scheduled;
2
 
2
 
3
import java.io.IOException;
3
import java.io.IOException;
4
import java.text.MessageFormat;
4
import java.text.MessageFormat;
5
import java.time.LocalDate;
5
import java.time.LocalDate;
-
 
6
import java.util.List;
6
 
7
 
7
import javax.mail.MessagingException;
8
import javax.mail.MessagingException;
8
 
9
 
9
import org.apache.logging.log4j.LogManager;
10
import org.apache.logging.log4j.LogManager;
10
import org.apache.logging.log4j.Logger;
11
import org.apache.logging.log4j.Logger;
Line 12... Line 13...
12
import org.springframework.scheduling.annotation.Scheduled;
13
import org.springframework.scheduling.annotation.Scheduled;
13
import org.springframework.stereotype.Component;
14
import org.springframework.stereotype.Component;
14
 
15
 
15
import com.smartdukaan.cron.monitored.NagiosMonitorTasks;
16
import com.smartdukaan.cron.monitored.NagiosMonitorTasks;
16
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
17
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
-
 
18
import com.spice.profitmandi.dao.entity.fofo.SaleHeadDetails;
-
 
19
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
17
 
20
 
18
@Component
21
@Component
19
public class ScheduledSkeleton {
22
public class ScheduledSkeleton {
20
 
23
 
21
	private static final Logger log = LogManager.getLogger(ScheduledSkeleton.class);
24
	private static final Logger log = LogManager.getLogger(ScheduledSkeleton.class);
Line 23... Line 26...
23
	@Autowired
26
	@Autowired
24
	ScheduledTasks scheduledTasks;
27
	ScheduledTasks scheduledTasks;
25
 
28
 
26
	@Autowired
29
	@Autowired
27
	NagiosMonitorTasks nagiosMonitorTasks;
30
	NagiosMonitorTasks nagiosMonitorTasks;
-
 
31
	
-
 
32
	@Autowired
-
 
33
	private FofoStoreRepository fofoStoreRepository;
28
 
34
 
29
	@Scheduled(cron = "0 15 0 * * *")
35
	@Scheduled(cron = "0 15 0 * * *")
30
	public void reconcileRecharge() throws Exception {
36
	public void reconcileRecharge() throws Exception {
31
		scheduledTasks.reconcileRecharge();
37
		scheduledTasks.reconcileRecharge();
32
	}
38
	}
Line 45... Line 51...
45
	public void migrateLineItems() throws Throwable {
51
	public void migrateLineItems() throws Throwable {
46
		log.info("Started run Once");
52
		log.info("Started run Once");
47
		scheduledTasks.sendPartnerInvestmentDetails();
53
		scheduledTasks.sendPartnerInvestmentDetails();
48
	}
54
	}
49
 
55
 
50
	@Scheduled(cron = "0 0 23 * * ?")
56
	@Scheduled(cron = "0 */01 * ? * *")
51
	public void sendMail() throws MessagingException, ProfitMandiBusinessException, IOException {
57
	public void sendMail() throws MessagingException, ProfitMandiBusinessException, IOException {
52
		log.info("sending mail");
58
		log.info("sending mail");
53
		String message = MessageFormat.format("Sale Target summary for {0}", LocalDate.now());
59
		String message = MessageFormat.format("Sale Target summary for {0}", LocalDate.now());
54
		String[] to = { "adeel.yazdani@smartdukaan.com", "kamal.kumar@smartdukaan.com",
60
		List<SaleHeadDetails> saleHeadDetails=fofoStoreRepository.selectAllSalesHeadDetails();
-
 
61
		for(SaleHeadDetails saleHeadDetail:saleHeadDetails)
-
 
62
		{
-
 
63
			if(saleHeadDetail.getName().equals("Kamal"))
-
 
64
			{
55
				"mohinder.mutreja@smartdukaan.com", "dhruv.kathpal@smartdukaan.com" };
65
				String[] to= {saleHeadDetail.getEmail(),"dhruv.kathpal@smartdukaan.com","govind.kumar@shop2020.in"};
-
 
66
				scheduledTasks.sendMailWithAttachmentsForSalesHead(to, "Daily Sale Report", message,saleHeadDetail.getName());
-
 
67
			}
-
 
68
			else
56
 
69
			{
-
 
70
			String[] to= {saleHeadDetail.getEmail(),"dhruv.kathpal@smartdukaan.com","govind.kumar@shop2020.in"};
57
		scheduledTasks.sendMailWithAttachments(to, "Daily Sale Report", message);
71
			scheduledTasks.sendMailWithAttachmentsForSalesHead(to, "Daily Sale Report", message,saleHeadDetail.getName());
-
 
72
			}
-
 
73
		}
-
 
74
		
58
	}
75
	}
59
}
76
}