Subversion Repositories SmartDukaan

Rev

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

Rev 24691 Rev 24692
Line 28... Line 28...
28
import javax.mail.internet.MimeMessage;
28
import javax.mail.internet.MimeMessage;
29
 
29
 
30
import org.apache.commons.codec.CharEncoding;
30
import org.apache.commons.codec.CharEncoding;
31
import org.apache.commons.io.IOUtils;
31
import org.apache.commons.io.IOUtils;
32
import org.apache.commons.io.output.ByteArrayOutputStream;
32
import org.apache.commons.io.output.ByteArrayOutputStream;
33
import org.apache.http.HttpEntity;
-
 
34
import org.apache.http.HttpResponse;
-
 
35
import org.apache.logging.log4j.LogManager;
33
import org.apache.logging.log4j.LogManager;
36
import org.apache.logging.log4j.Logger;
34
import org.apache.logging.log4j.Logger;
37
import org.apache.poi.EncryptedDocumentException;
35
import org.apache.poi.EncryptedDocumentException;
38
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
36
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
39
import org.springframework.beans.factory.annotation.Autowired;
37
import org.springframework.beans.factory.annotation.Autowired;
40
import org.springframework.beans.factory.annotation.Qualifier;
38
import org.springframework.beans.factory.annotation.Qualifier;
41
import org.springframework.beans.factory.annotation.Value;
39
import org.springframework.beans.factory.annotation.Value;
42
import org.springframework.core.io.ByteArrayResource;
40
import org.springframework.core.io.ByteArrayResource;
-
 
41
import org.springframework.core.io.InputStreamSource;
43
import org.springframework.mail.javamail.JavaMailSender;
42
import org.springframework.mail.javamail.JavaMailSender;
44
import org.springframework.mail.javamail.MimeMessageHelper;
43
import org.springframework.mail.javamail.MimeMessageHelper;
45
import org.springframework.stereotype.Component;
44
import org.springframework.stereotype.Component;
46
import org.springframework.transaction.annotation.Transactional;
45
import org.springframework.transaction.annotation.Transactional;
47
 
46
 
Line 699... Line 698...
699
 
698
 
700
		}
699
		}
701
	}
700
	}
702
 
701
 
703
	public void sendAgeingReport() throws Exception {
702
	public void sendAgeingReport() throws Exception {
-
 
703
 
704
		HttpResponse response = reporticoService.getReportFile(ReporticoProject.WAREHOUSENEW, "itemstockageing.xml");
704
		InputStreamSource isr = reporticoService.getReportInputStreamSource(ReporticoProject.WAREHOUSENEW,
705
		HttpEntity respsonseEntity = response.getEntity();
-
 
706
		byte[] buffer = new byte[respsonseEntity.getContent().available()];
-
 
707
		respsonseEntity.getContent().read(buffer);
705
				"itemstockageing.xml");
708
		String[] to = { "amod.sen@smartdukaan.com", "adeel.yazdani@smartdukaan.com", "kamini.sharma@smartdukaan.com",
706
		String[] to = { "amod.sen@smartdukaan.com", "adeel.yazdani@smartdukaan.com", "kamini.sharma@smartdukaan.com",
709
				"tarun.verma@smartdukaan.com", "chaitnaya.vats@smartdukaan.com", "mohinder.mutreja@smartdukaan.com" };
707
				"tarun.verma@smartdukaan.com", "chaitnaya.vats@smartdukaan.com", "mohinder.mutreja@smartdukaan.com" };
710
		Attachment attachment = new Attachment(
708
		Attachment attachment = new Attachment(
711
				"aeging-report-" + FormattingUtils.formatDate(LocalDateTime.now().minusDays(1)) + ".csv",
709
				"aeging-report-" + FormattingUtils.formatDate(LocalDateTime.now().minusDays(1)) + ".csv", isr);
712
				new ByteArrayResource(buffer));
-
 
713
		Utils.sendMailWithAttachments(googleMailSender, to, null, "Stock Aeging Report", "PFA", attachment);
710
		Utils.sendMailWithAttachments(googleMailSender, to, null, "Stock Aeging Report", "PFA", attachment);
714
	}
711
	}
715
 
712
 
716
	public void moveImeisToPriceDropImeis() throws Exception {
713
	public void moveImeisToPriceDropImeis() throws Exception {
717
		List<PriceDrop> priceDrops = priceDropRepository.selectAll();
714
		List<PriceDrop> priceDrops = priceDropRepository.selectAll();