| Line 67... |
Line 67... |
| 67 |
import com.spice.profitmandi.dao.repository.warehouse.*;
|
67 |
import com.spice.profitmandi.dao.repository.warehouse.*;
|
| 68 |
import com.spice.profitmandi.dao.service.biuedart.BluedartAuthService;
|
68 |
import com.spice.profitmandi.dao.service.biuedart.BluedartAuthService;
|
| 69 |
import com.spice.profitmandi.dao.service.biuedart.BluedartService;
|
69 |
import com.spice.profitmandi.dao.service.biuedart.BluedartService;
|
| 70 |
import com.spice.profitmandi.dao.service.solr.FofoSolr;
|
70 |
import com.spice.profitmandi.dao.service.solr.FofoSolr;
|
| 71 |
import com.spice.profitmandi.service.*;
|
71 |
import com.spice.profitmandi.service.*;
|
| 72 |
import com.spice.profitmandi.service.catalog.BrandsService;
|
- |
|
| 73 |
import com.spice.profitmandi.service.integrations.CCAvenuePaymentService;
|
72 |
import com.spice.profitmandi.service.integrations.CCAvenuePaymentService;
|
| 74 |
import com.spice.profitmandi.service.integrations.RazorpayPaymentService;
|
73 |
import com.spice.profitmandi.service.integrations.RazorpayPaymentService;
|
| 75 |
import com.spice.profitmandi.service.integrations.bharti.model.BAGInsuranceModel;
|
74 |
import com.spice.profitmandi.service.integrations.bharti.model.BAGInsuranceModel;
|
| 76 |
import com.spice.profitmandi.service.integrations.psismart.PsiSmartService;
|
75 |
import com.spice.profitmandi.service.integrations.psismart.PsiSmartService;
|
| 77 |
import com.spice.profitmandi.service.integrations.smartping.SmartPingService;
|
76 |
import com.spice.profitmandi.service.integrations.smartping.SmartPingService;
|
| Line 124... |
Line 123... |
| 124 |
import javax.mail.internet.MimeMessage;
|
123 |
import javax.mail.internet.MimeMessage;
|
| 125 |
import java.io.*;
|
124 |
import java.io.*;
|
| 126 |
import java.math.BigDecimal;
|
125 |
import java.math.BigDecimal;
|
| 127 |
import java.math.RoundingMode;
|
126 |
import java.math.RoundingMode;
|
| 128 |
import java.nio.file.Files;
|
127 |
import java.nio.file.Files;
|
| 129 |
import java.nio.file.Path;
|
- |
|
| 130 |
import java.nio.file.Paths;
|
128 |
import java.nio.file.Paths;
|
| 131 |
import java.sql.Timestamp;
|
129 |
import java.sql.Timestamp;
|
| 132 |
import java.text.DecimalFormat;
|
130 |
import java.text.DecimalFormat;
|
| 133 |
import java.time.*;
|
131 |
import java.time.*;
|
| 134 |
import java.time.format.DateTimeFormatter;
|
132 |
import java.time.format.DateTimeFormatter;
|
| Line 1029... |
Line 1027... |
| 1029 |
|
1027 |
|
| 1030 |
@Autowired
|
1028 |
@Autowired
|
| 1031 |
InvoiceService invoiceService;
|
1029 |
InvoiceService invoiceService;
|
| 1032 |
|
1030 |
|
| 1033 |
public void test() throws Exception {
|
1031 |
public void test() throws Exception {
|
| 1034 |
invoiceService.createInvoices(Arrays.asList("NSDLUK62", "NSDL39915", "NSDLHR24036", "NSDL39831", "NSNOI5266", "NSDL39849"));
|
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 |
});
|
| 1035 |
//this.setInventoryItemIdToPriceDropImei();
|
1036 |
//this.setInventoryItemIdToPriceDropImei();
|
| 1036 |
//fofoSolr.populateTagItems();
|
1037 |
//fofoSolr.populateTagItems();
|
| 1037 |
//System.out.println(smartPingService.getAllAgentsByEmail());
|
1038 |
//System.out.println(smartPingService.getAllAgentsByEmail());
|
| 1038 |
//System.out.println(psiSmartService.getRegistrationEndPoint("9990381569"));
|
1039 |
//System.out.println(psiSmartService.getRegistrationEndPoint("9990381569"));
|
| 1039 |
//migrateValentine();
|
1040 |
//migrateValentine();
|
| Line 3526... |
Line 3527... |
| 3526 |
|
3527 |
|
| 3527 |
if (!unAuthorizedBuyingMap.isEmpty()) {
|
3528 |
if (!unAuthorizedBuyingMap.isEmpty()) {
|
| 3528 |
for (Map.Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES), true).entrySet()) {
|
3529 |
for (Map.Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMappingByCategoryIds(Arrays.asList(ProfitMandiConstants.TICKET_CATEGORY_RBM, ProfitMandiConstants.TICKET_CATEGORY_SALES), true).entrySet()) {
|
| 3529 |
List<NonSdBuying> unAuthorizedfilteredRows = storeGuyEntry.getValue().stream()
|
3530 |
List<NonSdBuying> unAuthorizedfilteredRows = storeGuyEntry.getValue().stream()
|
| 3530 |
.map(x -> unAuthorizedBuyingMap.get(x)).filter(x -> x != null).collect(Collectors.toList());
|
3531 |
.map(x -> unAuthorizedBuyingMap.get(x)).filter(x -> x != null).collect(Collectors.toList());
|
| 3531 |
if(!unAuthorizedfilteredRows.isEmpty()){
|
3532 |
if (!unAuthorizedfilteredRows.isEmpty()) {
|
| 3532 |
String subject = "Unauthorized Buying";
|
3533 |
String subject = "Unauthorized Buying";
|
| 3533 |
String messageText = this.getMessageForUnauthorizedBuying(unAuthorizedfilteredRows);
|
3534 |
String messageText = this.getMessageForUnauthorizedBuying(unAuthorizedfilteredRows);
|
| 3534 |
|
3535 |
|
| 3535 |
MimeMessage message = mailSender.createMimeMessage();
|
3536 |
MimeMessage message = mailSender.createMimeMessage();
|
| 3536 |
MimeMessageHelper helper = new MimeMessageHelper(message, true);
|
3537 |
MimeMessageHelper helper = new MimeMessageHelper(message, true);
|
| 3537 |
String[] email = new String[]{storeGuyEntry.getKey()};
|
3538 |
String[] email = new String[]{storeGuyEntry.getKey()};
|
| 3538 |
// String[] email = {"ranu.rajput@smartdukaan.com"};
|
3539 |
// String[] email = {"ranu.rajput@smartdukaan.com"};
|
| 3539 |
|
3540 |
|
| 3540 |
helper.setSubject(subject);
|
3541 |
helper.setSubject(subject);
|
| 3541 |
helper.setText(messageText, true);
|
3542 |
helper.setText(messageText, true);
|
| 3542 |
helper.setTo(email);
|
3543 |
helper.setTo(email);
|
| 3543 |
InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "Smartdukaan Alerts");
|
3544 |
InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "Smartdukaan Alerts");
|
| Line 3860... |
Line 3861... |
| 3860 |
|
3861 |
|
| 3861 |
public void processActivatedImeisForSchemes() throws ProfitMandiBusinessException {
|
3862 |
public void processActivatedImeisForSchemes() throws ProfitMandiBusinessException {
|
| 3862 |
schemeService.processActivatedImeisForSchemes();
|
3863 |
schemeService.processActivatedImeisForSchemes();
|
| 3863 |
}
|
3864 |
}
|
| 3864 |
|
3865 |
|
| - |
|
3866 |
@Autowired
|
| - |
|
3867 |
FofoSidbiSanctionRepository fofoSidbiSanctionRepository;
|
| - |
|
3868 |
|
| 3865 |
public void updatePartnerLimit() throws ProfitMandiBusinessException {
|
3869 |
public void updatePartnerLimit() throws ProfitMandiBusinessException {
|
| 3866 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
|
3870 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
|
| 3867 |
|
- |
|
| - |
|
3871 |
Map<Integer, List<FofoSidbiSanction>> fofoSidbiSanctionMap = fofoSidbiSanctionRepository.selectAllUptoBy(ProfitMandiConstants.SIDBI_TENUERE_MONTHS).stream().collect(Collectors.groupingBy(x->x.getFofoId()));
|
| 3868 |
Map<Integer, SDCreditRequirement> sdCreditRequirementMap = sdCreditRequirementRepository.selectAll().stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
3872 |
Map<Integer, SDCreditRequirement> sdCreditRequirementMap = sdCreditRequirementRepository.selectAll().stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| - |
|
3873 |
Map<Integer, CreditAccount> creditAccountMap = creditAccountRepository.selectAllByGateays(Arrays.asList(Gateway.SIDBI, Gateway.SDDIRECT))
|
| - |
|
3874 |
.stream().filter(x -> x.isActive()).collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| 3869 |
Map<Integer, CurrentPartnerDailyInvestment> currentPartnerDailyInvestmentMap = currentPartnerDailyInvestmentRepository.selectAll().stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
3875 |
Map<Integer, CurrentPartnerDailyInvestment> currentPartnerDailyInvestmentMap = currentPartnerDailyInvestmentRepository.selectAll().stream().collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| 3870 |
double limitValue = 100000;
|
- |
|
| 3871 |
for (Entry<Integer, CustomRetailer> customRetailerEntry : customRetailerMap.entrySet()) {
|
3876 |
for (Entry<Integer, CustomRetailer> customRetailerEntry : customRetailerMap.entrySet()) {
|
| 3872 |
int fofoId = customRetailerEntry.getKey();
|
3877 |
int fofoId = customRetailerEntry.getKey();
|
| 3873 |
SDCreditRequirement sdCreditRequirement = sdCreditRequirementMap.get(customRetailerEntry.getKey());
|
- |
|
| 3874 |
LocalDateTime firstBillingDate = transactionRepository.getFirstBillingDate(fofoId);
|
3878 |
LocalDateTime firstBillingDate = transactionRepository.getFirstBillingDate(fofoId);
|
| 3875 |
CurrentPartnerDailyInvestment currentPartnerDailyInvestment = currentPartnerDailyInvestmentMap.get(fofoId);
|
- |
|
| 3876 |
BigDecimal suggestedAmount = BigDecimal.ZERO;
|
3879 |
CreditAccount creditAccount = creditAccountMap.get(fofoId);
|
| 3877 |
if (currentPartnerDailyInvestment != null) {
|
- |
|
| 3878 |
suggestedAmount = BigDecimal.valueOf(currentPartnerDailyInvestment.getTotalInvestment() * 0.1);
|
- |
|
| 3879 |
}
|
- |
|
| 3880 |
|
- |
|
| 3881 |
if (suggestedAmount.doubleValue() > limitValue) {
|
- |
|
| 3882 |
|
3880 |
|
| 3883 |
suggestedAmount = BigDecimal.valueOf(limitValue);
|
3881 |
CurrentPartnerDailyInvestment currentPartnerDailyInvestment = currentPartnerDailyInvestmentMap.get(fofoId);
|
| 3884 |
|
- |
|
| 3885 |
}
|
3882 |
List<FofoSidbiSanction> fofoSidbiSanctions = fofoSidbiSanctionMap.get(fofoId);
|
| 3886 |
|
- |
|
| 3887 |
if (suggestedAmount.doubleValue() < 0) {
|
3883 |
BigDecimal suggestedAmount = this.getSuggestedAmount(creditAccount, currentPartnerDailyInvestment, fofoSidbiSanctions);
|
| 3888 |
suggestedAmount = BigDecimal.ZERO;
|
3884 |
SDCreditRequirement sdCreditRequirement = sdCreditRequirementMap.get(fofoId);
|
| 3889 |
}
|
- |
|
| 3890 |
|
3885 |
|
| 3891 |
LOGGER.info("suggestedAmount {} ", suggestedAmount);
|
3886 |
LOGGER.info("suggestedAmount {} ", suggestedAmount);
|
| 3892 |
|
3887 |
|
| 3893 |
if (sdCreditRequirement == null) {
|
3888 |
if (sdCreditRequirement == null) {
|
| 3894 |
sdCreditRequirement = new SDCreditRequirement();
|
3889 |
sdCreditRequirement = new SDCreditRequirement();
|
| Line 3920... |
Line 3915... |
| 3920 |
|
3915 |
|
| 3921 |
sdCreditRequirement.setUtilizedAmount(utilizedLimit);
|
3916 |
sdCreditRequirement.setUtilizedAmount(utilizedLimit);
|
| 3922 |
|
3917 |
|
| 3923 |
sdCreditRequirement.setUpdateTimestamp(LocalDateTime.now());
|
3918 |
sdCreditRequirement.setUpdateTimestamp(LocalDateTime.now());
|
| 3924 |
|
3919 |
|
| 3925 |
CreditAccount creditAccount = creditAccountRepository.selectByFofoIdAndGateway(sdCreditRequirement.getFofoId(), Gateway.SDDIRECT);
|
- |
|
| 3926 |
if (creditAccount != null) {
|
3920 |
if (creditAccount != null) {
|
| 3927 |
|
3921 |
|
| 3928 |
creditAccount.setInterestRate(sdCreditRequirement.getInterestRate().floatValue());
|
3922 |
creditAccount.setInterestRate(sdCreditRequirement.getInterestRate().floatValue());
|
| 3929 |
creditAccount.setSanctionedAmount(sdCreditRequirement.getLimit().floatValue());
|
3923 |
creditAccount.setSanctionedAmount(sdCreditRequirement.getLimit().floatValue());
|
| 3930 |
creditAccount.setAvailableAmount(availableLimit.floatValue());
|
3924 |
creditAccount.setAvailableAmount(availableLimit.floatValue());
|
| Line 3934... |
Line 3928... |
| 3934 |
|
3928 |
|
| 3935 |
}
|
3929 |
}
|
| 3936 |
|
3930 |
|
| 3937 |
}
|
3931 |
}
|
| 3938 |
|
3932 |
|
| - |
|
3933 |
private BigDecimal getSuggestedAmount(CreditAccount creditAccount, CurrentPartnerDailyInvestment currentPartnerDailyInvestment, List<FofoSidbiSanction> fofoSidbiSanctions) {
|
| - |
|
3934 |
BigDecimal suggestedAmount = BigDecimal.ZERO;
|
| - |
|
3935 |
//1 LAC
|
| - |
|
3936 |
double limitValue = 100000;
|
| - |
|
3937 |
if (creditAccount.getGateway().equals(Gateway.SDDIRECT)) {
|
| - |
|
3938 |
|
| - |
|
3939 |
if (currentPartnerDailyInvestment != null) {
|
| - |
|
3940 |
suggestedAmount = BigDecimal.valueOf(Math.min(currentPartnerDailyInvestment.getTotalInvestment() * 0.1, limitValue));
|
| - |
|
3941 |
}
|
| - |
|
3942 |
if (suggestedAmount.doubleValue() < 0) {
|
| - |
|
3943 |
suggestedAmount = BigDecimal.ZERO;
|
| - |
|
3944 |
}
|
| - |
|
3945 |
} else if(creditAccount.getGateway().equals(Gateway.SIDBI) && fofoSidbiSanctions!= null && fofoSidbiSanctions.size() > 0){
|
| - |
|
3946 |
//Left
|
| - |
|
3947 |
FofoSidbiSanction fofoSidbiSanction = fofoSidbiSanctions.get(0);
|
| - |
|
3948 |
int monthsLeft = fofoSidbiSanction.getMonthsLeft(ProfitMandiConstants.SIDBI_TENUERE_MONTHS);
|
| - |
|
3949 |
if(monthsLeft >=0) {
|
| - |
|
3950 |
suggestedAmount = BigDecimal.valueOf(fofoSidbiSanction.getSanctionAmount()*monthsLeft/ProfitMandiConstants.SIDBI_TENUERE_MONTHS);
|
| - |
|
3951 |
}
|
| - |
|
3952 |
}
|
| - |
|
3953 |
return suggestedAmount;
|
| - |
|
3954 |
}
|
| - |
|
3955 |
|
| 3939 |
public void notifyDefaultLoans() throws ProfitMandiBusinessException, MessagingException, IOException {
|
3956 |
public void notifyDefaultLoans() throws ProfitMandiBusinessException, MessagingException, IOException {
|
| 3940 |
|
3957 |
|
| 3941 |
sdCreditService.updateRisk();
|
3958 |
sdCreditService.updateRisk();
|
| 3942 |
List<Loan> defaultLoans = sdCreditService.getDefaultLoan();
|
3959 |
List<Loan> defaultLoans = sdCreditService.getDefaultLoan();
|
| 3943 |
if (!defaultLoans.isEmpty()) {
|
3960 |
if (!defaultLoans.isEmpty()) {
|