| Line 758... |
Line 758... |
| 758 |
Map<Integer, String> userNameMap = retailerService.getAllFofoRetailerIdNameMap();
|
758 |
Map<Integer, String> userNameMap = retailerService.getAllFofoRetailerIdNameMap();
|
| 759 |
Map<Integer, Float> userAmountMap = new HashMap<>();
|
759 |
Map<Integer, Float> userAmountMap = new HashMap<>();
|
| 760 |
|
760 |
|
| 761 |
List<List<?>> rows = new ArrayList<>();
|
761 |
List<List<?>> rows = new ArrayList<>();
|
| 762 |
List<String> headers = Arrays.asList("Scheme", "Item", "Partner", "Amount", "Credited On", "Invoice Number", "Sale On", "Scheme Start", "Scheme End", "Active On", "Expired On");
|
762 |
List<String> headers = Arrays.asList("Scheme", "Item", "Partner", "Amount", "Credited On", "Invoice Number", "Sale On", "Scheme Start", "Scheme End", "Active On", "Expired On");
|
| 763 |
schemeRepository.selectAll().stream().forEach(x -> {
|
763 |
for (Scheme scheme : schemeRepository.selectAll()) {
|
| 764 |
if (x.getType().equals(SchemeType.OUT)) {
|
764 |
if (scheme.getType().equals(SchemeType.OUT)) {
|
| 765 |
List<SchemeInOut> sioList = schemeInOutRepository.selectBySchemeIds(new HashSet<>(Arrays.asList(x.getId())));
|
765 |
List<SchemeInOut> sioList = schemeInOutRepository.selectBySchemeIds(new HashSet<>(Arrays.asList(scheme.getId())));
|
| 766 |
if (x.getActiveTimestamp() != null) {
|
766 |
if (scheme.getActiveTimestamp() != null) {
|
| 767 |
LocalDateTime endDateTime = x.getEndDateTime();
|
767 |
LocalDateTime endDateTime = scheme.getEndDateTime();
|
| 768 |
if (x.getExpireTimestamp() != null && x.getExpireTimestamp().isBefore(x.getEndDateTime())) {
|
768 |
if (scheme.getExpireTimestamp() != null && scheme.getExpireTimestamp().isBefore(scheme.getEndDateTime())) {
|
| 769 |
endDateTime = x.getExpireTimestamp();
|
769 |
endDateTime = scheme.getExpireTimestamp();
|
| 770 |
}
|
770 |
}
|
| 771 |
for (SchemeInOut sio : sioList) {
|
771 |
for (SchemeInOut sio : sioList) {
|
| 772 |
InventoryItem inventoryItem = null;
|
772 |
InventoryItem inventoryItem = null;
|
| 773 |
inventoryItem = inventoryItemRepository.selectById(sio.getInventoryItemId());
|
773 |
inventoryItem = inventoryItemRepository.selectById(sio.getInventoryItemId());
|
| 774 |
FofoOrder fofoOrder = fofoOrderRepository.selectByFofoIdAndSerialNumber(
|
774 |
FofoOrder fofoOrder = fofoOrderRepository.selectByFofoIdAndSerialNumber(
|
| 775 |
inventoryItem.getFofoId(), inventoryItem.getSerialNumber(), null, null, 0, 1).get(0);
|
775 |
inventoryItem.getFofoId(), inventoryItem.getSerialNumber(), null, null, 0, 1).get(0);
|
| 776 |
Optional<ScanRecord> record = scanRecordRepository.selectByInventoryItemId(sio.getInventoryItemId()).stream().filter(y -> y.getType().equals(ScanType.SALE)).findFirst();
|
776 |
Optional<ScanRecord> record = scanRecordRepository.selectByInventoryItemId(sio.getInventoryItemId()).stream().filter(y -> y.getType().equals(ScanType.SALE)).findFirst();
|
| 777 |
if (record.isPresent()) {
|
777 |
if (record.isPresent()) {
|
| 778 |
int fofoId = record.get().getFofoId();
|
778 |
int fofoId = record.get().getFofoId();
|
| 779 |
if (record.get().getCreateTimestamp().isAfter(endDateTime) || record.get().getCreateTimestamp().isBefore(x.getStartDateTime())) {
|
779 |
if (record.get().getCreateTimestamp().isAfter(endDateTime) || record.get().getCreateTimestamp().isBefore(scheme.getStartDateTime())) {
|
| 780 |
if (!userAmountMap.containsKey(fofoId)) {
|
780 |
if (!userAmountMap.containsKey(fofoId)) {
|
| 781 |
userAmountMap.put(fofoId, 0f);
|
781 |
userAmountMap.put(fofoId, 0f);
|
| 782 |
}
|
782 |
}
|
| 783 |
userAmountMap.put(fofoId, sio.getAmount() + userAmountMap.get(fofoId));
|
783 |
userAmountMap.put(fofoId, sio.getAmount() + userAmountMap.get(fofoId));
|
| 784 |
try {
|
784 |
try {
|
| 785 |
rows.add(Arrays.asList(x.getDescription(), itemRepository.selectById(inventoryItem.getItemId()).getItemDescription(), userNameMap.get(fofoId), sio.getAmount(), FormattingUtils.formatDate(sio.getCreateTimestamp()), fofoOrder.getInvoiceNumber(), FormattingUtils.formatDate(record.get().getCreateTimestamp()), FormattingUtils.formatDate(x.getStartDateTime()), FormattingUtils.formatDate(x.getEndDateTime()), FormattingUtils.formatDate(x.getActiveTimestamp()), FormattingUtils.formatDate(x.getExpireTimestamp())));
|
785 |
rows.add(Arrays.asList(scheme.getDescription(), itemRepository.selectById(inventoryItem.getItemId()).getItemDescription(), userNameMap.get(fofoId), sio.getAmount(), FormattingUtils.formatDate(sio.getCreateTimestamp()), fofoOrder.getInvoiceNumber(), FormattingUtils.formatDate(record.get().getCreateTimestamp()), FormattingUtils.formatDate(scheme.getStartDateTime()), FormattingUtils.formatDate(scheme.getEndDateTime()), FormattingUtils.formatDate(scheme.getActiveTimestamp()), FormattingUtils.formatDate(scheme.getExpireTimestamp())));
|
| 786 |
} catch (Exception e) {
|
786 |
} catch (Exception e) {
|
| 787 |
e.printStackTrace();
|
787 |
e.printStackTrace();
|
| 788 |
}
|
788 |
}
|
| 789 |
}
|
789 |
}
|
| 790 |
}
|
790 |
}
|
| 791 |
}
|
791 |
}
|
| 792 |
}
|
792 |
}
|
| 793 |
}
|
793 |
}
|
| 794 |
});
|
794 |
}
|
| 795 |
userAmountMap.entrySet().stream().forEach(x -> LOGGER.info("{} to be deducted from {}({}) for wrongly disbursed due to technical error.", x.getValue(), userNameMap.get(x.getKey())));
|
795 |
userAmountMap.entrySet().stream().forEach(x -> LOGGER.info("{} to be deducted from {}({}) for wrongly disbursed due to technical error.", x.getValue(), userNameMap.get(x.getKey())));
|
| 796 |
|
796 |
|
| 797 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, rows);
|
797 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, rows);
|
| 798 |
Utils.sendMailWithAttachment(googleMailSender, new String[]{"amit.gupta@shop2020.in"}, null, "Partner Excess Amount", "PFA", "ListofSchemes.csv", new ByteArrayResource(baos.toByteArray()));
|
798 |
Utils.sendMailWithAttachment(googleMailSender, new String[]{"amit.gupta@shop2020.in"}, null, "Partner Excess Amount", "PFA", "ListofSchemes.csv", new ByteArrayResource(baos.toByteArray()));
|
| 799 |
|
799 |
|
| Line 1027... |
Line 1027... |
| 1027 |
|
1027 |
|
| 1028 |
@Autowired
|
1028 |
@Autowired
|
| 1029 |
InvoiceService invoiceService;
|
1029 |
InvoiceService invoiceService;
|
| 1030 |
|
1030 |
|
| 1031 |
public void test() throws Exception {
|
1031 |
public void test() throws Exception {
|
| 1032 |
//invoiceService.createInvoices(Arrays.asList("NSDLUK62", "NSDL39915", "NSDLHR24036", "NSDL39831", "NSNOI5266", "NSDL39849"));
|
- |
|
| 1033 |
/*vendorCatalogPricingLogRepository.selectByCatalogId(1024271, VendorCatalogPricingStatus.APPROVED).stream().filter(x -> x.getVendorId() == 341).forEach(x -> {
|
- |
|
| 1034 |
System.out.println(x.getEffectedOn() + ", " + x.getTransferPrice());
|
- |
|
| 1035 |
});*/
|
- |
|
| 1036 |
List<AgeingSummaryModel> ageingSummaryModels = warehouseInventoryItemRepository.
|
- |
|
| 1037 |
findPartnerStockAgeingByBrand("Samsung", 0, 80);
|
- |
|
| 1038 |
System.out.println(ageingSummaryModels.size());
|
- |
|
| 1039 |
//this.setInventoryItemIdToPriceDropImei();
|
- |
|
| 1040 |
//fofoSolr.populateTagItems();
|
- |
|
| 1041 |
//System.out.println(smartPingService.getAllAgentsByEmail());
|
- |
|
| 1042 |
//System.out.println(psiSmartService.getRegistrationEndPoint("9990381569"));
|
1032 |
System.out.println(saholicInventoryService.getByWarehouseIdItemIds(7573, Arrays.asList(35942, 35943, 35945)));
|
| 1043 |
//migrateValentine();
|
- |
|
| 1044 |
//Map<Integer, List<Offer>> offerMap = offerRepository.selectAllPublishedMapByPartner(YearMonth.now());
|
- |
|
| 1045 |
//LOGGER.info("Offers - {}", offerMap.entrySet().stream().filter(x->x.getKey()==168118414).flatMap(x->x.getValue().stream().map(y->y.getId())).collect(Collectors.toList()));
|
- |
|
| 1046 |
//bluedartAuthService.getAuthToken();
|
- |
|
| 1047 |
//bluedartService.getAirwayBillNo()
|
- |
|
| 1048 |
/*transactionRelatedTasks.reverseRTO(Arrays.asList(
|
- |
|
| 1049 |
"BLY156",
|
- |
|
| 1050 |
"BLY159",
|
- |
|
| 1051 |
"BLY339",
|
- |
|
| 1052 |
"NSDL33621",
|
- |
|
| 1053 |
"NSDL34037",
|
- |
|
| 1054 |
"NSLCK13532",
|
- |
|
| 1055 |
"NSSRNPR1124",
|
- |
|
| 1056 |
"NSSRNPR1248",
|
- |
|
| 1057 |
"NSSRNPR1249",
|
- |
|
| 1058 |
"NSUK267",
|
- |
|
| 1059 |
"UKRDPR139"));*/
|
- |
|
| 1060 |
|
- |
|
| 1061 |
//sendMailWhatsAppAfterLoanDueDate();
|
- |
|
| 1062 |
}
|
1033 |
}
|
| 1063 |
|
1034 |
|
| 1064 |
public void test3() throws Exception {
|
1035 |
public void test3() throws Exception {
|
| 1065 |
List<Long> payoutIds = Arrays.asList();
|
1036 |
List<Long> payoutIds = Arrays.asList();
|
| 1066 |
List<OfferPayout> offerPayouts = offerPayoutRepository.selectAllByIds(payoutIds);
|
1037 |
List<OfferPayout> offerPayouts = offerPayoutRepository.selectAllByIds(payoutIds);
|
| Line 1435... |
Line 1406... |
| 1435 |
String[] sendToArray = sendTo.toArray(new String[sendTo.size()]);
|
1406 |
String[] sendToArray = sendTo.toArray(new String[sendTo.size()]);
|
| 1436 |
Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Franchise Investment Summary", "PFA", fileName, new ByteArrayResource(baos.toByteArray()));
|
1407 |
Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Franchise Investment Summary", "PFA", fileName, new ByteArrayResource(baos.toByteArray()));
|
| 1437 |
|
1408 |
|
| 1438 |
}
|
1409 |
}
|
| 1439 |
|
1410 |
|
| 1440 |
private Map<Integer, FofoReportingModel> getPartnerIdSalesHeaders() {
|
1411 |
private Map<Integer, FofoReportingModel> getPartnerIdSalesHeaders() throws ProfitMandiBusinessException {
|
| 1441 |
Map<String, SaleRoles> partnerEmailSalesMap = new HashMap<>();
|
1412 |
Map<String, SaleRoles> partnerEmailSalesMap = new HashMap<>();
|
| 1442 |
Map<String, SaleRoles> partnerEmailRBMMap = new HashMap<>();
|
1413 |
Map<String, SaleRoles> partnerEmailRBMMap = new HashMap<>();
|
| 1443 |
|
1414 |
|
| 1444 |
List<Position> positions = positionRepository.selectPositionByCategoryIds(Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_RBM));
|
1415 |
List<Position> positions = positionRepository.selectPositionByCategoryIds(Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_RBM));
|
| 1445 |
Map<Integer, AuthUser> authUsersMap = authRepository.selectAllActiveUser().stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
1416 |
Map<Integer, AuthUser> authUsersMap = authRepository.selectAllActiveUser().stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| Line 1754... |
Line 1725... |
| 1754 |
}
|
1725 |
}
|
| 1755 |
}
|
1726 |
}
|
| 1756 |
|
1727 |
|
| 1757 |
}
|
1728 |
}
|
| 1758 |
|
1729 |
|
| 1759 |
public void schemewalletmismatch() {
|
1730 |
public void schemewalletmismatch() throws ProfitMandiBusinessException {
|
| 1760 |
LocalDate dateToReconcile = LocalDate.of(2018, 4, 1);
|
1731 |
LocalDate dateToReconcile = LocalDate.of(2018, 4, 1);
|
| 1761 |
while (dateToReconcile.isBefore(LocalDate.now())) {
|
1732 |
while (dateToReconcile.isBefore(LocalDate.now())) {
|
| 1762 |
reconcileSchemes(dateToReconcile);
|
1733 |
reconcileSchemes(dateToReconcile);
|
| 1763 |
// reconcileOrders(dateTime);
|
1734 |
// reconcileOrders(dateTime);
|
| 1764 |
// reconcileRecharges(dateTime);
|
1735 |
// reconcileRecharges(dateTime);
|
| 1765 |
dateToReconcile = dateToReconcile.plusDays(1);
|
1736 |
dateToReconcile = dateToReconcile.plusDays(1);
|
| 1766 |
}
|
1737 |
}
|
| 1767 |
}
|
1738 |
}
|
| 1768 |
|
1739 |
|
| 1769 |
private void reconcileSchemes(LocalDate date) {
|
1740 |
private void reconcileSchemes(LocalDate date) throws ProfitMandiBusinessException {
|
| 1770 |
LocalDateTime startDate = date.atStartOfDay();
|
1741 |
LocalDateTime startDate = date.atStartOfDay();
|
| 1771 |
LocalDateTime endDate = startDate.plusDays(1);
|
1742 |
LocalDateTime endDate = startDate.plusDays(1);
|
| 1772 |
List<SchemeInOut> siosCreated = schemeInOutRepository.selectAllByCreateDate(startDate, endDate);
|
1743 |
List<SchemeInOut> siosCreated = schemeInOutRepository.selectAllByCreateDate(startDate, endDate);
|
| 1773 |
List<SchemeInOut> siosRefunded = schemeInOutRepository.selectAllByRefundDate(startDate, endDate);
|
1744 |
List<SchemeInOut> siosRefunded = schemeInOutRepository.selectAllByRefundDate(startDate, endDate);
|
| 1774 |
double totalSchemeDisbursed = siosCreated.stream().mapToDouble(x -> x.getAmount()).sum();
|
1745 |
double totalSchemeDisbursed = siosCreated.stream().mapToDouble(x -> x.getAmount()).sum();
|
| Line 1822... |
Line 1793... |
| 1822 |
LocalDateTime startDate = LocalDate.of(2018, 3, 1).atStartOfDay();
|
1793 |
LocalDateTime startDate = LocalDate.of(2018, 3, 1).atStartOfDay();
|
| 1823 |
LocalDateTime endDate = LocalDate.now().atStartOfDay();
|
1794 |
LocalDateTime endDate = LocalDate.now().atStartOfDay();
|
| 1824 |
List<Purchase> purchases = purchaseRepository.selectAllBetweenPurchaseDate(startDate, endDate);
|
1795 |
List<Purchase> purchases = purchaseRepository.selectAllBetweenPurchaseDate(startDate, endDate);
|
| 1825 |
|
1796 |
|
| 1826 |
Map<Integer, String> storeNameMap = fofoStoreRepository.getStoresMap();
|
1797 |
Map<Integer, String> storeNameMap = fofoStoreRepository.getStoresMap();
|
| 1827 |
purchases.stream().forEach(purchase -> {
|
1798 |
for (Purchase purchase : purchases) {
|
| 1828 |
float amountToRollback = 0;
|
1799 |
float amountToRollback = 0;
|
| 1829 |
String description = "Adjustment of Duplicate Scheme for Purchase Invoice " + purchase.getPurchaseReference();
|
1800 |
String description = "Adjustment of Duplicate Scheme for Purchase Invoice " + purchase.getPurchaseReference();
|
| 1830 |
Map<Integer, String> inventorySerialNumberMap = inventoryItemRepository.selectByPurchaseId(purchase.getId()).stream().filter(ii -> ii.getSerialNumber() != null).collect(Collectors.toMap(InventoryItem::getId, InventoryItem::getSerialNumber));
|
1801 |
Map<Integer, String> inventorySerialNumberMap = inventoryItemRepository.selectByPurchaseId(purchase.getId()).stream().filter(ii -> ii.getSerialNumber() != null).collect(Collectors.toMap(InventoryItem::getId, InventoryItem::getSerialNumber));
|
| 1831 |
if (inventorySerialNumberMap.size() > 0) {
|
1802 |
if (inventorySerialNumberMap.size() > 0) {
|
| 1832 |
for (Map.Entry<Integer, String> inventorySerialNumberEntry : inventorySerialNumberMap.entrySet()) {
|
1803 |
for (Entry<Integer, String> inventorySerialNumberEntry : inventorySerialNumberMap.entrySet()) {
|
| 1833 |
String serialNumber = inventorySerialNumberEntry.getValue();
|
1804 |
String serialNumber = inventorySerialNumberEntry.getValue();
|
| 1834 |
int inventoryItemId = inventorySerialNumberEntry.getKey();
|
1805 |
int inventoryItemId = inventorySerialNumberEntry.getKey();
|
| 1835 |
if (serialNumbersConsidered.contains(serialNumber)) {
|
1806 |
if (serialNumbersConsidered.contains(serialNumber)) {
|
| 1836 |
// This will rollback scheme for differenct orders for same serial
|
1807 |
// This will rollback scheme for differenct orders for same serial
|
| 1837 |
List<SchemeInOut> sios = schemeInOutRepository.selectByInventoryItemIds(new HashSet<>(Arrays.asList(inventoryItemId))).stream().filter(x -> x.getRolledBackTimestamp() == null && schemeTypeMap.get(x.getSchemeId()).equals(SchemeType.IN)).collect(Collectors.toList());
|
1808 |
List<SchemeInOut> sios = schemeInOutRepository.selectByInventoryItemIds(new HashSet<>(Arrays.asList(inventoryItemId))).stream().filter(x -> x.getRolledBackTimestamp() == null && schemeTypeMap.get(x.getSchemeId()).equals(SchemeType.IN)).collect(Collectors.toList());
|
| Line 1878... |
Line 1849... |
| 1878 |
uwh.setWalletId(userWalletMap.get(purchase.getFofoId()));
|
1849 |
uwh.setWalletId(userWalletMap.get(purchase.getFofoId()));
|
| 1879 |
uwh.setFofoId(purchase.getFofoId());
|
1850 |
uwh.setFofoId(purchase.getFofoId());
|
| 1880 |
uwh.setStoreCode(storeNameMap.get(purchase.getFofoId()));
|
1851 |
uwh.setStoreCode(storeNameMap.get(purchase.getFofoId()));
|
| 1881 |
userWalletHistory.add(uwh);
|
1852 |
userWalletHistory.add(uwh);
|
| 1882 |
}
|
1853 |
}
|
| 1883 |
});
|
1854 |
}
|
| 1884 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(
|
1855 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(
|
| 1885 |
Arrays.asList("User Id", "Store Code", "Reference Type", "Reference", "Amount", "Description", "Timestamp"), userWalletHistory.stream().map(x -> Arrays.asList(x.getWalletId(), x.getStoreCode(), x.getReferenceType(), x.getReference(), x.getAmount(), x.getDescription(), x.getTimestamp())).collect(Collectors.toList()));
|
1856 |
Arrays.asList("User Id", "Store Code", "Reference Type", "Reference", "Amount", "Description", "Timestamp"), userWalletHistory.stream().map(x -> Arrays.asList(x.getWalletId(), x.getStoreCode(), x.getReferenceType(), x.getReference(), x.getAmount(), x.getDescription(), x.getTimestamp())).collect(Collectors.toList()));
|
| 1886 |
|
1857 |
|
| 1887 |
ByteArrayOutputStream baosOuts = FileUtil.getCSVByteStream(
|
1858 |
ByteArrayOutputStream baosOuts = FileUtil.getCSVByteStream(
|
| 1888 |
Arrays.asList("Scheme ID", "SchemeType", "Reference", "Store Code", "Serial Number", "Amount", "Created", "Rolledback"), rolledbackSios.stream().map(x -> Arrays.asList(x.getSchemeId(), x.getSchemeType(), x.getReference(), x.getStoreCode(), x.getSerialNumber(), x.getAmount(), x.getCreateTimestamp(), x.getRolledBackTimestamp())).collect(Collectors.toList()));
|
1859 |
Arrays.asList("Scheme ID", "SchemeType", "Reference", "Store Code", "Serial Number", "Amount", "Created", "Rolledback"), rolledbackSios.stream().map(x -> Arrays.asList(x.getSchemeId(), x.getSchemeType(), x.getReference(), x.getStoreCode(), x.getSerialNumber(), x.getAmount(), x.getCreateTimestamp(), x.getRolledBackTimestamp())).collect(Collectors.toList()));
|
| Line 1904... |
Line 1875... |
| 1904 |
// Collections.reverse(allOrders);
|
1875 |
// Collections.reverse(allOrders);
|
| 1905 |
// List<FofoOrder> allOrders =
|
1876 |
// List<FofoOrder> allOrders =
|
| 1906 |
// List<FofoOrder> allOrders =
|
1877 |
// List<FofoOrder> allOrders =
|
| 1907 |
// Arrays.asList(fofoOrderRepository.selectByInvoiceNumber("UPGZ019/25"));
|
1878 |
// Arrays.asList(fofoOrderRepository.selectByInvoiceNumber("UPGZ019/25"));
|
| 1908 |
Set<String> serialNumbersConsidered = new HashSet<>();
|
1879 |
Set<String> serialNumbersConsidered = new HashSet<>();
|
| 1909 |
allOrders.stream().forEach(fofoOrder -> {
|
1880 |
for (FofoOrder fofoOrder : allOrders) {
|
| 1910 |
String description = "Adjustment of Duplicate Scheme for Sale Invoice " + fofoOrder.getInvoiceNumber();
|
1881 |
String description = "Adjustment of Duplicate Scheme for Sale Invoice " + fofoOrder.getInvoiceNumber();
|
| 1911 |
Map<Integer, String> inventorySerialNumberMap = new HashMap<>();
|
1882 |
Map<Integer, String> inventorySerialNumberMap = new HashMap<>();
|
| 1912 |
float amountToRollback = 0;
|
1883 |
float amountToRollback = 0;
|
| 1913 |
List<FofoOrderItem> orderItems = fofoOrderItemRepository.selectByOrderId(fofoOrder.getId());
|
1884 |
List<FofoOrderItem> orderItems = fofoOrderItemRepository.selectByOrderId(fofoOrder.getId());
|
| 1914 |
orderItems.forEach(x -> {
|
1885 |
orderItems.forEach(x -> {
|
| 1915 |
inventorySerialNumberMap.putAll(x.getFofoLineItems().stream().filter(li -> li.getSerialNumber() != null).collect(Collectors.toMap(FofoLineItem::getInventoryItemId, FofoLineItem::getSerialNumber)));
|
1886 |
inventorySerialNumberMap.putAll(x.getFofoLineItems().stream().filter(li -> li.getSerialNumber() != null).collect(Collectors.toMap(FofoLineItem::getInventoryItemId, FofoLineItem::getSerialNumber)));
|
| 1916 |
});
|
1887 |
});
|
| 1917 |
if (inventorySerialNumberMap.size() > 0) {
|
1888 |
if (inventorySerialNumberMap.size() > 0) {
|
| 1918 |
for (Map.Entry<Integer, String> inventorySerialNumberEntry : inventorySerialNumberMap.entrySet()) {
|
1889 |
for (Entry<Integer, String> inventorySerialNumberEntry : inventorySerialNumberMap.entrySet()) {
|
| 1919 |
String serialNumber = inventorySerialNumberEntry.getValue();
|
1890 |
String serialNumber = inventorySerialNumberEntry.getValue();
|
| 1920 |
int inventoryItemId = inventorySerialNumberEntry.getKey();
|
1891 |
int inventoryItemId = inventorySerialNumberEntry.getKey();
|
| 1921 |
if (serialNumbersConsidered.contains(serialNumber)) {
|
1892 |
if (serialNumbersConsidered.contains(serialNumber)) {
|
| 1922 |
// This will rollback scheme for differenct orders for same serial
|
1893 |
// This will rollback scheme for differenct orders for same serial
|
| 1923 |
List<SchemeInOut> sios = schemeInOutRepository.selectByInventoryItemIds(new HashSet<>(Arrays.asList(inventoryItemId))).stream().filter(x -> x.getRolledBackTimestamp() == null && schemeTypeMap.get(x.getSchemeId()).equals(SchemeType.OUT)).collect(Collectors.toList());
|
1894 |
List<SchemeInOut> sios = new ArrayList<>();
|
| - |
|
1895 |
for (SchemeInOut schemeInOut : schemeInOutRepository.selectByInventoryItemIds(new HashSet<>(Arrays.asList(inventoryItemId)))) {
|
| - |
|
1896 |
if (schemeInOut.getRolledBackTimestamp() == null && schemeTypeMap.get(schemeInOut.getSchemeId()).equals(SchemeType.OUT)) {
|
| - |
|
1897 |
sios.add(schemeInOut);
|
| - |
|
1898 |
}
|
| - |
|
1899 |
}
|
| 1924 |
Collections.reverse(sios);
|
1900 |
Collections.reverse(sios);
|
| 1925 |
for (SchemeInOut sio : sios) {
|
1901 |
for (SchemeInOut sio : sios) {
|
| 1926 |
sio.setRolledBackTimestamp(LocalDateTime.now());
|
1902 |
sio.setRolledBackTimestamp(LocalDateTime.now());
|
| 1927 |
amountToRollback += sio.getAmount();
|
1903 |
amountToRollback += sio.getAmount();
|
| 1928 |
// sio.setSchemeType(SchemeType.OUT);
|
1904 |
// sio.setSchemeType(SchemeType.OUT);
|
| Line 1964... |
Line 1940... |
| 1964 |
uwh.setWalletId(userWalletMap.get(fofoOrder.getFofoId()));
|
1940 |
uwh.setWalletId(userWalletMap.get(fofoOrder.getFofoId()));
|
| 1965 |
uwh.setFofoId(fofoOrder.getFofoId());
|
1941 |
uwh.setFofoId(fofoOrder.getFofoId());
|
| 1966 |
uwh.setStoreCode(fofoOrder.getInvoiceNumber().split("/")[0]);
|
1942 |
uwh.setStoreCode(fofoOrder.getInvoiceNumber().split("/")[0]);
|
| 1967 |
userWalletHistory.add(uwh);
|
1943 |
userWalletHistory.add(uwh);
|
| 1968 |
}
|
1944 |
}
|
| 1969 |
});
|
1945 |
}
|
| 1970 |
|
1946 |
|
| 1971 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(
|
1947 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(
|
| 1972 |
Arrays.asList("Wallet Id", "Store Code", "Reference Type", "Reference", "Amount", "Description", "Timestamp"), userWalletHistory.stream().map(x -> Arrays.asList(x.getWalletId(), x.getStoreCode(), x.getReferenceType(), x.getReference(), x.getAmount(), x.getDescription(), x.getTimestamp())).collect(Collectors.toList()));
|
1948 |
Arrays.asList("Wallet Id", "Store Code", "Reference Type", "Reference", "Amount", "Description", "Timestamp"), userWalletHistory.stream().map(x -> Arrays.asList(x.getWalletId(), x.getStoreCode(), x.getReferenceType(), x.getReference(), x.getAmount(), x.getDescription(), x.getTimestamp())).collect(Collectors.toList()));
|
| 1973 |
|
1949 |
|
| 1974 |
ByteArrayOutputStream baosOuts = FileUtil.getCSVByteStream(
|
1950 |
ByteArrayOutputStream baosOuts = FileUtil.getCSVByteStream(
|
| Line 1983... |
Line 1959... |
| 1983 |
List<Integer> references = Arrays.asList(6744, 7347, 8320, 8891, 9124, 9217, 9263, 9379);
|
1959 |
List<Integer> references = Arrays.asList(6744, 7347, 8320, 8891, 9124, 9217, 9263, 9379);
|
| 1984 |
List<UserWalletHistory> userWalletHistory = new ArrayList<>();
|
1960 |
List<UserWalletHistory> userWalletHistory = new ArrayList<>();
|
| 1985 |
List<SchemeInOut> rolledbackSios = new ArrayList<>();
|
1961 |
List<SchemeInOut> rolledbackSios = new ArrayList<>();
|
| 1986 |
Map<Integer, Integer> userWalletMap = userWalletRepository.selectAll().stream().collect(Collectors.toMap(UserWallet::getUserId, UserWallet::getId));
|
1962 |
Map<Integer, Integer> userWalletMap = userWalletRepository.selectAll().stream().collect(Collectors.toMap(UserWallet::getUserId, UserWallet::getId));
|
| 1987 |
Map<Integer, SchemeType> schemeTypeMap = schemeRepository.selectAll().stream().collect(Collectors.toMap(Scheme::getId, Scheme::getType));
|
1963 |
Map<Integer, SchemeType> schemeTypeMap = schemeRepository.selectAll().stream().collect(Collectors.toMap(Scheme::getId, Scheme::getType));
|
| 1988 |
references.stream().forEach(reference -> {
|
1964 |
for (Integer reference : references) {
|
| 1989 |
FofoOrder fofoOrder = null;
|
1965 |
FofoOrder fofoOrder = null;
|
| 1990 |
try {
|
1966 |
try {
|
| 1991 |
fofoOrder = fofoOrderRepository.selectByOrderId(reference);
|
1967 |
fofoOrder = fofoOrderRepository.selectByOrderId(reference);
|
| 1992 |
} catch (Exception e) {
|
1968 |
} catch (Exception e) {
|
| 1993 |
|
1969 |
|
| Line 2002... |
Line 1978... |
| 2002 |
if (inventorySerialNumberMap.size() > 0) {
|
1978 |
if (inventorySerialNumberMap.size() > 0) {
|
| 2003 |
List<SchemeInOut> sios = schemeInOutRepository.selectByInventoryItemIds(inventorySerialNumberMap.keySet()).stream().filter(x -> schemeTypeMap.get(x.getSchemeId()).equals(SchemeType.OUT)).collect(Collectors.toList());
|
1979 |
List<SchemeInOut> sios = schemeInOutRepository.selectByInventoryItemIds(inventorySerialNumberMap.keySet()).stream().filter(x -> schemeTypeMap.get(x.getSchemeId()).equals(SchemeType.OUT)).collect(Collectors.toList());
|
| 2004 |
LOGGER.info("Found {} duplicate schemeouts for Orderid {}", sios.size(), fofoOrder.getId());
|
1980 |
LOGGER.info("Found {} duplicate schemeouts for Orderid {}", sios.size(), fofoOrder.getId());
|
| 2005 |
UserWalletHistory uwh = new UserWalletHistory();
|
1981 |
UserWalletHistory uwh = new UserWalletHistory();
|
| 2006 |
Map<Integer, List<SchemeInOut>> inventoryIdSouts = sios.stream().collect(groupingBy(SchemeInOut::getInventoryItemId, Collectors.toList()));
|
1982 |
Map<Integer, List<SchemeInOut>> inventoryIdSouts = sios.stream().collect(groupingBy(SchemeInOut::getInventoryItemId, Collectors.toList()));
|
| 2007 |
for (Map.Entry<Integer, List<SchemeInOut>> inventorySioEntry : inventoryIdSouts.entrySet()) {
|
1983 |
for (Entry<Integer, List<SchemeInOut>> inventorySioEntry : inventoryIdSouts.entrySet()) {
|
| 2008 |
List<SchemeInOut> outList = inventorySioEntry.getValue();
|
1984 |
List<SchemeInOut> outList = inventorySioEntry.getValue();
|
| 2009 |
if (outList.size() > 1) {
|
1985 |
if (outList.size() > 1) {
|
| 2010 |
|
1986 |
|
| 2011 |
}
|
1987 |
}
|
| 2012 |
}
|
1988 |
}
|
| Line 2018... |
Line 1994... |
| 2018 |
uwh.setWalletId(userWalletMap.get(fofoOrder.getFofoId()));
|
1994 |
uwh.setWalletId(userWalletMap.get(fofoOrder.getFofoId()));
|
| 2019 |
uwh.setFofoId(fofoOrder.getFofoId());
|
1995 |
uwh.setFofoId(fofoOrder.getFofoId());
|
| 2020 |
uwh.setStoreCode(fofoOrder.getInvoiceNumber().split("/")[0]);
|
1996 |
uwh.setStoreCode(fofoOrder.getInvoiceNumber().split("/")[0]);
|
| 2021 |
userWalletHistory.add(uwh);
|
1997 |
userWalletHistory.add(uwh);
|
| 2022 |
}
|
1998 |
}
|
| 2023 |
});
|
1999 |
}
|
| 2024 |
|
2000 |
|
| 2025 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(
|
2001 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(
|
| 2026 |
Arrays.asList("User Id", "Reference Type", "Reference", "Amount", "Description", "Timestamp"), userWalletHistory.stream().map(x -> Arrays.asList(x.getWalletId(), x.getReferenceType(), x.getReference(), x.getAmount(), x.getDescription(), x.getTimestamp())).collect(Collectors.toList()));
|
2002 |
Arrays.asList("User Id", "Reference Type", "Reference", "Amount", "Description", "Timestamp"), userWalletHistory.stream().map(x -> Arrays.asList(x.getWalletId(), x.getReferenceType(), x.getReference(), x.getAmount(), x.getDescription(), x.getTimestamp())).collect(Collectors.toList()));
|
| 2027 |
|
2003 |
|
| 2028 |
ByteArrayOutputStream baosOuts = FileUtil.getCSVByteStream(
|
2004 |
ByteArrayOutputStream baosOuts = FileUtil.getCSVByteStream(
|
| Line 3270... |
Line 3246... |
| 3270 |
}
|
3246 |
}
|
| 3271 |
|
3247 |
|
| 3272 |
@Autowired
|
3248 |
@Autowired
|
| 3273 |
WarehouseRepository warehouseRepository;
|
3249 |
WarehouseRepository warehouseRepository;
|
| 3274 |
|
3250 |
|
| 3275 |
public void getVendorWarehouses(int warehouseId) {
|
3251 |
public void getVendorWarehouses(int warehouseId) throws ProfitMandiBusinessException {
|
| 3276 |
LOGGER.info("Warehouses - {}", warehouseRepository.getVendorWarehouses().get(warehouseId));
|
3252 |
LOGGER.info("Warehouses - {}", warehouseRepository.getVendorWarehouses().get(warehouseId));
|
| 3277 |
|
3253 |
|
| 3278 |
}
|
3254 |
}
|
| 3279 |
|
3255 |
|
| 3280 |
public void checkImeiActivation() {
|
3256 |
public void checkImeiActivation() {
|
| Line 3703... |
Line 3679... |
| 3703 |
|
3679 |
|
| 3704 |
CreditAccount creditAccount = creditAccountRepository.selectByFofoIdAndGateway(loan.getFofoId(), Gateway.SDDIRECT);
|
3680 |
CreditAccount creditAccount = creditAccountRepository.selectByFofoIdAndGateway(loan.getFofoId(), Gateway.SDDIRECT);
|
| 3705 |
|
3681 |
|
| 3706 |
creditAccount.setAvailableAmount(sdCreditRequirement.getAvailableLimit().floatValue());
|
3682 |
creditAccount.setAvailableAmount(sdCreditRequirement.getAvailableLimit().floatValue());
|
| 3707 |
creditAccount.setUpdatedOn(LocalDateTime.now());
|
3683 |
creditAccount.setUpdatedOn(LocalDateTime.now());
|
| 3708 |
//userWallet.setAmount(0);
|
- |
|
| 3709 |
|
3684 |
|
| 3710 |
loan.setPendingAmount(
|
3685 |
loan.setPendingAmount(
|
| 3711 |
loan.getPendingAmount().subtract(BigDecimal.valueOf(userWalletAmount)));
|
3686 |
loan.getPendingAmount().subtract(BigDecimal.valueOf(userWalletAmount)));
|
| 3712 |
|
- |
|
| 3713 |
}
|
3687 |
}
|
| 3714 |
|
- |
|
| 3715 |
walletService.consumeAmountFromWallet(userWallet.getUserId(), loan.getId(), WalletReferenceType.LOAN_REPAYMENT, "Amount adjusted against loan", (float) Math.abs(paidAmount), LocalDateTime.now());
|
3688 |
walletService.consumeAmountFromWallet(userWallet.getUserId(), loan.getId(), WalletReferenceType.LOAN_REPAYMENT, "Amount adjusted against loan", (float) Math.abs(paidAmount), LocalDateTime.now());
|
| 3716 |
|
- |
|
| 3717 |
// createUserWalletHistory(userWallet.getId(), userWallet.getUserId(), WalletReferenceType.LOAN_REPAYMENT, loan.getId(), Math.abs(paidAmount));
|
- |
|
| 3718 |
|
- |
|
| 3719 |
} else {
|
3689 |
} else {
|
| 3720 |
|
- |
|
| 3721 |
settledLoanStatement(LoanReferenceType.INTEREST, BigDecimal.valueOf(userWallet.getAmount()), loan.getFofoId(), loan.getId(), "Amount adjusted against loan", LocalDateTime.now());
|
3690 |
settledLoanStatement(LoanReferenceType.INTEREST, BigDecimal.valueOf(userWallet.getAmount()), loan.getFofoId(), loan.getId(),
|
| - |
|
3691 |
"Amount adjusted against loan", LocalDateTime.now());
|
| 3722 |
|
3692 |
|
| 3723 |
paidAmount += Math.abs(userWallet.getAmount());
|
3693 |
paidAmount += Math.abs(userWallet.getAmount());
|
| 3724 |
|
3694 |
|
| 3725 |
loan.setInterestPaid(
|
- |
|
| 3726 |
loan.getInterestPaid().add(BigDecimal.valueOf(userWallet.getAmount()).abs()));
|
3695 |
loan.setInterestPaid(loan.getInterestPaid().add(BigDecimal.valueOf(userWallet.getAmount()).abs()));
|
| 3727 |
|
- |
|
| 3728 |
// createUserWalletHistory(userWallet.getId(), userWallet.getUserId(), WalletReferenceType.LOAN_REPAYMENT, loan.getId(), Math.abs(paidAmount));
|
3696 |
walletService.consumeAmountFromWallet(userWallet.getUserId(), loan.getId(), WalletReferenceType.LOAN_REPAYMENT,
|
| 3729 |
|
- |
|
| 3730 |
walletService.consumeAmountFromWallet(userWallet.getUserId(), loan.getId(), WalletReferenceType.LOAN_REPAYMENT, "Amount adjusted against loan", (float) Math.abs(paidAmount), LocalDateTime.now());
|
3697 |
"Amount adjusted against loan", (float) Math.abs(paidAmount), LocalDateTime.now());
|
| 3731 |
|
- |
|
| 3732 |
|
3698 |
|
| 3733 |
// userWallet.setAmount(0);
|
- |
|
| 3734 |
}
|
3699 |
}
|
| 3735 |
|
3700 |
|
| 3736 |
|
3701 |
|
| 3737 |
List<SanctionRequest> sanctionRequests = sanctionRequestRepository.selectHoldSanctionByFofoId(loan.getFofoId());
|
3702 |
List<SanctionRequest> sanctionRequests = sanctionRequestRepository.selectHoldSanctionByFofoId(loan.getFofoId());
|
| 3738 |
|
3703 |
|
| Line 3744... |
Line 3709... |
| 3744 |
LOGGER.info("Could not find orders - for Sanction Request {}", sanctionRequest);
|
3709 |
LOGGER.info("Could not find orders - for Sanction Request {}", sanctionRequest);
|
| 3745 |
continue;
|
3710 |
continue;
|
| 3746 |
}
|
3711 |
}
|
| 3747 |
|
3712 |
|
| 3748 |
if (settledAmount >= sanctionRequest.getPendingAmount().doubleValue()) {
|
3713 |
if (settledAmount >= sanctionRequest.getPendingAmount().doubleValue()) {
|
| 3749 |
settledAmount = settledAmount - sanctionRequest.getPendingAmount().doubleValue();
|
3714 |
settledAmount -= sanctionRequest.getPendingAmount().doubleValue();
|
| 3750 |
|
- |
|
| 3751 |
sanctionRequest.setPendingAmount(BigDecimal.valueOf(0));
|
3715 |
sanctionRequest.setPendingAmount(BigDecimal.valueOf(0));
|
| 3752 |
this.sendUnholdEmail(orders);
|
3716 |
this.sendUnholdEmail(orders);
|
| 3753 |
} else {
|
3717 |
} else {
|
| 3754 |
|
- |
|
| 3755 |
settledAmount = sanctionRequest.getPendingAmount().doubleValue() - settledAmount;
|
3718 |
settledAmount -= sanctionRequest.getPendingAmount().doubleValue();
|
| 3756 |
|
- |
|
| 3757 |
sanctionRequest.setPendingAmount(BigDecimal.valueOf(settledAmount));
|
3719 |
sanctionRequest.setPendingAmount(BigDecimal.valueOf(settledAmount));
|
| 3758 |
|
- |
|
| 3759 |
break;
|
3720 |
break;
|
| 3760 |
|
3721 |
|
| 3761 |
}
|
3722 |
}
|
| 3762 |
|
3723 |
|
| 3763 |
}
|
3724 |
}
|
| Line 3867... |
Line 3828... |
| 3867 |
@Autowired
|
3828 |
@Autowired
|
| 3868 |
FofoSidbiSanctionRepository fofoSidbiSanctionRepository;
|
3829 |
FofoSidbiSanctionRepository fofoSidbiSanctionRepository;
|
| 3869 |
|
3830 |
|
| 3870 |
public void updatePartnerLimit() throws ProfitMandiBusinessException {
|
3831 |
public void updatePartnerLimit() throws ProfitMandiBusinessException {
|
| 3871 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
|
3832 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
|
| 3872 |
Map<Integer, List<FofoSidbiSanction>> fofoSidbiSanctionMap = fofoSidbiSanctionRepository.selectAllUptoBy(ProfitMandiConstants.SIDBI_TENUERE_MONTHS).stream().collect(Collectors.groupingBy(x->x.getFofoId()));
|
3833 |
Map<Integer, List<FofoSidbiSanction>> fofoSidbiSanctionMap = fofoSidbiSanctionRepository.selectAllUptoBy(ProfitMandiConstants.SIDBI_TENUERE_MONTHS).stream().collect(Collectors.groupingBy(x -> x.getFofoId()));
|
| 3873 |
Map<Integer, SDCreditRequirement> sdCreditRequirementMap = sdCreditRequirementRepository.selectAll().stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
3834 |
Map<Integer, SDCreditRequirement> sdCreditRequirementMap = sdCreditRequirementRepository.selectAll().stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| 3874 |
Map<Integer, CreditAccount> creditAccountMap = creditAccountRepository.selectAllByGateways(Arrays.asList(Gateway.SIDBI, Gateway.SDDIRECT))
|
3835 |
Map<Integer, CreditAccount> creditAccountMap = creditAccountRepository.selectAllByGateways(Arrays.asList(Gateway.SIDBI, Gateway.SDDIRECT))
|
| 3875 |
.stream().filter(x -> x.isActive()).collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
3836 |
.stream().filter(x -> x.isActive()).collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| 3876 |
Map<Integer, CurrentPartnerDailyInvestment> currentPartnerDailyInvestmentMap = currentPartnerDailyInvestmentRepository.selectAll().stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
3837 |
Map<Integer, CurrentPartnerDailyInvestment> currentPartnerDailyInvestmentMap = currentPartnerDailyInvestmentRepository.selectAll().stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| 3877 |
for (Entry<Integer, CustomRetailer> customRetailerEntry : customRetailerMap.entrySet()) {
|
3838 |
for (Entry<Integer, CustomRetailer> customRetailerEntry : customRetailerMap.entrySet()) {
|
| Line 3941... |
Line 3902... |
| 3941 |
suggestedAmount = BigDecimal.valueOf(Math.min(currentPartnerDailyInvestment.getTotalInvestment() * 0.1, limitValue));
|
3902 |
suggestedAmount = BigDecimal.valueOf(Math.min(currentPartnerDailyInvestment.getTotalInvestment() * 0.1, limitValue));
|
| 3942 |
}
|
3903 |
}
|
| 3943 |
if (suggestedAmount.doubleValue() < 0) {
|
3904 |
if (suggestedAmount.doubleValue() < 0) {
|
| 3944 |
suggestedAmount = BigDecimal.ZERO;
|
3905 |
suggestedAmount = BigDecimal.ZERO;
|
| 3945 |
}
|
3906 |
}
|
| 3946 |
} else if(creditAccount.getGateway().equals(Gateway.SIDBI) && fofoSidbiSanctions!= null && fofoSidbiSanctions.size() > 0){
|
3907 |
} else if (creditAccount.getGateway().equals(Gateway.SIDBI) && fofoSidbiSanctions != null && fofoSidbiSanctions.size() > 0) {
|
| 3947 |
//Left
|
3908 |
//Left
|
| 3948 |
FofoSidbiSanction fofoSidbiSanction = fofoSidbiSanctions.get(0);
|
3909 |
FofoSidbiSanction fofoSidbiSanction = fofoSidbiSanctions.get(0);
|
| 3949 |
int monthsLeft = fofoSidbiSanction.getMonthsLeft(ProfitMandiConstants.SIDBI_TENUERE_MONTHS);
|
3910 |
int monthsLeft = fofoSidbiSanction.getMonthsLeft(ProfitMandiConstants.SIDBI_TENUERE_MONTHS);
|
| 3950 |
if(monthsLeft >=0) {
|
3911 |
if (monthsLeft >= 0) {
|
| 3951 |
suggestedAmount = BigDecimal.valueOf(fofoSidbiSanction.getSanctionAmount()*monthsLeft/ProfitMandiConstants.SIDBI_TENUERE_MONTHS);
|
3912 |
suggestedAmount = BigDecimal.valueOf(fofoSidbiSanction.getSanctionAmount() * monthsLeft / ProfitMandiConstants.SIDBI_TENUERE_MONTHS);
|
| 3952 |
}
|
3913 |
}
|
| 3953 |
}
|
3914 |
}
|
| 3954 |
return suggestedAmount;
|
3915 |
return suggestedAmount;
|
| 3955 |
}
|
3916 |
}
|
| 3956 |
|
3917 |
|
| Line 4047... |
Line 4008... |
| 4047 |
Map<Integer, com.spice.profitmandi.dao.model.FofoRBMReportingModel> fofoRbmReportingModelMap = csService.getPartnerIdRBMHeaders();
|
4008 |
Map<Integer, com.spice.profitmandi.dao.model.FofoRBMReportingModel> fofoRbmReportingModelMap = csService.getPartnerIdRBMHeaders();
|
| 4048 |
StringBuilder sb = new StringBuilder();
|
4009 |
StringBuilder sb = new StringBuilder();
|
| 4049 |
sb.append("<html><body><p>Alert</p><p>Due Date Cross Partners :-</p>" + "<br/><p>Additional penal interest of shall be levied on daily basis.</p>" + "<br/>" +
|
4010 |
sb.append("<html><body><p>Alert</p><p>Due Date Cross Partners :-</p>" + "<br/><p>Additional penal interest of shall be levied on daily basis.</p>" + "<br/>" +
|
| 4050 |
"<table style='border:1px solid black ;padding: 5px';>");
|
4011 |
"<table style='border:1px solid black ;padding: 5px';>");
|
| 4051 |
sb.append("<tbody>\n" + "<tr>\n" +
|
4012 |
sb.append("<tbody>\n" + "<tr>\n" +
|
| 4052 |
"<th style='border:1px solid black;padding: 5px'>PartnerName</th>\n" +
|
4013 |
"<th style='border:1px solid black;padding: 5px'>PartnerName</th>\n" +
|
| 4053 |
"<th style='border:1px solid black;padding: 5px'>State Name</th>\n" +
|
4014 |
"<th style='border:1px solid black;padding: 5px'>State Name</th>\n" +
|
| 4054 |
"<th style='border:1px solid black;padding: 5px'>due date</th>\n" +
|
4015 |
"<th style='border:1px solid black;padding: 5px'>due date</th>\n" +
|
| 4055 |
"<th style='border:1px solid black;padding: 5px'>Days</th>\n" +
|
4016 |
"<th style='border:1px solid black;padding: 5px'>Days</th>\n" +
|
| 4056 |
"<th style='border:1px solid black;padding: 5px'>Pending Amount</th>\n"+
|
4017 |
"<th style='border:1px solid black;padding: 5px'>Pending Amount</th>\n" +
|
| 4057 |
"<th style='border:1px solid black;padding: 5px'>RBM L1</th>\n"+
|
4018 |
"<th style='border:1px solid black;padding: 5px'>RBM L1</th>\n" +
|
| 4058 |
"<th style='border:1px solid black;padding: 5px'>RBM L2</th>\n"+
|
4019 |
"<th style='border:1px solid black;padding: 5px'>RBM L2</th>\n" +
|
| 4059 |
"<th style='border:1px solid black;padding: 5px'>Sales L1</th>\n"+
|
4020 |
"<th style='border:1px solid black;padding: 5px'>Sales L1</th>\n" +
|
| 4060 |
"<th style='border:1px solid black;padding: 5px'>Sales L2</th>\n"+
|
4021 |
"<th style='border:1px solid black;padding: 5px'>Sales L2</th>\n" +
|
| 4061 |
"</tr>");
|
4022 |
"</tr>");
|
| 4062 |
|
4023 |
|
| 4063 |
for (Loan entry : loans) {
|
4024 |
for (Loan entry : loans) {
|
| 4064 |
|
4025 |
|
| 4065 |
List<LoanStatement> loanStatements = loanStatementRepository.selectByLoanId(entry.getId());
|
4026 |
List<LoanStatement> loanStatements = loanStatementRepository.selectByLoanId(entry.getId());
|
| Line 4308... |
Line 4269... |
| 4308 |
}
|
4269 |
}
|
| 4309 |
|
4270 |
|
| 4310 |
@Autowired
|
4271 |
@Autowired
|
| 4311 |
SaholicReservationSnapshotRepository saholicReservationSnapshotRepository;
|
4272 |
SaholicReservationSnapshotRepository saholicReservationSnapshotRepository;
|
| 4312 |
|
4273 |
|
| 4313 |
public void removePartialBillingForTransaction(int transactionId) {
|
4274 |
public void removePartialBillingForTransaction(int transactionId) throws ProfitMandiBusinessException {
|
| 4314 |
List<Order> orderList = orderRepository.selectAllByTransactionId(transactionId);
|
4275 |
List<Order> orderList = orderRepository.selectAllByTransactionId(transactionId);
|
| 4315 |
Map<Integer, Order> orderMap = orderList.stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
4276 |
Map<Integer, Order> orderMap = orderList.stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| 4316 |
//Delete scanRecords
|
4277 |
//Delete scanRecords
|
| 4317 |
List<WarehouseScan> warehouseScans = warehouseScanRepository.selectAllByOrderIds(new ArrayList<>(orderMap.keySet()));
|
4278 |
List<WarehouseScan> warehouseScans = warehouseScanRepository.selectAllByOrderIds(new ArrayList<>(orderMap.keySet()));
|
| 4318 |
for (WarehouseScan warehouseScan : warehouseScans) {
|
4279 |
for (WarehouseScan warehouseScan : warehouseScans) {
|
| Line 4420... |
Line 4381... |
| 4420 |
}
|
4381 |
}
|
| 4421 |
|
4382 |
|
| 4422 |
}
|
4383 |
}
|
| 4423 |
|
4384 |
|
| 4424 |
private String getMessageHygieneAlertForPartner(
|
4385 |
private String getMessageHygieneAlertForPartner(
|
| 4425 |
Map<Integer, Map<YearMonth, List<HygieneData>>> partnerYearMonthData, Map<Integer, Map<LocalDate, List<HygieneData>>> partnerDateWiseData) {
|
4386 |
Map<Integer, Map<YearMonth, List<HygieneData>>> partnerYearMonthData, Map<Integer, Map<LocalDate, List<HygieneData>>> partnerDateWiseData)
|
| - |
|
4387 |
throws ProfitMandiBusinessException {
|
| 4426 |
|
4388 |
|
| 4427 |
Map<Integer, CustomRetailer> customeRetailerMap = retailerService.getAllFofoRetailers();
|
4389 |
Map<Integer, CustomRetailer> customeRetailerMap = retailerService.getAllFofoRetailers();
|
| 4428 |
|
4390 |
|
| 4429 |
LocalDateTime startDate = LocalDate.now().withDayOfMonth(1).atStartOfDay();
|
4391 |
LocalDateTime startDate = LocalDate.now().withDayOfMonth(1).atStartOfDay();
|
| 4430 |
LocalDateTime endDate = LocalDateTime.now();
|
4392 |
LocalDateTime endDate = LocalDateTime.now();
|
| Line 4685... |
Line 4647... |
| 4685 |
|
4647 |
|
| 4686 |
@Autowired
|
4648 |
@Autowired
|
| 4687 |
private VendorCatalogPricingService vendorCatalogPricingService;
|
4649 |
private VendorCatalogPricingService vendorCatalogPricingService;
|
| 4688 |
|
4650 |
|
| 4689 |
|
4651 |
|
| 4690 |
public void migrateVendorItemPricing() {
|
4652 |
public void migrateVendorItemPricing() throws ProfitMandiBusinessException {
|
| 4691 |
|
4653 |
|
| 4692 |
List<VendorItemPricing> vendorItemPricings = vendorItemPricingRepository.selectAll();
|
4654 |
List<VendorItemPricing> vendorItemPricings = vendorItemPricingRepository.selectAll();
|
| 4693 |
LOGGER.info("At migrate VendorItemPricing");
|
4655 |
LOGGER.info("At migrate VendorItemPricing");
|
| 4694 |
Map<Integer, Item> items = itemRepository.selectByIds(vendorItemPricings.stream().map(x -> x.getItemId()).collect(Collectors.toSet())).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
4656 |
Map<Integer, Item> items = itemRepository.selectByIds(vendorItemPricings.stream().map(x -> x.getItemId()).collect(Collectors.toSet())).stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| 4695 |
for (VendorItemPricing vendorItemPricing : vendorItemPricings) {
|
4657 |
for (VendorItemPricing vendorItemPricing : vendorItemPricings) {
|