| Line 314... |
Line 314... |
| 314 |
CSVPrinter csvPrinter = new CSVPrinter(writer,
|
314 |
CSVPrinter csvPrinter = new CSVPrinter(writer,
|
| 315 |
CSVFormat.EXCEL.withTrim().withHeader("Code", "StoreName", "Email", "Mobile", "WalletAmount",
|
315 |
CSVFormat.EXCEL.withTrim().withHeader("Code", "StoreName", "Email", "Mobile", "WalletAmount",
|
| 316 |
"InStockAmount", "UnbilledStockAmount", "GrnPendingStockAmount", "MinimumInvestment",
|
316 |
"InStockAmount", "UnbilledStockAmount", "GrnPendingStockAmount", "MinimumInvestment",
|
| 317 |
"TotalInvested", "ShortAmount"));) {
|
317 |
"TotalInvested", "ShortAmount"));) {
|
| 318 |
for (FofoStore fofoStore : fofoStores) {
|
318 |
for (FofoStore fofoStore : fofoStores) {
|
| 319 |
|
319 |
|
| 320 |
CustomRetailer retailer = customRetailerMap.get(fofoStore.getId());
|
320 |
CustomRetailer retailer = customRetailerMap.get(fofoStore.getId());
|
| - |
|
321 |
if(retailer==null) {
|
| - |
|
322 |
LOGGER.info("Could not find retailer with retailer Id {}",fofoStore.getId() );
|
| - |
|
323 |
}
|
| 321 |
float walletAmount = walletService.getUserWallet(fofoStore.getId()).getAmount();
|
324 |
float walletAmount = walletService.getUserWallet(fofoStore.getId()).getAmount();
|
| 322 |
float inStockAmount = inventoryService.getTotalAmountInStock(fofoStore.getId());
|
325 |
float inStockAmount = inventoryService.getTotalAmountInStock(fofoStore.getId());
|
| 323 |
|
326 |
|
| 324 |
float unbilledStockAmount = 0;
|
327 |
float unbilledStockAmount = 0;
|
| 325 |
List<Order> unbilledOrders = transactionService.getInTransitOrders(fofoStore.getId());
|
328 |
List<Order> unbilledOrders = transactionService.getInTransitOrders(fofoStore.getId());
|
| Line 333... |
Line 336... |
| 333 |
LOGGER.info("Grn pending for Order {} and partner {}", grnPendingOrder.getId(),
|
336 |
LOGGER.info("Grn pending for Order {} and partner {}", grnPendingOrder.getId(),
|
| 334 |
grnPendingOrder.getRetailerEmailId());
|
337 |
grnPendingOrder.getRetailerEmailId());
|
| 335 |
grnPendingStockAmount += grnPendingOrder.getTotalAmount();
|
338 |
grnPendingStockAmount += grnPendingOrder.getTotalAmount();
|
| 336 |
}
|
339 |
}
|
| 337 |
float totalInvestedAmount = walletAmount + inStockAmount + unbilledStockAmount + grnPendingStockAmount;
|
340 |
float totalInvestedAmount = walletAmount + inStockAmount + unbilledStockAmount + grnPendingStockAmount;
|
| - |
|
341 |
try {
|
| 338 |
csvPrinter.printRecord(fofoStore.getCode(), fofoStore.getCode(), retailer.getBusinessName(),
|
342 |
csvPrinter.printRecord(fofoStore.getCode(), retailer.getBusinessName(),
|
| 339 |
retailer.getEmail(), retailer.getMobileNumber(), fofoStore.getMinimumInvestment(), walletAmount,
|
343 |
retailer.getEmail(), retailer.getMobileNumber(), walletAmount,
|
| 340 |
inStockAmount, unbilledStockAmount, grnPendingStockAmount, totalInvestedAmount,
|
344 |
inStockAmount, unbilledStockAmount, grnPendingStockAmount, fofoStore.getMinimumInvestment(), totalInvestedAmount,
|
| 341 |
fofoStore.getMinimumInvestment() - totalInvestedAmount);
|
345 |
fofoStore.getMinimumInvestment() - totalInvestedAmount);
|
| - |
|
346 |
} catch (Exception e) {
|
| - |
|
347 |
LOGGER.info("Could not get investment details for partner {}, re", retailer.getEmail());
|
| - |
|
348 |
e.printStackTrace();
|
| - |
|
349 |
}
|
| 342 |
}
|
350 |
}
|
| 343 |
Utils.sendMailWithAttachment(mailSender, "kamini.sharma@smartdukaan.com",
|
351 |
Utils.sendMailWithAttachment(mailSender, "kamini.sharma@smartdukaan.com",
|
| 344 |
new String[] { "amandeep.singh@smartdukaan.com", "tarun.verma@smartdukaan.com" },
|
352 |
new String[] { "amandeep.singh@smartdukaan.com", "tarun.verma@smartdukaan.com" },
|
| 345 |
"Partner Investment Summary", "PFA", fileName, new ByteArrayResource(baos.toByteArray()));
|
353 |
"Partner Investment Summary", "PFA", fileName, new ByteArrayResource(baos.toByteArray()));
|
| 346 |
|
354 |
|