Subversion Repositories SmartDukaan

Rev

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

Rev 9776 Rev 9778
Line 253... Line 253...
253
				while(exitfetchinghistory){
253
				while(exitfetchinghistory){
254
					get = new HttpGet("http://seller.snapdeal.com/pricing/search?gridType=history&_search=false&nd="+time+"&rows=30&page="+i+"&sidx=&sord=asc");
254
					get = new HttpGet("http://seller.snapdeal.com/pricing/search?gridType=history&_search=false&nd="+time+"&rows=30&page="+i+"&sidx=&sord=asc");
255
					response = client.execute(get);
255
					response = client.execute(get);
256
					rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
256
					rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
257
					pricingHistoryItems = (PricingHistoryItems) gson.fromJson(rd, PricingHistoryItems.class);
257
					pricingHistoryItems = (PricingHistoryItems) gson.fromJson(rd, PricingHistoryItems.class);
258
					if(pricingHistoryItems.getRows().size()!=0 &&  successfullyUpdated != iterator){
258
					if(pricingHistoryItems.getRows().size()!=0 &&  successfullyUpdated != (iterator - 1)){
259
						for(PricingHistory pricingHistory:pricingHistoryItems.getRows()){
259
						for(PricingHistory pricingHistory:pricingHistoryItems.getRows()){
260
							if(Long.parseLong(pricingHistory.getModifiedOn()) > time && pricingHistory.getApprovalStatus().equals("Done") && pricingHistory.getUploadId().equals(uploadId)){
260
							if(Long.parseLong(pricingHistory.getModifiedOn()) > time && pricingHistory.getApprovalStatus().equals("Done") && pricingHistory.getUploadId().equals(uploadId)){
261
								successfullyUpdated++;
261
								successfullyUpdated++;
262
								updatedSkuList.add(pricingHistory.getSellerSku());
262
								updatedSkuList.add(pricingHistory.getSellerSku());
263
								System.out.println("SKU Updated " + pricingHistory.getSellerSku());
263
								System.out.println("SKU Updated " + pricingHistory.getSellerSku() + " " + pricingHistory.getUploadId());
264
							}
264
							}
265
						}
265
						}
266
					}
266
					}
267
					else{
267
					else{
268
						exitfetchinghistory = false;
268
						exitfetchinghistory = false;
269
						if(successfullyUpdated == iterator){
269
						if(successfullyUpdated == (iterator-1)){
270
							retry = 0;
270
							retry = 0;
271
						}
271
						}
272
					}
272
					}
273
					i++;
273
					i++;
274
				}
274
				}
Line 285... Line 285...
285
			List<Long> updatedItems = new ArrayList<Long>();
285
			List<Long> updatedItems = new ArrayList<Long>();
286
			if(toUpdateSkuList.size() != updatedSkuList.size()){
286
			if(toUpdateSkuList.size() != updatedSkuList.size()){
287
				toUpdateSkuList.removeAll(updatedSkuList);
287
				toUpdateSkuList.removeAll(updatedSkuList);
288
				System.out.println("SKUs not updated");
288
				System.out.println("SKUs not updated");
289
				try {
289
				try {
290
					mailer.sendSSLMessage(sendTo,"Following Snapdeal Item Prices were not updated "+ sdf.format(System.currentTimeMillis()),"Following Snapdeal Item Prices were not updated \n"+toUpdateSkuList.toString(), emailFromAddress, password, new ArrayList<File>());
290
					mailer.sendSSLMessage(sendTo,"Snapdeal Item Prices were not updated "+ sdf.format(System.currentTimeMillis()),"Following Snapdeal Item Prices were not updated \n"+toUpdateSkuList.toString(), emailFromAddress, password, new ArrayList<File>());
291
				} catch (MessagingException e) {
291
				} catch (MessagingException e) {
292
					// TODO Auto-generated catch block
292
					// TODO Auto-generated catch block
293
					e.printStackTrace();
293
					e.printStackTrace();
294
				}
294
				}
295
				
295
				
Line 311... Line 311...
311
						e1.printStackTrace();
311
						e1.printStackTrace();
312
					}
312
					}
313
					e.printStackTrace();
313
					e.printStackTrace();
314
				}
314
				}
315
				try {
315
				try {
316
					System.out.println("Prices are same as the snapdeal prices");
316
					System.out.println("Snapdeal Item Prices updated Successfully");
317
					mailer.sendSSLMessage(sendTo,"No changes in Snapdeal Item Prices "+ sdf.format(System.currentTimeMillis()),"No change in Snapdeal Prices to be update ", emailFromAddress, password, new ArrayList<File>());
317
					mailer.sendSSLMessage(sendTo,updatedSkuList.size()+" Snapdeal Items Price updated Successfully "+ sdf.format(System.currentTimeMillis()),"All Snapdeal Item Prices updated Successfully ", emailFromAddress, password, new ArrayList<File>());
318
				} catch (MessagingException e) {
318
				} catch (MessagingException e) {
319
					e.printStackTrace();
319
					e.printStackTrace();
320
				}
320
				}
321
			}
321
			}
322
		}
322
		}