Subversion Repositories SmartDukaan

Rev

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

Rev 25407 Rev 25418
Line 23... Line 23...
23
import javax.mail.MessagingException;
23
import javax.mail.MessagingException;
24
import javax.mail.internet.InternetAddress;
24
import javax.mail.internet.InternetAddress;
25
import javax.mail.internet.MimeMessage;
25
import javax.mail.internet.MimeMessage;
26
 
26
 
27
import org.apache.commons.io.output.ByteArrayOutputStream;
27
import org.apache.commons.io.output.ByteArrayOutputStream;
-
 
28
import org.apache.commons.lang3.ArrayUtils;
28
import org.apache.http.client.methods.CloseableHttpResponse;
29
import org.apache.http.client.methods.CloseableHttpResponse;
29
import org.apache.http.client.methods.HttpPost;
30
import org.apache.http.client.methods.HttpPost;
30
import org.apache.http.entity.StringEntity;
31
import org.apache.http.entity.StringEntity;
31
import org.apache.http.impl.client.CloseableHttpClient;
32
import org.apache.http.impl.client.CloseableHttpClient;
32
import org.apache.http.impl.client.HttpClients;
33
import org.apache.http.impl.client.HttpClients;
Line 740... Line 741...
740
				"aeging-report-" + FormattingUtils.formatDate(LocalDateTime.now().minusDays(1)) + ".csv", isr);
741
				"aeging-report-" + FormattingUtils.formatDate(LocalDateTime.now().minusDays(1)) + ".csv", isr);
741
		Attachment attachment1 = new Attachment(
742
		Attachment attachment1 = new Attachment(
742
				"aeging-report-" + FormattingUtils.formatDate(LocalDateTime.now().minusDays(1)) + ".csv", isr1);
743
				"aeging-report-" + FormattingUtils.formatDate(LocalDateTime.now().minusDays(1)) + ".csv", isr1);
743
		Utils.sendMailWithAttachments(googleMailSender, sendTo, null, "Stock Aeging Report", "PFA", attachment,
744
		Utils.sendMailWithAttachments(googleMailSender, sendTo, null, "Stock Aeging Report", "PFA", attachment,
744
				attachment1);
745
				attachment1);
-
 
746
 
-
 
747
		//Reports to be sent to mapped partners
745
		Set<String> storeGuys = getStoreGuyMap().keySet();
748
		Map<String, Set<String>> storeGuysMap = getStoreGuyMap();
746
		
749
		
747
		String[] sendToArray = new String[storeGuys.size()];
750
		String[] sendToArray = new String[storeGuysMap.size()];
-
 
751
		int i=0;
-
 
752
		for(String storeGuyName : storeGuysMap.keySet()) {
-
 
753
			sendToArray[i]= nameEmail.get(storeGuyName);
-
 
754
			i++;
-
 
755
		}
748
		Utils.sendMailWithAttachments(googleMailSender, sendToArray, null, "Stock Aeging Report", "PFA", attachment);
756
		Utils.sendMailWithAttachments(googleMailSender, sendToArray, null, "Stock Aeging Report", "PFA", attachment);
749
		
757
		
-
 
758
		
-
 
759
		for(Map.Entry<String, Set<String>> storeGuyEntry: storeGuysMap.entrySet()) {
-
 
760
			Map<String, String> params = new HashMap<>();
-
 
761
			params.put("MANUAL_email", String.join(",", storeGuyEntry.getValue()));
-
 
762
			InputStreamSource isr3 = reporticoService.getReportInputStreamSource(ReporticoProject.FOCO,
-
 
763
					"focostockreport.xml", params);
-
 
764
			Attachment attache = new Attachment(
-
 
765
					"aeging-report-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv", isr3);
-
 
766
			Utils.sendMailWithAttachments(googleMailSender, new String[] {}, null, "Partner Stock Report", "PFA", attache);
-
 
767
		}
-
 
768
		
750
	}
769
	}
751
 
770
 
752
	public void sendAgeingReport() throws Exception {
771
	public void sendAgeingReport() throws Exception {
753
		sendAgeingReport("amod.sen@smartdukaan.com", "adeel.yazdani@smartdukaan.com", "kamini.sharma@smartdukaan.com",
772
		sendAgeingReport("kamini.sharma@smartdukaan.com",
754
				"tarun.verma@smartdukaan.com", "chaitnaya.vats@smartdukaan.com", "mohinder.mutreja@smartdukaan.com");
773
				"tarun.verma@smartdukaan.com", "chaitnaya.vats@smartdukaan.com");
755
	}
774
	}
756
 
775
 
757
	public void moveImeisToPriceDropImeis() throws Exception {
776
	public void moveImeisToPriceDropImeis() throws Exception {
758
		List<PriceDrop> priceDrops = priceDropRepository.selectAll();
777
		List<PriceDrop> priceDrops = priceDropRepository.selectAll();
759
		for (PriceDrop priceDrop : priceDrops) {
778
		for (PriceDrop priceDrop : priceDrops) {