Subversion Repositories SmartDukaan

Rev

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

Rev 9006 Rev 9007
Line 191... Line 191...
191
				if(nextLine[6].length()!=0 && nextLine[6].equalsIgnoreCase("Approved")){
191
				if(nextLine[6].length()!=0 && nextLine[6].equalsIgnoreCase("Approved")){
192
					String status = nextLine[6];	
192
					String status = nextLine[6];	
193
				}
193
				}
194
				else{
194
				else{
195
					if(nextLine[6].length()==0){
195
					if(nextLine[6].length()==0){
-
 
196
						sb.append(orderId+" "+subOrderId + " Could not parse status" +"\n");
-
 
197
						logger.info(orderId+" "+subOrderId + " Could not parse status" +"\n");
-
 
198
					}
-
 
199
					else{
196
						sb.append(orderId+" "+subOrderId + " Order not Approved" +"\n");
200
						sb.append(orderId+" "+subOrderId + "Order not Approved" +"\n");
197
						logger.info(orderId+" "+subOrderId + " Order not Approved" +"\n");
201
						logger.info(orderId+" "+subOrderId + "Order not Approved" +"\n");
198
					}
202
					}
199
					continue;
203
					continue;
200
				}
204
				}
201
				double unitSellingPrice,shippingPrice,octroiFee,emiFee;
205
				double unitSellingPrice,shippingPrice,octroiFee,emiFee;
202
				if(nextLine[7].length()!=0 ){
206
				if(nextLine[7].length()!=0 ){
Line 580... Line 584...
580
			response.setHeader("Content-Type", "text/javascript");
584
			response.setHeader("Content-Type", "text/javascript");
581
 
585
 
582
			ServletOutputStream sos;
586
			ServletOutputStream sos;
583
			try {
587
			try {
584
				sos = response.getOutputStream();
588
				sos = response.getOutputStream();
585
				if(sb.toString().equalsIgnoreCase("")){
589
				if(sb!=null){
586
					sos.write(sb.toString().getBytes());
590
					sos.write(sb.toString().getBytes());
587
				}
591
				}
588
				else{
592
				else{
589
					if(orders_processed!=0){
593
					if(orders_processed!=0){
590
						sos.write("Orders Created Successfully".toString().getBytes());
594
						sos.write("Orders Created Successfully".toString().getBytes());
Line 603... Line 607...
603
			// TODO Auto-generated catch block
607
			// TODO Auto-generated catch block
604
			e.printStackTrace();
608
			e.printStackTrace();
605
		}
609
		}
606
		java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
610
		java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
607
		Calendar cal=GregorianCalendar.getInstance();
611
		Calendar cal=GregorianCalendar.getInstance();
608
		String emailFromAddress = "flipkart-alerts";
612
		String emailFromAddress = "build@shop2020.in";
609
		String password = "cafe@nes";
613
		String password = "cafe@nes";
610
		GmailUtils mailer = new GmailUtils();
614
		GmailUtils mailer = new GmailUtils();
611
		String sendTo[] = new String[]{"vikram.raghav@shop2020.in"};
615
		String sendTo[] = new String[]{"vikram.raghav@shop2020.in"};
612
		/*String sendTo[] = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
616
		/*String sendTo[] = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
613
				"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
617
				"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
614
				"yukti.jain@shop2020.in","manisha.sharma@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
618
				"yukti.jain@shop2020.in","manisha.sharma@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
615
		*/		
619
		*/		
616
		try {
620
		try {
617
			logger.info("Before Sending Emails");
621
			logger.info("Before Sending Emails");
618
			if(sb.toString().equalsIgnoreCase("")){
622
			if(sb!=null){
619
				String emailSubjectTxt = "Flipkart Orders Created Successfully (Check Alerts)"+sdf.format(cal.getTime());
623
				String emailSubjectTxt = "Flipkart Orders Created Successfully (Check Alerts)"+sdf.format(cal.getTime());
620
				mailer.sendSSLMessage(sendTo, emailSubjectTxt, sb.toString(), emailFromAddress, password, new ArrayList<File>());
624
				mailer.sendSSLMessage(sendTo, emailSubjectTxt, sb.toString(), emailFromAddress, password, new ArrayList<File>());
621
				logger.info("Sending Emails Flipkart Orders Created Successfully (Check Alerts)");
625
				logger.info("Sending Emails Flipkart Orders Created Successfully (Check Alerts)");
622
			}
626
			}
623
			else{
627
			else{
624
				if(orders_processed!=0){
628
				if(orders_processed!=0){
625
					String emailSubjectTxt = "Flipkart Orders Created Successfully"+sdf.format(cal.getTime());
629
					String emailSubjectTxt = "Flipkart Orders Created Successfully"+sdf.format(cal.getTime());
626
					mailer.sendSSLMessage(sendTo, emailSubjectTxt,"No Alerts", emailFromAddress, password, new ArrayList<File>());
630
					mailer.sendSSLMessage(sendTo, emailSubjectTxt,"No Alerts", emailFromAddress, password, new ArrayList<File>());
627
					logger.info("Sending Emails Flipkart Orders Created Successfully");
631
					logger.info("Sending Emails Flipkart Orders Created Successfully (Check Alerts)");
628
				}
632
				}
629
				else{
633
				else{
630
					String emailSubjectTxt = "No New Approved Orders"+sdf.format(cal.getTime());
634
					String emailSubjectTxt = "No New Approved Orders"+sdf.format(cal.getTime());
631
					mailer.sendSSLMessage(sendTo, emailSubjectTxt,"No Alerts", emailFromAddress, password, new ArrayList<File>());
635
					mailer.sendSSLMessage(sendTo, emailSubjectTxt,"No Alerts", emailFromAddress, password, new ArrayList<File>());
632
					logger.info("Sending Emails No New Approved Orders");
-
 
633
			
636
			
634
				}
637
				}
635
			}
638
			}
636
 
639
 
637
			}
640
			}
638
			catch (Exception e) {
641
			catch (Exception e) {
639
				e.printStackTrace();
642
				e.printStackTrace();
-
 
643
				logger.error("Exception ",e);
640
			}
644
			}
641
	}
645
	}
642
 
646
 
643
	public static Logger getLogger() {
647
	public static Logger getLogger() {
644
		return logger;
648
		return logger;