From 19e568e8f9c9037ff3f66bc14826c3f503e70100 Mon Sep 17 00:00:00 2001 From: sachinkulkarni12 Date: Mon, 13 Apr 2015 18:38:49 +0530 Subject: [PATCH] fix for saving payment details in collection sheet --- .../collectionsheet/data/JLGCollectionSheetData.java | 7 ++++--- .../CollectionSheetReadPlatformServiceImpl.java | 10 +++++++--- ...tionSheetWritePlatformServiceJpaRepositoryImpl.java | 7 +++++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/data/JLGCollectionSheetData.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/data/JLGCollectionSheetData.java index 9f67fd464..b1a711bd3 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/data/JLGCollectionSheetData.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/data/JLGCollectionSheetData.java @@ -12,6 +12,7 @@ import org.joda.time.LocalDate; import org.mifosplatform.infrastructure.codes.data.CodeValueData; import org.mifosplatform.infrastructure.core.data.EnumOptionData; import org.mifosplatform.portfolio.loanproduct.data.LoanProductData; +import org.mifosplatform.portfolio.paymenttype.data.PaymentTypeData; import org.mifosplatform.portfolio.savings.data.SavingsProductData; /** @@ -25,11 +26,11 @@ public class JLGCollectionSheetData { private final Collection savingsProducts; private final Collection groups; private final List attendanceTypeOptions; - private final Collection paymentTypeOptions; + private final Collection paymentTypeOptions; public static JLGCollectionSheetData instance(final LocalDate date, final Collection loanProducts, final Collection groups, final List attendanceTypeOptions, - final Collection paymentTypeOptions) { + final Collection paymentTypeOptions) { return new JLGCollectionSheetData(date, loanProducts, null, groups, attendanceTypeOptions, paymentTypeOptions); } @@ -42,7 +43,7 @@ public class JLGCollectionSheetData { private JLGCollectionSheetData(LocalDate dueDate, Collection loanProducts, Collection savingsProducts, Collection groups, List attendanceTypeOptions, - final Collection paymentTypeOptions) { + final Collection paymentTypeOptions) { this.dueDate = dueDate; this.loanProducts = loanProducts; this.savingsProducts = savingsProducts; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java index 03edd5e08..9b613bb32 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java @@ -52,6 +52,8 @@ import org.mifosplatform.portfolio.loanproduct.data.LoanProductData; import org.mifosplatform.portfolio.meeting.attendance.service.AttendanceDropdownReadPlatformService; import org.mifosplatform.portfolio.meeting.attendance.service.AttendanceEnumerations; import org.mifosplatform.portfolio.paymentdetail.PaymentDetailConstants; +import org.mifosplatform.portfolio.paymenttype.data.PaymentTypeData; +import org.mifosplatform.portfolio.paymenttype.service.PaymentTypeReadPlatformService; import org.mifosplatform.portfolio.savings.data.SavingsProductData; import org.mifosplatform.useradministration.domain.AppUser; import org.springframework.beans.factory.annotation.Autowired; @@ -75,6 +77,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe private final AttendanceDropdownReadPlatformService attendanceDropdownReadPlatformService; private final MandatorySavingsCollectionsheetExtractor mandatorySavingsExtractor = new MandatorySavingsCollectionsheetExtractor(); private final CodeValueReadPlatformService codeValueReadPlatformService; + private final PaymentTypeReadPlatformService paymentTypeReadPlatformService; @Autowired public CollectionSheetReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource, @@ -82,7 +85,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe final CollectionSheetGenerateCommandFromApiJsonDeserializer collectionSheetGenerateCommandFromApiJsonDeserializer, final CalendarRepositoryWrapper calendarRepositoryWrapper, final AttendanceDropdownReadPlatformService attendanceDropdownReadPlatformService, - final CodeValueReadPlatformService codeValueReadPlatformService) { + final CodeValueReadPlatformService codeValueReadPlatformService, final PaymentTypeReadPlatformService paymentTypeReadPlatformService) { this.context = context; this.centerReadPlatformService = centerReadPlatformService; this.namedParameterjdbcTemplate = new NamedParameterJdbcTemplate(dataSource); @@ -91,6 +94,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe this.calendarRepositoryWrapper = calendarRepositoryWrapper; this.attendanceDropdownReadPlatformService = attendanceDropdownReadPlatformService; this.codeValueReadPlatformService = codeValueReadPlatformService; + this.paymentTypeReadPlatformService = paymentTypeReadPlatformService; } /* @@ -105,8 +109,8 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe boolean firstTime = true; Long prevGroupId = null; Long prevClientId = null; - final Collection paymentOptions = this.codeValueReadPlatformService - .retrieveCodeValuesByCode(PaymentDetailConstants.paymentTypeCodeName); + final Collection paymentOptions = this.paymentTypeReadPlatformService.retrieveAllPaymentTypes(); + final List jlgGroupsData = new ArrayList<>(); List clientsData = new ArrayList<>(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/service/CollectionSheetWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/service/CollectionSheetWritePlatformServiceJpaRepositoryImpl.java index 37a615599..5b6595dbe 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/service/CollectionSheetWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/service/CollectionSheetWritePlatformServiceJpaRepositoryImpl.java @@ -24,6 +24,7 @@ import org.mifosplatform.portfolio.loanaccount.service.LoanWritePlatformService; import org.mifosplatform.portfolio.meeting.service.MeetingWritePlatformService; import org.mifosplatform.portfolio.paymentdetail.domain.PaymentDetail; import org.mifosplatform.portfolio.paymentdetail.domain.PaymentDetailAssembler; +import org.mifosplatform.portfolio.paymentdetail.service.PaymentDetailWritePlatformService; import org.mifosplatform.portfolio.savings.data.SavingsAccountTransactionDTO; import org.mifosplatform.portfolio.savings.domain.DepositAccountAssembler; import org.mifosplatform.portfolio.savings.domain.SavingsAccountTransaction; @@ -42,6 +43,7 @@ public class CollectionSheetWritePlatformServiceJpaRepositoryImpl implements Col private final DepositAccountAssembler accountAssembler; private final DepositAccountWritePlatformService accountWritePlatformService; private final PaymentDetailAssembler paymentDetailAssembler; + private final PaymentDetailWritePlatformService paymentDetailWritePlatformService; @Autowired public CollectionSheetWritePlatformServiceJpaRepositoryImpl(final LoanWritePlatformService loanWritePlatformService, @@ -49,7 +51,7 @@ public class CollectionSheetWritePlatformServiceJpaRepositoryImpl implements Col final CollectionSheetBulkDisbursalCommandFromApiJsonDeserializer bulkDisbursalCommandFromApiJsonDeserializer, final CollectionSheetTransactionDataValidator transactionDataValidator, final MeetingWritePlatformService meetingWritePlatformService, final DepositAccountAssembler accountAssembler, - final DepositAccountWritePlatformService accountWritePlatformService, final PaymentDetailAssembler paymentDetailAssembler) { + final DepositAccountWritePlatformService accountWritePlatformService, final PaymentDetailAssembler paymentDetailAssembler, final PaymentDetailWritePlatformService paymentDetailWritePlatformService) { this.loanWritePlatformService = loanWritePlatformService; this.bulkRepaymentCommandFromApiJsonDeserializer = bulkRepaymentCommandFromApiJsonDeserializer; this.bulkDisbursalCommandFromApiJsonDeserializer = bulkDisbursalCommandFromApiJsonDeserializer; @@ -58,6 +60,7 @@ public class CollectionSheetWritePlatformServiceJpaRepositoryImpl implements Col this.accountAssembler = accountAssembler; this.accountWritePlatformService = accountWritePlatformService; this.paymentDetailAssembler = paymentDetailAssembler; + this.paymentDetailWritePlatformService = paymentDetailWritePlatformService; } @Override @@ -74,7 +77,7 @@ public class CollectionSheetWritePlatformServiceJpaRepositoryImpl implements Col changes.put("note", noteText); } - final PaymentDetail paymentDetail = this.paymentDetailAssembler.fetchPaymentDetail(command.parsedJson().getAsJsonObject()); + final PaymentDetail paymentDetail = this.paymentDetailWritePlatformService.createAndPersistPaymentDetail(command, changes); changes.putAll(updateBulkReapayments(command, paymentDetail)); changes.putAll(updateBulkDisbursals(command));