minor cleanups
This commit is contained in:
+9
-12
@@ -44,10 +44,8 @@ public class CurrencyWritePlatformServiceJpaRepositoryImpl implements CurrencyWr
|
|||||||
public CurrencyWritePlatformServiceJpaRepositoryImpl(final PlatformSecurityContext context,
|
public CurrencyWritePlatformServiceJpaRepositoryImpl(final PlatformSecurityContext context,
|
||||||
final CurrencyCommandFromApiJsonDeserializer fromApiJsonDeserializer,
|
final CurrencyCommandFromApiJsonDeserializer fromApiJsonDeserializer,
|
||||||
final ApplicationCurrencyRepositoryWrapper applicationCurrencyRepository,
|
final ApplicationCurrencyRepositoryWrapper applicationCurrencyRepository,
|
||||||
final OrganisationCurrencyRepository organisationCurrencyRepository,
|
final OrganisationCurrencyRepository organisationCurrencyRepository, final LoanProductReadPlatformService loanProductService,
|
||||||
final LoanProductReadPlatformService loanProductService,
|
final SavingsProductReadPlatformService savingsProductService, final ChargeReadPlatformService chargeService) {
|
||||||
final SavingsProductReadPlatformService savingsProductService,
|
|
||||||
final ChargeReadPlatformService chargeService) {
|
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.fromApiJsonDeserializer = fromApiJsonDeserializer;
|
this.fromApiJsonDeserializer = fromApiJsonDeserializer;
|
||||||
this.applicationCurrencyRepository = applicationCurrencyRepository;
|
this.applicationCurrencyRepository = applicationCurrencyRepository;
|
||||||
@@ -81,14 +79,13 @@ public class CurrencyWritePlatformServiceJpaRepositoryImpl implements CurrencyWr
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (OrganisationCurrency priorCurrency : this.organisationCurrencyRepository.findAll()) {
|
for (OrganisationCurrency priorCurrency : this.organisationCurrencyRepository.findAll()) {
|
||||||
if (!allowedCurrencyCodes.contains(priorCurrency.getCode())) {
|
if (!allowedCurrencyCodes.contains(priorCurrency.getCode())) {
|
||||||
// Check if it's safe to remove this currency.
|
// Check if it's safe to remove this currency.
|
||||||
if (!loanProductService.retrieveAllLoanProductsForCurrency(priorCurrency).isEmpty() ||
|
if (!loanProductService.retrieveAllLoanProductsForCurrency(priorCurrency.getCode()).isEmpty()
|
||||||
!savingsProductService.retrieveAllForCurrency(priorCurrency).isEmpty() ||
|
|| !savingsProductService.retrieveAllForCurrency(priorCurrency.getCode()).isEmpty()
|
||||||
!chargeService.retrieveAllChargesForCurrency(priorCurrency).isEmpty()) {
|
|| !chargeService.retrieveAllChargesForCurrency(priorCurrency.getCode()).isEmpty()) { throw new CurrencyInUseException(
|
||||||
throw new CurrencyInUseException(priorCurrency.getCode());
|
priorCurrency.getCode()); }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
changes.put("currencies", allowedCurrencyCodes.toArray(new String[allowedCurrencyCodes.size()]));
|
changes.put("currencies", allowedCurrencyCodes.toArray(new String[allowedCurrencyCodes.size()]));
|
||||||
|
|||||||
+1
-2
@@ -7,14 +7,13 @@ package org.mifosplatform.portfolio.charge.service;
|
|||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.mifosplatform.organisation.office.domain.OrganisationCurrency;
|
|
||||||
import org.mifosplatform.portfolio.charge.data.ChargeData;
|
import org.mifosplatform.portfolio.charge.data.ChargeData;
|
||||||
|
|
||||||
public interface ChargeReadPlatformService {
|
public interface ChargeReadPlatformService {
|
||||||
|
|
||||||
Collection<ChargeData> retrieveAllCharges();
|
Collection<ChargeData> retrieveAllCharges();
|
||||||
|
|
||||||
Collection<ChargeData> retrieveAllChargesForCurrency(OrganisationCurrency currency);
|
Collection<ChargeData> retrieveAllChargesForCurrency(String currencyCode);
|
||||||
|
|
||||||
ChargeData retrieveCharge(Long chargeId);
|
ChargeData retrieveCharge(Long chargeId);
|
||||||
|
|
||||||
|
|||||||
+8
-12
@@ -18,7 +18,6 @@ import org.mifosplatform.infrastructure.core.service.RoutingDataSource;
|
|||||||
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
||||||
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
||||||
import org.mifosplatform.organisation.monetary.service.CurrencyReadPlatformService;
|
import org.mifosplatform.organisation.monetary.service.CurrencyReadPlatformService;
|
||||||
import org.mifosplatform.organisation.office.domain.OrganisationCurrency;
|
|
||||||
import org.mifosplatform.portfolio.charge.data.ChargeData;
|
import org.mifosplatform.portfolio.charge.data.ChargeData;
|
||||||
import org.mifosplatform.portfolio.charge.domain.ChargeAppliesTo;
|
import org.mifosplatform.portfolio.charge.domain.ChargeAppliesTo;
|
||||||
import org.mifosplatform.portfolio.charge.exception.ChargeNotFoundException;
|
import org.mifosplatform.portfolio.charge.exception.ChargeNotFoundException;
|
||||||
@@ -64,20 +63,17 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
|||||||
return this.jdbcTemplate.query(sql, rm, new Object[] {});
|
return this.jdbcTemplate.query(sql, rm, new Object[] {});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(value = "charges", key = "T(org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil).getTenant().getTenantIdentifier().concat('ch')")
|
public Collection<ChargeData> retrieveAllChargesForCurrency(String currencyCode) {
|
||||||
public Collection<ChargeData> retrieveAllChargesForCurrency(
|
this.context.authenticatedUser();
|
||||||
OrganisationCurrency currency) {
|
|
||||||
this.context.authenticatedUser();
|
|
||||||
|
|
||||||
final ChargeMapper rm = new ChargeMapper();
|
final ChargeMapper rm = new ChargeMapper();
|
||||||
|
|
||||||
final String sql = "select " + rm.chargeSchema()
|
final String sql = "select " + rm.chargeSchema() + " where c.is_deleted=0 and c.currency_code='" + currencyCode
|
||||||
+ " where c.is_deleted=0 and c.currency_code='" + currency.getCode()
|
+ "' order by c.name ";
|
||||||
+ "' order by c.name ";
|
|
||||||
|
|
||||||
return this.jdbcTemplate.query(sql, rm, new Object[] {});
|
return this.jdbcTemplate.query(sql, rm, new Object[] {});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChargeData retrieveCharge(final Long chargeId) {
|
public ChargeData retrieveCharge(final Long chargeId) {
|
||||||
|
|||||||
+1
-2
@@ -7,7 +7,6 @@ package org.mifosplatform.portfolio.loanproduct.service;
|
|||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.mifosplatform.organisation.office.domain.OrganisationCurrency;
|
|
||||||
import org.mifosplatform.portfolio.loanproduct.data.LoanProductBorrowerCycleVariationData;
|
import org.mifosplatform.portfolio.loanproduct.data.LoanProductBorrowerCycleVariationData;
|
||||||
import org.mifosplatform.portfolio.loanproduct.data.LoanProductData;
|
import org.mifosplatform.portfolio.loanproduct.data.LoanProductData;
|
||||||
|
|
||||||
@@ -21,7 +20,7 @@ public interface LoanProductReadPlatformService {
|
|||||||
|
|
||||||
LoanProductData retrieveNewLoanProductDetails();
|
LoanProductData retrieveNewLoanProductDetails();
|
||||||
|
|
||||||
Collection<LoanProductData> retrieveAllLoanProductsForCurrency(OrganisationCurrency currency);
|
Collection<LoanProductData> retrieveAllLoanProductsForCurrency(String currencyCode);
|
||||||
|
|
||||||
Collection<LoanProductData> retrieveAvailableLoanProductsForMix();
|
Collection<LoanProductData> retrieveAvailableLoanProductsForMix();
|
||||||
|
|
||||||
|
|||||||
+7
-10
@@ -19,7 +19,6 @@ import org.mifosplatform.infrastructure.core.service.DateUtils;
|
|||||||
import org.mifosplatform.infrastructure.core.service.RoutingDataSource;
|
import org.mifosplatform.infrastructure.core.service.RoutingDataSource;
|
||||||
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
||||||
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
||||||
import org.mifosplatform.organisation.office.domain.OrganisationCurrency;
|
|
||||||
import org.mifosplatform.portfolio.charge.data.ChargeData;
|
import org.mifosplatform.portfolio.charge.data.ChargeData;
|
||||||
import org.mifosplatform.portfolio.charge.service.ChargeReadPlatformService;
|
import org.mifosplatform.portfolio.charge.service.ChargeReadPlatformService;
|
||||||
import org.mifosplatform.portfolio.loanproduct.data.LoanProductBorrowerCycleVariationData;
|
import org.mifosplatform.portfolio.loanproduct.data.LoanProductBorrowerCycleVariationData;
|
||||||
@@ -292,18 +291,16 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<LoanProductData> retrieveAllLoanProductsForCurrency(
|
public Collection<LoanProductData> retrieveAllLoanProductsForCurrency(String currencyCode) {
|
||||||
OrganisationCurrency currency) {
|
this.context.authenticatedUser();
|
||||||
this.context.authenticatedUser();
|
|
||||||
|
|
||||||
final LoanProductMapper rm = new LoanProductMapper(null, null);
|
final LoanProductMapper rm = new LoanProductMapper(null, null);
|
||||||
|
|
||||||
final String sql = "select " + rm.loanProductSchema()
|
final String sql = "select " + rm.loanProductSchema() + " where lp.currency_code='" + currencyCode + "'";
|
||||||
+ " where lp.currency_code='" + currency.getCode() + "'";
|
|
||||||
|
|
||||||
return this.jdbcTemplate.query(sql, rm, new Object[] {});
|
return this.jdbcTemplate.query(sql, rm, new Object[] {});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<LoanProductData> retrieveAvailableLoanProductsForMix() {
|
public Collection<LoanProductData> retrieveAvailableLoanProductsForMix() {
|
||||||
|
|||||||
-1
@@ -13,7 +13,6 @@ import org.springframework.data.jpa.domain.AbstractPersistable;
|
|||||||
@Table(name = "m_savings_interest_incentives")
|
@Table(name = "m_savings_interest_incentives")
|
||||||
public class DepositAccountInterestIncentives extends AbstractPersistable<Long> {
|
public class DepositAccountInterestIncentives extends AbstractPersistable<Long> {
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "deposit_account_interest_rate_slab_id", nullable = false)
|
@JoinColumn(name = "deposit_account_interest_rate_slab_id", nullable = false)
|
||||||
private DepositAccountInterestRateChartSlabs depositAccountInterestRateChartSlabs;
|
private DepositAccountInterestRateChartSlabs depositAccountInterestRateChartSlabs;
|
||||||
|
|||||||
+1
-2
@@ -7,7 +7,6 @@ package org.mifosplatform.portfolio.savings.service;
|
|||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.mifosplatform.organisation.office.domain.OrganisationCurrency;
|
|
||||||
import org.mifosplatform.portfolio.savings.data.SavingsProductData;
|
import org.mifosplatform.portfolio.savings.data.SavingsProductData;
|
||||||
|
|
||||||
public interface SavingsProductReadPlatformService {
|
public interface SavingsProductReadPlatformService {
|
||||||
@@ -18,7 +17,7 @@ public interface SavingsProductReadPlatformService {
|
|||||||
|
|
||||||
Collection<SavingsProductData> retrieveAllForLookupByType(Boolean isOverdraftType);
|
Collection<SavingsProductData> retrieveAllForLookupByType(Boolean isOverdraftType);
|
||||||
|
|
||||||
Collection<SavingsProductData> retrieveAllForCurrency(OrganisationCurrency currency);
|
Collection<SavingsProductData> retrieveAllForCurrency(String currencyCode);
|
||||||
|
|
||||||
SavingsProductData retrieveOne(Long productId);
|
SavingsProductData retrieveOne(Long productId);
|
||||||
|
|
||||||
|
|||||||
+9
-12
@@ -16,7 +16,6 @@ import org.mifosplatform.infrastructure.core.domain.JdbcSupport;
|
|||||||
import org.mifosplatform.infrastructure.core.service.RoutingDataSource;
|
import org.mifosplatform.infrastructure.core.service.RoutingDataSource;
|
||||||
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
||||||
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
||||||
import org.mifosplatform.organisation.office.domain.OrganisationCurrency;
|
|
||||||
import org.mifosplatform.portfolio.savings.DepositAccountType;
|
import org.mifosplatform.portfolio.savings.DepositAccountType;
|
||||||
import org.mifosplatform.portfolio.savings.data.SavingsProductData;
|
import org.mifosplatform.portfolio.savings.data.SavingsProductData;
|
||||||
import org.mifosplatform.portfolio.savings.exception.SavingsProductNotFoundException;
|
import org.mifosplatform.portfolio.savings.exception.SavingsProductNotFoundException;
|
||||||
@@ -180,24 +179,22 @@ public class SavingsProductReadPlatformServiceImpl implements SavingsProductRead
|
|||||||
@Override
|
@Override
|
||||||
public Collection<SavingsProductData> retrieveAllForLookupByType(Boolean isOverdraftType) {
|
public Collection<SavingsProductData> retrieveAllForLookupByType(Boolean isOverdraftType) {
|
||||||
String sql = "select " + this.savingsProductLookupsRowMapper.schema();
|
String sql = "select " + this.savingsProductLookupsRowMapper.schema();
|
||||||
if(isOverdraftType != null){
|
if (isOverdraftType != null) {
|
||||||
sql += " where sp.allow_overdraft=?";
|
sql += " where sp.allow_overdraft=?";
|
||||||
return this.jdbcTemplate.query(sql, this.savingsProductLookupsRowMapper, isOverdraftType);
|
return this.jdbcTemplate.query(sql, this.savingsProductLookupsRowMapper, isOverdraftType);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.jdbcTemplate.query(sql, this.savingsProductLookupsRowMapper);
|
return this.jdbcTemplate.query(sql, this.savingsProductLookupsRowMapper);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<SavingsProductData> retrieveAllForCurrency(
|
public Collection<SavingsProductData> retrieveAllForCurrency(String currencyCode) {
|
||||||
OrganisationCurrency currency) {
|
|
||||||
|
|
||||||
this.context.authenticatedUser();
|
this.context.authenticatedUser();
|
||||||
|
|
||||||
final String sql = "select " + this.savingsProductRowMapper.schema()
|
final String sql = "select " + this.savingsProductRowMapper.schema() + " where sp.currency_code='" + currencyCode + "'";
|
||||||
+ " where sp.currency_code='" + currency.getCode() + "'";
|
|
||||||
|
|
||||||
return this.jdbcTemplate.query(sql, this.savingsProductRowMapper, new Object[] { DepositAccountType.SAVINGS_DEPOSIT.getValue() });
|
return this.jdbcTemplate.query(sql, this.savingsProductRowMapper, new Object[] { DepositAccountType.SAVINGS_DEPOSIT.getValue() });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user