Subversion Repositories SmartDukaan

Rev

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

Rev 10083 Rev 10084
Line 47... Line 47...
47
 
47
 
48
 
48
 
49
public class FlipkartInventoryReconcillation {
49
public class FlipkartInventoryReconcillation {
50
 
50
 
51
 
51
 
52
	public static void main(String... args) throws ClientProtocolException, IOException, TException{
52
	public static void main(String... args) throws ClientProtocolException, IOException{
53
		SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
53
		SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
54
		String emailFromAddress = "build@shop2020.in";
54
		String emailFromAddress = "build@shop2020.in";
55
		String password = "cafe@nes";
55
		String password = "cafe@nes";
56
		GmailUtils mailer = new GmailUtils();
56
		GmailUtils mailer = new GmailUtils();
57
		String[] sendTo = new String[]{"vikram.raghav@shop2020.in"};
57
		String[] sendTo = new String[]{"vikram.raghav@shop2020.in"};
58
		/*String[] sendTo = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
58
		/*String[] sendTo = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
59
				"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
59
				"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
60
				"yukti.jain@shop2020.in","manoj.pal@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
60
				"yukti.jain@shop2020.in","manoj.pal@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
61
		 */
61
		 */
62
		Map<String,Long> itemInventoryMap = FetchInventoryAtFlipkart();
62
		Map<String,Long> itemInventoryMap = FetchInventoryAtFlipkart();
63
		in.shop2020.model.v1.catalog.CatalogService.Client catalogClient = new CatalogClient().getClient();
63
		in.shop2020.model.v1.catalog.CatalogService.Client catalogClient = null;
64
		List<Item> aliveItems = null;
64
		List<Item> aliveItems = null;
65
		List<FlipkartItem> flipkartItems = null;
65
		List<FlipkartItem> flipkartItems = null;
66
		try {
-
 
67
			flipkartItems = catalogClient.getAllFlipkartItems();
-
 
68
		} catch (TException e1) {
-
 
69
			catalogClient = new CatalogClient().getClient();
-
 
70
			flipkartItems = catalogClient.getAllFlipkartItems();
-
 
71
			e1.printStackTrace();
-
 
72
		}
-
 
73
		boolean ex = true;
66
		boolean ex = true;
74
		while(ex){
67
		while(ex){
75
			try {
68
			try {
76
				aliveItems = catalogClient.getAllAliveItems();
-
 
77
				ex =false;
-
 
78
			} catch (Exception e1) {
-
 
79
				catalogClient = new CatalogClient().getClient();
69
				catalogClient = new CatalogClient().getClient();
-
 
70
				flipkartItems = catalogClient.getAllFlipkartItems();
-
 
71
				ex =false;
-
 
72
			} catch (Exception e) {
-
 
73
				e.printStackTrace();
-
 
74
			}
-
 
75
		}
-
 
76
 
-
 
77
		while(ex){
-
 
78
			try {
80
				aliveItems = catalogClient.getAllAliveItems();
79
				aliveItems = catalogClient.getAllAliveItems();
-
 
80
				ex =false;
-
 
81
			} catch (Exception e) {
-
 
82
				try {
-
 
83
					catalogClient = new CatalogClient().getClient();
-
 
84
				} catch (Exception e1) {
81
				e1.printStackTrace();
85
					e1.printStackTrace();
-
 
86
				}
82
			}
87
			}
83
		}
88
		}
84
		Map<Long,FlipkartItem> flipkartItemsMap = new HashMap<Long,FlipkartItem>();
89
		Map<Long,FlipkartItem> flipkartItemsMap = new HashMap<Long,FlipkartItem>();
85
		Map<Long,Item> aliveItemsMap = new HashMap<Long,Item>();
90
		Map<Long,Item> aliveItemsMap = new HashMap<Long,Item>();
86
		for(Item item:aliveItems){
91
		for(Item item:aliveItems){