Subversion Repositories SmartDukaan

Rev

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

Rev 9944 Rev 10020
Line 382... Line 382...
382
		HttpResponse response = null;
382
		HttpResponse response = null;
383
		BufferedReader rd = null;
383
		BufferedReader rd = null;
384
		while(exitfetchinghistory){
384
		while(exitfetchinghistory){
385
			//System.out.println("Fetching inventory history page " +i);
385
			//System.out.println("Fetching inventory history page " +i);
386
			get = new HttpGet("http://seller.snapdeal.com/inventory/search?gridType=history&_search=false&nd="+time+"&rows=30&page="+i+"&sidx=&sord=dsc");
386
			get = new HttpGet("http://seller.snapdeal.com/inventory/search?gridType=history&_search=false&nd="+time+"&rows=30&page="+i+"&sidx=&sord=dsc");
387
			
387
 
388
			try {
388
			try {
389
				response = client.execute(get);
389
				response = client.execute(get);
390
			} catch (ClientProtocolException e) {
390
			} catch (ClientProtocolException e) {
391
				// TODO Auto-generated catch block
391
				// TODO Auto-generated catch block
392
				e.printStackTrace();
392
				e.printStackTrace();
393
			} catch (IOException e) {
393
			} catch (IOException e) {
394
				// TODO Auto-generated catch block
394
				// TODO Auto-generated catch block
395
				e.printStackTrace();
395
				e.printStackTrace();
396
			}
396
			}
397
			
397
 
398
			try {
398
			try {
399
				rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
399
				rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
400
			} catch (IllegalStateException e) {
400
			} catch (IllegalStateException e) {
401
				// TODO Auto-generated catch block
401
				// TODO Auto-generated catch block
402
				e.printStackTrace();
402
				e.printStackTrace();
Line 504... Line 504...
504
			if(inventoryitems.getRows().size()!=0){
504
			if(inventoryitems.getRows().size()!=0){
505
				for(Inventory inventory : inventoryitems.getRows()){
505
				for(Inventory inventory : inventoryitems.getRows()){
506
					if(snapdealItemMap.containsKey(inventory.getSellerSku())){
506
					if(snapdealItemMap.containsKey(inventory.getSellerSku())){
507
						currentInventoryItemList.add(inventory);
507
						currentInventoryItemList.add(inventory);
508
					}
508
					}
509
					
509
 
510
					else{
510
					else{
511
						notMappedItems.append("<tr>" 
511
						notMappedItems.append("<tr>" 
512
							+ "<td>" + inventory.getProductName() +"</td>"
512
								+ "<td>" + inventory.getProductName() +"</td>"
513
							+"<td>" + inventory.getSellerSku() + "</td>"
513
								+"<td>" + inventory.getSellerSku() + "</td>"
514
							+"<td>" + inventory.getSupc() + "</td>"
514
								+"<td>" + inventory.getSupc() + "</td>"
515
							+"</tr>");
515
								+"</tr>");
516
					}
516
					}
517
					items++;
517
					items++;
518
				}
518
				}
519
			}
519
			}
520
			else{
520
			else{
Line 679... Line 679...
679
		}
679
		}
680
		ex = sb.substring(i+24,j-1);
680
		ex = sb.substring(i+24,j-1);
681
		System.out.println("EXECUTION VALUE " + ex);
681
		System.out.println("EXECUTION VALUE " + ex);
682
		HttpPost post = new HttpPost("http://selleraccounts.snapdeal.com/keymaker/login");
682
		HttpPost post = new HttpPost("http://selleraccounts.snapdeal.com/keymaker/login");
683
		List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
683
		List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
-
 
684
		//nameValuePairs.add(new BasicNameValuePair("username",
-
 
685
		//"khushal.bhatia@saholic.com"));
684
		nameValuePairs.add(new BasicNameValuePair("username",
686
		nameValuePairs.add(new BasicNameValuePair("username",
685
		"khushal.bhatia@saholic.com"));
687
		"saholic-snapdeal@saholic.com"));
-
 
688
		//nameValuePairs.add(new BasicNameValuePair("password",
-
 
689
		//"sonline"));
686
		nameValuePairs.add(new BasicNameValuePair("password",
690
		nameValuePairs.add(new BasicNameValuePair("password",
687
		"sonline"));
691
		"bc452ce4"));
688
		nameValuePairs.add(new BasicNameValuePair("_eventId","submit"));
692
		nameValuePairs.add(new BasicNameValuePair("_eventId","submit"));
689
		nameValuePairs.add(new BasicNameValuePair("execution",ex));
693
		nameValuePairs.add(new BasicNameValuePair("execution",ex));
690
		nameValuePairs.add(new BasicNameValuePair("lt",lt));
694
		nameValuePairs.add(new BasicNameValuePair("lt",lt));
691
		nameValuePairs.add(new BasicNameValuePair("submit","LOGIN"));
695
		nameValuePairs.add(new BasicNameValuePair("submit","LOGIN"));
692
		post.setEntity(new UrlEncodedFormEntity(nameValuePairs,"utf-8"));
696
		post.setEntity(new UrlEncodedFormEntity(nameValuePairs,"utf-8"));
Line 702... Line 706...
702
		while ((line = rd.readLine()) != null) {
706
		while ((line = rd.readLine()) != null) {
703
			//System.out.println(line);
707
			//System.out.println(line);
704
		}
708
		}
705
	}
709
	}
706
 
710
 
707
	
711
 
708
	
712
 
709
	
713
 
710
	@SuppressWarnings("deprecation")
714
	@SuppressWarnings("deprecation")
711
	public static void main(String[] args) throws NumberFormatException, TException, ClientProtocolException, IOException, MessagingException {
715
	public static void main(String[] args) throws NumberFormatException, TException, ClientProtocolException, IOException, MessagingException {
712
		handleLogin();
716
		handleLogin();
713
		fetchinventoryhistoryfromsnapdeal();
717
		fetchinventoryhistoryfromsnapdeal();
714
		fetchcurrentinventoryfromsnapdeal();
718
		fetchcurrentinventoryfromsnapdeal();
Line 956... Line 960...
956
					mailer.sendSSLMessage(sendTo,emailSubjectTxt, emailFromAddress, password, text);
960
					mailer.sendSSLMessage(sendTo,emailSubjectTxt, emailFromAddress, password, text);
957
				} catch (MessagingException e) {
961
				} catch (MessagingException e) {
958
					e.printStackTrace();
962
					e.printStackTrace();
959
				}
963
				}
960
			}
964
			}
961
			
965
 
962
			tableHeader = "<tr>" 
966
			tableHeader = "<tr>" 
963
				+ "<td>" + "Product Name" +"</td>"
967
				+ "<td>" + "Product Name" +"</td>"
964
				+"<td>" + "Item ID" + "</td>"
968
				+"<td>" + "Item ID" + "</td>"
965
				+"<td>" + "Available - Reserve" + "</td>"
969
				+"<td>" + "Available - Reserve" + "</td>"
966
				+"<td>" + "Total Held" + "</td>"
970
				+"<td>" + "Total Held" + "</td>"
Line 991... Line 995...
991
			+"<td>" + "SUPC" + "</td>"
995
			+"<td>" + "SUPC" + "</td>"
992
			+"</tr>";
996
			+"</tr>";
993
		String text;
997
		String text;
994
 
998
 
995
		if(notMappedItems.length() >0){
999
		if(notMappedItems.length() >0){
996
			 text = "<html><table border=\"1\" align=\"center\">"+tableHeader+notMappedItems.toString()+"</table></html>";
1000
			text = "<html><table border=\"1\" align=\"center\">"+tableHeader+notMappedItems.toString()+"</table></html>";
997
				mailer.sendSSLMessage(sendTo,"Please create Warehouse ID and Item ID mapping", emailFromAddress, password, text);
1001
			mailer.sendSSLMessage(sendTo,"Please create Warehouse ID and Item ID mapping", emailFromAddress, password, text);
998
		}
1002
		}
999
 
1003
 
1000
	}
1004
	}
1001
 
1005
 
1002
}
1006
}