| Line 39... |
Line 39... |
| 39 |
import javax.servlet.http.HttpSession;
|
39 |
import javax.servlet.http.HttpSession;
|
| 40 |
|
40 |
|
| 41 |
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
41 |
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
| 42 |
import org.apache.poi.ss.usermodel.Cell;
|
42 |
import org.apache.poi.ss.usermodel.Cell;
|
| 43 |
import org.apache.poi.ss.usermodel.CellStyle;
|
43 |
import org.apache.poi.ss.usermodel.CellStyle;
|
| - |
|
44 |
import org.apache.poi.ss.usermodel.CreationHelper;
|
| 44 |
import org.apache.poi.ss.usermodel.Font;
|
45 |
import org.apache.poi.ss.usermodel.Font;
|
| 45 |
import org.apache.poi.ss.usermodel.Row;
|
46 |
import org.apache.poi.ss.usermodel.Row;
|
| 46 |
import org.apache.poi.ss.usermodel.Sheet;
|
47 |
import org.apache.poi.ss.usermodel.Sheet;
|
| 47 |
import org.apache.poi.ss.usermodel.Workbook;
|
48 |
import org.apache.poi.ss.usermodel.Workbook;
|
| 48 |
import org.apache.poi.ss.util.CellRangeAddress;
|
49 |
import org.apache.poi.ss.util.CellRangeAddress;
|
| Line 50... |
Line 51... |
| 50 |
import org.apache.struts2.interceptor.ServletResponseAware;
|
51 |
import org.apache.struts2.interceptor.ServletResponseAware;
|
| 51 |
import org.apache.thrift.TException;
|
52 |
import org.apache.thrift.TException;
|
| 52 |
|
53 |
|
| 53 |
public class UserOrdersController implements ServletResponseAware, ServletRequestAware{
|
54 |
public class UserOrdersController implements ServletResponseAware, ServletRequestAware{
|
| 54 |
|
55 |
|
| 55 |
private static final DateFormat DATE_TIME_FORMAT = new SimpleDateFormat("dd/MM/yyyy HH:mm");
|
56 |
//private static final DateFormat DATE_TIME_FORMAT = new SimpleDateFormat("yyyy/MM/dd HH:mm");
|
| 56 |
|
57 |
|
| 57 |
private HttpServletRequest request;
|
58 |
private HttpServletRequest request;
|
| 58 |
private HttpServletResponse response;
|
59 |
private HttpServletResponse response;
|
| 59 |
|
60 |
|
| 60 |
private String errorMsg = "";
|
61 |
private String errorMsg = "";
|
| 61 |
|
62 |
|
| 62 |
public UserOrdersController(){
|
- |
|
| 63 |
|
- |
|
| 64 |
}
|
- |
|
| 65 |
|
- |
|
| 66 |
@Override
|
63 |
@Override
|
| 67 |
public void setServletRequest(HttpServletRequest req) {
|
64 |
public void setServletRequest(HttpServletRequest req) {
|
| 68 |
this.request = req;
|
65 |
this.request = req;
|
| 69 |
}
|
66 |
}
|
| 70 |
|
67 |
|
| Line 119... |
Line 116... |
| 119 |
return "report";
|
116 |
return "report";
|
| 120 |
}
|
117 |
}
|
| 121 |
|
118 |
|
| 122 |
//Retrieving all user communications
|
119 |
//Retrieving all user communications
|
| 123 |
List<UserCommunication> userCommunications = userClient.getUserCommunicationByUser(user.getUserId());
|
120 |
List<UserCommunication> userCommunications = userClient.getUserCommunicationByUser(user.getUserId());
|
| 124 |
List<UserCommunication> allCommunications = userClient.getAllUserCommunications();
|
- |
|
| 125 |
|
121 |
|
| 126 |
//Retrieving all the transactions
|
122 |
//Retrieving all the transactions
|
| 127 |
List <Transaction> transactions = transactionClient.getTransactionsForCustomer(user.getUserId(), 0, (new Date()).getTime(), null);
|
123 |
List <Transaction> transactions = transactionClient.getTransactionsForCustomer(user.getUserId(), 0, (new Date()).getTime(), null);
|
| 128 |
Collections.reverse(transactions);
|
124 |
Collections.reverse(transactions);
|
| 129 |
|
125 |
|
| 130 |
System.out.println("Total number of Transaction: " + transactions.size());
|
- |
|
| 131 |
|
- |
|
| 132 |
//Retrieving all the payments
|
126 |
//Retrieving all the payments
|
| 133 |
List <Payment> payments = paymentClient.getPaymentsForUser(user.getUserId(), 0,
|
127 |
List <Payment> payments = paymentClient.getPaymentsForUser(user.getUserId(), 0,
|
| 134 |
(new Date()).getTime(), null, 0);
|
128 |
(new Date()).getTime(), null, 0);
|
| 135 |
|
129 |
|
| 136 |
Map<Long, Payment> txnIdToPaymentMap = new HashMap<Long, Payment>();
|
130 |
Map<Long, Payment> txnIdToPaymentMap = new HashMap<Long, Payment>();
|
| Line 144... |
Line 138... |
| 144 |
response.setHeader("Content-disposition", "inline; filename=user-orders" + ".xls");
|
138 |
response.setHeader("Content-disposition", "inline; filename=user-orders" + ".xls");
|
| 145 |
|
139 |
|
| 146 |
ServletOutputStream sos;
|
140 |
ServletOutputStream sos;
|
| 147 |
try {
|
141 |
try {
|
| 148 |
ByteArrayOutputStream baos = getSpreadSheetData(user,
|
142 |
ByteArrayOutputStream baos = getSpreadSheetData(user,
|
| 149 |
transactions, txnIdToPaymentMap, userCommunications,
|
143 |
transactions, txnIdToPaymentMap, userCommunications, userClient);
|
| 150 |
allCommunications, userClient);
|
- |
|
| 151 |
sos = response.getOutputStream();
|
144 |
sos = response.getOutputStream();
|
| 152 |
baos.writeTo(sos);
|
145 |
baos.writeTo(sos);
|
| 153 |
sos.flush();
|
146 |
sos.flush();
|
| 154 |
} catch (IOException e) {
|
147 |
} catch (IOException e) {
|
| 155 |
errorMsg = "Failed to write to response.";
|
148 |
errorMsg = "Failed to write to response.";
|
| Line 172... |
Line 165... |
| 172 |
// Prepares the XLS worksheet object and fills in the data with proper formatting
|
165 |
// Prepares the XLS worksheet object and fills in the data with proper formatting
|
| 173 |
private ByteArrayOutputStream getSpreadSheetData(User user,
|
166 |
private ByteArrayOutputStream getSpreadSheetData(User user,
|
| 174 |
List<Transaction> transactions,
|
167 |
List<Transaction> transactions,
|
| 175 |
Map<Long, Payment> txnIdToPaymentMap,
|
168 |
Map<Long, Payment> txnIdToPaymentMap,
|
| 176 |
List<UserCommunication> userCommunications,
|
169 |
List<UserCommunication> userCommunications,
|
| 177 |
List<UserCommunication> allCommunications, Client userClient)
|
170 |
Client userClient)
|
| 178 |
{
|
171 |
{
|
| 179 |
ByteArrayOutputStream baosXLS = new ByteArrayOutputStream();
|
172 |
ByteArrayOutputStream baosXLS = new ByteArrayOutputStream();
|
| 180 |
|
173 |
|
| 181 |
Workbook wb = new HSSFWorkbook();
|
174 |
Workbook wb = new HSSFWorkbook();
|
| 182 |
|
175 |
|
| 183 |
Font font = wb.createFont();
|
176 |
Font font = wb.createFont();
|
| 184 |
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
|
177 |
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
|
| 185 |
CellStyle style = wb.createCellStyle();
|
178 |
CellStyle style = wb.createCellStyle();
|
| 186 |
style.setFont(font);
|
179 |
style.setFont(font);
|
| 187 |
|
180 |
|
| 188 |
createUserSheet(user, userCommunications, wb, style);
|
181 |
CreationHelper createHelper = wb.getCreationHelper();
|
| - |
|
182 |
CellStyle dateCellStyle = wb.createCellStyle();
|
| - |
|
183 |
dateCellStyle.setDataFormat(createHelper.createDataFormat().getFormat("DD/MM/YYYY HH:MM"));
|
| - |
|
184 |
|
| 189 |
createTransactionSheet(transactions, txnIdToPaymentMap, wb, style);
|
185 |
createUserSheet(user, userCommunications, wb, style, dateCellStyle);
|
| 190 |
createAllUserCommunicationSheet(allCommunications, userClient, wb, style);
|
186 |
createTransactionSheet(transactions, txnIdToPaymentMap, wb, style, dateCellStyle);
|
| 191 |
|
187 |
|
| 192 |
// Write the workbook to the output stream
|
188 |
// Write the workbook to the output stream
|
| 193 |
try {
|
189 |
try {
|
| 194 |
wb.write(baosXLS);
|
190 |
wb.write(baosXLS);
|
| 195 |
baosXLS.close();
|
191 |
baosXLS.close();
|
| 196 |
} catch (IOException e) {
|
192 |
} catch (IOException e) {
|
| 197 |
e.printStackTrace();
|
193 |
e.printStackTrace();
|
| 198 |
}
|
194 |
}
|
| 199 |
return baosXLS;
|
195 |
return baosXLS;
|
| 200 |
}
|
196 |
}
|
| 201 |
|
- |
|
| 202 |
private void createAllUserCommunicationSheet(
|
- |
|
| 203 |
List<UserCommunication> allCommunications,
|
- |
|
| 204 |
Client userClient,
|
- |
|
| 205 |
Workbook wb,
|
- |
|
| 206 |
CellStyle style)
|
- |
|
| 207 |
{
|
- |
|
| 208 |
// USER COMMUNICATION SHEET
|
- |
|
| 209 |
Sheet commSheet = wb.createSheet("All Users Communications");
|
- |
|
| 210 |
short commSerialNo = 0;
|
- |
|
| 211 |
|
- |
|
| 212 |
Row commTitleRow = commSheet.createRow(commSerialNo ++);
|
- |
|
| 213 |
Cell commTitleCell = commTitleRow.createCell(0);
|
- |
|
| 214 |
commTitleCell.setCellValue("All Users Communications");
|
- |
|
| 215 |
commTitleCell.setCellStyle(style);
|
- |
|
| 216 |
|
- |
|
| 217 |
commSheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 6));
|
- |
|
| 218 |
|
- |
|
| 219 |
commSheet.createRow(commSerialNo ++);
|
- |
|
| 220 |
|
- |
|
| 221 |
Row commHeaderRow = commSheet.createRow(commSerialNo++);
|
- |
|
| 222 |
commHeaderRow.createCell(0).setCellValue("User Email");
|
- |
|
| 223 |
commHeaderRow.createCell(1).setCellValue("User Name");
|
- |
|
| 224 |
commHeaderRow.createCell(2).setCellValue("Communication Email");
|
- |
|
| 225 |
commHeaderRow.createCell(3).setCellValue("Date of Birth");
|
- |
|
| 226 |
commHeaderRow.createCell(4).setCellValue("Mobile Number");
|
- |
|
| 227 |
commHeaderRow.createCell(5).setCellValue("User Id");
|
- |
|
| 228 |
commHeaderRow.createCell(6).setCellValue("Sex");
|
- |
|
| 229 |
commHeaderRow.createCell(7).setCellValue("Order Id");
|
- |
|
| 230 |
commHeaderRow.createCell(8).setCellValue("Communication Type");
|
- |
|
| 231 |
commHeaderRow.createCell(9).setCellValue("AirwayBill No");
|
- |
|
| 232 |
commHeaderRow.createCell(10).setCellValue("TimeStamp");
|
- |
|
| 233 |
commHeaderRow.createCell(11).setCellValue("Product Name");
|
- |
|
| 234 |
commHeaderRow.createCell(12).setCellValue("Reply To");
|
- |
|
| 235 |
commHeaderRow.createCell(13).setCellValue("Subject");
|
- |
|
| 236 |
commHeaderRow.createCell(14).setCellValue("Message");
|
- |
|
| 237 |
|
- |
|
| 238 |
for( UserCommunication userComm : allCommunications) {
|
- |
|
| 239 |
commSerialNo++;
|
- |
|
| 240 |
Row commContentRow = commSheet.createRow(commSerialNo);
|
- |
|
| 241 |
|
- |
|
| 242 |
try {
|
- |
|
| 243 |
User user = userClient.getUserById(userComm.getUserId());
|
- |
|
| 244 |
if (user.getUserId() == -1) {
|
- |
|
| 245 |
commContentRow.createCell(0).setCellValue(user.getEmail());
|
- |
|
| 246 |
commContentRow.createCell(1).setCellValue(user.getName());
|
- |
|
| 247 |
commContentRow.createCell(2).setCellValue(user.getCommunicationEmail());
|
- |
|
| 248 |
commContentRow.createCell(3).setCellValue(user.getDateOfBirth());
|
- |
|
| 249 |
commContentRow.createCell(4).setCellValue(user.getMobileNumber());
|
- |
|
| 250 |
commContentRow.createCell(5).setCellValue(user.getUserId());
|
- |
|
| 251 |
if (user.getSex() != null) {
|
- |
|
| 252 |
commContentRow.createCell(6).setCellValue(user.getSex().name());
|
- |
|
| 253 |
}
|
- |
|
| 254 |
}
|
- |
|
| 255 |
} catch (UserContextException e) {
|
- |
|
| 256 |
e.printStackTrace();
|
- |
|
| 257 |
} catch (TException e) {
|
- |
|
| 258 |
e.printStackTrace();
|
- |
|
| 259 |
}
|
- |
|
| 260 |
commContentRow.createCell(7).setCellValue(userComm.getOrderId());
|
- |
|
| 261 |
if (userComm.getCommunicationType() != null) {
|
- |
|
| 262 |
commContentRow.createCell(8).setCellValue(
|
- |
|
| 263 |
userComm.getCommunicationType().name());
|
- |
|
| 264 |
}
|
- |
|
| 265 |
commContentRow.createCell(9).setCellValue(userComm.getAirwaybillNo());
|
- |
|
| 266 |
commContentRow.createCell(10).setCellValue(DATE_TIME_FORMAT.format(userComm.getCommunication_timestamp()));
|
- |
|
| 267 |
commContentRow.createCell(11).setCellValue(userComm.getProductName());
|
- |
|
| 268 |
commContentRow.createCell(12).setCellValue(userComm.getReplyTo());
|
- |
|
| 269 |
commContentRow.createCell(13).setCellValue(userComm.getSubject());
|
- |
|
| 270 |
commContentRow.createCell(14).setCellValue(userComm.getMessage());
|
- |
|
| 271 |
}
|
- |
|
| 272 |
}
|
- |
|
| 273 |
|
197 |
|
| 274 |
private void createTransactionSheet(List<Transaction> transactions, Map<Long, Payment> txnIdToPaymentMap, Workbook wb, CellStyle style) {
|
198 |
private void createTransactionSheet(List<Transaction> transactions, Map<Long, Payment> txnIdToPaymentMap, Workbook wb, CellStyle style, CellStyle dateCellStyle) {
|
| 275 |
// TRANSACTION SHEET
|
199 |
// TRANSACTION SHEET
|
| 276 |
Sheet transactionSheet = wb.createSheet("Transactions and Payments");
|
200 |
Sheet transactionSheet = wb.createSheet("Transactions and Payments");
|
| 277 |
short transactionSerialNo = 0;
|
201 |
short transactionSerialNo = 0;
|
| 278 |
|
202 |
|
| 279 |
Row orderTitleRow = transactionSheet.createRow(transactionSerialNo ++);
|
203 |
Row orderTitleRow = transactionSheet.createRow(transactionSerialNo ++);
|
| Line 304... |
Line 228... |
| 304 |
|
228 |
|
| 305 |
orderHeaderRow.createCell(14).setCellValue("User Id");
|
229 |
orderHeaderRow.createCell(14).setCellValue("User Id");
|
| 306 |
orderHeaderRow.createCell(15).setCellValue("Name");
|
230 |
orderHeaderRow.createCell(15).setCellValue("Name");
|
| 307 |
orderHeaderRow.createCell(16).setCellValue("Address1");
|
231 |
orderHeaderRow.createCell(16).setCellValue("Address1");
|
| 308 |
orderHeaderRow.createCell(17).setCellValue("Address2");
|
232 |
orderHeaderRow.createCell(17).setCellValue("Address2");
|
| 309 |
orderHeaderRow.createCell(17).setCellValue("City");
|
233 |
orderHeaderRow.createCell(18).setCellValue("City");
|
| 310 |
orderHeaderRow.createCell(19).setCellValue("State");
|
234 |
orderHeaderRow.createCell(19).setCellValue("State");
|
| 311 |
orderHeaderRow.createCell(20).setCellValue("Pin Code");
|
235 |
orderHeaderRow.createCell(20).setCellValue("Pin Code");
|
| 312 |
orderHeaderRow.createCell(21).setCellValue("Mobile Number");
|
236 |
orderHeaderRow.createCell(21).setCellValue("Mobile Number");
|
| 313 |
orderHeaderRow.createCell(22).setCellValue("email");
|
237 |
orderHeaderRow.createCell(22).setCellValue("email");
|
| 314 |
|
238 |
|
| Line 331... |
Line 255... |
| 331 |
orderHeaderRow.createCell(38).setCellValue("Amount");
|
255 |
orderHeaderRow.createCell(38).setCellValue("Amount");
|
| 332 |
orderHeaderRow.createCell(39).setCellValue("Description");
|
256 |
orderHeaderRow.createCell(39).setCellValue("Description");
|
| 333 |
orderHeaderRow.createCell(40).setCellValue("Auth Code");
|
257 |
orderHeaderRow.createCell(40).setCellValue("Auth Code");
|
| 334 |
orderHeaderRow.createCell(41).setCellValue("Error Code");
|
258 |
orderHeaderRow.createCell(41).setCellValue("Error Code");
|
| 335 |
|
259 |
|
| - |
|
260 |
for (int i=0; i<42 ;i++) {
|
| - |
|
261 |
orderHeaderRow.getCell(i).setCellStyle(style);
|
| - |
|
262 |
}
|
| - |
|
263 |
|
| 336 |
for(Transaction transaction : transactions) {
|
264 |
for(Transaction transaction : transactions) {
|
| 337 |
List<Order> orders = transaction.getOrders();
|
265 |
List<Order> orders = transaction.getOrders();
|
| 338 |
Date transactionDate = new Date(transaction.getCreatedOn());
|
266 |
Date transactionDate = new Date(transaction.getCreatedOn());
|
| 339 |
long transactionId = transaction.getId();
|
267 |
long transactionId = transaction.getId();
|
| 340 |
String transactionStatus = transaction.getStatusDescription();
|
268 |
String transactionStatus = transaction.getStatusDescription();
|
| Line 343... |
Line 271... |
| 343 |
Row contentRow = transactionSheet.createRow(transactionSerialNo);
|
271 |
Row contentRow = transactionSheet.createRow(transactionSerialNo);
|
| 344 |
LineItem lineItem = order.getLineitems().get(0);
|
272 |
LineItem lineItem = order.getLineitems().get(0);
|
| 345 |
Payment payment = txnIdToPaymentMap.get(transactionId);
|
273 |
Payment payment = txnIdToPaymentMap.get(transactionId);
|
| 346 |
|
274 |
|
| 347 |
contentRow.createCell(0).setCellValue(transactionId);
|
275 |
contentRow.createCell(0).setCellValue(transactionId);
|
| 348 |
contentRow.createCell(1).setCellValue(DATE_TIME_FORMAT.format(transactionDate));
|
276 |
contentRow.createCell(1).setCellValue(transactionDate);
|
| - |
|
277 |
contentRow.getCell(1).setCellStyle(dateCellStyle);
|
| 349 |
contentRow.createCell(2).setCellValue(transactionStatus);
|
278 |
contentRow.createCell(2).setCellValue(transactionStatus);
|
| 350 |
contentRow.createCell(3).setCellValue(order.getId());
|
279 |
contentRow.createCell(3).setCellValue(order.getId());
|
| 351 |
contentRow.createCell(4).setCellValue(order.getInvoice_number());
|
280 |
contentRow.createCell(4).setCellValue(order.getInvoice_number());
|
| 352 |
contentRow.createCell(5).setCellValue(DATE_TIME_FORMAT.format(new Date(order.getBilling_timestamp())));
|
281 |
contentRow.createCell(5).setCellValue(order.getBilling_timestamp());
|
| - |
|
282 |
contentRow.getCell(5).setCellStyle(dateCellStyle);
|
| 353 |
contentRow.createCell(6).setCellValue(order.getStatusDescription());
|
283 |
contentRow.createCell(6).setCellValue(order.getStatusDescription());
|
| 354 |
|
284 |
|
| 355 |
contentRow.createCell(7).setCellValue(getValueForEmptyString(lineItem.getBrand()));
|
285 |
contentRow.createCell(7).setCellValue(getValueForEmptyString(lineItem.getBrand()));
|
| 356 |
contentRow.createCell(8).setCellValue(getValueForEmptyString(lineItem.getModel_name()));
|
286 |
contentRow.createCell(8).setCellValue(getValueForEmptyString(lineItem.getModel_name()));
|
| 357 |
contentRow.createCell(9).setCellValue(getValueForEmptyString(lineItem.getModel_number()));
|
287 |
contentRow.createCell(9).setCellValue(getValueForEmptyString(lineItem.getModel_number()));
|
| Line 372... |
Line 302... |
| 372 |
|
302 |
|
| 373 |
contentRow.createCell(23).setCellValue(order.getAirwaybill_no());
|
303 |
contentRow.createCell(23).setCellValue(order.getAirwaybill_no());
|
| 374 |
contentRow.createCell(24).setCellValue(order.getBilled_by());
|
304 |
contentRow.createCell(24).setCellValue(order.getBilled_by());
|
| 375 |
contentRow.createCell(25).setCellValue(order.getReceiver());
|
305 |
contentRow.createCell(25).setCellValue(order.getReceiver());
|
| 376 |
contentRow.createCell(26).setCellValue(order.getTracking_id());
|
306 |
contentRow.createCell(26).setCellValue(order.getTracking_id());
|
| 377 |
contentRow.createCell(27).setCellValue(DATE_TIME_FORMAT.format(new Date(order.getAccepted_timestamp())));
|
307 |
contentRow.createCell(27).setCellValue(order.getAccepted_timestamp());
|
| - |
|
308 |
contentRow.getCell(27).setCellStyle(dateCellStyle);
|
| 378 |
contentRow.createCell(28).setCellValue(DATE_TIME_FORMAT.format(new Date(order.getDelivery_timestamp())));
|
309 |
contentRow.createCell(28).setCellValue(order.getDelivery_timestamp());
|
| - |
|
310 |
contentRow.getCell(28).setCellStyle(dateCellStyle);
|
| 379 |
contentRow.createCell(29).setCellValue(DATE_TIME_FORMAT.format(new Date(order.getExpected_delivery_time())));
|
311 |
contentRow.createCell(29).setCellValue(order.getExpected_delivery_time());
|
| - |
|
312 |
contentRow.getCell(29).setCellStyle(dateCellStyle);
|
| 380 |
|
313 |
|
| 381 |
if (payment != null) {
|
314 |
if (payment != null) {
|
| 382 |
contentRow.createCell(30).setCellValue(payment.getPaymentId());
|
315 |
contentRow.createCell(30).setCellValue(payment.getPaymentId());
|
| 383 |
contentRow.createCell(31).setCellValue(payment.getStatus().name());
|
316 |
contentRow.createCell(31).setCellValue(payment.getStatus().name());
|
| 384 |
contentRow.createCell(32).setCellValue(payment.getGatewayPaymentId());
|
317 |
contentRow.createCell(32).setCellValue(payment.getGatewayPaymentId());
|
| Line 401... |
Line 334... |
| 401 |
return "-";
|
334 |
return "-";
|
| 402 |
else
|
335 |
else
|
| 403 |
return s;
|
336 |
return s;
|
| 404 |
}
|
337 |
}
|
| 405 |
|
338 |
|
| 406 |
private void createUserSheet(User user, List<UserCommunication> userCommunications, Workbook wb, CellStyle style) {
|
339 |
private void createUserSheet(User user, List<UserCommunication> userCommunications, Workbook wb, CellStyle style, CellStyle dateCellStyle) {
|
| 407 |
Sheet userSheet = wb.createSheet("User");
|
340 |
Sheet userSheet = wb.createSheet("User");
|
| 408 |
short userSerialNo = 0;
|
341 |
short userSerialNo = 0;
|
| 409 |
// Create the header row and put all the titles in it. Rows are 0 based.
|
342 |
// Create the header row and put all the titles in it. Rows are 0 based.
|
| 410 |
|
343 |
|
| 411 |
Row titleRow = userSheet.createRow(userSerialNo++);
|
344 |
Row titleRow = userSheet.createRow(userSerialNo++);
|
| Line 421... |
Line 354... |
| 421 |
userHeaderRow.createCell(2).setCellValue("Communication Email");
|
354 |
userHeaderRow.createCell(2).setCellValue("Communication Email");
|
| 422 |
userHeaderRow.createCell(3).setCellValue("Date Of Birth");
|
355 |
userHeaderRow.createCell(3).setCellValue("Date Of Birth");
|
| 423 |
userHeaderRow.createCell(4).setCellValue("Mobile Number");
|
356 |
userHeaderRow.createCell(4).setCellValue("Mobile Number");
|
| 424 |
userHeaderRow.createCell(5).setCellValue("Sex");
|
357 |
userHeaderRow.createCell(5).setCellValue("Sex");
|
| 425 |
userHeaderRow.createCell(6).setCellValue("User Id");
|
358 |
userHeaderRow.createCell(6).setCellValue("User Id");
|
| - |
|
359 |
for (int i=0; i<7 ;i++) {
|
| - |
|
360 |
userHeaderRow.getCell(i).setCellStyle(style);
|
| - |
|
361 |
}
|
| 426 |
|
362 |
|
| 427 |
Row userContentRow = userSheet.createRow(userSerialNo++);
|
363 |
Row userContentRow = userSheet.createRow(userSerialNo++);
|
| 428 |
|
364 |
|
| 429 |
userContentRow.createCell(0).setCellValue(user.getName());
|
365 |
userContentRow.createCell(0).setCellValue(user.getName());
|
| 430 |
userContentRow.createCell(1).setCellValue(user.getEmail());
|
366 |
userContentRow.createCell(1).setCellValue(user.getEmail());
|
| Line 441... |
Line 377... |
| 441 |
addressHeaderRow.createCell(2).setCellValue("Line2");
|
377 |
addressHeaderRow.createCell(2).setCellValue("Line2");
|
| 442 |
addressHeaderRow.createCell(3).setCellValue("City");
|
378 |
addressHeaderRow.createCell(3).setCellValue("City");
|
| 443 |
addressHeaderRow.createCell(4).setCellValue("State");
|
379 |
addressHeaderRow.createCell(4).setCellValue("State");
|
| 444 |
addressHeaderRow.createCell(5).setCellValue("Pincode");
|
380 |
addressHeaderRow.createCell(5).setCellValue("Pincode");
|
| 445 |
addressHeaderRow.createCell(6).setCellValue("Phone");
|
381 |
addressHeaderRow.createCell(6).setCellValue("Phone");
|
| - |
|
382 |
for (int i=0; i<7 ;i++) {
|
| - |
|
383 |
addressHeaderRow.getCell(i).setCellStyle(style);
|
| - |
|
384 |
}
|
| 446 |
|
385 |
|
| 447 |
List<Address> user_addresses = user.getAddresses();
|
386 |
List<Address> user_addresses = user.getAddresses();
|
| 448 |
if (user_addresses != null && !user_addresses.isEmpty()) {
|
387 |
if (user_addresses != null && !user_addresses.isEmpty()) {
|
| 449 |
for (Address address : user.getAddresses()) {
|
388 |
for (Address address : user.getAddresses()) {
|
| 450 |
if (user.getDefaultAddressId() == address.getId()) {
|
389 |
if (user.getDefaultAddressId() == address.getId()) {
|
| 451 |
userContentRow = userSheet.createRow(userSerialNo);
|
390 |
userContentRow = userSheet.createRow(userSerialNo);
|
| 452 |
userSheet.addMergedRegion(new CellRangeAddress(
|
391 |
userSheet.addMergedRegion(new CellRangeAddress(
|
| 453 |
userSerialNo, userSerialNo, 0, 6));
|
392 |
userSerialNo, userSerialNo, 0, 6));
|
| 454 |
userContentRow.createCell(0)
|
393 |
userContentRow.createCell(0)
|
| 455 |
.setCellValue("Primary Address");
|
394 |
.setCellValue("Primary Address");
|
| - |
|
395 |
userContentRow.getCell(0).setCellStyle(style);
|
| 456 |
|
396 |
|
| 457 |
userSerialNo++;
|
397 |
userSerialNo++;
|
| 458 |
userContentRow = userSheet.createRow(userSerialNo);
|
398 |
userContentRow = userSheet.createRow(userSerialNo);
|
| 459 |
userContentRow.createCell(0)
|
399 |
userContentRow.createCell(0)
|
| 460 |
.setCellValue(address.getName());
|
400 |
.setCellValue(address.getName());
|
| Line 475... |
Line 415... |
| 475 |
|
415 |
|
| 476 |
userContentRow = userSheet.createRow(userSerialNo);
|
416 |
userContentRow = userSheet.createRow(userSerialNo);
|
| 477 |
userSheet.addMergedRegion(new CellRangeAddress(userSerialNo,
|
417 |
userSheet.addMergedRegion(new CellRangeAddress(userSerialNo,
|
| 478 |
userSerialNo, 0, 6));
|
418 |
userSerialNo, 0, 6));
|
| 479 |
userContentRow.createCell(0).setCellValue("Other Addresses");
|
419 |
userContentRow.createCell(0).setCellValue("Other Addresses");
|
| - |
|
420 |
userContentRow.getCell(0).setCellStyle(style);
|
| 480 |
|
421 |
|
| 481 |
for (Address address : user.getAddresses()) {
|
422 |
for (Address address : user.getAddresses()) {
|
| 482 |
if (user.getDefaultAddressId() != address.getId()) {
|
423 |
if (user.getDefaultAddressId() != address.getId()) {
|
| 483 |
userSerialNo++;
|
424 |
userSerialNo++;
|
| 484 |
userContentRow = userSheet.createRow(userSerialNo);
|
425 |
userContentRow = userSheet.createRow(userSerialNo);
|
| Line 502... |
Line 443... |
| 502 |
userSerialNo+=2;
|
443 |
userSerialNo+=2;
|
| 503 |
userContentRow = userSheet.createRow(userSerialNo);
|
444 |
userContentRow = userSheet.createRow(userSerialNo);
|
| 504 |
userSheet.addMergedRegion(new CellRangeAddress(userSerialNo,
|
445 |
userSheet.addMergedRegion(new CellRangeAddress(userSerialNo,
|
| 505 |
userSerialNo, 0, 6));
|
446 |
userSerialNo, 0, 6));
|
| 506 |
userContentRow.createCell(0).setCellValue("User Communication");
|
447 |
userContentRow.createCell(0).setCellValue("User Communication");
|
| - |
|
448 |
userContentRow.getCell(0).setCellStyle(style);
|
| 507 |
userSerialNo++;
|
449 |
userSerialNo++;
|
| 508 |
Row commHeaderRow = userSheet.createRow(userSerialNo);
|
450 |
Row commHeaderRow = userSheet.createRow(userSerialNo);
|
| 509 |
commHeaderRow.createCell(0).setCellValue("Order Id");
|
451 |
commHeaderRow.createCell(0).setCellValue("Order Id");
|
| 510 |
commHeaderRow.createCell(1).setCellValue("Communication Type");
|
452 |
commHeaderRow.createCell(1).setCellValue("Communication Type");
|
| 511 |
commHeaderRow.createCell(2).setCellValue("AirwayBill No");
|
453 |
commHeaderRow.createCell(2).setCellValue("AirwayBill No");
|
| 512 |
commHeaderRow.createCell(3).setCellValue("TimeStamp");
|
454 |
commHeaderRow.createCell(3).setCellValue("TimeStamp");
|
| 513 |
commHeaderRow.createCell(4).setCellValue("Product Name");
|
455 |
commHeaderRow.createCell(4).setCellValue("Product Name");
|
| 514 |
commHeaderRow.createCell(5).setCellValue("Reply To");
|
456 |
commHeaderRow.createCell(5).setCellValue("Reply To");
|
| 515 |
commHeaderRow.createCell(6).setCellValue("Subject");
|
457 |
commHeaderRow.createCell(6).setCellValue("Subject");
|
| 516 |
commHeaderRow.createCell(7).setCellValue("Message");
|
458 |
commHeaderRow.createCell(7).setCellValue("Message");
|
| - |
|
459 |
for (int i=0; i<8 ;i++) {
|
| - |
|
460 |
commHeaderRow.getCell(i).setCellStyle(style);
|
| - |
|
461 |
}
|
| 517 |
|
462 |
|
| 518 |
for( UserCommunication userComm : userCommunications) {
|
463 |
for( UserCommunication userComm : userCommunications) {
|
| 519 |
userSerialNo++;
|
464 |
userSerialNo++;
|
| 520 |
userContentRow = userSheet.createRow(userSerialNo);
|
465 |
userContentRow = userSheet.createRow(userSerialNo);
|
| 521 |
userContentRow.createCell(0).setCellValue(userComm.getOrderId());
|
466 |
userContentRow.createCell(0).setCellValue(userComm.getOrderId());
|
| 522 |
if (userComm.getCommunicationType() != null) {
|
467 |
if (userComm.getCommunicationType() != null) {
|
| 523 |
userContentRow.createCell(1).setCellValue(userComm.getCommunicationType().name());
|
468 |
userContentRow.createCell(1).setCellValue(userComm.getCommunicationType().name());
|
| 524 |
}
|
469 |
}
|
| 525 |
userContentRow.createCell(2).setCellValue(userComm.getAirwaybillNo());
|
470 |
userContentRow.createCell(2).setCellValue(userComm.getAirwaybillNo());
|
| 526 |
userContentRow.createCell(3).setCellValue(DATE_TIME_FORMAT.format(userComm.getCommunication_timestamp()));
|
471 |
userContentRow.createCell(3).setCellValue(userComm.getCommunication_timestamp());
|
| - |
|
472 |
userContentRow.createCell(3).setCellStyle(dateCellStyle);
|
| 527 |
userContentRow.createCell(4).setCellValue(userComm.getProductName());
|
473 |
userContentRow.createCell(4).setCellValue(userComm.getProductName());
|
| 528 |
userContentRow.createCell(5).setCellValue(userComm.getReplyTo());
|
474 |
userContentRow.createCell(5).setCellValue(userComm.getReplyTo());
|
| 529 |
userContentRow.createCell(6).setCellValue(userComm.getSubject());
|
475 |
userContentRow.createCell(6).setCellValue(userComm.getSubject());
|
| 530 |
userContentRow.createCell(7).setCellValue(userComm.getMessage());
|
476 |
userContentRow.createCell(7).setCellValue(userComm.getMessage());
|
| 531 |
}
|
477 |
}
|