| Line 1... |
Line 1... |
| 1 |
import in.shop2020.model.v1.order.Order;
|
1 |
import in.shop2020.model.v1.order.Order;
|
| 2 |
import in.shop2020.model.v1.order.OrderSource;
|
- |
|
| 3 |
import in.shop2020.model.v1.order.OrderStatus;
|
2 |
import in.shop2020.model.v1.order.OrderStatus;
|
| 4 |
import in.shop2020.model.v1.order.TransactionService.Client;
|
3 |
import in.shop2020.model.v1.order.TransactionService.Client;
|
| 5 |
import in.shop2020.thrift.clients.TransactionClient;
|
4 |
import in.shop2020.thrift.clients.TransactionClient;
|
| 6 |
|
5 |
|
| 7 |
import java.util.ArrayList;
|
6 |
import java.util.ArrayList;
|
| 8 |
import java.util.Arrays;
|
7 |
import java.util.Arrays;
|
| - |
|
8 |
import java.util.Date;
|
| 9 |
import java.util.HashMap;
|
9 |
import java.util.HashMap;
|
| 10 |
import java.util.List;
|
10 |
import java.util.List;
|
| 11 |
import java.util.Map;
|
11 |
import java.util.Map;
|
| 12 |
|
12 |
|
| 13 |
import com.aramex.impl.Aramex;
|
- |
|
| 14 |
import com.providers.logistics.Provider;
|
13 |
import com.providers.logistics.Provider;
|
| 15 |
import com.providers.logistics.ProviderFactory;
|
14 |
import com.providers.logistics.ProviderFactory;
|
| 16 |
|
15 |
|
| 17 |
|
16 |
|
| 18 |
|
17 |
|
| 19 |
public class Test {
|
18 |
public class Test {
|
| 20 |
public static void main (String[] args) throws Exception {
|
19 |
public static void main (String[] args) throws Throwable {
|
| - |
|
20 |
//generateAramex();
|
| - |
|
21 |
//System.out.println("/tmp/123".substring("/tmp/123".lastIndexOf('/') + 1));
|
| 21 |
String a = null;
|
22 |
/*String s = "ABCDEF";
|
| - |
|
23 |
System.out.println(s.substring(0,4));*/
|
| - |
|
24 |
assignAwbs();
|
| 22 |
try {
|
25 |
}
|
| - |
|
26 |
|
| - |
|
27 |
/*public static void generateAramex() throws Throwable{
|
| 23 |
a.charAt(0);
|
28 |
List<String> waybills=Arrays.asList("43272597933","43272597981","43272670453","43272670700","43272670615","43272702874","43272703375","43272702981","43272703471","43272703821","43272703600","43272702966","43272703084","43272703003","43272703423","43272703681","43272716701","43272716760");
|
| - |
|
29 |
|
| - |
|
30 |
TransactionClient transactionServiceClient = new TransactionClient();
|
| 24 |
} catch(Exception e){
|
31 |
Aramex aramex = new Aramex();
|
| - |
|
32 |
for (String wayBill : waybills){
|
| 25 |
System.out.println(" e.getMessage() - " + e.getMessage());
|
33 |
TransactionService.Client tsc = transactionServiceClient.getClient();
|
| - |
|
34 |
List<Order> orders = tsc.getOrderForAwb(wayBill);
|
| - |
|
35 |
//List<Order> orders = tsc.getOrderForAwb("43272670700");
|
| 26 |
System.out.println("e.toString() - " + e.toString());
|
36 |
//System.out.println(orders);
|
| 27 |
System.out.println("e.getLocalizedMessage() - " + e.getLocalizedMessage());
|
37 |
String newWayBill = aramex.getAirwayBillNo(orders);
|
| - |
|
38 |
System.out.println("update `order` set airwaybill_no='" + newWayBill + "', tracking_id='" + newWayBill + "' where airwaybill_no = '" + wayBill+ "';");
|
| 28 |
}
|
39 |
}
|
| - |
|
40 |
}*/
|
| - |
|
41 |
|
| - |
|
42 |
public static void printInvoice() throws Exception {
|
| - |
|
43 |
/*GSTInvoiceGenerationService invoiceGenerationService = new GSTInvoiceGenerationService();
|
| - |
|
44 |
invoiceGenerationService.generateInvoice(748108, false, 7441);*/
|
| 29 |
}
|
45 |
}
|
| 30 |
|
46 |
|
| 31 |
|
47 |
|
| 32 |
public static void assignAwbs() throws Exception{
|
48 |
public static void assignAwbs() throws Exception{
|
| 33 |
TransactionClient client = new TransactionClient("support_transaction_service_server_host", "transaction_service_server_port");
|
49 |
TransactionClient client = new TransactionClient("support_transaction_service_server_host", "transaction_service_server_port");
|
| 34 |
Client c = client.getClient();
|
50 |
Client c = client.getClient();
|
| 35 |
List<Order> allOrdersWithMissingAwb = c.getOrderForAirwayBillNo(null);
|
51 |
List<Order> allOrdersWithMissingAwb = c.getAllOrders(Arrays.asList(OrderStatus.BILLED), 0, new Date().getTime(), 7573);
|
| 36 |
Map<String, List<Order>> logisticsTxnOrdersMap = new HashMap<String, List<Order>>();
|
52 |
Map<String, List<Order>> logisticsTxnOrdersMap = new HashMap<String, List<Order>>();
|
| 37 |
for(Order o: allOrdersWithMissingAwb) {
|
53 |
for(Order o: allOrdersWithMissingAwb) {
|
| 38 |
if(!logisticsTxnOrdersMap.containsKey(o.getLogisticsTransactionId())) {
|
54 |
if(!logisticsTxnOrdersMap.containsKey(o.getLogisticsTransactionId())) {
|
| 39 |
logisticsTxnOrdersMap.put(o.getLogisticsTransactionId(), new ArrayList<Order>());
|
55 |
logisticsTxnOrdersMap.put(o.getLogisticsTransactionId(), new ArrayList<Order>());
|
| 40 |
}
|
56 |
}
|
| 41 |
List<Order> orderList = logisticsTxnOrdersMap.get(o.getLogisticsTransactionId());
|
57 |
List<Order> orderList = logisticsTxnOrdersMap.get(o.getLogisticsTransactionId());
|
| 42 |
orderList.add(o);
|
58 |
orderList.add(o);
|
| 43 |
}
|
59 |
}
|
| - |
|
60 |
System.out.println(logisticsTxnOrdersMap.keySet());
|
| 44 |
//Iterate LogisticTransaction Id and
|
61 |
//Iterate LogisticTransaction Id and
|
| 45 |
for (Map.Entry<String, List<Order>> entry : logisticsTxnOrdersMap.entrySet()) {
|
62 |
for (Map.Entry<String, List<Order>> entry : logisticsTxnOrdersMap.entrySet()) {
|
| 46 |
Order o = entry.getValue().get(0);
|
63 |
Order o = entry.getValue().get(0);
|
| 47 |
Provider logisticsProvider = ProviderFactory.getProvider(2);
|
64 |
Provider logisticsProvider = ProviderFactory.getProvider(2);
|
| 48 |
if(o.getLogistics_provider_id()==2 && o.getStatus().equals(OrderStatus.BILLED)) {
|
65 |
if(o.getLogistics_provider_id()==2 && o.getStatus().equals(OrderStatus.BILLED)) {
|