| Line 625... |
Line 625... |
| 625 |
File file = new File("/tmp/snapdeal-bulk-upload-template.xls");
|
625 |
File file = new File("/tmp/snapdeal-bulk-upload-template.xls");
|
| 626 |
HSSFWorkbook hwb=new HSSFWorkbook();
|
626 |
HSSFWorkbook hwb=new HSSFWorkbook();
|
| 627 |
HSSFSheet sheet = hwb.createSheet("Snapdeal-Listings");
|
627 |
HSSFSheet sheet = hwb.createSheet("Snapdeal-Listings");
|
| 628 |
HSSFRow rowhead= sheet.createRow((short)0);
|
628 |
HSSFRow rowhead= sheet.createRow((short)0);
|
| 629 |
rowhead.createCell((short) 0).setCellValue("ITEM-ID");
|
629 |
rowhead.createCell((short) 0).setCellValue("ITEM-ID");
|
| - |
|
630 |
rowhead.createCell((short) 1).setCellValue("PRODUCT");
|
| 630 |
rowhead.createCell((short) 1).setCellValue("WAREHOUSE-ID");
|
631 |
rowhead.createCell((short) 2).setCellValue("WAREHOUSE-ID");
|
| 631 |
rowhead.createCell((short) 2).setCellValue("EXCEPTIONAL-PRICE");
|
632 |
rowhead.createCell((short) 3).setCellValue("EXCEPTIONAL-PRICE");
|
| 632 |
rowhead.createCell((short) 3).setCellValue("SNAPDEAL-LISTED");
|
633 |
rowhead.createCell((short) 4).setCellValue("SNAPDEAL-LISTED");
|
| 633 |
rowhead.createCell((short) 4).setCellValue("TRANSFER-PRICE");
|
634 |
rowhead.createCell((short) 5).setCellValue("TRANSFER-PRICE");
|
| 634 |
rowhead.createCell((short) 5).setCellValue("SELLING-PRICE");
|
635 |
rowhead.createCell((short) 6).setCellValue("SELLING-PRICE");
|
| 635 |
rowhead.createCell((short) 6).setCellValue("LOWEST POSSIBLE SP");
|
636 |
rowhead.createCell((short) 7).setCellValue("LOWEST POSSIBLE SP");
|
| 636 |
rowhead.createCell((short) 7).setCellValue("LOWEST POSSIBLE TP");
|
637 |
rowhead.createCell((short) 8).setCellValue("LOWEST POSSIBLE TP");
|
| 637 |
rowhead.createCell((short) 8).setCellValue("OTHER COST");
|
638 |
rowhead.createCell((short) 9).setCellValue("OTHER COST");
|
| 638 |
rowhead.createCell((short) 9).setCellValue("COURIER-COST");
|
639 |
rowhead.createCell((short) 10).setCellValue("COURIER-COST");
|
| 639 |
rowhead.createCell((short) 10).setCellValue("COMMISION");
|
640 |
rowhead.createCell((short) 11).setCellValue("COMMISION");
|
| 640 |
rowhead.createCell((short) 11).setCellValue("SERVICE-TAX");
|
641 |
rowhead.createCell((short) 12).setCellValue("SERVICE-TAX");
|
| 641 |
rowhead.createCell((short) 12).setCellValue("Suppress Inventory Feed");
|
642 |
rowhead.createCell((short) 13).setCellValue("Suppress Inventory Feed");
|
| 642 |
rowhead.createCell((short) 13).setCellValue("Suppress Price Feed");
|
643 |
rowhead.createCell((short) 14).setCellValue("Suppress Price Feed");
|
| 643 |
rowhead.createCell((short) 14).setCellValue("AUTO FAVOURITE");
|
644 |
rowhead.createCell((short) 15).setCellValue("AUTO FAVOURITE");
|
| 644 |
rowhead.createCell((short) 15).setCellValue("MANUAL FAVOURITE");
|
645 |
rowhead.createCell((short) 16).setCellValue("MANUAL FAVOURITE");
|
| 645 |
rowhead.createCell((short) 16).setCellValue("AUTO INCREMENT");
|
646 |
rowhead.createCell((short) 17).setCellValue("AUTO INCREMENT");
|
| 646 |
rowhead.createCell((short) 17).setCellValue("AUTO DECREMENT");
|
647 |
rowhead.createCell((short) 18).setCellValue("AUTO DECREMENT");
|
| 647 |
rowhead.createCell((short) 18).setCellValue("Max NLC");
|
648 |
rowhead.createCell((short) 19).setCellValue("Max NLC");
|
| 648 |
rowhead.createCell((short) 19).setCellValue("SKU @ Snapdeal");
|
649 |
rowhead.createCell((short) 20).setCellValue("SKU @ Snapdeal");
|
| 649 |
rowhead.createCell((short) 20).setCellValue("SUPC");
|
650 |
rowhead.createCell((short) 21).setCellValue("SUPC");
|
| 650 |
Client catalogClient = null;
|
651 |
Client catalogClient = null;
|
| 651 |
List<SnapdealItemDetails> snapdealItems = null;
|
652 |
List<SnapdealItemDetails> snapdealItems = null;
|
| 652 |
try {
|
653 |
try {
|
| 653 |
catalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
|
654 |
catalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
|
| 654 |
snapdealItems = catalogClient.getAllSnapdealItems();
|
655 |
snapdealItems = catalogClient.getAllSnapdealItems();
|
| 655 |
} catch (Exception e) {
|
656 |
} catch (Exception e) {
|
| 656 |
e.printStackTrace();
|
657 |
e.printStackTrace();
|
| 657 |
}
|
658 |
}
|
| 658 |
int iterator=1;
|
659 |
int iterator=1;
|
| - |
|
660 |
Item item;
|
| - |
|
661 |
MarketplaceItems marketplaceItem;
|
| 659 |
for(SnapdealItemDetails snapdealItem:snapdealItems){
|
662 |
for(SnapdealItemDetails snapdealItem:snapdealItems){
|
| 660 |
MarketplaceItems marketplaceItem = catalogClient.getMarketplacedetailsForItem(snapdealItem.getItem_id(), 7);
|
663 |
marketplaceItem = catalogClient.getMarketplacedetailsForItem(snapdealItem.getItem_id(), 7);
|
| - |
|
664 |
try {
|
| - |
|
665 |
item = catalogClient.getItem(snapdealItem.getItem_id());
|
| - |
|
666 |
} catch (CatalogServiceException e) {
|
| - |
|
667 |
e.printStackTrace();
|
| - |
|
668 |
continue;
|
| - |
|
669 |
}
|
| 661 |
HSSFRow row = sheet.createRow((short)iterator);
|
670 |
HSSFRow row = sheet.createRow((short)iterator);
|
| 662 |
row.createCell((short) 0).setCellValue(snapdealItem.getItem_id());
|
671 |
row.createCell((short) 0).setCellValue(snapdealItem.getItem_id());
|
| - |
|
672 |
row.createCell((short) 1).setCellValue();
|
| 663 |
row.createCell((short) 1).setCellValue(snapdealItem.getWarehouseId());
|
673 |
row.createCell((short) 2).setCellValue(snapdealItem.getWarehouseId());
|
| 664 |
row.createCell((short) 2).setCellValue(roundTwoDecimals(snapdealItem.getExceptionPrice()));
|
674 |
row.createCell((short) 3).setCellValue(roundTwoDecimals(snapdealItem.getExceptionPrice()));
|
| 665 |
if(snapdealItem.isIsListedOnSnapdeal()){
|
675 |
if(snapdealItem.isIsListedOnSnapdeal()){
|
| 666 |
row.createCell((short) 3).setCellValue(1);
|
676 |
row.createCell((short) 4).setCellValue(1);
|
| 667 |
}
|
677 |
}
|
| 668 |
else{
|
678 |
else{
|
| 669 |
row.createCell((short) 3).setCellValue(0);
|
679 |
row.createCell((short) 4).setCellValue(0);
|
| 670 |
}
|
680 |
}
|
| 671 |
row.createCell((short) 4).setCellValue(roundTwoDecimals(snapdealItem.getTransferPrice()));
|
681 |
row.createCell((short) 5).setCellValue(roundTwoDecimals(snapdealItem.getTransferPrice()));
|
| 672 |
row.createCell((short) 5).setCellValue(roundTwoDecimals(snapdealItem.getSellingPrice()));
|
682 |
row.createCell((short) 6).setCellValue(roundTwoDecimals(snapdealItem.getSellingPrice()));
|
| 673 |
row.createCell((short) 6).setCellValue(roundTwoDecimals(marketplaceItem.getMinimumPossibleSp()));
|
683 |
row.createCell((short) 7).setCellValue(roundTwoDecimals(marketplaceItem.getMinimumPossibleSp()));
|
| 674 |
row.createCell((short) 7).setCellValue(roundTwoDecimals(marketplaceItem.getMinimumPossibleTp()));
|
684 |
row.createCell((short) 8).setCellValue(roundTwoDecimals(marketplaceItem.getMinimumPossibleTp()));
|
| 675 |
row.createCell((short) 8).setCellValue(roundTwoDecimals(marketplaceItem.getOtherCost()));
|
685 |
row.createCell((short) 9).setCellValue(roundTwoDecimals(marketplaceItem.getOtherCost()));
|
| 676 |
row.createCell((short) 9).setCellValue(snapdealItem.getCourierCost());
|
686 |
row.createCell((short) 10).setCellValue(snapdealItem.getCourierCost());
|
| 677 |
row.createCell((short) 10).setCellValue(roundTwoDecimals(snapdealItem.getCommission()));
|
687 |
row.createCell((short) 11).setCellValue(roundTwoDecimals(snapdealItem.getCommission()));
|
| 678 |
row.createCell((short) 11).setCellValue(roundTwoDecimals(snapdealItem.getServiceTax()));
|
688 |
row.createCell((short) 12).setCellValue(roundTwoDecimals(snapdealItem.getServiceTax()));
|
| 679 |
if(snapdealItem.isSuppressInventoryFeed()){
|
689 |
if(snapdealItem.isSuppressInventoryFeed()){
|
| 680 |
row.createCell((short) 12).setCellValue(1);
|
- |
|
| 681 |
}
|
- |
|
| 682 |
else{
|
- |
|
| 683 |
row.createCell((short) 12).setCellValue(0);
|
- |
|
| 684 |
}
|
- |
|
| 685 |
if(snapdealItem.isSuppressPriceFeed()){
|
- |
|
| 686 |
row.createCell((short) 13).setCellValue(1);
|
690 |
row.createCell((short) 13).setCellValue(1);
|
| 687 |
}
|
691 |
}
|
| 688 |
else{
|
692 |
else{
|
| 689 |
row.createCell((short) 13).setCellValue(0);
|
693 |
row.createCell((short) 13).setCellValue(0);
|
| 690 |
}
|
694 |
}
|
| 691 |
if(marketplaceItem.isAutoFavourite()){
|
695 |
if(snapdealItem.isSuppressPriceFeed()){
|
| 692 |
row.createCell((short) 14).setCellValue(1);
|
696 |
row.createCell((short) 14).setCellValue(1);
|
| 693 |
}
|
697 |
}
|
| 694 |
else{
|
698 |
else{
|
| 695 |
row.createCell((short) 14).setCellValue(0);
|
699 |
row.createCell((short) 14).setCellValue(0);
|
| 696 |
}
|
700 |
}
|
| 697 |
if(marketplaceItem.isManualFavourite()){
|
701 |
if(marketplaceItem.isAutoFavourite()){
|
| 698 |
row.createCell((short) 15).setCellValue(1);
|
702 |
row.createCell((short) 15).setCellValue(1);
|
| 699 |
}
|
703 |
}
|
| 700 |
else{
|
704 |
else{
|
| 701 |
row.createCell((short) 15).setCellValue(0);
|
705 |
row.createCell((short) 15).setCellValue(0);
|
| 702 |
}
|
706 |
}
|
| 703 |
if(marketplaceItem.isAutoIncrement()){
|
707 |
if(marketplaceItem.isManualFavourite()){
|
| 704 |
row.createCell((short) 16).setCellValue(1);
|
708 |
row.createCell((short) 16).setCellValue(1);
|
| 705 |
}
|
709 |
}
|
| 706 |
else{
|
710 |
else{
|
| 707 |
row.createCell((short) 16).setCellValue(0);
|
711 |
row.createCell((short) 16).setCellValue(0);
|
| 708 |
}
|
712 |
}
|
| 709 |
if(marketplaceItem.isAutoDecrement()){
|
713 |
if(marketplaceItem.isAutoIncrement()){
|
| 710 |
row.createCell((short) 17).setCellValue(1);
|
714 |
row.createCell((short) 17).setCellValue(1);
|
| 711 |
}
|
715 |
}
|
| 712 |
else{
|
716 |
else{
|
| 713 |
row.createCell((short) 17).setCellValue(0);
|
717 |
row.createCell((short) 17).setCellValue(0);
|
| 714 |
}
|
718 |
}
|
| - |
|
719 |
if(marketplaceItem.isAutoDecrement()){
|
| - |
|
720 |
row.createCell((short) 18).setCellValue(1);
|
| - |
|
721 |
}
|
| - |
|
722 |
else{
|
| - |
|
723 |
row.createCell((short) 18).setCellValue(0);
|
| - |
|
724 |
}
|
| 715 |
row.createCell((short) 18).setCellValue(snapdealItem.getMaxNlc());
|
725 |
row.createCell((short) 19).setCellValue(snapdealItem.getMaxNlc());
|
| 716 |
row.createCell((short) 19).setCellValue(snapdealItem.getSkuAtSnapdeal());
|
726 |
row.createCell((short) 20).setCellValue(snapdealItem.getSkuAtSnapdeal());
|
| 717 |
row.createCell((short) 20).setCellValue(snapdealItem.getSupc());
|
727 |
row.createCell((short) 21).setCellValue(snapdealItem.getSupc());
|
| 718 |
iterator++;
|
728 |
iterator++;
|
| 719 |
}
|
729 |
}
|
| 720 |
|
730 |
|
| 721 |
FileOutputStream fileOut = null;
|
731 |
FileOutputStream fileOut = null;
|
| 722 |
try {
|
732 |
try {
|