Subversion Repositories SmartDukaan

Rev

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

Rev 10196 Rev 10197
Line 49... Line 49...
49
		sendTo = new String[]{"vikram.raghav@shop2020.in"};
49
		sendTo = new String[]{"vikram.raghav@shop2020.in"};
50
		/*sendTo = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
50
		/*sendTo = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in",
51
				"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
51
				"khushal.bhatia@shop2020.in","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com",
52
				"yukti.jain@shop2020.in","manisha.sharma@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
52
				"yukti.jain@shop2020.in","manisha.sharma@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
53
		 */
53
		 */
54
		 Client catalogServiceClient = null;
54
		Client catalogServiceClient = null;
55
		 try {
55
		try {
56
			 catalogServiceClient = new CatalogClient().getClient();
56
			catalogServiceClient = new CatalogClient().getClient();
57
		 } catch (TTransportException e) {
57
		} catch (TTransportException e) {
58
			 e.printStackTrace();
58
			e.printStackTrace();
59
		 }
59
		}
60
		 try {
60
		try {
61
			 time = System.currentTimeMillis();
61
			time = System.currentTimeMillis();
62
			 flipkartPricingItems = catalogServiceClient.getMarketPlaceItemsForPriceUpdate(8);
62
			flipkartPricingItems = catalogServiceClient.getMarketPlaceItemsForPriceUpdate(8);
63
			 List<Item> aliveItems = catalogServiceClient.getAllAliveItems();
-
 
64
				for(in.shop2020.model.v1.catalog.Item thriftItem:aliveItems){
-
 
65
					aliveItemsMap.put(thriftItem.getId(), thriftItem);
-
 
66
				}
-
 
67
			List<FlipkartItem> flipkartItems = catalogServiceClient.getAllFlipkartItems();
63
			List<FlipkartItem> flipkartItems = catalogServiceClient.getAllFlipkartItems();
68
			for(FlipkartItem flipkartItem:flipkartItems){
64
			for(FlipkartItem flipkartItem:flipkartItems){
69
				flipkartItemsMap.put(flipkartItem.getItem_id(),flipkartItem);
65
				flipkartItemsMap.put(flipkartItem.getItem_id(),flipkartItem);
70
			}
66
			}
-
 
67
			List<Item> aliveItems = catalogServiceClient.getAllAliveItems();
-
 
68
			for(in.shop2020.model.v1.catalog.Item thriftItem:aliveItems){
-
 
69
				aliveItemsMap.put(thriftItem.getId(), thriftItem);
71
			 
70
			}
-
 
71
 
72
		 } catch (TException e) {
72
		} catch (TException e) {
73
			 e.printStackTrace();
73
			e.printStackTrace();
74
		 }
74
		}
75
		 if(flipkartPricingItems.size()==0){
75
		if(flipkartPricingItems.size()==0){
76
			 String text = "";
76
			String text = "";
77
			 try {
77
			try {
78
				 mailer.sendSSLMessage(sendTo,"No Change in Flipkart item Prices ", emailFromAddress, password, text);
78
				mailer.sendSSLMessage(sendTo,"No Change in Flipkart item Prices ", emailFromAddress, password, text);
79
				 System.exit(0);
79
				System.exit(0);
80
			 } catch (MessagingException e) {
80
			} catch (MessagingException e) {
81
				 e.printStackTrace();
81
				e.printStackTrace();
82
			 }
82
			}
83
		 }
83
		}
84
 
84
 
85
	}
85
	}
86
 
86
 
87
	public static void main(String[] args) throws ClientProtocolException, TException{
87
	public static void main(String[] args) throws ClientProtocolException, TException{
88
		DefaultHttpClient httpclient = new DefaultHttpClient();
88
		DefaultHttpClient httpclient = new DefaultHttpClient();
Line 122... Line 122...
122
			System.out.println("Product Name " + getProductName(item));
122
			System.out.println("Product Name " + getProductName(item));
123
			System.out.println("Selling Price " + entry.getSellingPrice());
123
			System.out.println("Selling Price " + entry.getSellingPrice());
124
			jsonRequest.append("{\"skuId\":"+"\""+flipkartItemsMap.get(entry.getItem_id()).getSkuAtFlipkart()+
124
			jsonRequest.append("{\"skuId\":"+"\""+flipkartItemsMap.get(entry.getItem_id()).getSkuAtFlipkart()+
125
					"\","+"\"attributeValues\""+":"+
125
					"\","+"\"attributeValues\""+":"+
126
					"{\"selling_price\""+":"+"\""+entry.getSellingPrice()+"}}");
126
					"{\"selling_price\""+":"+"\""+entry.getSellingPrice()+"}}");
127
			
127
 
128
			pricingItems.append("<tr>" 
128
			pricingItems.append("<tr>" 
129
					+ "<td>" +getProductName(item)+"</td>"
129
					+ "<td>" +getProductName(item)+"</td>"
130
					+"<td>" + item.getId() + "</td>"
130
					+"<td>" + item.getId() + "</td>"
131
					+"<td>" + entry.getSellingPrice() + "</td>"
131
					+"<td>" + entry.getSellingPrice() + "</td>"
132
					+"</tr>");
132
					+"</tr>");
Line 189... Line 189...
189
		Client catalogClient = null;
189
		Client catalogClient = null;
190
		if(feedResponse.toString().length()>0){
190
		if(feedResponse.toString().length()>0){
191
			try {
191
			try {
192
				mailer.sendSSLMessage(sendTo, "Flipkart Pricing could not be updated ", feedResponse.toString(), emailFromAddress, password,new ArrayList<File>());
192
				mailer.sendSSLMessage(sendTo, "Flipkart Pricing could not be updated ", feedResponse.toString(), emailFromAddress, password,new ArrayList<File>());
193
				try {
193
				try {
194
					 catalogClient = new CatalogClient().getClient();
194
					catalogClient = new CatalogClient().getClient();
195
					 catalogClient.updateMarketPlacePriceUpdateStatus(updatedItems,time,8);
195
					catalogClient.updateMarketPlacePriceUpdateStatus(updatedItems,time,8);
196
				} catch (TException e) {
196
				} catch (TException e) {
197
					try {
197
					try {
198
						new CatalogClient().getClient().updateMarketPlacePriceUpdateStatus(updatedItems, time,8);
198
						new CatalogClient().getClient().updateMarketPlacePriceUpdateStatus(updatedItems, time,8);
199
					} catch (TTransportException e1) {
199
					} catch (TTransportException e1) {
200
						e1.printStackTrace();
200
						e1.printStackTrace();
201
					} catch (TException e1) {
201
					} catch (TException e1) {
202
						e1.printStackTrace();
202
						e1.printStackTrace();
203
					}
203
					}
204
					e.printStackTrace();
204
					e.printStackTrace();
205
				}
205
				}
206
				
206
 
207
			} catch (MessagingException e) {
207
			} catch (MessagingException e) {
208
				try {
208
				try {
209
					 catalogClient = new CatalogClient().getClient();
209
					catalogClient = new CatalogClient().getClient();
210
					 catalogClient.updateMarketPlacePriceUpdateStatus(updatedItems,time,8);
210
					catalogClient.updateMarketPlacePriceUpdateStatus(updatedItems,time,8);
211
				} catch (TException ex) {
211
				} catch (TException ex) {
212
					try {
212
					try {
213
						new CatalogClient().getClient().updateMarketPlacePriceUpdateStatus(updatedItems, time,8);
213
						new CatalogClient().getClient().updateMarketPlacePriceUpdateStatus(updatedItems, time,8);
214
					} catch (TTransportException e1) {
214
					} catch (TTransportException e1) {
215
						e1.printStackTrace();
215
						e1.printStackTrace();