| 4600 |
varun.gupt |
1 |
package in.shop2020.support.controllers;
|
|
|
2 |
|
| 4734 |
varun.gupt |
3 |
import in.shop2020.logistics.Provider;
|
| 4600 |
varun.gupt |
4 |
import in.shop2020.model.v1.catalog.Vendor;
|
|
|
5 |
import in.shop2020.model.v1.order.LineItem;
|
|
|
6 |
import in.shop2020.model.v1.order.Order;
|
| 4734 |
varun.gupt |
7 |
import in.shop2020.model.v1.order.OrderStatus;
|
| 5020 |
varun.gupt |
8 |
import in.shop2020.model.v1.order.OrderStatusGroups;
|
| 4600 |
varun.gupt |
9 |
import in.shop2020.model.v1.order.PaymentSettlement;
|
| 5386 |
phani.kuma |
10 |
import in.shop2020.model.v1.order.ReturnOrder;
|
| 4600 |
varun.gupt |
11 |
import in.shop2020.model.v1.order.Transaction;
|
|
|
12 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
|
|
13 |
import in.shop2020.payments.Payment;
|
|
|
14 |
import in.shop2020.payments.PaymentGateway;
|
|
|
15 |
import in.shop2020.thrift.clients.CatalogClient;
|
| 4734 |
varun.gupt |
16 |
import in.shop2020.thrift.clients.LogisticsClient;
|
| 4600 |
varun.gupt |
17 |
import in.shop2020.thrift.clients.PaymentClient;
|
|
|
18 |
import in.shop2020.thrift.clients.TransactionClient;
|
|
|
19 |
|
| 5020 |
varun.gupt |
20 |
import java.io.ByteArrayOutputStream;
|
|
|
21 |
import java.io.File;
|
|
|
22 |
import java.io.FileInputStream;
|
|
|
23 |
import java.io.FileNotFoundException;
|
|
|
24 |
import java.io.IOException;
|
|
|
25 |
import java.text.DateFormat;
|
|
|
26 |
import java.text.ParseException;
|
|
|
27 |
import java.text.SimpleDateFormat;
|
|
|
28 |
import java.util.ArrayList;
|
|
|
29 |
import java.util.Date;
|
|
|
30 |
import java.util.HashMap;
|
| 5386 |
phani.kuma |
31 |
import java.util.HashSet;
|
| 5020 |
varun.gupt |
32 |
import java.util.List;
|
|
|
33 |
import java.util.Map;
|
| 5386 |
phani.kuma |
34 |
import java.util.Set;
|
|
|
35 |
import java.util.Map.Entry;
|
| 5020 |
varun.gupt |
36 |
|
| 4600 |
varun.gupt |
37 |
import javax.servlet.ServletContext;
|
|
|
38 |
import javax.servlet.ServletOutputStream;
|
|
|
39 |
import javax.servlet.http.HttpServletRequest;
|
|
|
40 |
import javax.servlet.http.HttpServletResponse;
|
| 5189 |
varun.gupt |
41 |
import org.apache.commons.io.IOUtils;
|
| 4600 |
varun.gupt |
42 |
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
43 |
import org.apache.poi.ss.usermodel.Row;
|
|
|
44 |
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
45 |
import org.apache.poi.ss.usermodel.Workbook;
|
| 5020 |
varun.gupt |
46 |
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
| 4600 |
varun.gupt |
47 |
import org.apache.struts2.interceptor.ServletRequestAware;
|
|
|
48 |
import org.apache.struts2.interceptor.ServletResponseAware;
|
|
|
49 |
import org.apache.struts2.rest.DefaultHttpHeaders;
|
|
|
50 |
import org.apache.struts2.rest.HttpHeaders;
|
|
|
51 |
import org.apache.struts2.util.ServletContextAware;
|
|
|
52 |
import org.apache.thrift.transport.TTransportException;
|
|
|
53 |
import org.slf4j.Logger;
|
|
|
54 |
import org.slf4j.LoggerFactory;
|
|
|
55 |
|
| 4715 |
varun.gupt |
56 |
import com.opensymphony.xwork2.ValidationAwareSupport;
|
|
|
57 |
|
| 4600 |
varun.gupt |
58 |
/**
|
|
|
59 |
* @author Varun Gupta
|
|
|
60 |
* @description: This class handles web requests to generate vendor specific reconciliation reports
|
|
|
61 |
* for given vendor for a given date range
|
|
|
62 |
*/
|
| 5386 |
phani.kuma |
63 |
|
| 4715 |
varun.gupt |
64 |
public class VendorReconciliationController extends ValidationAwareSupport implements ServletRequestAware, ServletResponseAware, ServletContextAware {
|
| 4600 |
varun.gupt |
65 |
|
| 5386 |
phani.kuma |
66 |
private static final long serialVersionUID = 1L;
|
|
|
67 |
private static Logger logger = LoggerFactory.getLogger(VendorReconciliationController.class);
|
| 4600 |
varun.gupt |
68 |
|
|
|
69 |
private enum OrderReportColumn {
|
|
|
70 |
ORDER_ID(0),
|
| 5386 |
phani.kuma |
71 |
ORIGINAL_ORDER_ID(1),
|
|
|
72 |
VENDOR_ID(2),
|
|
|
73 |
ORDER_DATE(3),
|
|
|
74 |
BILLING_NUMBER(4),
|
|
|
75 |
BILLING_DATE(5),
|
|
|
76 |
DELIVERY_DATE(6),
|
| 4600 |
varun.gupt |
77 |
BRAND(7),
|
|
|
78 |
MODEL_NAME(8),
|
|
|
79 |
MODEL_NUMBER(9),
|
|
|
80 |
COLOR(10),
|
|
|
81 |
QUANTITY(11),
|
|
|
82 |
UNIT_TRANSFER_PRICE(12),
|
|
|
83 |
UNIT_SELLING_PRICE(13),
|
|
|
84 |
TOTAL_TRANSFER_PRICE(14),
|
|
|
85 |
TOTAL_SELLING_PRICE(15),
|
| 5386 |
phani.kuma |
86 |
CURRENT_STATUS(16),
|
|
|
87 |
PAYMENT_STATUS(17),
|
|
|
88 |
PAYMENT_TYPE(18),
|
|
|
89 |
PAYMENT_ID(19),
|
|
|
90 |
COUPON_CODE(20),
|
|
|
91 |
SETTLEMENT_DATE(21),
|
|
|
92 |
SERVICE_TAX(22),
|
|
|
93 |
OTHER_CHARGES(23),
|
|
|
94 |
NET_COLLECTION(24),
|
|
|
95 |
USER_PAYABLE_AMOUNT(25);
|
| 4600 |
varun.gupt |
96 |
|
|
|
97 |
private int value;
|
|
|
98 |
|
|
|
99 |
OrderReportColumn(int value) {
|
|
|
100 |
this.value = value;
|
|
|
101 |
}
|
|
|
102 |
public int getValue(){
|
|
|
103 |
return this.value;
|
|
|
104 |
}
|
|
|
105 |
}
|
|
|
106 |
|
|
|
107 |
private HttpServletRequest request;
|
|
|
108 |
private HttpServletResponse response;
|
|
|
109 |
private ServletContext context;
|
|
|
110 |
private List<Vendor> vendors;
|
| 5020 |
varun.gupt |
111 |
private Map<Long, String> codProviders = new HashMap<Long, String>();
|
|
|
112 |
private Map<Long, String> paymentGateways = new HashMap<Long, String>();
|
|
|
113 |
|
| 5386 |
phani.kuma |
114 |
private File orderIdsToBeMarked;
|
| 4600 |
varun.gupt |
115 |
private File hdfcSettlementReport;
|
|
|
116 |
|
|
|
117 |
private File ebsSettlementReport;
|
|
|
118 |
private File ebsSettlementSummary;
|
|
|
119 |
|
|
|
120 |
private String bluedartSettlementDate;
|
|
|
121 |
private File bluedartSettlementReport;
|
|
|
122 |
|
| 4715 |
varun.gupt |
123 |
private String aramexSettlementDate;
|
|
|
124 |
private File aramexSettlementReport;
|
|
|
125 |
|
| 4600 |
varun.gupt |
126 |
private Map<Long, String> ebsSettlementSummaries;
|
|
|
127 |
|
| 5020 |
varun.gupt |
128 |
private List<OrderStatus> refundOrderStatuses;
|
| 5189 |
varun.gupt |
129 |
|
| 5386 |
phani.kuma |
130 |
private List<Order> reshippedNonPayableOrders = new ArrayList<Order>();
|
|
|
131 |
private List<Order> returnedOrders = new ArrayList<Order>();
|
| 5189 |
varun.gupt |
132 |
private List<Order> unsettledOrders = new ArrayList<Order>();
|
| 5386 |
phani.kuma |
133 |
private List<Order> userPaymentNotRequiredOrders = new ArrayList<Order>();
|
|
|
134 |
private Map<Order, PaymentSettlement> paymentSettledOrdersMap = new HashMap<Order, PaymentSettlement>();
|
|
|
135 |
private List<Order> ordersWithErrors = new ArrayList<Order>();
|
| 4745 |
varun.gupt |
136 |
|
| 4600 |
varun.gupt |
137 |
private final DateFormat DATE_FORMAT = new SimpleDateFormat("dd/MM/yyyy");
|
|
|
138 |
|
|
|
139 |
public String index() {
|
| 5098 |
varun.gupt |
140 |
initiatializeDashboard();
|
| 4600 |
varun.gupt |
141 |
return "report";
|
|
|
142 |
}
|
|
|
143 |
|
|
|
144 |
public HttpHeaders create() {
|
|
|
145 |
|
|
|
146 |
String formType = request.getParameter("formtype");
|
| 4715 |
varun.gupt |
147 |
logger.info("Form Type: " + formType);
|
| 4600 |
varun.gupt |
148 |
|
|
|
149 |
if (formType.equals("uploadEBSSettlementSummary")) {
|
|
|
150 |
uploadEBSSettlementSummary();
|
|
|
151 |
|
|
|
152 |
} else if (formType.equals("uploadEBSSettlements")) {
|
|
|
153 |
uploadEBSSettlements();
|
|
|
154 |
|
|
|
155 |
} else if (formType.equals("uploadHDFCSettlements")) {
|
|
|
156 |
uploadHDFCSettlements();
|
|
|
157 |
|
|
|
158 |
} else if (formType.equals("uploadBluedartSettlements")) {
|
|
|
159 |
uploadBluedartSettlements();
|
| 4715 |
varun.gupt |
160 |
|
|
|
161 |
} else if (formType.equals("uploadAramexSettlements")) {
|
|
|
162 |
uploadAramexSettlements();
|
| 5098 |
varun.gupt |
163 |
|
|
|
164 |
} else if (formType.equals("markOrdersAsPaid")) {
|
| 5189 |
varun.gupt |
165 |
uploadOrderIdsToBeMarkedPaid();
|
| 5386 |
phani.kuma |
166 |
|
|
|
167 |
} else if (formType.equals("markOrdersAsReturned")) {
|
|
|
168 |
uploadOrderIdsToBeMarkedReturned();
|
|
|
169 |
|
| 4600 |
varun.gupt |
170 |
}
|
| 5386 |
phani.kuma |
171 |
|
| 5098 |
varun.gupt |
172 |
initiatializeDashboard();
|
| 4600 |
varun.gupt |
173 |
return new DefaultHttpHeaders("report");
|
|
|
174 |
}
|
|
|
175 |
|
|
|
176 |
public HttpHeaders generateReconciliationReport() {
|
| 5189 |
varun.gupt |
177 |
initiatializeDashboard();
|
| 5386 |
phani.kuma |
178 |
|
|
|
179 |
try {
|
|
|
180 |
LogisticsClient lsc = new LogisticsClient();
|
|
|
181 |
in.shop2020.logistics.LogisticsService.Client logisticsClient = lsc.getClient();
|
|
|
182 |
|
|
|
183 |
PaymentClient psc = new PaymentClient();
|
|
|
184 |
in.shop2020.payments.PaymentService.Client paymentClient = psc.getClient();
|
|
|
185 |
|
|
|
186 |
List<PaymentGateway> tPaymentGateways = paymentClient.getActivePaymentGateways();
|
|
|
187 |
|
|
|
188 |
for (PaymentGateway tPaymentGateway: tPaymentGateways) {
|
|
|
189 |
paymentGateways.put(tPaymentGateway.getId(), tPaymentGateway.getName());
|
|
|
190 |
}
|
|
|
191 |
|
|
|
192 |
for (Provider provider: logisticsClient.getAllProviders()) {
|
|
|
193 |
codProviders.put(provider.getId(), provider.getName());
|
|
|
194 |
}
|
|
|
195 |
|
|
|
196 |
try {
|
|
|
197 |
long vendorId = Long.parseLong(request.getParameter("vendor"));
|
|
|
198 |
String vendorName = "";
|
|
|
199 |
logger.info("Vendor ID: " + vendorId);
|
|
|
200 |
|
|
|
201 |
if(vendorId == -1) {
|
|
|
202 |
vendorName = "ALL-Vendors";
|
|
|
203 |
}
|
|
|
204 |
else {
|
|
|
205 |
vendorName = getVendorName(vendorId);
|
|
|
206 |
if(vendorName != null) {
|
|
|
207 |
vendorName = vendorName.replaceAll("\\s", "-");
|
|
|
208 |
}
|
|
|
209 |
}
|
|
|
210 |
|
|
|
211 |
response.setContentType("application/vnd.ms-excel");
|
|
|
212 |
response.setHeader("Content-disposition", "inline; filename=" + vendorName + "-reconciliation.xls");
|
|
|
213 |
|
|
|
214 |
ServletOutputStream sos;
|
|
|
215 |
try {
|
|
|
216 |
ByteArrayOutputStream baos = getReconciliationReport(vendorId);
|
|
|
217 |
sos = response.getOutputStream();
|
|
|
218 |
baos.writeTo(sos);
|
|
|
219 |
sos.flush();
|
|
|
220 |
} catch (IOException e) {
|
|
|
221 |
String errMsg = "Error while streaming the reconciliation report";
|
|
|
222 |
logger.error(errMsg, e);
|
|
|
223 |
addActionError(errMsg);
|
|
|
224 |
}
|
|
|
225 |
} catch (NullPointerException e) {
|
|
|
226 |
String errMsg = "NullPointerException";
|
|
|
227 |
logger.error(errMsg, e);
|
|
|
228 |
addActionError(errMsg);
|
|
|
229 |
}
|
| 4600 |
varun.gupt |
230 |
|
| 5386 |
phani.kuma |
231 |
} catch (Exception e) {
|
|
|
232 |
String errMsg = "Exception Occured in generateReconciliationReport";
|
|
|
233 |
logger.error(errMsg, e);
|
|
|
234 |
addActionError(errMsg);
|
| 4745 |
varun.gupt |
235 |
}
|
| 5386 |
phani.kuma |
236 |
|
| 4600 |
varun.gupt |
237 |
return new DefaultHttpHeaders("report");
|
|
|
238 |
}
|
|
|
239 |
|
|
|
240 |
public void uploadEBSSettlementSummary() {
|
|
|
241 |
|
|
|
242 |
DateFormat settlementDateFormat = new SimpleDateFormat("dd MMM,yyyy hh:mm:ss a");
|
|
|
243 |
DateFormat transactionDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
244 |
|
|
|
245 |
Workbook wb = null;
|
|
|
246 |
try {
|
|
|
247 |
wb = new HSSFWorkbook(new FileInputStream(ebsSettlementSummary));
|
|
|
248 |
} catch (FileNotFoundException e) {
|
| 5386 |
phani.kuma |
249 |
String errMsg = "Unable to open the EBS Settlement Summary report";
|
|
|
250 |
logger.error(errMsg, e);
|
|
|
251 |
addActionError(errMsg);
|
|
|
252 |
return;
|
| 4600 |
varun.gupt |
253 |
} catch (IOException e) {
|
| 5386 |
phani.kuma |
254 |
String errMsg = "Unable to open the EBS Settlement Summary report";
|
|
|
255 |
logger.error(errMsg, e);
|
|
|
256 |
addActionError(errMsg);
|
|
|
257 |
return;
|
| 4600 |
varun.gupt |
258 |
}
|
|
|
259 |
Sheet sheet = wb.getSheetAt(0);
|
|
|
260 |
|
|
|
261 |
int indexSettlementId = 0;
|
|
|
262 |
int indexSettlementDate = 1;
|
|
|
263 |
int indexTransactionDateFrom = 2;
|
|
|
264 |
int indexTransactionDateTo = 3;
|
|
|
265 |
int indexAmount = 4;
|
|
|
266 |
|
|
|
267 |
Row firstRow = sheet.getRow(0);
|
|
|
268 |
Row secondRow = sheet.getRow(1);
|
|
|
269 |
Row thirdRow = sheet.getRow(2);
|
|
|
270 |
Row fourthRow = sheet.getRow(3);
|
|
|
271 |
Row fifthRow = sheet.getRow(4);
|
| 5020 |
varun.gupt |
272 |
|
| 4600 |
varun.gupt |
273 |
TransactionClient tsc;
|
| 5386 |
phani.kuma |
274 |
long settlementId = 0;
|
| 4600 |
varun.gupt |
275 |
|
|
|
276 |
try {
|
|
|
277 |
tsc = new TransactionClient();
|
|
|
278 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
|
|
279 |
|
|
|
280 |
for(Row row: sheet) {
|
|
|
281 |
if(row.equals(firstRow) || row.equals(secondRow) || row.equals(thirdRow) || row.equals(fourthRow) || row.equals(fifthRow)) {
|
|
|
282 |
continue;
|
|
|
283 |
}
|
| 5386 |
phani.kuma |
284 |
settlementId = (long) row.getCell(indexSettlementId).getNumericCellValue();
|
| 4600 |
varun.gupt |
285 |
String settlementDateStr = row.getCell(indexSettlementDate).getStringCellValue();
|
|
|
286 |
String transactionDateFromStr = row.getCell(indexTransactionDateFrom).getStringCellValue();
|
|
|
287 |
String transactionDateToStr = row.getCell(indexTransactionDateTo).getStringCellValue();
|
|
|
288 |
Double amount = row.getCell(indexAmount).getNumericCellValue();
|
|
|
289 |
|
|
|
290 |
Date settlementDate = settlementDateFormat.parse(settlementDateStr);
|
|
|
291 |
Date transactionDateFrom = transactionDateFormat.parse(transactionDateFromStr);
|
|
|
292 |
Date transactionDateTo = transactionDateFormat.parse(transactionDateToStr);
|
|
|
293 |
|
|
|
294 |
try {
|
|
|
295 |
transactionClient.saveEBSSettlementSummary(settlementId, settlementDate.getTime(), transactionDateFrom.getTime(), transactionDateTo.getTime(), amount);
|
|
|
296 |
|
| 5386 |
phani.kuma |
297 |
} catch (TransactionServiceException e) {
|
|
|
298 |
String errMsg = "TransactionServiceException recieved for settlement Id, " + Long.toString(settlementId);
|
|
|
299 |
logger.error(errMsg, e);
|
|
|
300 |
addActionError(errMsg);
|
|
|
301 |
}
|
| 4600 |
varun.gupt |
302 |
}
|
|
|
303 |
} catch (Exception e) {
|
| 5386 |
phani.kuma |
304 |
String errMsg = "Exception recieved for payment Id," + Long.toString(settlementId);
|
|
|
305 |
logger.error(errMsg, e);
|
|
|
306 |
addActionError(errMsg);
|
| 4600 |
varun.gupt |
307 |
}
|
|
|
308 |
}
|
|
|
309 |
|
|
|
310 |
public void uploadHDFCSettlements() {
|
|
|
311 |
logger.info("Uploading HDFC settlements");
|
|
|
312 |
|
|
|
313 |
Workbook wb = null;
|
|
|
314 |
try {
|
|
|
315 |
wb = new HSSFWorkbook(new FileInputStream(this.hdfcSettlementReport));
|
|
|
316 |
} catch (FileNotFoundException e) {
|
| 4734 |
varun.gupt |
317 |
String errMsg = "Unable to open the HDFC Payout report";
|
|
|
318 |
logger.error(errMsg, e);
|
|
|
319 |
addActionError(errMsg);
|
|
|
320 |
return;
|
| 4600 |
varun.gupt |
321 |
} catch (IOException e) {
|
| 4734 |
varun.gupt |
322 |
String errMsg = "Unable to open the HDFC Payout report";
|
|
|
323 |
logger.error(errMsg, e);
|
|
|
324 |
addActionError(errMsg);
|
|
|
325 |
return;
|
| 4600 |
varun.gupt |
326 |
}
|
|
|
327 |
Sheet sheet = wb.getSheetAt(0);
|
|
|
328 |
|
|
|
329 |
Row firstRow = sheet.getRow(0);
|
|
|
330 |
|
|
|
331 |
int indexRECFMT = 2;
|
|
|
332 |
int indexSettlementDate = 7;
|
|
|
333 |
int indexPaymentId = 13;
|
|
|
334 |
int indexMSF = 14;
|
|
|
335 |
int indexServiceTax = 15;
|
|
|
336 |
int indexEduCess = 16;
|
|
|
337 |
int indexNetCollection = 17;
|
|
|
338 |
|
|
|
339 |
TransactionClient tsc;
|
|
|
340 |
String paymentIdStr = "";
|
|
|
341 |
long paymentId = 0;
|
| 5020 |
varun.gupt |
342 |
|
| 4734 |
varun.gupt |
343 |
int countSuccessfulInserts = 0;
|
|
|
344 |
int countRefunds = 0;
|
| 4600 |
varun.gupt |
345 |
|
|
|
346 |
try {
|
|
|
347 |
tsc = new TransactionClient();
|
|
|
348 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
|
|
349 |
|
|
|
350 |
for (Row row: sheet) {
|
|
|
351 |
if(row.equals(firstRow)) continue;
|
|
|
352 |
|
| 5020 |
varun.gupt |
353 |
if(row.getCell(0).getStringCellValue().equals("Total")) break;
|
|
|
354 |
|
| 4600 |
varun.gupt |
355 |
try {
|
|
|
356 |
String recfmt = row.getCell(indexRECFMT).getStringCellValue();
|
|
|
357 |
Date settlementDate = row.getCell(indexSettlementDate).getDateCellValue();
|
|
|
358 |
double netCollection = row.getCell(indexNetCollection).getNumericCellValue();
|
| 5020 |
varun.gupt |
359 |
paymentIdStr = row.getCell(indexPaymentId).getStringCellValue().replace("'", "").trim();
|
| 4600 |
varun.gupt |
360 |
paymentId = Long.parseLong(paymentIdStr);
|
|
|
361 |
|
|
|
362 |
logger.info("paymentId: " + paymentId + ", recfmt: " + recfmt + ", settlementDate: " + settlementDate + ", netCollection: " + netCollection);
|
|
|
363 |
|
| 4715 |
varun.gupt |
364 |
if (recfmt.trim().equalsIgnoreCase("CVD")) {
|
|
|
365 |
if (netCollection > 0.0) netCollection *= -1.0;
|
|
|
366 |
transactionClient.savePaymentSettlements(settlementDate.getTime(), 1, paymentId, 0.0, 0.0, netCollection);
|
| 4734 |
varun.gupt |
367 |
countRefunds += 1;
|
| 5020 |
varun.gupt |
368 |
|
| 4600 |
varun.gupt |
369 |
} else {
|
|
|
370 |
double msf = row.getCell(indexMSF).getNumericCellValue();
|
|
|
371 |
double serviceTax = row.getCell(indexServiceTax).getNumericCellValue();
|
|
|
372 |
double eduCess = row.getCell(indexEduCess).getNumericCellValue();
|
|
|
373 |
logger.info("msf: " + msf + ", serviceTax: " + serviceTax + ", eduCess: " + eduCess);
|
|
|
374 |
|
|
|
375 |
transactionClient.savePaymentSettlements(settlementDate.getTime(), 1, paymentId, serviceTax, (eduCess + msf), netCollection);
|
| 4734 |
varun.gupt |
376 |
countSuccessfulInserts += 1;
|
| 4600 |
varun.gupt |
377 |
}
|
|
|
378 |
} catch (NumberFormatException e) {
|
| 4734 |
varun.gupt |
379 |
String errMsg = "NumberFormatException recieved for payment Id, " + paymentIdStr;
|
| 5386 |
phani.kuma |
380 |
logger.error(errMsg, e);
|
| 4734 |
varun.gupt |
381 |
addActionError(errMsg);
|
| 4600 |
varun.gupt |
382 |
|
|
|
383 |
} catch (TransactionServiceException e) {
|
| 5386 |
phani.kuma |
384 |
String errMsg = "TransactionServiceException recieved for payment Id, " + Long.toString(paymentId);
|
|
|
385 |
logger.error(errMsg, e);
|
| 4734 |
varun.gupt |
386 |
addActionError(errMsg);
|
| 4600 |
varun.gupt |
387 |
}
|
|
|
388 |
}
|
| 5386 |
phani.kuma |
389 |
} catch (Exception e) {
|
|
|
390 |
String errMsg = "Exception recieved for payment Id," + Long.toString(paymentId);
|
|
|
391 |
logger.error(errMsg, e);
|
|
|
392 |
addActionError(errMsg);
|
|
|
393 |
}
|
| 4600 |
varun.gupt |
394 |
|
| 4734 |
varun.gupt |
395 |
addActionMessage("Added settlements for " + countSuccessfulInserts + " payments");
|
|
|
396 |
addActionMessage("Added settlements for " + countRefunds + " refund payments");
|
| 4600 |
varun.gupt |
397 |
}
|
|
|
398 |
|
|
|
399 |
public void uploadEBSSettlements() {
|
|
|
400 |
Workbook wb = null;
|
|
|
401 |
try {
|
|
|
402 |
wb = new HSSFWorkbook(new FileInputStream(this.ebsSettlementReport));
|
|
|
403 |
} catch (FileNotFoundException e) {
|
| 5386 |
phani.kuma |
404 |
String errMsg = "Unable to open the EBS Settlement detail report";
|
|
|
405 |
logger.error(errMsg, e);
|
|
|
406 |
addActionError(errMsg);
|
|
|
407 |
return;
|
| 4600 |
varun.gupt |
408 |
} catch (IOException e) {
|
| 5386 |
phani.kuma |
409 |
String errMsg = "Unable to open the EBS Settlement detail report";
|
|
|
410 |
logger.error(errMsg, e);
|
|
|
411 |
addActionError(errMsg);
|
|
|
412 |
return;
|
| 4600 |
varun.gupt |
413 |
}
|
|
|
414 |
|
|
|
415 |
Sheet sheet = wb.getSheetAt(0);
|
|
|
416 |
|
|
|
417 |
Row firstRow = sheet.getRow(0);
|
|
|
418 |
Row secondRow = sheet.getRow(1);
|
|
|
419 |
|
|
|
420 |
int indexPaymentId = 2;
|
|
|
421 |
int indexTxnType = 5;
|
|
|
422 |
int indexAmount = 6;
|
|
|
423 |
|
|
|
424 |
Map<Long, Map<String, Double>> map = new HashMap<Long, Map<String,Double>>();
|
|
|
425 |
Map <String, Double> record;
|
| 4734 |
varun.gupt |
426 |
int countPaymentIds = 0;
|
| 4600 |
varun.gupt |
427 |
|
|
|
428 |
try {
|
|
|
429 |
for (Row row: sheet) {
|
|
|
430 |
if(row.equals(firstRow) || row.equals(secondRow)) continue;
|
|
|
431 |
|
|
|
432 |
long paymentId = Long.parseLong(row.getCell(indexPaymentId).getStringCellValue());
|
|
|
433 |
String transactionType = row.getCell(indexTxnType).getStringCellValue();
|
|
|
434 |
double amount = row.getCell(indexAmount).getNumericCellValue();
|
|
|
435 |
|
|
|
436 |
if(map.containsKey(paymentId)) {
|
|
|
437 |
map.get(paymentId).put(transactionType, amount);
|
|
|
438 |
|
|
|
439 |
} else {
|
|
|
440 |
record = new HashMap<String, Double>();
|
|
|
441 |
record.put(transactionType, amount);
|
|
|
442 |
map.put(paymentId, record);
|
| 4734 |
varun.gupt |
443 |
countPaymentIds += 1;
|
| 4600 |
varun.gupt |
444 |
}
|
|
|
445 |
}
|
|
|
446 |
} catch (NullPointerException e) {
|
|
|
447 |
logger.error("" + e);
|
|
|
448 |
}
|
| 4734 |
varun.gupt |
449 |
addActionMessage("Total Payment Ids added: " + countPaymentIds);
|
| 4600 |
varun.gupt |
450 |
|
|
|
451 |
TransactionClient tsc;
|
|
|
452 |
long settlementId = Long.parseLong(request.getParameter("settlementId"));
|
|
|
453 |
|
| 4734 |
varun.gupt |
454 |
int countPaymentsRecieved = 0;
|
|
|
455 |
int countPaymentsRefunded = 0;
|
|
|
456 |
|
| 4600 |
varun.gupt |
457 |
try {
|
|
|
458 |
tsc = new TransactionClient();
|
|
|
459 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
| 4734 |
varun.gupt |
460 |
long settlementDate;
|
| 4600 |
varun.gupt |
461 |
|
| 4734 |
varun.gupt |
462 |
try {
|
|
|
463 |
settlementDate = transactionClient.getEBSSettlementDate(settlementId);
|
|
|
464 |
} catch (TransactionServiceException e) {
|
|
|
465 |
String errMsg = "Could not retrieve EBS Settlement date for settlementId, " + settlementId;
|
| 5386 |
phani.kuma |
466 |
logger.error(errMsg, e);
|
| 4734 |
varun.gupt |
467 |
addActionError(errMsg);
|
|
|
468 |
return;
|
|
|
469 |
}
|
|
|
470 |
|
| 4600 |
varun.gupt |
471 |
for (long paymentId: map.keySet()) {
|
|
|
472 |
record = map.get(paymentId);
|
|
|
473 |
|
|
|
474 |
if(record.containsKey("Captured")) {
|
|
|
475 |
double capturedAmount = record.get("Captured");
|
|
|
476 |
double tdr = record.get("TDR");
|
|
|
477 |
double serviceTax = record.get("ServiceTax");
|
|
|
478 |
|
|
|
479 |
if(tdr < 0) tdr *= -1;
|
|
|
480 |
if(serviceTax < 0) serviceTax *= -1;
|
|
|
481 |
|
|
|
482 |
double amount = capturedAmount - tdr - serviceTax;
|
| 4734 |
varun.gupt |
483 |
|
|
|
484 |
try {
|
|
|
485 |
transactionClient.savePaymentSettlements(settlementDate, 2, paymentId, serviceTax, tdr, amount);
|
|
|
486 |
} catch (TransactionServiceException e) {
|
|
|
487 |
String errMsg = "Could not save settlement for paymentId, " + paymentId;
|
|
|
488 |
logger.error(errMsg + e);
|
|
|
489 |
addActionError(errMsg);
|
|
|
490 |
}
|
|
|
491 |
countPaymentsRecieved += 1;
|
|
|
492 |
}
|
|
|
493 |
|
|
|
494 |
if(record.containsKey("Refunded")) {
|
| 4600 |
varun.gupt |
495 |
double refundedAmount = record.get("Refunded");
|
|
|
496 |
|
|
|
497 |
if (refundedAmount > 0) refundedAmount *= -1;
|
|
|
498 |
|
| 4734 |
varun.gupt |
499 |
try {
|
|
|
500 |
transactionClient.savePaymentSettlements(settlementDate, 2, paymentId, 0.0, 0.0, refundedAmount);
|
|
|
501 |
} catch (TransactionServiceException e) {
|
|
|
502 |
String errMsg = "Could not save refund settlement for paymentId, " + paymentId;
|
| 5386 |
phani.kuma |
503 |
logger.error(errMsg, e);
|
| 4734 |
varun.gupt |
504 |
addActionError(errMsg);
|
|
|
505 |
}
|
|
|
506 |
countPaymentsRefunded += 1;
|
| 4600 |
varun.gupt |
507 |
}
|
|
|
508 |
}
|
| 4734 |
varun.gupt |
509 |
addActionMessage("Total count of payments recieved: " + countPaymentsRecieved);
|
|
|
510 |
addActionMessage("Total count of payments refunded: " + countPaymentsRefunded);
|
| 4600 |
varun.gupt |
511 |
|
| 4734 |
varun.gupt |
512 |
try {
|
|
|
513 |
transactionClient.markEBSSettlementUploaded(settlementId);
|
|
|
514 |
} catch (TransactionServiceException e) {
|
|
|
515 |
String errMsg = "Could not mark settlement for details Uploaded. Settlement ID: " + settlementId;
|
| 5386 |
phani.kuma |
516 |
logger.error(errMsg, e);
|
| 4734 |
varun.gupt |
517 |
addActionError(errMsg);
|
|
|
518 |
}
|
| 5386 |
phani.kuma |
519 |
} catch (Exception e) {
|
|
|
520 |
String errMsg = e.getMessage();
|
|
|
521 |
logger.error(errMsg, e);
|
|
|
522 |
addActionError(errMsg);
|
| 4600 |
varun.gupt |
523 |
}
|
|
|
524 |
}
|
|
|
525 |
|
|
|
526 |
public void uploadBluedartSettlements() {
|
|
|
527 |
|
|
|
528 |
Workbook wb = null;
|
|
|
529 |
try {
|
|
|
530 |
wb = new HSSFWorkbook(new FileInputStream(this.bluedartSettlementReport));
|
|
|
531 |
} catch (FileNotFoundException e) {
|
| 5386 |
phani.kuma |
532 |
String errMsg = "Unable to open the Bluedart Settlement report";
|
|
|
533 |
logger.error(errMsg, e);
|
|
|
534 |
addActionError(errMsg);
|
|
|
535 |
return;
|
| 4600 |
varun.gupt |
536 |
} catch (IOException e) {
|
| 5386 |
phani.kuma |
537 |
String errMsg = "Unable to open the Bluedart Settlement report";
|
|
|
538 |
logger.error(errMsg, e);
|
|
|
539 |
addActionError(errMsg);
|
|
|
540 |
return;
|
| 4600 |
varun.gupt |
541 |
}
|
|
|
542 |
|
|
|
543 |
Sheet sheet = wb.getSheetAt(0);
|
|
|
544 |
|
|
|
545 |
Row firstRow = sheet.getRow(0);
|
|
|
546 |
logger.info("Cell count:" + firstRow.getPhysicalNumberOfCells());
|
|
|
547 |
|
| 5098 |
varun.gupt |
548 |
int indexOrderId = 15;
|
|
|
549 |
int indexAmount = 14;
|
| 4600 |
varun.gupt |
550 |
|
|
|
551 |
TransactionClient tsc;
|
| 4734 |
varun.gupt |
552 |
int countSuccessfulSaves = 0;
|
| 4600 |
varun.gupt |
553 |
|
|
|
554 |
try {
|
|
|
555 |
long settlementDate = DATE_FORMAT.parse(bluedartSettlementDate).getTime();
|
|
|
556 |
tsc = new TransactionClient();
|
|
|
557 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
|
|
558 |
|
| 5386 |
phani.kuma |
559 |
long orderId = 0;
|
|
|
560 |
|
| 4600 |
varun.gupt |
561 |
for (Row row : sheet) {
|
| 5098 |
varun.gupt |
562 |
String orderIdString = "";
|
| 4600 |
varun.gupt |
563 |
try {
|
| 5098 |
varun.gupt |
564 |
orderIdString = row.getCell(indexOrderId).getStringCellValue();
|
|
|
565 |
orderId = Long.parseLong(orderIdString);
|
| 4715 |
varun.gupt |
566 |
|
| 4600 |
varun.gupt |
567 |
double amount = row.getCell(indexAmount).getNumericCellValue();
|
| 5020 |
varun.gupt |
568 |
logger.info("Bluedart SettlementDate: " + settlementDate + ", OrderId: " + orderId + ", Amount: " + amount);
|
| 4905 |
varun.gupt |
569 |
transactionClient.savePaymentSettlements(settlementDate, 4, orderId, 0.0, 0.0, amount);
|
| 4875 |
varun.gupt |
570 |
countSuccessfulSaves += 1;
|
| 4600 |
varun.gupt |
571 |
|
| 5098 |
varun.gupt |
572 |
} catch (IllegalStateException e) {
|
| 5386 |
phani.kuma |
573 |
String errMsg = "IllegalStateException Near OrderId: " + orderId;
|
|
|
574 |
logger.error(errMsg, e);
|
|
|
575 |
addActionError(errMsg);
|
| 5098 |
varun.gupt |
576 |
|
| 5386 |
phani.kuma |
577 |
} catch(NumberFormatException e) {
|
|
|
578 |
String errMsg = "NumberFormatException for Extracted String: " + orderIdString;
|
|
|
579 |
logger.error(errMsg, e);
|
|
|
580 |
addActionError(errMsg);
|
| 5098 |
varun.gupt |
581 |
|
| 4600 |
varun.gupt |
582 |
} catch (NullPointerException e) {
|
| 5386 |
phani.kuma |
583 |
String errMsg = "NullPointerException For OrderId: " + orderId;
|
|
|
584 |
logger.error(errMsg, e);
|
|
|
585 |
addActionError(errMsg);
|
| 4600 |
varun.gupt |
586 |
|
| 4875 |
varun.gupt |
587 |
} catch (TransactionServiceException e) {
|
| 5386 |
phani.kuma |
588 |
String errMsg = "TransactionServiceException For OrderId: " + orderId;
|
|
|
589 |
logger.error(errMsg, e);
|
|
|
590 |
addActionError(errMsg);
|
| 4600 |
varun.gupt |
591 |
}
|
|
|
592 |
}
|
|
|
593 |
} catch (ParseException e) {
|
| 5386 |
phani.kuma |
594 |
String errMsg = "Could not parse " + bluedartSettlementDate;
|
|
|
595 |
logger.error(errMsg, e);
|
|
|
596 |
addActionError(errMsg);
|
|
|
597 |
} catch (Exception e) {
|
|
|
598 |
String errMsg = e.getMessage();
|
|
|
599 |
logger.error(errMsg, e);
|
|
|
600 |
addActionError(errMsg);
|
| 4600 |
varun.gupt |
601 |
}
|
| 4734 |
varun.gupt |
602 |
addActionMessage("Successfully added Bluedart settlement details for " + countSuccessfulSaves + " orders");
|
| 4600 |
varun.gupt |
603 |
}
|
|
|
604 |
|
| 5386 |
phani.kuma |
605 |
public void uploadAramexSettlements() {
|
| 4715 |
varun.gupt |
606 |
logger.info("Uploading Aramex Settlements" + this.aramexSettlementDate);
|
|
|
607 |
|
| 5386 |
phani.kuma |
608 |
if(this.aramexSettlementDate.equals("")) {
|
| 4715 |
varun.gupt |
609 |
addActionError("Settlement date cannot be left blank");
|
|
|
610 |
return;
|
|
|
611 |
}
|
|
|
612 |
|
|
|
613 |
Workbook wb = null;
|
|
|
614 |
try {
|
| 5020 |
varun.gupt |
615 |
wb = new XSSFWorkbook(new FileInputStream(this.aramexSettlementReport));
|
| 4715 |
varun.gupt |
616 |
} catch (FileNotFoundException e) {
|
| 5386 |
phani.kuma |
617 |
String errMsg = "Unable to open the Aramex Settlement report";
|
|
|
618 |
logger.error(errMsg, e);
|
|
|
619 |
addActionError(errMsg);
|
|
|
620 |
return;
|
| 4715 |
varun.gupt |
621 |
} catch (IOException e) {
|
| 5386 |
phani.kuma |
622 |
String errMsg = "Unable to open the Aramex Settlement report";
|
|
|
623 |
logger.error(errMsg, e);
|
|
|
624 |
addActionError(errMsg);
|
|
|
625 |
return;
|
|
|
626 |
}
|
| 4715 |
varun.gupt |
627 |
|
|
|
628 |
Sheet sheet = wb.getSheetAt(0);
|
|
|
629 |
|
| 5343 |
phani.kuma |
630 |
int indexAWB = 0;
|
| 4734 |
varun.gupt |
631 |
int indexAmount = 1;
|
| 5343 |
phani.kuma |
632 |
int indexComment = 2;
|
| 4715 |
varun.gupt |
633 |
Row firstRow = sheet.getRow(0);
|
|
|
634 |
logger.info("Cell count:" + firstRow.getPhysicalNumberOfCells());
|
|
|
635 |
|
|
|
636 |
TransactionClient tsc;
|
| 4734 |
varun.gupt |
637 |
int countSuccessfulSaves = 0;
|
| 4715 |
varun.gupt |
638 |
try {
|
|
|
639 |
long settlementDate = DATE_FORMAT.parse(aramexSettlementDate).getTime();
|
|
|
640 |
|
|
|
641 |
tsc = new TransactionClient();
|
|
|
642 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
|
|
643 |
|
|
|
644 |
for (Row row: sheet) {
|
| 5343 |
phani.kuma |
645 |
if(row.equals(firstRow)) {
|
|
|
646 |
continue;
|
|
|
647 |
}
|
| 4715 |
varun.gupt |
648 |
|
| 5343 |
phani.kuma |
649 |
long awb = -1;
|
|
|
650 |
|
|
|
651 |
if(row.getCell(indexAWB).getCellType() == 0) {
|
|
|
652 |
awb = (long) row.getCell(indexAWB).getNumericCellValue();
|
| 5108 |
varun.gupt |
653 |
}
|
| 5343 |
phani.kuma |
654 |
else if(row.getCell(indexAWB).getCellType() == 1) {
|
|
|
655 |
awb = Long.parseLong(row.getCell(indexAWB).getStringCellValue());
|
|
|
656 |
}
|
|
|
657 |
|
|
|
658 |
if(awb == -1) {
|
|
|
659 |
continue;
|
|
|
660 |
}
|
|
|
661 |
else if(row.getCell(indexComment).getStringCellValue().equals("LOST SHIPMENT")) {
|
|
|
662 |
logger.info("LOST SHIPMENT");
|
|
|
663 |
continue;
|
|
|
664 |
}
|
|
|
665 |
|
| 4715 |
varun.gupt |
666 |
try {
|
| 5108 |
varun.gupt |
667 |
long orderId = transactionClient.getOrderForAwb(Long.toString(awb)).getId();
|
|
|
668 |
double amount = row.getCell(indexAmount).getNumericCellValue();
|
|
|
669 |
logger.info("Aramex Settlement, Order Id: " + orderId + " Amount: " + amount);
|
|
|
670 |
|
| 4907 |
varun.gupt |
671 |
transactionClient.savePaymentSettlements(settlementDate, 4, orderId, 0.0, 0.0, amount);
|
| 4734 |
varun.gupt |
672 |
countSuccessfulSaves += 1;
|
| 4715 |
varun.gupt |
673 |
|
|
|
674 |
} catch (TransactionServiceException e) {
|
| 5108 |
varun.gupt |
675 |
logger.error("Transaction Service Exception while getting order for AWB, " + awb, e);
|
|
|
676 |
addActionError("Transaction Service Exception while getting order for AWB, " + awb);
|
| 4715 |
varun.gupt |
677 |
}
|
|
|
678 |
}
|
|
|
679 |
} catch (ParseException e) {
|
| 5386 |
phani.kuma |
680 |
String errMsg = "Could not parse " + aramexSettlementDate;
|
|
|
681 |
logger.error(errMsg, e);
|
|
|
682 |
addActionError(errMsg);
|
|
|
683 |
} catch (Exception e) {
|
|
|
684 |
String errMsg = e.getMessage();
|
|
|
685 |
logger.error(errMsg, e);
|
|
|
686 |
addActionError(errMsg);
|
| 4715 |
varun.gupt |
687 |
}
|
| 4734 |
varun.gupt |
688 |
addActionMessage("Successfully added Aramex settlement details for " + countSuccessfulSaves + " orders");
|
| 4715 |
varun.gupt |
689 |
}
|
|
|
690 |
|
| 5098 |
varun.gupt |
691 |
public void uploadOrderIdsToBeMarkedPaid() {
|
|
|
692 |
logger.info("Uploading Order Ids to be marked as paid");
|
| 5189 |
varun.gupt |
693 |
List<Long> orderIds = new ArrayList<Long>();
|
|
|
694 |
|
|
|
695 |
try {
|
| 5386 |
phani.kuma |
696 |
FileInputStream uploadedFile = new FileInputStream(this.orderIdsToBeMarked);
|
| 5189 |
varun.gupt |
697 |
String uploadedContent = IOUtils.toString(uploadedFile);
|
|
|
698 |
|
|
|
699 |
for(String s: uploadedContent.trim().split("\n")) {
|
|
|
700 |
|
| 5386 |
phani.kuma |
701 |
if(! s.trim().isEmpty()) {
|
|
|
702 |
orderIds.add(Long.parseLong(s));
|
|
|
703 |
}
|
| 5189 |
varun.gupt |
704 |
}
|
|
|
705 |
} catch (FileNotFoundException e) {
|
| 5386 |
phani.kuma |
706 |
String errMsg = "Unable to open the sheet containing orders for which vendor is paid";
|
|
|
707 |
logger.error(errMsg, e);
|
|
|
708 |
addActionError(errMsg);
|
|
|
709 |
return;
|
| 5189 |
varun.gupt |
710 |
} catch (IOException e) {
|
| 5386 |
phani.kuma |
711 |
String errMsg = "IOException occured while reading the file containing orders for which vendor is paid";
|
|
|
712 |
logger.error(errMsg, e);
|
|
|
713 |
addActionError(errMsg);
|
|
|
714 |
return;
|
| 5098 |
varun.gupt |
715 |
}
|
| 5189 |
varun.gupt |
716 |
|
| 5098 |
varun.gupt |
717 |
TransactionClient tsc;
|
|
|
718 |
int countSuccessfulSaves = 0;
|
|
|
719 |
|
| 5189 |
varun.gupt |
720 |
try {
|
|
|
721 |
tsc = new TransactionClient();
|
|
|
722 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
|
|
723 |
|
|
|
724 |
for (long orderId: orderIds) {
|
|
|
725 |
|
| 5198 |
varun.gupt |
726 |
logger.info("Marking as paid, Order Id: " + orderId);
|
| 5189 |
varun.gupt |
727 |
try {
|
| 5386 |
phani.kuma |
728 |
transactionClient.updateOrderOnlyAsPaidToVendor(orderId);
|
| 5189 |
varun.gupt |
729 |
countSuccessfulSaves += 1;
|
|
|
730 |
|
|
|
731 |
} catch (TransactionServiceException e) {
|
|
|
732 |
logger.error("Transaction Service Exception while getting order for id, " + orderId, e);
|
|
|
733 |
addActionError("Transaction Service Exception while getting order for id, " + orderId);
|
|
|
734 |
}
|
|
|
735 |
}
|
| 5386 |
phani.kuma |
736 |
} catch (Exception e) {
|
|
|
737 |
String errMsg = e.getMessage();
|
|
|
738 |
logger.error(errMsg, e);
|
|
|
739 |
addActionError(errMsg);
|
|
|
740 |
}
|
| 5098 |
varun.gupt |
741 |
addActionMessage("Successfully marked " + countSuccessfulSaves + " orders as paid to vendor");
|
|
|
742 |
}
|
|
|
743 |
|
| 5386 |
phani.kuma |
744 |
public void uploadOrderIdsToBeMarkedReturned() {
|
|
|
745 |
logger.info("Uploading Order Ids to be marked as Returned");
|
|
|
746 |
List<Long> orderIds = new ArrayList<Long>();
|
| 4875 |
varun.gupt |
747 |
|
| 5386 |
phani.kuma |
748 |
try {
|
|
|
749 |
FileInputStream uploadedFile = new FileInputStream(this.orderIdsToBeMarked);
|
|
|
750 |
String uploadedContent = IOUtils.toString(uploadedFile);
|
|
|
751 |
|
|
|
752 |
for(String s: uploadedContent.trim().split("\n")) {
|
|
|
753 |
|
|
|
754 |
if(! s.trim().isEmpty()) {
|
|
|
755 |
orderIds.add(Long.parseLong(s));
|
|
|
756 |
}
|
|
|
757 |
}
|
|
|
758 |
} catch (FileNotFoundException e) {
|
|
|
759 |
String errMsg = "Unable to open the sheet containing returned orders to be marked";
|
|
|
760 |
logger.error(errMsg, e);
|
|
|
761 |
addActionError(errMsg);
|
|
|
762 |
return;
|
|
|
763 |
} catch (IOException e) {
|
|
|
764 |
String errMsg = "IOException occured while reading the file containing returned orders to be marked";
|
|
|
765 |
logger.error(errMsg, e);
|
|
|
766 |
addActionError(errMsg);
|
|
|
767 |
return;
|
|
|
768 |
}
|
|
|
769 |
|
|
|
770 |
TransactionClient tsc;
|
|
|
771 |
int countSuccessfulSaves = 0;
|
|
|
772 |
|
|
|
773 |
try {
|
|
|
774 |
tsc = new TransactionClient();
|
|
|
775 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
|
|
776 |
|
|
|
777 |
for (long orderId: orderIds) {
|
|
|
778 |
|
|
|
779 |
logger.info("Marking as Returned, Order Id: " + orderId);
|
|
|
780 |
try {
|
|
|
781 |
transactionClient.processReturn(orderId);
|
|
|
782 |
countSuccessfulSaves += 1;
|
|
|
783 |
|
|
|
784 |
} catch (TransactionServiceException e) {
|
|
|
785 |
String errMsg = "Transaction Service Exception while getting order for id, " + orderId;
|
|
|
786 |
logger.error(errMsg, e);
|
|
|
787 |
addActionError(errMsg);
|
|
|
788 |
}
|
|
|
789 |
}
|
|
|
790 |
} catch (Exception e) {
|
|
|
791 |
String errMsg = e.getMessage();
|
|
|
792 |
logger.error(errMsg, e);
|
|
|
793 |
addActionError(errMsg);
|
|
|
794 |
}
|
|
|
795 |
addActionMessage("Successfully marked " + countSuccessfulSaves + " orders as returned to vendor");
|
|
|
796 |
}
|
|
|
797 |
|
|
|
798 |
private ByteArrayOutputStream getReconciliationReport(long vendorId) {
|
|
|
799 |
ByteArrayOutputStream baosXLS = new ByteArrayOutputStream();
|
|
|
800 |
|
|
|
801 |
try {
|
| 4745 |
varun.gupt |
802 |
TransactionClient tsc = new TransactionClient();
|
|
|
803 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
| 5386 |
phani.kuma |
804 |
|
| 5189 |
varun.gupt |
805 |
List<Order> unpaidOrders = transactionClient.getOrdersWhereVendorNotPaid(vendorId);
|
|
|
806 |
logger.info("Unpaid Order count: " + unpaidOrders.size());
|
| 4905 |
varun.gupt |
807 |
|
| 5386 |
phani.kuma |
808 |
List<ReturnOrder> returns = new ArrayList<ReturnOrder>();
|
| 4745 |
varun.gupt |
809 |
|
| 5386 |
phani.kuma |
810 |
try {
|
|
|
811 |
returns = transactionClient.getReturnOrders(-1, 0L, 0L);
|
|
|
812 |
} catch (TTransportException e) {
|
|
|
813 |
tsc = new TransactionClient();
|
|
|
814 |
transactionClient = tsc.getClient();
|
|
|
815 |
returns = transactionClient.getReturnOrders(-1, 0L, 0L);
|
|
|
816 |
}
|
|
|
817 |
|
|
|
818 |
Map<Long, ReturnOrder> mapReturnOrderIds = new HashMap<Long, ReturnOrder>();
|
|
|
819 |
|
|
|
820 |
for (ReturnOrder returnOrder: returns)
|
|
|
821 |
{
|
|
|
822 |
mapReturnOrderIds.put(returnOrder.getOrderId(), returnOrder);
|
|
|
823 |
}
|
|
|
824 |
|
|
|
825 |
List<Long> ReturnOrderIds = new ArrayList<Long>(mapReturnOrderIds.keySet());
|
|
|
826 |
|
|
|
827 |
List<Order> listofreturnedOrders = new ArrayList<Order>();
|
|
|
828 |
|
|
|
829 |
try {
|
|
|
830 |
listofreturnedOrders = transactionClient.getOrderListForVendor(ReturnOrderIds, vendorId);
|
|
|
831 |
} catch (TTransportException e) {
|
|
|
832 |
tsc = new TransactionClient();
|
|
|
833 |
transactionClient = tsc.getClient();
|
|
|
834 |
listofreturnedOrders = transactionClient.getOrderListForVendor(ReturnOrderIds, vendorId);
|
|
|
835 |
}
|
|
|
836 |
|
|
|
837 |
for (Order order: listofreturnedOrders)
|
|
|
838 |
{
|
|
|
839 |
order.setDelivery_timestamp(mapReturnOrderIds.get(order.getId()).getCreatedAt());
|
|
|
840 |
returnedOrders.add(order);
|
|
|
841 |
}
|
|
|
842 |
|
|
|
843 |
Set<Long> OriginalOrderIds = new HashSet<Long>();
|
|
|
844 |
Map<Long, Order> mapUnpaidOrders = new HashMap<Long, Order>();
|
|
|
845 |
|
|
|
846 |
for (Order order: unpaidOrders)
|
|
|
847 |
{
|
|
|
848 |
if(order.getOriginalOrderId() == 0) {
|
|
|
849 |
OriginalOrderIds.add(order.getId());
|
|
|
850 |
}
|
|
|
851 |
else {
|
|
|
852 |
OriginalOrderIds.add(order.getOriginalOrderId());
|
|
|
853 |
}
|
|
|
854 |
mapUnpaidOrders.put(order.getId(), order);
|
|
|
855 |
}
|
|
|
856 |
|
|
|
857 |
List<Order> reshippedPayableOrders = new ArrayList<Order>();
|
|
|
858 |
List<Order> originalPayableOrders_user = new ArrayList<Order>();
|
|
|
859 |
List<Order> originalPayableOrders_nouser = new ArrayList<Order>();
|
|
|
860 |
|
|
|
861 |
Order originalOrder = null;
|
|
|
862 |
boolean originalOrderUnpaid = false;
|
|
|
863 |
Order tempOrder = null;
|
|
|
864 |
boolean tempOrderUnpaid = false;
|
|
|
865 |
long nextOrderId = 0;
|
|
|
866 |
String previous_invoice_number = "";
|
|
|
867 |
|
|
|
868 |
for (long originalOrderId: OriginalOrderIds)
|
|
|
869 |
{
|
|
|
870 |
originalOrder = null;
|
|
|
871 |
originalOrderUnpaid = false;
|
|
|
872 |
tempOrder = null;
|
|
|
873 |
tempOrderUnpaid = false;
|
|
|
874 |
nextOrderId = originalOrderId;
|
|
|
875 |
previous_invoice_number = "";
|
| 5189 |
varun.gupt |
876 |
|
| 5386 |
phani.kuma |
877 |
while (true)
|
|
|
878 |
{
|
|
|
879 |
if(mapUnpaidOrders.containsKey(nextOrderId)) {
|
|
|
880 |
tempOrder = mapUnpaidOrders.get(nextOrderId);
|
|
|
881 |
tempOrderUnpaid = true;
|
|
|
882 |
}
|
|
|
883 |
else {
|
|
|
884 |
try {
|
|
|
885 |
tempOrder = transactionClient.getOrder(nextOrderId);
|
|
|
886 |
} catch (TTransportException e) {
|
|
|
887 |
tsc = new TransactionClient();
|
|
|
888 |
transactionClient = tsc.getClient();
|
|
|
889 |
tempOrder = transactionClient.getOrder(nextOrderId);
|
|
|
890 |
}
|
|
|
891 |
tempOrderUnpaid = false;
|
|
|
892 |
}
|
| 5189 |
varun.gupt |
893 |
|
| 5386 |
phani.kuma |
894 |
if(tempOrderUnpaid && nextOrderId != originalOrderId) {
|
|
|
895 |
if(previous_invoice_number.equals(tempOrder.getInvoice_number())) {
|
|
|
896 |
reshippedNonPayableOrders.add(tempOrder);
|
|
|
897 |
}
|
|
|
898 |
else {
|
|
|
899 |
reshippedPayableOrders.add(tempOrder);
|
|
|
900 |
}
|
|
|
901 |
}
|
| 5189 |
varun.gupt |
902 |
|
| 5386 |
phani.kuma |
903 |
if(tempOrderUnpaid && nextOrderId == originalOrderId) {
|
|
|
904 |
originalOrder = tempOrder;
|
|
|
905 |
originalOrderUnpaid = true;
|
|
|
906 |
}
|
| 5189 |
varun.gupt |
907 |
|
| 5386 |
phani.kuma |
908 |
nextOrderId = tempOrder.getNew_order_id();
|
|
|
909 |
previous_invoice_number = tempOrder.getInvoice_number();
|
|
|
910 |
if(nextOrderId == 0) {
|
|
|
911 |
if(originalOrderUnpaid) {
|
|
|
912 |
if(refundOrderStatuses.contains(tempOrder.getStatus())) {
|
|
|
913 |
originalPayableOrders_nouser.add(originalOrder);
|
|
|
914 |
}
|
|
|
915 |
else {
|
|
|
916 |
originalPayableOrders_user.add(originalOrder);
|
|
|
917 |
}
|
|
|
918 |
}
|
|
|
919 |
break;
|
|
|
920 |
}
|
| 5189 |
varun.gupt |
921 |
}
|
|
|
922 |
}
|
|
|
923 |
|
| 5386 |
phani.kuma |
924 |
PaymentClient psc = new PaymentClient();
|
|
|
925 |
in.shop2020.payments.PaymentService.Client paymentClient = psc.getClient();
|
|
|
926 |
|
|
|
927 |
PaymentSettlement pmtSettlement = null;
|
|
|
928 |
Payment payment = null;
|
|
|
929 |
|
|
|
930 |
for (Order UserpayRequiredOrder: originalPayableOrders_user)
|
|
|
931 |
{
|
| 5189 |
varun.gupt |
932 |
try {
|
| 5386 |
phani.kuma |
933 |
pmtSettlement = null;
|
| 5189 |
varun.gupt |
934 |
|
| 5386 |
phani.kuma |
935 |
if(UserpayRequiredOrder.isCod()) {
|
|
|
936 |
try {
|
|
|
937 |
pmtSettlement = transactionClient.getSettlementForCod(UserpayRequiredOrder.getId(), false);
|
|
|
938 |
} catch (TTransportException e) {
|
|
|
939 |
tsc = new TransactionClient();
|
|
|
940 |
transactionClient = tsc.getClient();
|
|
|
941 |
pmtSettlement = transactionClient.getSettlementForCod(UserpayRequiredOrder.getId(), false);
|
|
|
942 |
}
|
| 5189 |
varun.gupt |
943 |
|
| 5386 |
phani.kuma |
944 |
if(pmtSettlement.getReferenceId() > 0) {
|
|
|
945 |
paymentSettledOrdersMap.put(UserpayRequiredOrder, pmtSettlement);
|
| 5189 |
varun.gupt |
946 |
}
|
| 5386 |
phani.kuma |
947 |
else {
|
|
|
948 |
unsettledOrders.add(UserpayRequiredOrder);
|
|
|
949 |
}
|
|
|
950 |
}
|
|
|
951 |
else {
|
|
|
952 |
payment = null;
|
| 5189 |
varun.gupt |
953 |
|
| 5386 |
phani.kuma |
954 |
try {
|
|
|
955 |
payment = paymentClient.getSuccessfulPaymentForTxnId(UserpayRequiredOrder.getTransactionId());
|
|
|
956 |
} catch (TTransportException e) {
|
|
|
957 |
psc = new PaymentClient();
|
|
|
958 |
paymentClient = psc.getClient();
|
|
|
959 |
payment = paymentClient.getSuccessfulPaymentForTxnId(UserpayRequiredOrder.getTransactionId());
|
| 5189 |
varun.gupt |
960 |
}
|
|
|
961 |
|
| 5386 |
phani.kuma |
962 |
try {
|
|
|
963 |
pmtSettlement = transactionClient.getSettlementForPrepaid(payment.getPaymentId(), false);
|
|
|
964 |
} catch (TTransportException e) {
|
|
|
965 |
tsc = new TransactionClient();
|
|
|
966 |
transactionClient = tsc.getClient();
|
|
|
967 |
pmtSettlement = transactionClient.getSettlementForPrepaid(payment.getPaymentId(), false);
|
| 5189 |
varun.gupt |
968 |
}
|
|
|
969 |
|
| 5386 |
phani.kuma |
970 |
if(pmtSettlement.getReferenceId() > 0) {
|
|
|
971 |
paymentSettledOrdersMap.put(UserpayRequiredOrder, pmtSettlement);
|
| 5189 |
varun.gupt |
972 |
}
|
| 5386 |
phani.kuma |
973 |
else {
|
|
|
974 |
unsettledOrders.add(UserpayRequiredOrder);
|
|
|
975 |
}
|
| 5189 |
varun.gupt |
976 |
}
|
| 5386 |
phani.kuma |
977 |
} catch (Exception e) {
|
|
|
978 |
ordersWithErrors.add(UserpayRequiredOrder);
|
|
|
979 |
String errMsg = "error occured in getReconciliationReport during " + UserpayRequiredOrder.getId();
|
|
|
980 |
logger.error(errMsg, e);
|
|
|
981 |
addActionError(errMsg);
|
| 5189 |
varun.gupt |
982 |
}
|
|
|
983 |
}
|
|
|
984 |
|
| 5386 |
phani.kuma |
985 |
userPaymentNotRequiredOrders.addAll(originalPayableOrders_nouser);
|
|
|
986 |
logger.info("No User Payment Required Original Orders Count: " + originalPayableOrders_nouser.size());
|
|
|
987 |
userPaymentNotRequiredOrders.addAll(reshippedPayableOrders);
|
|
|
988 |
logger.info("Reshipped Payable Orders Count: " + reshippedPayableOrders.size());
|
|
|
989 |
logger.info("Payment Settlement Count: " + paymentSettledOrdersMap.keySet().size());
|
|
|
990 |
logger.info("Unsettled Orders Count: " + unsettledOrders.size());
|
|
|
991 |
logger.info("User Payment Not Required Orders Count: " + userPaymentNotRequiredOrders.size());
|
|
|
992 |
logger.info("Reshipped Orders Count: " + reshippedNonPayableOrders.size());
|
|
|
993 |
logger.info("Returned Orders Count: " + returnedOrders.size());
|
|
|
994 |
|
|
|
995 |
Workbook wb = new HSSFWorkbook();
|
|
|
996 |
|
|
|
997 |
Sheet totalPayableOrderSheet = wb.createSheet("Total Payable Orders");
|
|
|
998 |
Sheet settledOrderSheet = wb.createSheet("Settled Payable Orders");
|
|
|
999 |
Sheet unsettledOrderSheet = wb.createSheet("Unsettled Payable Orders");
|
|
|
1000 |
Sheet returnedOrderSheet = wb.createSheet("Receivable Orders");
|
|
|
1001 |
Sheet reshippedOrderSheet = wb.createSheet("Reshipped Non Payable Orders");
|
|
|
1002 |
Sheet errorOrderSheet = wb.createSheet("Orders With Errors");
|
|
|
1003 |
|
|
|
1004 |
populateSettledOrderSheet(totalPayableOrderSheet, true);
|
|
|
1005 |
populateSettledOrderSheet(settledOrderSheet, false);
|
|
|
1006 |
populateUnsettledOrderSheet(unsettledOrderSheet);
|
|
|
1007 |
populateReturnedOrderSheet(returnedOrderSheet);
|
|
|
1008 |
populateReshippedOrderSheet(reshippedOrderSheet);
|
|
|
1009 |
populateErrorOrderSheet(errorOrderSheet);
|
|
|
1010 |
|
|
|
1011 |
wb.write(baosXLS);
|
|
|
1012 |
baosXLS.close();
|
|
|
1013 |
|
|
|
1014 |
} catch (Exception e) {
|
|
|
1015 |
String errMsg = e.getMessage();
|
| 4745 |
varun.gupt |
1016 |
logger.error(errMsg, e);
|
|
|
1017 |
addActionError(errMsg);
|
|
|
1018 |
}
|
|
|
1019 |
|
| 4600 |
varun.gupt |
1020 |
return baosXLS;
|
|
|
1021 |
}
|
|
|
1022 |
|
| 5386 |
phani.kuma |
1023 |
private void populateErrorOrderSheet(Sheet sheet) {
|
|
|
1024 |
int rowCount = 0;
|
|
|
1025 |
|
|
|
1026 |
Row headerRow = sheet.createRow(rowCount ++);
|
|
|
1027 |
headerRow.createCell(OrderReportColumn.ORDER_ID.getValue()).setCellValue("Order Id");
|
|
|
1028 |
headerRow.createCell(OrderReportColumn.ORIGINAL_ORDER_ID.getValue()).setCellValue("Original Order Id");
|
|
|
1029 |
headerRow.createCell(OrderReportColumn.VENDOR_ID.getValue()).setCellValue("Vendor Id");
|
|
|
1030 |
headerRow.createCell(OrderReportColumn.ORDER_DATE.getValue()).setCellValue("Order Date");
|
|
|
1031 |
headerRow.createCell(OrderReportColumn.BILLING_NUMBER.getValue()).setCellValue("Billing Number");
|
|
|
1032 |
headerRow.createCell(OrderReportColumn.BILLING_DATE.getValue()).setCellValue("Billing Date");
|
|
|
1033 |
headerRow.createCell(OrderReportColumn.DELIVERY_DATE.getValue()).setCellValue("Returned Date");
|
|
|
1034 |
headerRow.createCell(OrderReportColumn.BRAND.getValue()).setCellValue("Brand");
|
|
|
1035 |
headerRow.createCell(OrderReportColumn.MODEL_NAME.getValue()).setCellValue("Model Name");
|
|
|
1036 |
headerRow.createCell(OrderReportColumn.MODEL_NUMBER.getValue()).setCellValue("Model Number");
|
|
|
1037 |
headerRow.createCell(OrderReportColumn.COLOR.getValue()).setCellValue("Color");
|
|
|
1038 |
headerRow.createCell(OrderReportColumn.QUANTITY.getValue()).setCellValue("Quantity");
|
|
|
1039 |
headerRow.createCell(OrderReportColumn.UNIT_TRANSFER_PRICE.getValue()).setCellValue("Unit Transfer Price");
|
|
|
1040 |
headerRow.createCell(OrderReportColumn.UNIT_SELLING_PRICE.getValue()).setCellValue("Unit Selling Price");
|
|
|
1041 |
headerRow.createCell(OrderReportColumn.TOTAL_TRANSFER_PRICE.getValue()).setCellValue("Total Transfer Price");
|
|
|
1042 |
headerRow.createCell(OrderReportColumn.TOTAL_SELLING_PRICE.getValue()).setCellValue("Total Selling Price");
|
|
|
1043 |
headerRow.createCell(OrderReportColumn.CURRENT_STATUS.getValue()).setCellValue("Current Status");
|
| 4600 |
varun.gupt |
1044 |
|
| 5386 |
phani.kuma |
1045 |
try {
|
|
|
1046 |
|
|
|
1047 |
Row contentRow = null;
|
|
|
1048 |
LineItem lineItem = null;
|
|
|
1049 |
|
|
|
1050 |
for (Order order: ordersWithErrors)
|
|
|
1051 |
{
|
|
|
1052 |
contentRow = sheet.createRow(rowCount ++);
|
|
|
1053 |
lineItem = order.getLineitems().get(0);
|
|
|
1054 |
|
|
|
1055 |
contentRow.createCell(OrderReportColumn.ORDER_ID.getValue()).setCellValue(order.getId());
|
|
|
1056 |
if(order.getOriginalOrderId() == 0) {
|
|
|
1057 |
contentRow.createCell(OrderReportColumn.ORIGINAL_ORDER_ID.getValue()).setCellValue(order.getId());
|
|
|
1058 |
}
|
|
|
1059 |
else {
|
|
|
1060 |
contentRow.createCell(OrderReportColumn.ORIGINAL_ORDER_ID.getValue()).setCellValue(order.getOriginalOrderId());
|
|
|
1061 |
}
|
|
|
1062 |
contentRow.createCell(OrderReportColumn.VENDOR_ID.getValue()).setCellValue(order.getVendorId());
|
|
|
1063 |
contentRow.createCell(OrderReportColumn.ORDER_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getCreated_timestamp())));
|
|
|
1064 |
contentRow.createCell(OrderReportColumn.BILLING_NUMBER.getValue()).setCellValue(order.getInvoice_number());
|
|
|
1065 |
contentRow.createCell(OrderReportColumn.BILLING_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getBilling_timestamp())));
|
|
|
1066 |
contentRow.createCell(OrderReportColumn.DELIVERY_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getDelivery_timestamp())));
|
|
|
1067 |
contentRow.createCell(OrderReportColumn.BRAND.getValue()).setCellValue(getValueForEmptyString(lineItem.getBrand()));
|
|
|
1068 |
contentRow.createCell(OrderReportColumn.MODEL_NAME.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_name()));
|
|
|
1069 |
contentRow.createCell(OrderReportColumn.MODEL_NUMBER.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_number()));
|
|
|
1070 |
contentRow.createCell(OrderReportColumn.COLOR.getValue()).setCellValue(getValueForEmptyString(lineItem.getColor()));
|
|
|
1071 |
contentRow.createCell(OrderReportColumn.QUANTITY.getValue()).setCellValue(lineItem.getQuantity());
|
|
|
1072 |
contentRow.createCell(OrderReportColumn.UNIT_TRANSFER_PRICE.getValue()).setCellValue(lineItem.getTransfer_price());
|
|
|
1073 |
contentRow.createCell(OrderReportColumn.UNIT_SELLING_PRICE.getValue()).setCellValue(lineItem.getUnit_price());
|
|
|
1074 |
contentRow.createCell(OrderReportColumn.TOTAL_TRANSFER_PRICE.getValue()).setCellValue(lineItem.getTransfer_price() * lineItem.getQuantity());
|
|
|
1075 |
contentRow.createCell(OrderReportColumn.TOTAL_SELLING_PRICE.getValue()).setCellValue(lineItem.getTotal_price());
|
|
|
1076 |
contentRow.createCell(OrderReportColumn.CURRENT_STATUS.getValue()).setCellValue(order.getStatus().name());
|
|
|
1077 |
}
|
|
|
1078 |
} catch (Exception e) {
|
|
|
1079 |
String errMsg = e.getMessage();
|
|
|
1080 |
logger.error(errMsg, e);
|
|
|
1081 |
addActionError(errMsg);
|
|
|
1082 |
}
|
| 4600 |
varun.gupt |
1083 |
}
|
|
|
1084 |
|
| 5386 |
phani.kuma |
1085 |
private void populateReturnedOrderSheet(Sheet sheet) {
|
|
|
1086 |
int rowCount = 0;
|
|
|
1087 |
|
|
|
1088 |
Row headerRow = sheet.createRow(rowCount ++);
|
| 4875 |
varun.gupt |
1089 |
headerRow.createCell(OrderReportColumn.ORDER_ID.getValue()).setCellValue("Order Id");
|
| 5386 |
phani.kuma |
1090 |
headerRow.createCell(OrderReportColumn.ORIGINAL_ORDER_ID.getValue()).setCellValue("Original Order Id");
|
|
|
1091 |
headerRow.createCell(OrderReportColumn.VENDOR_ID.getValue()).setCellValue("Vendor Id");
|
| 4875 |
varun.gupt |
1092 |
headerRow.createCell(OrderReportColumn.ORDER_DATE.getValue()).setCellValue("Order Date");
|
|
|
1093 |
headerRow.createCell(OrderReportColumn.BILLING_NUMBER.getValue()).setCellValue("Billing Number");
|
|
|
1094 |
headerRow.createCell(OrderReportColumn.BILLING_DATE.getValue()).setCellValue("Billing Date");
|
| 5386 |
phani.kuma |
1095 |
headerRow.createCell(OrderReportColumn.DELIVERY_DATE.getValue()).setCellValue("Returned Date");
|
| 4875 |
varun.gupt |
1096 |
headerRow.createCell(OrderReportColumn.BRAND.getValue()).setCellValue("Brand");
|
|
|
1097 |
headerRow.createCell(OrderReportColumn.MODEL_NAME.getValue()).setCellValue("Model Name");
|
|
|
1098 |
headerRow.createCell(OrderReportColumn.MODEL_NUMBER.getValue()).setCellValue("Model Number");
|
|
|
1099 |
headerRow.createCell(OrderReportColumn.COLOR.getValue()).setCellValue("Color");
|
|
|
1100 |
headerRow.createCell(OrderReportColumn.QUANTITY.getValue()).setCellValue("Quantity");
|
|
|
1101 |
headerRow.createCell(OrderReportColumn.UNIT_TRANSFER_PRICE.getValue()).setCellValue("Unit Transfer Price");
|
|
|
1102 |
headerRow.createCell(OrderReportColumn.UNIT_SELLING_PRICE.getValue()).setCellValue("Unit Selling Price");
|
|
|
1103 |
headerRow.createCell(OrderReportColumn.TOTAL_TRANSFER_PRICE.getValue()).setCellValue("Total Transfer Price");
|
|
|
1104 |
headerRow.createCell(OrderReportColumn.TOTAL_SELLING_PRICE.getValue()).setCellValue("Total Selling Price");
|
|
|
1105 |
headerRow.createCell(OrderReportColumn.CURRENT_STATUS.getValue()).setCellValue("Current Status");
|
|
|
1106 |
|
| 5386 |
phani.kuma |
1107 |
try {
|
|
|
1108 |
|
|
|
1109 |
Row contentRow = null;
|
|
|
1110 |
LineItem lineItem = null;
|
|
|
1111 |
|
|
|
1112 |
for (Order order: returnedOrders)
|
|
|
1113 |
{
|
|
|
1114 |
contentRow = sheet.createRow(rowCount ++);
|
|
|
1115 |
lineItem = order.getLineitems().get(0);
|
|
|
1116 |
|
|
|
1117 |
contentRow.createCell(OrderReportColumn.ORDER_ID.getValue()).setCellValue(order.getId());
|
|
|
1118 |
if(order.getOriginalOrderId() == 0) {
|
|
|
1119 |
contentRow.createCell(OrderReportColumn.ORIGINAL_ORDER_ID.getValue()).setCellValue(order.getId());
|
| 4875 |
varun.gupt |
1120 |
}
|
| 5386 |
phani.kuma |
1121 |
else {
|
|
|
1122 |
contentRow.createCell(OrderReportColumn.ORIGINAL_ORDER_ID.getValue()).setCellValue(order.getOriginalOrderId());
|
|
|
1123 |
}
|
|
|
1124 |
contentRow.createCell(OrderReportColumn.VENDOR_ID.getValue()).setCellValue(order.getVendorId());
|
|
|
1125 |
contentRow.createCell(OrderReportColumn.ORDER_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getCreated_timestamp())));
|
| 4875 |
varun.gupt |
1126 |
contentRow.createCell(OrderReportColumn.BILLING_NUMBER.getValue()).setCellValue(order.getInvoice_number());
|
|
|
1127 |
contentRow.createCell(OrderReportColumn.BILLING_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getBilling_timestamp())));
|
|
|
1128 |
contentRow.createCell(OrderReportColumn.DELIVERY_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getDelivery_timestamp())));
|
|
|
1129 |
contentRow.createCell(OrderReportColumn.BRAND.getValue()).setCellValue(getValueForEmptyString(lineItem.getBrand()));
|
|
|
1130 |
contentRow.createCell(OrderReportColumn.MODEL_NAME.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_name()));
|
|
|
1131 |
contentRow.createCell(OrderReportColumn.MODEL_NUMBER.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_number()));
|
|
|
1132 |
contentRow.createCell(OrderReportColumn.COLOR.getValue()).setCellValue(getValueForEmptyString(lineItem.getColor()));
|
|
|
1133 |
contentRow.createCell(OrderReportColumn.QUANTITY.getValue()).setCellValue(lineItem.getQuantity());
|
| 5386 |
phani.kuma |
1134 |
contentRow.createCell(OrderReportColumn.UNIT_TRANSFER_PRICE.getValue()).setCellValue(lineItem.getTransfer_price());
|
| 4875 |
varun.gupt |
1135 |
contentRow.createCell(OrderReportColumn.UNIT_SELLING_PRICE.getValue()).setCellValue(lineItem.getUnit_price());
|
| 5386 |
phani.kuma |
1136 |
contentRow.createCell(OrderReportColumn.TOTAL_TRANSFER_PRICE.getValue()).setCellValue(lineItem.getTransfer_price() * lineItem.getQuantity());
|
|
|
1137 |
contentRow.createCell(OrderReportColumn.TOTAL_SELLING_PRICE.getValue()).setCellValue(lineItem.getTotal_price());
|
|
|
1138 |
contentRow.createCell(OrderReportColumn.CURRENT_STATUS.getValue()).setCellValue(order.getStatus().name());
|
|
|
1139 |
}
|
|
|
1140 |
} catch (Exception e) {
|
|
|
1141 |
String errMsg = e.getMessage();
|
|
|
1142 |
logger.error(errMsg, e);
|
|
|
1143 |
addActionError(errMsg);
|
| 4875 |
varun.gupt |
1144 |
}
|
|
|
1145 |
}
|
|
|
1146 |
|
| 5386 |
phani.kuma |
1147 |
private void populateReshippedOrderSheet(Sheet sheet) {
|
|
|
1148 |
int rowCount = 0;
|
| 5020 |
varun.gupt |
1149 |
|
| 5189 |
varun.gupt |
1150 |
Row headerRow = sheet.createRow(rowCount ++);
|
|
|
1151 |
headerRow.createCell(OrderReportColumn.ORDER_ID.getValue()).setCellValue("Order Id");
|
| 5386 |
phani.kuma |
1152 |
headerRow.createCell(OrderReportColumn.ORIGINAL_ORDER_ID.getValue()).setCellValue("Original Order Id");
|
|
|
1153 |
headerRow.createCell(OrderReportColumn.VENDOR_ID.getValue()).setCellValue("Vendor Id");
|
| 5189 |
varun.gupt |
1154 |
headerRow.createCell(OrderReportColumn.ORDER_DATE.getValue()).setCellValue("Order Date");
|
|
|
1155 |
headerRow.createCell(OrderReportColumn.BILLING_NUMBER.getValue()).setCellValue("Billing Number");
|
|
|
1156 |
headerRow.createCell(OrderReportColumn.BILLING_DATE.getValue()).setCellValue("Billing Date");
|
|
|
1157 |
headerRow.createCell(OrderReportColumn.DELIVERY_DATE.getValue()).setCellValue("Delivery Date");
|
|
|
1158 |
headerRow.createCell(OrderReportColumn.BRAND.getValue()).setCellValue("Brand");
|
|
|
1159 |
headerRow.createCell(OrderReportColumn.MODEL_NAME.getValue()).setCellValue("Model Name");
|
|
|
1160 |
headerRow.createCell(OrderReportColumn.MODEL_NUMBER.getValue()).setCellValue("Model Number");
|
|
|
1161 |
headerRow.createCell(OrderReportColumn.COLOR.getValue()).setCellValue("Color");
|
|
|
1162 |
headerRow.createCell(OrderReportColumn.QUANTITY.getValue()).setCellValue("Quantity");
|
|
|
1163 |
headerRow.createCell(OrderReportColumn.UNIT_TRANSFER_PRICE.getValue()).setCellValue("Unit Transfer Price");
|
|
|
1164 |
headerRow.createCell(OrderReportColumn.UNIT_SELLING_PRICE.getValue()).setCellValue("Unit Selling Price");
|
|
|
1165 |
headerRow.createCell(OrderReportColumn.TOTAL_TRANSFER_PRICE.getValue()).setCellValue("Total Transfer Price");
|
|
|
1166 |
headerRow.createCell(OrderReportColumn.TOTAL_SELLING_PRICE.getValue()).setCellValue("Total Selling Price");
|
|
|
1167 |
headerRow.createCell(OrderReportColumn.CURRENT_STATUS.getValue()).setCellValue("Current Status");
|
|
|
1168 |
|
|
|
1169 |
try {
|
| 5386 |
phani.kuma |
1170 |
|
|
|
1171 |
Row contentRow = null;
|
|
|
1172 |
LineItem lineItem = null;
|
|
|
1173 |
|
|
|
1174 |
for (Order order: reshippedNonPayableOrders)
|
|
|
1175 |
{
|
|
|
1176 |
contentRow = sheet.createRow(rowCount ++);
|
|
|
1177 |
lineItem = order.getLineitems().get(0);
|
| 5189 |
varun.gupt |
1178 |
|
| 5386 |
phani.kuma |
1179 |
contentRow.createCell(OrderReportColumn.ORDER_ID.getValue()).setCellValue(order.getId());
|
|
|
1180 |
if(order.getOriginalOrderId() == 0) {
|
|
|
1181 |
contentRow.createCell(OrderReportColumn.ORIGINAL_ORDER_ID.getValue()).setCellValue(order.getId());
|
| 5189 |
varun.gupt |
1182 |
}
|
| 5386 |
phani.kuma |
1183 |
else {
|
|
|
1184 |
contentRow.createCell(OrderReportColumn.ORIGINAL_ORDER_ID.getValue()).setCellValue(order.getOriginalOrderId());
|
|
|
1185 |
}
|
|
|
1186 |
contentRow.createCell(OrderReportColumn.VENDOR_ID.getValue()).setCellValue(order.getVendorId());
|
| 5189 |
varun.gupt |
1187 |
contentRow.createCell(OrderReportColumn.ORDER_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getCreated_timestamp())));
|
|
|
1188 |
contentRow.createCell(OrderReportColumn.BILLING_NUMBER.getValue()).setCellValue(order.getInvoice_number());
|
|
|
1189 |
contentRow.createCell(OrderReportColumn.BILLING_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getBilling_timestamp())));
|
| 5386 |
phani.kuma |
1190 |
if(order.getDelivery_timestamp() != 0) {
|
|
|
1191 |
contentRow.createCell(OrderReportColumn.DELIVERY_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getDelivery_timestamp())));
|
|
|
1192 |
}
|
| 5189 |
varun.gupt |
1193 |
contentRow.createCell(OrderReportColumn.BRAND.getValue()).setCellValue(getValueForEmptyString(lineItem.getBrand()));
|
|
|
1194 |
contentRow.createCell(OrderReportColumn.MODEL_NAME.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_name()));
|
|
|
1195 |
contentRow.createCell(OrderReportColumn.MODEL_NUMBER.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_number()));
|
|
|
1196 |
contentRow.createCell(OrderReportColumn.COLOR.getValue()).setCellValue(getValueForEmptyString(lineItem.getColor()));
|
|
|
1197 |
contentRow.createCell(OrderReportColumn.QUANTITY.getValue()).setCellValue(lineItem.getQuantity());
|
|
|
1198 |
contentRow.createCell(OrderReportColumn.UNIT_TRANSFER_PRICE.getValue()).setCellValue(lineItem.getTransfer_price());
|
|
|
1199 |
contentRow.createCell(OrderReportColumn.UNIT_SELLING_PRICE.getValue()).setCellValue(lineItem.getUnit_price());
|
|
|
1200 |
contentRow.createCell(OrderReportColumn.TOTAL_TRANSFER_PRICE.getValue()).setCellValue(lineItem.getTransfer_price() * lineItem.getQuantity());
|
|
|
1201 |
contentRow.createCell(OrderReportColumn.TOTAL_SELLING_PRICE.getValue()).setCellValue(lineItem.getTotal_price());
|
|
|
1202 |
contentRow.createCell(OrderReportColumn.CURRENT_STATUS.getValue()).setCellValue(order.getStatusDescription());
|
|
|
1203 |
}
|
|
|
1204 |
} catch (Exception e) {
|
| 5386 |
phani.kuma |
1205 |
String errMsg = e.getMessage();
|
|
|
1206 |
logger.error(errMsg, e);
|
|
|
1207 |
addActionError(errMsg);
|
| 5189 |
varun.gupt |
1208 |
}
|
|
|
1209 |
}
|
|
|
1210 |
|
| 5386 |
phani.kuma |
1211 |
private void populateUnsettledOrderSheet(Sheet sheet) {
|
|
|
1212 |
int rowCount = 0;
|
| 5189 |
varun.gupt |
1213 |
|
| 5020 |
varun.gupt |
1214 |
Row headerRow = sheet.createRow(rowCount ++);
|
| 4600 |
varun.gupt |
1215 |
headerRow.createCell(OrderReportColumn.ORDER_ID.getValue()).setCellValue("Order Id");
|
| 5386 |
phani.kuma |
1216 |
headerRow.createCell(OrderReportColumn.ORIGINAL_ORDER_ID.getValue()).setCellValue("Original Order Id");
|
|
|
1217 |
headerRow.createCell(OrderReportColumn.VENDOR_ID.getValue()).setCellValue("Vendor Id");
|
| 4600 |
varun.gupt |
1218 |
headerRow.createCell(OrderReportColumn.ORDER_DATE.getValue()).setCellValue("Order Date");
|
|
|
1219 |
headerRow.createCell(OrderReportColumn.BILLING_NUMBER.getValue()).setCellValue("Billing Number");
|
|
|
1220 |
headerRow.createCell(OrderReportColumn.BILLING_DATE.getValue()).setCellValue("Billing Date");
|
|
|
1221 |
headerRow.createCell(OrderReportColumn.DELIVERY_DATE.getValue()).setCellValue("Delivery Date");
|
|
|
1222 |
headerRow.createCell(OrderReportColumn.BRAND.getValue()).setCellValue("Brand");
|
|
|
1223 |
headerRow.createCell(OrderReportColumn.MODEL_NAME.getValue()).setCellValue("Model Name");
|
|
|
1224 |
headerRow.createCell(OrderReportColumn.MODEL_NUMBER.getValue()).setCellValue("Model Number");
|
|
|
1225 |
headerRow.createCell(OrderReportColumn.COLOR.getValue()).setCellValue("Color");
|
|
|
1226 |
headerRow.createCell(OrderReportColumn.QUANTITY.getValue()).setCellValue("Quantity");
|
|
|
1227 |
headerRow.createCell(OrderReportColumn.UNIT_TRANSFER_PRICE.getValue()).setCellValue("Unit Transfer Price");
|
|
|
1228 |
headerRow.createCell(OrderReportColumn.UNIT_SELLING_PRICE.getValue()).setCellValue("Unit Selling Price");
|
|
|
1229 |
headerRow.createCell(OrderReportColumn.TOTAL_TRANSFER_PRICE.getValue()).setCellValue("Total Transfer Price");
|
|
|
1230 |
headerRow.createCell(OrderReportColumn.TOTAL_SELLING_PRICE.getValue()).setCellValue("Total Selling Price");
|
|
|
1231 |
headerRow.createCell(OrderReportColumn.CURRENT_STATUS.getValue()).setCellValue("Current Status");
|
|
|
1232 |
headerRow.createCell(OrderReportColumn.PAYMENT_TYPE.getValue()).setCellValue("Payment Type");
|
| 4745 |
varun.gupt |
1233 |
headerRow.createCell(OrderReportColumn.PAYMENT_STATUS.getValue()).setCellValue("Payment Status");
|
| 4600 |
varun.gupt |
1234 |
headerRow.createCell(OrderReportColumn.PAYMENT_ID.getValue()).setCellValue("Payment Id");
|
|
|
1235 |
headerRow.createCell(OrderReportColumn.COUPON_CODE.getValue()).setCellValue("Coupon Code");
|
|
|
1236 |
|
| 5386 |
phani.kuma |
1237 |
outputPaymentUnsettledOrdersRows(sheet, rowCount);
|
|
|
1238 |
}
|
|
|
1239 |
|
|
|
1240 |
private int outputPaymentUnsettledOrdersRows(Sheet sheet, int rowCount) {
|
|
|
1241 |
|
|
|
1242 |
try {
|
|
|
1243 |
PaymentClient psc = new PaymentClient();
|
|
|
1244 |
in.shop2020.payments.PaymentService.Client paymentClient = psc.getClient();
|
|
|
1245 |
|
|
|
1246 |
TransactionClient tsc = new TransactionClient();
|
| 4600 |
varun.gupt |
1247 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
| 5189 |
varun.gupt |
1248 |
|
| 5386 |
phani.kuma |
1249 |
Row contentRow = null;
|
|
|
1250 |
LineItem lineItem = null;
|
|
|
1251 |
Payment pmt = null;
|
|
|
1252 |
Transaction txn = null;
|
|
|
1253 |
|
|
|
1254 |
for (Order order: unsettledOrders)
|
|
|
1255 |
{
|
|
|
1256 |
contentRow = sheet.createRow(rowCount ++);
|
|
|
1257 |
lineItem = order.getLineitems().get(0);
|
|
|
1258 |
pmt = null;
|
|
|
1259 |
txn = null;
|
|
|
1260 |
|
|
|
1261 |
try {
|
|
|
1262 |
if(order.isCod()) {
|
|
|
1263 |
try {
|
|
|
1264 |
pmt = paymentClient.getPaymentForTxnId(order.getTransactionId()).get(0);
|
|
|
1265 |
} catch (TTransportException e) {
|
|
|
1266 |
psc = new PaymentClient();
|
|
|
1267 |
paymentClient = psc.getClient();
|
|
|
1268 |
pmt = paymentClient.getPaymentForTxnId(order.getTransactionId()).get(0);
|
|
|
1269 |
}
|
|
|
1270 |
|
|
|
1271 |
try {
|
|
|
1272 |
txn = transactionClient.getTransaction(order.getTransactionId());
|
|
|
1273 |
} catch (TTransportException e) {
|
|
|
1274 |
tsc = new TransactionClient();
|
|
|
1275 |
transactionClient = tsc.getClient();
|
|
|
1276 |
txn = transactionClient.getTransaction(order.getTransactionId());
|
|
|
1277 |
}
|
|
|
1278 |
}
|
|
|
1279 |
else {
|
|
|
1280 |
try {
|
|
|
1281 |
pmt = paymentClient.getSuccessfulPaymentForTxnId(order.getTransactionId());
|
|
|
1282 |
} catch (TTransportException e) {
|
|
|
1283 |
psc = new PaymentClient();
|
|
|
1284 |
paymentClient = psc.getClient();
|
|
|
1285 |
pmt = paymentClient.getSuccessfulPaymentForTxnId(order.getTransactionId());
|
|
|
1286 |
}
|
|
|
1287 |
|
|
|
1288 |
try {
|
|
|
1289 |
txn = transactionClient.getTransaction(pmt.getMerchantTxnId());
|
|
|
1290 |
} catch (TTransportException e) {
|
|
|
1291 |
tsc = new TransactionClient();
|
|
|
1292 |
transactionClient = tsc.getClient();
|
|
|
1293 |
txn = transactionClient.getTransaction(pmt.getMerchantTxnId());
|
|
|
1294 |
}
|
|
|
1295 |
}
|
|
|
1296 |
|
|
|
1297 |
contentRow.createCell(OrderReportColumn.ORDER_ID.getValue()).setCellValue(order.getId());
|
|
|
1298 |
if(order.getOriginalOrderId() == 0) {
|
|
|
1299 |
contentRow.createCell(OrderReportColumn.ORIGINAL_ORDER_ID.getValue()).setCellValue(order.getId());
|
|
|
1300 |
}
|
|
|
1301 |
else {
|
|
|
1302 |
contentRow.createCell(OrderReportColumn.ORIGINAL_ORDER_ID.getValue()).setCellValue(order.getOriginalOrderId());
|
|
|
1303 |
}
|
|
|
1304 |
contentRow.createCell(OrderReportColumn.VENDOR_ID.getValue()).setCellValue(order.getVendorId());
|
|
|
1305 |
contentRow.createCell(OrderReportColumn.ORDER_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getCreated_timestamp())));
|
|
|
1306 |
contentRow.createCell(OrderReportColumn.BILLING_NUMBER.getValue()).setCellValue(order.getInvoice_number());
|
|
|
1307 |
contentRow.createCell(OrderReportColumn.BILLING_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getBilling_timestamp())));
|
|
|
1308 |
if(order.getDelivery_timestamp() != 0) {
|
|
|
1309 |
contentRow.createCell(OrderReportColumn.DELIVERY_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getDelivery_timestamp())));
|
|
|
1310 |
}
|
|
|
1311 |
contentRow.createCell(OrderReportColumn.BRAND.getValue()).setCellValue(getValueForEmptyString(lineItem.getBrand()));
|
|
|
1312 |
contentRow.createCell(OrderReportColumn.MODEL_NAME.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_name()));
|
|
|
1313 |
contentRow.createCell(OrderReportColumn.MODEL_NUMBER.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_number()));
|
|
|
1314 |
contentRow.createCell(OrderReportColumn.COLOR.getValue()).setCellValue(getValueForEmptyString(lineItem.getColor()));
|
|
|
1315 |
contentRow.createCell(OrderReportColumn.QUANTITY.getValue()).setCellValue(lineItem.getQuantity());
|
|
|
1316 |
contentRow.createCell(OrderReportColumn.UNIT_TRANSFER_PRICE.getValue()).setCellValue(lineItem.getTransfer_price());
|
|
|
1317 |
contentRow.createCell(OrderReportColumn.UNIT_SELLING_PRICE.getValue()).setCellValue(lineItem.getUnit_price());
|
|
|
1318 |
contentRow.createCell(OrderReportColumn.TOTAL_TRANSFER_PRICE.getValue()).setCellValue(lineItem.getTransfer_price() * lineItem.getQuantity());
|
|
|
1319 |
contentRow.createCell(OrderReportColumn.TOTAL_SELLING_PRICE.getValue()).setCellValue(lineItem.getTotal_price());
|
|
|
1320 |
contentRow.createCell(OrderReportColumn.CURRENT_STATUS.getValue()).setCellValue(order.getStatus().name());
|
|
|
1321 |
|
|
|
1322 |
if(pmt.getGatewayId() == 4) {
|
|
|
1323 |
contentRow.createCell(OrderReportColumn.PAYMENT_TYPE.getValue()).setCellValue("COD-" + codProviders.get(order.getLogistics_provider_id()));
|
|
|
1324 |
}
|
|
|
1325 |
else {
|
|
|
1326 |
contentRow.createCell(OrderReportColumn.PAYMENT_TYPE.getValue()).setCellValue(paymentGateways.get(pmt.getGatewayId()));
|
|
|
1327 |
}
|
|
|
1328 |
contentRow.createCell(OrderReportColumn.PAYMENT_STATUS.getValue()).setCellValue(pmt.getStatus().name());
|
|
|
1329 |
contentRow.createCell(OrderReportColumn.PAYMENT_ID.getValue()).setCellValue(pmt.getPaymentId());
|
|
|
1330 |
contentRow.createCell(OrderReportColumn.COUPON_CODE.getValue()).setCellValue(txn.getCoupon_code());
|
|
|
1331 |
|
|
|
1332 |
} catch (Exception e) {
|
|
|
1333 |
contentRow.createCell(OrderReportColumn.ORDER_ID.getValue()).setCellValue(order.getId());
|
|
|
1334 |
String errMsg = "error occured in outputPaymentUnsettledOrdersRows during " + order.getId();
|
|
|
1335 |
logger.error(errMsg, e);
|
|
|
1336 |
addActionError(errMsg);
|
| 5020 |
varun.gupt |
1337 |
}
|
| 4600 |
varun.gupt |
1338 |
}
|
| 5386 |
phani.kuma |
1339 |
} catch (Exception e) {
|
|
|
1340 |
String errMsg = e.getMessage();
|
|
|
1341 |
logger.error(errMsg, e);
|
|
|
1342 |
addActionError(errMsg);
|
| 5020 |
varun.gupt |
1343 |
}
|
| 5386 |
phani.kuma |
1344 |
|
|
|
1345 |
return rowCount;
|
| 5020 |
varun.gupt |
1346 |
}
|
|
|
1347 |
|
| 5386 |
phani.kuma |
1348 |
private void populateSettledOrderSheet(Sheet sheet, boolean total) {
|
|
|
1349 |
int rowCount = 0;
|
| 5020 |
varun.gupt |
1350 |
|
| 5386 |
phani.kuma |
1351 |
Row headerRow = sheet.createRow(rowCount ++);
|
|
|
1352 |
headerRow.createCell(OrderReportColumn.ORDER_ID.getValue()).setCellValue("Order Id");
|
|
|
1353 |
headerRow.createCell(OrderReportColumn.ORIGINAL_ORDER_ID.getValue()).setCellValue("Original Order Id");
|
|
|
1354 |
headerRow.createCell(OrderReportColumn.VENDOR_ID.getValue()).setCellValue("Vendor Id");
|
|
|
1355 |
headerRow.createCell(OrderReportColumn.ORDER_DATE.getValue()).setCellValue("Order Date");
|
|
|
1356 |
headerRow.createCell(OrderReportColumn.BILLING_NUMBER.getValue()).setCellValue("Billing Number");
|
|
|
1357 |
headerRow.createCell(OrderReportColumn.BILLING_DATE.getValue()).setCellValue("Billing Date");
|
|
|
1358 |
headerRow.createCell(OrderReportColumn.DELIVERY_DATE.getValue()).setCellValue("Delivery Date");
|
|
|
1359 |
headerRow.createCell(OrderReportColumn.BRAND.getValue()).setCellValue("Brand");
|
|
|
1360 |
headerRow.createCell(OrderReportColumn.MODEL_NAME.getValue()).setCellValue("Model Name");
|
|
|
1361 |
headerRow.createCell(OrderReportColumn.MODEL_NUMBER.getValue()).setCellValue("Model Number");
|
|
|
1362 |
headerRow.createCell(OrderReportColumn.COLOR.getValue()).setCellValue("Color");
|
|
|
1363 |
headerRow.createCell(OrderReportColumn.QUANTITY.getValue()).setCellValue("Quantity");
|
|
|
1364 |
headerRow.createCell(OrderReportColumn.UNIT_TRANSFER_PRICE.getValue()).setCellValue("Unit Transfer Price");
|
|
|
1365 |
headerRow.createCell(OrderReportColumn.UNIT_SELLING_PRICE.getValue()).setCellValue("Unit Selling Price");
|
|
|
1366 |
headerRow.createCell(OrderReportColumn.TOTAL_TRANSFER_PRICE.getValue()).setCellValue("Total Transfer Price");
|
|
|
1367 |
headerRow.createCell(OrderReportColumn.TOTAL_SELLING_PRICE.getValue()).setCellValue("Total Selling Price");
|
|
|
1368 |
headerRow.createCell(OrderReportColumn.CURRENT_STATUS.getValue()).setCellValue("Current Status");
|
|
|
1369 |
headerRow.createCell(OrderReportColumn.PAYMENT_TYPE.getValue()).setCellValue("Payment Type");
|
|
|
1370 |
headerRow.createCell(OrderReportColumn.PAYMENT_STATUS.getValue()).setCellValue("Payment Status");
|
|
|
1371 |
headerRow.createCell(OrderReportColumn.PAYMENT_ID.getValue()).setCellValue("Payment Reference");
|
|
|
1372 |
headerRow.createCell(OrderReportColumn.COUPON_CODE.getValue()).setCellValue("Coupon Code");
|
|
|
1373 |
headerRow.createCell(OrderReportColumn.SETTLEMENT_DATE.getValue()).setCellValue("Settlement Date");
|
|
|
1374 |
headerRow.createCell(OrderReportColumn.SERVICE_TAX.getValue()).setCellValue("Service Tax");
|
|
|
1375 |
headerRow.createCell(OrderReportColumn.OTHER_CHARGES.getValue()).setCellValue("Other Charges");
|
|
|
1376 |
headerRow.createCell(OrderReportColumn.NET_COLLECTION.getValue()).setCellValue("Net Collection");
|
|
|
1377 |
headerRow.createCell(OrderReportColumn.USER_PAYABLE_AMOUNT.getValue()).setCellValue("User Payable Amount");
|
|
|
1378 |
|
|
|
1379 |
rowCount = outputPaymentSettledOrdersRows(sheet, rowCount);
|
|
|
1380 |
rowCount = outputPaymentNotRequiredOrdersRows(sheet, rowCount);
|
|
|
1381 |
|
|
|
1382 |
if(total) {
|
|
|
1383 |
rowCount = outputPaymentUnsettledOrdersRows(sheet, rowCount);
|
|
|
1384 |
}
|
|
|
1385 |
}
|
|
|
1386 |
|
|
|
1387 |
private int outputPaymentSettledOrdersRows(Sheet sheet, int rowCount) {
|
| 5020 |
varun.gupt |
1388 |
|
| 5386 |
phani.kuma |
1389 |
try {
|
|
|
1390 |
PaymentClient psc = new PaymentClient();
|
|
|
1391 |
in.shop2020.payments.PaymentService.Client paymentClient = psc.getClient();
|
|
|
1392 |
|
|
|
1393 |
TransactionClient tsc = new TransactionClient();
|
|
|
1394 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
|
|
1395 |
|
|
|
1396 |
Row contentRow = null;
|
|
|
1397 |
Order order = null;
|
|
|
1398 |
PaymentSettlement paymentSettlement = null;
|
|
|
1399 |
Payment pmt = null;
|
|
|
1400 |
Transaction txn = null;
|
|
|
1401 |
LineItem lineItem = null;
|
|
|
1402 |
|
|
|
1403 |
for (Entry<Order, PaymentSettlement> entry : paymentSettledOrdersMap.entrySet())
|
|
|
1404 |
{
|
|
|
1405 |
contentRow = sheet.createRow(rowCount ++);
|
|
|
1406 |
order = entry.getKey();
|
|
|
1407 |
paymentSettlement = entry.getValue();
|
|
|
1408 |
pmt = null;
|
|
|
1409 |
txn = null;
|
| 5020 |
varun.gupt |
1410 |
|
| 5386 |
phani.kuma |
1411 |
try {
|
|
|
1412 |
if(order.isCod()) {
|
|
|
1413 |
try {
|
|
|
1414 |
pmt = paymentClient.getPaymentForTxnId(order.getTransactionId()).get(0);
|
|
|
1415 |
} catch (TTransportException e) {
|
|
|
1416 |
psc = new PaymentClient();
|
|
|
1417 |
paymentClient = psc.getClient();
|
|
|
1418 |
pmt = paymentClient.getPaymentForTxnId(order.getTransactionId()).get(0);
|
|
|
1419 |
}
|
|
|
1420 |
|
|
|
1421 |
try {
|
|
|
1422 |
txn = transactionClient.getTransaction(order.getTransactionId());
|
|
|
1423 |
} catch (TTransportException e) {
|
|
|
1424 |
tsc = new TransactionClient();
|
|
|
1425 |
transactionClient = tsc.getClient();
|
|
|
1426 |
txn = transactionClient.getTransaction(order.getTransactionId());
|
|
|
1427 |
}
|
|
|
1428 |
}
|
|
|
1429 |
else {
|
|
|
1430 |
try {
|
|
|
1431 |
pmt = paymentClient.getSuccessfulPaymentForTxnId(order.getTransactionId());
|
|
|
1432 |
} catch (TTransportException e) {
|
|
|
1433 |
psc = new PaymentClient();
|
|
|
1434 |
paymentClient = psc.getClient();
|
|
|
1435 |
pmt = paymentClient.getSuccessfulPaymentForTxnId(order.getTransactionId());
|
|
|
1436 |
}
|
|
|
1437 |
|
|
|
1438 |
try {
|
|
|
1439 |
txn = transactionClient.getTransaction(pmt.getMerchantTxnId());
|
|
|
1440 |
} catch (TTransportException e) {
|
|
|
1441 |
tsc = new TransactionClient();
|
|
|
1442 |
transactionClient = tsc.getClient();
|
|
|
1443 |
txn = transactionClient.getTransaction(pmt.getMerchantTxnId());
|
|
|
1444 |
}
|
|
|
1445 |
}
|
|
|
1446 |
lineItem = order.getLineitems().get(0);
|
|
|
1447 |
|
|
|
1448 |
contentRow.createCell(OrderReportColumn.ORDER_ID.getValue()).setCellValue(order.getId());
|
|
|
1449 |
if(order.getOriginalOrderId() == 0) {
|
|
|
1450 |
contentRow.createCell(OrderReportColumn.ORIGINAL_ORDER_ID.getValue()).setCellValue(order.getId());
|
|
|
1451 |
}
|
|
|
1452 |
else {
|
|
|
1453 |
contentRow.createCell(OrderReportColumn.ORIGINAL_ORDER_ID.getValue()).setCellValue(order.getOriginalOrderId());
|
|
|
1454 |
}
|
|
|
1455 |
contentRow.createCell(OrderReportColumn.VENDOR_ID.getValue()).setCellValue(order.getVendorId());
|
|
|
1456 |
contentRow.createCell(OrderReportColumn.ORDER_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getCreated_timestamp())));
|
|
|
1457 |
contentRow.createCell(OrderReportColumn.BILLING_NUMBER.getValue()).setCellValue(order.getInvoice_number());
|
|
|
1458 |
contentRow.createCell(OrderReportColumn.BILLING_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getBilling_timestamp())));
|
|
|
1459 |
if(order.getDelivery_timestamp() != 0) {
|
|
|
1460 |
contentRow.createCell(OrderReportColumn.DELIVERY_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getDelivery_timestamp())));
|
|
|
1461 |
}
|
|
|
1462 |
contentRow.createCell(OrderReportColumn.BRAND.getValue()).setCellValue(getValueForEmptyString(lineItem.getBrand()));
|
|
|
1463 |
contentRow.createCell(OrderReportColumn.MODEL_NAME.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_name()));
|
|
|
1464 |
contentRow.createCell(OrderReportColumn.MODEL_NUMBER.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_number()));
|
|
|
1465 |
contentRow.createCell(OrderReportColumn.COLOR.getValue()).setCellValue(getValueForEmptyString(lineItem.getColor()));
|
|
|
1466 |
contentRow.createCell(OrderReportColumn.QUANTITY.getValue()).setCellValue(lineItem.getQuantity());
|
|
|
1467 |
contentRow.createCell(OrderReportColumn.UNIT_TRANSFER_PRICE.getValue()).setCellValue(lineItem.getTransfer_price());
|
|
|
1468 |
contentRow.createCell(OrderReportColumn.UNIT_SELLING_PRICE.getValue()).setCellValue(lineItem.getUnit_price());
|
|
|
1469 |
contentRow.createCell(OrderReportColumn.TOTAL_TRANSFER_PRICE.getValue()).setCellValue(lineItem.getTransfer_price() * lineItem.getQuantity());
|
|
|
1470 |
contentRow.createCell(OrderReportColumn.TOTAL_SELLING_PRICE.getValue()).setCellValue(lineItem.getTotal_price());
|
|
|
1471 |
contentRow.createCell(OrderReportColumn.CURRENT_STATUS.getValue()).setCellValue(order.getStatus().name());
|
|
|
1472 |
|
|
|
1473 |
if(pmt.getGatewayId() == 4) {
|
|
|
1474 |
contentRow.createCell(OrderReportColumn.PAYMENT_TYPE.getValue()).setCellValue("COD-" + codProviders.get(order.getLogistics_provider_id()));
|
|
|
1475 |
contentRow.createCell(OrderReportColumn.SERVICE_TAX.getValue()).setCellValue(paymentSettlement.getServiceTax());
|
|
|
1476 |
contentRow.createCell(OrderReportColumn.OTHER_CHARGES.getValue()).setCellValue(paymentSettlement.getOtherCharges());
|
|
|
1477 |
contentRow.createCell(OrderReportColumn.NET_COLLECTION.getValue()).setCellValue(paymentSettlement.getNetCollection());
|
|
|
1478 |
contentRow.createCell(OrderReportColumn.PAYMENT_ID.getValue()).setCellValue(paymentSettlement.getReferenceId());
|
|
|
1479 |
}
|
|
|
1480 |
else {
|
|
|
1481 |
contentRow.createCell(OrderReportColumn.PAYMENT_TYPE.getValue()).setCellValue(paymentGateways.get(pmt.getGatewayId()));
|
|
|
1482 |
contentRow.createCell(OrderReportColumn.SERVICE_TAX.getValue()).setCellValue((paymentSettlement.getServiceTax() * order.getTotal_amount()) / pmt.getAmount());
|
|
|
1483 |
contentRow.createCell(OrderReportColumn.OTHER_CHARGES.getValue()).setCellValue((paymentSettlement.getOtherCharges() * order.getTotal_amount()) / pmt.getAmount());
|
|
|
1484 |
contentRow.createCell(OrderReportColumn.NET_COLLECTION.getValue()).setCellValue((paymentSettlement.getNetCollection() * order.getTotal_amount()) / pmt.getAmount());
|
|
|
1485 |
contentRow.createCell(OrderReportColumn.PAYMENT_ID.getValue()).setCellValue(pmt.getPaymentId());
|
|
|
1486 |
}
|
|
|
1487 |
contentRow.createCell(OrderReportColumn.PAYMENT_STATUS.getValue()).setCellValue(pmt.getStatus().name());
|
|
|
1488 |
contentRow.createCell(OrderReportColumn.SETTLEMENT_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(paymentSettlement.getSettlementDate())));
|
|
|
1489 |
contentRow.createCell(OrderReportColumn.USER_PAYABLE_AMOUNT.getValue()).setCellValue(order.getTotal_amount());
|
|
|
1490 |
contentRow.createCell(OrderReportColumn.COUPON_CODE.getValue()).setCellValue(txn.getCoupon_code());
|
|
|
1491 |
|
|
|
1492 |
} catch (Exception e) {
|
|
|
1493 |
contentRow.createCell(OrderReportColumn.ORDER_ID.getValue()).setCellValue(order.getId());
|
|
|
1494 |
String errMsg = "error occured in outputPaymentSettledOrdersRows during " + order.getId();
|
|
|
1495 |
logger.error(errMsg, e);
|
|
|
1496 |
addActionError(errMsg);
|
|
|
1497 |
}
|
| 4715 |
varun.gupt |
1498 |
}
|
| 5386 |
phani.kuma |
1499 |
} catch (Exception e) {
|
|
|
1500 |
String errMsg = e.getMessage();
|
|
|
1501 |
logger.error(errMsg, e);
|
|
|
1502 |
addActionError(errMsg);
|
| 5020 |
varun.gupt |
1503 |
}
|
| 5386 |
phani.kuma |
1504 |
|
|
|
1505 |
return rowCount;
|
| 5020 |
varun.gupt |
1506 |
}
|
| 5098 |
varun.gupt |
1507 |
|
| 5386 |
phani.kuma |
1508 |
private int outputPaymentNotRequiredOrdersRows(Sheet sheet, int rowCount) {
|
| 5020 |
varun.gupt |
1509 |
|
| 5386 |
phani.kuma |
1510 |
try {
|
|
|
1511 |
|
|
|
1512 |
Row contentRow = null;
|
|
|
1513 |
LineItem lineItem = null;
|
|
|
1514 |
|
|
|
1515 |
for (Order order: userPaymentNotRequiredOrders)
|
|
|
1516 |
{
|
|
|
1517 |
contentRow = sheet.createRow(rowCount ++);
|
|
|
1518 |
lineItem = order.getLineitems().get(0);
|
| 5189 |
varun.gupt |
1519 |
|
| 5386 |
phani.kuma |
1520 |
contentRow.createCell(OrderReportColumn.ORDER_ID.getValue()).setCellValue(order.getId());
|
|
|
1521 |
if(order.getOriginalOrderId() == 0) {
|
|
|
1522 |
contentRow.createCell(OrderReportColumn.ORIGINAL_ORDER_ID.getValue()).setCellValue(order.getId());
|
| 5189 |
varun.gupt |
1523 |
}
|
| 5386 |
phani.kuma |
1524 |
else {
|
|
|
1525 |
contentRow.createCell(OrderReportColumn.ORIGINAL_ORDER_ID.getValue()).setCellValue(order.getOriginalOrderId());
|
|
|
1526 |
}
|
|
|
1527 |
contentRow.createCell(OrderReportColumn.VENDOR_ID.getValue()).setCellValue(order.getVendorId());
|
| 5020 |
varun.gupt |
1528 |
contentRow.createCell(OrderReportColumn.ORDER_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getCreated_timestamp())));
|
|
|
1529 |
contentRow.createCell(OrderReportColumn.BILLING_NUMBER.getValue()).setCellValue(order.getInvoice_number());
|
|
|
1530 |
contentRow.createCell(OrderReportColumn.BILLING_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getBilling_timestamp())));
|
| 5386 |
phani.kuma |
1531 |
if(order.getDelivery_timestamp() != 0) {
|
|
|
1532 |
contentRow.createCell(OrderReportColumn.DELIVERY_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(order.getDelivery_timestamp())));
|
|
|
1533 |
}
|
| 5020 |
varun.gupt |
1534 |
contentRow.createCell(OrderReportColumn.BRAND.getValue()).setCellValue(getValueForEmptyString(lineItem.getBrand()));
|
|
|
1535 |
contentRow.createCell(OrderReportColumn.MODEL_NAME.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_name()));
|
|
|
1536 |
contentRow.createCell(OrderReportColumn.MODEL_NUMBER.getValue()).setCellValue(getValueForEmptyString(lineItem.getModel_number()));
|
|
|
1537 |
contentRow.createCell(OrderReportColumn.COLOR.getValue()).setCellValue(getValueForEmptyString(lineItem.getColor()));
|
|
|
1538 |
contentRow.createCell(OrderReportColumn.QUANTITY.getValue()).setCellValue(lineItem.getQuantity());
|
|
|
1539 |
contentRow.createCell(OrderReportColumn.UNIT_TRANSFER_PRICE.getValue()).setCellValue(lineItem.getTransfer_price());
|
|
|
1540 |
contentRow.createCell(OrderReportColumn.UNIT_SELLING_PRICE.getValue()).setCellValue(lineItem.getUnit_price());
|
|
|
1541 |
contentRow.createCell(OrderReportColumn.TOTAL_TRANSFER_PRICE.getValue()).setCellValue(lineItem.getTransfer_price() * lineItem.getQuantity());
|
|
|
1542 |
contentRow.createCell(OrderReportColumn.TOTAL_SELLING_PRICE.getValue()).setCellValue(lineItem.getTotal_price());
|
| 5386 |
phani.kuma |
1543 |
contentRow.createCell(OrderReportColumn.CURRENT_STATUS.getValue()).setCellValue(order.getStatus().name());
|
|
|
1544 |
contentRow.createCell(OrderReportColumn.USER_PAYABLE_AMOUNT.getValue()).setCellValue(0);
|
| 5020 |
varun.gupt |
1545 |
}
|
| 5386 |
phani.kuma |
1546 |
} catch (Exception e) {
|
|
|
1547 |
String errMsg = e.getMessage();
|
|
|
1548 |
logger.error(errMsg, e);
|
|
|
1549 |
addActionError(errMsg);
|
| 4600 |
varun.gupt |
1550 |
}
|
| 5020 |
varun.gupt |
1551 |
|
| 5386 |
phani.kuma |
1552 |
return rowCount;
|
| 5020 |
varun.gupt |
1553 |
}
|
|
|
1554 |
|
| 5098 |
varun.gupt |
1555 |
private void initiatializeDashboard() {
|
|
|
1556 |
try {
|
|
|
1557 |
OrderStatusGroups orderStatusGroups = new OrderStatusGroups();
|
|
|
1558 |
refundOrderStatuses = orderStatusGroups.getRefundedOrders();
|
|
|
1559 |
|
| 5386 |
phani.kuma |
1560 |
CatalogClient csc = new CatalogClient();
|
|
|
1561 |
in.shop2020.model.v1.catalog.InventoryService.Client catalogClient = csc.getClient();
|
| 5098 |
varun.gupt |
1562 |
vendors = catalogClient.getAllVendors();
|
|
|
1563 |
|
|
|
1564 |
TransactionClient tsc = new TransactionClient();
|
|
|
1565 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
|
|
1566 |
ebsSettlementSummaries = transactionClient.getEBSSettlementSummaries();
|
|
|
1567 |
|
| 5386 |
phani.kuma |
1568 |
} catch (Exception e) {
|
|
|
1569 |
String errMsg = e.getMessage();
|
|
|
1570 |
logger.error(errMsg, e);
|
|
|
1571 |
addActionError(errMsg);
|
| 5098 |
varun.gupt |
1572 |
}
|
|
|
1573 |
}
|
|
|
1574 |
|
| 4600 |
varun.gupt |
1575 |
public List<Vendor> getAllVendors() {
|
|
|
1576 |
return this.vendors;
|
|
|
1577 |
}
|
|
|
1578 |
|
|
|
1579 |
private String getValueForEmptyString(String s){
|
|
|
1580 |
if(s==null || s.equals(""))
|
|
|
1581 |
return "-";
|
|
|
1582 |
else
|
|
|
1583 |
return s;
|
|
|
1584 |
}
|
|
|
1585 |
|
|
|
1586 |
private String getVendorName(long vendorId) {
|
|
|
1587 |
for (Vendor vendor: vendors) {
|
|
|
1588 |
if (vendor.getId() == vendorId) return vendor.getName();
|
|
|
1589 |
}
|
|
|
1590 |
return null;
|
|
|
1591 |
}
|
|
|
1592 |
|
| 5386 |
phani.kuma |
1593 |
public File getHdfcSettlementReport() {
|
| 4600 |
varun.gupt |
1594 |
return hdfcSettlementReport;
|
|
|
1595 |
}
|
|
|
1596 |
|
|
|
1597 |
public void setHdfcSettlementReport(File hdfcSettlementReport) {
|
|
|
1598 |
this.hdfcSettlementReport = hdfcSettlementReport;
|
|
|
1599 |
}
|
|
|
1600 |
|
|
|
1601 |
public File getEbsSettlementSummary() {
|
|
|
1602 |
return ebsSettlementSummary;
|
|
|
1603 |
}
|
|
|
1604 |
|
|
|
1605 |
public void setEbsSettlementSummary(File ebsSettlementSummary) {
|
|
|
1606 |
this.ebsSettlementSummary = ebsSettlementSummary;
|
|
|
1607 |
}
|
|
|
1608 |
|
|
|
1609 |
public File getEbsSettlementReport() {
|
|
|
1610 |
return ebsSettlementReport;
|
|
|
1611 |
}
|
|
|
1612 |
|
|
|
1613 |
public void setEbsSettlementReport(File ebsSettlementReport) {
|
|
|
1614 |
this.ebsSettlementReport = ebsSettlementReport;
|
|
|
1615 |
}
|
|
|
1616 |
|
|
|
1617 |
public String getBluedartSettlementDate() {
|
|
|
1618 |
return bluedartSettlementDate;
|
|
|
1619 |
}
|
|
|
1620 |
|
|
|
1621 |
public void setBluedartSettlementDate(String bluedartSettlementDate) {
|
|
|
1622 |
this.bluedartSettlementDate = bluedartSettlementDate;
|
|
|
1623 |
}
|
|
|
1624 |
|
|
|
1625 |
public File getBluedartSettlementReport() {
|
|
|
1626 |
return bluedartSettlementReport;
|
|
|
1627 |
}
|
|
|
1628 |
|
|
|
1629 |
public void setBluedartSettlementReport(File bluedartSettlementReport) {
|
|
|
1630 |
this.bluedartSettlementReport = bluedartSettlementReport;
|
|
|
1631 |
}
|
|
|
1632 |
|
| 4715 |
varun.gupt |
1633 |
public String getAramexSettlementDate() {
|
|
|
1634 |
return this.aramexSettlementDate;
|
|
|
1635 |
}
|
|
|
1636 |
|
|
|
1637 |
public void setAramexSettlementDate(String aramexSettlementDate) {
|
|
|
1638 |
this.aramexSettlementDate = aramexSettlementDate;
|
|
|
1639 |
}
|
|
|
1640 |
|
|
|
1641 |
public void setAramexSettlementReport(File aramexSettlementReport) {
|
|
|
1642 |
this.aramexSettlementReport = aramexSettlementReport;
|
|
|
1643 |
}
|
|
|
1644 |
|
|
|
1645 |
public File getAramexSettlementReport() {
|
|
|
1646 |
return aramexSettlementReport;
|
|
|
1647 |
}
|
|
|
1648 |
|
| 4600 |
varun.gupt |
1649 |
@Override
|
| 5386 |
phani.kuma |
1650 |
public void setServletContext(ServletContext context) {
|
| 4600 |
varun.gupt |
1651 |
this.context = context;
|
|
|
1652 |
}
|
|
|
1653 |
|
|
|
1654 |
public String getServletContextPath() {
|
|
|
1655 |
return context.getContextPath();
|
|
|
1656 |
}
|
|
|
1657 |
|
|
|
1658 |
@Override
|
|
|
1659 |
public void setServletResponse(HttpServletResponse response) {
|
|
|
1660 |
this.response = response;
|
|
|
1661 |
}
|
|
|
1662 |
|
|
|
1663 |
@Override
|
|
|
1664 |
public void setServletRequest(HttpServletRequest request) {
|
|
|
1665 |
this.request = request;
|
|
|
1666 |
}
|
|
|
1667 |
|
| 5386 |
phani.kuma |
1668 |
public Map<Long, String> getEBSSettlementSummaries() {
|
| 4600 |
varun.gupt |
1669 |
return ebsSettlementSummaries;
|
|
|
1670 |
}
|
| 5386 |
phani.kuma |
1671 |
|
|
|
1672 |
public void setOrderIdsToBeMarked(File orderIdsToBeMarked) {
|
|
|
1673 |
this.orderIdsToBeMarked = orderIdsToBeMarked;
|
| 5098 |
varun.gupt |
1674 |
}
|
|
|
1675 |
|
| 5386 |
phani.kuma |
1676 |
public File getOrderIdsToBeMarked() {
|
|
|
1677 |
return orderIdsToBeMarked;
|
| 5098 |
varun.gupt |
1678 |
}
|
| 4600 |
varun.gupt |
1679 |
}
|