Subversion Repositories SmartDukaan

Rev

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

Rev 9571 Rev 9580
Line 70... Line 70...
70
	private static DefaultHttpClient client = new DefaultHttpClient();
70
	private static DefaultHttpClient client = new DefaultHttpClient();
71
	static Map<String,SnapdealItemDetails> snapdealItemMap = new HashMap<String,SnapdealItemDetails>();
71
	static Map<String,SnapdealItemDetails> snapdealItemMap = new HashMap<String,SnapdealItemDetails>();
72
	static Map<Long,SnapdealItemDetails> itemSnapdealMap = new HashMap<Long,SnapdealItemDetails>();
72
	static Map<Long,SnapdealItemDetails> itemSnapdealMap = new HashMap<Long,SnapdealItemDetails>();
73
	static Map<String,PendingOrderInventoryHistory> PendingOrdersInventoryHistoryMap = new HashMap<String,PendingOrderInventoryHistory>();
73
	static Map<String,PendingOrderInventoryHistory> PendingOrdersInventoryHistoryMap = new HashMap<String,PendingOrderInventoryHistory>();
74
	static long lastUpdatedInventoryTime = 0;
74
	static long lastUpdatedInventoryTime = 0;
-
 
75
	static java.text.SimpleDateFormat sdf;
-
 
76
	static String emailFromAddress;
-
 
77
	static String password;
-
 
78
	static GmailUtils mailer;
-
 
79
	static String sendTo[];
75
	static{
80
	static{
-
 
81
		sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
-
 
82
		emailFromAddress = "build@shop2020.in";
-
 
83
		password = "cafe@nes";
-
 
84
		mailer = new GmailUtils();
-
 
85
		//String sendTo[] = new String[]{"vikram.raghav@shop2020.in"};
-
 
86
		String sendTo[] = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
-
 
87
				"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
-
 
88
				"yukti.jain@shop2020.in","manisha.sharma@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
76
		itemIdpendingOrdersMap = new HashMap<Long,Long>();
89
		itemIdpendingOrdersMap = new HashMap<Long,Long>();
77
		CatalogClient catalogServiceClient = null;
90
		CatalogClient catalogServiceClient = null;
78
		try {
91
		try {
79
			catalogServiceClient = new CatalogClient();
92
			catalogServiceClient = new CatalogClient();
80
		} catch (TTransportException e1) {
93
		} catch (TTransportException e1) {
Line 421... Line 434...
421
			else{
434
			else{
422
				exitfetchinghistory = false;
435
				exitfetchinghistory = false;
423
			}
436
			}
424
			i++;
437
			i++;
425
		}
438
		}
-
 
439
		if(inventoryhistoryItemMap.entrySet().size()==0){
-
 
440
			try {
-
 
441
				mailer.sendSSLMessage(sendTo,"Error : Last Inventory Sent still not updated"+ sdf.format(System.currentTimeMillis()),"This e-mail is sent when there is some time lag on inventory updation on snapdeal ", emailFromAddress, password, new ArrayList<File>());
-
 
442
			} catch (MessagingException e) {
-
 
443
				// TODO Auto-generated catch block
-
 
444
				e.printStackTrace();
-
 
445
			}
-
 
446
		}
426
		InventoryClient inventoryServiceClient = new InventoryClient();
447
		InventoryClient inventoryServiceClient = new InventoryClient();
427
		in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
448
		in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
428
		List<SnapdealInventoryItem> snapdealInventoryItemHistoryList = inventoryClient.getSnapdealInventorySnapshot();
449
		List<SnapdealInventoryItem> snapdealInventoryItemHistoryList = inventoryClient.getSnapdealInventorySnapshot();
429
		if(snapdealInventoryItemHistoryList.size()>0){
450
		if(snapdealInventoryItemHistoryList.size()>0){
430
			for(SnapdealInventoryItem snapdealInventoryItem:snapdealInventoryItemHistoryList){
451
			for(SnapdealInventoryItem snapdealInventoryItem:snapdealInventoryItemHistoryList){
Line 737... Line 758...
737
			}
758
			}
738
			else{
759
			else{
739
				continue;
760
				continue;
740
			}
761
			}
741
		}
762
		}
742
		java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
-
 
743
		String emailFromAddress = "build@shop2020.in";
-
 
744
		String password = "cafe@nes";
-
 
745
		GmailUtils mailer = new GmailUtils();
-
 
746
		//String sendTo[] = new String[]{"vikram.raghav@shop2020.in"};
-
 
747
		String sendTo[] = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
-
 
748
				"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
-
 
749
				"yukti.jain@shop2020.in","manisha.sharma@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
-
 
750
		if(iterator > 1){
763
		if(iterator > 1){
751
			FileOutputStream fileOut = null;
764
			FileOutputStream fileOut = null;
752
			fis.close();
765
			fis.close();
753
			try {
766
			try {
754
				//System.out.println("Before writing file ");
767
				//System.out.println("Before writing file ");
Line 862... Line 875...
862
			}
875
			}
863
 
876
 
864
		}
877
		}
865
		else{
878
		else{
866
			try {
879
			try {
867
				mailer.sendSSLMessage(sendTo,"No changes in Snapdeal inventory to update)"+ sdf.format(System.currentTimeMillis()),"No change in Snapdeal Inventory to be updated ", emailFromAddress, password, new ArrayList<File>());
880
				mailer.sendSSLMessage(sendTo,"No changes in Snapdeal inventory to update"+ sdf.format(System.currentTimeMillis()),"No change in Snapdeal Inventory to be updated ", emailFromAddress, password, new ArrayList<File>());
868
			} catch (MessagingException e) {
881
			} catch (MessagingException e) {
869
				e.printStackTrace();
882
				e.printStackTrace();
870
			}
883
			}
871
		}
884
		}
872
 
885