| Line 55... |
Line 55... |
| 55 |
* @description HotspotReconciliationController handles requests to generate a reconciliation
|
55 |
* @description HotspotReconciliationController handles requests to generate a reconciliation
|
| 56 |
* report in XLS format for all the transactions with HotSpot within a given date range.
|
56 |
* report in XLS format for all the transactions with HotSpot within a given date range.
|
| 57 |
*
|
57 |
*
|
| 58 |
*/
|
58 |
*/
|
| 59 |
|
59 |
|
| 60 |
@InterceptorRefs({
|
60 |
//@InterceptorRefs({
|
| 61 |
@InterceptorRef("defaultStack"),
|
61 |
// @InterceptorRef("defaultStack"),
|
| 62 |
@InterceptorRef("login")
|
62 |
// @InterceptorRef("login")
|
| 63 |
})
|
63 |
//})
|
| - |
|
64 |
//@Results({
|
| - |
|
65 |
// @Result(name="authfail", type="redirectAction", params = {"actionName" , "reports"})
|
| - |
|
66 |
//})
|
| 64 |
@Results({
|
67 |
@Results({
|
| 65 |
@Result(name="authfail", type="redirectAction", params = {"actionName" , "reports"})
|
68 |
@Result(name="report1", location="my-report.vm")
|
| 66 |
})
|
69 |
})
|
| 67 |
public class HotspotReconciliationController implements ServletResponseAware, ServletRequestAware, ServletContextAware {
|
70 |
public class HotspotReconciliationController implements ServletResponseAware, ServletRequestAware, ServletContextAware {
|
| 68 |
|
71 |
|
| 69 |
private static Logger logger = LoggerFactory.getLogger(HotspotReconciliationController.class);
|
72 |
private static Logger logger = LoggerFactory.getLogger(HotspotReconciliationController.class);
|
| 70 |
|
73 |
|
| Line 76... |
Line 79... |
| 76 |
BRAND(4),
|
79 |
BRAND(4),
|
| 77 |
MODEL_NAME(5),
|
80 |
MODEL_NAME(5),
|
| 78 |
MODEL_NUMBER(6),
|
81 |
MODEL_NUMBER(6),
|
| 79 |
COLOR(7),
|
82 |
COLOR(7),
|
| 80 |
XFER_PRICE(8),
|
83 |
XFER_PRICE(8),
|
| 81 |
SELLING_PRICE(9);
|
84 |
SELLING_PRICE(9),
|
| - |
|
85 |
DELIVERY_DATE(10),
|
| - |
|
86 |
STATUS(11);
|
| 82 |
|
87 |
|
| 83 |
private int value;
|
88 |
private int value;
|
| 84 |
|
89 |
|
| 85 |
OrderReportColumn(int value) {
|
90 |
OrderReportColumn(int value) {
|
| 86 |
this.value = value;
|
91 |
this.value = value;
|
| Line 186... |
Line 191... |
| 186 |
} catch (TException e) {
|
191 |
} catch (TException e) {
|
| 187 |
logger.error("Unable to get the orders or the warehouses", e);
|
192 |
logger.error("Unable to get the orders or the warehouses", e);
|
| 188 |
} catch (Exception e) {
|
193 |
} catch (Exception e) {
|
| 189 |
logger.error("Unexpected exception", e);
|
194 |
logger.error("Unexpected exception", e);
|
| 190 |
}
|
195 |
}
|
| 191 |
return new DefaultHttpHeaders("report");
|
196 |
return new DefaultHttpHeaders("report1");
|
| 192 |
}
|
197 |
}
|
| 193 |
|
198 |
|
| 194 |
// Prepares the XLS worksheet object and fills in the data with proper formatting
|
199 |
// Prepares the XLS worksheet object and fills in the data with proper formatting
|
| 195 |
private ByteArrayOutputStream getReconciliationReport(List<Order> orders, List<ReturnOrder> returnOrders, Date startDate, Date endDate) {
|
200 |
private ByteArrayOutputStream getReconciliationReport(List<Order> orders, List<ReturnOrder> returnOrders, Date startDate, Date endDate) {
|
| 196 |
ByteArrayOutputStream baosXLS = new ByteArrayOutputStream();
|
201 |
ByteArrayOutputStream baosXLS = new ByteArrayOutputStream();
|
| Line 244... |
Line 249... |
| 244 |
headerRow.createCell(OrderReportColumn.MODEL_NAME.getValue()).setCellValue("Model Name");
|
249 |
headerRow.createCell(OrderReportColumn.MODEL_NAME.getValue()).setCellValue("Model Name");
|
| 245 |
headerRow.createCell(OrderReportColumn.MODEL_NUMBER.getValue()).setCellValue("Model Number");
|
250 |
headerRow.createCell(OrderReportColumn.MODEL_NUMBER.getValue()).setCellValue("Model Number");
|
| 246 |
headerRow.createCell(OrderReportColumn.COLOR.getValue()).setCellValue("Color");
|
251 |
headerRow.createCell(OrderReportColumn.COLOR.getValue()).setCellValue("Color");
|
| 247 |
headerRow.createCell(OrderReportColumn.XFER_PRICE.getValue()).setCellValue("Transfer Price");
|
252 |
headerRow.createCell(OrderReportColumn.XFER_PRICE.getValue()).setCellValue("Transfer Price");
|
| 248 |
headerRow.createCell(OrderReportColumn.SELLING_PRICE.getValue()).setCellValue("Selling Price");
|
253 |
headerRow.createCell(OrderReportColumn.SELLING_PRICE.getValue()).setCellValue("Selling Price");
|
| - |
|
254 |
headerRow.createCell(OrderReportColumn.DELIVERY_DATE.getValue()).setCellValue("Delivery Date");
|
| - |
|
255 |
headerRow.createCell(OrderReportColumn.STATUS.getValue()).setCellValue("Current Status");
|
| 249 |
|
256 |
|
| 250 |
sheet.createRow(serialNo ++);
|
257 |
sheet.createRow(serialNo ++);
|
| 251 |
double totalTransferPrice = 0.0;
|
258 |
double totalTransferPrice = 0.0;
|
| 252 |
double totalSellingPrice = 0.0;
|
259 |
double totalSellingPrice = 0.0;
|
| 253 |
|
260 |
|
| Line 269... |
Line 276... |
| 269 |
contentRow.createCell(OrderReportColumn.MODEL_NAME.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_name()));
|
276 |
contentRow.createCell(OrderReportColumn.MODEL_NAME.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_name()));
|
| 270 |
contentRow.createCell(OrderReportColumn.MODEL_NUMBER.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_number()));
|
277 |
contentRow.createCell(OrderReportColumn.MODEL_NUMBER.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_number()));
|
| 271 |
contentRow.createCell(OrderReportColumn.COLOR.getValue()).setCellValue(getValueForEmptyString(lineItem.getColor()));
|
278 |
contentRow.createCell(OrderReportColumn.COLOR.getValue()).setCellValue(getValueForEmptyString(lineItem.getColor()));
|
| 272 |
contentRow.createCell(OrderReportColumn.XFER_PRICE.getValue()).setCellValue(transferPrice);
|
279 |
contentRow.createCell(OrderReportColumn.XFER_PRICE.getValue()).setCellValue(transferPrice);
|
| 273 |
contentRow.createCell(OrderReportColumn.SELLING_PRICE.getValue()).setCellValue(sellingPrice);
|
280 |
contentRow.createCell(OrderReportColumn.SELLING_PRICE.getValue()).setCellValue(sellingPrice);
|
| - |
|
281 |
|
| - |
|
282 |
if(order.getDelivery_timestamp() > 0) {
|
| - |
|
283 |
contentRow.createCell(OrderReportColumn.DELIVERY_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getDelivery_timestamp())));
|
| - |
|
284 |
} else {
|
| - |
|
285 |
contentRow.createCell(OrderReportColumn.DELIVERY_DATE.getValue()).setCellValue("-");
|
| - |
|
286 |
}
|
| - |
|
287 |
contentRow.createCell(OrderReportColumn.STATUS.getValue()).setCellValue(order.getStatus().name());
|
| 274 |
}
|
288 |
}
|
| 275 |
sheet.createRow(serialNo ++);
|
289 |
sheet.createRow(serialNo ++);
|
| 276 |
Row contentRow = sheet.createRow(serialNo);
|
290 |
Row contentRow = sheet.createRow(serialNo);
|
| 277 |
contentRow.createCell(0).setCellValue("Total Transfer Price");
|
291 |
contentRow.createCell(0).setCellValue("Total Transfer Price");
|
| 278 |
contentRow.createCell(OrderReportColumn.XFER_PRICE.getValue()).setCellValue(totalTransferPrice);
|
292 |
contentRow.createCell(OrderReportColumn.XFER_PRICE.getValue()).setCellValue(totalTransferPrice);
|