Subversion Repositories SmartDukaan

Rev

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

Rev 9260 Rev 9737
Line 59... Line 59...
59
						TimeZone zone= TimeZone.getTimeZone("GMT");
59
						TimeZone zone= TimeZone.getTimeZone("GMT");
60
						istFormatter.setTimeZone(zone);
60
						istFormatter.setTimeZone(zone);
61
						Date date = istFormatter.parse(nextLine[2]);
61
						Date date = istFormatter.parse(nextLine[2]);
62
						SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
62
						SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
63
						Date date_key = dateFormat.parse(dateFormat.format(date));
63
						Date date_key = dateFormat.parse(dateFormat.format(date));
64
						System.out.println("Order Details " + nextLine[0]+" "+date_key+" "+ nextLine[11] +" " + nextLine[13] + " " + nextLine[14]);
64
						//System.out.println("Order Details " + nextLine[0]+" "+date_key+" "+ nextLine[11] +" " + nextLine[13] + " " + nextLine[14]);
65
						Long itemid = Long.parseLong(nextLine[11].replaceAll("FBA",""));
65
						Long itemid = Long.parseLong(nextLine[11].replaceAll("FBA",""));
66
						Integer qty=0;
66
						Integer qty=0;
67
						if(nextLine[14].length()!=0){
67
						if(nextLine[14].length()!=0){
68
							qty = new Integer(nextLine[14]);
68
							qty = new Integer(nextLine[14]);
69
						}
69
						}
Line 161... Line 161...
161
			Calendar cal = Calendar.getInstance();
161
			Calendar cal = Calendar.getInstance();
162
			cal.add(Calendar.DATE, -1);
162
			cal.add(Calendar.DATE, -1);
163
			Date date_end = dateFormat.parse(dateFormat.format(cal.getTime()));
163
			Date date_end = dateFormat.parse(dateFormat.format(cal.getTime()));
164
			cal.add(Calendar.DATE, -5);
164
			cal.add(Calendar.DATE, -5);
165
			Date date_start = dateFormat.parse(dateFormat.format(cal.getTime()));
165
			Date date_start = dateFormat.parse(dateFormat.format(cal.getTime()));
166
			System.out.println("Start Date = " + date_start);
166
			//System.out.println("Start Date = " + date_start);
167
			System.out.println("End Date = " + date_end);
167
			//System.out.println("End Date = " + date_end);
168
			Date d = date_start;
168
			Date d = date_start;
169
			while(!d.equals(date_end)){
169
			while(!d.equals(date_end)){
170
				cal.setTime(d);
170
				cal.setTime(d);
171
				cal.add(Calendar.DATE,1);
171
				cal.add(Calendar.DATE,1);
172
				d = cal.getTime();
172
				d = cal.getTime();
Line 301... Line 301...
301
			}
301
			}
302
			boolean oos;
302
			boolean oos;
303
			for (Entry<Date, Map<Long, FbaSalesSnapshot>> entry : orderDateItemIdFbaSaleSnapshotMap.entrySet()){
303
			for (Entry<Date, Map<Long, FbaSalesSnapshot>> entry : orderDateItemIdFbaSaleSnapshotMap.entrySet()){
304
				Date orderDate = entry.getKey();
304
				Date orderDate = entry.getKey();
305
				for(Entry<Long, FbaSalesSnapshot> entry1 :entry.getValue().entrySet()){
305
				for(Entry<Long, FbaSalesSnapshot> entry1 :entry.getValue().entrySet()){
306
					System.out.println("Item ID is " + entry1.getKey());
306
					//System.out.println("Item ID is " + entry1.getKey());
307
					Long inventory = inventoryClient.getAmazonFbaItemInventory(entry1.getKey());
307
					Long inventory = inventoryClient.getAmazonFbaItemInventory(entry1.getKey());
308
 
308
 
309
					if(inventory==0 && entry1.getValue().getTotalOrderCount()==0){
309
					if(inventory==0 && entry1.getValue().getTotalOrderCount()==0){
310
						oos=true;
310
						oos=true;
311
					}
311
					}
Line 315... Line 315...
315
					Long item_id = entry1.getKey();
315
					Long item_id = entry1.getKey();
316
					Amazonlisted amazon_item=catalogClient.getAmazonItemDetails(item_id);
316
					Amazonlisted amazon_item=catalogClient.getAmazonItemDetails(item_id);
317
					if(amazon_item.getItemid()==0){
317
					if(amazon_item.getItemid()==0){
318
						continue;
318
						continue;
319
					}
319
					}
320
					System.out.println(orderDate +","+entry1.getKey()+","+entry1.getValue()+","+ inventory +","+ oos+","+itemIdSalePriceMap.get(item_id)+","+itemIdminFBAPriceMap.get(item_id)+","+itemIdminMFNPriceMap.get(item_id));
320
					//System.out.println(orderDate +","+entry1.getKey()+","+entry1.getValue()+","+ inventory +","+ oos+","+itemIdSalePriceMap.get(item_id)+","+itemIdminFBAPriceMap.get(item_id)+","+itemIdminMFNPriceMap.get(item_id));
321
					AmazonFbaSalesSnapshot amazonfbasalessnapshot = new AmazonFbaSalesSnapshot();
321
					AmazonFbaSalesSnapshot amazonfbasalessnapshot = new AmazonFbaSalesSnapshot();
322
					amazonfbasalessnapshot.setDateOfSale(orderDate.getTime());
322
					amazonfbasalessnapshot.setDateOfSale(orderDate.getTime());
323
					amazonfbasalessnapshot.setItem_id(entry1.getKey());
323
					amazonfbasalessnapshot.setItem_id(entry1.getKey());
324
					amazonfbasalessnapshot.setTotalOrderCount(entry1.getValue().getPromotionOrderCount());
324
					amazonfbasalessnapshot.setTotalOrderCount(entry1.getValue().getPromotionOrderCount());
325
					amazonfbasalessnapshot.setTotalOrderCount(entry1.getValue().getTotalOrderCount());
325
					amazonfbasalessnapshot.setTotalOrderCount(entry1.getValue().getTotalOrderCount());
Line 356... Line 356...
356
					}
356
					}
357
					else{
357
					else{
358
						amazonfbasalessnapshot.setOurPrice(amazon_item.getFbaPrice());
358
						amazonfbasalessnapshot.setOurPrice(amazon_item.getFbaPrice());
359
						amazonfbasalessnapshot.setOurPriceSnapshotDate(0);
359
						amazonfbasalessnapshot.setOurPriceSnapshotDate(0);
360
					}
360
					}
-
 
361
					System.out.println(" Item details are " + amazonfbasalessnapshot.getDateOfSale() + " "+ amazonfbasalessnapshot.getItem_id() + " " + amazonfbasalessnapshot.getTotalOrderCount());
361
					amazonfbasalessnapshot.setAmazonFbaInventory(inventory);
362
					amazonfbasalessnapshot.setAmazonFbaInventory(inventory);
362
					transactionClient.addOrUpdateAmazonFbaSalesSnapshot(amazonfbasalessnapshot);
363
					transactionClient.addOrUpdateAmazonFbaSalesSnapshot(amazonfbasalessnapshot);
363
				}
364
				}
364
			}
365
			}
365
		} catch (IOException e) {
366
		} catch (IOException e) {