Subversion Repositories SmartDukaan

Rev

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

Rev 9711 Rev 9715
Line 77... Line 77...
77
	static java.text.SimpleDateFormat sdf;
77
	static java.text.SimpleDateFormat sdf;
78
	static String emailFromAddress;
78
	static String emailFromAddress;
79
	static String password;
79
	static String password;
80
	static GmailUtils mailer;
80
	static GmailUtils mailer;
81
	static String sendTo[];
81
	static String sendTo[];
-
 
82
	static StringBuffer notMappedItems =new StringBuffer();
82
	static{
83
	static{
83
		sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
84
		sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
84
		emailFromAddress = "build@shop2020.in";
85
		emailFromAddress = "build@shop2020.in";
85
		password = "cafe@nes";
86
		password = "cafe@nes";
86
		mailer = new GmailUtils();
87
		mailer = new GmailUtils();
Line 571... Line 572...
571
			if(inventoryitems.getRows().size()!=0){
572
			if(inventoryitems.getRows().size()!=0){
572
				for(Inventory inventory : inventoryitems.getRows()){
573
				for(Inventory inventory : inventoryitems.getRows()){
573
					if(snapdealItemMap.containsKey(inventory.getSellerSku())){
574
					if(snapdealItemMap.containsKey(inventory.getSellerSku())){
574
						currentInventoryItemList.add(inventory);
575
						currentInventoryItemList.add(inventory);
575
					}
576
					}
-
 
577
					
-
 
578
					else{
-
 
579
						notMappedItems.append("<tr>" 
-
 
580
							+ "<td>" + inventory.getProductName() +"</td>"
-
 
581
							+"<td>" + inventory.getSellerSku() + "</td>"
-
 
582
							+"<td>" + inventory.getSupc() + "</td>"
-
 
583
							+"</tr>");
-
 
584
					}
576
					items++;
585
					items++;
577
				}
586
				}
578
			}
587
			}
579
			else{
588
			else{
580
				System.out.println("Fetched  " + items);
589
				System.out.println("Fetched  " + items);
Line 678... Line 687...
678
		}
687
		}
679
 
688
 
680
	}
689
	}
681
 
690
 
682
	@SuppressWarnings("deprecation")
691
	@SuppressWarnings("deprecation")
683
	public static void main(String[] args) throws NumberFormatException, TException, ClientProtocolException, IOException {
692
	public static void main(String[] args) throws NumberFormatException, TException, ClientProtocolException, IOException, MessagingException {
684
		fetchinventoryhistoryfromsnapdeal();
693
		fetchinventoryhistoryfromsnapdeal();
685
		fetchcurrentinventoryfromsnapdeal();
694
		fetchcurrentinventoryfromsnapdeal();
686
		calculateinventory();
695
		calculateinventory();
687
		in.shop2020.model.v1.catalog.CatalogService.Client catalogServiceClient = null;
696
		in.shop2020.model.v1.catalog.CatalogService.Client catalogServiceClient = null;
688
		try {
697
		try {
Line 978... Line 987...
978
				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>());
987
				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>());
979
			} catch (MessagingException e) {
988
			} catch (MessagingException e) {
980
				e.printStackTrace();
989
				e.printStackTrace();
981
			}
990
			}
982
		}
991
		}
-
 
992
		String tableHeader = "<tr>" 
-
 
993
			+ "<td>" + "Product Name" +"</td>"
-
 
994
			+"<td>" + "SKU at Snapdeal" + "</td>"
-
 
995
			+"<td>" + "SUPC" + "</td>"
-
 
996
			+"</tr>";
-
 
997
		String text;
983
 
998
 
-
 
999
		if(notMappedItems.length() >0){
-
 
1000
			 text = "<html><table border=\"1\" align=\"center\">"+tableHeader+notMappedItems.toString()+"</table></html>";
-
 
1001
				mailer.sendSSLMessage(sendTo,"Please set Warehouse ID and Item ID for Items", emailFromAddress, password, text);
984
 
1002
		}
985
 
1003
 
986
	}
1004
	}
987
 
1005
 
988
}
1006
}