added configuration value for wait penalty period of 2 days
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
ALTER TABLE `c_configuration`
|
||||
ADD COLUMN `value` INT NULL AFTER `name`;
|
||||
|
||||
INSERT INTO `c_configuration` (
|
||||
`id` ,
|
||||
`name` ,
|
||||
`value` ,
|
||||
`enabled`
|
||||
)
|
||||
VALUES (
|
||||
NULL , 'penalty-wait-period', '2', '1'
|
||||
);
|
||||
|
||||
|
||||
Regular → Executable
+4
-1
@@ -14,9 +14,12 @@ public class GlobalConfigurationPropertyData {
|
||||
private final String name;
|
||||
@SuppressWarnings("unused")
|
||||
private final boolean enabled;
|
||||
@SuppressWarnings("unused")
|
||||
private final Long value;
|
||||
|
||||
public GlobalConfigurationPropertyData(final String name, final boolean enabled) {
|
||||
public GlobalConfigurationPropertyData(final String name, final boolean enabled, final Long value) {
|
||||
this.name = name;
|
||||
this.enabled = enabled;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
Regular → Executable
+13
-3
@@ -5,12 +5,12 @@
|
||||
*/
|
||||
package org.mifosplatform.infrastructure.configuration.domain;
|
||||
|
||||
import org.springframework.data.jpa.domain.AbstractPersistable;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.springframework.data.jpa.domain.AbstractPersistable;
|
||||
|
||||
@Entity
|
||||
@Table(name = "c_configuration")
|
||||
public class GlobalConfigurationProperty extends AbstractPersistable<Long> {
|
||||
@@ -21,23 +21,33 @@ public class GlobalConfigurationProperty extends AbstractPersistable<Long> {
|
||||
@Column(name = "enabled", nullable = false)
|
||||
private boolean enabled;
|
||||
|
||||
@Column(name= "value", nullable= true)
|
||||
private final Long value;
|
||||
|
||||
protected GlobalConfigurationProperty() {
|
||||
this.name = null;
|
||||
this.enabled = false;
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
public GlobalConfigurationProperty(final String name, final boolean enabled) {
|
||||
public GlobalConfigurationProperty(final String name, final boolean enabled,final Long value) {
|
||||
this.name = name;
|
||||
this.enabled = enabled;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
public Long getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public boolean updateTo(final boolean value) {
|
||||
final boolean updated = this.enabled != value;
|
||||
this.enabled = value;
|
||||
return updated;
|
||||
}
|
||||
|
||||
}
|
||||
Regular → Executable
+6
-5
@@ -5,10 +5,6 @@
|
||||
*/
|
||||
package org.mifosplatform.infrastructure.configuration.service;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.mifosplatform.infrastructure.configuration.data.GlobalConfigurationData;
|
||||
import org.mifosplatform.infrastructure.configuration.data.GlobalConfigurationPropertyData;
|
||||
import org.mifosplatform.infrastructure.core.service.RoutingDataSource;
|
||||
@@ -18,6 +14,10 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ConfigurationReadPlatformServiceImpl implements ConfigurationReadPlatformService {
|
||||
|
||||
@@ -51,8 +51,9 @@ public class ConfigurationReadPlatformServiceImpl implements ConfigurationReadPl
|
||||
|
||||
final String name = rs.getString("name");
|
||||
final boolean enabled = rs.getBoolean("enabled");
|
||||
final Long value = rs.getLong("value");
|
||||
|
||||
return new GlobalConfigurationPropertyData(name, enabled);
|
||||
return new GlobalConfigurationPropertyData(name, enabled,value);
|
||||
}
|
||||
}
|
||||
}
|
||||
+22
-23
@@ -5,18 +5,13 @@
|
||||
*/
|
||||
package org.mifosplatform.portfolio.loanaccount.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.joda.time.Days;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosplatform.infrastructure.codes.data.CodeValueData;
|
||||
import org.mifosplatform.infrastructure.codes.service.CodeValueReadPlatformService;
|
||||
import org.mifosplatform.infrastructure.configuration.domain.GlobalConfigurationProperty;
|
||||
import org.mifosplatform.infrastructure.configuration.domain.GlobalConfigurationRepository;
|
||||
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
||||
import org.mifosplatform.infrastructure.core.domain.JdbcSupport;
|
||||
import org.mifosplatform.infrastructure.core.service.DateUtils;
|
||||
@@ -48,19 +43,8 @@ import org.mifosplatform.portfolio.group.data.GroupGeneralData;
|
||||
import org.mifosplatform.portfolio.group.data.GroupRoleData;
|
||||
import org.mifosplatform.portfolio.group.service.GroupReadPlatformService;
|
||||
import org.mifosplatform.portfolio.group.service.SearchParameters;
|
||||
import org.mifosplatform.portfolio.loanaccount.data.DisbursementData;
|
||||
import org.mifosplatform.portfolio.loanaccount.data.LoanAccountData;
|
||||
import org.mifosplatform.portfolio.loanaccount.data.LoanApplicationTimelineData;
|
||||
import org.mifosplatform.portfolio.loanaccount.data.LoanStatusEnumData;
|
||||
import org.mifosplatform.portfolio.loanaccount.data.LoanSummaryData;
|
||||
import org.mifosplatform.portfolio.loanaccount.data.LoanTransactionData;
|
||||
import org.mifosplatform.portfolio.loanaccount.data.LoanTransactionEnumData;
|
||||
import org.mifosplatform.portfolio.loanaccount.data.RepaymentScheduleRelatedLoanData;
|
||||
import org.mifosplatform.portfolio.loanaccount.domain.Loan;
|
||||
import org.mifosplatform.portfolio.loanaccount.domain.LoanRepository;
|
||||
import org.mifosplatform.portfolio.loanaccount.domain.LoanTransaction;
|
||||
import org.mifosplatform.portfolio.loanaccount.domain.LoanTransactionRepository;
|
||||
import org.mifosplatform.portfolio.loanaccount.domain.LoanTransactionType;
|
||||
import org.mifosplatform.portfolio.loanaccount.data.*;
|
||||
import org.mifosplatform.portfolio.loanaccount.domain.*;
|
||||
import org.mifosplatform.portfolio.loanaccount.exception.LoanNotFoundException;
|
||||
import org.mifosplatform.portfolio.loanaccount.exception.LoanTransactionNotFoundException;
|
||||
import org.mifosplatform.portfolio.loanaccount.loanschedule.data.LoanScheduleData;
|
||||
@@ -83,6 +67,13 @@ import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
@Service
|
||||
public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
|
||||
@@ -102,6 +93,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
private final StaffReadPlatformService staffReadPlatformService;
|
||||
private final PaginationHelper<LoanAccountData> paginationHelper = new PaginationHelper<LoanAccountData>();
|
||||
private final LoanMapper loaanLoanMapper = new LoanMapper();
|
||||
private final GlobalConfigurationRepository repository;
|
||||
|
||||
@Autowired
|
||||
public LoanReadPlatformServiceImpl(final PlatformSecurityContext context, final LoanRepository loanRepository,
|
||||
@@ -111,7 +103,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
final GroupReadPlatformService groupReadPlatformService, final LoanDropdownReadPlatformService loanDropdownReadPlatformService,
|
||||
final FundReadPlatformService fundReadPlatformService, final ChargeReadPlatformService chargeReadPlatformService,
|
||||
final CodeValueReadPlatformService codeValueReadPlatformService, final RoutingDataSource dataSource,
|
||||
final CalendarReadPlatformService calendarReadPlatformService, final StaffReadPlatformService staffReadPlatformService) {
|
||||
final CalendarReadPlatformService calendarReadPlatformService, final StaffReadPlatformService staffReadPlatformService,
|
||||
final GlobalConfigurationRepository repository) {
|
||||
this.context = context;
|
||||
this.loanRepository = loanRepository;
|
||||
this.loanTransactionRepository = loanTransactionRepository;
|
||||
@@ -126,6 +119,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
this.calendarReadPlatformService = calendarReadPlatformService;
|
||||
this.staffReadPlatformService = staffReadPlatformService;
|
||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
this.repository = repository;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1149,14 +1144,18 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
|
||||
@Override
|
||||
public Collection<OverdueLoanScheduleData> retrieveAllLoansWithOverdueInstallmentsNotAlreadyPenalized() {
|
||||
final String penaltyWaitPeriod ="penalty-wait-period";
|
||||
final GlobalConfigurationProperty globalConfigurationProperty= this.repository.findOneByName(penaltyWaitPeriod);
|
||||
final Long penaltyWaitPeriodValue = globalConfigurationProperty.getValue();
|
||||
|
||||
final MusoniOverdueLoanScheduleMapper rm = new MusoniOverdueLoanScheduleMapper();
|
||||
final String sql = "select "
|
||||
+ rm.schema()
|
||||
+ " where CURDATE() > ls.duedate "
|
||||
+ " where DATE_SUB(CURDATE(),INTERVAL ? DAY) > ls.duedate "
|
||||
+ " and ls.completed_derived <> 1 and mc.charge_applies_to_enum =1 "
|
||||
+ " and mc.charge_time_enum = 9 and ml.loan_status_id = 300 "
|
||||
+ " and plc.charge_id not in (SELECT charge_id from m_loan_charge as mlc where mlc.loan_id = ml.id and mlc.charge_id = plc.charge_id and mlc.due_for_collection_as_of_date > fromdate AND mlc.due_for_collection_as_of_date <= duedate) ";
|
||||
return this.jdbcTemplate.query(sql, rm, new Object[] {});
|
||||
return this.jdbcTemplate.query(sql, rm, new Object[]{penaltyWaitPeriodValue});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user