| Line 4... |
Line 4... |
| 4 |
import in.shop2020.model.v1.order.Order;
|
4 |
import in.shop2020.model.v1.order.Order;
|
| 5 |
import in.shop2020.model.v1.user.Address;
|
5 |
import in.shop2020.model.v1.user.Address;
|
| 6 |
import in.shop2020.model.v1.user.User;
|
6 |
import in.shop2020.model.v1.user.User;
|
| 7 |
import in.shop2020.model.v1.user.UserContextException;
|
7 |
import in.shop2020.model.v1.user.UserContextException;
|
| 8 |
import in.shop2020.serving.utils.Utils;
|
8 |
import in.shop2020.serving.utils.Utils;
|
| 9 |
import in.shop2020.thrift.clients.LogisticsServiceClient;
|
9 |
import in.shop2020.thrift.clients.LogisticsClient;
|
| 10 |
import in.shop2020.thrift.clients.TransactionServiceClient;
|
10 |
import in.shop2020.thrift.clients.TransactionClient;
|
| 11 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
11 |
import in.shop2020.thrift.clients.UserClient;
|
| 12 |
|
12 |
|
| 13 |
import java.io.BufferedReader;
|
13 |
import java.io.BufferedReader;
|
| 14 |
import java.io.File;
|
14 |
import java.io.File;
|
| 15 |
import java.io.FileInputStream;
|
15 |
import java.io.FileInputStream;
|
| 16 |
import java.io.FileNotFoundException;
|
16 |
import java.io.FileNotFoundException;
|
| Line 170... |
Line 170... |
| 170 |
String templateFile = "templates/orderdetails.vm";
|
170 |
String templateFile = "templates/orderdetails.vm";
|
| 171 |
Order order = null;
|
171 |
Order order = null;
|
| 172 |
Date orderedOn = null, deliveryEstimate = null;
|
172 |
Date orderedOn = null, deliveryEstimate = null;
|
| 173 |
Provider provider = null;
|
173 |
Provider provider = null;
|
| 174 |
try{
|
174 |
try{
|
| 175 |
TransactionServiceClient transactionServiceClient = new TransactionServiceClient();
|
175 |
TransactionClient transactionServiceClient = new TransactionClient();
|
| 176 |
in.shop2020.model.v1.order.TransactionService.Client orderClient = transactionServiceClient.getClient();
|
176 |
in.shop2020.model.v1.order.TransactionService.Client orderClient = transactionServiceClient.getClient();
|
| 177 |
order = orderClient.getOrderForCustomer(orderId, userId);
|
177 |
order = orderClient.getOrderForCustomer(orderId, userId);
|
| 178 |
orderedOn = new Date(order.getCreated_timestamp());
|
178 |
orderedOn = new Date(order.getCreated_timestamp());
|
| 179 |
deliveryEstimate = new Date(order.getExpected_delivery_time());
|
179 |
deliveryEstimate = new Date(order.getExpected_delivery_time());
|
| 180 |
|
180 |
|
| 181 |
if(order.getLogistics_provider_id() != 0){
|
181 |
if(order.getLogistics_provider_id() != 0){
|
| 182 |
LogisticsServiceClient logisticsServiceClient = new LogisticsServiceClient();
|
182 |
LogisticsClient logisticsServiceClient = new LogisticsClient();
|
| 183 |
in.shop2020.logistics.LogisticsService.Client logisticsClient = logisticsServiceClient.getClient();
|
183 |
in.shop2020.logistics.LogisticsService.Client logisticsClient = logisticsServiceClient.getClient();
|
| 184 |
provider = logisticsClient.getProvider(order.getLogistics_provider_id());
|
184 |
provider = logisticsClient.getProvider(order.getLogistics_provider_id());
|
| 185 |
}
|
185 |
}
|
| 186 |
}catch (Exception e){
|
186 |
}catch (Exception e){
|
| 187 |
|
187 |
|
| Line 205... |
Line 205... |
| 205 |
VelocityContext context = new VelocityContext();
|
205 |
VelocityContext context = new VelocityContext();
|
| 206 |
String templateFile = "templates/myaccount.vm";
|
206 |
String templateFile = "templates/myaccount.vm";
|
| 207 |
List<Order> orders = null;
|
207 |
List<Order> orders = null;
|
| 208 |
Map<Long, String> providerNames = new HashMap<Long, String>();
|
208 |
Map<Long, String> providerNames = new HashMap<Long, String>();
|
| 209 |
try{
|
209 |
try{
|
| 210 |
TransactionServiceClient transactionServiceClient = new TransactionServiceClient();
|
210 |
TransactionClient transactionServiceClient = new TransactionClient();
|
| 211 |
in.shop2020.model.v1.order.TransactionService.Client orderClient = transactionServiceClient.getClient();
|
211 |
in.shop2020.model.v1.order.TransactionService.Client orderClient = transactionServiceClient.getClient();
|
| 212 |
orders = orderClient.getOrdersForCustomer(userId, 0, (new Date()).getTime(), null);
|
212 |
orders = orderClient.getOrdersForCustomer(userId, 0, (new Date()).getTime(), null);
|
| 213 |
|
213 |
|
| 214 |
LogisticsServiceClient logisticsServiceClient = new LogisticsServiceClient();
|
214 |
LogisticsClient logisticsServiceClient = new LogisticsClient();
|
| 215 |
in.shop2020.logistics.LogisticsService.Client logisticsClient = logisticsServiceClient.getClient();
|
215 |
in.shop2020.logistics.LogisticsService.Client logisticsClient = logisticsServiceClient.getClient();
|
| 216 |
List<Provider> providers = logisticsClient.getAllProviders();
|
216 |
List<Provider> providers = logisticsClient.getAllProviders();
|
| 217 |
for(Provider provider: providers)
|
217 |
for(Provider provider: providers)
|
| 218 |
providerNames.put(provider.getId(), provider.getName());
|
218 |
providerNames.put(provider.getId(), provider.getName());
|
| 219 |
}catch (Exception e){
|
219 |
}catch (Exception e){
|
| Line 252... |
Line 252... |
| 252 |
|
252 |
|
| 253 |
public String getEmailId(long userId){
|
253 |
public String getEmailId(long userId){
|
| 254 |
String email = " ";
|
254 |
String email = " ";
|
| 255 |
|
255 |
|
| 256 |
try {
|
256 |
try {
|
| 257 |
UserContextServiceClient userContextServiceClient = new UserContextServiceClient();
|
257 |
UserClient userContextServiceClient = new UserClient();
|
| 258 |
in.shop2020.model.v1.user.UserContextService.Client userClient = userContextServiceClient.getClient();
|
258 |
in.shop2020.model.v1.user.UserContextService.Client userClient = userContextServiceClient.getClient();
|
| 259 |
String userEmail = userClient.getUserById(userId).getEmail();
|
259 |
String userEmail = userClient.getUserById(userId).getEmail();
|
| 260 |
if( userEmail != null){
|
260 |
if( userEmail != null){
|
| 261 |
email = userEmail;
|
261 |
email = userEmail;
|
| 262 |
}
|
262 |
}
|
| Line 278... |
Line 278... |
| 278 |
String email = "";
|
278 |
String email = "";
|
| 279 |
String name = "";
|
279 |
String name = "";
|
| 280 |
String dateOfBirth = "";
|
280 |
String dateOfBirth = "";
|
| 281 |
String sex = "";
|
281 |
String sex = "";
|
| 282 |
String subscribe = "false";
|
282 |
String subscribe = "false";
|
| 283 |
UserContextServiceClient userContextServiceClient = null;
|
283 |
UserClient userContextServiceClient = null;
|
| 284 |
in.shop2020.model.v1.user.UserContextService.Client userClient = null;
|
284 |
in.shop2020.model.v1.user.UserContextService.Client userClient = null;
|
| 285 |
try{
|
285 |
try{
|
| 286 |
User user = null;
|
286 |
User user = null;
|
| 287 |
userContextServiceClient = new UserContextServiceClient();
|
287 |
userContextServiceClient = new UserClient();
|
| 288 |
userClient = userContextServiceClient.getClient();
|
288 |
userClient = userContextServiceClient.getClient();
|
| 289 |
user = userClient.getUserById(userId);
|
289 |
user = userClient.getUserById(userId);
|
| 290 |
|
290 |
|
| 291 |
email = user.getCommunicationEmail();
|
291 |
email = user.getCommunicationEmail();
|
| 292 |
name = user.getName();
|
292 |
name = user.getName();
|
| Line 317... |
Line 317... |
| 317 |
VelocityContext context = new VelocityContext();
|
317 |
VelocityContext context = new VelocityContext();
|
| 318 |
String templateFile = "templates/shippingaddressdetails.vm";
|
318 |
String templateFile = "templates/shippingaddressdetails.vm";
|
| 319 |
long defaultAddressId = 0;
|
319 |
long defaultAddressId = 0;
|
| 320 |
List<Address> addresses = null;
|
320 |
List<Address> addresses = null;
|
| 321 |
|
321 |
|
| 322 |
UserContextServiceClient userContextServiceClient = null;
|
322 |
UserClient userContextServiceClient = null;
|
| 323 |
in.shop2020.model.v1.user.UserContextService.Client userClient = null;
|
323 |
in.shop2020.model.v1.user.UserContextService.Client userClient = null;
|
| 324 |
try {
|
324 |
try {
|
| 325 |
userContextServiceClient = new UserContextServiceClient();
|
325 |
userContextServiceClient = new UserClient();
|
| 326 |
userClient = userContextServiceClient.getClient();
|
326 |
userClient = userContextServiceClient.getClient();
|
| 327 |
|
327 |
|
| 328 |
addresses = userClient.getAllAddressesForUser(userId);
|
328 |
addresses = userClient.getAllAddressesForUser(userId);
|
| 329 |
defaultAddressId = userClient.getDefaultAddressId(userId);
|
329 |
defaultAddressId = userClient.getDefaultAddressId(userId);
|
| 330 |
} catch (Exception e) {
|
330 |
} catch (Exception e) {
|