| Line 323... |
Line 323... |
| 323 |
Process process = testProcess.start();
|
323 |
Process process = testProcess.start();
|
| 324 |
process.waitFor();
|
324 |
process.waitFor();
|
| 325 |
logger.info(String.valueOf(process.exitValue()));
|
325 |
logger.info(String.valueOf(process.exitValue()));
|
| 326 |
return "asinjob";
|
326 |
return "asinjob";
|
| 327 |
}
|
327 |
}
|
| - |
|
328 |
|
| - |
|
329 |
public void runFbaInventoryJob() throws IOException, InterruptedException {
|
| - |
|
330 |
ProcessBuilder testProcess = new ProcessBuilder("/bin/bash");
|
| - |
|
331 |
String[] command = {"/bin/bash", "-c", "sudo /root/code/trunk/AmazonFeeds/SubmitFBAInventoryFeed.sh"};
|
| - |
|
332 |
testProcess.command(command);
|
| - |
|
333 |
logger.info(testProcess.command().toString());
|
| - |
|
334 |
Process process = testProcess.start();
|
| - |
|
335 |
process.waitFor();
|
| - |
|
336 |
logger.info(String.valueOf(process.exitValue()));
|
| - |
|
337 |
}
|
| 328 |
|
338 |
|
| 329 |
public void uploadAsinFile() throws IOException, TException{
|
339 |
public void uploadAsinFile() throws IOException, TException{
|
| 330 |
File fileToCreate = new File("/tmp/", "Amazon-asin-upload.xls");
|
340 |
File fileToCreate = new File("/tmp/", "Amazon-asin-upload.xls");
|
| 331 |
FileUtils.copyFile(this.file, fileToCreate);
|
341 |
FileUtils.copyFile(this.file, fileToCreate);
|
| 332 |
FileInputStream iFile = new FileInputStream(new File(file.getAbsolutePath()));
|
342 |
FileInputStream iFile = new FileInputStream(new File(file.getAbsolutePath()));
|
| Line 424... |
Line 434... |
| 424 |
public void uploadBulkFile() throws IOException, TException{
|
434 |
public void uploadBulkFile() throws IOException, TException{
|
| 425 |
File fileToCreate = new File("/tmp/", "Amazon-bulk-upload.xls");
|
435 |
File fileToCreate = new File("/tmp/", "Amazon-bulk-upload.xls");
|
| 426 |
FileUtils.copyFile(this.file, fileToCreate);
|
436 |
FileUtils.copyFile(this.file, fileToCreate);
|
| 427 |
FileInputStream iFile = new FileInputStream(new File(file.getAbsolutePath()));
|
437 |
FileInputStream iFile = new FileInputStream(new File(file.getAbsolutePath()));
|
| 428 |
HSSFWorkbook workbook = new HSSFWorkbook(iFile);
|
438 |
HSSFWorkbook workbook = new HSSFWorkbook(iFile);
|
| - |
|
439 |
|
| 429 |
HSSFSheet sheet = workbook.getSheetAt(0);
|
440 |
HSSFSheet sheet = workbook.getSheetAt(0);
|
| 430 |
Map<Long,Amazonlisted> amazonBulkUpdate = new HashMap<Long,Amazonlisted>();
|
441 |
Map<Long,Amazonlisted> amazonBulkUpdate = new HashMap<Long,Amazonlisted>();
|
| 431 |
Client CatalogClient=null;
|
442 |
Client CatalogClient=null;
|
| 432 |
StringBuilder sb = new StringBuilder();
|
443 |
StringBuilder sb = new StringBuilder();
|
| 433 |
try {
|
444 |
try {
|
| Line 518... |
Line 529... |
| 518 |
}
|
529 |
}
|
| 519 |
amazonBulkUpdate.put(sku, amazonlisted);
|
530 |
amazonBulkUpdate.put(sku, amazonlisted);
|
| 520 |
}
|
531 |
}
|
| 521 |
logger.info("Amazon Bulk Map "+amazonBulkUpdate.toString());
|
532 |
logger.info("Amazon Bulk Map "+amazonBulkUpdate.toString());
|
| 522 |
CatalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
|
533 |
CatalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
|
| 523 |
CatalogClient.updateAmazonAttributesInBulk(amazonBulkUpdate);
|
534 |
boolean result = CatalogClient.updateAmazonAttributesInBulk(amazonBulkUpdate);
|
| - |
|
535 |
if (!result){
|
| - |
|
536 |
sb = new StringBuilder();
|
| - |
|
537 |
sb.append("Error : Unable to update");
|
| - |
|
538 |
}
|
| 524 |
File file = new File("/tmp/amazonbulk");
|
539 |
File file = new File("/tmp/amazonbulk");
|
| 525 |
FileWriter writer = new FileWriter(file);
|
540 |
FileWriter writer = new FileWriter(file);
|
| 526 |
writer.append(sb.toString());
|
541 |
writer.append(sb.toString());
|
| 527 |
writer.close();
|
542 |
writer.close();
|
| 528 |
byte[] buffer = new byte[(int)file.length()];
|
543 |
byte[] buffer = new byte[(int)file.length()];
|