| Line 170... |
Line 170... |
| 170 |
LOGGER.info("fileName" + fileName);
|
170 |
LOGGER.info("fileName" + fileName);
|
| 171 |
LOGGER.info("fileNames" + fileNames);
|
171 |
LOGGER.info("fileNames" + fileNames);
|
| 172 |
|
172 |
|
| 173 |
List<CSVRecord> records = FileUtil.readFile(file);
|
173 |
List<CSVRecord> records = FileUtil.readFile(file);
|
| 174 |
|
174 |
|
| 175 |
List<BilledOrderListModel> billedOrderList = new ArrayList<BilledOrderListModel>();
|
175 |
List<BilledOrderListModel> billedOrderListModels = new ArrayList<>();
|
| 176 |
for (CSVRecord record : records) {
|
176 |
for (CSVRecord record : records) {
|
| 177 |
BilledOrderListModel blm = createBilleOrder(record);
|
177 |
BilledOrderListModel blm = createBilleOrder(record);
|
| 178 |
billedOrderList.add(blm);
|
178 |
billedOrderListModels.add(blm);
|
| 179 |
LOGGER.info("records" + record.get(1));
|
179 |
LOGGER.info("records" + record.get(1));
|
| 180 |
}
|
180 |
}
|
| 181 |
|
181 |
|
| 182 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
182 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 183 |
String email = loginDetails.getEmailId();
|
183 |
String email = loginDetails.getEmailId();
|
| Line 206... |
Line 206... |
| 206 |
|
206 |
|
| 207 |
LOGGER.info("warehouseIds" + warehouseIds);
|
207 |
LOGGER.info("warehouseIds" + warehouseIds);
|
| 208 |
|
208 |
|
| 209 |
Map<String, DispatchNotificationModel> dispatchNotication = new HashMap<>();
|
209 |
Map<String, DispatchNotificationModel> dispatchNotication = new HashMap<>();
|
| 210 |
|
210 |
|
| 211 |
if (!billedOrderList.isEmpty()) {
|
211 |
if (!billedOrderListModels.isEmpty()) {
|
| 212 |
List<Order> ords = orderRepository.selectByInvoiceNumbers(
|
212 |
List<Order> ords = orderRepository.selectByInvoiceNumbers(
|
| 213 |
billedOrderList.stream().map(x -> x.getInvoiceNumber()).collect(Collectors.toList()));
|
213 |
billedOrderListModels.stream().map(x -> x.getInvoiceNumber()).collect(Collectors.toList()));
|
| 214 |
|
214 |
|
| 215 |
List<Integer> shippingWarehouseIds = ords.stream().map(x -> x.getWarehouseId()).collect(Collectors.toList());
|
215 |
List<Integer> shippingWarehouseIds = ords.stream().map(x -> x.getWarehouseId()).collect(Collectors.toList());
|
| 216 |
|
216 |
|
| 217 |
if (!warehouseIds.containsAll(shippingWarehouseIds)) {
|
217 |
if (!warehouseIds.containsAll(shippingWarehouseIds)) {
|
| 218 |
throw new ProfitMandiBusinessException("Uploaded File", "", "Partners are not belong to the same warehouse");
|
218 |
throw new ProfitMandiBusinessException("Uploaded File", "", "Partners are not belong to the same warehouse");
|
| Line 222... |
Line 222... |
| 222 |
Map<String, Set<Integer>> invoicefofoIdmap = ords.stream().collect(Collectors.groupingBy(
|
222 |
Map<String, Set<Integer>> invoicefofoIdmap = ords.stream().collect(Collectors.groupingBy(
|
| 223 |
x -> x.getInvoiceNumber(), Collectors.mapping(Order::getRetailerId, Collectors.toSet())));
|
223 |
x -> x.getInvoiceNumber(), Collectors.mapping(Order::getRetailerId, Collectors.toSet())));
|
| 224 |
|
224 |
|
| 225 |
LOGGER.info("invoicefofoIdmap" + invoicefofoIdmap);
|
225 |
LOGGER.info("invoicefofoIdmap" + invoicefofoIdmap);
|
| 226 |
|
226 |
|
| 227 |
Map<String, Set<String>> airbillInvoiceNumberMap = billedOrderList.stream().collect(Collectors.groupingBy(x -> x.getAirwayBillNumber(), Collectors.mapping(BilledOrderListModel::getInvoiceNumber, Collectors.toSet())));
|
227 |
Map<String, Set<String>> airbillInvoiceNumberMap = billedOrderListModels.stream().collect(Collectors.groupingBy(x -> x.getAirwayBillNumber(), Collectors.mapping(BilledOrderListModel::getInvoiceNumber, Collectors.toSet())));
|
| 228 |
|
228 |
|
| 229 |
LOGGER.info("airbillInvoiceNumberMap" + airbillInvoiceNumberMap);
|
229 |
LOGGER.info("airbillInvoiceNumberMap" + airbillInvoiceNumberMap);
|
| 230 |
|
230 |
|
| 231 |
for (Entry<String, Set<String>> aim : airbillInvoiceNumberMap.entrySet()) {
|
231 |
for (Entry<String, Set<String>> aim : airbillInvoiceNumberMap.entrySet()) {
|
| 232 |
Set<String> InvoceNumbers = aim.getValue();
|
232 |
Set<String> InvoceNumbers = aim.getValue();
|
| Line 241... |
Line 241... |
| 241 |
if (fofoId.size() > 1) {
|
241 |
if (fofoId.size() > 1) {
|
| 242 |
throw new ProfitMandiBusinessException("Uploaded File", "", "Waybill " + aim.getKey() + " number cannot have invoices with different Retailers");
|
242 |
throw new ProfitMandiBusinessException("Uploaded File", "", "Waybill " + aim.getKey() + " number cannot have invoices with different Retailers");
|
| 243 |
}
|
243 |
}
|
| 244 |
}
|
244 |
}
|
| 245 |
|
245 |
|
| 246 |
Map<String, List<BilledOrderListModel>> blueDartAirbillBilledOrderMap = billedOrderList.stream().filter(x -> x.getLogisticsProviderName().equals("BlueDart")).collect(Collectors.groupingBy(x -> x.getAirwayBillNumber(), Collectors.toList()));
|
246 |
Map<String, List<BilledOrderListModel>> blueDartAirbillBilledOrderMap = billedOrderListModels.stream().filter(x -> x.getLogisticsProviderName().equals("BlueDart")).collect(Collectors.groupingBy(x -> x.getAirwayBillNumber(), Collectors.toList()));
|
| 247 |
|
247 |
|
| 248 |
List<BilledOrderListModel> orderList = billedOrderList.stream().filter(x -> !x.getLogisticsProviderName().equals("BlueDart")).collect(Collectors.toList());
|
248 |
List<BilledOrderListModel> orderList = billedOrderListModels.stream().filter(x -> !x.getLogisticsProviderName().equals("BlueDart")).collect(Collectors.toList());
|
| 249 |
|
249 |
|
| 250 |
if (!blueDartAirbillBilledOrderMap.isEmpty()) {
|
250 |
if (!blueDartAirbillBilledOrderMap.isEmpty()) {
|
| 251 |
List<BilledOrderListModel> blueDartorderList = billedOrderList.stream().filter(x -> x.getLogisticsProviderName().equals("BlueDart")).collect(Collectors.toList());
|
251 |
List<BilledOrderListModel> blueDartorderList = billedOrderListModels.stream().filter(x -> x.getLogisticsProviderName().equals("BlueDart")).collect(Collectors.toList());
|
| 252 |
|
252 |
|
| 253 |
List<Integer> unserviceablePincode = new ArrayList<>();
|
253 |
List<Integer> unserviceablePincode = new ArrayList<>();
|
| 254 |
|
254 |
|
| 255 |
for (BilledOrderListModel billedOrder : blueDartorderList) {
|
255 |
for (BilledOrderListModel billedOrder : blueDartorderList) {
|
| 256 |
|
256 |
|
| Line 327... |
Line 327... |
| 327 |
}
|
327 |
}
|
| 328 |
|
328 |
|
| 329 |
}
|
329 |
}
|
| 330 |
}
|
330 |
}
|
| 331 |
|
331 |
|
| 332 |
LOGGER.info("dispatchNotication" + dispatchNotication);
|
- |
|
| 333 |
LOGGER.info("billedOrderList" + billedOrderList);
|
- |
|
| 334 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
332 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
| 335 |
return "response";
|
333 |
return "response";
|
| 336 |
|
334 |
|
| 337 |
}
|
335 |
}
|
| 338 |
|
336 |
|