Subversion Repositories SmartDukaan

Rev

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

Rev 9404 Rev 9405
Line 55... Line 55...
55
import org.apache.thrift.transport.TTransportException;
55
import org.apache.thrift.transport.TTransportException;
56
import com.google.gson.Gson;
56
import com.google.gson.Gson;
57
 
57
 
58
public class CreateSnapDealInventoryFeed {
58
public class CreateSnapDealInventoryFeed {
59
	private static long time = System.currentTimeMillis();
59
	private static long time = System.currentTimeMillis();
60
	private static final String SNAPDEAL_INVENTORY_SHEET = "/home/vikram/snapdeal-inventory-"+time+".xls";
60
	private static final String SNAPDEAL_INVENTORY_SHEET = "/home/snapdeal/snapdeal-inventory-"+time+".xls";
61
	private static Map<Long, SnapdealItemForInventory> allItemsInventoryMap = new HashMap<Long, SnapdealItemForInventory>();
61
	private static Map<Long, SnapdealItemForInventory> allItemsInventoryMap = new HashMap<Long, SnapdealItemForInventory>();
62
	private static ArrayList<Inventory> inventoryItemList;
62
	private static ArrayList<Inventory> inventoryItemList;
63
	static Map<Long,Long> itemIdpendingOrdersMap = new HashMap<Long,Long>();
63
	static Map<Long,Long> itemIdpendingOrdersMap = new HashMap<Long,Long>();
64
	private static void calculateinventory(){
64
	private static void calculateinventory(){
65
 
65
 
Line 460... Line 460...
460
			hwb.write(fileOut);
460
			hwb.write(fileOut);
461
		} catch (IOException e) {
461
		} catch (IOException e) {
462
			// TODO Auto-generated catch block
462
			// TODO Auto-generated catch block
463
			e.printStackTrace();
463
			e.printStackTrace();
464
		}
464
		}
465
		HttpClient client = new DefaultHttpClient();
465
/*		HttpClient client = new DefaultHttpClient();
466
		HttpPost post = new HttpPost("http://seller.snapdeal.com/login_security_check?spring-security-redirect=http://seller.snapdeal.com/inventory&");
466
		HttpPost post = new HttpPost("http://seller.snapdeal.com/login_security_check?spring-security-redirect=http://seller.snapdeal.com/inventory&");
467
		BufferedReader rd= null;
467
		BufferedReader rd= null;
468
		/*List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
468
		List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
469
		nameValuePairs.add(new BasicNameValuePair("j_username",
469
		nameValuePairs.add(new BasicNameValuePair("j_username",
470
		"khushal.bhatia@saholic.com"));
470
		"khushal.bhatia@saholic.com"));
471
		nameValuePairs.add(new BasicNameValuePair("j_password",
471
		nameValuePairs.add(new BasicNameValuePair("j_password",
472
		"sonline"));
472
		"sonline"));
473
		post.setEntity(new UrlEncodedFormEntity(nameValuePairs,"utf-8"));*/
473
		post.setEntity(new UrlEncodedFormEntity(nameValuePairs,"utf-8"));
474
		HttpResponse response = null;
474
		HttpResponse response = null;
475
		String line;
475
		String line;
476
/*		try {
476
		try {
477
			response = client.execute(post);
477
			response = client.execute(post);
478
			rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
478
			rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
479
			while ((line = rd.readLine()) != null) {
479
			while ((line = rd.readLine()) != null) {
480
				System.out.println(line);
480
				System.out.println(line);
481
			}
481
			}
Line 485... Line 485...
485
			e.printStackTrace();
485
			e.printStackTrace();
486
		} catch (IOException e) {
486
		} catch (IOException e) {
487
			// TODO Auto-generated catch block
487
			// TODO Auto-generated catch block
488
			e.printStackTrace();
488
			e.printStackTrace();
489
		}
489
		}
490
*/		post = new HttpPost("http://seller.snapdeal.com/inventory/upload");
490
		post = new HttpPost("http://seller.snapdeal.com/inventory/upload");
491
		File file = new File("/home/vikram/snapdeal-inventory-1389608325312.xls");
491
		File file = new File("/home/vikram/snapdeal-inventory-1389608325312.xls");
492
		MultipartEntity mpEntity = new MultipartEntity();
492
		MultipartEntity mpEntity = new MultipartEntity();
493
	    ContentBody cbFile = new FileBody(file,"application/vnd.ms-excel");
493
	    ContentBody cbFile = new FileBody(file,"application/vnd.ms-excel");
494
	    mpEntity.addPart("file", cbFile);
494
	    mpEntity.addPart("file", cbFile);
495
	    post.setEntity(mpEntity);
495
	    post.setEntity(mpEntity);
Line 510... Line 510...
510
			}
510
			}
511
		} catch (IOException e) {
511
		} catch (IOException e) {
512
			// TODO Auto-generated catch block
512
			// TODO Auto-generated catch block
513
			e.printStackTrace();
513
			e.printStackTrace();
514
		}
514
		}
515
 
515
*/
516
	}
516
	}
517
 
517
 
518
}
518
}