| Line 379... |
Line 379... |
| 379 |
txn.setStatusDescription("Order for flipkart ");
|
379 |
txn.setStatusDescription("Order for flipkart ");
|
| 380 |
List<in.shop2020.model.v1.order.Order> orderlist = new ArrayList<in.shop2020.model.v1.order.Order>();
|
380 |
List<in.shop2020.model.v1.order.Order> orderlist = new ArrayList<in.shop2020.model.v1.order.Order>();
|
| 381 |
double total_price=0;
|
381 |
double total_price=0;
|
| 382 |
InventoryService.Client inventoryClient = null;
|
382 |
InventoryService.Client inventoryClient = null;
|
| 383 |
Warehouse fulfillmentWarehouse= null;
|
383 |
Warehouse fulfillmentWarehouse= null;
|
| - |
|
384 |
boolean exit = false;
|
| 384 |
for(int i=0;i<quantity;i++){
|
385 |
for(int i=0;i<quantity;i++){
|
| 385 |
LineItem lineItem = null;
|
386 |
LineItem lineItem = null;
|
| 386 |
lineItem = createLineItem(sku,unitSellingPrice);
|
387 |
lineItem = createLineItem(sku,unitSellingPrice);
|
| 387 |
logger.info(orderId+" "+subOrderId + "sku and Price " + sku + " " + unitSellingPrice);
|
388 |
logger.info(orderId+" "+subOrderId + "sku and Price " + sku + " " + unitSellingPrice);
|
| 388 |
lineItem.setExtra_info("flipkartOrderId = " + orderId + " flipkartsubOrderId = " + subOrderId);
|
389 |
lineItem.setExtra_info("flipkartOrderId = " + orderId + " flipkartsubOrderId = " + subOrderId);
|
| Line 415... |
Line 416... |
| 415 |
t_order.setPromised_delivery_time(time.getTimeInMillis());
|
416 |
t_order.setPromised_delivery_time(time.getTimeInMillis());
|
| 416 |
t_order.setExpected_delivery_time(time.getTimeInMillis());
|
417 |
t_order.setExpected_delivery_time(time.getTimeInMillis());
|
| 417 |
} catch(Exception e) {
|
418 |
} catch(Exception e) {
|
| 418 |
logger.error("Error in updating Shipping or Delivery Time for suborderid " + subOrderId);
|
419 |
logger.error("Error in updating Shipping or Delivery Time for suborderid " + subOrderId);
|
| 419 |
sb.append(orderId + " "+ subOrderId + " Could not update delivery time" + " " + "\n");
|
420 |
sb.append(orderId + " "+ subOrderId + " Could not update delivery time" + " " + "\n");
|
| - |
|
421 |
exit = true;
|
| 420 |
continue;
|
422 |
continue;
|
| 421 |
}
|
423 |
}
|
| 422 |
SnapdealItem snapdealItem = new CatalogClient().getClient().getSnapdealItem(sku);
|
424 |
SnapdealItem snapdealItem = new CatalogClient().getClient().getSnapdealItem(sku);
|
| 423 |
inventoryClient = new InventoryClient().getClient();
|
425 |
inventoryClient = new InventoryClient().getClient();
|
| 424 |
try {
|
426 |
try {
|
| Line 463... |
Line 465... |
| 463 |
t_order.getLineitems().get(0).setTransfer_price(vendorItemPricing.getTransferPrice());
|
465 |
t_order.getLineitems().get(0).setTransfer_price(vendorItemPricing.getTransferPrice());
|
| 464 |
t_order.getLineitems().get(0).setNlc(vendorItemPricing.getNlc());
|
466 |
t_order.getLineitems().get(0).setNlc(vendorItemPricing.getNlc());
|
| 465 |
} catch (InventoryServiceException e) {
|
467 |
} catch (InventoryServiceException e) {
|
| 466 |
logger.error("Error connecting inventory service for suborderid " + orderId + " " + subOrderId , e);
|
468 |
logger.error("Error connecting inventory service for suborderid " + orderId + " " + subOrderId , e);
|
| 467 |
sb.append(orderId + " " + subOrderId+ " Inventory Service Exception" + " " + "\n");
|
469 |
sb.append(orderId + " " + subOrderId+ " Inventory Service Exception" + " " + "\n");
|
| - |
|
470 |
exit = true;
|
| 468 |
continue;
|
471 |
continue;
|
| 469 |
} catch (TTransportException e) {
|
472 |
} catch (TTransportException e) {
|
| 470 |
logger.error("Transport Exception with Inventory Service for suborderid " + orderId + " " + subOrderId , e);
|
473 |
logger.error("Transport Exception with Inventory Service for suborderid " + orderId + " " + subOrderId , e);
|
| 471 |
sb.append(orderId + " " + subOrderId + " Transport Exception with Inventory Service" + " " + "\n");
|
474 |
sb.append(orderId + " " + subOrderId + " Transport Exception with Inventory Service" + " " + "\n");
|
| - |
|
475 |
exit = true;
|
| 472 |
continue;
|
476 |
continue;
|
| 473 |
} catch (TException e) {
|
477 |
} catch (TException e) {
|
| 474 |
logger.error("Exception with Inventory Service for suborderid " + orderId + " " + subOrderId , e);
|
478 |
logger.error("Exception with Inventory Service for suborderid " + orderId + " " + subOrderId , e);
|
| 475 |
sb.append(orderId + " " + subOrderId + " Exception in Inventory Service" + " " + "\n");
|
479 |
sb.append(orderId + " " + subOrderId + " Exception in Inventory Service" + " " + "\n");
|
| - |
|
480 |
exit = true;
|
| 476 |
continue;
|
481 |
continue;
|
| 477 |
} catch (CatalogServiceException e) {
|
482 |
} catch (CatalogServiceException e) {
|
| 478 |
logger.error("Exception with Catalog Service for " + orderId + " " + subOrderId + " while getting item " + lineItem.getItem_id(), e);
|
483 |
logger.error("Exception with Catalog Service for " + orderId + " " + subOrderId + " while getting item " + lineItem.getItem_id(), e);
|
| 479 |
sb.append(orderId + " " + subOrderId + " Exception in Catalog Service" + " " + "\n");
|
484 |
sb.append(orderId + " " + subOrderId + " Exception in Catalog Service" + " " + "\n");
|
| - |
|
485 |
exit = true;
|
| 480 |
continue;
|
486 |
continue;
|
| 481 |
}
|
487 |
}
|
| 482 |
t_order.setLogistics_provider_id(FLIPKART_LOGISTICS_ID);
|
488 |
t_order.setLogistics_provider_id(FLIPKART_LOGISTICS_ID);
|
| 483 |
t_order.setAirwaybill_no("");
|
489 |
t_order.setAirwaybill_no("");
|
| 484 |
t_order.setTracking_id("");
|
490 |
t_order.setTracking_id("");
|
| Line 487... |
Line 493... |
| 487 |
t_order.setSource(FLIPKART_SOURCE_ID);
|
493 |
t_order.setSource(FLIPKART_SOURCE_ID);
|
| 488 |
t_order.setOrderType(OrderType.B2C);
|
494 |
t_order.setOrderType(OrderType.B2C);
|
| 489 |
total_price = total_price + unitSellingPrice;
|
495 |
total_price = total_price + unitSellingPrice;
|
| 490 |
orderlist.add(t_order);
|
496 |
orderlist.add(t_order);
|
| 491 |
}
|
497 |
}
|
| - |
|
498 |
if(exit){
|
| - |
|
499 |
continue;
|
| - |
|
500 |
}
|
| 492 |
txn.setOrders(orderlist);
|
501 |
txn.setOrders(orderlist);
|
| 493 |
try {
|
502 |
try {
|
| 494 |
transactionId = String.valueOf(transaction_client.createTransaction(txn));
|
503 |
transactionId = String.valueOf(transaction_client.createTransaction(txn));
|
| 495 |
logger.info("Transaction id is : " + transactionId);
|
504 |
logger.info("Transaction id is : " + transactionId);
|
| 496 |
} catch (TransactionServiceException e) {
|
505 |
} catch (TransactionServiceException e) {
|
| 497 |
logger.error(orderId+" "+subOrderId + " Could not create transaction " , e);
|
506 |
logger.error(orderId+" "+subOrderId + " Could not create transaction " , e);
|
| 498 |
sb.append(orderId+" "+subOrderId + " Could not create transaction" +"\n");
|
507 |
sb.append(orderId+" "+subOrderId + " Could not create transaction" +"\n");
|
| 499 |
logger.info(orderId+" "+subOrderId + " Could not create transaction" +"\n");
|
- |
|
| 500 |
continue;
|
508 |
continue;
|
| 501 |
} catch (TException e) {
|
509 |
} catch (TException e) {
|
| 502 |
logger.error("Problem with transaction service while creating transaction", e);
|
- |
|
| 503 |
sb.append(orderId+" "+subOrderId + " Transaction Service Exception could not create transaction" +"\n");
|
510 |
sb.append(orderId+" "+subOrderId + " Transaction Service Exception could not create transaction" +"\n");
|
| 504 |
logger.info(orderId+" "+subOrderId + " Transaction Service Exception could not create transaction" +"\n");
|
511 |
logger.info(orderId+" "+subOrderId + " Transaction Service Exception could not create transaction" +"\n");
|
| 505 |
continue;
|
512 |
continue;
|
| 506 |
}
|
513 |
}
|
| 507 |
try{
|
514 |
try{
|
| Line 586... |
Line 593... |
| 586 |
|
593 |
|
| 587 |
ServletOutputStream sos;
|
594 |
ServletOutputStream sos;
|
| 588 |
try {
|
595 |
try {
|
| 589 |
sos = response.getOutputStream();
|
596 |
sos = response.getOutputStream();
|
| 590 |
if(sb.toString().equalsIgnoreCase("")){
|
597 |
if(sb.toString().equalsIgnoreCase("")){
|
| 591 |
sos.write("Orders Created Successfully (No Alerts)".toString().getBytes());
|
598 |
sos.write((orders_processed + " Orders Created").toString().getBytes());
|
| 592 |
}
|
599 |
}
|
| 593 |
else{
|
600 |
else{
|
| 594 |
if(orders_processed!=0){
|
- |
|
| 595 |
sos.write(("Orders Created with Alerts \n"+ sb.toString()).getBytes());
|
601 |
sos.write((orders_processed +" Orders Created \n"+ sb.toString()).getBytes());
|
| 596 |
}
|
- |
|
| 597 |
else{
|
- |
|
| 598 |
sos.write(("Zero Approved Orders \n"+ sb.toString()).getBytes());
|
- |
|
| 599 |
}
|
- |
|
| 600 |
}
|
602 |
}
|
| 601 |
sos.flush();
|
603 |
sos.flush();
|
| 602 |
} catch (IOException e) {
|
604 |
} catch (IOException e) {
|
| 603 |
System.out.println("Unable to stream the manifest file");
|
605 |
System.out.println("Unable to stream the manifest file");
|
| 604 |
}
|
606 |
}
|
| Line 619... |
Line 621... |
| 619 |
"yukti.jain@shop2020.in","manisha.sharma@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
|
621 |
"yukti.jain@shop2020.in","manisha.sharma@shop2020.in","chandan.kumar@shop2020.in","ankush.dhingra@shop2020.in","amar.kumar@shop2020.in"};
|
| 620 |
*/
|
622 |
*/
|
| 621 |
try {
|
623 |
try {
|
| 622 |
logger.info("Before Sending Emails");
|
624 |
logger.info("Before Sending Emails");
|
| 623 |
if(sb.toString().equalsIgnoreCase("")){
|
625 |
if(sb.toString().equalsIgnoreCase("")){
|
| 624 |
String emailSubjectTxt = "Flipkart Orders Created Successfully"+sdf.format(cal.getTime());
|
626 |
String emailSubjectTxt = orders_processed + " Flipkart Orders Created "+sdf.format(cal.getTime());
|
| 625 |
mailer.sendSSLMessage(sendTo, emailSubjectTxt,"Orders Created Successfully (No Alerts)", emailFromAddress, password, new ArrayList<File>());
|
627 |
mailer.sendSSLMessage(sendTo, emailSubjectTxt,"Orders Created Successfully (No Alerts)", emailFromAddress, password, new ArrayList<File>());
|
| 626 |
logger.info("Sending Emails Flipkart Orders Created Successfully (No Alerts)");
|
628 |
logger.info("Sending Email Flipkart Orders Created Successfully (No Alerts)");
|
| 627 |
}
|
629 |
}
|
| 628 |
else{
|
630 |
else{
|
| 629 |
if(orders_processed!=0){
|
631 |
if(orders_processed!=0){
|
| 630 |
String emailSubjectTxt = "Flipkart Orders Created Successfully (Check Alerts)"+sdf.format(cal.getTime());
|
632 |
String emailSubjectTxt = orders_processed + " Flipkart Orders Created (Check Alerts)"+sdf.format(cal.getTime());
|
| 631 |
mailer.sendSSLMessage(sendTo, emailSubjectTxt,sb.toString(), emailFromAddress, password, new ArrayList<File>());
|
633 |
mailer.sendSSLMessage(sendTo, emailSubjectTxt,sb.toString(), emailFromAddress, password, new ArrayList<File>());
|
| 632 |
logger.info("Sending Emails Flipkart Orders Created Successfully (Check Alerts)");
|
634 |
logger.info("Sending Email Flipkart Orders Created Successfully (Check Alerts)");
|
| 633 |
}
|
635 |
}
|
| 634 |
else{
|
636 |
else{
|
| 635 |
String emailSubjectTxt = "No New Approved Orders"+sdf.format(cal.getTime());
|
637 |
String emailSubjectTxt = "No new orders created "+sdf.format(cal.getTime());
|
| 636 |
mailer.sendSSLMessage(sendTo, emailSubjectTxt,sb.toString(), emailFromAddress, password, new ArrayList<File>());
|
638 |
mailer.sendSSLMessage(sendTo, emailSubjectTxt,sb.toString(), emailFromAddress, password, new ArrayList<File>());
|
| 637 |
logger.info("Sending Emails Flipkart Orders Created Successfully (Check Alerts)");
|
639 |
logger.info("Sending Email Flipkart Orders Created Successfully (Check Alerts)");
|
| 638 |
|
- |
|
| 639 |
}
|
640 |
}
|
| 640 |
}
|
641 |
}
|
| 641 |
|
642 |
|
| 642 |
}
|
643 |
}
|
| 643 |
catch (Exception e) {
|
644 |
catch (Exception e) {
|