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