| Line 355... |
Line 355... |
| 355 |
}
|
355 |
}
|
| 356 |
}
|
356 |
}
|
| 357 |
else{
|
357 |
else{
|
| 358 |
System.out.println("No inventory in FBA");
|
358 |
System.out.println("No inventory in FBA");
|
| 359 |
}
|
359 |
}
|
| 360 |
Map<Long,Double> itemIdOurPriceMap = new HashMap<Long,Double>();
|
360 |
Map<Long,PriceAtDate> itemIdOurPriceMap = new HashMap<Long,PriceAtDate>();
|
| 361 |
Map<Long,Double> itemIdSalePriceMap = new HashMap<Long,Double>();
|
361 |
Map<Long,PriceAtDate> itemIdSalePriceMap = new HashMap<Long,PriceAtDate>();
|
| 362 |
Map<Long,Double> itemIdminFBAPriceMap = new HashMap<Long,Double>();
|
362 |
Map<Long,PriceAtDate> itemIdminFBAPriceMap = new HashMap<Long,PriceAtDate>();
|
| 363 |
Map<Long,Double> itemIdminMFNPriceMap = new HashMap<Long,Double>();
|
363 |
Map<Long,PriceAtDate> itemIdminMFNPriceMap = new HashMap<Long,PriceAtDate>();
|
| 364 |
count=1;
|
364 |
count=1;
|
| 365 |
while ((nextLine = inventoryhealthreportreader.readNext()) != null ) {
|
365 |
while ((nextLine = inventoryhealthreportreader.readNext()) != null ) {
|
| 366 |
if(count!=1){
|
366 |
if(count!=1){
|
| 367 |
//System.out.println(nextLine[1] +" "+ nextLine[31] +" " + nextLine[32] + " " + nextLine[34]);
|
367 |
//System.out.println(nextLine[1] +" "+ nextLine[31] +" " + nextLine[32] + " " + nextLine[34]);
|
| - |
|
368 |
SimpleDateFormat istFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
| - |
|
369 |
istFormatter .setLenient(false);
|
| - |
|
370 |
TimeZone zone= TimeZone.getTimeZone("GMT");
|
| - |
|
371 |
istFormatter.setTimeZone(zone);
|
| - |
|
372 |
Date date = istFormatter.parse(nextLine[0]);
|
| 368 |
Long item_id = Long.parseLong(nextLine[1].replaceAll("FBA",""));
|
373 |
Long item_id = Long.parseLong(nextLine[1].replaceAll("FBA",""));
|
| 369 |
Double ourPrice = null;
|
374 |
Double ourPrice = null;
|
| 370 |
Double minFBAPrice= null;
|
375 |
Double minFBAPrice= null;
|
| 371 |
Double minMFNPrice= null;
|
376 |
Double minMFNPrice= null;
|
| 372 |
Double salePrice= null;
|
377 |
Double salePrice= null;
|
| 373 |
|
- |
|
| 374 |
if(nextLine[30].length() >0){
|
378 |
if(nextLine[30].length() >0){
|
| 375 |
ourPrice = Double.parseDouble(nextLine[30]);
|
379 |
ourPrice = Double.parseDouble(nextLine[30]);
|
| - |
|
380 |
if(itemIdOurPriceMap.containsKey(item_id) && itemIdOurPriceMap.get(item_id).getDate().before(date)){
|
| - |
|
381 |
itemIdOurPriceMap.get(item_id).setDate(date);
|
| - |
|
382 |
itemIdOurPriceMap.get(item_id).setPrice(ourPrice);
|
| - |
|
383 |
}
|
| - |
|
384 |
else{
|
| - |
|
385 |
PriceAtDate priceAtDate= new PriceAtDate();
|
| - |
|
386 |
priceAtDate.setDate(date);
|
| - |
|
387 |
priceAtDate.setPrice(ourPrice);
|
| 376 |
itemIdOurPriceMap.put(item_id,ourPrice);
|
388 |
itemIdOurPriceMap.put(item_id,priceAtDate);
|
| - |
|
389 |
}
|
| 377 |
}
|
390 |
}
|
| 378 |
if(nextLine[31].length() >0){
|
391 |
if(nextLine[31].length() >0){
|
| 379 |
salePrice = Double.parseDouble(nextLine[31]);
|
392 |
salePrice = Double.parseDouble(nextLine[31]);
|
| - |
|
393 |
if(itemIdSalePriceMap.containsKey(item_id) && itemIdSalePriceMap.get(item_id).getDate().before(date)){
|
| - |
|
394 |
itemIdSalePriceMap.get(item_id).setDate(date);
|
| - |
|
395 |
itemIdSalePriceMap.get(item_id).setPrice(ourPrice);
|
| - |
|
396 |
}
|
| - |
|
397 |
else{
|
| - |
|
398 |
PriceAtDate priceAtDate= new PriceAtDate();
|
| - |
|
399 |
priceAtDate.setDate(date);
|
| - |
|
400 |
priceAtDate.setPrice(ourPrice);
|
| 380 |
itemIdSalePriceMap.put(item_id,salePrice);
|
401 |
itemIdSalePriceMap.put(item_id,priceAtDate);
|
| - |
|
402 |
}
|
| 381 |
}
|
403 |
}
|
| 382 |
if(nextLine[32].length() >0){
|
404 |
if(nextLine[32].length() >0){
|
| 383 |
minFBAPrice = Double.parseDouble(nextLine[32]);
|
405 |
minFBAPrice = Double.parseDouble(nextLine[32]);
|
| - |
|
406 |
if(itemIdminFBAPriceMap.containsKey(item_id) && itemIdminFBAPriceMap.get(item_id).getDate().before(date)){
|
| - |
|
407 |
itemIdminFBAPriceMap.get(item_id).setDate(date);
|
| - |
|
408 |
itemIdminFBAPriceMap.get(item_id).setPrice(ourPrice);
|
| - |
|
409 |
}
|
| - |
|
410 |
else{
|
| - |
|
411 |
PriceAtDate priceAtDate= new PriceAtDate();
|
| - |
|
412 |
priceAtDate.setDate(date);
|
| - |
|
413 |
priceAtDate.setPrice(ourPrice);
|
| 384 |
itemIdminFBAPriceMap.put(item_id,minFBAPrice);
|
414 |
itemIdminFBAPriceMap.put(item_id,priceAtDate);
|
| - |
|
415 |
}
|
| 385 |
}
|
416 |
}
|
| 386 |
if(nextLine[34].length() >0){
|
417 |
if(nextLine[34].length() >0){
|
| 387 |
minMFNPrice = Double.parseDouble(nextLine[34]);
|
418 |
minMFNPrice = Double.parseDouble(nextLine[34]);
|
| - |
|
419 |
if(itemIdminMFNPriceMap.containsKey(item_id) && itemIdminMFNPriceMap.get(item_id).getDate().before(date)){
|
| - |
|
420 |
itemIdminMFNPriceMap.get(item_id).setDate(date);
|
| - |
|
421 |
itemIdminMFNPriceMap.get(item_id).setPrice(ourPrice);
|
| - |
|
422 |
}
|
| - |
|
423 |
else{
|
| - |
|
424 |
PriceAtDate priceAtDate= new PriceAtDate();
|
| - |
|
425 |
priceAtDate.setDate(date);
|
| - |
|
426 |
priceAtDate.setPrice(ourPrice);
|
| 388 |
itemIdminMFNPriceMap.put(item_id,minMFNPrice);
|
427 |
itemIdminMFNPriceMap.put(item_id,priceAtDate);
|
| - |
|
428 |
}
|
| 389 |
}
|
429 |
}
|
| 390 |
}
|
430 |
}
|
| 391 |
count++;
|
431 |
count++;
|
| 392 |
}
|
432 |
}
|
| 393 |
boolean oos;
|
433 |
boolean oos;
|
| Line 418... |
Line 458... |
| 418 |
amazon_item = catalogClient.getAmazonItemDetails(item_id);
|
458 |
amazon_item = catalogClient.getAmazonItemDetails(item_id);
|
| 419 |
}
|
459 |
}
|
| 420 |
else{
|
460 |
else{
|
| 421 |
continue;
|
461 |
continue;
|
| 422 |
}
|
462 |
}
|
| 423 |
if(itemIdSalePriceMap.containsKey(item_id) && itemIdSalePriceMap.get(item_id)!=0){
|
463 |
if(itemIdSalePriceMap.containsKey(item_id) && itemIdSalePriceMap.get(item_id).getPrice()!=0){
|
| 424 |
amazonfbasalessnapshot.setSalePrice(itemIdSalePriceMap.get(item_id));
|
464 |
amazonfbasalessnapshot.setSalePrice(itemIdSalePriceMap.get(item_id).getPrice());
|
| 425 |
}
|
465 |
}
|
| 426 |
else{
|
466 |
else{
|
| 427 |
amazonfbasalessnapshot.setSalePrice(0.0);
|
467 |
amazonfbasalessnapshot.setSalePrice(0.0);
|
| 428 |
}
|
468 |
}
|
| 429 |
if(itemIdminMFNPriceMap.containsKey(item_id) && itemIdminMFNPriceMap.get(item_id)!=0){
|
469 |
if(itemIdminMFNPriceMap.containsKey(item_id) && itemIdminMFNPriceMap.get(item_id).getPrice()!=0){
|
| 430 |
amazonfbasalessnapshot.setMinMfnPrice(itemIdminMFNPriceMap.get(item_id));
|
470 |
amazonfbasalessnapshot.setMinMfnPrice(itemIdminMFNPriceMap.get(item_id).getPrice());
|
| 431 |
}
|
471 |
}
|
| 432 |
else{
|
472 |
else{
|
| 433 |
amazonfbasalessnapshot.setMinMfnPrice(0.0);
|
473 |
amazonfbasalessnapshot.setMinMfnPrice(0.0);
|
| 434 |
}
|
474 |
}
|
| 435 |
if(itemIdminFBAPriceMap.containsKey(item_id) && itemIdminFBAPriceMap.get(item_id)!=0){
|
475 |
if(itemIdminFBAPriceMap.containsKey(item_id) && itemIdminFBAPriceMap.get(item_id).getPrice()!=0){
|
| 436 |
amazonfbasalessnapshot.setMinFbaPrice(itemIdminFBAPriceMap.get(item_id));
|
476 |
amazonfbasalessnapshot.setMinFbaPrice(itemIdminFBAPriceMap.get(item_id).getPrice());
|
| 437 |
}
|
477 |
}
|
| 438 |
else{
|
478 |
else{
|
| 439 |
amazonfbasalessnapshot.setMinFbaPrice(0.0);
|
479 |
amazonfbasalessnapshot.setMinFbaPrice(0.0);
|
| 440 |
}
|
480 |
}
|
| 441 |
if(itemIdOurPriceMap.containsKey(item_id) && itemIdOurPriceMap.get(item_id)!=0){
|
481 |
if(itemIdOurPriceMap.containsKey(item_id) && itemIdOurPriceMap.get(item_id).getPrice()!=0){
|
| 442 |
amazonfbasalessnapshot.setOurPrice(itemIdOurPriceMap.get(item_id));
|
482 |
amazonfbasalessnapshot.setOurPrice(itemIdOurPriceMap.get(item_id).getPrice());
|
| 443 |
}
|
483 |
}
|
| 444 |
else{
|
484 |
else{
|
| 445 |
amazonfbasalessnapshot.setOurPrice(amazon_item.getFbaPrice());
|
485 |
amazonfbasalessnapshot.setOurPrice(amazon_item.getFbaPrice());
|
| 446 |
}
|
486 |
}
|
| 447 |
amazonfbasalessnapshot.setAmazonFbaInventory(inventory);
|
487 |
amazonfbasalessnapshot.setAmazonFbaInventory(inventory);
|