| Line 841... |
Line 841... |
| 841 |
}
|
841 |
}
|
| 842 |
|
842 |
|
| 843 |
@Autowired
|
843 |
@Autowired
|
| 844 |
CreditNoteService creditNoteService;
|
844 |
CreditNoteService creditNoteService;
|
| 845 |
|
845 |
|
| 846 |
@Autowired
|
- |
|
| 847 |
com.spice.profitmandi.dao.repository.transaction.CreditNoteRepository creditNoteRepository;
|
- |
|
| 848 |
|
- |
|
| 849 |
public void sendCreditNote(YearMonth yearMonth) throws Exception {
|
846 |
public void sendCreditNote(YearMonth yearMonth) throws Exception {
|
| 850 |
LOGGER.info("Running SendCreditNote for {}", yearMonth.toString());
|
847 |
LOGGER.info("Running SendCreditNote for {}", yearMonth.toString());
|
| 851 |
creditNoteService.issueMonthlyMarginsCN(yearMonth);
|
848 |
creditNoteService.issueMonthlyMarginsCN(yearMonth);
|
| 852 |
}
|
849 |
}
|
| 853 |
|
850 |
|
| 854 |
public void recoverCreditNote(YearMonth yearMonth, String logFilePath) throws Exception {
|
- |
|
| 855 |
LOGGER.info("Running RecoverCreditNote for {} using log {}", yearMonth.toString(), logFilePath);
|
- |
|
| 856 |
creditNoteService.recoverMonthlyMarginsCN(yearMonth, logFilePath);
|
- |
|
| 857 |
}
|
- |
|
| 858 |
|
- |
|
| 859 |
public void resendCNReport(YearMonth yearMonth) throws Exception {
|
- |
|
| 860 |
LOGGER.info("Running ResendCNReport for {}", yearMonth.toString());
|
- |
|
| 861 |
creditNoteService.resendCNReport(yearMonth);
|
- |
|
| 862 |
}
|
- |
|
| 863 |
|
- |
|
| 864 |
public void genDNs(YearMonth yearMonth) throws Exception {
|
851 |
public void genDNs(YearMonth yearMonth) throws Exception {
|
| 865 |
LOGGER.info("Running genDNs for {}", yearMonth.toString());
|
852 |
LOGGER.info("Running genDNs for {}", yearMonth.toString());
|
| 866 |
creditNoteService.generateDebitNotesForCancelled(yearMonth);
|
853 |
creditNoteService.generateDebitNotesForCancelled(yearMonth);
|
| 867 |
}
|
854 |
}
|
| 868 |
|
855 |
|
| 869 |
public void testReissueOneCN() throws Exception {
|
- |
|
| 870 |
YearMonth marginMonth = YearMonth.of(2026, 3);
|
- |
|
| 871 |
java.time.LocalDate bookDate = java.time.LocalDate.of(2026, 3, 31);
|
- |
|
| 872 |
String suffix = "/A";
|
- |
|
| 873 |
|
- |
|
| 874 |
java.util.List<com.spice.profitmandi.dao.entity.transaction.CreditNote> allCNs =
|
- |
|
| 875 |
creditNoteRepository.selectAllMarginsTypeByMonth(marginMonth);
|
- |
|
| 876 |
LOGGER.info("testReissueOneCN: found {} non-cancelled MARGINS CNs for {}", allCNs.size(), marginMonth);
|
- |
|
| 877 |
|
- |
|
| 878 |
// Pick first non-Delhi CN for testing
|
- |
|
| 879 |
com.spice.profitmandi.dao.entity.transaction.CreditNote testCN = null;
|
- |
|
| 880 |
for (com.spice.profitmandi.dao.entity.transaction.CreditNote cn : allCNs) {
|
- |
|
| 881 |
String prefix = cn.getCreditNoteNumber().substring(3).replaceAll("\\d", "");
|
- |
|
| 882 |
if (!prefix.startsWith("NSDL")) {
|
- |
|
| 883 |
testCN = cn;
|
- |
|
| 884 |
break;
|
- |
|
| 885 |
}
|
- |
|
| 886 |
}
|
- |
|
| 887 |
if (testCN == null) {
|
- |
|
| 888 |
throw new RuntimeException("No non-Delhi CN found for testing");
|
- |
|
| 889 |
}
|
- |
|
| 890 |
LOGGER.info("testReissueOneCN: testing with CN={} fofoId={}", testCN.getCreditNoteNumber(), testCN.getFofoId());
|
- |
|
| 891 |
|
- |
|
| 892 |
// Override partner email to send to sdtech for testing
|
- |
|
| 893 |
creditNoteService.reissueMarginsCN(marginMonth, bookDate, suffix, testCN.getId(), "sdtech@smartdukaan.com");
|
- |
|
| 894 |
}
|
- |
|
| 895 |
|
- |
|
| 896 |
public void reissueMarginsCN() throws Exception {
|
- |
|
| 897 |
YearMonth marginMonth = YearMonth.of(2026, 3);
|
- |
|
| 898 |
java.time.LocalDate bookDate = java.time.LocalDate.of(2026, 3, 31);
|
- |
|
| 899 |
String suffix = "/A";
|
- |
|
| 900 |
|
- |
|
| 901 |
java.util.List<com.spice.profitmandi.dao.entity.transaction.CreditNote> existing =
|
- |
|
| 902 |
creditNoteRepository.selectAllMarginsTypeByMonth(marginMonth);
|
- |
|
| 903 |
LOGGER.info("reissueMarginsCN: found {} non-cancelled MARGINS CNs for {}", existing.size(), marginMonth);
|
- |
|
| 904 |
|
- |
|
| 905 |
creditNoteService.reissueMarginsCN(marginMonth, bookDate, suffix);
|
- |
|
| 906 |
}
|
- |
|
| 907 |
|
- |
|
| 908 |
@Autowired
|
856 |
@Autowired
|
| 909 |
BrandAgeingLimitRepository brandAgeingLimitRepository;
|
857 |
BrandAgeingLimitRepository brandAgeingLimitRepository;
|
| 910 |
|
858 |
|
| 911 |
@Autowired
|
859 |
@Autowired
|
| 912 |
AgeingService ageingService;
|
860 |
AgeingService ageingService;
|
| Line 5011... |
Line 4959... |
| 5011 |
List<String> sendTo = Arrays.asList("kamini.sharma@smartdukaan.com", "niranjan.kala@smartdukaan.com",
|
4959 |
List<String> sendTo = Arrays.asList("kamini.sharma@smartdukaan.com", "niranjan.kala@smartdukaan.com",
|
| 5012 |
"mohit.gulati@smartdukaan.com", "vinay.p@smartdukaan.com", "shivam.gupta@smartdukaan.com");
|
4960 |
"mohit.gulati@smartdukaan.com", "vinay.p@smartdukaan.com", "shivam.gupta@smartdukaan.com");
|
| 5013 |
|
4961 |
|
| 5014 |
|
4962 |
|
| 5015 |
String[] email = sendTo.toArray(new String[sendTo.size()]);
|
4963 |
String[] email = sendTo.toArray(new String[sendTo.size()]);
|
| 5016 |
this.sendMailOfHtmlFormat(googleMailSender, email, sb.toString(), null, subject);
|
4964 |
this.sendMailOfHtmlFormat(googleMailSender, email, sb.toString(), null, subject);
|
| 5017 |
|
4965 |
|
| 5018 |
}
|
4966 |
}
|
| 5019 |
|
4967 |
|
| 5020 |
public void findTodayPocoBillingItems() throws MessagingException, ProfitMandiBusinessException, IOException {
|
4968 |
public void findTodayPocoBillingItems() throws MessagingException, ProfitMandiBusinessException, IOException {
|
| 5021 |
LocalDateTime endDate = LocalDate.now().atStartOfDay().plusDays(1);
|
4969 |
LocalDateTime endDate = LocalDate.now().atStartOfDay().plusDays(1);
|