| Line 157... |
Line 157... |
| 157 |
inventoryhealthreportrequest.setStartDate(inventoryStartDate);
|
157 |
inventoryhealthreportrequest.setStartDate(inventoryStartDate);
|
| 158 |
inventoryhealthreportrequest.setEndDate(inventoryEndDate);
|
158 |
inventoryhealthreportrequest.setEndDate(inventoryEndDate);
|
| 159 |
Map<String,String> requestIdreportIdmap;
|
159 |
Map<String,String> requestIdreportIdmap;
|
| 160 |
String orderreportrequestId = RequestReportSample.invokeRequestReport(service, orderreportrequest);
|
160 |
String orderreportrequestId = RequestReportSample.invokeRequestReport(service, orderreportrequest);
|
| 161 |
String inventoryhealthreportrequestId = RequestReportSample.invokeRequestReport(service, inventoryhealthreportrequest);
|
161 |
String inventoryhealthreportrequestId = RequestReportSample.invokeRequestReport(service, inventoryhealthreportrequest);
|
| - |
|
162 |
int retry2=0;
|
| 162 |
while(true){
|
163 |
while(true){
|
| - |
|
164 |
int retry1 = 0;
|
| - |
|
165 |
while(true){
|
| 163 |
GetReportListRequest requestreportlist = new GetReportListRequest();
|
166 |
GetReportListRequest requestreportlist = new GetReportListRequest();
|
| 164 |
requestreportlist.setMerchant( merchantId );
|
167 |
requestreportlist.setMerchant( merchantId );
|
| 165 |
final IdList requestIdList = new IdList(Arrays.asList(orderreportrequestId,inventoryhealthreportrequestId));
|
168 |
final IdList requestIdList = new IdList(Arrays.asList(orderreportrequestId,inventoryhealthreportrequestId));
|
| 166 |
requestreportlist.setReportRequestIdList(requestIdList);
|
169 |
requestreportlist.setReportRequestIdList(requestIdList);
|
| 167 |
requestIdreportIdmap = GetReportListSample.invokeGetReportList(service, requestreportlist);
|
170 |
requestIdreportIdmap = GetReportListSample.invokeGetReportList(service, requestreportlist);
|
| 168 |
if(requestIdreportIdmap.get(orderreportrequestId)!=null && requestIdreportIdmap.get(inventoryhealthreportrequestId)!=null){
|
171 |
if(requestIdreportIdmap.get(orderreportrequestId)!=null && requestIdreportIdmap.get(inventoryhealthreportrequestId)!=null){
|
| 169 |
GetReportRequest requestorderreport = new GetReportRequest();
|
172 |
GetReportRequest requestorderreport = new GetReportRequest();
|
| 170 |
GetReportRequest requestinventoryhealthreport = new GetReportRequest();
|
173 |
GetReportRequest requestinventoryhealthreport = new GetReportRequest();
|
| 171 |
requestorderreport.setMerchant( merchantId );
|
174 |
requestorderreport.setMerchant( merchantId );
|
| 172 |
requestinventoryhealthreport.setMerchant(merchantId);
|
175 |
requestinventoryhealthreport.setMerchant(merchantId);
|
| 173 |
requestorderreport.setReportId( requestIdreportIdmap.get(orderreportrequestId));
|
176 |
requestorderreport.setReportId( requestIdreportIdmap.get(orderreportrequestId));
|
| 174 |
requestinventoryhealthreport.setReportId(requestIdreportIdmap.get(inventoryhealthreportrequestId));
|
177 |
requestinventoryhealthreport.setReportId(requestIdreportIdmap.get(inventoryhealthreportrequestId));
|
| 175 |
OutputStream orderreport=null;
|
178 |
OutputStream orderreport=null;
|
| 176 |
OutputStream inventoryhealthreport=null;
|
179 |
OutputStream inventoryhealthreport=null;
|
| 177 |
try {
|
180 |
try {
|
| 178 |
orderreport = new FileOutputStream( "/home/vikram/Desktop/amazonorderreport.csv" );
|
181 |
orderreport = new FileOutputStream( "/home/vikram/Desktop/amazonorderreport.csv" );
|
| 179 |
inventoryhealthreport = new FileOutputStream( "/home/vikram/Desktop/inventoryhealthreport.csv" );
|
182 |
inventoryhealthreport = new FileOutputStream( "/home/vikram/Desktop/inventoryhealthreport.csv" );
|
| 180 |
} catch (FileNotFoundException e) {
|
- |
|
| 181 |
// TODO Auto-generated catch block
|
- |
|
| 182 |
e.printStackTrace();
|
- |
|
| 183 |
}
|
- |
|
| 184 |
requestorderreport.setReportOutputStream(orderreport);
|
- |
|
| 185 |
requestinventoryhealthreport.setReportOutputStream(inventoryhealthreport);
|
- |
|
| 186 |
GetReportSample.invokeGetReport(service, requestorderreport);
|
- |
|
| 187 |
GetReportSample.invokeGetReport(service, requestinventoryhealthreport);
|
- |
|
| 188 |
System.out.println("Order and Inventory Reports are ready please check");
|
- |
|
| 189 |
CSVReader orderreportreader = null;
|
- |
|
| 190 |
CSVReader inventoryhealthreportreader = null;
|
- |
|
| 191 |
try {
|
- |
|
| 192 |
orderreportreader = new CSVReader(new FileReader("/home/vikram/Desktop/amazonorderreport.csv"),'\t');
|
- |
|
| 193 |
inventoryhealthreportreader = new CSVReader(new FileReader("/home/vikram/Desktop/inventoryhealthreport.csv"),'\t');
|
- |
|
| 194 |
} catch (FileNotFoundException e) {
|
183 |
} catch (FileNotFoundException e) {
|
| 195 |
// TODO Auto-generated catch block
|
184 |
// TODO Auto-generated catch block
|
| 196 |
e.printStackTrace();
|
185 |
e.printStackTrace();
|
| 197 |
}
|
- |
|
| 198 |
String [] nextLine;
|
- |
|
| 199 |
try {
|
- |
|
| 200 |
int count =1;
|
- |
|
| 201 |
Map<Date,Map<Long,Integer>> orderDateItemIdCountMap = new HashMap<Date,Map<Long,Integer>>();
|
- |
|
| 202 |
while ((nextLine = orderreportreader.readNext()) != null) {
|
- |
|
| 203 |
if(count!=1 && nextLine[5].equalsIgnoreCase("Amazon") && (nextLine[13].equalsIgnoreCase("Unshipped") || nextLine[13].equalsIgnoreCase("Shipped"))){
|
- |
|
| 204 |
SimpleDateFormat istFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
- |
|
| 205 |
istFormatter .setLenient(false);
|
- |
|
| 206 |
TimeZone zone= TimeZone.getTimeZone("GMT");
|
- |
|
| 207 |
istFormatter.setTimeZone(zone);
|
- |
|
| 208 |
Date date = istFormatter.parse(nextLine[2]);
|
- |
|
| 209 |
SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
|
- |
|
| 210 |
Date date_key = dateFormat.parse(dateFormat.format(date));
|
- |
|
| 211 |
System.out.println(nextLine[0]+" "+date_key+" "+ nextLine[11] +" " + nextLine[13] + " " + nextLine[14]);
|
- |
|
| 212 |
Long itemid = Long.parseLong(nextLine[11].replaceAll("FBA",""));
|
- |
|
| 213 |
Integer qty = new Integer(nextLine[14]);
|
- |
|
| 214 |
if(orderDateItemIdCountMap.containsKey(date_key)){
|
- |
|
| 215 |
if(orderDateItemIdCountMap.get(date_key).containsKey(itemid)){
|
- |
|
| 216 |
orderDateItemIdCountMap.get(date_key).put(itemid,orderDateItemIdCountMap.get(date_key).get(itemid)+qty);
|
- |
|
| 217 |
}
|
- |
|
| 218 |
else{
|
- |
|
| 219 |
orderDateItemIdCountMap.get(date_key).put(itemid,qty);
|
- |
|
| 220 |
}
|
- |
|
| 221 |
}
|
- |
|
| 222 |
else{
|
- |
|
| 223 |
|
- |
|
| 224 |
Map<Long,Integer> itemIdcountMap = new HashMap<Long,Integer>();
|
- |
|
| 225 |
itemIdcountMap.put(itemid,qty);
|
- |
|
| 226 |
orderDateItemIdCountMap.put(date_key,itemIdcountMap);
|
- |
|
| 227 |
}
|
- |
|
| 228 |
|
- |
|
| 229 |
}
|
- |
|
| 230 |
count++;
|
- |
|
| 231 |
}
|
186 |
}
|
| - |
|
187 |
requestorderreport.setReportOutputStream(orderreport);
|
| - |
|
188 |
requestinventoryhealthreport.setReportOutputStream(inventoryhealthreport);
|
| 232 |
InventoryClient inventoryServiceClient = null;
|
189 |
GetReportSample.invokeGetReport(service, requestorderreport);
|
| - |
|
190 |
GetReportSample.invokeGetReport(service, requestinventoryhealthreport);
|
| - |
|
191 |
System.out.println("Order and Inventory Reports are ready please check");
|
| 233 |
TransactionClient transactionServiceClient = null;
|
192 |
CSVReader orderreportreader = null;
|
| 234 |
CatalogClient catalogServiceClient = null;
|
193 |
CSVReader inventoryhealthreportreader = null;
|
| 235 |
try {
|
194 |
try {
|
| 236 |
inventoryServiceClient = new InventoryClient();
|
- |
|
| 237 |
transactionServiceClient = new TransactionClient();
|
195 |
orderreportreader = new CSVReader(new FileReader("/home/vikram/Desktop/amazonorderreport.csv"),'\t');
|
| 238 |
catalogServiceClient = new CatalogClient();
|
- |
|
| 239 |
//catalogServiceClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port");
|
196 |
inventoryhealthreportreader = new CSVReader(new FileReader("/home/vikram/Desktop/inventoryhealthreport.csv"),'\t');
|
| 240 |
} catch (Exception e) {
|
197 |
} catch (FileNotFoundException e) {
|
| 241 |
// TODO Auto-generated catch block
|
198 |
// TODO Auto-generated catch block
|
| 242 |
e.printStackTrace();
|
199 |
e.printStackTrace();
|
| 243 |
}
|
200 |
}
|
| - |
|
201 |
String [] nextLine;
|
| - |
|
202 |
try {
|
| - |
|
203 |
int count =1;
|
| 244 |
in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
|
204 |
Map<Date,Map<Long,Integer>> orderDateItemIdCountMap = new HashMap<Date,Map<Long,Integer>>();
|
| - |
|
205 |
while ((nextLine = orderreportreader.readNext()) != null) {
|
| 245 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = transactionServiceClient.getClient();
|
206 |
if(count!=1 && nextLine[5].equalsIgnoreCase("Amazon") && (nextLine[13].equalsIgnoreCase("Unshipped") || nextLine[13].equalsIgnoreCase("Shipped"))){
|
| 246 |
in.shop2020.model.v1.catalog.CatalogService.Client catalogClient = catalogServiceClient.getClient();
|
207 |
SimpleDateFormat istFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
| - |
|
208 |
istFormatter .setLenient(false);
|
| - |
|
209 |
TimeZone zone= TimeZone.getTimeZone("GMT");
|
| - |
|
210 |
istFormatter.setTimeZone(zone);
|
| - |
|
211 |
Date date = istFormatter.parse(nextLine[2]);
|
| 247 |
SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
|
212 |
SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
|
| 248 |
Date date_today = dateFormat.parse(dateFormat.format(new Date()));
|
213 |
Date date_key = dateFormat.parse(dateFormat.format(date));
|
| 249 |
List<AmazonFbaInventorySnapshot> nonzeroFbaInventorySnapshotlist = inventoryClient.getAllNonzeroAmazonFbaItemInventory();
|
214 |
System.out.println(nextLine[0]+" "+date_key+" "+ nextLine[11] +" " + nextLine[13] + " " + nextLine[14]);
|
| 250 |
if(nonzeroFbaInventorySnapshotlist!=null){
|
215 |
Long itemid = Long.parseLong(nextLine[11].replaceAll("FBA",""));
|
| 251 |
for(AmazonFbaInventorySnapshot amazonFbaInventory:nonzeroFbaInventorySnapshotlist){
|
216 |
Integer qty = new Integer(nextLine[14]);
|
| 252 |
if(orderDateItemIdCountMap.containsKey(date_today) ){
|
217 |
if(orderDateItemIdCountMap.containsKey(date_key)){
|
| 253 |
if(!orderDateItemIdCountMap.get(date_today).containsKey(amazonFbaInventory.getItem_id())){
|
218 |
if(orderDateItemIdCountMap.get(date_key).containsKey(itemid)){
|
| - |
|
219 |
orderDateItemIdCountMap.get(date_key).put(itemid,orderDateItemIdCountMap.get(date_key).get(itemid)+qty);
|
| - |
|
220 |
}
|
| - |
|
221 |
else{
|
| 254 |
orderDateItemIdCountMap.get(date_today).put(amazonFbaInventory.getItem_id(),0);
|
222 |
orderDateItemIdCountMap.get(date_key).put(itemid,qty);
|
| - |
|
223 |
}
|
| 255 |
}
|
224 |
}
|
| - |
|
225 |
else{
|
| 256 |
|
226 |
|
| - |
|
227 |
Map<Long,Integer> itemIdcountMap = new HashMap<Long,Integer>();
|
| - |
|
228 |
itemIdcountMap.put(itemid,qty);
|
| - |
|
229 |
orderDateItemIdCountMap.put(date_key,itemIdcountMap);
|
| 257 |
}
|
230 |
}
|
| - |
|
231 |
|
| - |
|
232 |
}
|
| - |
|
233 |
count++;
|
| - |
|
234 |
}
|
| - |
|
235 |
InventoryClient inventoryServiceClient = null;
|
| - |
|
236 |
TransactionClient transactionServiceClient = null;
|
| - |
|
237 |
CatalogClient catalogServiceClient = null;
|
| - |
|
238 |
try {
|
| - |
|
239 |
inventoryServiceClient = new InventoryClient();
|
| - |
|
240 |
transactionServiceClient = new TransactionClient();
|
| - |
|
241 |
catalogServiceClient = new CatalogClient();
|
| - |
|
242 |
//catalogServiceClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port");
|
| - |
|
243 |
} catch (Exception e) {
|
| - |
|
244 |
// TODO Auto-generated catch block
|
| - |
|
245 |
e.printStackTrace();
|
| - |
|
246 |
}
|
| - |
|
247 |
in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = inventoryServiceClient.getClient();
|
| - |
|
248 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = transactionServiceClient.getClient();
|
| - |
|
249 |
in.shop2020.model.v1.catalog.CatalogService.Client catalogClient = catalogServiceClient.getClient();
|
| - |
|
250 |
SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
|
| - |
|
251 |
Date date_today = dateFormat.parse(dateFormat.format(new Date()));
|
| - |
|
252 |
List<AmazonFbaInventorySnapshot> nonzeroFbaInventorySnapshotlist = inventoryClient.getAllNonzeroAmazonFbaItemInventory();
|
| - |
|
253 |
if(nonzeroFbaInventorySnapshotlist!=null){
|
| - |
|
254 |
for(AmazonFbaInventorySnapshot amazonFbaInventory:nonzeroFbaInventorySnapshotlist){
|
| - |
|
255 |
if(orderDateItemIdCountMap.containsKey(date_today) ){
|
| - |
|
256 |
if(!orderDateItemIdCountMap.get(date_today).containsKey(amazonFbaInventory.getItem_id())){
|
| - |
|
257 |
orderDateItemIdCountMap.get(date_today).put(amazonFbaInventory.getItem_id(),0);
|
| - |
|
258 |
}
|
| - |
|
259 |
|
| - |
|
260 |
}
|
| 258 |
else{
|
261 |
else{
|
| 259 |
Map<Long,Integer> itemIdcountMap = new HashMap<Long,Integer>();
|
262 |
Map<Long,Integer> itemIdcountMap = new HashMap<Long,Integer>();
|
| 260 |
itemIdcountMap.put(amazonFbaInventory.getItem_id(),0);
|
263 |
itemIdcountMap.put(amazonFbaInventory.getItem_id(),0);
|
| 261 |
orderDateItemIdCountMap.put(date_today,itemIdcountMap);
|
264 |
orderDateItemIdCountMap.put(date_today,itemIdcountMap);
|
| - |
|
265 |
}
|
| 262 |
}
|
266 |
}
|
| 263 |
}
|
267 |
}
|
| 264 |
}
|
- |
|
| 265 |
else{
|
268 |
else{
|
| 266 |
System.out.println("No inventory in FBA");
|
269 |
System.out.println("No inventory in FBA");
|
| 267 |
}
|
- |
|
| 268 |
orderDateItemIdCountMap.get(date_today);
|
- |
|
| 269 |
Map<Long,Double> itemIdSalePriceMap = new HashMap<Long,Double>();
|
- |
|
| 270 |
Map<Long,Double> itemIdminFBAPriceMap = new HashMap<Long,Double>();
|
- |
|
| 271 |
Map<Long,Double> itemIdminMFNPriceMap = new HashMap<Long,Double>();
|
- |
|
| 272 |
count=1;
|
- |
|
| 273 |
while ((nextLine = inventoryhealthreportreader.readNext()) != null ) {
|
- |
|
| 274 |
if(count!=1){
|
- |
|
| 275 |
//System.out.println(nextLine[1] +" "+ nextLine[31] +" " + nextLine[32] + " " + nextLine[34]);
|
- |
|
| 276 |
Long item_id = Long.parseLong(nextLine[1].replaceAll("FBA",""));
|
- |
|
| 277 |
Double salePrice = Double.parseDouble(nextLine[31]);
|
- |
|
| 278 |
Double minFBAPrice = Double.parseDouble(nextLine[32]);
|
- |
|
| 279 |
Double minMFNPrice = Double.parseDouble(nextLine[34]);
|
- |
|
| 280 |
itemIdSalePriceMap.put(item_id,salePrice);
|
- |
|
| 281 |
itemIdminFBAPriceMap.put(item_id,minFBAPrice);
|
- |
|
| 282 |
itemIdminMFNPriceMap.put(item_id,minMFNPrice);
|
- |
|
| 283 |
}
|
270 |
}
|
| 284 |
count++;
|
- |
|
| 285 |
}
|
- |
|
| 286 |
boolean oos;
|
- |
|
| 287 |
for (Map.Entry<Date, Map<Long, Integer>> entry : orderDateItemIdCountMap.entrySet()){
|
271 |
orderDateItemIdCountMap.get(date_today);
|
| 288 |
Date orderDate = entry.getKey();
|
272 |
Map<Long,Double> itemIdSalePriceMap = new HashMap<Long,Double>();
|
| 289 |
for(Map.Entry<Long, Integer> entry1 :entry.getValue().entrySet()){
|
273 |
Map<Long,Double> itemIdminFBAPriceMap = new HashMap<Long,Double>();
|
| 290 |
Long inventory = inventoryClient.getAmazonFbaItemInventory(entry1.getKey());
|
274 |
Map<Long,Double> itemIdminMFNPriceMap = new HashMap<Long,Double>();
|
| 291 |
oos=false;
|
275 |
count=1;
|
| 292 |
if(inventory==0 && entry1.getValue()==0)
|
276 |
while ((nextLine = inventoryhealthreportreader.readNext()) != null ) {
|
| 293 |
oos=true;
|
277 |
if(count!=1){
|
| 294 |
Long item_id = entry1.getKey();
|
- |
|
| 295 |
System.out.println(orderDate +","+entry1.getKey()+","+entry1.getValue()+","+ inventory +","+ oos+","+itemIdSalePriceMap.get(item_id)+","+itemIdminFBAPriceMap.get(item_id)+","+itemIdminMFNPriceMap.get(item_id));
|
- |
|
| 296 |
AmazonFbaSalesSnapshot amazonfbasalessnapshot = new AmazonFbaSalesSnapshot();
|
278 |
//System.out.println(nextLine[1] +" "+ nextLine[31] +" " + nextLine[32] + " " + nextLine[34]);
|
| 297 |
amazonfbasalessnapshot.setDateOfSale(orderDate.getTime());
|
279 |
Long item_id = Long.parseLong(nextLine[1].replaceAll("FBA",""));
|
| 298 |
amazonfbasalessnapshot.setItem_id(entry1.getKey());
|
280 |
Double salePrice = Double.parseDouble(nextLine[31]);
|
| 299 |
amazonfbasalessnapshot.setOrderCount(entry1.getValue());
|
281 |
Double minFBAPrice = Double.parseDouble(nextLine[32]);
|
| 300 |
amazonfbasalessnapshot.setIsOutOfStock(oos);
|
- |
|
| 301 |
Amazonlisted amazon_item = catalogClient.getAmazonItemDetails(item_id);
|
282 |
Double minMFNPrice = Double.parseDouble(nextLine[34]);
|
| 302 |
if(itemIdSalePriceMap.containsKey(item_id) && itemIdSalePriceMap.get(item_id)!=0){
|
283 |
itemIdSalePriceMap.put(item_id,salePrice);
|
| 303 |
amazonfbasalessnapshot.setSalePrice(itemIdSalePriceMap.get(item_id));
|
- |
|
| 304 |
}
|
- |
|
| 305 |
else{
|
- |
|
| 306 |
amazonfbasalessnapshot.setSalePrice(amazon_item.getFbaPrice());
|
284 |
itemIdminFBAPriceMap.put(item_id,minFBAPrice);
|
| 307 |
}
|
- |
|
| 308 |
if(itemIdminMFNPriceMap.containsKey(item_id) && itemIdminMFNPriceMap.get(item_id)!=0){
|
285 |
itemIdminMFNPriceMap.put(item_id,minMFNPrice);
|
| 309 |
amazonfbasalessnapshot.setMinFbaPrice(itemIdminMFNPriceMap.get(item_id));
|
- |
|
| 310 |
}
|
286 |
}
|
| - |
|
287 |
count++;
|
| - |
|
288 |
}
|
| - |
|
289 |
boolean oos;
|
| - |
|
290 |
for (Map.Entry<Date, Map<Long, Integer>> entry : orderDateItemIdCountMap.entrySet()){
|
| - |
|
291 |
Date orderDate = entry.getKey();
|
| - |
|
292 |
for(Map.Entry<Long, Integer> entry1 :entry.getValue().entrySet()){
|
| - |
|
293 |
Long inventory = inventoryClient.getAmazonFbaItemInventory(entry1.getKey());
|
| - |
|
294 |
oos=false;
|
| - |
|
295 |
if(inventory==0 && entry1.getValue()==0)
|
| - |
|
296 |
oos=true;
|
| - |
|
297 |
Long item_id = entry1.getKey();
|
| - |
|
298 |
System.out.println(orderDate +","+entry1.getKey()+","+entry1.getValue()+","+ inventory +","+ oos+","+itemIdSalePriceMap.get(item_id)+","+itemIdminFBAPriceMap.get(item_id)+","+itemIdminMFNPriceMap.get(item_id));
|
| - |
|
299 |
AmazonFbaSalesSnapshot amazonfbasalessnapshot = new AmazonFbaSalesSnapshot();
|
| - |
|
300 |
amazonfbasalessnapshot.setDateOfSale(orderDate.getTime());
|
| - |
|
301 |
amazonfbasalessnapshot.setItem_id(entry1.getKey());
|
| - |
|
302 |
amazonfbasalessnapshot.setOrderCount(entry1.getValue());
|
| - |
|
303 |
amazonfbasalessnapshot.setIsOutOfStock(oos);
|
| - |
|
304 |
Amazonlisted amazon_item = catalogClient.getAmazonItemDetails(item_id);
|
| - |
|
305 |
if(itemIdSalePriceMap.containsKey(item_id) && itemIdSalePriceMap.get(item_id)!=0){
|
| - |
|
306 |
amazonfbasalessnapshot.setSalePrice(itemIdSalePriceMap.get(item_id));
|
| - |
|
307 |
}
|
| - |
|
308 |
else{
|
| - |
|
309 |
amazonfbasalessnapshot.setSalePrice(amazon_item.getFbaPrice());
|
| - |
|
310 |
}
|
| 311 |
if(itemIdminMFNPriceMap.containsKey(item_id) && itemIdminMFNPriceMap.get(item_id)!=0){
|
311 |
if(itemIdminMFNPriceMap.containsKey(item_id) && itemIdminMFNPriceMap.get(item_id)!=0){
|
| - |
|
312 |
amazonfbasalessnapshot.setMinFbaPrice(itemIdminMFNPriceMap.get(item_id));
|
| - |
|
313 |
}
|
| - |
|
314 |
if(itemIdminMFNPriceMap.containsKey(item_id) && itemIdminMFNPriceMap.get(item_id)!=0){
|
| 312 |
amazonfbasalessnapshot.setMinMfnPrice(itemIdminMFNPriceMap.get(item_id));
|
315 |
amazonfbasalessnapshot.setMinMfnPrice(itemIdminMFNPriceMap.get(item_id));
|
| - |
|
316 |
}
|
| - |
|
317 |
amazonfbasalessnapshot.setAmazonFbaInventory(inventory);
|
| - |
|
318 |
transactionClient.addOrUpdateAmazonFbaSalesSnapshot(amazonfbasalessnapshot);
|
| 313 |
}
|
319 |
}
|
| 314 |
amazonfbasalessnapshot.setAmazonFbaInventory(inventory);
|
- |
|
| 315 |
transactionClient.addOrUpdateAmazonFbaSalesSnapshot(amazonfbasalessnapshot);
|
- |
|
| 316 |
}
|
320 |
}
|
| - |
|
321 |
} catch (IOException e) {
|
| - |
|
322 |
// TODO Auto-generated catch block
|
| - |
|
323 |
e.printStackTrace();
|
| - |
|
324 |
} catch (ParseException e) {
|
| - |
|
325 |
// TODO Auto-generated catch block
|
| - |
|
326 |
e.printStackTrace();
|
| - |
|
327 |
} catch (TException e) {
|
| - |
|
328 |
// TODO Auto-generated catch block
|
| - |
|
329 |
e.printStackTrace();
|
| 317 |
}
|
330 |
}
|
| 318 |
} catch (IOException e) {
|
- |
|
| 319 |
// TODO Auto-generated catch block
|
- |
|
| 320 |
e.printStackTrace();
|
- |
|
| 321 |
} catch (ParseException e) {
|
- |
|
| 322 |
// TODO Auto-generated catch block
|
- |
|
| 323 |
e.printStackTrace();
|
331 |
break;
|
| 324 |
} catch (TException e) {
|
- |
|
| 325 |
// TODO Auto-generated catch block
|
- |
|
| 326 |
e.printStackTrace();
|
- |
|
| 327 |
}
|
332 |
}
|
| 328 |
break;
|
- |
|
| 329 |
}
|
- |
|
| 330 |
else{
|
333 |
else{
|
| 331 |
System.out.println("Report not ready");
|
334 |
System.out.println("Report not ready");
|
| 332 |
try {
|
335 |
try {
|
| 333 |
Thread.sleep(5*60*1000);
|
336 |
Thread.sleep(5*60*1000);
|
| 334 |
} catch (InterruptedException e) {
|
337 |
} catch (InterruptedException e) {
|
| 335 |
// TODO Auto-generated catch block
|
338 |
// TODO Auto-generated catch block
|
| 336 |
e.printStackTrace();
|
339 |
e.printStackTrace();
|
| - |
|
340 |
}
|
| 337 |
}
|
341 |
}
|
| - |
|
342 |
retry1++;
|
| - |
|
343 |
if(retry1==5){
|
| - |
|
344 |
break;
|
| - |
|
345 |
}
|
| - |
|
346 |
}
|
| - |
|
347 |
Thread.sleep(10*60*1000);
|
| - |
|
348 |
retry2++;
|
| - |
|
349 |
if(retry2==5){
|
| - |
|
350 |
break;
|
| 338 |
}
|
351 |
}
|
| 339 |
}
|
352 |
}
|
| 340 |
|
353 |
|
| 341 |
// Note that depending on the type of report being downloaded, a report can reach
|
354 |
// Note that depending on the type of report being downloaded, a report can reach
|
| 342 |
// sizes greater than 1GB. For this reason we recommend that you _always_ program to
|
355 |
// sizes greater than 1GB. For this reason we recommend that you _always_ program to
|