| Line 46... |
Line 46... |
| 46 |
} catch (Exception e) {
|
46 |
} catch (Exception e) {
|
| 47 |
logger.error("Error while initializing one of the thrift clients", e);
|
47 |
logger.error("Error while initializing one of the thrift clients", e);
|
| 48 |
}
|
48 |
}
|
| 49 |
}
|
49 |
}
|
| 50 |
|
50 |
|
| 51 |
public ByteArrayOutputStream generateCourierDetails(long warehouseId, long providerId){
|
51 |
public ByteArrayOutputStream generateCourierDetails(long warehouseId, long providerId, boolean isCod){
|
| 52 |
ByteArrayOutputStream baosXLS = new ByteArrayOutputStream();
|
52 |
ByteArrayOutputStream baosXLS = new ByteArrayOutputStream();
|
| 53 |
in.shop2020.model.v1.order.TransactionService.Client txnClient = tsc.getClient();
|
53 |
in.shop2020.model.v1.order.TransactionService.Client txnClient = tsc.getClient();
|
| 54 |
in.shop2020.model.v1.catalog.InventoryService.Client inventoryClient = csc.getClient();
|
54 |
in.shop2020.model.v1.catalog.InventoryService.Client inventoryClient = csc.getClient();
|
| 55 |
in.shop2020.logistics.LogisticsService.Client logisticsClient = lsc.getClient();
|
55 |
in.shop2020.logistics.LogisticsService.Client logisticsClient = lsc.getClient();
|
| 56 |
|
56 |
|
| Line 107... |
Line 107... |
| 107 |
headerRow.createCell(16).setCellValue("Packet Weight(in Kg)");
|
107 |
headerRow.createCell(16).setCellValue("Packet Weight(in Kg)");
|
| 108 |
headerRow.createCell(17).setCellValue("Product Name");
|
108 |
headerRow.createCell(17).setCellValue("Product Name");
|
| 109 |
headerRow.createCell(18).setCellValue("Pickup Location");
|
109 |
headerRow.createCell(18).setCellValue("Pickup Location");
|
| 110 |
headerRow.createCell(19).setCellValue("Customer A/C Code");
|
110 |
headerRow.createCell(19).setCellValue("Customer A/C Code");
|
| 111 |
|
111 |
|
| - |
|
112 |
String accountNo;
|
| - |
|
113 |
if(isCod)
|
| - |
|
114 |
accountNo = provider.getDetails().get(DeliveryType.COD).getAccountNo();
|
| - |
|
115 |
else
|
| 112 |
String accountNo = provider.getDetails().get(DeliveryType.PREPAID).getAccountNo();
|
116 |
accountNo = provider.getDetails().get(DeliveryType.PREPAID).getAccountNo();
|
| - |
|
117 |
|
| 113 |
Date awbDate = new Date();
|
118 |
Date awbDate = new Date();
|
| 114 |
int serialNo = 0;
|
119 |
int serialNo = 0;
|
| 115 |
for(int i = 0; i<orders.size(); i++){
|
120 |
for(int i = 0; i<orders.size(); i++){
|
| 116 |
Order order = orders.get(i);
|
121 |
Order order = orders.get(i);
|
| 117 |
if(order.getLogistics_provider_id()!=providerId)
|
122 |
if(order.getLogistics_provider_id()!=providerId)
|
| 118 |
continue;
|
123 |
continue;
|
| - |
|
124 |
if(order.isCod() != isCod)
|
| - |
|
125 |
continue;
|
| 119 |
serialNo++;
|
126 |
serialNo++;
|
| 120 |
Row contentRow = sheet.createRow((short)serialNo);
|
127 |
Row contentRow = sheet.createRow((short)serialNo);
|
| 121 |
contentRow.createCell(0).setCellValue(serialNo);
|
128 |
contentRow.createCell(0).setCellValue(serialNo);
|
| 122 |
contentRow.createCell(1).setCellValue(order.getAirwaybill_no());
|
129 |
contentRow.createCell(1).setCellValue(order.getAirwaybill_no());
|
| 123 |
Cell awbDateCell = contentRow.createCell(2);
|
130 |
Cell awbDateCell = contentRow.createCell(2);
|
| Line 130... |
Line 137... |
| 130 |
contentRow.createCell(7).setCellValue(getValueForEmptyString(order.getCustomer_city()));
|
137 |
contentRow.createCell(7).setCellValue(getValueForEmptyString(order.getCustomer_city()));
|
| 131 |
contentRow.createCell(8).setCellValue(getValueForEmptyString(order.getCustomer_state()));
|
138 |
contentRow.createCell(8).setCellValue(getValueForEmptyString(order.getCustomer_state()));
|
| 132 |
contentRow.createCell(9).setCellValue(getValueForEmptyString(order.getCustomer_pincode()));
|
139 |
contentRow.createCell(9).setCellValue(getValueForEmptyString(order.getCustomer_pincode()));
|
| 133 |
contentRow.createCell(10).setCellValue(getValueForEmptyString(order.getCustomer_mobilenumber()));
|
140 |
contentRow.createCell(10).setCellValue(getValueForEmptyString(order.getCustomer_mobilenumber()));
|
| 134 |
contentRow.createCell(11).setCellValue("-");
|
141 |
contentRow.createCell(11).setCellValue("-");
|
| - |
|
142 |
if(isCod){
|
| - |
|
143 |
contentRow.createCell(12).setCellValue("COD");
|
| - |
|
144 |
contentRow.createCell(13).setCellValue(order.getTotal_amount());
|
| - |
|
145 |
} else {
|
| 135 |
contentRow.createCell(12).setCellValue("Prepaid");
|
146 |
contentRow.createCell(12).setCellValue("Prepaid");
|
| 136 |
contentRow.createCell(13).setCellValue(0);
|
147 |
contentRow.createCell(13).setCellValue(0);
|
| - |
|
148 |
}
|
| - |
|
149 |
|
| 137 |
List<LineItem> lineItems = order.getLineitems();
|
150 |
List<LineItem> lineItems = order.getLineitems();
|
| 138 |
LineItem lineItem = lineItems.get(0);
|
151 |
LineItem lineItem = lineItems.get(0);
|
| 139 |
contentRow.createCell(14).setCellValue(order.getTotal_amount());
|
152 |
contentRow.createCell(14).setCellValue(order.getTotal_amount());
|
| 140 |
contentRow.createCell(15).setCellValue(lineItem.getId());
|
153 |
contentRow.createCell(15).setCellValue(lineItem.getId());
|
| 141 |
Cell weightCell = contentRow.createCell(16);
|
154 |
Cell weightCell = contentRow.createCell(16);
|
| Line 170... |
Line 183... |
| 170 |
public static void main(String[] args) {
|
183 |
public static void main(String[] args) {
|
| 171 |
System.out.println("Hey There");
|
184 |
System.out.println("Hey There");
|
| 172 |
CourierDetailsGenerator g = new CourierDetailsGenerator();
|
185 |
CourierDetailsGenerator g = new CourierDetailsGenerator();
|
| 173 |
try {
|
186 |
try {
|
| 174 |
FileOutputStream f = new FileOutputStream("/home/ashish/Downloads/courier-details.xls");
|
187 |
FileOutputStream f = new FileOutputStream("/home/ashish/Downloads/courier-details.xls");
|
| 175 |
ByteArrayOutputStream baosXLS = g.generateCourierDetails(1, 1);
|
188 |
ByteArrayOutputStream baosXLS = g.generateCourierDetails(1, 1, true);
|
| 176 |
baosXLS.writeTo(f);
|
189 |
baosXLS.writeTo(f);
|
| 177 |
f.close();
|
190 |
f.close();
|
| 178 |
} catch (FileNotFoundException e) {
|
191 |
} catch (FileNotFoundException e) {
|
| 179 |
e.printStackTrace();
|
192 |
e.printStackTrace();
|
| 180 |
} catch (IOException e) {
|
193 |
} catch (IOException e) {
|