| Line 1... |
Line 1... |
| 1 |
package in.shop2020.support.controllers;
|
1 |
package in.shop2020.support.controllers;
|
| 2 |
|
2 |
|
| 3 |
import in.shop2020.model.v1.order.LineItem;
|
3 |
import in.shop2020.model.v1.order.LineItem;
|
| 4 |
import in.shop2020.model.v1.order.Order;
|
4 |
import in.shop2020.model.v1.order.Order;
|
| 5 |
import in.shop2020.model.v1.order.OrderStatus;
|
- |
|
| 6 |
import in.shop2020.model.v1.order.Transaction;
|
5 |
import in.shop2020.model.v1.order.Transaction;
|
| 7 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
6 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
| 8 |
import in.shop2020.model.v1.order.TransactionStatus;
|
- |
|
| 9 |
import in.shop2020.model.v1.user.Address;
|
7 |
import in.shop2020.model.v1.user.Address;
|
| 10 |
import in.shop2020.model.v1.user.User;
|
8 |
import in.shop2020.model.v1.user.User;
|
| 11 |
import in.shop2020.model.v1.user.UserContextService.Client;
|
9 |
import in.shop2020.model.v1.user.UserContextService.Client;
|
| 12 |
import in.shop2020.payments.Payment;
|
10 |
import in.shop2020.payments.Payment;
|
| 13 |
import in.shop2020.payments.PaymentService;
|
- |
|
| 14 |
import in.shop2020.payments.PaymentStatus;
|
- |
|
| 15 |
import in.shop2020.thrift.clients.PaymentServiceClient;
|
11 |
import in.shop2020.thrift.clients.PaymentServiceClient;
|
| 16 |
import in.shop2020.thrift.clients.TransactionServiceClient;
|
12 |
import in.shop2020.thrift.clients.TransactionServiceClient;
|
| 17 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
13 |
import in.shop2020.thrift.clients.UserContextServiceClient;
|
| 18 |
|
14 |
|
| 19 |
import java.io.BufferedReader;
|
15 |
import java.io.BufferedReader;
|
| Line 102... |
Line 98... |
| 102 |
errorMsg = "No user for this id.";
|
98 |
errorMsg = "No user for this id.";
|
| 103 |
return "report";
|
99 |
return "report";
|
| 104 |
}
|
100 |
}
|
| 105 |
}
|
101 |
}
|
| 106 |
else {
|
102 |
else {
|
| - |
|
103 |
try {
|
| 107 |
user = userClient.getUserById(transactionClient.getOrder(Long.parseLong(orderid)).getCustomer_id());
|
104 |
user = userClient.getUserById(transactionClient.getOrder(Long.parseLong(orderid)).getCustomer_id());
|
| - |
|
105 |
} catch (NumberFormatException e) {
|
| - |
|
106 |
errorMsg = "Order Id should be a number.";
|
| - |
|
107 |
return "report";
|
| - |
|
108 |
}
|
| 108 |
}
|
109 |
}
|
| 109 |
|
110 |
|
| 110 |
if (user == null) {
|
111 |
if (user == null) {
|
| 111 |
errorMsg = "Could not find user.";
|
112 |
errorMsg = "Could not find user.";
|
| 112 |
return "report";
|
113 |
return "report";
|
| Line 137... |
Line 138... |
| 137 |
errorMsg = "Failed to write to response.";
|
138 |
errorMsg = "Failed to write to response.";
|
| 138 |
e.printStackTrace();
|
139 |
e.printStackTrace();
|
| 139 |
}
|
140 |
}
|
| 140 |
|
141 |
|
| 141 |
} catch (ParseException e) {
|
142 |
} catch (ParseException e) {
|
| 142 |
errorMsg = "Parse Exception.";
|
143 |
errorMsg = e.getMessage();
|
| 143 |
e.printStackTrace();
|
144 |
e.printStackTrace();
|
| 144 |
} catch (TransactionServiceException e) {
|
145 |
} catch (TransactionServiceException e) {
|
| 145 |
errorMsg = "Transaction Service Exception.";
|
146 |
errorMsg = e.getMessage();
|
| 146 |
e.printStackTrace();
|
147 |
e.printStackTrace();
|
| 147 |
} catch (Exception e) {
|
148 |
} catch (Exception e) {
|
| 148 |
errorMsg = "Something went wrong.";
|
149 |
errorMsg = e.getMessage();
|
| 149 |
e.printStackTrace();
|
150 |
e.printStackTrace();
|
| 150 |
}
|
151 |
}
|
| 151 |
return "report";
|
152 |
return "report";
|
| 152 |
}
|
153 |
}
|
| 153 |
|
154 |
|
| Line 357... |
Line 358... |
| 357 |
userContentRow.createCell(3).setCellValue(user.getDateOfBirth());
|
358 |
userContentRow.createCell(3).setCellValue(user.getDateOfBirth());
|
| 358 |
userContentRow.createCell(4).setCellValue(user.getMobileNumber());
|
359 |
userContentRow.createCell(4).setCellValue(user.getMobileNumber());
|
| 359 |
userContentRow.createCell(5).setCellValue(user.getSex().name());
|
360 |
userContentRow.createCell(5).setCellValue(user.getSex().name());
|
| 360 |
userContentRow.createCell(6).setCellValue(user.getUserId());
|
361 |
userContentRow.createCell(6).setCellValue(user.getUserId());
|
| 361 |
|
362 |
|
| - |
|
363 |
userSerialNo+=2;
|
| - |
|
364 |
Row addressHeaderRow = userSheet.createRow(userSerialNo++);
|
| - |
|
365 |
addressHeaderRow.createCell(0).setCellValue("Name");
|
| - |
|
366 |
addressHeaderRow.createCell(1).setCellValue("Line1");
|
| - |
|
367 |
addressHeaderRow.createCell(2).setCellValue("Line2");
|
| - |
|
368 |
addressHeaderRow.createCell(3).setCellValue("City");
|
| - |
|
369 |
addressHeaderRow.createCell(4).setCellValue("State");
|
| - |
|
370 |
addressHeaderRow.createCell(5).setCellValue("Pincode");
|
| - |
|
371 |
addressHeaderRow.createCell(6).setCellValue("Phone");
|
| - |
|
372 |
|
| 362 |
for (Address address : user.getAddresses()) {
|
373 |
for (Address address : user.getAddresses()) {
|
| 363 |
if (user.getDefaultAddressId() == address.getId()) {
|
374 |
if (user.getDefaultAddressId() == address.getId()) {
|
| 364 |
userSerialNo+=2;
|
- |
|
| 365 |
userContentRow = userSheet.createRow(userSerialNo);
|
375 |
userContentRow = userSheet.createRow(userSerialNo);
|
| 366 |
userSheet.addMergedRegion(new CellRangeAddress(userSerialNo, userSerialNo, 0, 6));
|
376 |
userSheet.addMergedRegion(new CellRangeAddress(userSerialNo, userSerialNo, 0, 6));
|
| 367 |
userContentRow.createCell(0).setCellValue("Primary Address");
|
377 |
userContentRow.createCell(0).setCellValue("Primary Address");
|
| 368 |
|
378 |
|
| 369 |
userSerialNo++;
|
379 |
userSerialNo++;
|
| 370 |
userContentRow = userSheet.createRow(userSerialNo);
|
380 |
userContentRow = userSheet.createRow(userSerialNo);
|
| Line 373... |
Line 383... |
| 373 |
userContentRow.createCell(2).setCellValue(address.getLine2());
|
383 |
userContentRow.createCell(2).setCellValue(address.getLine2());
|
| 374 |
userContentRow.createCell(3).setCellValue(address.getCity());
|
384 |
userContentRow.createCell(3).setCellValue(address.getCity());
|
| 375 |
userContentRow.createCell(4).setCellValue(address.getState());
|
385 |
userContentRow.createCell(4).setCellValue(address.getState());
|
| 376 |
userContentRow.createCell(5).setCellValue(address.getPin());
|
386 |
userContentRow.createCell(5).setCellValue(address.getPin());
|
| 377 |
userContentRow.createCell(6).setCellValue(address.getPhone());
|
387 |
userContentRow.createCell(6).setCellValue(address.getPhone());
|
| - |
|
388 |
userSerialNo+=3;
|
| 378 |
}
|
389 |
}
|
| 379 |
}
|
390 |
}
|
| 380 |
|
391 |
|
| 381 |
userSerialNo+=3;
|
- |
|
| 382 |
userContentRow = userSheet.createRow(userSerialNo);
|
392 |
userContentRow = userSheet.createRow(userSerialNo);
|
| 383 |
userSheet.addMergedRegion(new CellRangeAddress(userSerialNo, userSerialNo, 0, 6));
|
393 |
userSheet.addMergedRegion(new CellRangeAddress(userSerialNo, userSerialNo, 0, 6));
|
| 384 |
userContentRow.createCell(0).setCellValue("Other Addresses");
|
394 |
userContentRow.createCell(0).setCellValue("Other Addresses");
|
| 385 |
|
395 |
|
| 386 |
for (Address address : user.getAddresses()) {
|
396 |
for (Address address : user.getAddresses()) {
|