Subversion Repositories SmartDukaan

Rev

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

Rev 10237 Rev 10238
Line 53... Line 53...
53
	 public UpdateSDPricingUsingPanel() {
53
	 public UpdateSDPricingUsingPanel() {
54
	 }
54
	 }
55
	 public static void main(String... args) throws ClientProtocolException, IOException, TTransportException, CatalogServiceException, TException{
55
	 public static void main(String... args) throws ClientProtocolException, IOException, TTransportException, CatalogServiceException, TException{
56
		 Item item = new CatalogClient().getClient().getItem(2231);
56
		 Item item = new CatalogClient().getClient().getItem(2231);
57
		 UpdateSDPricingUsingPanel updatePriceOnSnapdeal = new UpdateSDPricingUsingPanel(22500f,"1108903",item,System.currentTimeMillis());
57
		 UpdateSDPricingUsingPanel updatePriceOnSnapdeal = new UpdateSDPricingUsingPanel(22500f,"1108903",item,System.currentTimeMillis());
58
			logger.info("Calling Thread to update price at snapdeal");
58
		 logger.info("Calling Thread to update price at snapdeal");
59
			updatePriceOnSnapdeal.start();	
59
		 updatePriceOnSnapdeal.start();	
60
 
60
 
61
	 }
61
	 }
62
	 int updatePricing(Float price,String supc,Item item,Long timestamp) throws ClientProtocolException, IOException{
62
	 int updatePricing(Float price,String supc,Item item,Long timestamp) throws ClientProtocolException, IOException{
63
		 logger.info("Calling Update Snapdeal Price Constructor --" + " Price :" +price + " Supc :"+supc +" Item ID:" +item.getId());
63
		 logger.info("Calling Update Snapdeal Price Constructor --" + " Price :" +price + " Supc :"+supc +" Item ID:" +item.getId());
64
		 HttpPost post = new HttpPost("http://seller.snapdeal.com/pricing/update");
64
		 HttpPost post = new HttpPost("http://seller.snapdeal.com/pricing/update");
Line 158... Line 158...
158
	 public void run()
158
	 public void run()
159
	 {
159
	 {
160
		 try {
160
		 try {
161
			 this.handleLogin();
161
			 this.handleLogin();
162
			 this.updatePricing(this.price,this.supc,this.item,timestamp);
162
			 this.updatePricing(this.price,this.supc,this.item,timestamp);
-
 
163
			 boolean retry =true;
-
 
164
			 while(retry){
-
 
165
				 Thread.sleep(2*60*1000);
163
			 HttpGet get = new HttpGet("http://seller.snapdeal.com/pricing/search?searchType=SUPC&searchValue="+this.supc+"&gridType=normal&_search=false&nd="+System.currentTimeMillis()+"&rows=30&page=1&sidx=&sord=asc");
166
				 HttpGet get = new HttpGet("http://seller.snapdeal.com/pricing/search?searchType=SUPC&searchValue="+this.supc+"&gridType=normal&_search=false&nd="+System.currentTimeMillis()+"&rows=30&page=1&sidx=&sord=asc");
164
			 HttpResponse response = client.execute(get);
167
				 HttpResponse response = client.execute(get);
165
			 BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
168
				 BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
166
			 String line = "";
169
				 String line = "";
167
			 while ((line = rd.readLine()) != null) {
170
				 while ((line = rd.readLine()) != null) {
168
				 logger.info(line);
171
					 logger.info(line);
-
 
172
					 if(line.contains("\"pendingUpdate\":false\"")){
-
 
173
						 retry =false;
-
 
174
					 }
-
 
175
				 }
169
			 }
176
			 }
170
			 GmailUtils mailer = new GmailUtils();
177
			 GmailUtils mailer = new GmailUtils();
171
			 String text = "Product       : " +getProductName(this.item) +"\n"+ 
178
			 String text = "Product       : " +getProductName(this.item) +"\n"+ 
172
			 "Item ID       : " +this.item.getId() +"\n"+
179
			 "Item ID       : " +this.item.getId() +"\n"+
173
			 "SUPC          : " +this.supc +"\n"+
180
			 "SUPC          : " +this.supc +"\n"+