| Line 5... |
Line 5... |
| 5 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
5 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 6 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
6 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 7 |
import com.spice.profitmandi.common.model.UnsettledPaymentModel;
|
7 |
import com.spice.profitmandi.common.model.UnsettledPaymentModel;
|
| 8 |
import com.spice.profitmandi.common.util.*;
|
8 |
import com.spice.profitmandi.common.util.*;
|
| 9 |
import com.spice.profitmandi.dao.entity.dtr.CreditAccount;
|
9 |
import com.spice.profitmandi.dao.entity.dtr.CreditAccount;
|
| 10 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
- |
|
| 11 |
import com.spice.profitmandi.dao.entity.transaction.*;
|
10 |
import com.spice.profitmandi.dao.entity.transaction.*;
|
| 12 |
import com.spice.profitmandi.dao.enumuration.fofo.Gateway;
|
11 |
import com.spice.profitmandi.dao.enumuration.fofo.Gateway;
|
| 13 |
import com.spice.profitmandi.dao.enumuration.transaction.AddWalletRequestStatus;
|
12 |
import com.spice.profitmandi.dao.enumuration.transaction.AddWalletRequestStatus;
|
| 14 |
import com.spice.profitmandi.dao.enumuration.transaction.TransactionType;
|
13 |
import com.spice.profitmandi.dao.enumuration.transaction.TransactionType;
|
| 15 |
import com.spice.profitmandi.dao.repository.catalog.AddWalletRequestRepository;
|
14 |
import com.spice.profitmandi.dao.repository.catalog.AddWalletRequestRepository;
|
| Line 58... |
Line 57... |
| 58 |
import java.io.InputStream;
|
57 |
import java.io.InputStream;
|
| 59 |
import java.math.BigDecimal;
|
58 |
import java.math.BigDecimal;
|
| 60 |
import java.text.MessageFormat;
|
59 |
import java.text.MessageFormat;
|
| 61 |
import java.time.LocalDate;
|
60 |
import java.time.LocalDate;
|
| 62 |
import java.time.LocalDateTime;
|
61 |
import java.time.LocalDateTime;
|
| - |
|
62 |
import java.time.YearMonth;
|
| 63 |
import java.time.ZoneId;
|
63 |
import java.time.ZoneId;
|
| 64 |
import java.util.*;
|
64 |
import java.util.*;
|
| 65 |
import java.util.stream.Collectors;
|
65 |
import java.util.stream.Collectors;
|
| 66 |
|
66 |
|
| 67 |
@Controller
|
67 |
@Controller
|
| Line 150... |
Line 150... |
| 150 |
@Autowired
|
150 |
@Autowired
|
| 151 |
private LoanStatementRepository loanStatementRepository;
|
151 |
private LoanStatementRepository loanStatementRepository;
|
| 152 |
@Autowired
|
152 |
@Autowired
|
| 153 |
SDCreditRequirementRepository sdCreditRequirementRepository;
|
153 |
SDCreditRequirementRepository sdCreditRequirementRepository;
|
| 154 |
|
154 |
|
| - |
|
155 |
|
| 155 |
@PostMapping(value = "/wallet/upload")
|
156 |
@PostMapping(value = "/wallet/upload")
|
| 156 |
public String uploadWalletBulk(HttpServletRequest request, @RequestPart("file") MultipartFile file, Model model) throws Exception {
|
157 |
public String uploadWalletBulk(HttpServletRequest request, @RequestPart("file") MultipartFile file, Model model) throws Exception {
|
| 157 |
List<WalletHistoryModel> walletHistoryModelList = ExcelUtils.parseWalletBulkCredit(file.getInputStream());
|
158 |
List<WalletHistoryModel> walletHistoryModelList = ExcelUtils.parseWalletBulkCredit(file.getInputStream());
|
| 158 |
for (WalletHistoryModel walletHistoryModel : walletHistoryModelList) {
|
159 |
for (WalletHistoryModel walletHistoryModel : walletHistoryModelList) {
|
| 159 |
if (walletHistoryModel.getReference() == 0) {
|
160 |
if (walletHistoryModel.getReference() == 0) {
|
| Line 694... |
Line 695... |
| 694 |
}
|
695 |
}
|
| 695 |
float openingBalance = walletService.getOpeningTillExcludingPurchase(fofoId, startDate);
|
696 |
float openingBalance = walletService.getOpeningTillExcludingPurchase(fofoId, startDate);
|
| 696 |
float closingBalance = walletService.getOpeningTillExcludingPurchase(fofoId, endDate);
|
697 |
float closingBalance = walletService.getOpeningTillExcludingPurchase(fofoId, endDate);
|
| 697 |
UserWallet uw = walletService.getUserWallet(fofoId);
|
698 |
UserWallet uw = walletService.getUserWallet(fofoId);
|
| 698 |
List<UserWalletHistory> history = userWalletHistoryRepository.selectPaginatedByWalletId(uw.getId(), startDate, endDate, 0, 0);
|
699 |
List<UserWalletHistory> history = userWalletHistoryRepository.selectPaginatedByWalletId(uw.getId(), startDate, endDate, 0, 0);
|
| 699 |
history = history.stream().filter(x -> !x.getReferenceType().equals(WalletReferenceType.PURCHASE)).collect(Collectors.toList());
|
700 |
history = history.stream().filter(x -> !x.getReferenceType().equals(WalletReferenceType.PURCHASE))
|
| - |
|
701 |
.filter(x -> !WalletService.CN_WALLET_REFERENCES.contains(x.getReferenceType())).sorted(Comparator.comparing(UserWalletHistory::getId)).collect(Collectors.toList());
|
| - |
|
702 |
|
| 700 |
InputStream is = getClass().getClassLoader().getResourceAsStream("account-statement.xlsx");
|
703 |
InputStream is = getClass().getClassLoader().getResourceAsStream("account-statement.xlsx");
|
| 701 |
String partnerName = retailerService.getAllFofoRetailerIdNameMap().get(fofoId);
|
704 |
CustomRetailer customRetailer = retailerService.getAllFofoRetailers().get(fofoId);
|
| 702 |
List<StatementDetailModel> details = orderRepository.selectDetailsBetween(fofoId, startDate, endDate);
|
705 |
List<StatementDetailModel> details = orderRepository.selectDetailsBetween(fofoId, startDate, endDate);
|
| 703 |
float openingAmount = orderRepository.selectOpeningAmount(fofoId, startDate);
|
706 |
float openingAmount = orderRepository.selectOpeningAmount(fofoId, startDate);
|
| 704 |
float closingAmount = orderRepository.selectOpeningAmount(fofoId, endDate);
|
707 |
float closingAmount = orderRepository.selectOpeningAmount(fofoId, endDate);
|
| 705 |
LOGGER.info("Opening - {}, Closing - {}", openingAmount, closingAmount);
|
708 |
LOGGER.info("Opening - {}, Closing - {}", openingAmount, closingAmount);
|
| 706 |
ByteArrayOutputStream byteArrayOutputStream = this.populateData(is, openingBalance - openingAmount, closingBalance - closingAmount, partnerName, history, startDate, endDate, details);
|
709 |
ByteArrayOutputStream byteArrayOutputStream = this.populateData(is, openingBalance - openingAmount, closingBalance - closingAmount, customRetailer, history, startDate, endDate, details);
|
| 707 |
|
710 |
|
| 708 |
final HttpHeaders headers = new HttpHeaders();
|
711 |
final HttpHeaders headers = new HttpHeaders();
|
| 709 |
headers.set("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
712 |
headers.set("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
| 710 |
headers.set("Content-disposition", "inline; filename=account-statement." + StringUtils.toHyphenatedString(startDate.toLocalDate()) + "-" + StringUtils.toHyphenatedString(endDate.toLocalDate()) + ".xlsx");
|
713 |
headers.set("Content-disposition", "inline; filename=account-statement." + StringUtils.toHyphenatedString(startDate.toLocalDate()) + "-" + StringUtils.toHyphenatedString(endDate.toLocalDate()) + ".xlsx");
|
| 711 |
headers.setContentLength(byteArrayOutputStream.toByteArray().length);
|
714 |
headers.setContentLength(byteArrayOutputStream.toByteArray().length);
|
| Line 715... |
Line 718... |
| 715 |
|
718 |
|
| 716 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
719 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
| 717 |
|
720 |
|
| 718 |
}
|
721 |
}
|
| 719 |
|
722 |
|
| - |
|
723 |
@Autowired
|
| - |
|
724 |
CreditNoteRepository creditNoteRepository;
|
| - |
|
725 |
@Autowired
|
| - |
|
726 |
CreditNoteLineRepository creditNoteLineRepository;
|
| - |
|
727 |
|
| 720 |
private ByteArrayOutputStream populateData(InputStream is, float openingBalance, float closingBalance, String partnerName, List<UserWalletHistory> history, LocalDateTime startDate, LocalDateTime endDate, List<StatementDetailModel> invoiceDetails) throws Exception {
|
728 |
private ByteArrayOutputStream populateData(InputStream is, float openingBalance, float closingBalance, CustomRetailer customRetailer, List<UserWalletHistory> history,
|
| - |
|
729 |
LocalDateTime startLocalDateTime, LocalDateTime endLocalDateTime, List<StatementDetailModel> invoiceDetails) throws Exception {
|
| - |
|
730 |
Map<LocalDate, List<StatementDetailModel>> dateInvoiceMap = invoiceDetails.stream().collect(Collectors.groupingBy(x -> x.getOnDate().toLocalDate()));
|
| - |
|
731 |
LOGGER.info("dateInvoiceMap - {}", dateInvoiceMap);
|
| 721 |
XSSFWorkbook workbook = new XSSFWorkbook(is);
|
732 |
XSSFWorkbook workbook = new XSSFWorkbook(is);
|
| 722 |
CreationHelper creationHelper = workbook.getCreationHelper();
|
733 |
CreationHelper creationHelper = workbook.getCreationHelper();
|
| 723 |
CellStyle style2 = workbook.createCellStyle();
|
734 |
CellStyle style2 = workbook.createCellStyle();
|
| 724 |
style2.setDataFormat(creationHelper.createDataFormat().getFormat("mm/dd/yyyy hh:mm:ss"));
|
735 |
style2.setDataFormat(creationHelper.createDataFormat().getFormat("dd/mm/yyyy"));
|
| 725 |
|
736 |
|
| 726 |
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
737 |
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
| 727 |
Sheet sheet = workbook.getSheetAt(0);
|
738 |
Sheet sheet = workbook.getSheetAt(0);
|
| 728 |
sheet.getRow(0).getCell(0).setCellValue(partnerName);
|
739 |
sheet.getRow(0).getCell(0).setCellValue(customRetailer.getBusinessName());
|
| 729 |
sheet.getRow(1).getCell(1).setCellValue(new Date(startDate.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
|
740 |
sheet.getRow(1).getCell(1).setCellValue(new Date(startLocalDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
|
| 730 |
sheet.getRow(1).getCell(2).setCellValue(new Date(endDate.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
|
741 |
sheet.getRow(1).getCell(2).setCellValue(new Date(endLocalDateTime.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
|
| 731 |
sheet.getRow(2).getCell(2).setCellValue(openingBalance);
|
742 |
sheet.getRow(2).getCell(2).setCellValue(openingBalance);
|
| 732 |
long grandTotalDebit = 0l;
|
743 |
long grandTotalDebit = 0l;
|
| 733 |
long grandTotalCredit = 0l;
|
744 |
long grandTotalCredit = 0l;
|
| 734 |
int row = 4;
|
745 |
int row = 4;
|
| - |
|
746 |
LocalDate currentLocalDate = startLocalDateTime.toLocalDate();
|
| - |
|
747 |
LocalDate endDate = endLocalDateTime.toLocalDate();
|
| 735 |
for (UserWalletHistory walletEntry : history) {
|
748 |
for (UserWalletHistory walletEntry : history) {
|
| - |
|
749 |
while (!currentLocalDate.equals(walletEntry.getTimestamp().toLocalDate())) {
|
| - |
|
750 |
List<StatementDetailModel> statementDetailModels = dateInvoiceMap.get(currentLocalDate);
|
| - |
|
751 |
LOGGER.info("statementDetailModels - {}", statementDetailModels);
|
| - |
|
752 |
if (statementDetailModels != null) {
|
| - |
|
753 |
for (StatementDetailModel statementDetailModel : statementDetailModels) {
|
| - |
|
754 |
Cell dateCell = sheet.createRow(row).createCell(0);
|
| - |
|
755 |
dateCell.setCellValue(statementDetailModel.getOnDate());
|
| - |
|
756 |
dateCell.setCellStyle(style2);
|
| - |
|
757 |
sheet.getRow(row).createCell(1).setCellValue("BILLING");
|
| - |
|
758 |
if (statementDetailModel.getAmount() > 0) {
|
| - |
|
759 |
sheet.getRow(row).createCell(2).setCellValue(statementDetailModel.getAmount());
|
| - |
|
760 |
sheet.getRow(row).createCell(3).setCellValue(0);
|
| - |
|
761 |
grandTotalDebit += statementDetailModel.getAmount();
|
| - |
|
762 |
} else {
|
| - |
|
763 |
sheet.getRow(row).createCell(2).setCellValue(0);
|
| - |
|
764 |
sheet.getRow(row).createCell(3).setCellValue(-statementDetailModel.getAmount());
|
| - |
|
765 |
grandTotalCredit += -statementDetailModel.getAmount();
|
| - |
|
766 |
}
|
| - |
|
767 |
|
| - |
|
768 |
sheet.getRow(row).createCell(4).setCellValue(statementDetailModel.getReferenceType());
|
| - |
|
769 |
sheet.getRow(row).createCell(5).setCellValue(statementDetailModel.getInvoiceNumber());
|
| - |
|
770 |
|
| - |
|
771 |
row += 1;
|
| - |
|
772 |
}
|
| - |
|
773 |
}
|
| - |
|
774 |
if (YearMonth.from(currentLocalDate).atEndOfMonth().equals(currentLocalDate)) {
|
| - |
|
775 |
List<CreditNote> creditNotes = creditNoteRepository.selectAll(customRetailer.getPartnerId(), YearMonth.from(currentLocalDate));
|
| - |
|
776 |
if (creditNotes != null) {
|
| - |
|
777 |
for (CreditNote creditNote : creditNotes) {
|
| - |
|
778 |
double cnAmount = creditNoteLineRepository.selectAllByCreditNote(creditNote.getId()).stream().collect(Collectors.summingDouble(x -> x.getAmount()));
|
| - |
|
779 |
Cell dateCell = sheet.createRow(row).createCell(0);
|
| - |
|
780 |
dateCell.setCellValue(new Date(currentLocalDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
|
| - |
|
781 |
dateCell.setCellStyle(style2);
|
| - |
|
782 |
sheet.getRow(row).createCell(1).setCellValue("CREDIT NOTE");
|
| - |
|
783 |
if (cnAmount > 0) {
|
| - |
|
784 |
sheet.getRow(row).createCell(2).setCellValue(0);
|
| - |
|
785 |
sheet.getRow(row).createCell(3).setCellValue(cnAmount);
|
| - |
|
786 |
grandTotalCredit += cnAmount;
|
| - |
|
787 |
} else {
|
| - |
|
788 |
sheet.getRow(row).createCell(2).setCellValue(-cnAmount);
|
| - |
|
789 |
sheet.getRow(row).createCell(3).setCellValue(0);
|
| - |
|
790 |
grandTotalDebit += -cnAmount;
|
| - |
|
791 |
}
|
| - |
|
792 |
|
| - |
|
793 |
sheet.getRow(row).createCell(4).setCellValue("Credit Note Issued");
|
| - |
|
794 |
sheet.getRow(row).createCell(5).setCellValue(creditNote.getCreditNoteNumber());
|
| - |
|
795 |
|
| - |
|
796 |
row += 1;
|
| - |
|
797 |
}
|
| - |
|
798 |
}
|
| - |
|
799 |
}
|
| - |
|
800 |
currentLocalDate = currentLocalDate.plusDays(1);
|
| - |
|
801 |
}
|
| 736 |
Cell dateCell = sheet.createRow(row).createCell(0);
|
802 |
Cell dateCell = sheet.createRow(row).createCell(0);
|
| 737 |
dateCell.setCellValue(new Date(walletEntry.getTimestamp().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
|
803 |
dateCell.setCellValue(new Date(walletEntry.getTimestamp().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
|
| 738 |
dateCell.setCellStyle(style2);
|
804 |
dateCell.setCellStyle(style2);
|
| 739 |
sheet.getRow(row).createCell(1).setCellValue(walletEntry.getReferenceType().toString());
|
805 |
sheet.getRow(row).createCell(1).setCellValue(walletEntry.getReferenceType().toString());
|
| 740 |
if (walletEntry.getAmount() > 0) {
|
806 |
if (walletEntry.getAmount() > 0) {
|
| Line 748... |
Line 814... |
| 748 |
}
|
814 |
}
|
| 749 |
sheet.getRow(row).createCell(4).setCellValue(walletEntry.getDescription());
|
815 |
sheet.getRow(row).createCell(4).setCellValue(walletEntry.getDescription());
|
| 750 |
sheet.getRow(row).createCell(5).setCellValue(walletEntry.getReference());
|
816 |
sheet.getRow(row).createCell(5).setCellValue(walletEntry.getReference());
|
| 751 |
row++;
|
817 |
row++;
|
| 752 |
}
|
818 |
}
|
| - |
|
819 |
List<StatementDetailModel> statementDetailModels = dateInvoiceMap.get(endDate);
|
| - |
|
820 |
if (statementDetailModels != null) {
|
| 753 |
for (StatementDetailModel statementDetailModel : invoiceDetails) {
|
821 |
for (StatementDetailModel statementDetailModel : statementDetailModels) {
|
| 754 |
Cell dateCell = sheet.createRow(row).createCell(0);
|
822 |
Cell dateCell = sheet.createRow(row).createCell(0);
|
| 755 |
dateCell.setCellValue(statementDetailModel.getOnDate());
|
823 |
dateCell.setCellValue(statementDetailModel.getOnDate());
|
| 756 |
dateCell.setCellStyle(style2);
|
824 |
dateCell.setCellStyle(style2);
|
| 757 |
sheet.getRow(row).createCell(1).setCellValue("BILLING");
|
825 |
sheet.getRow(row).createCell(1).setCellValue("BILLING");
|
| 758 |
if (statementDetailModel.getAmount() > 0) {
|
826 |
if (statementDetailModel.getAmount() > 0) {
|
| 759 |
sheet.getRow(row).createCell(2).setCellValue(statementDetailModel.getAmount());
|
827 |
sheet.getRow(row).createCell(2).setCellValue(statementDetailModel.getAmount());
|
| 760 |
sheet.getRow(row).createCell(3).setCellValue(0);
|
828 |
sheet.getRow(row).createCell(3).setCellValue(0);
|
| 761 |
grandTotalDebit += statementDetailModel.getAmount();
|
829 |
grandTotalDebit += statementDetailModel.getAmount();
|
| 762 |
} else {
|
830 |
} else {
|
| 763 |
sheet.getRow(row).createCell(2).setCellValue(0);
|
831 |
sheet.getRow(row).createCell(2).setCellValue(0);
|
| 764 |
sheet.getRow(row).createCell(3).setCellValue(-statementDetailModel.getAmount());
|
832 |
sheet.getRow(row).createCell(3).setCellValue(-statementDetailModel.getAmount());
|
| 765 |
grandTotalCredit += -statementDetailModel.getAmount();
|
833 |
grandTotalCredit += -statementDetailModel.getAmount();
|
| - |
|
834 |
}
|
| - |
|
835 |
|
| - |
|
836 |
sheet.getRow(row).createCell(4).setCellValue(statementDetailModel.getReferenceType());
|
| - |
|
837 |
sheet.getRow(row).createCell(5).setCellValue(statementDetailModel.getInvoiceNumber());
|
| - |
|
838 |
|
| - |
|
839 |
row += 1;
|
| 766 |
}
|
840 |
}
|
| - |
|
841 |
}
|
| - |
|
842 |
List<CreditNote> creditNotes = creditNoteRepository.selectAll(customRetailer.getPartnerId(), YearMonth.from(endDate));
|
| - |
|
843 |
if (creditNotes != null) {
|
| - |
|
844 |
for (CreditNote creditNote : creditNotes) {
|
| - |
|
845 |
double cnAmount = creditNoteLineRepository.selectAllByCreditNote(creditNote.getId()).stream().collect(Collectors.summingDouble(x -> x.getAmount()));
|
| - |
|
846 |
Cell dateCell = sheet.createRow(row).createCell(0);
|
| - |
|
847 |
dateCell.setCellValue(new Date(currentLocalDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()));
|
| - |
|
848 |
dateCell.setCellStyle(style2);
|
| - |
|
849 |
sheet.getRow(row).createCell(1).setCellValue("CREDIT NOTE");
|
| - |
|
850 |
if (cnAmount > 0) {
|
| - |
|
851 |
sheet.getRow(row).createCell(2).setCellValue(0);
|
| - |
|
852 |
sheet.getRow(row).createCell(3).setCellValue(cnAmount);
|
| - |
|
853 |
grandTotalCredit += cnAmount;
|
| - |
|
854 |
} else {
|
| - |
|
855 |
sheet.getRow(row).createCell(2).setCellValue(-cnAmount);
|
| - |
|
856 |
sheet.getRow(row).createCell(3).setCellValue(0);
|
| - |
|
857 |
grandTotalDebit += -cnAmount;
|
| - |
|
858 |
}
|
| 767 |
|
859 |
|
| 768 |
sheet.getRow(row).createCell(4).setCellValue(statementDetailModel.getReferenceType());
|
860 |
sheet.getRow(row).createCell(4).setCellValue("Credit Note Issued");
|
| 769 |
sheet.getRow(row).createCell(5).setCellValue(statementDetailModel.getInvoiceNumber());
|
861 |
sheet.getRow(row).createCell(5).setCellValue(creditNote.getCreditNoteNumber());
|
| 770 |
|
862 |
|
| 771 |
row += 1;
|
863 |
row += 1;
|
| - |
|
864 |
}
|
| 772 |
}
|
865 |
}
|
| 773 |
sheet.createRow(row).createCell(0).setCellValue("Grand Total");
|
866 |
sheet.createRow(row).createCell(0).setCellValue("Grand Total");
|
| 774 |
sheet.getRow(row).createCell(2).setCellValue(grandTotalDebit);
|
867 |
sheet.getRow(row).createCell(2).setCellValue(grandTotalDebit);
|
| 775 |
sheet.getRow(row).createCell(3).setCellValue(grandTotalCredit);
|
868 |
sheet.getRow(row).createCell(3).setCellValue(grandTotalCredit);
|
| 776 |
row += 2;
|
869 |
row += 2;
|
| Line 956... |
Line 1049... |
| 956 |
addWalletRequests = addWalletRequests.stream().filter(x -> Arrays.asList(AddWalletRequestStatus.approved, AddWalletRequestStatus.pending).contains(x.getStatus())).collect(Collectors.toList());
|
1049 |
addWalletRequests = addWalletRequests.stream().filter(x -> Arrays.asList(AddWalletRequestStatus.approved, AddWalletRequestStatus.pending).contains(x.getStatus())).collect(Collectors.toList());
|
| 957 |
if (addWalletRequests.size() > 0) {
|
1050 |
if (addWalletRequests.size() > 0) {
|
| 958 |
throw new ProfitMandiBusinessException("Transaction Reference (UTR)", transactionReference, "Already added");
|
1051 |
throw new ProfitMandiBusinessException("Transaction Reference (UTR)", transactionReference, "Already added");
|
| 959 |
}
|
1052 |
}
|
| 960 |
HdfcPayment hdfcPayment = hdfcPaymentRepository.selectByUtrNo(transactionReference);
|
1053 |
HdfcPayment hdfcPayment = hdfcPaymentRepository.selectByUtrNo(transactionReference);
|
| 961 |
if(hdfcPayment != null) {
|
1054 |
if (hdfcPayment != null) {
|
| 962 |
throw new ProfitMandiBusinessException("Transaction Reference (UTR)", transactionReference, "Already added");
|
1055 |
throw new ProfitMandiBusinessException("Transaction Reference (UTR)", transactionReference, "Already added");
|
| 963 |
}
|
1056 |
}
|
| 964 |
AddWalletRequest addWalletRequest = new AddWalletRequest();
|
1057 |
AddWalletRequest addWalletRequest = new AddWalletRequest();
|
| 965 |
addWalletRequest.setRetailerId(fofoId);
|
1058 |
addWalletRequest.setRetailerId(fofoId);
|
| 966 |
addWalletRequest.setAmount(amount);
|
1059 |
addWalletRequest.setAmount(amount);
|
| Line 1007... |
Line 1100... |
| 1007 |
creditAccount.setGateway(gateway);
|
1100 |
creditAccount.setGateway(gateway);
|
| 1008 |
if (gateway.equals(Gateway.SIDBI)) {
|
1101 |
if (gateway.equals(Gateway.SIDBI)) {
|
| 1009 |
FofoSidbiSanction fofoSidbiSanction = fofoSidbiSanctionRepository.selectByFofoId(creditAccount.getFofoId());
|
1102 |
FofoSidbiSanction fofoSidbiSanction = fofoSidbiSanctionRepository.selectByFofoId(creditAccount.getFofoId());
|
| 1010 |
creditAccount.setAvailableAmount((float) fofoSidbiSanction.getSanctionAmount());
|
1103 |
creditAccount.setAvailableAmount((float) fofoSidbiSanction.getSanctionAmount());
|
| 1011 |
creditAccount.setSanctionedAmount((float) fofoSidbiSanction.getSanctionAmount());
|
1104 |
creditAccount.setSanctionedAmount((float) fofoSidbiSanction.getSanctionAmount());
|
| - |
|
1105 |
|
| - |
|
1106 |
SDCreditRequirement sdCreditRequirement = sdCreditRequirementRepository.selectByFofoId(creditAccount.getFofoId());
|
| - |
|
1107 |
sdCreditRequirement.setLimit(BigDecimal.valueOf(fofoSidbiSanction.getSanctionAmount()));
|
| - |
|
1108 |
if (sdCreditRequirement.getUtilizedAmount().compareTo(BigDecimal.ZERO) > 0) {
|
| - |
|
1109 |
throw new ProfitMandiBusinessException("Loans are not closed", "Loans are not closed", "Loans are not closed");
|
| - |
|
1110 |
}
|
| - |
|
1111 |
sdCreditRequirement.setUtilizedAmount(BigDecimal.ZERO);
|
| 1012 |
}
|
1112 |
}
|
| 1013 |
|
1113 |
|
| 1014 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getAllFofoRetailers();
|
1114 |
Map<Integer, CustomRetailer> customRetailers = retailerService.getAllFofoRetailers();
|
| 1015 |
|
1115 |
|
| 1016 |
String title = "Loan Approved";
|
1116 |
String title = "Loan Approved";
|