| Line 42... |
Line 42... |
| 42 |
List<SchemeInOut> schemeInOuts = schemeInOutRepository.selectAllPending(SchemeType.INVESTMENT, startOfPreviousMonth.atStartOfDay(), firstDateOfCurrentMonth.atStartOfDay());
|
42 |
List<SchemeInOut> schemeInOuts = schemeInOutRepository.selectAllPending(SchemeType.INVESTMENT, startOfPreviousMonth.atStartOfDay(), firstDateOfCurrentMonth.atStartOfDay());
|
| 43 |
Map<Integer, List<SchemeInOut>> inventoryItemIdSchemeMap = schemeInOuts.stream().collect(Collectors.groupingBy(x->x.getInventoryItemId()));
|
43 |
Map<Integer, List<SchemeInOut>> inventoryItemIdSchemeMap = schemeInOuts.stream().collect(Collectors.groupingBy(x->x.getInventoryItemId()));
|
| 44 |
List<InventoryItem> inventoryItems = inventoryItemRepository.selectByIds(inventoryItemIdSchemeMap.keySet());
|
44 |
List<InventoryItem> inventoryItems = inventoryItemRepository.selectByIds(inventoryItemIdSchemeMap.keySet());
|
| 45 |
Map<Integer, List<Integer>> retailerInventoryItemIdMap = inventoryItems.stream()
|
45 |
Map<Integer, List<Integer>> retailerInventoryItemIdMap = inventoryItems.stream()
|
| 46 |
.collect(Collectors.groupingBy(x->x.getFofoId(), Collectors.mapping(x->x.getId(), Collectors.toList())));
|
46 |
.collect(Collectors.groupingBy(x->x.getFofoId(), Collectors.mapping(x->x.getId(), Collectors.toList())));
|
| - |
|
47 |
System.out.println("fofoId\tInvestment Short Days\tEligible payout");
|
| 47 |
for(Map.Entry<Integer, List<Integer>> retailerEntry : retailerInventoryItemIdMap.entrySet()) {
|
48 |
for(Map.Entry<Integer, List<Integer>> retailerEntry : retailerInventoryItemIdMap.entrySet()) {
|
| 48 |
int fofoId = retailerEntry.getKey();
|
49 |
int fofoId = retailerEntry.getKey();
|
| 49 |
System.out.print("fofoId\tInvestment Short Days\tEligible payout");
|
- |
|
| 50 |
List<SchemeInOut> schemeInouts = retailerEntry.getValue().stream().map(x->inventoryItemIdSchemeMap.get(x)).flatMap(List::stream).collect(Collectors.toList());
|
50 |
List<SchemeInOut> schemeInouts = retailerEntry.getValue().stream().map(x->inventoryItemIdSchemeMap.get(x)).flatMap(List::stream).collect(Collectors.toList());
|
| 51 |
double totalAmount = schemeInouts.stream().filter(x->x.getRolledBackTimestamp()!=null).collect(Collectors.summingDouble(x->x.getAmount()));
|
51 |
double totalAmount = schemeInouts.stream().filter(x->x.getRolledBackTimestamp()!=null).collect(Collectors.summingDouble(x->x.getAmount()));
|
| 52 |
long daysShort = investmentShortDaysMap.get(fofoId);
|
52 |
long daysShort = investmentShortDaysMap.get(fofoId);
|
| 53 |
if(daysShort >= 12) {
|
53 |
if(daysShort >= 12) {
|
| 54 |
//do nothing
|
54 |
//do nothing
|