Subversion Repositories SmartDukaan

Rev

Rev 167 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 167 Rev 306
Line 6... Line 6...
6
 
6
 
7
import in.shop2020.hotspot.dashbaord.shared.actions.Order;
7
import in.shop2020.hotspot.dashbaord.shared.actions.Order;
8
import in.shop2020.hotspot.dashbaord.shared.actions.OrderRequest;
8
import in.shop2020.hotspot.dashbaord.shared.actions.OrderRequest;
9
import in.shop2020.hotspot.dashbaord.shared.actions.OrderResponse;
9
import in.shop2020.hotspot.dashbaord.shared.actions.OrderResponse;
10
import in.shop2020.hotspot.dashbaord.shared.actions.OrderType;
10
import in.shop2020.hotspot.dashbaord.shared.actions.OrderType;
-
 
11
import in.shop2020.model.v1.order.Alert;
-
 
12
import in.shop2020.model.v1.order.ExtraOrderInfo;
11
import in.shop2020.model.v1.order.Transaction;
13
import in.shop2020.model.v1.order.Transaction;
12
import in.shop2020.model.v1.order.TransactionStatus;
14
import in.shop2020.model.v1.order.TransactionStatus;
13
import in.shop2020.model.v1.order.TransactionService.Client;
15
import in.shop2020.model.v1.order.TransactionService.Client;
14
import in.shop2020.thrift.clients.TransactionServiceClient;
16
import in.shop2020.thrift.clients.TransactionServiceClient;
15
import net.customware.gwt.dispatch.server.ActionHandler;
17
import net.customware.gwt.dispatch.server.ActionHandler;
Line 46... Line 48...
46
		try{
48
		try{
47
			TransactionServiceClient client = new TransactionServiceClient();
49
			TransactionServiceClient client = new TransactionServiceClient();
48
			Client c = client.getClient();
50
			Client c = client.getClient();
49
			List<Transaction> txns = c.getAllTransactions(TransactionStatus.INIT, 0L, new Date().getTime());
51
			List<Transaction> txns = c.getAllTransactions(TransactionStatus.INIT, 0L, new Date().getTime());
50
			for (Transaction t: txns){
52
			for (Transaction t: txns){
-
 
53
				long sku_id;
-
 
54
				String model;
-
 
55
				String vendor;
-
 
56
				String colour;
-
 
57
				ExtraOrderInfo eoi = c.getExtraInfo(t.getId());
-
 
58
				if(eoi == null){
-
 
59
					sku_id = 34;
-
 
60
					model = "N 72";
-
 
61
					colour = "Black";
-
 
62
					vendor = "Nokia";
-
 
63
				}else{
-
 
64
					sku_id = eoi.getSku_id();
-
 
65
					model = eoi.getModel_name();
-
 
66
					vendor = eoi.getVendor_info();
-
 
67
					colour = eoi.getColour();
-
 
68
				}
-
 
69
				
-
 
70
				Order o = new Order(t.getCustomer_id(), t.getId(), t.getCreatedOn(), t.getExpectedDeliveryTime(), t.getTransactionStatus().toString(), t.getStatusDescription(), model, colour, vendor, sku_id);
51
				Order o = new Order(t.getCustomer_id(), t.getId(), t.getCreatedOn(), t.getExpectedDeliveryTime(), t.getTransactionStatus().toString(), t.getStatusDescription());
71
				//Order o = new Order(t.getCustomer_id(), t.getId(), t.getCreatedOn(), t.getExpectedDeliveryTime(), t.getTransactionStatus().toString(), t.getStatusDescription());
52
				orders.add(o);
72
				orders.add(o);
-
 
73
				//check if it has an associated alert
-
 
74
				List<Alert> alerts = c.getAlerts(t.getId(), true);
-
 
75
				if(alerts != null){
-
 
76
					if (alerts.size() != 0){
-
 
77
						o.setAlert(true);
-
 
78
						o.setStatusMessage(alerts.iterator().next().getComment());
-
 
79
					}
-
 
80
				}else{
-
 
81
					o.setAlert(false);
-
 
82
				}
53
			}
83
			}
54
		}catch(Exception e){
84
		}catch(Exception e){
55
			System.out.println(e);
85
			System.out.println(e);
56
		}
86
		}
57
		return orders;
87
		return orders;