Subversion Repositories SmartDukaan

Rev

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

Rev 14606 Rev 14636
Line 73... Line 73...
73
				minCreationDate = 1393612200000l;
73
				minCreationDate = 1393612200000l;
74
			} catch (Exception e) {
74
			} catch (Exception e) {
75
				logger.error("Unable to establish connection to the transaction service while getting Minimum Order Created Timstamp for Undelivered Orders ", e);
75
				logger.error("Unable to establish connection to the transaction service while getting Minimum Order Created Timstamp for Undelivered Orders ", e);
76
			}//Dec 14, 2013 12:00:00 AM  1383291412000l
76
			}//Dec 14, 2013 12:00:00 AM  1383291412000l
77
			 */
77
			 */
78
			SimpleDateFormat snapdealDateFormat = new SimpleDateFormat("yyyy-MM-dd");
78
			SimpleDateFormat snapdealDateFormat = new SimpleDateFormat("yyyy/MM/dd");
79
			SimpleDateFormat gotSnapdealDateFormat = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss aaa");
79
			SimpleDateFormat gotSnapdealDateFormat = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss aaa");
80
			SimpleDateFormat ourDBDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
80
			SimpleDateFormat ourDBDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
81
			String startDate= "";
81
			String startDate= "";
82
			Date start_date = new Date(minCreationDate);
82
			Date start_date = new Date(minCreationDate);
83
			Date end_date = new Date(currentTime);
83
			Date end_date = new Date(currentTime);
Line 212... Line 212...
212
				long end = start + 604800000l;
212
				long end = start + 604800000l;
213
				if(end > end_date.getTime()){
213
				if(end > end_date.getTime()){
214
					end = end_date.getTime();
214
					end = end_date.getTime();
215
				}
215
				}
216
				startDate = snapdealDateFormat.format(new Date(start));
216
				startDate = snapdealDateFormat.format(new Date(start));
217
				startDate = startDate.replace("-", "%2F");
-
 
218
				endDate = snapdealDateFormat.format(new Date(end));
217
				endDate = snapdealDateFormat.format(new Date(end));
219
				endDate = endDate.replace("-", "%2F");
-
 
220
 
218
 
221
				logger.info("==== Start Date.."+startDate+"\n");
219
				logger.info("==== Start Date.."+startDate+"\n");
222
				logger.info("==== End Date.."+endDate+"\n");
220
				logger.info("==== End Date.."+endDate+"\n");
223
 
221
 
224
 
222
 
Line 279... Line 277...
279
 
277
 
280
				logger.info("Getting Delivery Information for OneShip Snapdeal Orders");
278
				logger.info("Getting Delivery Information for OneShip Snapdeal Orders");
281
				//statusCode=CLD&dispatchCategoryId=0&startDate=2013%2F11%2F01&endDate=2013%2F11%2F07&statusColumn=cancelledOn
279
				//statusCode=CLD&dispatchCategoryId=0&startDate=2013%2F11%2F01&endDate=2013%2F11%2F07&statusColumn=cancelledOn
282
				String oneShipUrl = "http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch/?startDate="+startDate+"&endDate="+endDate+"&statusCode=COURIER_DELIVERED&statusColumn=deliveredOn&dispatchCategoryId=0";
280
				String oneShipUrl = "http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch/?startDate="+startDate+"&endDate="+endDate+"&statusCode=COURIER_DELIVERED&statusColumn=deliveredOn&dispatchCategoryId=0";
283
				logger.info("One Ship Url "+oneShipUrl);
281
				logger.info("One Ship Url "+oneShipUrl);
284
 
282
				
-
 
283
				post = new HttpPost("http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch");
285
				get = new HttpGet(oneShipUrl);	
284
				nameValuePairs = new ArrayList<NameValuePair>();
-
 
285
				nameValuePairs.add(new BasicNameValuePair("startDate",startDate));
-
 
286
				nameValuePairs.add(new BasicNameValuePair("endDate",endDate));
-
 
287
				nameValuePairs.add(new BasicNameValuePair("statusColumn","deliveredOn"));
-
 
288
				nameValuePairs.add(new BasicNameValuePair("queryType","CREATED"));
-
 
289
				post.setEntity(new UrlEncodedFormEntity(nameValuePairs,"utf-8"));
286
 
290
 
287
				try {
291
				try {
288
					response = client.execute(get);
292
					response = client.execute(post);
289
				} catch (Exception e) {
293
				} catch (Exception e) {
290
					logger.error("Unable to get Http Response for snapdeal oneship delivered orders", e);
294
					logger.error("Unable to get Http Response for snapdeal oneship delivered orders", e);
291
					throw new Exception("Unable to get Http Response for snapdeal oneship delivered orders");
295
					throw new Exception("Unable to get Http Response for snapdeal oneship delivered orders");
292
				} 
296
				} 
293
 
297
 
Line 387... Line 391...
387
 
391
 
388
				logger.info("Getting Information for OneShip Snapdeal Cancelled Orders");
392
				logger.info("Getting Information for OneShip Snapdeal Cancelled Orders");
389
				String oneShipCancelUrl = "http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch/?statusCode=CLD&dispatchCategoryId=0&startDate="+startDate+"&endDate="+endDate+"&statusColumn=cancelledOn";
393
				String oneShipCancelUrl = "http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch/?statusCode=CLD&dispatchCategoryId=0&startDate="+startDate+"&endDate="+endDate+"&statusColumn=cancelledOn";
390
				logger.info("One Ship Cancel Url "+oneShipCancelUrl);
394
				logger.info("One Ship Cancel Url "+oneShipCancelUrl);
391
 
395
 
-
 
396
				post = new HttpPost("http://shipping.snapdeal.com/vendor/ONESHIP/product-shipment/shippedData/fetch");
392
				get = new HttpGet(oneShipCancelUrl);
397
				nameValuePairs = new ArrayList<NameValuePair>();
-
 
398
				nameValuePairs.add(new BasicNameValuePair("startDate",startDate));
-
 
399
				nameValuePairs.add(new BasicNameValuePair("endDate",endDate));
-
 
400
				nameValuePairs.add(new BasicNameValuePair("statusColumn","cancelledOn"));
-
 
401
				nameValuePairs.add(new BasicNameValuePair("queryType","CREATED"));
-
 
402
				post.setEntity(new UrlEncodedFormEntity(nameValuePairs,"utf-8"));
393
 
403
 
394
				try {
404
				try {
395
					response = client.execute(get);
405
					response = client.execute(post);
396
				} catch (Exception e) {
406
				} catch (Exception e) {
397
					logger.error("Unable to get Http Response for snapdeal oneship cancelled orders", e);
407
					logger.error("Unable to get Http Response for snapdeal oneship cancelled orders", e);
398
					throw new Exception("Unable to get Http Response for snapdeal oneship cancelled orders");
408
					throw new Exception("Unable to get Http Response for snapdeal oneship cancelled orders");
399
				} 
409
				} 
400
 
410