| Line 56... |
Line 56... |
| 56 |
@Autowired
|
56 |
@Autowired
|
| 57 |
private FofoStoreRepository fofoStoreRepository;
|
57 |
private FofoStoreRepository fofoStoreRepository;
|
| 58 |
|
58 |
|
| 59 |
@Autowired
|
59 |
@Autowired
|
| 60 |
private LineItemImeisRepository lineItemImeisRepository;
|
60 |
private LineItemImeisRepository lineItemImeisRepository;
|
| 61 |
|
61 |
|
| 62 |
@Autowired
|
62 |
@Autowired
|
| 63 |
private RetailerService retailerService;
|
63 |
private RetailerService retailerService;
|
| 64 |
|
64 |
|
| 65 |
@Autowired
|
65 |
@Autowired
|
| 66 |
private PurchaseRepository purchaseRepository;
|
66 |
private PurchaseRepository purchaseRepository;
|
| Line 122... |
Line 122... |
| 122 |
}
|
122 |
}
|
| 123 |
}
|
123 |
}
|
| 124 |
LOGGER.info("Migrated LineItems Successfully");
|
124 |
LOGGER.info("Migrated LineItems Successfully");
|
| 125 |
}
|
125 |
}
|
| 126 |
|
126 |
|
| 127 |
public void getInvestmentDetails() throws Exception{
|
127 |
public void getInvestmentDetails() throws Exception {
|
| - |
|
128 |
LOGGER.info(
|
| 128 |
LOGGER.info("StoreName\tEmail\tMobile\tminimumInvestment\twalletAmount\tinStockAmount\tunbilledStockAmount\tgrnPendingStockAmount");
|
129 |
"Code\tStoreName\tEmail\tMobile\tminimumInvestment\twalletAmount\tinStockAmount\tunbilledStockAmount\tgrnPendingStockAmount\tTotalInvested");
|
| 129 |
List<FofoStore> fofoStores = fofoStoreRepository.selectAll();
|
130 |
List<FofoStore> fofoStores = fofoStoreRepository.selectAll();
|
| - |
|
131 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService
|
| 130 |
Map<Integer,CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(fofoStores.stream().map(x->x.getId()).collect(Collectors.toList()));
|
132 |
.getFofoRetailers(fofoStores.stream().map(x -> x.getId()).collect(Collectors.toList()));
|
| 131 |
for (FofoStore fofoStore: fofoStores) {
|
133 |
for (FofoStore fofoStore : fofoStores) {
|
| 132 |
CustomRetailer retailer = customRetailerMap.get(fofoStore.getId());
|
134 |
CustomRetailer retailer = customRetailerMap.get(fofoStore.getId());
|
| 133 |
float walletAmount = walletService.getUserWallet(fofoStore.getId()).getAmount();
|
135 |
float walletAmount = walletService.getUserWallet(fofoStore.getId()).getAmount();
|
| 134 |
float inStockAmount = inventoryService.getTotalAmountInStock(fofoStore.getId());
|
136 |
float inStockAmount = inventoryService.getTotalAmountInStock(fofoStore.getId());
|
| 135 |
|
137 |
|
| 136 |
float unbilledStockAmount = 0;
|
138 |
float unbilledStockAmount = 0;
|
| 137 |
List<Order> unbilledOrders = transactionService.getInTransitOrders(fofoStore.getId());
|
139 |
List<Order> unbilledOrders = transactionService.getInTransitOrders(fofoStore.getId());
|
| 138 |
for(Order unBilledOrder : unbilledOrders) {
|
140 |
for (Order unBilledOrder : unbilledOrders) {
|
| 139 |
unbilledStockAmount += unBilledOrder.getTotalAmount();
|
141 |
unbilledStockAmount += unBilledOrder.getTotalAmount();
|
| 140 |
}
|
142 |
}
|
| 141 |
|
143 |
|
| 142 |
float grnPendingStockAmount = 0;
|
144 |
float grnPendingStockAmount = 0;
|
| 143 |
List<Order> grnPendingOrders = transactionService.getGrnPendingOrders(fofoStore.getId());
|
145 |
List<Order> grnPendingOrders = transactionService.getGrnPendingOrders(fofoStore.getId());
|
| 144 |
for(Order grnPendingOrder : grnPendingOrders) {
|
146 |
for (Order grnPendingOrder : grnPendingOrders) {
|
| 145 |
grnPendingStockAmount += grnPendingOrder.getTotalAmount();
|
147 |
grnPendingStockAmount += grnPendingOrder.getTotalAmount();
|
| 146 |
}
|
148 |
}
|
| - |
|
149 |
float totalInvestedAmount = walletAmount + inStockAmount + unbilledStockAmount + grnPendingStockAmount;
|
| 147 |
try {
|
150 |
try {
|
| 148 |
LOGGER.info(String.join("\t", fofoStore.getCode(), retailer.getMobileNumber(), String.valueOf(fofoStore.getMinimumInvestment()),
|
151 |
LOGGER.info(String.join("\t", fofoStore.getCode(), retailer.getBusinessName(), retailer.getMobileNumber(),
|
| - |
|
152 |
String.valueOf(fofoStore.getMinimumInvestment()), String.valueOf(walletAmount),
|
| - |
|
153 |
String.valueOf(inStockAmount), String.valueOf(unbilledStockAmount),
|
| 149 |
String.valueOf(walletAmount), String.valueOf(inStockAmount), String.valueOf(unbilledStockAmount), String.valueOf(grnPendingStockAmount)));
|
154 |
String.valueOf(grnPendingStockAmount), String.valueOf(totalInvestedAmount)));
|
| 150 |
} catch(Exception e) {
|
155 |
} catch (Exception e) {
|
| 151 |
continue;
|
156 |
continue;
|
| 152 |
}
|
157 |
}
|
| 153 |
float totalInvestedAmount = walletAmount + inStockAmount + unbilledStockAmount + grnPendingStockAmount;
|
- |
|
| 154 |
LOGGER.info("Total Amount in System is {}", totalInvestedAmount);
|
- |
|
| 155 |
LOGGER.info("Store minimum investment is {}", fofoStore.getMinimumInvestment());
|
- |
|
| 156 |
}
|
158 |
}
|
| 157 |
|
159 |
|
| 158 |
}
|
160 |
}
|
| 159 |
}
|
161 |
}
|
| 160 |
|
162 |
|