| Line 695... |
Line 695... |
| 695 |
rechargeTransactionRepository.persist(rt);
|
695 |
rechargeTransactionRepository.persist(rt);
|
| 696 |
}
|
696 |
}
|
| 697 |
LOGGER.info("Cashbacks for Recharge processed Successfully");
|
697 |
LOGGER.info("Cashbacks for Recharge processed Successfully");
|
| 698 |
}
|
698 |
}
|
| 699 |
|
699 |
|
| 700 |
public void rollOutUpgardedMarginsNextMonth() throws Exception {
|
700 |
public void rollOutUpgardedMarginsNextMonth(List<Integer> fofoIds) throws Exception {
|
| 701 |
LocalDate startOfPreviousMonth = LocalDate.now().with(ChronoField.DAY_OF_MONTH, 1).minusMonths(1);
|
701 |
LocalDate startOfPreviousMonth = LocalDate.now().with(ChronoField.DAY_OF_MONTH, 1).minusMonths(1);
|
| 702 |
|
- |
|
| - |
|
702 |
List<FofoStore> stores;
|
| - |
|
703 |
if (fofoIds != null || fofoIds.isEmpty()) {
|
| 703 |
List<FofoStore> stores = fofoStoreRepository.selectActiveStores();
|
704 |
stores = fofoStoreRepository.selectActiveStores();
|
| - |
|
705 |
} else {
|
| - |
|
706 |
stores = fofoStoreRepository.selectByRetailerIds(fofoIds);
|
| - |
|
707 |
}
|
| 704 |
for (FofoStore store : stores) {
|
708 |
for (FofoStore store : stores) {
|
| 705 |
this.rolloutMarginForStoreOnMonth(store, startOfPreviousMonth);
|
709 |
this.rolloutMarginForStoreOnMonth(store, startOfPreviousMonth);
|
| 706 |
}
|
710 |
}
|
| 707 |
}
|
711 |
}
|
| 708 |
|
712 |
|
| Line 722... |
Line 726... |
| 722 |
}
|
726 |
}
|
| 723 |
}
|
727 |
}
|
| 724 |
}
|
728 |
}
|
| 725 |
|
729 |
|
| 726 |
|
730 |
|
| 727 |
public void rollOutUpgardedMargins() throws Exception {
|
731 |
public void rollOutUpgardedMargins(List<Integer> fofoIds) throws Exception {
|
| 728 |
LocalDate today = LocalDate.now();
|
732 |
LocalDate today = LocalDate.now();
|
| 729 |
LocalDate yesterday = today.minusDays(1);
|
733 |
LocalDate yesterday = today.minusDays(1);
|
| 730 |
int upgradedCount = 0;
|
734 |
int upgradedCount = 0;
|
| - |
|
735 |
List<FofoStore> stores;
|
| - |
|
736 |
if (fofoIds == null || fofoIds.isEmpty()) {
|
| 731 |
List<FofoStore> stores = fofoStoreRepository.selectActiveStores();
|
737 |
stores = fofoStoreRepository.selectActiveStores();
|
| - |
|
738 |
} else {
|
| - |
|
739 |
stores = fofoStoreRepository.selectByRetailerIds(fofoIds);
|
| - |
|
740 |
}
|
| 732 |
|
741 |
|
| 733 |
// Bulk fetch partner types to avoid N+1 queries
|
742 |
// Bulk fetch partner types to avoid N+1 queries
|
| 734 |
List<Integer> fofoIds = stores.stream().map(FofoStore::getId).collect(Collectors.toList());
|
- |
|
| 735 |
Map<Integer, PartnerType> yesterdayTypeMap = partnerTypeChangeService.getTypesForFofoIds(fofoIds, yesterday);
|
743 |
Map<Integer, PartnerType> yesterdayTypeMap = partnerTypeChangeService.getTypesForFofoIds(fofoIds, yesterday);
|
| 736 |
Map<Integer, PartnerType> todayTypeMap = partnerTypeChangeService.getTypesForFofoIds(fofoIds, today);
|
744 |
Map<Integer, PartnerType> todayTypeMap = partnerTypeChangeService.getTypesForFofoIds(fofoIds, today);
|
| 737 |
|
745 |
|
| 738 |
StringBuilder sb = new StringBuilder();
|
746 |
StringBuilder sb = new StringBuilder();
|
| 739 |
for (FofoStore store : stores) {
|
747 |
for (FofoStore store : stores) {
|
| Line 767... |
Line 775... |
| 767 |
}
|
775 |
}
|
| 768 |
|
776 |
|
| 769 |
@Autowired
|
777 |
@Autowired
|
| 770 |
private PartnerStatsService partnerStatsService;
|
778 |
private PartnerStatsService partnerStatsService;
|
| 771 |
|
779 |
|
| 772 |
// Temporary Method
|
780 |
// Temporary Method
|
| 773 |
|
781 |
|
| 774 |
public void fetchParnterStats() throws Exception {
|
782 |
public void fetchParnterStats() throws Exception {
|
| 775 |
Map<Integer, PartnerDetailModel> partnerStats = partnerStatsService.getAllPartnerStats();
|
783 |
Map<Integer, PartnerDetailModel> partnerStats = partnerStatsService.getAllPartnerStats();
|
| 776 |
ObjectOutputStream oos = null;
|
784 |
ObjectOutputStream oos = null;
|
| 777 |
FileOutputStream fout = null;
|
785 |
FileOutputStream fout = null;
|
| Line 848... |
Line 856... |
| 848 |
|
856 |
|
| 849 |
public void processDeductions() {
|
857 |
public void processDeductions() {
|
| 850 |
sidbiService.processDeductions();
|
858 |
sidbiService.processDeductions();
|
| 851 |
}
|
859 |
}
|
| 852 |
|
860 |
|
| 853 |
public void resetHardLimit() throws ProfitMandiBusinessException{
|
861 |
public void resetHardLimit() throws ProfitMandiBusinessException {
|
| 854 |
sdCreditService.resetHardLimit();
|
862 |
sdCreditService.resetHardLimit();
|
| 855 |
}
|
863 |
}
|
| 856 |
|
864 |
|
| 857 |
public void testInvoiceFormat() throws ProfitMandiBusinessException {
|
865 |
public void testInvoiceFormat() throws ProfitMandiBusinessException {
|
| 858 |
InvoicePdfModel invoicePdfModel = orderService.getInvoicePdfModel(560280);
|
866 |
InvoicePdfModel invoicePdfModel = orderService.getInvoicePdfModel(560280);
|
| 859 |
//System.out.println(InvoiceFormatter.buildInvoiceLines(invoicePdfModel, InvoiceFormatter.WIDTH_80MM));
|
867 |
//System.out.println(InvoiceFormatter.buildInvoiceLines(invoicePdfModel, InvoiceFormatter.WIDTH_80MM));
|
| 860 |
}
|
868 |
}
|
| 861 |
|
869 |
|
| 862 |
public void sendTrialExpiry() {
|
870 |
public void sendTrialExpiry() {
|
| 863 |
List<FofoStore> stores = fofoStoreRepository.selectAllTrial();
|
871 |
List<FofoStore> stores = fofoStoreRepository.selectAllTrial();
|
| 864 |
List<FofoStore> twoDaysToExpiry = stores.stream().filter(x->x.getTrialEnd().minusDays(2).equals(LocalDate.now())).collect(Collectors.toList());
|
872 |
List<FofoStore> twoDaysToExpiry = stores.stream().filter(x -> x.getTrialEnd().minusDays(2).equals(LocalDate.now())).collect(Collectors.toList());
|
| 865 |
|
873 |
|
| 866 |
List<FofoStore> fiveDaysToExpiry = stores.stream().filter(x->x.getTrialEnd().minusDays(5).equals(LocalDate.now())).collect(Collectors.toList());
|
874 |
List<FofoStore> fiveDaysToExpiry = stores.stream().filter(x -> x.getTrialEnd().minusDays(5).equals(LocalDate.now())).collect(Collectors.toList());
|
| 867 |
List<FofoStore> expiredToday = stores.stream().filter(x->x.getTrialEnd().equals(LocalDate.now())).collect(Collectors.toList());
|
875 |
List<FofoStore> expiredToday = stores.stream().filter(x -> x.getTrialEnd().equals(LocalDate.now())).collect(Collectors.toList());
|
| 868 |
List<FofoStore> expired = stores.stream().filter(x->x.getTrialEnd().isAfter(LocalDate.now())).collect(Collectors.toList());
|
876 |
List<FofoStore> expired = stores.stream().filter(x -> x.getTrialEnd().isAfter(LocalDate.now())).collect(Collectors.toList());
|
| 869 |
}
|
877 |
}
|
| 870 |
|
878 |
|
| 871 |
/*public void processCashDiscount() throws ProfitMandiBusinessException {
|
879 |
/*public void processCashDiscount() throws ProfitMandiBusinessException {
|
| 872 |
System.out.println("processing cash discount");
|
880 |
System.out.println("processing cash discount");
|
| 873 |
List<Loan> loansSettledYesterday = loanRepository.selectLoansSettledOn(LocalDate.now().minusDays(1));
|
881 |
List<Loan> loansSettledYesterday = loanRepository.selectLoansSettledOn(LocalDate.now().minusDays(1));
|
| Line 1138... |
Line 1146... |
| 1138 |
@Autowired
|
1146 |
@Autowired
|
| 1139 |
AbmReportSender abmReportSender;
|
1147 |
AbmReportSender abmReportSender;
|
| 1140 |
|
1148 |
|
| 1141 |
public void sendOverDueReport() {
|
1149 |
public void sendOverDueReport() {
|
| 1142 |
List<Loan> loans = loanRepository.selectAllActiveLoan();
|
1150 |
List<Loan> loans = loanRepository.selectAllActiveLoan();
|
| 1143 |
Map<Integer, List<Loan>> partnerLoansMap = loans.stream().filter(x->x.isOverdue()).collect(Collectors.groupingBy(x->x.getFofoId()));
|
1151 |
Map<Integer, List<Loan>> partnerLoansMap = loans.stream().filter(x -> x.isOverdue()).collect(Collectors.groupingBy(x -> x.getFofoId()));
|
| 1144 |
//sdCreditService.getDueDateCrossLoan()
|
1152 |
//sdCreditService.getDueDateCrossLoan()
|
| 1145 |
partnerLoansMap.entrySet().stream().forEach(x->{
|
1153 |
partnerLoansMap.entrySet().stream().forEach(x -> {
|
| 1146 |
|
1154 |
|
| 1147 |
x.getKey();
|
1155 |
x.getKey();
|
| 1148 |
x.getValue().size();
|
1156 |
x.getValue().size();
|
| 1149 |
});
|
1157 |
});
|
| 1150 |
|
1158 |
|
| Line 1171... |
Line 1179... |
| 1171 |
@Autowired
|
1179 |
@Autowired
|
| 1172 |
com.spice.profitmandi.service.integrations.pinelabs.PinelabsAffordabilityService pinelabsAffordabilityService;
|
1180 |
com.spice.profitmandi.service.integrations.pinelabs.PinelabsAffordabilityService pinelabsAffordabilityService;
|
| 1173 |
|
1181 |
|
| 1174 |
@Autowired
|
1182 |
@Autowired
|
| 1175 |
com.spice.profitmandi.service.integrations.pinelabs.PinelabsAuthService pinelabsAuthService;
|
1183 |
com.spice.profitmandi.service.integrations.pinelabs.PinelabsAuthService pinelabsAuthService;
|
| - |
|
1184 |
|
| 1176 |
public void testAffordability() {
|
1185 |
public void testAffordability() {
|
| 1177 |
Money orderAmount = new Money("1000000", "INR");
|
1186 |
Money orderAmount = new Money("1000000", "INR");
|
| 1178 |
Money discountAmount = new Money("0", "INR");
|
1187 |
Money discountAmount = new Money("0", "INR");
|
| 1179 |
List<ProductDetails> productDetails = Arrays.asList(new ProductDetails(orderAmount, discountAmount, "Alpha_2"));
|
1188 |
List<ProductDetails> productDetails = Arrays.asList(new ProductDetails(orderAmount, discountAmount, "Alpha_2"));
|
| 1180 |
OfferDiscoveryRequest offerDiscoveryRequest = new com.spice.profitmandi.service.integrations.pinelabs.dto.OfferDiscoveryRequest(orderAmount, productDetails, new AffordabilityIssuer("12345678"));
|
1189 |
OfferDiscoveryRequest offerDiscoveryRequest = new com.spice.profitmandi.service.integrations.pinelabs.dto.OfferDiscoveryRequest(orderAmount, productDetails, new AffordabilityIssuer("12345678"));
|
| 1181 |
OfferDiscoveryResponse offerDiscoveryResponse = pinelabsAffordabilityService.discoverOffers(offerDiscoveryRequest);
|
1190 |
OfferDiscoveryResponse offerDiscoveryResponse = pinelabsAffordabilityService.discoverOffers(offerDiscoveryRequest);
|
| 1182 |
System.out.println(offerDiscoveryResponse);
|
1191 |
System.out.println(offerDiscoveryResponse);
|
| 1183 |
}
|
1192 |
}
|
| - |
|
1193 |
|
| 1184 |
public void test() throws Exception {
|
1194 |
public void test() throws Exception {
|
| 1185 |
|
1195 |
|
| 1186 |
System.out.println(pinelabsAuthService.getAccessToken());
|
1196 |
System.out.println(pinelabsAuthService.getAccessToken());
|
| 1187 |
testAffordability();
|
1197 |
testAffordability();
|
| 1188 |
|
1198 |
|
| Line 1239... |
Line 1249... |
| 1239 |
List<Loan> blockedLoans = loanRepository.selectAllBlockedLoans();
|
1249 |
List<Loan> blockedLoans = loanRepository.selectAllBlockedLoans();
|
| 1240 |
for (Loan blockedLoan : blockedLoans) {
|
1250 |
for (Loan blockedLoan : blockedLoans) {
|
| 1241 |
LoanTransaction loanTransaction = loanTransactionRepository.selectByLoanId(blockedLoan.getId());
|
1251 |
LoanTransaction loanTransaction = loanTransactionRepository.selectByLoanId(blockedLoan.getId());
|
| 1242 |
int transactionId = loanTransaction.getTransactionId();
|
1252 |
int transactionId = loanTransaction.getTransactionId();
|
| 1243 |
List<UserWalletHistory> userWalletHistory = walletService.getAllByReference(blockedLoan.getFofoId(), transactionId, WalletReferenceType.PURCHASE);
|
1253 |
List<UserWalletHistory> userWalletHistory = walletService.getAllByReference(blockedLoan.getFofoId(), transactionId, WalletReferenceType.PURCHASE);
|
| 1244 |
int amount = userWalletHistory.get(userWalletHistory.size()-1).getAmount();
|
1254 |
int amount = userWalletHistory.get(userWalletHistory.size() - 1).getAmount();
|
| 1245 |
int loanAmount = blockedLoan.getIntialAmount().intValue();
|
1255 |
int loanAmount = blockedLoan.getIntialAmount().intValue();
|
| 1246 |
if(loanAmount > -amount) {
|
1256 |
if (loanAmount > -amount) {
|
| 1247 |
sdCreditService.settleBlockedLoan(transactionId, loanAmount+amount);
|
1257 |
sdCreditService.settleBlockedLoan(transactionId, loanAmount + amount);
|
| 1248 |
}
|
1258 |
}
|
| 1249 |
|
1259 |
|
| 1250 |
|
1260 |
|
| 1251 |
|
- |
|
| 1252 |
}
|
1261 |
}
|
| 1253 |
}
|
1262 |
}
|
| 1254 |
|
1263 |
|
| 1255 |
@Autowired
|
1264 |
@Autowired
|
| 1256 |
LoanTransactionRepository loanTransactionRepository;
|
1265 |
LoanTransactionRepository loanTransactionRepository;
|
| Line 1704... |
Line 1713... |
| 1704 |
private Map<Integer, FofoReportingModel> getPartnerIdSalesHeaders() throws ProfitMandiBusinessException {
|
1713 |
private Map<Integer, FofoReportingModel> getPartnerIdSalesHeaders() throws ProfitMandiBusinessException {
|
| 1705 |
Map<String, SaleRoles> partnerEmailSalesMap = new HashMap<>();
|
1714 |
Map<String, SaleRoles> partnerEmailSalesMap = new HashMap<>();
|
| 1706 |
Map<String, SaleRoles> partnerEmailRBMMap = new HashMap<>();
|
1715 |
Map<String, SaleRoles> partnerEmailRBMMap = new HashMap<>();
|
| 1707 |
Map<String, SaleRoles> partnerEmailABMMap = new HashMap<>();
|
1716 |
Map<String, SaleRoles> partnerEmailABMMap = new HashMap<>();
|
| 1708 |
|
1717 |
|
| 1709 |
List<Position> positions = positionRepository.selectPositionByCategoryIds(Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_RBM,ProfitMandiConstants.TICKET_CATEGORY_ABM));
|
1718 |
List<Position> positions = positionRepository.selectPositionByCategoryIds(Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_ABM));
|
| 1710 |
Map<Integer, AuthUser> authUsersMap = authRepository.selectAllActiveUser().stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
1719 |
Map<Integer, AuthUser> authUsersMap = authRepository.selectAllActiveUser().stream().collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| 1711 |
Map<Integer, List<CustomRetailer>> positionIdRetailerMap = csService.getPositionCustomRetailerMap(positions);
|
1720 |
Map<Integer, List<CustomRetailer>> positionIdRetailerMap = csService.getPositionCustomRetailerMap(positions);
|
| 1712 |
for (Position position : positions) {
|
1721 |
for (Position position : positions) {
|
| 1713 |
List<CustomRetailer> crList = positionIdRetailerMap.get(position.getId());
|
1722 |
List<CustomRetailer> crList = positionIdRetailerMap.get(position.getId());
|
| 1714 |
if (crList == null)
|
1723 |
if (crList == null)
|
| Line 1762... |
Line 1771... |
| 1762 |
continue;
|
1771 |
continue;
|
| 1763 |
}
|
1772 |
}
|
| 1764 |
String name = authUser.getFirstName() + " " + authUser.getLastName();
|
1773 |
String name = authUser.getFirstName() + " " + authUser.getLastName();
|
| 1765 |
if (position.getEscalationType().equals(EscalationType.L1) || position.getEscalationType().equals(EscalationType.L1)) {
|
1774 |
if (position.getEscalationType().equals(EscalationType.L1) || position.getEscalationType().equals(EscalationType.L1)) {
|
| 1766 |
saleRoles.getL1().add(name);
|
1775 |
saleRoles.getL1().add(name);
|
| 1767 |
}
|
- |
|
| 1768 |
else if (position.getEscalationType().equals(EscalationType.L2)) {
|
1776 |
} else if (position.getEscalationType().equals(EscalationType.L2)) {
|
| 1769 |
saleRoles.getL2().add(name);
|
1777 |
saleRoles.getL2().add(name);
|
| 1770 |
}
|
1778 |
}
|
| 1771 |
}
|
1779 |
}
|
| 1772 |
}
|
1780 |
}
|
| 1773 |
|
1781 |
|
| Line 2387... |
Line 2395... |
| 2387 |
Exception {
|
2395 |
Exception {
|
| 2388 |
String timeString = "Today %s";
|
2396 |
String timeString = "Today %s";
|
| 2389 |
LocalDateTime now = LocalDateTime.now();
|
2397 |
LocalDateTime now = LocalDateTime.now();
|
| 2390 |
|
2398 |
|
| 2391 |
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("h:m a");
|
2399 |
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("h:m a");
|
| 2392 |
List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_LOGISTICS, ProfitMandiConstants.TICKET_CATEGORY_FINANCIAL_SERVICES, ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES,ProfitMandiConstants.TICKET_CATEGORY_ABM, ProfitMandiConstants.TICKET_CATEGORY_MARKETING, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT, ProfitMandiConstants.TICKET_CATEGORY_TECHNOLOGY);
|
2400 |
List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_LOGISTICS, ProfitMandiConstants.TICKET_CATEGORY_FINANCIAL_SERVICES, ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_ABM, ProfitMandiConstants.TICKET_CATEGORY_MARKETING, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT, ProfitMandiConstants.TICKET_CATEGORY_TECHNOLOGY);
|
| 2393 |
|
2401 |
|
| 2394 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false);
|
2402 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false);
|
| 2395 |
|
2403 |
|
| 2396 |
for (Entry<String, Set<Integer>> storeGuyEntry : storeGuyMap.entrySet()) {
|
2404 |
for (Entry<String, Set<Integer>> storeGuyEntry : storeGuyMap.entrySet()) {
|
| 2397 |
String email = storeGuyEntry.getKey();
|
2405 |
String email = storeGuyEntry.getKey();
|
| Line 3616... |
Line 3624... |
| 3616 |
|
3624 |
|
| 3617 |
}
|
3625 |
}
|
| 3618 |
}
|
3626 |
}
|
| 3619 |
if (!salesEscalatedRemarksMap.isEmpty()) {
|
3627 |
if (!salesEscalatedRemarksMap.isEmpty()) {
|
| 3620 |
//
|
3628 |
//
|
| 3621 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_SALES,ProfitMandiConstants.TICKET_CATEGORY_ABM, ProfitMandiConstants.TICKET_CATEGORY_RBM), true).entrySet()) {
|
3629 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_ABM, ProfitMandiConstants.TICKET_CATEGORY_RBM), true).entrySet()) {
|
| 3622 |
List<PartnerCollectionRemark> filteredRows = storeGuyEntry.getValue().stream()
|
3630 |
List<PartnerCollectionRemark> filteredRows = storeGuyEntry.getValue().stream()
|
| 3623 |
.map(x -> salesEscalatedRemarksMap.get(x)).filter(x -> x != null).collect(Collectors.toList());
|
3631 |
.map(x -> salesEscalatedRemarksMap.get(x)).filter(x -> x != null).collect(Collectors.toList());
|
| 3624 |
String subject = "Partners escalated to Sales";
|
3632 |
String subject = "Partners escalated to Sales";
|
| 3625 |
String messageText = this.getMessageForSalesEscalatedPartners(filteredRows);
|
3633 |
String messageText = this.getMessageForSalesEscalatedPartners(filteredRows);
|
| 3626 |
|
3634 |
|
| Line 3652... |
Line 3660... |
| 3652 |
ProfitMandiBusinessException, MessagingException, UnsupportedEncodingException {
|
3660 |
ProfitMandiBusinessException, MessagingException, UnsupportedEncodingException {
|
| 3653 |
List<NonSdBuying> nonSdByuingActiveList = nonSdBuyingRepository.selectAllActiveNonSDBuyingList(true);
|
3661 |
List<NonSdBuying> nonSdByuingActiveList = nonSdBuyingRepository.selectAllActiveNonSDBuyingList(true);
|
| 3654 |
Map<Integer, NonSdBuying> unAuthorizedBuyingMap = nonSdByuingActiveList.stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
3662 |
Map<Integer, NonSdBuying> unAuthorizedBuyingMap = nonSdByuingActiveList.stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| 3655 |
|
3663 |
|
| 3656 |
if (!unAuthorizedBuyingMap.isEmpty()) {
|
3664 |
if (!unAuthorizedBuyingMap.isEmpty()) {
|
| 3657 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES,ProfitMandiConstants.TICKET_CATEGORY_ABM), true).entrySet()) {
|
3665 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_ABM), true).entrySet()) {
|
| 3658 |
List<NonSdBuying> unAuthorizedfilteredRows = storeGuyEntry.getValue().stream()
|
3666 |
List<NonSdBuying> unAuthorizedfilteredRows = storeGuyEntry.getValue().stream()
|
| 3659 |
.map(x -> unAuthorizedBuyingMap.get(x)).filter(x -> x != null).collect(Collectors.toList());
|
3667 |
.map(x -> unAuthorizedBuyingMap.get(x)).filter(x -> x != null).collect(Collectors.toList());
|
| 3660 |
if (!unAuthorizedfilteredRows.isEmpty()) {
|
3668 |
if (!unAuthorizedfilteredRows.isEmpty()) {
|
| 3661 |
String subject = "Unauthorized Buying";
|
3669 |
String subject = "Unauthorized Buying";
|
| 3662 |
String messageText = this.getMessageForUnauthorizedBuying(unAuthorizedfilteredRows);
|
3670 |
String messageText = this.getMessageForUnauthorizedBuying(unAuthorizedfilteredRows);
|
| Line 3873... |
Line 3881... |
| 3873 |
|
3881 |
|
| 3874 |
public void processSidbiDeductions() throws ProfitMandiBusinessException {
|
3882 |
public void processSidbiDeductions() throws ProfitMandiBusinessException {
|
| 3875 |
//sidbiService.migrateSanctions();
|
3883 |
//sidbiService.migrateSanctions();
|
| 3876 |
sidbiService.processDeductions();
|
3884 |
sidbiService.processDeductions();
|
| 3877 |
}
|
3885 |
}
|
| - |
|
3886 |
|
| 3878 |
public void updatePartnerLimit(int fofoId) throws ProfitMandiBusinessException {
|
3887 |
public void updatePartnerLimit(int fofoId) throws ProfitMandiBusinessException {
|
| 3879 |
LocalDateTime firstBillingDate = transactionRepository.getFirstBillingDate(fofoId);
|
3888 |
LocalDateTime firstBillingDate = transactionRepository.getFirstBillingDate(fofoId);
|
| 3880 |
|
3889 |
|
| 3881 |
CreditAccount creditAccount = creditAccountRepository.selectByFofoIdAndGateway(fofoId, Gateway.SDDIRECT);
|
3890 |
CreditAccount creditAccount = creditAccountRepository.selectByFofoIdAndGateway(fofoId, Gateway.SDDIRECT);
|
| 3882 |
BigDecimal utilizationAmount = sdCreditService.getUtilizationAmount(fofoId);
|
3891 |
BigDecimal utilizationAmount = sdCreditService.getUtilizationAmount(fofoId);
|
| Line 3926... |
Line 3935... |
| 3926 |
creditAccount.setFreeDays(sdCreditRequirement.getFreeDays());
|
3935 |
creditAccount.setFreeDays(sdCreditRequirement.getFreeDays());
|
| 3927 |
creditAccount.setUpdatedOn(LocalDateTime.now());
|
3936 |
creditAccount.setUpdatedOn(LocalDateTime.now());
|
| 3928 |
}
|
3937 |
}
|
| 3929 |
|
3938 |
|
| 3930 |
}
|
3939 |
}
|
| - |
|
3940 |
|
| 3931 |
public void updatePartnerLimit() throws ProfitMandiBusinessException {
|
3941 |
public void updatePartnerLimit() throws ProfitMandiBusinessException {
|
| 3932 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
|
3942 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
|
| 3933 |
Map<Integer, BigDecimal> fofoSidbiLimitMap = sidbiService.getSuggestedLimitMap();
|
3943 |
Map<Integer, BigDecimal> fofoSidbiLimitMap = sidbiService.getSuggestedLimitMap();
|
| 3934 |
Map<Integer, SDCreditRequirement> sdCreditRequirementMap = sdCreditRequirementRepository.selectAll().stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
3944 |
Map<Integer, SDCreditRequirement> sdCreditRequirementMap = sdCreditRequirementRepository.selectAll().stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| 3935 |
Map<Integer, CreditAccount> creditAccountMap = creditAccountRepository.selectAllByGateways(Arrays.asList(Gateway.SIDBI, Gateway.SDDIRECT))
|
3945 |
Map<Integer, CreditAccount> creditAccountMap = creditAccountRepository.selectAllByGateways(Arrays.asList(Gateway.SIDBI, Gateway.SDDIRECT))
|
| Line 4057... |
Line 4067... |
| 4057 |
|
4067 |
|
| 4058 |
public void sendDefaultLoanAlert(List<Loan> defaultLoans) throws
|
4068 |
public void sendDefaultLoanAlert(List<Loan> defaultLoans) throws
|
| 4059 |
ProfitMandiBusinessException, MessagingException, IOException {
|
4069 |
ProfitMandiBusinessException, MessagingException, IOException {
|
| 4060 |
String subject = "Default Partners";
|
4070 |
String subject = "Default Partners";
|
| 4061 |
|
4071 |
|
| 4062 |
List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES,ProfitMandiConstants.TICKET_CATEGORY_ABM, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT);
|
4072 |
List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_ABM, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT);
|
| 4063 |
|
4073 |
|
| 4064 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false).entrySet()) {
|
4074 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false).entrySet()) {
|
| 4065 |
List<Loan> filteredRows = new ArrayList<>();
|
4075 |
List<Loan> filteredRows = new ArrayList<>();
|
| 4066 |
for (Loan loan : defaultLoans) {
|
4076 |
for (Loan loan : defaultLoans) {
|
| 4067 |
|
4077 |
|
| Line 4207... |
Line 4217... |
| 4207 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + new DecimalFormat("#.##").format(Math.abs(amount)) + "</td>");
|
4217 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + new DecimalFormat("#.##").format(Math.abs(amount)) + "</td>");
|
| 4208 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + fofoRbmReportingModelMap.get(entry.getFofoId()).getL1Manager() + "</td>");
|
4218 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + fofoRbmReportingModelMap.get(entry.getFofoId()).getL1Manager() + "</td>");
|
| 4209 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + fofoRbmReportingModelMap.get(entry.getFofoId()).getL2Manager() + "</td>");
|
4219 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + fofoRbmReportingModelMap.get(entry.getFofoId()).getL2Manager() + "</td>");
|
| 4210 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + fofoReportingModelMap.get(entry.getFofoId()).getTerritoryManager() + "</td>");
|
4220 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + fofoReportingModelMap.get(entry.getFofoId()).getTerritoryManager() + "</td>");
|
| 4211 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + fofoReportingModelMap.get(entry.getFofoId()).getRegionalManager() + "</td>");
|
4221 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + fofoReportingModelMap.get(entry.getFofoId()).getRegionalManager() + "</td>");
|
| 4212 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + df.format(sdCreditRequirement.getLimit()) + "</td>");
|
4222 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + df.format(sdCreditRequirement.getLimit()) + "</td>");
|
| 4213 |
sb.append("</tr>");
|
4223 |
sb.append("</tr>");
|
| 4214 |
}
|
4224 |
}
|
| 4215 |
|
4225 |
|
| 4216 |
sb.append("</tbody></table></body></html>");
|
4226 |
sb.append("</tbody></table></body></html>");
|
| 4217 |
|
4227 |
|
| Line 4221... |
Line 4231... |
| 4221 |
public void notifyLoanDueDateCross() throws Exception {
|
4231 |
public void notifyLoanDueDateCross() throws Exception {
|
| 4222 |
|
4232 |
|
| 4223 |
List<Loan> dueDateCrossLoans = sdCreditService.getDueDateCrossLoan();
|
4233 |
List<Loan> dueDateCrossLoans = sdCreditService.getDueDateCrossLoan();
|
| 4224 |
List<Loan> allActiveLoans = sdCreditService.getAllActiveLoan();
|
4234 |
List<Loan> allActiveLoans = sdCreditService.getAllActiveLoan();
|
| 4225 |
if (!dueDateCrossLoans.isEmpty()) {
|
4235 |
if (!dueDateCrossLoans.isEmpty()) {
|
| 4226 |
this.sendDueDateCrossLoanAlert(dueDateCrossLoans,allActiveLoans);
|
4236 |
this.sendDueDateCrossLoanAlert(dueDateCrossLoans, allActiveLoans);
|
| 4227 |
}
|
4237 |
}
|
| 4228 |
|
4238 |
|
| 4229 |
}
|
4239 |
}
|
| 4230 |
|
4240 |
|
| 4231 |
private void sendDueDateCrossLoanAlert(List<Loan> dueDateCrossLoans,List<Loan> allActiveLoans) throws Exception {
|
4241 |
private void sendDueDateCrossLoanAlert(List<Loan> dueDateCrossLoans, List<Loan> allActiveLoans) throws Exception {
|
| 4232 |
List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES,ProfitMandiConstants.TICKET_CATEGORY_ABM, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT);
|
4242 |
List<Integer> categoryIds = Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_CATEGORY, ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES, ProfitMandiConstants.TICKET_CATEGORY_ABM, ProfitMandiConstants.TICKET_CATEGORY_ACCOUNTS, ProfitMandiConstants.TICKET_CATEGORY_BUSINESSINTELLIGENT);
|
| 4233 |
|
4243 |
|
| 4234 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false).entrySet()) {
|
4244 |
for (Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(categoryIds, false).entrySet()) {
|
| 4235 |
List<Loan> filteredRows = new ArrayList<>();
|
4245 |
List<Loan> filteredRows = new ArrayList<>();
|
| 4236 |
for (Loan loan : dueDateCrossLoans) {
|
4246 |
for (Loan loan : dueDateCrossLoans) {
|
| 4237 |
|
4247 |
|
| Line 4250... |
Line 4260... |
| 4250 |
}
|
4260 |
}
|
| 4251 |
}
|
4261 |
}
|
| 4252 |
|
4262 |
|
| 4253 |
ByteArrayOutputStream byteArrayOutputStream = null;
|
4263 |
ByteArrayOutputStream byteArrayOutputStream = null;
|
| 4254 |
Utils.Attachment attachment1 = null;
|
4264 |
Utils.Attachment attachment1 = null;
|
| 4255 |
if(!filteredAllActiveLoans.isEmpty()){
|
4265 |
if (!filteredAllActiveLoans.isEmpty()) {
|
| 4256 |
byteArrayOutputStream = this.generateLoanCsv(filteredAllActiveLoans);
|
4266 |
byteArrayOutputStream = this.generateLoanCsv(filteredAllActiveLoans);
|
| 4257 |
attachment1 = new Utils.Attachment("partnner-credit.csv", new ByteArrayResource(byteArrayOutputStream.toByteArray()));
|
4267 |
attachment1 = new Utils.Attachment("partnner-credit.csv", new ByteArrayResource(byteArrayOutputStream.toByteArray()));
|
| 4258 |
|
4268 |
|
| 4259 |
}
|
4269 |
}
|
| 4260 |
|
4270 |
|
| 4261 |
|
4271 |
|
| 4262 |
|
- |
|
| 4263 |
if (!filteredRows.isEmpty()) {
|
4272 |
if (!filteredRows.isEmpty()) {
|
| 4264 |
String messageText = this.getMessageForDueDateCross(filteredRows);
|
4273 |
String messageText = this.getMessageForDueDateCross(filteredRows);
|
| 4265 |
String[] email = new String[]{storeGuyEntry.getKey()};
|
4274 |
String[] email = new String[]{storeGuyEntry.getKey()};
|
| 4266 |
|
4275 |
|
| 4267 |
if(attachment1 != null){
|
4276 |
if (attachment1 != null) {
|
| 4268 |
Utils.sendMailWithAttachments(googleMailSender, email, null, null, "Partner Credit Report", messageText, true, attachment1);
|
4277 |
Utils.sendMailWithAttachments(googleMailSender, email, null, null, "Partner Credit Report", messageText, true, attachment1);
|
| 4269 |
}else {
|
4278 |
} else {
|
| 4270 |
this.sendMailOfHtmlFormat(googleMailSender, email, messageText, null, "Due Date Cross");
|
4279 |
this.sendMailOfHtmlFormat(googleMailSender, email, messageText, null, "Due Date Cross");
|
| 4271 |
|
4280 |
|
| 4272 |
}
|
4281 |
}
|
| 4273 |
|
4282 |
|
| 4274 |
}
|
4283 |
}
|
| 4275 |
|
4284 |
|
| 4276 |
}
|
4285 |
}
|
| 4277 |
|
4286 |
|
| 4278 |
String messageText = this.getMessageForDueDateCross(dueDateCrossLoans);
|
4287 |
String messageText = this.getMessageForDueDateCross(dueDateCrossLoans);
|
| 4279 |
ByteArrayOutputStream byteArrayOutputStream = this.generateLoanCsv(allActiveLoans);
|
4288 |
ByteArrayOutputStream byteArrayOutputStream = this.generateLoanCsv(allActiveLoans);
|
| 4280 |
Utils.Attachment attachment = null;
|
4289 |
Utils.Attachment attachment = null;
|
| 4281 |
if(byteArrayOutputStream != null){
|
4290 |
if (byteArrayOutputStream != null) {
|
| 4282 |
attachment = new Utils.Attachment("partnner-credit.csv", new ByteArrayResource(byteArrayOutputStream.toByteArray()));
|
4291 |
attachment = new Utils.Attachment("partnner-credit.csv", new ByteArrayResource(byteArrayOutputStream.toByteArray()));
|
| 4283 |
|
4292 |
|
| 4284 |
}
|
4293 |
}
|
| 4285 |
|
4294 |
|
| 4286 |
if(attachment != null){
|
4295 |
if (attachment != null) {
|
| 4287 |
Utils.sendMailWithAttachments(googleMailSender, new String[]{"sdtech@smartdukaan.com"}, null, null, "Partner Credit Report", messageText, true, attachment);
|
4296 |
Utils.sendMailWithAttachments(googleMailSender, new String[]{"sdtech@smartdukaan.com"}, null, null, "Partner Credit Report", messageText, true, attachment);
|
| 4288 |
}else {
|
4297 |
} else {
|
| 4289 |
this.sendMailOfHtmlFormat(googleMailSender, new String[]{"sdtech@smartdukaan.com"}, messageText, null, "Due Date Cross");
|
4298 |
this.sendMailOfHtmlFormat(googleMailSender, new String[]{"sdtech@smartdukaan.com"}, messageText, null, "Due Date Cross");
|
| 4290 |
}
|
4299 |
}
|
| 4291 |
|
4300 |
|
| 4292 |
|
4301 |
|
| 4293 |
if (!dueDateCrossLoans.isEmpty()) {
|
4302 |
if (!dueDateCrossLoans.isEmpty()) {
|
| Line 5334... |
Line 5343... |
| 5334 |
.stream()
|
5343 |
.stream()
|
| 5335 |
.collect(Collectors.toList())
|
5344 |
.collect(Collectors.toList())
|
| 5336 |
);
|
5345 |
);
|
| 5337 |
|
5346 |
|
| 5338 |
|
5347 |
|
| 5339 |
|
- |
|
| 5340 |
|
- |
|
| 5341 |
|
- |
|
| 5342 |
Map<Integer, Map<Integer, Integer>> activatedButNotBilledCatalogQtyMap = smartCartService.activatedButNotBilledCatalogQtyMap();
|
5348 |
Map<Integer, Map<Integer, Integer>> activatedButNotBilledCatalogQtyMap = smartCartService.activatedButNotBilledCatalogQtyMap();
|
| 5343 |
LOGGER.info("PartnerOpeningStockByTodayModel {}", partnerOpeningStockByTodayMap);
|
5349 |
LOGGER.info("PartnerOpeningStockByTodayModel {}", partnerOpeningStockByTodayMap);
|
| 5344 |
for (Map.Entry<Integer, List<PartnerOpeningStockByTodayModel>> entry : partnerOpeningStockByTodayMap.entrySet()) {
|
5350 |
for (Map.Entry<Integer, List<PartnerOpeningStockByTodayModel>> entry : partnerOpeningStockByTodayMap.entrySet()) {
|
| 5345 |
int fofoId = entry.getKey();
|
5351 |
int fofoId = entry.getKey();
|
| 5346 |
List<PartnerOpeningStockByTodayModel> partnerStockList = entry.getValue();
|
5352 |
List<PartnerOpeningStockByTodayModel> partnerStockList = entry.getValue();
|
| Line 5353... |
Line 5359... |
| 5353 |
int stockCurrentQty = partnerStock.getOpeningQty();
|
5359 |
int stockCurrentQty = partnerStock.getOpeningQty();
|
| 5354 |
LocalDate openingDate = partnerStock.getOpeningDate();
|
5360 |
LocalDate openingDate = partnerStock.getOpeningDate();
|
| 5355 |
|
5361 |
|
| 5356 |
int soldButNotBilledQty = activatedButNotBilledQtyMap.getOrDefault(catalogId, 0);
|
5362 |
int soldButNotBilledQty = activatedButNotBilledQtyMap.getOrDefault(catalogId, 0);
|
| 5357 |
|
5363 |
|
| 5358 |
if(catalogId ==1025656 && fofoId == 175140232 ){
|
5364 |
if (catalogId == 1025656 && fofoId == 175140232) {
|
| 5359 |
LOGGER.info("catalogId {}",catalogId);
|
5365 |
LOGGER.info("catalogId {}", catalogId);
|
| 5360 |
LOGGER.info("fofoId {}",fofoId);
|
5366 |
LOGGER.info("fofoId {}", fofoId);
|
| 5361 |
LOGGER.info("soldButNotBilledQty {}",soldButNotBilledQty);
|
5367 |
LOGGER.info("soldButNotBilledQty {}", soldButNotBilledQty);
|
| 5362 |
LOGGER.info("stockCurrentQty {}",stockCurrentQty);
|
5368 |
LOGGER.info("stockCurrentQty {}", stockCurrentQty);
|
| 5363 |
}
|
5369 |
}
|
| 5364 |
|
5370 |
|
| 5365 |
// Subtract soldQty from partnerCurrentQty
|
5371 |
// Subtract soldQty from partnerCurrentQty
|
| 5366 |
int partnerCurrentQty = Math.max(stockCurrentQty - soldButNotBilledQty, 0); // Ensure it doesn't go negative
|
5372 |
int partnerCurrentQty = Math.max(stockCurrentQty - soldButNotBilledQty, 0); // Ensure it doesn't go negative
|
| 5367 |
|
5373 |
|