Subversion Repositories SmartDukaan

Rev

Rev 36556 | Rev 36581 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 36556 Rev 36561
Line 10... Line 10...
10
import com.smartdukaan.cron.migrations.RunOnceTasks;
10
import com.smartdukaan.cron.migrations.RunOnceTasks;
11
import com.smartdukaan.cron.scheduled.ambreports.AbmReportSender;
11
import com.smartdukaan.cron.scheduled.ambreports.AbmReportSender;
12
import com.smartdukaan.cron.scheduled.runnables.PurchaseMigration;
12
import com.smartdukaan.cron.scheduled.runnables.PurchaseMigration;
13
import com.spice.profitmandi.common.enumuration.*;
13
import com.spice.profitmandi.common.enumuration.*;
14
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
14
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
-
 
15
import org.springframework.scheduling.annotation.Scheduled;
15
import com.spice.profitmandi.common.model.*;
16
import com.spice.profitmandi.common.model.*;
16
import com.spice.profitmandi.common.services.ReporticoService;
17
import com.spice.profitmandi.common.services.ReporticoService;
17
import com.spice.profitmandi.common.services.mandii.MandiiService;
18
import com.spice.profitmandi.common.services.mandii.MandiiService;
18
import com.spice.profitmandi.common.util.FileUtil;
19
import com.spice.profitmandi.common.util.FileUtil;
19
import com.spice.profitmandi.common.util.FormattingUtils;
20
import com.spice.profitmandi.common.util.FormattingUtils;
Line 3973... Line 3974...
3973
        }
3974
        }
3974
 
3975
 
3975
 
3976
 
3976
    }
3977
    }
3977
 
3978
 
-
 
3979
    @Scheduled(cron = "0 0 1 * * *")
3978
    public void convertExpiredFlagshipCredits() {
3980
    public void convertExpiredFlagshipCredits() {
3979
        synchronized (SD_CREDIT_LOCK) {
3981
        synchronized (SD_CREDIT_LOCK) {
3980
            try {
3982
            try {
3981
                sdCreditService.convertExpiredFlagshipCredits();
3983
                sdCreditService.convertExpiredFlagshipCredits();
3982
            } catch (Exception e) {
3984
            } catch (Exception e) {
3983
                LOGGER.error("Error converting expired flagship credits", e);
3985
                LOGGER.error("Error converting expired flagship credits", e);
3984
            }
3986
            }
3985
        }
3987
        }
3986
    }
3988
    }
3987
 
3989
 
-
 
3990
    public void testFlagshipBilling(int transactionId, double invoiceAmount, String invoiceNumber) {
-
 
3991
        synchronized (SD_CREDIT_LOCK) {
-
 
3992
            try {
-
 
3993
                System.out.println("=== TEST: Calling createLoanForBilling ===");
-
 
3994
                System.out.println("transactionId=" + transactionId + ", invoiceAmount=" + invoiceAmount + ", invoiceNumber=" + invoiceNumber);
-
 
3995
                sdCreditService.createLoanForBilling(transactionId, invoiceAmount, invoiceNumber);
-
 
3996
                System.out.println("=== TEST: createLoanForBilling completed ===");
-
 
3997
            } catch (Exception e) {
-
 
3998
                System.out.println("=== TEST: ERROR ===");
-
 
3999
                e.printStackTrace();
-
 
4000
            }
-
 
4001
        }
-
 
4002
    }
-
 
4003
 
3988
    public void notifyFlagshipExpiryIn2Days() {
4004
    public void notifyFlagshipExpiryIn2Days() {
3989
        try {
4005
        try {
3990
            java.time.LocalDate expiryDate = java.time.LocalDate.now().plusDays(2);
4006
            java.time.LocalDate expiryDate = java.time.LocalDate.now().plusDays(2);
3991
            List<Loan> expiringLoans = loanRepository.selectFlagshipLoansExpiringOn(expiryDate);
4007
            List<Loan> expiringLoans = loanRepository.selectFlagshipLoansExpiringOn(expiryDate);
3992
            LOGGER.info("Found {} flagship credits expiring on {}", expiringLoans.size(), expiryDate);
4008
            LOGGER.info("Found {} flagship credits expiring on {}", expiringLoans.size(), expiryDate);