| Line 1006... |
Line 1006... |
| 1006 |
inventoryItemId = fli.getInventoryItemId();
|
1006 |
inventoryItemId = fli.getInventoryItemId();
|
| 1007 |
}
|
1007 |
}
|
| 1008 |
}
|
1008 |
}
|
| 1009 |
//Rollback entry with reversal reason
|
1009 |
//Rollback entry with reversal reason
|
| 1010 |
if(fofoOrder.getCreateTimestamp().isAfter(LocalDate.of(2020, 4, 1).atStartOfDay())) {
|
1010 |
if(fofoOrder.getCreateTimestamp().isAfter(LocalDate.of(2020, 4, 1).atStartOfDay())) {
|
| - |
|
1011 |
float invoiceWalletAmount = 0;
|
| - |
|
1012 |
float invoiceSchemeReversalAmount = 0;
|
| 1011 |
List<UserWalletHistory> userWalletHistory = userWalletHistoryRepository.selectAllByreferenceIdandreferenceType(fofoOrder.getId(), WalletReferenceType.SCHEME_OUT);
|
1013 |
List<UserWalletHistory> userWalletHistory = userWalletHistoryRepository.selectAllByreferenceIdandreferenceType(fofoOrder.getId(), WalletReferenceType.SCHEME_OUT);
|
| 1012 |
totalAmount += userWalletHistory.stream().collect(Collectors.summingInt(y->y.getAmount()));
|
1014 |
totalAmount += userWalletHistory.stream().collect(Collectors.summingInt(y->y.getAmount()));
|
| - |
|
1015 |
invoiceSchemeReversalAmount += userWalletHistory.stream().collect(Collectors.summingInt(y->y.getAmount()));
|
| 1013 |
/*walletService.rollbackAmountFromWallet(fofoOrder.getFofoId(), totalAmount, fofoOrder.getId(), WalletReferenceType.SCHEME_OUT,
|
1016 |
/*walletService.rollbackAmountFromWallet(fofoOrder.getFofoId(), totalAmount, fofoOrder.getId(), WalletReferenceType.SCHEME_OUT,
|
| 1014 |
"Same order for Invoice-"+ invoiceNumber + "created twice, duplicate invoice rollback", fofoOrder.getCancelledTimestamp());*/
|
1017 |
"Same order for Invoice-"+ invoiceNumber + "created twice, duplicate invoice rollback", fofoOrder.getCancelledTimestamp());*/
|
| 1015 |
List<SchemeInOut> schemeInOuts = schemeInOutRepository.selectByInventoryItemIds(new HashSet<>(Arrays.asList(inventoryItemId)));
|
1018 |
List<SchemeInOut> schemeInOuts = schemeInOutRepository.selectByInventoryItemIds(new HashSet<>(Arrays.asList(inventoryItemId)));
|
| 1016 |
Set<Integer> schemeIds = new HashSet<>();
|
1019 |
Set<Integer> schemeIds = new HashSet<>();
|
| 1017 |
for(SchemeInOut sio : schemeInOuts) {
|
1020 |
for(SchemeInOut sio : schemeInOuts) {
|
| Line 1019... |
Line 1022... |
| 1019 |
LOGGER.info(sio);
|
1022 |
LOGGER.info(sio);
|
| 1020 |
if(!schemeIds.contains(sio.getSchemeId())) {
|
1023 |
if(!schemeIds.contains(sio.getSchemeId())) {
|
| 1021 |
schemeIds.add(sio.getSchemeId());
|
1024 |
schemeIds.add(sio.getSchemeId());
|
| 1022 |
} else {
|
1025 |
} else {
|
| 1023 |
schemeReverseAmount += sio.getAmount();
|
1026 |
schemeReverseAmount += sio.getAmount();
|
| - |
|
1027 |
invoiceSchemeReversalAmount += sio.getAmount();
|
| 1024 |
}
|
1028 |
}
|
| 1025 |
}
|
1029 |
}
|
| 1026 |
}
|
1030 |
}
|
| 1027 |
|
- |
|
| - |
|
1031 |
LOGGER.info("invoiceWalletAmount - {}, invoiceSchemeReversalAmount {}", invoiceWalletAmount, invoiceSchemeReversalAmount);
|
| 1028 |
}
|
1032 |
}
|
| 1029 |
//Remove order id
|
1033 |
//Remove order id
|
| 1030 |
//Remove order item Id
|
1034 |
//Remove order item Id
|
| 1031 |
//Remove lineitem id
|
1035 |
//Remove lineitem id
|
| 1032 |
}
|
1036 |
}
|