| Line 1... |
Line 1... |
| 1 |
package in.shop2020.hotspot.dashbaord.server;
|
1 |
package in.shop2020.hotspot.dashbaord.server;
|
| 2 |
|
2 |
|
| 3 |
import in.shop2020.hotspot.dashbaord.server.OrderPromisedShippingComparator;
|
3 |
import in.shop2020.hotspot.dashbaord.server.OrderPromisedShippingComparator;
|
| 4 |
import in.shop2020.hotspot.dashbaord.shared.actions.Order;
|
4 |
import in.shop2020.hotspot.dashbaord.shared.actions.Order;
|
| - |
|
5 |
import in.shop2020.hotspot.dashbaord.shared.actions.OrderAlert;
|
| 5 |
import in.shop2020.hotspot.dashbaord.shared.actions.OrderType;
|
6 |
import in.shop2020.hotspot.dashbaord.shared.actions.OrderType;
|
| 6 |
import in.shop2020.hotspot.dashbaord.shared.actions.ReturnOrder;
|
7 |
import in.shop2020.hotspot.dashbaord.shared.actions.ReturnOrder;
|
| 7 |
import in.shop2020.model.v1.inventory.InventoryType;
|
8 |
import in.shop2020.model.v1.inventory.InventoryType;
|
| 8 |
import in.shop2020.model.v1.inventory.WarehouseType;
|
9 |
import in.shop2020.model.v1.inventory.WarehouseType;
|
| 9 |
import in.shop2020.model.v1.catalog.Item;
|
10 |
import in.shop2020.model.v1.catalog.Item;
|
| Line 48... |
Line 49... |
| 48 |
*
|
49 |
*
|
| 49 |
*/
|
50 |
*/
|
| 50 |
public class TransactionUtils {
|
51 |
public class TransactionUtils {
|
| 51 |
private static String courierDetailsPath = "/CourierDetailReports";
|
52 |
private static String courierDetailsPath = "/CourierDetailReports";
|
| 52 |
private static Logger logger = LoggerFactory.getLogger(TransactionUtils.class);
|
53 |
private static Logger logger = LoggerFactory.getLogger(TransactionUtils.class);
|
| 53 |
public static List<Long> virtualInvnetoryWarehouses;
|
- |
|
| 54 |
|
54 |
|
| 55 |
static{
|
- |
|
| 56 |
virtualInvnetoryWarehouses = new ArrayList<Long>();
|
- |
|
| 57 |
try{
|
- |
|
| 58 |
in.shop2020.model.v1.inventory.InventoryService.Client inventoryClient = new InventoryClient().getClient();
|
- |
|
| 59 |
List<Warehouse> allWarehouses = inventoryClient.getWarehouses(null, null, 0, 0, 0);
|
- |
|
| 60 |
for(Warehouse wh:allWarehouses){
|
- |
|
| 61 |
if(wh.getWarehouseType()==WarehouseType.THIRD_PARTY){
|
- |
|
| 62 |
virtualInvnetoryWarehouses.add(wh.getId());
|
- |
|
| 63 |
}
|
- |
|
| 64 |
}
|
- |
|
| 65 |
}catch(Exception e){
|
- |
|
| 66 |
e.printStackTrace();
|
- |
|
| 67 |
}
|
- |
|
| 68 |
|
- |
|
| 69 |
}
|
- |
|
| 70 |
|
55 |
|
| 71 |
/**
|
56 |
/**
|
| 72 |
* The human user is concerned only with a consolidated view of actionable
|
57 |
* The human user is concerned only with a consolidated view of actionable
|
| 73 |
* orders. Orders with different statuses in the database can be part of the
|
58 |
* orders. Orders with different statuses in the database can be part of the
|
| 74 |
* same consolidated view. This method uses a mapping of <i>type</i> to
|
59 |
* same consolidated view. This method uses a mapping of <i>type</i> to
|
| Line 484... |
Line 469... |
| 484 |
order.setBillTogetherOrdersMap(billTogetherOrdersMap);
|
469 |
order.setBillTogetherOrdersMap(billTogetherOrdersMap);
|
| 485 |
}
|
470 |
}
|
| 486 |
if(t_order.isSetLogisticsTransactionId()){
|
471 |
if(t_order.isSetLogisticsTransactionId()){
|
| 487 |
order.setLogisticsTransactionId(t_order.getLogisticsTransactionId());
|
472 |
order.setLogisticsTransactionId(t_order.getLogisticsTransactionId());
|
| 488 |
}
|
473 |
}
|
| - |
|
474 |
DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd");
|
| - |
|
475 |
Date date = new Date(System.currentTimeMillis());
|
| - |
|
476 |
long currentDateTime = 0;
|
| - |
|
477 |
long expectedDateShippingTime =0 ;
|
| - |
|
478 |
long currentTime = date.getTime();
|
| - |
|
479 |
currentDateTime = sdf.parse(sdf.format(date)).getTime();
|
| - |
|
480 |
expectedDateShippingTime = sdf.parse(sdf.format(new Date(order.getExpectedShippingTime()))).getTime();
|
| - |
|
481 |
if(expectedDateShippingTime >0 && order.getStatus() < 9){
|
| - |
|
482 |
if(expectedDateShippingTime <= currentDateTime){
|
| - |
|
483 |
if( WarehouseFinder.virtualInvnetoryWarehouses.contains(order.getFulfilmentWarehouseId())){
|
| - |
|
484 |
order.setAlert(OrderAlert.TODAY_SHIPPING_NOT_IN_STOCK);
|
| - |
|
485 |
}else{
|
| - |
|
486 |
order.setAlert(OrderAlert.TODAY_SHIPPING_IN_STOCK);
|
| - |
|
487 |
}
|
| - |
|
488 |
}else{
|
| - |
|
489 |
if(order.getExpectedShippingTime() <= currentTime){
|
| - |
|
490 |
order.setAlert(OrderAlert.SHIPPING_TIME_EXCEEDED);
|
| - |
|
491 |
}else{
|
| - |
|
492 |
order.setAlert(OrderAlert.LATER_SHIPPING);
|
| - |
|
493 |
}
|
| - |
|
494 |
}
|
| - |
|
495 |
}
|
| 489 |
return order;
|
496 |
return order;
|
| 490 |
}
|
497 |
}
|
| 491 |
|
498 |
|
| 492 |
/**
|
499 |
/**
|
| 493 |
* Queries the transction server to get the list of all return orders that
|
500 |
* Queries the transction server to get the list of all return orders that
|