Subversion Repositories SmartDukaan

Rev

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

Rev 10176 Rev 10179
Line 69... Line 69...
69
	static String password;
69
	static String password;
70
	static GmailUtils mailer;
70
	static GmailUtils mailer;
71
	static String sendTo[];
71
	static String sendTo[];
72
	private static List<SnapdealItemDetails> snapdealItems = new ArrayList<SnapdealItemDetails>();
72
	private static List<SnapdealItemDetails> snapdealItems = new ArrayList<SnapdealItemDetails>();
73
	private static Map<Long,SnapdealItemDetails> snapdealItemsMap = new HashMap<Long,SnapdealItemDetails>();
73
	private static Map<Long,SnapdealItemDetails> snapdealItemsMap = new HashMap<Long,SnapdealItemDetails>();
-
 
74
	private static String alternateEmailFromAddress;
-
 
75
	private static String alternateEmailPassword;
74
	static
76
	static
75
	{
77
	{
76
		sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
78
		sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
77
		emailFromAddress = "build@shop2020.in";
79
		emailFromAddress = "build@shop2020.in";
78
		password = "cafe@nes";
80
		password = "cafe@nes";
-
 
81
		alternateEmailFromAddress = "build-staging@shop2020.in";
-
 
82
		alternateEmailPassword = "shop2020";
-
 
83
 
79
		mailer = new GmailUtils();
84
		mailer = new GmailUtils();
80
		//sendTo = new String[]{"vikram.raghav@shop2020.in"};
85
		//sendTo = new String[]{"vikram.raghav@shop2020.in"};
81
		sendTo = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
86
		sendTo = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
82
				"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
87
				"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
83
				"yukti.jain@shop2020.in","manoj.pal@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
88
				"yukti.jain@shop2020.in","manoj.pal@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
Line 401... Line 406...
401
					e.printStackTrace();
406
					e.printStackTrace();
402
				}
407
				}
403
			}
408
			}
404
		}
409
		}
405
		System.out.println("Before sending email");
410
		System.out.println("Before sending email");
406
		String text = tableHeader+inventoryItems.toString()+tableFooter;
-
 
407
		if(inventoryItems.toString().length()>0){
411
		if(feedResponse.toString().length()>0){
408
			try {
412
			try {
409
				mailer.sendSSLMessage(sendTo,"Flipkart Inventory Sent Details " + sdf.format(System.currentTimeMillis()), emailFromAddress, password, text);
413
				mailer.sendSSLMessage(sendTo, "Flipkart Inventory could not be updated " + sdf.format(System.currentTimeMillis()), feedResponse.toString(), emailFromAddress, password,new ArrayList<File>());
410
			} catch (MessagingException e) {
414
			} catch (MessagingException e) {
-
 
415
				emailFromAddress = alternateEmailFromAddress; 
-
 
416
				password = alternateEmailPassword;
-
 
417
				try {
-
 
418
					mailer.sendSSLMessage(sendTo, "Flipkart Inventory could not be updated " + sdf.format(System.currentTimeMillis()), feedResponse.toString(), emailFromAddress, password,new ArrayList<File>());
-
 
419
				} catch (MessagingException e1) {
-
 
420
					e1.printStackTrace();
-
 
421
				}
411
				e.printStackTrace();
422
				e.printStackTrace();
412
			}
423
			}
413
		}
424
		}
414
		if(backInStockItems.toString().length()>0){
425
		else{
415
			try {
426
			try {
416
				text = tableHeader+backInStockItems.toString()+tableFooter;
-
 
417
				mailer.sendSSLMessage(sendTo,"Flipkart Inventory Back in Stock " + sdf.format(System.currentTimeMillis()), emailFromAddress, password, text);
427
				mailer.sendSSLMessage(sendTo, "Flipkart Inventory updated successfully " + sdf.format(System.currentTimeMillis()), feedResponse.toString(), emailFromAddress, password,new ArrayList<File>());
418
			} catch (MessagingException e) {
428
			} catch (MessagingException e) {
-
 
429
				emailFromAddress = alternateEmailFromAddress; 
-
 
430
				password = alternateEmailPassword;
-
 
431
				try {
-
 
432
					mailer.sendSSLMessage(sendTo, "Flipkart Inventory updated successfully " + sdf.format(System.currentTimeMillis()), feedResponse.toString(), emailFromAddress, password,new ArrayList<File>());
-
 
433
				} catch (MessagingException e1) {
-
 
434
					e1.printStackTrace();
-
 
435
				}
419
				e.printStackTrace();
436
				e.printStackTrace();
420
			}
437
			}
421
 
-
 
422
		}
438
		}
-
 
439
 
-
 
440
		String text;
423
		if(outOfStockItems.toString().length()>0){
441
		if(inventoryItems.toString().length()>0){
-
 
442
			text = tableHeader+inventoryItems.toString()+tableFooter;
424
			try {
443
			try {
425
				text = tableHeader+outOfStockItems.toString()+tableFooter;
-
 
426
				mailer.sendSSLMessage(sendTo,"Flipkart Inventory Out of Stock " + sdf.format(System.currentTimeMillis()), emailFromAddress, password, text);
444
				mailer.sendSSLMessage(sendTo,"Flipkart Inventory Sent Details " + sdf.format(System.currentTimeMillis()), emailFromAddress, password, text);
427
			} catch (MessagingException e) {
445
			} catch (MessagingException e) {
428
				e.printStackTrace();
446
				e.printStackTrace();
429
			}
447
			}
430
 
-
 
431
		}
448
		}
432
		if(feedResponse.toString().length()>0){
449
		if(backInStockItems.toString().length()>0){
433
			try {
450
			try {
-
 
451
				text = tableHeader+backInStockItems.toString()+tableFooter;
434
				mailer.sendSSLMessage(sendTo, "Flipkart Inventory could not be updated " + sdf.format(System.currentTimeMillis()), feedResponse.toString(), emailFromAddress, password,new ArrayList<File>());
452
				mailer.sendSSLMessage(sendTo,"Flipkart Inventory Back in Stock " + sdf.format(System.currentTimeMillis()), emailFromAddress, password, text);
435
			} catch (MessagingException e) {
453
			} catch (MessagingException e) {
436
				e.printStackTrace();
454
				e.printStackTrace();
437
			}
455
			}
-
 
456
 
438
		}
457
		}
439
		else{
458
		if(outOfStockItems.toString().length()>0){
440
			try {
459
			try {
-
 
460
				text = tableHeader+outOfStockItems.toString()+tableFooter;
441
				mailer.sendSSLMessage(sendTo, "Flipkart Inventory updated successfully " + sdf.format(System.currentTimeMillis()), feedResponse.toString(), emailFromAddress, password,new ArrayList<File>());
461
				mailer.sendSSLMessage(sendTo,"Flipkart Inventory Out of Stock " + sdf.format(System.currentTimeMillis()), emailFromAddress, password, text);
442
			} catch (MessagingException e) {
462
			} catch (MessagingException e) {
443
				e.printStackTrace();
463
				e.printStackTrace();
444
			}
464
			}
-
 
465
 
445
		}
466
		}
446
	}
467
	}
447
 
468
 
448
	private static void calculateinventory(){
469
	private static void calculateinventory(){
449
		CatalogClient catalogServiceClient = null;
470
		CatalogClient catalogServiceClient = null;