| Line 38... |
Line 38... |
| 38 |
final public static String AMAZON_FBA_SHEET = "/home/vikram/Desktop/FBA-Stock-File.xls";
|
38 |
final public static String AMAZON_FBA_SHEET = "/home/vikram/Desktop/FBA-Stock-File.xls";
|
| 39 |
public static void main(String... args){
|
39 |
public static void main(String... args){
|
| 40 |
CSVReader orderreportreader = null;
|
40 |
CSVReader orderreportreader = null;
|
| 41 |
CSVReader inventoryhealthreportreader = null;
|
41 |
CSVReader inventoryhealthreportreader = null;
|
| 42 |
try {
|
42 |
try {
|
| 43 |
orderreportreader = new CSVReader(new FileReader("/home/vikram/Desktop/amazonorderreport.csv"),'\t');
|
43 |
orderreportreader = new CSVReader(new FileReader("/home/amazonorderreport.csv"),'\t');
|
| 44 |
inventoryhealthreportreader = new CSVReader(new FileReader("/home/vikram/Desktop/inventoryhealthreport.csv"),'\t');
|
44 |
inventoryhealthreportreader = new CSVReader(new FileReader("/home/inventoryhealthreport.csv"),'\t');
|
| 45 |
} catch (FileNotFoundException e) {
|
45 |
} catch (FileNotFoundException e) {
|
| 46 |
// TODO Auto-generated catch block
|
46 |
// TODO Auto-generated catch block
|
| 47 |
e.printStackTrace();
|
47 |
e.printStackTrace();
|
| 48 |
}
|
48 |
}
|
| 49 |
String [] nextLine;
|
49 |
String [] nextLine;
|
| Line 59... |
Line 59... |
| 59 |
Date date = istFormatter.parse(nextLine[2]);
|
59 |
Date date = istFormatter.parse(nextLine[2]);
|
| 60 |
SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
|
60 |
SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
|
| 61 |
Date date_key = dateFormat.parse(dateFormat.format(date));
|
61 |
Date date_key = dateFormat.parse(dateFormat.format(date));
|
| 62 |
System.out.println(nextLine[0]+" "+date_key+" "+ nextLine[11] +" " + nextLine[13] + " " + nextLine[14]);
|
62 |
System.out.println(nextLine[0]+" "+date_key+" "+ nextLine[11] +" " + nextLine[13] + " " + nextLine[14]);
|
| 63 |
Long itemid = Long.parseLong(nextLine[11].replaceAll("FBA",""));
|
63 |
Long itemid = Long.parseLong(nextLine[11].replaceAll("FBA",""));
|
| - |
|
64 |
|
| 64 |
Integer qty = new Integer(nextLine[14]);
|
65 |
Integer qty = new Integer(nextLine[14]);
|
| 65 |
Float itemSale=null;
|
66 |
Float itemSale = null;
|
| 66 |
if(nextLine[16].length()!=0){
|
67 |
if(nextLine[16].length()!=0){
|
| 67 |
itemSale = new Float(nextLine[16]);
|
68 |
itemSale = new Float(nextLine[16]);
|
| 68 |
}
|
69 |
}
|
| 69 |
else{
|
70 |
else{
|
| 70 |
continue;
|
71 |
continue;
|
| 71 |
}
|
72 |
}
|
| 72 |
System.out.println("Item Sale " + itemSale );
|
- |
|
| 73 |
Float itemDiscount;
|
73 |
Float itemDiscount;
|
| 74 |
if(nextLine[22].length()!=0){
|
74 |
if(nextLine[22].length()!=0){
|
| 75 |
itemDiscount = new Float(nextLine[22]);
|
75 |
itemDiscount = new Float(nextLine[22]);
|
| 76 |
}
|
76 |
}
|
| 77 |
else{
|
77 |
else{
|
| Line 79... |
Line 79... |
| 79 |
}
|
79 |
}
|
| 80 |
if(orderDateItemIdFbaSaleSnapshotMap.containsKey(date_key)){
|
80 |
if(orderDateItemIdFbaSaleSnapshotMap.containsKey(date_key)){
|
| 81 |
if(orderDateItemIdFbaSaleSnapshotMap.get(date_key).containsKey(itemid)){
|
81 |
if(orderDateItemIdFbaSaleSnapshotMap.get(date_key).containsKey(itemid)){
|
| 82 |
FbaSalesSnapshot fbaSalesSnapshot = orderDateItemIdFbaSaleSnapshotMap.get(date_key).get(itemid);
|
82 |
FbaSalesSnapshot fbaSalesSnapshot = orderDateItemIdFbaSaleSnapshotMap.get(date_key).get(itemid);
|
| 83 |
if(itemDiscount!=0){
|
83 |
if(itemDiscount!=0){
|
| 84 |
fbaSalesSnapshot.setPromotionOrderCount(fbaSalesSnapshot.getPromotionOrderCount() + qty);
|
84 |
fbaSalesSnapshot.setPromotionOrderCount(fbaSalesSnapshot.getPromotionOrderCount()+qty);
|
| 85 |
fbaSalesSnapshot.setTotalPromotionSale(fbaSalesSnapshot.getTotalPromotionSale() + (itemSale - itemDiscount));
|
85 |
fbaSalesSnapshot.setTotalPromotionSale(fbaSalesSnapshot.getTotalPromotionSale() + (itemSale - itemDiscount));
|
| 86 |
}
|
86 |
}
|
| 87 |
fbaSalesSnapshot.setTotalOrderCount(fbaSalesSnapshot.getTotalOrderCount() + qty);
|
87 |
fbaSalesSnapshot.setTotalOrderCount(fbaSalesSnapshot.getTotalOrderCount() + qty);
|
| 88 |
fbaSalesSnapshot.setTotalSale(fbaSalesSnapshot.getTotalSale() + itemSale);
|
88 |
fbaSalesSnapshot.setTotalSale(fbaSalesSnapshot.getTotalSale() + itemSale);
|
| 89 |
orderDateItemIdFbaSaleSnapshotMap.get(date_key).put(itemid,fbaSalesSnapshot);
|
89 |
orderDateItemIdFbaSaleSnapshotMap.get(date_key).put(itemid,fbaSalesSnapshot);
|
| Line 126... |
Line 126... |
| 126 |
TransactionClient transactionServiceClient = null;
|
126 |
TransactionClient transactionServiceClient = null;
|
| 127 |
CatalogClient catalogServiceClient = null;
|
127 |
CatalogClient catalogServiceClient = null;
|
| 128 |
try {
|
128 |
try {
|
| 129 |
inventoryServiceClient = new InventoryClient();
|
129 |
inventoryServiceClient = new InventoryClient();
|
| 130 |
transactionServiceClient = new TransactionClient();
|
130 |
transactionServiceClient = new TransactionClient();
|
| 131 |
catalogServiceClient = new CatalogClient();
|
131 |
//catalogServiceClient = new CatalogClient();
|
| 132 |
//catalogServiceClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port");
|
132 |
catalogServiceClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port");
|
| 133 |
} catch (Exception e) {
|
133 |
} catch (Exception e) {
|
| 134 |
// TODO Auto-generated catch block
|
134 |
// TODO Auto-generated catch block
|
| 135 |
e.printStackTrace();
|
135 |
e.printStackTrace();
|
| 136 |
}
|
136 |
}
|
| 137 |
in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
|
137 |
in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
|
| Line 199... |
Line 199... |
| 199 |
}
|
199 |
}
|
| 200 |
else{
|
200 |
else{
|
| 201 |
oos=false;
|
201 |
oos=false;
|
| 202 |
}
|
202 |
}
|
| 203 |
Long item_id = entry1.getKey();
|
203 |
Long item_id = entry1.getKey();
|
| 204 |
System.out.println(orderDate +","+entry1.getKey().toString()+","+entry1.getValue()+","+ inventory +","+ oos+","+itemIdSalePriceMap.get(item_id)+","+itemIdminFBAPriceMap.get(item_id)+","+itemIdminMFNPriceMap.get(item_id));
|
204 |
System.out.println(orderDate +","+entry1.getKey()+","+entry1.getValue()+","+ inventory +","+ oos+","+itemIdSalePriceMap.get(item_id)+","+itemIdminFBAPriceMap.get(item_id)+","+itemIdminMFNPriceMap.get(item_id));
|
| 205 |
AmazonFbaSalesSnapshot amazonfbasalessnapshot = new AmazonFbaSalesSnapshot();
|
205 |
AmazonFbaSalesSnapshot amazonfbasalessnapshot = new AmazonFbaSalesSnapshot();
|
| 206 |
amazonfbasalessnapshot.setDateOfSale(orderDate.getTime());
|
206 |
amazonfbasalessnapshot.setDateOfSale(orderDate.getTime());
|
| 207 |
amazonfbasalessnapshot.setItem_id(entry1.getKey());
|
207 |
amazonfbasalessnapshot.setItem_id(entry1.getKey());
|
| 208 |
amazonfbasalessnapshot.setTotalOrderCount(entry1.getValue().getPromotionOrderCount());
|
208 |
amazonfbasalessnapshot.setTotalOrderCount(entry1.getValue().getPromotionOrderCount());
|
| 209 |
amazonfbasalessnapshot.setTotalOrderCount(entry1.getValue().getTotalOrderCount());
|
209 |
amazonfbasalessnapshot.setTotalOrderCount(entry1.getValue().getTotalOrderCount());
|
| Line 232... |
Line 232... |
| 232 |
}
|
232 |
}
|
| 233 |
else{
|
233 |
else{
|
| 234 |
amazonfbasalessnapshot.setMinMfnPrice(0.0);
|
234 |
amazonfbasalessnapshot.setMinMfnPrice(0.0);
|
| 235 |
}
|
235 |
}
|
| 236 |
amazonfbasalessnapshot.setAmazonFbaInventory(inventory);
|
236 |
amazonfbasalessnapshot.setAmazonFbaInventory(inventory);
|
| 237 |
System.out.println("Item ID is " + amazonfbasalessnapshot.getItem_id() + " Min Price is " + amazonfbasalessnapshot.getMinFbaPrice());
|
- |
|
| 238 |
transactionClient.addOrUpdateAmazonFbaSalesSnapshot(amazonfbasalessnapshot);
|
237 |
transactionClient.addOrUpdateAmazonFbaSalesSnapshot(amazonfbasalessnapshot);
|
| 239 |
}
|
238 |
}
|
| 240 |
}
|
239 |
}
|
| 241 |
} catch (IOException e) {
|
240 |
} catch (IOException e) {
|
| 242 |
// TODO Auto-generated catch block
|
241 |
// TODO Auto-generated catch block
|