Subversion Repositories SmartDukaan

Rev

Rev 1611 | Rev 1677 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1611 Rev 1630
Line 1... Line 1...
1
package in.shop2020.support.controllers;
1
package in.shop2020.support.controllers;
2
 
2
 
3
import in.shop2020.model.v1.user.UserType;
3
import in.shop2020.model.v1.user.UserType;
4
import in.shop2020.thrift.clients.HelperServiceClient;
4
import in.shop2020.thrift.clients.HelperServiceClient;
-
 
5
import in.shop2020.thrift.clients.PaymentServiceClient;
5
import in.shop2020.thrift.clients.TransactionServiceClient;
6
import in.shop2020.thrift.clients.TransactionServiceClient;
6
import in.shop2020.thrift.clients.UserContextServiceClient;
7
import in.shop2020.thrift.clients.UserContextServiceClient;
7
import in.shop2020.utils.StatisticsUser;
8
import in.shop2020.utils.StatisticsUser;
8
 
9
 
9
import javax.servlet.ServletContext;
10
import javax.servlet.ServletContext;
Line 24... Line 25...
24
	private HttpSession session;
25
	private HttpSession session;
25
	
26
	
26
	private String errorMsg = "";
27
	private String errorMsg = "";
27
	private long noOfRegisterUsers;
28
	private long noOfRegisterUsers;
28
	private long noOfOrders;
29
	private long noOfOrders;
-
 
30
	private long noOfCustomers;
-
 
31
	private double maxOrderAmount;
-
 
32
	private double minOrderAmount;
-
 
33
	private double maxPaymentAmount;
-
 
34
	private double minPaymentAmount;
-
 
35
 
29
	public StatisticsController(){
36
	public StatisticsController(){
30
		
37
		
31
	}
38
	}
32
	
39
	
33
	@Override
40
	@Override
Line 53... Line 60...
53
	
60
	
54
	
61
	
55
	private void getStats() {
62
	private void getStats() {
56
		UserContextServiceClient usc;
63
		UserContextServiceClient usc;
57
		TransactionServiceClient tsc;
64
		TransactionServiceClient tsc;
-
 
65
		PaymentServiceClient psc;
58
		try {
66
		try {
59
			usc = new UserContextServiceClient();
67
			usc = new UserContextServiceClient();
60
			in.shop2020.model.v1.user.UserContextService.Client uclient = usc.getClient();
68
			in.shop2020.model.v1.user.UserContextService.Client uclient = usc.getClient();
61
			noOfRegisterUsers = uclient.getUserCount(UserType.USER);
69
			noOfRegisterUsers = uclient.getUserCount(UserType.USER);
62
			
70
			
63
			tsc = new TransactionServiceClient();
71
			tsc = new TransactionServiceClient();
64
			in.shop2020.model.v1.order.TransactionService.Client tClient = tsc.getClient();
72
			in.shop2020.model.v1.order.TransactionService.Client tClient = tsc.getClient();
65
			noOfOrders = tClient.getValidOrderCount();
73
			noOfOrders = tClient.getValidOrderCount();
-
 
74
			noOfCustomers = tClient.getNoOfCustomersWithSuccessfulTransaction();
-
 
75
			maxOrderAmount = tClient.getMaxValidOrderAmount();
-
 
76
			minOrderAmount = tClient.getMinValidOrderAmount();
-
 
77
			
-
 
78
			psc = new PaymentServiceClient();
-
 
79
			in.shop2020.payments.PaymentService.Client pClient = psc.getClient();
-
 
80
			maxPaymentAmount = pClient.getMaxPaymentAmount();
-
 
81
			minPaymentAmount = pClient.getMinPaymentAmount();
66
		} catch (Exception e) {
82
		} catch (Exception e) {
67
			e.printStackTrace();
83
			e.printStackTrace();
68
		}
84
		}
69
	}
85
	}
70
	
86
	
Line 102... Line 118...
102
 
118
 
103
	public long getNoOfOrders() {
119
	public long getNoOfOrders() {
104
		return noOfOrders;
120
		return noOfOrders;
105
	}
121
	}
106
	
122
	
-
 
123
	public long getNoOfCustomers() {
-
 
124
		return noOfCustomers;
-
 
125
	}
-
 
126
 
-
 
127
	public double getMaxOrderAmount() {
-
 
128
		return maxOrderAmount;
-
 
129
	}
-
 
130
 
-
 
131
	public double getMinOrderAmount() {
-
 
132
		return minOrderAmount;
-
 
133
	}
-
 
134
 
-
 
135
	public double getMaxPaymentAmount() {
-
 
136
		return maxPaymentAmount;
-
 
137
	}
-
 
138
 
-
 
139
	public double getMinPaymentAmount() {
-
 
140
		return minPaymentAmount;
-
 
141
	}
-
 
142
 
107
	public String getSessionUserName(){
143
	public String getSessionUserName(){
108
		return (String) session.getAttribute("username");
144
		return (String) session.getAttribute("username");
109
	}
145
	}
110
	
146
	
111
	public String getServletContextPath(){
147
	public String getServletContextPath(){