| Line 22... |
Line 22... |
| 22 |
import org.apache.velocity.exception.MethodInvocationException;
|
22 |
import org.apache.velocity.exception.MethodInvocationException;
|
| 23 |
import org.apache.velocity.exception.ParseErrorException;
|
23 |
import org.apache.velocity.exception.ParseErrorException;
|
| 24 |
import org.apache.velocity.exception.ResourceNotFoundException;
|
24 |
import org.apache.velocity.exception.ResourceNotFoundException;
|
| 25 |
|
25 |
|
| 26 |
|
26 |
|
| - |
|
27 |
import in.shop2020.logistics.Provider;
|
| 27 |
import in.shop2020.model.v1.catalog.InventoryServiceException;
|
28 |
import in.shop2020.model.v1.catalog.InventoryServiceException;
|
| 28 |
import in.shop2020.model.v1.catalog.Item;
|
29 |
import in.shop2020.model.v1.catalog.Item;
|
| 29 |
import in.shop2020.model.v1.catalog.InventoryService.Client;
|
30 |
import in.shop2020.model.v1.catalog.InventoryService.Client;
|
| 30 |
import in.shop2020.model.v1.order.Order;
|
31 |
import in.shop2020.model.v1.order.Order;
|
| 31 |
import in.shop2020.model.v1.order.OrderStatus;
|
32 |
import in.shop2020.model.v1.order.OrderStatus;
|
| Line 38... |
Line 39... |
| 38 |
import in.shop2020.model.v1.user.Widget;
|
39 |
import in.shop2020.model.v1.user.Widget;
|
| 39 |
import in.shop2020.model.v1.user.WidgetItem;
|
40 |
import in.shop2020.model.v1.user.WidgetItem;
|
| 40 |
import in.shop2020.model.v1.user.WidgetType;
|
41 |
import in.shop2020.model.v1.user.WidgetType;
|
| 41 |
import in.shop2020.serving.utils.*;
|
42 |
import in.shop2020.serving.utils.*;
|
| 42 |
import in.shop2020.thrift.clients.CatalogServiceClient;
|
43 |
import in.shop2020.thrift.clients.CatalogServiceClient;
|
| - |
|
44 |
import in.shop2020.thrift.clients.LogisticsServiceClient;
|
| 43 |
import in.shop2020.thrift.clients.TransactionServiceClient;
|
45 |
import in.shop2020.thrift.clients.TransactionServiceClient;
|
| 44 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
46 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
| 45 |
|
47 |
|
| 46 |
|
48 |
|
| 47 |
public class PageLoaderHandler {
|
49 |
public class PageLoaderHandler {
|
| Line 447... |
Line 449... |
| 447 |
|
449 |
|
| 448 |
public String getMyaccountDetailsHtml(long userId) {
|
450 |
public String getMyaccountDetailsHtml(long userId) {
|
| 449 |
String htmlString = "";
|
451 |
String htmlString = "";
|
| 450 |
VelocityContext context = new VelocityContext();
|
452 |
VelocityContext context = new VelocityContext();
|
| 451 |
String templateFile = "templates/myaccount.vm";
|
453 |
String templateFile = "templates/myaccount.vm";
|
| 452 |
TransactionServiceClient transactionServiceClient = null;
|
- |
|
| 453 |
in.shop2020.model.v1.order.TransactionService.Client orderClient = null;
|
- |
|
| 454 |
List<Order> orders = null;
|
454 |
List<Order> orders = null;
|
| - |
|
455 |
Map<Long, String> providerNames = new HashMap<Long, String>();
|
| 455 |
try{
|
456 |
try{
|
| 456 |
transactionServiceClient = new TransactionServiceClient();
|
457 |
TransactionServiceClient transactionServiceClient = new TransactionServiceClient();
|
| 457 |
orderClient = transactionServiceClient.getClient();
|
458 |
in.shop2020.model.v1.order.TransactionService.Client orderClient = transactionServiceClient.getClient();
|
| 458 |
orders = orderClient.getOrdersForCustomer(userId, 0, (new Date()).getTime(), null);
|
459 |
orders = orderClient.getOrdersForCustomer(userId, 0, (new Date()).getTime(), null);
|
| 459 |
|
460 |
|
| - |
|
461 |
LogisticsServiceClient logisticsServiceClient = new LogisticsServiceClient();
|
| - |
|
462 |
in.shop2020.logistics.LogisticsService.Client logisticsClient = logisticsServiceClient.getClient();
|
| - |
|
463 |
List<Provider> providers = logisticsClient.getAllProviders();
|
| - |
|
464 |
for(Provider provider: providers)
|
| - |
|
465 |
providerNames.put(provider.getId(), provider.getName());
|
| 460 |
}catch (Exception e){
|
466 |
}catch (Exception e){
|
| 461 |
|
467 |
|
| 462 |
}
|
468 |
}
|
| 463 |
List<String> orderDate = new ArrayList<String>();
|
469 |
List<String> orderDate = new ArrayList<String>();
|
| 464 |
SimpleDateFormat dateformat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss aa");
|
470 |
SimpleDateFormat dateformat = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss aa");
|
| Line 466... |
Line 472... |
| 466 |
Date orderedOn = new Date(order.getCreated_timestamp());
|
472 |
Date orderedOn = new Date(order.getCreated_timestamp());
|
| 467 |
orderDate.add(dateformat.format(orderedOn));
|
473 |
orderDate.add(dateformat.format(orderedOn));
|
| 468 |
}
|
474 |
}
|
| 469 |
context.put("orders", orders);
|
475 |
context.put("orders", orders);
|
| 470 |
context.put("orderDate", orderDate);
|
476 |
context.put("orderDate", orderDate);
|
| 471 |
|
- |
|
| - |
|
477 |
context.put("providerNames", providerNames);
|
| 472 |
htmlString = getHtmlFromVelocity(templateFile, context);
|
478 |
htmlString = getHtmlFromVelocity(templateFile, context);
|
| 473 |
return htmlString;
|
479 |
return htmlString;
|
| 474 |
}
|
480 |
}
|
| 475 |
|
481 |
|
| 476 |
|
482 |
|