Date to LocalDate (scheduler excluded due to quartz)
This commit is contained in:
committed by
Arnold Gálovics
parent
f7e21f8db1
commit
1db8ef46fc
+5
-8
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.closure.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import javax.persistence.Column;
|
||||
@@ -26,8 +26,6 @@ import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.closure.api.GLClosureJsonInputParams;
|
||||
@@ -48,8 +46,7 @@ public class GLClosure extends AbstractAuditableCustom {
|
||||
private boolean deleted = true;
|
||||
|
||||
@Column(name = "closing_date")
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date closingDate;
|
||||
private LocalDate closingDate;
|
||||
|
||||
@Column(name = "comments", nullable = true, length = 500)
|
||||
private String comments;
|
||||
@@ -58,7 +55,7 @@ public class GLClosure extends AbstractAuditableCustom {
|
||||
//
|
||||
}
|
||||
|
||||
public GLClosure(final Office office, final Date closingDate, final String comments) {
|
||||
public GLClosure(final Office office, final LocalDate closingDate, final String comments) {
|
||||
this.office = office;
|
||||
this.deleted = false;
|
||||
this.closingDate = closingDate;
|
||||
@@ -69,7 +66,7 @@ public class GLClosure extends AbstractAuditableCustom {
|
||||
}
|
||||
|
||||
public static GLClosure fromJson(final Office office, final JsonCommand command) {
|
||||
final Date closingDate = command.dateValueOfParameterNamed(GLClosureJsonInputParams.CLOSING_DATE.getValue());
|
||||
final LocalDate closingDate = command.localDateValueOfParameterNamed(GLClosureJsonInputParams.CLOSING_DATE.getValue());
|
||||
final String comments = command.stringValueOfParameterNamed(GLClosureJsonInputParams.COMMENTS.getValue());
|
||||
return new GLClosure(office, closingDate, comments);
|
||||
}
|
||||
@@ -92,7 +89,7 @@ public class GLClosure extends AbstractAuditableCustom {
|
||||
}
|
||||
}
|
||||
|
||||
public Date getClosingDate() {
|
||||
public LocalDate getClosingDate() {
|
||||
return this.closingDate;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.closure.exception;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
|
||||
|
||||
/**
|
||||
@@ -26,7 +26,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
|
||||
*/
|
||||
public class GLClosureInvalidDeleteException extends AbstractPlatformDomainRuleException {
|
||||
|
||||
public GLClosureInvalidDeleteException(final Long officeId, final String officeName, final Date latestclosureDate) {
|
||||
public GLClosureInvalidDeleteException(final Long officeId, final String officeName, final LocalDate latestclosureDate) {
|
||||
super("error.msg.glclosure.invalid.delete", "The latest closure for office with Id " + officeId + " and name " + officeName
|
||||
+ " is on " + latestclosureDate.toString() + ", please delete this closure first", latestclosureDate);
|
||||
}
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.closure.exception;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
|
||||
|
||||
/**
|
||||
@@ -50,7 +50,7 @@ public class GLClosureInvalidException extends AbstractPlatformDomainRuleExcepti
|
||||
}
|
||||
}
|
||||
|
||||
public GLClosureInvalidException(final GlClosureInvalidReason reason, final Date date) {
|
||||
public GLClosureInvalidException(final GlClosureInvalidReason reason, final LocalDate date) {
|
||||
super(reason.errorCode(), reason.errorMessage(), date);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-9
@@ -19,7 +19,6 @@
|
||||
package org.apache.fineract.accounting.closure.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -67,15 +66,15 @@ public class GLClosureWritePlatformServiceJpaRepositoryImpl implements GLClosure
|
||||
final Office office = this.officeRepositoryWrapper.findOneWithNotFoundDetection(officeId);
|
||||
// TODO: Get Tenant specific date
|
||||
// ensure closure date is not in the future
|
||||
final Date todaysDate = DateUtils.getBusinessDate();
|
||||
final Date closureDate = command.dateValueOfParameterNamed(GLClosureJsonInputParams.CLOSING_DATE.getValue());
|
||||
if (closureDate.after(todaysDate)) {
|
||||
final LocalDate todaysDate = DateUtils.getBusinessLocalDate();
|
||||
final LocalDate closureDate = command.localDateValueOfParameterNamed(GLClosureJsonInputParams.CLOSING_DATE.getValue());
|
||||
if (closureDate.isAfter(todaysDate)) {
|
||||
throw new GLClosureInvalidException(GlClosureInvalidReason.FUTURE_DATE, closureDate);
|
||||
}
|
||||
// shouldn't be before an existing accounting closure
|
||||
final GLClosure latestGLClosure = this.glClosureRepository.getLatestGLClosureByBranch(officeId);
|
||||
if (latestGLClosure != null) {
|
||||
if (latestGLClosure.getClosingDate().after(closureDate)) {
|
||||
if (latestGLClosure.getClosingDate().isAfter(closureDate)) {
|
||||
throw new GLClosureInvalidException(GlClosureInvalidReason.ACCOUNTING_CLOSED, latestGLClosure.getClosingDate());
|
||||
}
|
||||
}
|
||||
@@ -121,9 +120,9 @@ public class GLClosureWritePlatformServiceJpaRepositoryImpl implements GLClosure
|
||||
/**
|
||||
* check if any closures are present for this branch at a later date than this closure date
|
||||
**/
|
||||
final Date closureDate = glClosure.getClosingDate();
|
||||
final LocalDate closureDate = glClosure.getClosingDate();
|
||||
final GLClosure latestGLClosure = this.glClosureRepository.getLatestGLClosureByBranch(glClosure.getOffice().getId());
|
||||
if (latestGLClosure.getClosingDate().after(closureDate)) {
|
||||
if (latestGLClosure.getClosingDate().isAfter(closureDate)) {
|
||||
throw new GLClosureInvalidDeleteException(latestGLClosure.getOffice().getId(), latestGLClosure.getOffice().getName(),
|
||||
latestGLClosure.getClosingDate());
|
||||
}
|
||||
@@ -141,8 +140,7 @@ public class GLClosureWritePlatformServiceJpaRepositoryImpl implements GLClosure
|
||||
private void handleGLClosureIntegrityIssues(final JsonCommand command, final Throwable realCause, NonTransientDataAccessException dve) {
|
||||
if (realCause.getMessage().contains("office_id_closing_date")) {
|
||||
throw new GLClosureDuplicateException(command.longValueOfParameterNamed(GLClosureJsonInputParams.OFFICE_ID.getValue()),
|
||||
LocalDate.ofInstant(command.dateValueOfParameterNamed(GLClosureJsonInputParams.CLOSING_DATE.getValue()).toInstant(),
|
||||
DateUtils.getDateTimeZoneOfTenant()));
|
||||
command.localDateValueOfParameterNamed(GLClosureJsonInputParams.CLOSING_DATE.getValue()));
|
||||
}
|
||||
|
||||
log.error("Error occured.", dve);
|
||||
|
||||
+9
-13
@@ -20,13 +20,11 @@
|
||||
package org.apache.fineract.accounting.glaccount.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Objects;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
|
||||
@Entity
|
||||
@@ -43,23 +41,21 @@ public class TrialBalance extends AbstractPersistableCustom {
|
||||
private BigDecimal amount;
|
||||
|
||||
@Column(name = "entry_date", nullable = false)
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date entryDate;
|
||||
private LocalDate entryDate;
|
||||
|
||||
@Column(name = "created_date", nullable = true)
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date transactionDate;
|
||||
private LocalDate transactionDate;
|
||||
|
||||
@Column(name = "closing_balance", nullable = false)
|
||||
private BigDecimal closingBalance;
|
||||
|
||||
public static TrialBalance getInstance(final Long officeId, final Long glAccountId, final BigDecimal amount, final Date entryDate,
|
||||
final Date transactionDate) {
|
||||
public static TrialBalance getInstance(final Long officeId, final Long glAccountId, final BigDecimal amount, final LocalDate entryDate,
|
||||
final LocalDate transactionDate) {
|
||||
return new TrialBalance(officeId, glAccountId, amount, entryDate, transactionDate);
|
||||
}
|
||||
|
||||
private TrialBalance(final Long officeId, final Long glAccountId, final BigDecimal amount, final Date entryDate,
|
||||
final Date transactionDate) {
|
||||
private TrialBalance(final Long officeId, final Long glAccountId, final BigDecimal amount, final LocalDate entryDate,
|
||||
final LocalDate transactionDate) {
|
||||
this.officeId = officeId;
|
||||
this.glAccountId = glAccountId;
|
||||
this.amount = amount;
|
||||
@@ -73,7 +69,7 @@ public class TrialBalance extends AbstractPersistableCustom {
|
||||
return officeId;
|
||||
}
|
||||
|
||||
public Date getTransactionDate() {
|
||||
public LocalDate getTransactionDate() {
|
||||
return transactionDate;
|
||||
}
|
||||
|
||||
@@ -85,7 +81,7 @@ public class TrialBalance extends AbstractPersistableCustom {
|
||||
this.closingBalance = closingBalance;
|
||||
}
|
||||
|
||||
public Date getEntryDate() {
|
||||
public LocalDate getEntryDate() {
|
||||
return entryDate;
|
||||
}
|
||||
|
||||
|
||||
+2
-5
@@ -19,8 +19,6 @@
|
||||
package org.apache.fineract.accounting.journalentry.api;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.JsonParserHelper;
|
||||
@@ -38,9 +36,8 @@ public class DateParam {
|
||||
this.dateAsString = dateStr;
|
||||
}
|
||||
|
||||
public Date getDate(final String parameterName, final String dateFormat, final String localeAsString) {
|
||||
public LocalDate getDate(final String parameterName, final String dateFormat, final String localeAsString) {
|
||||
final Locale locale = JsonParserHelper.localeFromString(localeAsString);
|
||||
final LocalDate localDate = JsonParserHelper.convertFrom(this.dateAsString, parameterName, dateFormat, locale);
|
||||
return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
return JsonParserHelper.convertFrom(this.dateAsString, parameterName, dateFormat, locale);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -28,8 +28,8 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import javax.ws.rs.Consumes;
|
||||
@@ -126,11 +126,11 @@ public class JournalEntriesApiResource {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermission);
|
||||
|
||||
Date fromDate = null;
|
||||
LocalDate fromDate = null;
|
||||
if (fromDateParam != null) {
|
||||
fromDate = fromDateParam.getDate("fromDate", dateFormat, locale);
|
||||
}
|
||||
Date toDate = null;
|
||||
LocalDate toDate = null;
|
||||
if (toDateParam != null) {
|
||||
toDate = toDateParam.getDate("toDate", dateFormat, locale);
|
||||
}
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@
|
||||
package org.apache.fineract.accounting.journalentry.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -35,7 +35,7 @@ public class ClientTransactionDTO {
|
||||
|
||||
private final Long paymentTypeId;
|
||||
private final Long transactionId;
|
||||
private final Date transactionDate;
|
||||
private final LocalDate transactionDate;
|
||||
private final EnumOptionData transactionType;
|
||||
private final String currencyCode;
|
||||
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@
|
||||
package org.apache.fineract.accounting.journalentry.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -33,7 +33,7 @@ public class LoanTransactionDTO {
|
||||
private final Long officeId;
|
||||
private final Long paymentTypeId;
|
||||
private final String transactionId;
|
||||
private final Date transactionDate;
|
||||
private final LocalDate transactionDate;
|
||||
private final LoanTransactionEnumData transactionType;
|
||||
|
||||
private final BigDecimal amount;
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@
|
||||
package org.apache.fineract.accounting.journalentry.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -32,7 +32,7 @@ public class SavingsTransactionDTO {
|
||||
private final Long officeId;
|
||||
private final Long paymentTypeId;
|
||||
private final String transactionId;
|
||||
private final Date transactionDate;
|
||||
private final LocalDate transactionDate;
|
||||
private final SavingsAccountTransactionEnumData transactionType;
|
||||
|
||||
private final BigDecimal amount;
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@
|
||||
package org.apache.fineract.accounting.journalentry.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -32,7 +32,7 @@ public class SharesTransactionDTO {
|
||||
private final Long officeId;
|
||||
private final Long paymentTypeId;
|
||||
private final String transactionId;
|
||||
private final Date transactionDate;
|
||||
private final LocalDate transactionDate;
|
||||
private final ShareAccountTransactionEnumData transactionType;
|
||||
private final ShareAccountTransactionEnumData transactionStatus;
|
||||
|
||||
|
||||
+6
-9
@@ -19,15 +19,13 @@
|
||||
package org.apache.fineract.accounting.journalentry.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccount;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractAuditableCustom;
|
||||
@@ -85,8 +83,7 @@ public class JournalEntry extends AbstractAuditableCustom {
|
||||
private boolean manualEntry = false;
|
||||
|
||||
@Column(name = "entry_date")
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date transactionDate;
|
||||
private LocalDate transactionDate;
|
||||
|
||||
@Column(name = "type_enum", nullable = false)
|
||||
private Integer type;
|
||||
@@ -107,7 +104,7 @@ public class JournalEntry extends AbstractAuditableCustom {
|
||||
private String referenceNumber;
|
||||
|
||||
public static JournalEntry createNew(final Office office, final PaymentDetail paymentDetail, final GLAccount glAccount,
|
||||
final String currencyCode, final String transactionId, final boolean manualEntry, final Date transactionDate,
|
||||
final String currencyCode, final String transactionId, final boolean manualEntry, final LocalDate transactionDate,
|
||||
final JournalEntryType journalEntryType, final BigDecimal amount, final String description, final Integer entityType,
|
||||
final Long entityId, final String referenceNumber, final LoanTransaction loanTransaction,
|
||||
final SavingsAccountTransaction savingsTransaction, final ClientTransaction clientTransaction, Long shareTransactionId) {
|
||||
@@ -121,8 +118,8 @@ public class JournalEntry extends AbstractAuditableCustom {
|
||||
}
|
||||
|
||||
public JournalEntry(final Office office, final PaymentDetail paymentDetail, final GLAccount glAccount, final String currencyCode,
|
||||
final String transactionId, final boolean manualEntry, final Date transactionDate, final Integer type, final BigDecimal amount,
|
||||
final String description, final Integer entityType, final Long entityId, final String referenceNumber,
|
||||
final String transactionId, final boolean manualEntry, final LocalDate transactionDate, final Integer type,
|
||||
final BigDecimal amount, final String description, final Integer entityType, final Long entityId, final String referenceNumber,
|
||||
final LoanTransaction loanTransaction, final SavingsAccountTransaction savingsTransaction,
|
||||
final ClientTransaction clientTransaction, final Long shareTransactionId) {
|
||||
this.office = office;
|
||||
@@ -162,7 +159,7 @@ public class JournalEntry extends AbstractAuditableCustom {
|
||||
return this.glAccount;
|
||||
}
|
||||
|
||||
public Date getTransactionDate() {
|
||||
public LocalDate getTransactionDate() {
|
||||
return this.transactionDate;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.journalentry.exception;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
|
||||
|
||||
/**
|
||||
@@ -76,7 +76,7 @@ public class JournalEntryInvalidException extends AbstractPlatformDomainRuleExce
|
||||
}
|
||||
}
|
||||
|
||||
public JournalEntryInvalidException(final GlJournalEntryInvalidReason reason, final Date date, final String accountName,
|
||||
public JournalEntryInvalidException(final GlJournalEntryInvalidReason reason, final LocalDate date, final String accountName,
|
||||
final String accountGLCode) {
|
||||
super(reason.errorCode(), reason.errorMessage(), date, accountName, accountGLCode);
|
||||
}
|
||||
|
||||
+52
-53
@@ -20,9 +20,7 @@ package org.apache.fineract.accounting.journalentry.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -116,7 +114,7 @@ public class AccountingProcessorHelper {
|
||||
for (final Map<String, Object> map : newTransactionsMap) {
|
||||
final Long transactionOfficeId = (Long) map.get("officeId");
|
||||
final String transactionId = ((Long) map.get("id")).toString();
|
||||
final Date transactionDate = Date.from(((LocalDate) map.get("date")).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
final LocalDate transactionDate = ((LocalDate) map.get("date"));
|
||||
final LoanTransactionEnumData transactionType = (LoanTransactionEnumData) map.get("type");
|
||||
final BigDecimal amount = (BigDecimal) map.get("amount");
|
||||
final BigDecimal principal = (BigDecimal) map.get("principalPortion");
|
||||
@@ -183,7 +181,7 @@ public class AccountingProcessorHelper {
|
||||
for (final Map<String, Object> map : newTransactionsMap) {
|
||||
final Long transactionOfficeId = (Long) map.get("officeId");
|
||||
final String transactionId = ((Long) map.get("id")).toString();
|
||||
final Date transactionDate = Date.from(((LocalDate) map.get("date")).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
final LocalDate transactionDate = ((LocalDate) map.get("date"));
|
||||
final SavingsAccountTransactionEnumData transactionType = (SavingsAccountTransactionEnumData) map.get("type");
|
||||
final BigDecimal amount = (BigDecimal) map.get("amount");
|
||||
final boolean reversed = (Boolean) map.get("reversed");
|
||||
@@ -252,7 +250,7 @@ public class AccountingProcessorHelper {
|
||||
for (final Map<String, Object> map : newTransactionsMap) {
|
||||
final Long transactionOfficeId = (Long) map.get("officeId");
|
||||
final String transactionId = ((Long) map.get("id")).toString();
|
||||
final Date transactionDate = Date.from(((LocalDate) map.get("date")).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
final LocalDate transactionDate = ((LocalDate) map.get("date"));
|
||||
final ShareAccountTransactionEnumData transactionType = (ShareAccountTransactionEnumData) map.get("type");
|
||||
final ShareAccountTransactionEnumData transactionStatus = (ShareAccountTransactionEnumData) map.get("status");
|
||||
final BigDecimal amount = (BigDecimal) map.get("amount");
|
||||
@@ -288,8 +286,7 @@ public class AccountingProcessorHelper {
|
||||
final Long transactionOfficeId = (Long) accountingBridgeData.get("officeId");
|
||||
final Long clientId = (Long) accountingBridgeData.get("clientId");
|
||||
final Long transactionId = (Long) accountingBridgeData.get("id");
|
||||
final Date transactionDate = Date
|
||||
.from(((LocalDate) accountingBridgeData.get("date")).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
final LocalDate transactionDate = ((LocalDate) accountingBridgeData.get("date"));
|
||||
final EnumOptionData transactionType = (EnumOptionData) accountingBridgeData.get("type");
|
||||
final BigDecimal amount = (BigDecimal) accountingBridgeData.get("amount");
|
||||
final boolean reversed = (Boolean) accountingBridgeData.get("reversed");
|
||||
@@ -343,7 +340,8 @@ public class AccountingProcessorHelper {
|
||||
*/
|
||||
public void createAccrualBasedJournalEntriesAndReversalsForLoan(final Office office, final String currencyCode,
|
||||
final Integer accountTypeToBeDebited, final Integer accountTypeToBeCredited, final Long loanProductId, final Long paymentTypeId,
|
||||
final Long loanId, final String transactionId, final Date transactionDate, final BigDecimal amount, final Boolean isReversal) {
|
||||
final Long loanId, final String transactionId, final LocalDate transactionDate, final BigDecimal amount,
|
||||
final Boolean isReversal) {
|
||||
int accountTypeToDebitId = accountTypeToBeDebited;
|
||||
int accountTypeToCreditId = accountTypeToBeCredited;
|
||||
// reverse debits and credits for reversals
|
||||
@@ -385,7 +383,7 @@ public class AccountingProcessorHelper {
|
||||
*/
|
||||
public void createAccrualBasedJournalEntriesAndReversalsForLoanCharges(final Office office, final String currencyCode,
|
||||
final Integer accountTypeToBeDebited, final Integer accountTypeToBeCredited, final Long loanProductId, final Long loanId,
|
||||
final String transactionId, final Date transactionDate, final BigDecimal totalAmount, final Boolean isReversal,
|
||||
final String transactionId, final LocalDate transactionDate, final BigDecimal totalAmount, final Boolean isReversal,
|
||||
final List<ChargePaymentDTO> chargePaymentDTOs) {
|
||||
|
||||
GLAccount receivableAccount = getLinkedGLAccountForLoanCharges(loanProductId, accountTypeToBeDebited, null);
|
||||
@@ -446,8 +444,8 @@ public class AccountingProcessorHelper {
|
||||
*/
|
||||
public void createCashBasedJournalEntriesAndReversalsForSavings(final Office office, final String currencyCode,
|
||||
final Integer accountTypeToBeDebited, final Integer accountTypeToBeCredited, final Long savingsProductId,
|
||||
final Long paymentTypeId, final Long loanId, final String transactionId, final Date transactionDate, final BigDecimal amount,
|
||||
final Boolean isReversal) {
|
||||
final Long paymentTypeId, final Long loanId, final String transactionId, final LocalDate transactionDate,
|
||||
final BigDecimal amount, final Boolean isReversal) {
|
||||
int accountTypeToDebitId = accountTypeToBeDebited;
|
||||
int accountTypeToCreditId = accountTypeToBeCredited;
|
||||
// reverse debits and credits for reversals
|
||||
@@ -479,7 +477,8 @@ public class AccountingProcessorHelper {
|
||||
*/
|
||||
public void createCashBasedJournalEntriesAndReversalsForLoan(final Office office, final String currencyCode,
|
||||
final Integer accountTypeToBeDebited, final Integer accountTypeToBeCredited, final Long loanProductId, final Long paymentTypeId,
|
||||
final Long loanId, final String transactionId, final Date transactionDate, final BigDecimal amount, final Boolean isReversal) {
|
||||
final Long loanId, final String transactionId, final LocalDate transactionDate, final BigDecimal amount,
|
||||
final Boolean isReversal) {
|
||||
int accountTypeToDebitId = accountTypeToBeDebited;
|
||||
int accountTypeToCreditId = accountTypeToBeCredited;
|
||||
// reverse debits and credits for reversals
|
||||
@@ -493,7 +492,7 @@ public class AccountingProcessorHelper {
|
||||
|
||||
public void createCreditJournalEntryOrReversalForLoan(final Office office, final String currencyCode,
|
||||
final CashAccountsForLoan accountMappingType, final Long loanProductId, final Long paymentTypeId, final Long loanId,
|
||||
final String transactionId, final Date transactionDate, final BigDecimal amount, final Boolean isReversal) {
|
||||
final String transactionId, final LocalDate transactionDate, final BigDecimal amount, final Boolean isReversal) {
|
||||
final int accountMappingTypeId = accountMappingType.getValue();
|
||||
createCreditJournalEntryOrReversalForLoan(office, currencyCode, accountMappingTypeId, loanProductId, paymentTypeId, loanId,
|
||||
transactionId, transactionDate, amount, isReversal);
|
||||
@@ -501,7 +500,7 @@ public class AccountingProcessorHelper {
|
||||
|
||||
public void createCreditJournalEntryOrReversalForLoan(final Office office, final String currencyCode,
|
||||
final AccrualAccountsForLoan accountMappingType, final Long loanProductId, final Long paymentTypeId, final Long loanId,
|
||||
final String transactionId, final Date transactionDate, final BigDecimal amount, final Boolean isReversal) {
|
||||
final String transactionId, final LocalDate transactionDate, final BigDecimal amount, final Boolean isReversal) {
|
||||
final int accountMappingTypeId = accountMappingType.getValue();
|
||||
createCreditJournalEntryOrReversalForLoan(office, currencyCode, accountMappingTypeId, loanProductId, paymentTypeId, loanId,
|
||||
transactionId, transactionDate, amount, isReversal);
|
||||
@@ -511,14 +510,13 @@ public class AccountingProcessorHelper {
|
||||
* @param latestGLClosure
|
||||
* @param transactionDate
|
||||
*/
|
||||
public void checkForBranchClosures(final GLClosure latestGLClosure, final Date transactionDate) {
|
||||
public void checkForBranchClosures(final GLClosure latestGLClosure, final LocalDate transactionDate) {
|
||||
/**
|
||||
* check if an accounting closure has happened for this branch after the transaction Date
|
||||
**/
|
||||
if (latestGLClosure != null) {
|
||||
if (latestGLClosure.getClosingDate().after(transactionDate) || latestGLClosure.getClosingDate().compareTo(transactionDate) == 0
|
||||
? Boolean.TRUE
|
||||
: Boolean.FALSE) {
|
||||
if (latestGLClosure.getClosingDate().isAfter(transactionDate)
|
||||
|| latestGLClosure.getClosingDate().compareTo(transactionDate) == 0 ? Boolean.TRUE : Boolean.FALSE) {
|
||||
throw new JournalEntryInvalidException(GlJournalEntryInvalidReason.ACCOUNTING_CLOSED, latestGLClosure.getClosingDate(),
|
||||
null, null);
|
||||
}
|
||||
@@ -535,7 +533,7 @@ public class AccountingProcessorHelper {
|
||||
|
||||
private void createJournalEntriesForLoan(final Office office, final String currencyCode, final int accountTypeToDebitId,
|
||||
final int accountTypeToCreditId, final Long loanProductId, final Long paymentTypeId, final Long loanId,
|
||||
final String transactionId, final Date transactionDate, final BigDecimal amount) {
|
||||
final String transactionId, final LocalDate transactionDate, final BigDecimal amount) {
|
||||
final GLAccount debitAccount = getLinkedGLAccountForLoanProduct(loanProductId, accountTypeToDebitId, paymentTypeId);
|
||||
final GLAccount creditAccount = getLinkedGLAccountForLoanProduct(loanProductId, accountTypeToCreditId, paymentTypeId);
|
||||
createDebitJournalEntryForLoan(office, currencyCode, debitAccount, loanId, transactionId, transactionDate, amount);
|
||||
@@ -544,7 +542,7 @@ public class AccountingProcessorHelper {
|
||||
|
||||
private void createJournalEntriesForSavings(final Office office, final String currencyCode, final int accountTypeToDebitId,
|
||||
final int accountTypeToCreditId, final Long savingsProductId, final Long paymentTypeId, final Long savingsId,
|
||||
final String transactionId, final Date transactionDate, final BigDecimal amount) {
|
||||
final String transactionId, final LocalDate transactionDate, final BigDecimal amount) {
|
||||
final GLAccount debitAccount = getLinkedGLAccountForSavingsProduct(savingsProductId, accountTypeToDebitId, paymentTypeId);
|
||||
final GLAccount creditAccount = getLinkedGLAccountForSavingsProduct(savingsProductId, accountTypeToCreditId, paymentTypeId);
|
||||
createDebitJournalEntryForSavings(office, currencyCode, debitAccount, savingsId, transactionId, transactionDate, amount);
|
||||
@@ -574,7 +572,7 @@ public class AccountingProcessorHelper {
|
||||
public void createCashBasedJournalEntriesAndReversalsForSavingsTax(final Office office, final String currencyCode,
|
||||
final CashAccountsForSavings accountTypeToBeDebited, final CashAccountsForSavings accountTypeToBeCredited,
|
||||
final Long savingsProductId, final Long paymentTypeId, final Long savingsId, final String transactionId,
|
||||
final Date transactionDate, final BigDecimal amount, final Boolean isReversal, final List<TaxPaymentDTO> taxDetails) {
|
||||
final LocalDate transactionDate, final BigDecimal amount, final Boolean isReversal, final List<TaxPaymentDTO> taxDetails) {
|
||||
|
||||
for (TaxPaymentDTO taxPaymentDTO : taxDetails) {
|
||||
if (taxPaymentDTO.getAmount() != null) {
|
||||
@@ -594,7 +592,7 @@ public class AccountingProcessorHelper {
|
||||
|
||||
public void createCashBasedDebitJournalEntriesAndReversalsForSavings(final Office office, final String currencyCode,
|
||||
final Integer accountTypeToBeDebited, final Long savingsProductId, final Long paymentTypeId, final Long savingsId,
|
||||
final String transactionId, final Date transactionDate, final BigDecimal amount, final Boolean isReversal) {
|
||||
final String transactionId, final LocalDate transactionDate, final BigDecimal amount, final Boolean isReversal) {
|
||||
// reverse debits and credits for reversals
|
||||
if (isReversal) {
|
||||
createCreditJournalEntriesForSavings(office, currencyCode, accountTypeToBeDebited, savingsProductId, paymentTypeId, savingsId,
|
||||
@@ -607,7 +605,7 @@ public class AccountingProcessorHelper {
|
||||
|
||||
public void createCashBasedCreditJournalEntriesAndReversalsForSavings(final Office office, final String currencyCode,
|
||||
final Integer accountTypeToBeCredited, final Long savingsProductId, final Long paymentTypeId, final Long savingsId,
|
||||
final String transactionId, final Date transactionDate, final BigDecimal amount, final Boolean isReversal) {
|
||||
final String transactionId, final LocalDate transactionDate, final BigDecimal amount, final Boolean isReversal) {
|
||||
// reverse debits and credits for reversals
|
||||
if (isReversal) {
|
||||
createDebitJournalEntriesForSavings(office, currencyCode, accountTypeToBeCredited, savingsProductId, paymentTypeId, savingsId,
|
||||
@@ -619,7 +617,7 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
|
||||
public void createCashBasedDebitJournalEntriesAndReversalsForSavings(final Office office, final String currencyCode,
|
||||
final Long debitAccountId, final Long savingsId, final String transactionId, final Date transactionDate,
|
||||
final Long debitAccountId, final Long savingsId, final String transactionId, final LocalDate transactionDate,
|
||||
final BigDecimal amount, final Boolean isReversal) {
|
||||
// reverse debits and credits for reversals
|
||||
final GLAccount debitAccount = getGLAccountById(debitAccountId);
|
||||
@@ -631,7 +629,7 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
|
||||
public void createCashBasedCreditJournalEntriesAndReversalsForSavings(final Office office, final String currencyCode,
|
||||
final Long creditAccountId, final Long savingsId, final String transactionId, final Date transactionDate,
|
||||
final Long creditAccountId, final Long savingsId, final String transactionId, final LocalDate transactionDate,
|
||||
final BigDecimal amount, final Boolean isReversal) {
|
||||
// reverse debits and credits for reversals
|
||||
final GLAccount creditAccount = getGLAccountById(creditAccountId);
|
||||
@@ -644,21 +642,21 @@ public class AccountingProcessorHelper {
|
||||
|
||||
private void createDebitJournalEntriesForSavings(final Office office, final String currencyCode, final int accountTypeToDebitId,
|
||||
final Long savingsProductId, final Long paymentTypeId, final Long savingsId, final String transactionId,
|
||||
final Date transactionDate, final BigDecimal amount) {
|
||||
final LocalDate transactionDate, final BigDecimal amount) {
|
||||
final GLAccount debitAccount = getLinkedGLAccountForSavingsProduct(savingsProductId, accountTypeToDebitId, paymentTypeId);
|
||||
createDebitJournalEntryForSavings(office, currencyCode, debitAccount, savingsId, transactionId, transactionDate, amount);
|
||||
}
|
||||
|
||||
private void createCreditJournalEntriesForSavings(final Office office, final String currencyCode, final int accountTypeToCreditId,
|
||||
final Long savingsProductId, final Long paymentTypeId, final Long savingsId, final String transactionId,
|
||||
final Date transactionDate, final BigDecimal amount) {
|
||||
final LocalDate transactionDate, final BigDecimal amount) {
|
||||
final GLAccount creditAccount = getLinkedGLAccountForSavingsProduct(savingsProductId, accountTypeToCreditId, paymentTypeId);
|
||||
createCreditJournalEntryForSavings(office, currencyCode, creditAccount, savingsId, transactionId, transactionDate, amount);
|
||||
}
|
||||
|
||||
public void createDebitJournalEntryOrReversalForLoan(final Office office, final String currencyCode, final int accountMappingTypeId,
|
||||
final Long loanProductId, final Long paymentTypeId, final Long loanId, final String transactionId, final Date transactionDate,
|
||||
final BigDecimal amount, final Boolean isReversal) {
|
||||
final Long loanProductId, final Long paymentTypeId, final Long loanId, final String transactionId,
|
||||
final LocalDate transactionDate, final BigDecimal amount, final Boolean isReversal) {
|
||||
final GLAccount account = getLinkedGLAccountForLoanProduct(loanProductId, accountMappingTypeId, paymentTypeId);
|
||||
if (isReversal) {
|
||||
createCreditJournalEntryForLoan(office, currencyCode, account, loanId, transactionId, transactionDate, amount);
|
||||
@@ -669,7 +667,7 @@ public class AccountingProcessorHelper {
|
||||
|
||||
public void createCreditJournalEntryOrReversalForLoanCharges(final Office office, final String currencyCode,
|
||||
final int accountMappingTypeId, final Long loanProductId, final Long loanId, final String transactionId,
|
||||
final Date transactionDate, final BigDecimal totalAmount, final Boolean isReversal,
|
||||
final LocalDate transactionDate, final BigDecimal totalAmount, final Boolean isReversal,
|
||||
final List<ChargePaymentDTO> chargePaymentDTOs) {
|
||||
/***
|
||||
* Map to track each account and the net credit to be made for a particular account
|
||||
@@ -744,7 +742,7 @@ public class AccountingProcessorHelper {
|
||||
public void createCashBasedJournalEntriesAndReversalsForSavingsCharges(final Office office, final String currencyCode,
|
||||
final CashAccountsForSavings accountTypeToBeDebited, CashAccountsForSavings accountTypeToBeCredited,
|
||||
final Long savingsProductId, final Long paymentTypeId, final Long loanId, final String transactionId,
|
||||
final Date transactionDate, final BigDecimal totalAmount, final Boolean isReversal,
|
||||
final LocalDate transactionDate, final BigDecimal totalAmount, final Boolean isReversal,
|
||||
final List<ChargePaymentDTO> chargePaymentDTOs) {
|
||||
// TODO Vishwas: Remove this validation, as and when appropriate Junit
|
||||
// tests are written for accounting
|
||||
@@ -785,15 +783,15 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
|
||||
private void createCreditJournalEntryOrReversalForLoan(final Office office, final String currencyCode, final int accountMappingTypeId,
|
||||
final Long loanProductId, final Long paymentTypeId, final Long loanId, final String transactionId, final Date transactionDate,
|
||||
final BigDecimal amount, final Boolean isReversal) {
|
||||
final Long loanProductId, final Long paymentTypeId, final Long loanId, final String transactionId,
|
||||
final LocalDate transactionDate, final BigDecimal amount, final Boolean isReversal) {
|
||||
final GLAccount account = getLinkedGLAccountForLoanProduct(loanProductId, accountMappingTypeId, paymentTypeId);
|
||||
createCreditJournalEntryOrReversalForLoan(office, currencyCode, loanId, transactionId, transactionDate, amount, isReversal,
|
||||
account);
|
||||
}
|
||||
|
||||
public void createCreditJournalEntryOrReversalForLoan(final Office office, final String currencyCode, final Long loanId,
|
||||
final String transactionId, final Date transactionDate, final BigDecimal amount, final Boolean isReversal,
|
||||
final String transactionId, final LocalDate transactionDate, final BigDecimal amount, final Boolean isReversal,
|
||||
final GLAccount account) {
|
||||
if (isReversal) {
|
||||
createDebitJournalEntryForLoan(office, currencyCode, account, loanId, transactionId, transactionDate, amount);
|
||||
@@ -803,7 +801,7 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
|
||||
private void createCreditJournalEntryForClientPayments(final Office office, final String currencyCode, final GLAccount account,
|
||||
final Long clientId, final Long transactionId, final Date transactionDate, final BigDecimal amount) {
|
||||
final Long clientId, final Long transactionId, final LocalDate transactionDate, final BigDecimal amount) {
|
||||
final boolean manualEntry = false;
|
||||
LoanTransaction loanTransaction = null;
|
||||
SavingsAccountTransaction savingsAccountTransaction = null;
|
||||
@@ -822,7 +820,7 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
|
||||
private void createCreditJournalEntryForSavings(final Office office, final String currencyCode, final GLAccount account,
|
||||
final Long savingsId, final String transactionId, final Date transactionDate, final BigDecimal amount)
|
||||
final Long savingsId, final String transactionId, final LocalDate transactionDate, final BigDecimal amount)
|
||||
throws DataAccessException {
|
||||
final boolean manualEntry = false;
|
||||
LoanTransaction loanTransaction = null;
|
||||
@@ -844,7 +842,7 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
|
||||
private void createCreditJournalEntryForLoan(final Office office, final String currencyCode, final GLAccount account, final Long loanId,
|
||||
final String transactionId, final Date transactionDate, final BigDecimal amount) {
|
||||
final String transactionId, final LocalDate transactionDate, final BigDecimal amount) {
|
||||
final boolean manualEntry = false;
|
||||
LoanTransaction loanTransaction = null;
|
||||
SavingsAccountTransaction savingsAccountTransaction = null;
|
||||
@@ -863,7 +861,7 @@ public class AccountingProcessorHelper {
|
||||
this.glJournalEntryRepository.saveAndFlush(journalEntry);
|
||||
}
|
||||
|
||||
public void createProvisioningDebitJournalEntry(Date transactionDate, Long provisioningentryId, Office office, String currencyCode,
|
||||
public void createProvisioningDebitJournalEntry(LocalDate transactionDate, Long provisioningentryId, Office office, String currencyCode,
|
||||
GLAccount account, BigDecimal amount) {
|
||||
LoanTransaction loanTransaction = null;
|
||||
SavingsAccountTransaction savingsAccountTransaction = null;
|
||||
@@ -878,8 +876,8 @@ public class AccountingProcessorHelper {
|
||||
this.glJournalEntryRepository.saveAndFlush(journalEntry);
|
||||
}
|
||||
|
||||
public void createProvisioningCreditJournalEntry(Date transactionDate, Long provisioningentryId, Office office, String currencyCode,
|
||||
GLAccount account, BigDecimal amount) {
|
||||
public void createProvisioningCreditJournalEntry(LocalDate transactionDate, Long provisioningentryId, Office office,
|
||||
String currencyCode, GLAccount account, BigDecimal amount) {
|
||||
LoanTransaction loanTransaction = null;
|
||||
SavingsAccountTransaction savingsAccountTransaction = null;
|
||||
ClientTransaction clientTransaction = null;
|
||||
@@ -894,7 +892,7 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
|
||||
private void createDebitJournalEntryForLoan(final Office office, final String currencyCode, final GLAccount account, final Long loanId,
|
||||
final String transactionId, final Date transactionDate, final BigDecimal amount) {
|
||||
final String transactionId, final LocalDate transactionDate, final BigDecimal amount) {
|
||||
final boolean manualEntry = false;
|
||||
LoanTransaction loanTransaction = null;
|
||||
SavingsAccountTransaction savingsAccountTransaction = null;
|
||||
@@ -914,7 +912,7 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
|
||||
private void createDebitJournalEntryForSavings(final Office office, final String currencyCode, final GLAccount account,
|
||||
final Long savingsId, final String transactionId, final Date transactionDate, final BigDecimal amount) {
|
||||
final Long savingsId, final String transactionId, final LocalDate transactionDate, final BigDecimal amount) {
|
||||
final boolean manualEntry = false;
|
||||
LoanTransaction loanTransaction = null;
|
||||
SavingsAccountTransaction savingsAccountTransaction = null;
|
||||
@@ -935,7 +933,7 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
|
||||
private void createDebitJournalEntryForClientPayments(final Office office, final String currencyCode, final GLAccount account,
|
||||
final Long clientId, final Long transactionId, final Date transactionDate, final BigDecimal amount) {
|
||||
final Long clientId, final Long transactionId, final LocalDate transactionDate, final BigDecimal amount) {
|
||||
final boolean manualEntry = false;
|
||||
ClientTransaction clientTransaction = null;
|
||||
LoanTransaction loanTransaction = null;
|
||||
@@ -955,7 +953,7 @@ public class AccountingProcessorHelper {
|
||||
|
||||
public void createJournalEntriesForShares(final Office office, final String currencyCode, final int accountTypeToDebitId,
|
||||
final int accountTypeToCreditId, final Long shareProductId, final Long paymentTypeId, final Long shareAccountId,
|
||||
final String transactionId, final Date transactionDate, final BigDecimal amount) {
|
||||
final String transactionId, final LocalDate transactionDate, final BigDecimal amount) {
|
||||
createDebitJournalEntryForShares(office, currencyCode, accountTypeToDebitId, shareProductId, paymentTypeId, shareAccountId,
|
||||
transactionId, transactionDate, amount);
|
||||
createCreditJournalEntryForShares(office, currencyCode, accountTypeToCreditId, shareProductId, paymentTypeId, shareAccountId,
|
||||
@@ -964,14 +962,14 @@ public class AccountingProcessorHelper {
|
||||
|
||||
public void createDebitJournalEntryForShares(final Office office, final String currencyCode, final int accountTypeToDebitId,
|
||||
final Long shareProductId, final Long paymentTypeId, final Long shareAccountId, final String transactionId,
|
||||
final Date transactionDate, final BigDecimal amount) {
|
||||
final LocalDate transactionDate, final BigDecimal amount) {
|
||||
final GLAccount debitAccount = getLinkedGLAccountForShareProduct(shareProductId, accountTypeToDebitId, paymentTypeId);
|
||||
createDebitJournalEntryForShares(office, currencyCode, debitAccount, shareAccountId, transactionId, transactionDate, amount);
|
||||
}
|
||||
|
||||
public void createCreditJournalEntryForShares(final Office office, final String currencyCode, final int accountTypeToCreditId,
|
||||
final Long shareProductId, final Long paymentTypeId, final Long shareAccountId, final String transactionId,
|
||||
final Date transactionDate, final BigDecimal amount) {
|
||||
final LocalDate transactionDate, final BigDecimal amount) {
|
||||
final GLAccount creditAccount = getLinkedGLAccountForShareProduct(shareProductId, accountTypeToCreditId, paymentTypeId);
|
||||
createCreditJournalEntryForShares(office, currencyCode, creditAccount, shareAccountId, transactionId, transactionDate, amount);
|
||||
}
|
||||
@@ -979,7 +977,7 @@ public class AccountingProcessorHelper {
|
||||
public void createCashBasedJournalEntriesForSharesCharges(final Office office, final String currencyCode,
|
||||
final CashAccountsForShares accountTypeToBeDebited, final CashAccountsForShares accountTypeToBeCredited,
|
||||
final Long shareProductId, final Long paymentTypeId, final Long shareAccountId, final String transactionId,
|
||||
final Date transactionDate, final BigDecimal totalAmount, final List<ChargePaymentDTO> chargePaymentDTOs) {
|
||||
final LocalDate transactionDate, final BigDecimal totalAmount, final List<ChargePaymentDTO> chargePaymentDTOs) {
|
||||
|
||||
createDebitJournalEntryForShares(office, currencyCode, accountTypeToBeDebited.getValue(), shareProductId, paymentTypeId,
|
||||
shareAccountId, transactionId, transactionDate, totalAmount);
|
||||
@@ -989,7 +987,7 @@ public class AccountingProcessorHelper {
|
||||
|
||||
public void createCashBasedJournalEntryForSharesCharges(final Office office, final String currencyCode,
|
||||
final CashAccountsForShares accountTypeToBeCredited, final Long shareProductId, final Long shareAccountId,
|
||||
final String transactionId, final Date transactionDate, final BigDecimal totalAmount,
|
||||
final String transactionId, final LocalDate transactionDate, final BigDecimal totalAmount,
|
||||
final List<ChargePaymentDTO> chargePaymentDTOs) {
|
||||
final Map<GLAccount, BigDecimal> creditDetailsMap = new LinkedHashMap<>();
|
||||
for (final ChargePaymentDTO chargePaymentDTO : chargePaymentDTOs) {
|
||||
@@ -1021,7 +1019,7 @@ public class AccountingProcessorHelper {
|
||||
|
||||
public void revertCashBasedJournalEntryForSharesCharges(final Office office, final String currencyCode,
|
||||
final CashAccountsForShares accountTypeToBeCredited, final Long shareProductId, final Long shareAccountId,
|
||||
final String transactionId, final Date transactionDate, final BigDecimal totalAmount,
|
||||
final String transactionId, final LocalDate transactionDate, final BigDecimal totalAmount,
|
||||
final List<ChargePaymentDTO> chargePaymentDTOs) {
|
||||
final Map<GLAccount, BigDecimal> creditDetailsMap = new LinkedHashMap<>();
|
||||
for (final ChargePaymentDTO chargePaymentDTO : chargePaymentDTOs) {
|
||||
@@ -1052,7 +1050,7 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
|
||||
private void createDebitJournalEntryForShares(final Office office, final String currencyCode, final GLAccount account,
|
||||
final Long shareAccountId, final String transactionId, final Date transactionDate, final BigDecimal amount) {
|
||||
final Long shareAccountId, final String transactionId, final LocalDate transactionDate, final BigDecimal amount) {
|
||||
final boolean manualEntry = false;
|
||||
LoanTransaction loanTransaction = null;
|
||||
SavingsAccountTransaction savingsAccountTransaction = null;
|
||||
@@ -1071,7 +1069,7 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
|
||||
private void createCreditJournalEntryForShares(final Office office, final String currencyCode, final GLAccount account,
|
||||
final Long shareAccountId, final String transactionId, final Date transactionDate, final BigDecimal amount) {
|
||||
final Long shareAccountId, final String transactionId, final LocalDate transactionDate, final BigDecimal amount) {
|
||||
final boolean manualEntry = false;
|
||||
LoanTransaction loanTransaction = null;
|
||||
SavingsAccountTransaction savingsAccountTransaction = null;
|
||||
@@ -1253,7 +1251,7 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
|
||||
public BigDecimal createCreditJournalEntryOrReversalForClientPayments(final Office office, final String currencyCode,
|
||||
final Long clientId, final Long transactionId, final Date transactionDate, final Boolean isReversal,
|
||||
final Long clientId, final Long transactionId, final LocalDate transactionDate, final Boolean isReversal,
|
||||
final List<ClientChargePaymentDTO> clientChargePaymentDTOs) {
|
||||
/***
|
||||
* Map to track each account affected and the net credit to be made for a particular account
|
||||
@@ -1289,7 +1287,8 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
|
||||
public void createDebitJournalEntryOrReversalForClientChargePayments(final Office office, final String currencyCode,
|
||||
final Long clientId, final Long transactionId, final Date transactionDate, final BigDecimal amount, final Boolean isReversal) {
|
||||
final Long clientId, final Long transactionId, final LocalDate transactionDate, final BigDecimal amount,
|
||||
final Boolean isReversal) {
|
||||
final GLAccount account = financialActivityAccountRepository
|
||||
.findByFinancialActivityTypeWithNotFoundDetection(FinancialActivity.ASSET_FUND_SOURCE.getValue()).getGlAccount();
|
||||
if (isReversal) {
|
||||
|
||||
+9
-9
@@ -19,8 +19,8 @@
|
||||
package org.apache.fineract.accounting.journalentry.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -47,7 +47,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
final GLClosure latestGLClosure = this.helper.getLatestClosureByBranch(loanDTO.getOfficeId());
|
||||
final Office office = this.helper.getOfficeById(loanDTO.getOfficeId());
|
||||
for (final LoanTransactionDTO loanTransactionDTO : loanDTO.getNewLoanTransactions()) {
|
||||
final Date transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final LocalDate transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
this.helper.checkForBranchClosures(latestGLClosure, transactionDate);
|
||||
|
||||
/** Handle Disbursements **/
|
||||
@@ -116,7 +116,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
|
||||
// transaction properties
|
||||
final String transactionId = loanTransactionDTO.getTransactionId();
|
||||
final Date transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final LocalDate transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final BigDecimal disbursalAmount = loanTransactionDTO.getAmount();
|
||||
final boolean isReversed = loanTransactionDTO.isReversed();
|
||||
final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId();
|
||||
@@ -181,7 +181,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
|
||||
// transaction properties
|
||||
final String transactionId = loanTransactionDTO.getTransactionId();
|
||||
final Date transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final LocalDate transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final BigDecimal principalAmount = loanTransactionDTO.getPrincipal();
|
||||
final BigDecimal interestAmount = loanTransactionDTO.getInterest();
|
||||
final BigDecimal feesAmount = loanTransactionDTO.getFees();
|
||||
@@ -323,7 +323,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
|
||||
// transaction properties
|
||||
final String transactionId = loanTransactionDTO.getTransactionId();
|
||||
final Date transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final LocalDate transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final BigDecimal amount = loanTransactionDTO.getAmount();
|
||||
final boolean isReversal = loanTransactionDTO.isReversed();
|
||||
final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId();
|
||||
@@ -357,7 +357,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
|
||||
// transaction properties
|
||||
final String transactionId = loanTransactionDTO.getTransactionId();
|
||||
final Date transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final LocalDate transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final BigDecimal interestAmount = loanTransactionDTO.getInterest();
|
||||
final BigDecimal feesAmount = loanTransactionDTO.getFees();
|
||||
final BigDecimal penaltiesAmount = loanTransactionDTO.getPenalties();
|
||||
@@ -394,7 +394,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
|
||||
// transaction properties
|
||||
final String transactionId = loanTransactionDTO.getTransactionId();
|
||||
final Date transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final LocalDate transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final BigDecimal refundAmount = loanTransactionDTO.getAmount();
|
||||
final boolean isReversal = loanTransactionDTO.isReversed();
|
||||
final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId();
|
||||
@@ -419,7 +419,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
|
||||
// transaction properties
|
||||
final String transactionId = loanTransactionDTO.getTransactionId();
|
||||
final Date transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final LocalDate transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final BigDecimal refundAmount = loanTransactionDTO.getAmount();
|
||||
final boolean isReversal = loanTransactionDTO.isReversed();
|
||||
final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId();
|
||||
@@ -438,7 +438,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
|
||||
// transaction properties
|
||||
final String transactionId = loanTransactionDTO.getTransactionId();
|
||||
final Date transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final LocalDate transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final BigDecimal principalAmount = loanTransactionDTO.getPrincipal();
|
||||
final BigDecimal interestAmount = loanTransactionDTO.getInterest();
|
||||
final BigDecimal feesAmount = loanTransactionDTO.getFees();
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@
|
||||
package org.apache.fineract.accounting.journalentry.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.closure.domain.GLClosure;
|
||||
import org.apache.fineract.accounting.journalentry.data.ClientTransactionDTO;
|
||||
@@ -36,7 +36,7 @@ public class CashBasedAccountingProcessorForClientTransactions implements Accoun
|
||||
public void createJournalEntriesForClientTransaction(ClientTransactionDTO clientTransactionDTO) {
|
||||
if (clientTransactionDTO.isAccountingEnabled()) {
|
||||
final GLClosure latestGLClosure = this.helper.getLatestClosureByBranch(clientTransactionDTO.getOfficeId());
|
||||
final Date transactionDate = clientTransactionDTO.getTransactionDate();
|
||||
final LocalDate transactionDate = clientTransactionDTO.getTransactionDate();
|
||||
final Office office = this.helper.getOfficeById(clientTransactionDTO.getOfficeId());
|
||||
this.helper.checkForBranchClosures(latestGLClosure, transactionDate);
|
||||
|
||||
@@ -60,7 +60,7 @@ public class CashBasedAccountingProcessorForClientTransactions implements Accoun
|
||||
// transaction properties
|
||||
final String currencyCode = clientTransactionDTO.getCurrencyCode();
|
||||
final Long transactionId = clientTransactionDTO.getTransactionId();
|
||||
final Date transactionDate = clientTransactionDTO.getTransactionDate();
|
||||
final LocalDate transactionDate = clientTransactionDTO.getTransactionDate();
|
||||
final BigDecimal amount = clientTransactionDTO.getAmount();
|
||||
final boolean isReversal = clientTransactionDTO.isReversed();
|
||||
|
||||
|
||||
+9
-9
@@ -19,8 +19,8 @@
|
||||
package org.apache.fineract.accounting.journalentry.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.closure.domain.GLClosure;
|
||||
@@ -46,7 +46,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
final Long loanProductId = loanDTO.getLoanProductId();
|
||||
final String currencyCode = loanDTO.getCurrencyCode();
|
||||
for (final LoanTransactionDTO loanTransactionDTO : loanDTO.getNewLoanTransactions()) {
|
||||
final Date transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final LocalDate transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final String transactionId = loanTransactionDTO.getTransactionId();
|
||||
final Office office = this.helper.getOfficeById(loanTransactionDTO.getOfficeId());
|
||||
final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId();
|
||||
@@ -126,7 +126,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
|
||||
// transaction properties
|
||||
final String transactionId = loanTransactionDTO.getTransactionId();
|
||||
final Date transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final LocalDate transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final BigDecimal disbursalAmount = loanTransactionDTO.getAmount();
|
||||
final boolean isReversal = loanTransactionDTO.isReversed();
|
||||
final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId();
|
||||
@@ -164,7 +164,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
|
||||
// transaction properties
|
||||
final String transactionId = loanTransactionDTO.getTransactionId();
|
||||
final Date transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final LocalDate transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final BigDecimal refundAmount = loanTransactionDTO.getAmount();
|
||||
final boolean isReversal = loanTransactionDTO.isReversed();
|
||||
final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId();
|
||||
@@ -196,7 +196,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
|
||||
// transaction properties
|
||||
final String transactionId = loanTransactionDTO.getTransactionId();
|
||||
final Date transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final LocalDate transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final BigDecimal principalAmount = loanTransactionDTO.getPrincipal();
|
||||
final BigDecimal interestAmount = loanTransactionDTO.getInterest();
|
||||
final BigDecimal feesAmount = loanTransactionDTO.getFees();
|
||||
@@ -272,7 +272,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
|
||||
// transaction properties
|
||||
final String transactionId = loanTransactionDTO.getTransactionId();
|
||||
final Date transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final LocalDate transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final BigDecimal amount = loanTransactionDTO.getAmount();
|
||||
final boolean isReversal = loanTransactionDTO.isReversed();
|
||||
final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId();
|
||||
@@ -302,7 +302,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
|
||||
// transaction properties
|
||||
final String transactionId = loanTransactionDTO.getTransactionId();
|
||||
final Date transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final LocalDate transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final BigDecimal principalAmount = loanTransactionDTO.getPrincipal();
|
||||
final boolean isReversal = loanTransactionDTO.isReversed();
|
||||
// final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId();
|
||||
@@ -328,7 +328,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
|
||||
// transaction properties
|
||||
final String transactionId = loanTransactionDTO.getTransactionId();
|
||||
final Date transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final LocalDate transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final BigDecimal refundAmount = loanTransactionDTO.getAmount();
|
||||
final boolean isReversal = loanTransactionDTO.isReversed();
|
||||
final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId();
|
||||
@@ -346,7 +346,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
|
||||
// transaction properties
|
||||
final String transactionId = loanTransactionDTO.getTransactionId();
|
||||
final Date transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final LocalDate transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final BigDecimal principalAmount = loanTransactionDTO.getPrincipal();
|
||||
final BigDecimal interestAmount = loanTransactionDTO.getInterest();
|
||||
final BigDecimal feesAmount = loanTransactionDTO.getFees();
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@
|
||||
package org.apache.fineract.accounting.journalentry.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.closure.domain.GLClosure;
|
||||
@@ -44,7 +44,7 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
||||
final Long savingsId = savingsDTO.getSavingsId();
|
||||
final String currencyCode = savingsDTO.getCurrencyCode();
|
||||
for (final SavingsTransactionDTO savingsTransactionDTO : savingsDTO.getNewSavingsTransactions()) {
|
||||
final Date transactionDate = savingsTransactionDTO.getTransactionDate();
|
||||
final LocalDate transactionDate = savingsTransactionDTO.getTransactionDate();
|
||||
final String transactionId = savingsTransactionDTO.getTransactionId();
|
||||
final Office office = this.helper.getOfficeById(savingsTransactionDTO.getOfficeId());
|
||||
final Long paymentTypeId = savingsTransactionDTO.getPaymentTypeId();
|
||||
|
||||
+5
-5
@@ -19,7 +19,7 @@
|
||||
package org.apache.fineract.accounting.journalentry.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.closure.domain.GLClosure;
|
||||
@@ -43,7 +43,7 @@ public class CashBasedAccountingProcessorForShares implements AccountingProcesso
|
||||
final Long shareProductId = sharesDTO.getShareProductId();
|
||||
final String currencyCode = sharesDTO.getCurrencyCode();
|
||||
for (SharesTransactionDTO transactionDTO : sharesDTO.getNewTransactions()) {
|
||||
final Date transactionDate = transactionDTO.getTransactionDate();
|
||||
final LocalDate transactionDate = transactionDTO.getTransactionDate();
|
||||
final String transactionId = transactionDTO.getTransactionId();
|
||||
final Office office = this.helper.getOfficeById(transactionDTO.getOfficeId());
|
||||
final Long paymentTypeId = transactionDTO.getPaymentTypeId();
|
||||
@@ -70,8 +70,8 @@ public class CashBasedAccountingProcessorForShares implements AccountingProcesso
|
||||
}
|
||||
|
||||
public void createJournalEntriesForRedeem(final Long shareAccountId, final Long shareProductId, final String currencyCode,
|
||||
final Date transactionDate, final String transactionId, final Office office, final Long paymentTypeId, final BigDecimal amount,
|
||||
final BigDecimal chargeAmount, final List<ChargePaymentDTO> feePayments) {
|
||||
final LocalDate transactionDate, final String transactionId, final Office office, final Long paymentTypeId,
|
||||
final BigDecimal amount, final BigDecimal chargeAmount, final List<ChargePaymentDTO> feePayments) {
|
||||
if (chargeAmount == null || chargeAmount.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
this.helper.createJournalEntriesForShares(office, currencyCode, CashAccountsForShares.SHARES_EQUITY.getValue(),
|
||||
CashAccountsForShares.SHARES_REFERENCE.getValue(), shareProductId, paymentTypeId, shareAccountId, transactionId,
|
||||
@@ -87,7 +87,7 @@ public class CashBasedAccountingProcessorForShares implements AccountingProcesso
|
||||
}
|
||||
|
||||
public void createJournalEntriesForPurchase(final Long shareAccountId, final Long shareProductId, final String currencyCode,
|
||||
SharesTransactionDTO transactionDTO, final Date transactionDate, final String transactionId, final Office office,
|
||||
SharesTransactionDTO transactionDTO, final LocalDate transactionDate, final String transactionId, final Office office,
|
||||
final Long paymentTypeId, final BigDecimal amount, final BigDecimal chargeAmount, final List<ChargePaymentDTO> feePayments) {
|
||||
if (transactionDTO.getTransactionStatus().isApplied()) {
|
||||
if (chargeAmount == null || chargeAmount.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
|
||||
+3
-3
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.journalentry.service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import org.apache.fineract.accounting.journalentry.data.JournalEntryAssociationParametersData;
|
||||
import org.apache.fineract.accounting.journalentry.data.JournalEntryData;
|
||||
import org.apache.fineract.accounting.journalentry.data.OfficeOpeningBalancesData;
|
||||
@@ -29,8 +29,8 @@ public interface JournalEntryReadPlatformService {
|
||||
|
||||
JournalEntryData retrieveGLJournalEntryById(long glJournalEntryId, JournalEntryAssociationParametersData associationParametersData);
|
||||
|
||||
Page<JournalEntryData> retrieveAll(SearchParameters searchParameters, Long glAccountId, Boolean onlyManualEntries, Date fromDate,
|
||||
Date toDate, String transactionId, Integer entityType, JournalEntryAssociationParametersData associationParametersData);
|
||||
Page<JournalEntryData> retrieveAll(SearchParameters searchParameters, Long glAccountId, Boolean onlyManualEntries, LocalDate fromDate,
|
||||
LocalDate toDate, String transactionId, Integer entityType, JournalEntryAssociationParametersData associationParametersData);
|
||||
|
||||
OfficeOpeningBalancesData retrieveOfficeOpeningBalances(Long officeId, String currencyCode);
|
||||
|
||||
|
||||
+7
-8
@@ -21,12 +21,11 @@ package org.apache.fineract.accounting.journalentry.service;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeFormatterBuilder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -235,8 +234,8 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
||||
|
||||
@Override
|
||||
public Page<JournalEntryData> retrieveAll(final SearchParameters searchParameters, final Long glAccountId,
|
||||
final Boolean onlyManualEntries, final Date fromDate, final Date toDate, final String transactionId, final Integer entityType,
|
||||
final JournalEntryAssociationParametersData associationParametersData) {
|
||||
final Boolean onlyManualEntries, final LocalDate fromDate, final LocalDate toDate, final String transactionId,
|
||||
final Integer entityType, final JournalEntryAssociationParametersData associationParametersData) {
|
||||
|
||||
GLJournalEntryMapper rm = new GLJournalEntryMapper(associationParametersData);
|
||||
final StringBuilder sqlBuilder = new StringBuilder(200);
|
||||
@@ -290,7 +289,7 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
||||
}
|
||||
|
||||
if (fromDate != null || toDate != null) {
|
||||
final DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
final DateTimeFormatter df = new DateTimeFormatterBuilder().appendPattern("yyyy-MM-dd").toFormatter();
|
||||
String fromDateString = null;
|
||||
String toDateString = null;
|
||||
if (fromDate != null && toDate != null) {
|
||||
@@ -492,8 +491,8 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
||||
final String sortOrder = "ASC";
|
||||
final Integer entityType = null;
|
||||
final Boolean onlyManualEntries = null;
|
||||
final Date fromDate = null;
|
||||
final Date toDate = null;
|
||||
final LocalDate fromDate = null;
|
||||
final LocalDate toDate = null;
|
||||
final JournalEntryAssociationParametersData associationParametersData = null;
|
||||
final Long loanId = null;
|
||||
final Long savingsId = null;
|
||||
|
||||
+10
-12
@@ -21,8 +21,8 @@ package org.apache.fineract.accounting.journalentry.service;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -71,7 +71,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
String dateFinder = "select MIN(je.entry_date) as entityDate from acc_gl_journal_entry je "
|
||||
+ "where je.is_running_balance_calculated=false ";
|
||||
try {
|
||||
Date entityDate = this.jdbcTemplate.queryForObject(dateFinder, Date.class);
|
||||
LocalDate entityDate = this.jdbcTemplate.queryForObject(dateFinder, LocalDate.class);
|
||||
updateOrganizationRunningBalance(entityDate);
|
||||
} catch (EmptyResultDataAccessException e) {
|
||||
log.debug("No results found for updation of running balance ");
|
||||
@@ -92,7 +92,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
String dateFinder = "select MIN(je.entry_date) as entityDate " + "from acc_gl_journal_entry je "
|
||||
+ "where je.is_running_balance_calculated=false and je.office_id=?";
|
||||
try {
|
||||
Date entityDate = this.jdbcTemplate.queryForObject(dateFinder, Date.class, officeId);
|
||||
LocalDate entityDate = this.jdbcTemplate.queryForObject(dateFinder, LocalDate.class, officeId);
|
||||
updateRunningBalance(officeId, entityDate);
|
||||
} catch (EmptyResultDataAccessException e) {
|
||||
log.debug("No results found for updation of office running balance with office id: {}", officeId);
|
||||
@@ -102,7 +102,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
return commandProcessingResultBuilder.build();
|
||||
}
|
||||
|
||||
private void updateOrganizationRunningBalance(Date entityDate) {
|
||||
private void updateOrganizationRunningBalance(LocalDate entityDate) {
|
||||
Map<Long, BigDecimal> runningBalanceMap = new HashMap<>(5);
|
||||
Map<Long, Map<Long, BigDecimal>> officesRunningBalance = new HashMap<>();
|
||||
|
||||
@@ -112,7 +112,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
+ "group by je.id order by je.entry_date DESC " + sqlGenerator.limit(10000, 0);
|
||||
|
||||
List<Map<String, Object>> list = jdbcTemplate.queryForList(organizationRunningBalanceQuery, // NOSONAR
|
||||
new Object[] { entityDate, entityDate });
|
||||
entityDate, entityDate);
|
||||
|
||||
for (Map<String, Object> entries : list) {
|
||||
Long accountId = Long.parseLong(entries.get("accountId").toString()); // Drizzle
|
||||
@@ -137,7 +137,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
+ "group by je.id order by je.entry_date DESC " + sqlGenerator.limit(10000, 0);
|
||||
|
||||
List<Map<String, Object>> officesRunningBalanceList = jdbcTemplate.queryForList(offlineRunningBalanceQuery, // NOSONAR
|
||||
new Object[] { entityDate, entityDate });
|
||||
entityDate, entityDate);
|
||||
for (Map<String, Object> entries : officesRunningBalanceList) {
|
||||
Long accountId = Long.parseLong(entries.get("accountId").toString());
|
||||
Long officeId = Long.parseLong(entries.get("officeId").toString());
|
||||
@@ -153,8 +153,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
}
|
||||
}
|
||||
|
||||
List<JournalEntryData> entryDatas = jdbcTemplate.query(entryMapper.organizationRunningBalanceSchema(), entryMapper,
|
||||
new Object[] { entityDate });
|
||||
List<JournalEntryData> entryDatas = jdbcTemplate.query(entryMapper.organizationRunningBalanceSchema(), entryMapper, entityDate);
|
||||
if (entryDatas.size() > 0) {
|
||||
// run a batch update of 1000 SQL statements at a time
|
||||
final Integer batchUpdateSize = 1000;
|
||||
@@ -189,7 +188,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
|
||||
}
|
||||
|
||||
private void updateRunningBalance(Long officeId, Date entityDate) {
|
||||
private void updateRunningBalance(Long officeId, LocalDate entityDate) {
|
||||
Map<Long, BigDecimal> runningBalanceMap = new HashMap<>(5);
|
||||
|
||||
final String offlineRunningBalanceQuery = "select je.office_running_balance as runningBalance,je.account_id as accountId from acc_gl_journal_entry je "
|
||||
@@ -198,15 +197,14 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
+ "group by je.id order by je.entry_date DESC " + sqlGenerator.limit(10000, 0);
|
||||
|
||||
List<Map<String, Object>> list = jdbcTemplate.queryForList(offlineRunningBalanceQuery, // NOSONAR
|
||||
new Object[] { officeId, entityDate, officeId, entityDate });
|
||||
officeId, entityDate, officeId, entityDate);
|
||||
for (Map<String, Object> entries : list) {
|
||||
Long accountId = (Long) entries.get("accountId");
|
||||
if (!runningBalanceMap.containsKey(accountId)) {
|
||||
runningBalanceMap.put(accountId, (BigDecimal) entries.get("runningBalance"));
|
||||
}
|
||||
}
|
||||
List<JournalEntryData> entryDatas = jdbcTemplate.query(entryMapper.officeRunningBalanceSchema(), entryMapper,
|
||||
new Object[] { officeId, entityDate });
|
||||
List<JournalEntryData> entryDatas = jdbcTemplate.query(entryMapper.officeRunningBalanceSchema(), entryMapper, officeId, entityDate);
|
||||
String[] updateSql = new String[entryDatas.size()];
|
||||
int i = 0;
|
||||
for (JournalEntryData entryData : entryDatas) {
|
||||
|
||||
+3
-3
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.journalentry.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.accounting.provisioning.domain.ProvisioningEntry;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
@@ -39,12 +39,12 @@ public interface JournalEntryWritePlatformService {
|
||||
|
||||
CommandProcessingResult defineOpeningBalance(JsonCommand command);
|
||||
|
||||
String revertProvisioningJournalEntries(Date reversalTransactionDate, Long entityId, Integer entityType);
|
||||
String revertProvisioningJournalEntries(LocalDate reversalTransactionDate, Long entityId, Integer entityType);
|
||||
|
||||
String createProvisioningJournalEntries(ProvisioningEntry entry);
|
||||
|
||||
void createJournalEntriesForShares(Map<String, Object> accountingBridgeData);
|
||||
|
||||
void revertShareAccountJournalEntries(ArrayList<Long> transactionId, Date transactionDate);
|
||||
void revertShareAccountJournalEntries(ArrayList<Long> transactionId, LocalDate transactionDate);
|
||||
|
||||
}
|
||||
|
||||
+21
-20
@@ -20,10 +20,8 @@ package org.apache.fineract.accounting.journalentry.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -130,7 +128,8 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
final PaymentDetail paymentDetail = this.paymentDetailWritePlatformService.createAndPersistPaymentDetail(command, changes);
|
||||
|
||||
/** Set a transaction Id and save these Journal entries **/
|
||||
final Date transactionDate = command.dateValueOfParameterNamed(JournalEntryJsonInputParams.TRANSACTION_DATE.getValue());
|
||||
final LocalDate transactionDate = command
|
||||
.localDateValueOfParameterNamed(JournalEntryJsonInputParams.TRANSACTION_DATE.getValue());
|
||||
final String transactionId = generateTransactionId(officeId);
|
||||
final String referenceNumber = command.stringValueOfParameterNamed(JournalEntryJsonInputParams.REFERENCE_NUMBER.getValue());
|
||||
|
||||
@@ -315,10 +314,10 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
|
||||
// Before reversal validate accounting closure is done for that branch
|
||||
// or not.
|
||||
final Date journalEntriesTransactionDate = journalEntries.get(0).getTransactionDate();
|
||||
final LocalDate journalEntriesTransactionDate = journalEntries.get(0).getTransactionDate();
|
||||
final GLClosure latestGLClosureByBranch = this.glClosureRepository.getLatestGLClosureByBranch(officeId);
|
||||
if (latestGLClosureByBranch != null) {
|
||||
if (latestGLClosureByBranch.getClosingDate().after(journalEntriesTransactionDate)
|
||||
if (latestGLClosureByBranch.getClosingDate().isAfter(journalEntriesTransactionDate)
|
||||
|| latestGLClosureByBranch.getClosingDate().compareTo(journalEntriesTransactionDate) == 0 ? Boolean.TRUE
|
||||
: Boolean.FALSE) {
|
||||
final String accountName = null;
|
||||
@@ -358,7 +357,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
}
|
||||
|
||||
@Override
|
||||
public String revertProvisioningJournalEntries(final Date reversalTransactionDate, final Long entityId, final Integer entityType) {
|
||||
public String revertProvisioningJournalEntries(final LocalDate reversalTransactionDate, final Long entityId, final Integer entityType) {
|
||||
List<JournalEntry> journalEntries = this.glJournalEntryRepository.findProvisioningJournalEntriesByEntityId(entityId, entityType);
|
||||
final String reversalTransactionId = journalEntries.get(0).getTransactionId();
|
||||
for (final JournalEntry journalEntry : journalEntries) {
|
||||
@@ -435,13 +434,13 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
expenseMap.put(entry.getExpenseAccount(), amount);
|
||||
}
|
||||
}
|
||||
createJournalEnry(provisioningEntry.getCreatedDate(), provisioningEntry.getId(), key.office, key.currency, liabilityMap,
|
||||
createJournalEntry(provisioningEntry.getCreatedDate(), provisioningEntry.getId(), key.office, key.currency, liabilityMap,
|
||||
expenseMap);
|
||||
}
|
||||
return "P" + provisioningEntry.getId();
|
||||
}
|
||||
|
||||
private void createJournalEnry(Date transactionDate, Long entryId, Office office, String currencyCode,
|
||||
private void createJournalEntry(LocalDate transactionDate, Long entryId, Office office, String currencyCode,
|
||||
Map<GLAccount, BigDecimal> liabilityMap, Map<GLAccount, BigDecimal> expenseMap) {
|
||||
Set<GLAccount> liabilityAccounts = liabilityMap.keySet();
|
||||
for (GLAccount account : liabilityAccounts) {
|
||||
@@ -519,7 +518,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
}
|
||||
|
||||
@Override
|
||||
public void revertShareAccountJournalEntries(final ArrayList<Long> transactionIds, final Date transactionDate) {
|
||||
public void revertShareAccountJournalEntries(final ArrayList<Long> transactionIds, final LocalDate transactionDate) {
|
||||
for (Long shareTransactionId : transactionIds) {
|
||||
String transactionId = AccountingProcessorHelper.SHARE_TRANSACTION_IDENTIFIER + shareTransactionId.longValue();
|
||||
List<JournalEntry> journalEntries = this.glJournalEntryRepository.findJournalEntries(transactionId,
|
||||
@@ -561,18 +560,17 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
private void validateBusinessRulesForJournalEntries(final JournalEntryCommand command) {
|
||||
/** check if date of Journal entry is valid ***/
|
||||
final LocalDate entryLocalDate = command.getTransactionDate();
|
||||
final Date transactionDate = Date.from(entryLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
final LocalDate transactionDate = entryLocalDate;
|
||||
// shouldn't be in the future
|
||||
final Date todaysDate = DateUtils.getBusinessDate();
|
||||
if (transactionDate.after(todaysDate)) {
|
||||
final LocalDate todaysDate = DateUtils.getBusinessLocalDate();
|
||||
if (transactionDate.isAfter(todaysDate)) {
|
||||
throw new JournalEntryInvalidException(GlJournalEntryInvalidReason.FUTURE_DATE, transactionDate, null, null);
|
||||
}
|
||||
// shouldn't be before an accounting closure
|
||||
final GLClosure latestGLClosure = this.glClosureRepository.getLatestGLClosureByBranch(command.getOfficeId());
|
||||
if (latestGLClosure != null) {
|
||||
if (latestGLClosure.getClosingDate().after(transactionDate) || latestGLClosure.getClosingDate().compareTo(transactionDate) == 0
|
||||
? Boolean.TRUE
|
||||
: Boolean.FALSE) {
|
||||
if (latestGLClosure.getClosingDate().isAfter(transactionDate)
|
||||
|| latestGLClosure.getClosingDate().compareTo(transactionDate) == 0 ? Boolean.TRUE : Boolean.FALSE) {
|
||||
throw new JournalEntryInvalidException(GlJournalEntryInvalidReason.ACCOUNTING_CLOSED, latestGLClosure.getClosingDate(),
|
||||
null, null);
|
||||
}
|
||||
@@ -591,8 +589,9 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
}
|
||||
|
||||
private void saveAllDebitOrCreditEntries(final JournalEntryCommand command, final Office office, final PaymentDetail paymentDetail,
|
||||
final String currencyCode, final Date transactionDate, final SingleDebitOrCreditEntryCommand[] singleDebitOrCreditEntryCommands,
|
||||
final String transactionId, final JournalEntryType type, final String referenceNumber) {
|
||||
final String currencyCode, final LocalDate transactionDate,
|
||||
final SingleDebitOrCreditEntryCommand[] singleDebitOrCreditEntryCommands, final String transactionId,
|
||||
final JournalEntryType type, final String referenceNumber) {
|
||||
final boolean manualEntry = true;
|
||||
for (final SingleDebitOrCreditEntryCommand singleDebitOrCreditEntryCommand : singleDebitOrCreditEntryCommands) {
|
||||
final GLAccount glAccount = this.glAccountRepository.findById(singleDebitOrCreditEntryCommand.getGlAccountId())
|
||||
@@ -673,7 +672,8 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
}
|
||||
|
||||
/** Set a transaction Id and save these Journal entries **/
|
||||
final Date transactionDate = command.dateValueOfParameterNamed(JournalEntryJsonInputParams.TRANSACTION_DATE.getValue());
|
||||
final LocalDate transactionDate = command
|
||||
.localDateValueOfParameterNamed(JournalEntryJsonInputParams.TRANSACTION_DATE.getValue());
|
||||
final String transactionId = generateTransactionId(officeId);
|
||||
|
||||
saveAllDebitOrCreditOpeningBalanceEntries(journalEntryCommand, office, currencyCode, transactionDate,
|
||||
@@ -691,8 +691,9 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
}
|
||||
|
||||
private void saveAllDebitOrCreditOpeningBalanceEntries(final JournalEntryCommand command, final Office office,
|
||||
final String currencyCode, final Date transactionDate, final SingleDebitOrCreditEntryCommand[] singleDebitOrCreditEntryCommands,
|
||||
final String transactionId, final JournalEntryType type, final Long contraAccountId) {
|
||||
final String currencyCode, final LocalDate transactionDate,
|
||||
final SingleDebitOrCreditEntryCommand[] singleDebitOrCreditEntryCommands, final String transactionId,
|
||||
final JournalEntryType type, final Long contraAccountId) {
|
||||
|
||||
final boolean manualEntry = true;
|
||||
final GLAccount contraAccount = this.glAccountRepository.findById(contraAccountId)
|
||||
|
||||
+5
-5
@@ -19,8 +19,8 @@
|
||||
package org.apache.fineract.accounting.provisioning.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class ProvisioningEntryData {
|
||||
@@ -33,7 +33,7 @@ public class ProvisioningEntryData {
|
||||
|
||||
private String createdUser;
|
||||
|
||||
Date createdDate;
|
||||
LocalDate createdDate;
|
||||
|
||||
Long modifiedById;
|
||||
|
||||
@@ -48,8 +48,8 @@ public class ProvisioningEntryData {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public ProvisioningEntryData(Long id, Boolean journalEntry, Long createdById, String createdUser, Date createdDate, Long modifiedById,
|
||||
String modifiedUser, BigDecimal totalReservedAmount) {
|
||||
public ProvisioningEntryData(Long id, Boolean journalEntry, Long createdById, String createdUser, LocalDate createdDate,
|
||||
Long modifiedById, String modifiedUser, BigDecimal totalReservedAmount) {
|
||||
this.id = id;
|
||||
this.journalEntry = journalEntry;
|
||||
this.createdById = createdById;
|
||||
@@ -68,7 +68,7 @@ public class ProvisioningEntryData {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public Date getCreatedDate() {
|
||||
public LocalDate getCreatedDate() {
|
||||
return this.createdDate;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-9
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.provisioning.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import javax.persistence.CascadeType;
|
||||
@@ -30,8 +30,6 @@ import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
|
||||
@@ -50,22 +48,20 @@ public class ProvisioningEntry extends AbstractPersistableCustom {
|
||||
private AppUser createdBy;
|
||||
|
||||
@Column(name = "created_date")
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date createdDate;
|
||||
private LocalDate createdDate;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "lastmodifiedby_id")
|
||||
private AppUser lastModifiedBy;
|
||||
|
||||
@Column(name = "lastmodified_date")
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date lastModifiedDate;
|
||||
private LocalDate lastModifiedDate;
|
||||
|
||||
protected ProvisioningEntry() {
|
||||
|
||||
}
|
||||
|
||||
public ProvisioningEntry(AppUser createdBy, Date createdDate, AppUser lastModifiedBy, Date lastModifiedDate,
|
||||
public ProvisioningEntry(AppUser createdBy, LocalDate createdDate, AppUser lastModifiedBy, LocalDate lastModifiedDate,
|
||||
Set<LoanProductProvisioningEntry> provisioningEntries) {
|
||||
this.provisioningEntries = provisioningEntries;
|
||||
this.createdBy = createdBy;
|
||||
@@ -89,7 +85,7 @@ public class ProvisioningEntry extends AbstractPersistableCustom {
|
||||
this.isJournalEntryCreated = bool;
|
||||
}
|
||||
|
||||
public Date getCreatedDate() {
|
||||
public LocalDate getCreatedDate() {
|
||||
return this.createdDate;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.provisioning.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
@@ -28,7 +28,7 @@ public interface ProvisioningEntryRepository extends JpaRepository<ProvisioningE
|
||||
|
||||
// OPENJPA throws error if we use entry
|
||||
@Query("select entry1 from ProvisioningEntry entry1 where entry1.createdDate = :createdDate")
|
||||
ProvisioningEntry findByProvisioningEntryDate(@Param("createdDate") Date createdDate);
|
||||
ProvisioningEntry findByProvisioningEntryDate(@Param("createdDate") LocalDate createdDate);
|
||||
|
||||
@Query("select entry1 from ProvisioningEntry entry1 where entry1.createdDate = (select max(entry2.createdDate) from ProvisioningEntry entry2 where entry2.isJournalEntryCreated=true)")
|
||||
ProvisioningEntry findExistingProvisioningEntryWithJournalEntries();
|
||||
|
||||
+2
-2
@@ -18,12 +18,12 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.provisioning.exception;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
|
||||
|
||||
public class ProvisioningEntryAlreadyCreatedException extends AbstractPlatformResourceNotFoundException {
|
||||
|
||||
public ProvisioningEntryAlreadyCreatedException(Long id, Date date) {
|
||||
public ProvisioningEntryAlreadyCreatedException(Long id, LocalDate date) {
|
||||
super("error.msg.provisioningentry.already.exists.for.this.date",
|
||||
"ProvisioningEntry with identifier " + id + " exists for given date" + date, id);
|
||||
}
|
||||
|
||||
+2
-2
@@ -18,12 +18,12 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.provisioning.exception;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
|
||||
|
||||
public class ProvisioningJournalEntriesCannotbeCreatedException extends AbstractPlatformResourceNotFoundException {
|
||||
|
||||
public ProvisioningJournalEntriesCannotbeCreatedException(Date existingEntriesDate, Date requestedDate) {
|
||||
public ProvisioningJournalEntriesCannotbeCreatedException(LocalDate existingEntriesDate, LocalDate requestedDate) {
|
||||
super("error.msg.provisioning.journalentries.cannot.be.created", "Provisioning Journal Entries already created on later date "
|
||||
+ existingEntriesDate + " than requested date " + requestedDate);
|
||||
}
|
||||
|
||||
+2
-2
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.provisioning.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import org.apache.fineract.accounting.provisioning.data.LoanProductProvisioningEntryData;
|
||||
import org.apache.fineract.accounting.provisioning.data.ProvisioningEntryData;
|
||||
import org.apache.fineract.infrastructure.core.service.Page;
|
||||
@@ -27,7 +27,7 @@ import org.apache.fineract.infrastructure.core.service.SearchParameters;
|
||||
|
||||
public interface ProvisioningEntriesReadPlatformService {
|
||||
|
||||
Collection<LoanProductProvisioningEntryData> retrieveLoanProductsProvisioningData(Date date);
|
||||
Collection<LoanProductProvisioningEntryData> retrieveLoanProductsProvisioningData(LocalDate date);
|
||||
|
||||
ProvisioningEntryData retrieveProvisioningEntryData(Long entryId);
|
||||
|
||||
|
||||
+16
-13
@@ -19,17 +19,18 @@
|
||||
package org.apache.fineract.accounting.provisioning.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Date;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.accounting.provisioning.data.LoanProductProvisioningEntryData;
|
||||
import org.apache.fineract.accounting.provisioning.data.ProvisioningEntryData;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.Page;
|
||||
import org.apache.fineract.infrastructure.core.service.PaginationHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.SearchParameters;
|
||||
@@ -51,11 +52,11 @@ public class ProvisioningEntriesReadPlatformServiceImpl implements ProvisioningE
|
||||
private final DatabaseSpecificSQLGenerator sqlGenerator;
|
||||
|
||||
@Override
|
||||
public Collection<LoanProductProvisioningEntryData> retrieveLoanProductsProvisioningData(Date date) {
|
||||
String formattedDate = new SimpleDateFormat("yyyy-MM-dd").format(date);
|
||||
public Collection<LoanProductProvisioningEntryData> retrieveLoanProductsProvisioningData(LocalDate date) {
|
||||
String formattedDate = DateUtils.DEFAULT_DATE_FORMATER.format(date);
|
||||
LoanProductProvisioningEntryMapper mapper = new LoanProductProvisioningEntryMapper(sqlGenerator);
|
||||
final String sql = mapper.schema();
|
||||
return this.jdbcTemplate.query(sql, mapper, new Object[] { formattedDate, formattedDate, formattedDate });
|
||||
return this.jdbcTemplate.query(sql, mapper, formattedDate, formattedDate, formattedDate);
|
||||
}
|
||||
|
||||
private static final class LoanProductProvisioningEntryMapper implements RowMapper<LoanProductProvisioningEntryData> {
|
||||
@@ -107,8 +108,7 @@ public class ProvisioningEntriesReadPlatformServiceImpl implements ProvisioningE
|
||||
public ProvisioningEntryData retrieveProvisioningEntryData(Long entryId) {
|
||||
ProvisioningEntryDataMapperWithSumReserved mapper1 = new ProvisioningEntryDataMapperWithSumReserved();
|
||||
final String sql = "select" + mapper1.getSchema() + " where entry.id = ? group by entry.id, created.username, modified.username";
|
||||
ProvisioningEntryData data = this.jdbcTemplate.queryForObject(sql, mapper1, new Object[] { entryId }); // NOSONAR
|
||||
return data;
|
||||
return this.jdbcTemplate.queryForObject(sql, mapper1, entryId);
|
||||
}
|
||||
|
||||
private static final class ProvisioningEntryDataMapper implements RowMapper<ProvisioningEntryData> {
|
||||
@@ -130,7 +130,8 @@ public class ProvisioningEntriesReadPlatformServiceImpl implements ProvisioningE
|
||||
Long modifiedById = rs.getLong("lastmodifiedby_id");
|
||||
String modifieUser = rs.getString("modifieduser");
|
||||
BigDecimal totalReservedAmount = null;
|
||||
return new ProvisioningEntryData(id, journalEntry, createdById, createdUser, createdDate, modifiedById, modifieUser,
|
||||
LocalDate createdLocalDate = createdDate != null ? createdDate.toLocalDate() : null;
|
||||
return new ProvisioningEntryData(id, journalEntry, createdById, createdUser, createdLocalDate, modifiedById, modifieUser,
|
||||
totalReservedAmount);
|
||||
}
|
||||
|
||||
@@ -203,7 +204,8 @@ public class ProvisioningEntriesReadPlatformServiceImpl implements ProvisioningE
|
||||
Long modifiedById = rs.getLong("lastmodifiedby_id");
|
||||
String modifieUser = rs.getString("modifieduser");
|
||||
BigDecimal totalReservedAmount = rs.getBigDecimal("totalreserved");
|
||||
return new ProvisioningEntryData(id, journalEntry, createdById, createdUser, createdDate, modifiedById, modifieUser,
|
||||
LocalDate createdLocalDate = createdDate != null ? createdDate.toLocalDate() : null;
|
||||
return new ProvisioningEntryData(id, journalEntry, createdById, createdUser, createdLocalDate, modifiedById, modifieUser,
|
||||
totalReservedAmount);
|
||||
}
|
||||
|
||||
@@ -239,7 +241,7 @@ public class ProvisioningEntriesReadPlatformServiceImpl implements ProvisioningE
|
||||
final String sql1 = "select " + mapper1.getSchema() + " where entry.created_date like ? ";
|
||||
ProvisioningEntryData data = null;
|
||||
try {
|
||||
data = this.jdbcTemplate.queryForObject(sql1, mapper1, new Object[] { date }); // NOSONAR
|
||||
data = this.jdbcTemplate.queryForObject(sql1, mapper1, date); // NOSONAR
|
||||
} catch (EmptyResultDataAccessException e) {
|
||||
log.error("Problem occurred in retrieveProvisioningEntryData function", e);
|
||||
}
|
||||
@@ -252,12 +254,12 @@ public class ProvisioningEntriesReadPlatformServiceImpl implements ProvisioningE
|
||||
ProvisioningEntryData data = null;
|
||||
LoanProductProvisioningEntryRowMapper mapper = new LoanProductProvisioningEntryRowMapper();
|
||||
final String sql = "select " + mapper.getSchema() + " where entry.criteria_id = ?";
|
||||
Collection<LoanProductProvisioningEntryData> entries = this.jdbcTemplate.query(sql, mapper, new Object[] { criteriaId }); // NOSONAR
|
||||
Collection<LoanProductProvisioningEntryData> entries = this.jdbcTemplate.query(sql, mapper, criteriaId); // NOSONAR
|
||||
if (entries != null && entries.size() > 0) {
|
||||
Long entryId = ((LoanProductProvisioningEntryData) entries.toArray()[0]).getHistoryId();
|
||||
ProvisioningEntryDataMapper mapper1 = new ProvisioningEntryDataMapper();
|
||||
final String sql1 = "select " + mapper1.getSchema() + " where entry.id = ?";
|
||||
data = this.jdbcTemplate.queryForObject(sql1, mapper1, new Object[] { entryId }); // NOSONAR
|
||||
data = this.jdbcTemplate.queryForObject(sql1, mapper1, entryId); // NOSONAR
|
||||
data.setEntries(entries);
|
||||
}
|
||||
return data;
|
||||
@@ -290,7 +292,8 @@ public class ProvisioningEntriesReadPlatformServiceImpl implements ProvisioningE
|
||||
Long modifiedBy = null;
|
||||
String modifiedName = null;
|
||||
BigDecimal totalReservedAmount = null;
|
||||
return new ProvisioningEntryData(id, Boolean.TRUE, createdBy, createdName, createdDate, modifiedBy, modifiedName,
|
||||
LocalDate createdLocalDate = createdDate != null ? createdDate.toLocalDate() : null;
|
||||
return new ProvisioningEntryData(id, Boolean.TRUE, createdBy, createdName, createdLocalDate, modifiedBy, modifiedName,
|
||||
totalReservedAmount);
|
||||
}
|
||||
|
||||
|
||||
+10
-13
@@ -20,9 +20,7 @@ package org.apache.fineract.accounting.provisioning.service;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -111,9 +109,9 @@ public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements
|
||||
}
|
||||
|
||||
private void validateForCreateJournalEntry(ProvisioningEntryData existingEntry, ProvisioningEntry requested) {
|
||||
Date existingDate = existingEntry.getCreatedDate();
|
||||
Date requestedDate = requested.getCreatedDate();
|
||||
if (existingDate.after(requestedDate) || existingDate.compareTo(requestedDate) == 0 ? Boolean.TRUE : Boolean.FALSE) {
|
||||
LocalDate existingDate = existingEntry.getCreatedDate();
|
||||
LocalDate requestedDate = requested.getCreatedDate();
|
||||
if (existingDate.isAfter(requestedDate) || existingDate.compareTo(requestedDate) == 0 ? Boolean.TRUE : Boolean.FALSE) {
|
||||
throw new ProvisioningJournalEntriesCannotbeCreatedException(existingEntry.getCreatedDate(), requestedDate);
|
||||
}
|
||||
}
|
||||
@@ -127,15 +125,14 @@ public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements
|
||||
return bool;
|
||||
}
|
||||
|
||||
private Date parseDate(JsonCommand command) {
|
||||
LocalDate localDate = this.fromApiJsonHelper.extractLocalDateNamed("date", command.parsedJson());
|
||||
return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
private LocalDate parseDate(JsonCommand command) {
|
||||
return this.fromApiJsonHelper.extractLocalDateNamed("date", command.parsedJson());
|
||||
}
|
||||
|
||||
@Override
|
||||
@CronTarget(jobName = JobName.GENERATE_LOANLOSS_PROVISIONING)
|
||||
public void generateLoanLossProvisioningAmount() {
|
||||
Date currentDate = DateUtils.getBusinessDate();
|
||||
LocalDate currentDate = DateUtils.getBusinessLocalDate();
|
||||
boolean addJournalEntries = true;
|
||||
try {
|
||||
Collection<ProvisioningCriteriaData> criteriaCollection = this.provisioningCriteriaReadPlatformService
|
||||
@@ -156,7 +153,7 @@ public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements
|
||||
@Override
|
||||
public CommandProcessingResult createProvisioningEntries(JsonCommand command) {
|
||||
this.fromApiJsonDeserializer.validateForCreate(command.json());
|
||||
Date createdDate = parseDate(command);
|
||||
LocalDate createdDate = parseDate(command);
|
||||
boolean addJournalEntries = isJournalEntriesRequired(command);
|
||||
try {
|
||||
Collection<ProvisioningCriteriaData> criteriaCollection = this.provisioningCriteriaReadPlatformService
|
||||
@@ -171,14 +168,14 @@ public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements
|
||||
}
|
||||
}
|
||||
|
||||
private ProvisioningEntry createProvsioningEntry(Date date, boolean addJournalEntries) {
|
||||
private ProvisioningEntry createProvsioningEntry(LocalDate date, boolean addJournalEntries) {
|
||||
ProvisioningEntry existingEntry = this.provisioningEntryRepository.findByProvisioningEntryDate(date);
|
||||
if (existingEntry != null) {
|
||||
throw new ProvisioningEntryAlreadyCreatedException(existingEntry.getId(), existingEntry.getCreatedDate());
|
||||
}
|
||||
AppUser currentUser = this.platformSecurityContext.authenticatedUser();
|
||||
AppUser lastModifiedBy = null;
|
||||
Date lastModifiedDate = null;
|
||||
LocalDate lastModifiedDate = null;
|
||||
Set<LoanProductProvisioningEntry> nullEntries = null;
|
||||
ProvisioningEntry requestedEntry = new ProvisioningEntry(currentUser, date, lastModifiedBy, lastModifiedDate, nullEntries);
|
||||
Collection<LoanProductProvisioningEntry> entries = generateLoanProvisioningEntry(requestedEntry, date);
|
||||
@@ -205,7 +202,7 @@ public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements
|
||||
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(requestedEntry.getId()).build();
|
||||
}
|
||||
|
||||
private Collection<LoanProductProvisioningEntry> generateLoanProvisioningEntry(ProvisioningEntry parent, Date date) {
|
||||
private Collection<LoanProductProvisioningEntry> generateLoanProvisioningEntry(ProvisioningEntry parent, LocalDate date) {
|
||||
Collection<LoanProductProvisioningEntryData> entries = this.provisioningEntriesReadPlatformService
|
||||
.retrieveLoanProductsProvisioningData(date);
|
||||
Map<Integer, LoanProductProvisioningEntry> provisioningEntries = new HashMap<>();
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.rule.exception;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
|
||||
|
||||
/**
|
||||
@@ -26,7 +26,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
|
||||
*/
|
||||
public class AccountingRuleInvalidDeleteException extends AbstractPlatformDomainRuleException {
|
||||
|
||||
public AccountingRuleInvalidDeleteException(final Long officeId, final String officeName, final Date latestclosureDate) {
|
||||
public AccountingRuleInvalidDeleteException(final Long officeId, final String officeName, final LocalDate latestclosureDate) {
|
||||
super("error.msg.glclosure.invalid.delete", "The latest closure for office with Id " + officeId + " and name " + officeName
|
||||
+ " is on " + latestclosureDate.toString() + ", please delete this closure first", latestclosureDate);
|
||||
}
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.rule.exception;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
|
||||
|
||||
/**
|
||||
@@ -50,7 +50,7 @@ public class AccountingRuleInvalidException extends AbstractPlatformDomainRuleEx
|
||||
}
|
||||
}
|
||||
|
||||
public AccountingRuleInvalidException(final GlClosureInvalidReason reason, final Date date) {
|
||||
public AccountingRuleInvalidException(final GlClosureInvalidReason reason, final LocalDate date) {
|
||||
super(reason.errorCode(), reason.errorMessage(), date);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -21,4 +21,6 @@ package org.apache.fineract.cob.loan;
|
||||
import org.apache.fineract.cob.COBBusinessStep;
|
||||
import org.apache.fineract.portfolio.loanaccount.domain.Loan;
|
||||
|
||||
public interface LoanCOBBusinessStep extends COBBusinessStep<Loan> {}
|
||||
public interface LoanCOBBusinessStep extends COBBusinessStep<Loan> {
|
||||
|
||||
}
|
||||
|
||||
+6
-10
@@ -18,15 +18,13 @@
|
||||
*/
|
||||
package org.apache.fineract.commands.domain;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
@@ -75,16 +73,14 @@ public class CommandSource extends AbstractPersistableCustom {
|
||||
private AppUser maker;
|
||||
|
||||
@Column(name = "made_on_date", nullable = false)
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date madeOnDate;
|
||||
private LocalDateTime madeOnDate;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "checker_id", nullable = true)
|
||||
private AppUser checker;
|
||||
|
||||
@Column(name = "checked_on_date", nullable = true)
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date checkedOnDate;
|
||||
private LocalDateTime checkedOnDate;
|
||||
|
||||
@Column(name = "processing_result_enum", nullable = false)
|
||||
private Integer processingResult;
|
||||
@@ -119,7 +115,7 @@ public class CommandSource extends AbstractPersistableCustom {
|
||||
this.subresourceId = subresourceId;
|
||||
this.commandAsJson = commandSerializedAsJson;
|
||||
this.maker = maker;
|
||||
this.madeOnDate = Date.from(madeOnDateTime.toInstant());
|
||||
this.madeOnDate = madeOnDateTime != null ? madeOnDateTime.toLocalDateTime() : null;
|
||||
this.processingResult = CommandProcessingResultType.PROCESSED.getValue();
|
||||
}
|
||||
|
||||
@@ -141,13 +137,13 @@ public class CommandSource extends AbstractPersistableCustom {
|
||||
|
||||
public void markAsChecked(final AppUser checker, final ZonedDateTime checkedOnDate) {
|
||||
this.checker = checker;
|
||||
this.checkedOnDate = Date.from(checkedOnDate.toInstant());
|
||||
this.checkedOnDate = checkedOnDate != null ? checkedOnDate.toLocalDateTime() : null;
|
||||
this.processingResult = CommandProcessingResultType.PROCESSED.getValue();
|
||||
}
|
||||
|
||||
public void markAsRejected(final AppUser checker, final ZonedDateTime checkedOnDate) {
|
||||
this.checker = checker;
|
||||
this.checkedOnDate = Date.from(checkedOnDate.toInstant());
|
||||
this.checkedOnDate = checkedOnDate != null ? checkedOnDate.toLocalDateTime() : null;
|
||||
this.processingResult = CommandProcessingResultType.REJECTED.getValue();
|
||||
}
|
||||
|
||||
|
||||
+5
-10
@@ -19,15 +19,12 @@
|
||||
package org.apache.fineract.infrastructure.bulkimport.domain;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.domain.Document;
|
||||
@@ -41,13 +38,11 @@ public class ImportDocument extends AbstractPersistableCustom {
|
||||
@JoinColumn(name = "document_id")
|
||||
private Document document;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "import_time")
|
||||
private Date importTime;
|
||||
private LocalDateTime importTime;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "end_time")
|
||||
private Date endTime;
|
||||
private LocalDateTime endTime;
|
||||
|
||||
@Column(name = "completed", nullable = false)
|
||||
private Boolean completed;
|
||||
@@ -88,8 +83,8 @@ public class ImportDocument extends AbstractPersistableCustom {
|
||||
final Integer entityType, final AppUser createdBy, final Integer totalRecords, final Integer successCount,
|
||||
final Integer failureCount) {
|
||||
this.document = document;
|
||||
this.importTime = Date.from(importTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.endTime = Date.from(endTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.importTime = importTime;
|
||||
this.endTime = endTime;
|
||||
this.completed = completed;
|
||||
this.entityType = entityType;
|
||||
this.createdBy = createdBy;
|
||||
@@ -100,7 +95,7 @@ public class ImportDocument extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public void update(final LocalDateTime endTime, final Integer successCount, final Integer errorCount) {
|
||||
this.endTime = Date.from(endTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.endTime = endTime;
|
||||
this.completed = Boolean.TRUE;
|
||||
this.successCount = successCount;
|
||||
this.failureCount = errorCount;
|
||||
|
||||
+18
-28
@@ -19,10 +19,10 @@
|
||||
package org.apache.fineract.infrastructure.bulkimport.populator;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeFormatterBuilder;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
import org.apache.fineract.organisation.office.data.OfficeData;
|
||||
@@ -67,27 +67,21 @@ public abstract class AbstractWorkbookPopulator implements WorkbookPopulator {
|
||||
|
||||
protected void writeDate(int colIndex, Row row, String value, CellStyle dateCellStyle, String dateFormat) {
|
||||
try {
|
||||
SimpleDateFormat formatinDB = null;
|
||||
DateTimeFormatter formatinDB;
|
||||
if (value.matches("\\d{4}-\\d{1,2}-\\d{1,2}")) {
|
||||
formatinDB = new SimpleDateFormat("yyyy-MM-dd");
|
||||
formatinDB = new DateTimeFormatterBuilder().appendPattern("yyyy-M-d").toFormatter();
|
||||
} else if (value.matches("\\d{1,2}/\\d{1,2}/\\d{4}")) {
|
||||
formatinDB = new SimpleDateFormat("dd/MM/yyyy");
|
||||
formatinDB = new DateTimeFormatterBuilder().appendPattern("d/M/yyyy").toFormatter();
|
||||
} else if (value.matches("\\d{1,2} \\w{3,12} \\d{4}")) {
|
||||
formatinDB = new SimpleDateFormat("dd MMMM yyyy");
|
||||
formatinDB = new DateTimeFormatterBuilder().appendPattern("d MMMM yyyy").toFormatter();
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unrecognised format of date value: " + value);
|
||||
}
|
||||
Date date1 = formatinDB.parse(value);
|
||||
SimpleDateFormat expectedFormat = new SimpleDateFormat(dateFormat);
|
||||
Date date2 = expectedFormat.parse(expectedFormat.format(date1));
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date2);
|
||||
cal.set(Calendar.HOUR_OF_DAY, 0);
|
||||
cal.set(Calendar.MINUTE, 0);
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
Date dateWithoutTime = cal.getTime();
|
||||
row.createCell(colIndex).setCellValue(dateWithoutTime);
|
||||
LocalDate date1 = LocalDate.parse(value, formatinDB);
|
||||
DateTimeFormatter expectedFormat = new DateTimeFormatterBuilder().appendPattern(dateFormat).toFormatter();
|
||||
row.createCell(colIndex).setCellValue(expectedFormat.format(date1));
|
||||
row.getCell(colIndex).setCellStyle(dateCellStyle);
|
||||
} catch (ParseException pe) {
|
||||
} catch (DateTimeParseException pe) {
|
||||
throw new IllegalArgumentException(pe);
|
||||
}
|
||||
}
|
||||
@@ -121,9 +115,7 @@ public abstract class AbstractWorkbookPopulator implements WorkbookPopulator {
|
||||
short df = workbook.createDataFormat().getFormat(dateFormat);
|
||||
dateCellStyle.setDataFormat(df);
|
||||
int rowIndex = 0;
|
||||
SimpleDateFormat outputFormat = new SimpleDateFormat(dateFormat);
|
||||
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date date = null;
|
||||
DateTimeFormatter outputFormat = new DateTimeFormatterBuilder().appendPattern(dateFormat).toFormatter();
|
||||
try {
|
||||
if (clients != null) {
|
||||
for (ClientData client : clients) {
|
||||
@@ -134,8 +126,7 @@ public abstract class AbstractWorkbookPopulator implements WorkbookPopulator {
|
||||
writeString(nameCol, row, client.displayName().replaceAll("[ )(] ", "_") + "(" + client.id() + ")");
|
||||
|
||||
if (client.getActivationDate() != null) {
|
||||
date = inputFormat.parse(client.getActivationDate().toString());
|
||||
writeDate(activationDateCol, row, outputFormat.format(date), dateCellStyle, dateFormat);
|
||||
writeDate(activationDateCol, row, outputFormat.format(client.getActivationDate()), dateCellStyle, dateFormat);
|
||||
}
|
||||
if (containsClientExtId) {
|
||||
if (client.getExternalId() != null) {
|
||||
@@ -154,13 +145,12 @@ public abstract class AbstractWorkbookPopulator implements WorkbookPopulator {
|
||||
writeString(nameCol, row, group.getName().replaceAll("[ )(] ", "_"));
|
||||
|
||||
if (group.getActivationDate() != null) {
|
||||
date = inputFormat.parse(group.getActivationDate().toString());
|
||||
writeDate(activationDateCol, row, outputFormat.format(date), dateCellStyle, dateFormat);
|
||||
writeDate(activationDateCol, row, outputFormat.format(group.getActivationDate()), dateCellStyle, dateFormat);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
} catch (DateTimeParseException e) {
|
||||
LOG.error("Problem occurred in setClientAndGroupDateLookupTable function", e);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -19,8 +19,8 @@
|
||||
package org.apache.fineract.infrastructure.bulkimport.populator;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -99,10 +99,10 @@ public class SharedProductsSheetPopulator extends AbstractWorkbookPopulator {
|
||||
BigDecimal marketValue = shareProductData.getUnitPrice();
|
||||
Collection<ShareProductMarketPriceData> marketDataSet = shareProductData.getMarketPrice();
|
||||
if (marketDataSet != null && !marketDataSet.isEmpty()) {
|
||||
Date currentDate = DateUtils.getBusinessDate();
|
||||
LocalDate currentDate = DateUtils.getBusinessLocalDate();
|
||||
for (ShareProductMarketPriceData data : marketDataSet) {
|
||||
Date futureDate = data.getStartDate();
|
||||
if (currentDate.after(futureDate)) {
|
||||
LocalDate futureDate = data.getStartDate();
|
||||
if (currentDate.isAfter(futureDate)) {
|
||||
marketValue = data.getShareValue();
|
||||
}
|
||||
}
|
||||
|
||||
+5
-13
@@ -18,11 +18,10 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.bulkimport.populator.loanrepayment;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeFormatterBuilder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -229,9 +228,7 @@ public class LoanRepaymentWorkbookPopulator extends AbstractWorkbookPopulator {
|
||||
CellStyle dateCellStyle = workbook.createCellStyle();
|
||||
short df = workbook.createDataFormat().getFormat(dateFormat);
|
||||
dateCellStyle.setDataFormat(df);
|
||||
SimpleDateFormat outputFormat = new SimpleDateFormat(dateFormat);
|
||||
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date date = null;
|
||||
DateTimeFormatter outputFormat = new DateTimeFormatterBuilder().appendPattern(dateFormat).toFormatter();
|
||||
Collections.sort(allloans, new LoanComparatorByStatusActive());
|
||||
for (LoanAccountData loan : allloans) {
|
||||
row = loanRepaymentSheet.createRow(rowIndex++);
|
||||
@@ -244,13 +241,8 @@ public class LoanRepaymentWorkbookPopulator extends AbstractWorkbookPopulator {
|
||||
writeBigDecimal(LoanRepaymentConstants.LOOKUP_TOTAL_OUTSTANDING_AMOUNT_COL, row, loan.getTotalOutstandingAmount());
|
||||
}
|
||||
if (loan.getDisbursementDate() != null) {
|
||||
try {
|
||||
date = inputFormat.parse(loan.getDisbursementDate().toString());
|
||||
} catch (ParseException e) {
|
||||
LOG.error("Problem occurred in populateLoansTable function", e);
|
||||
}
|
||||
writeDate(LoanRepaymentConstants.LOOKUP_LOAN_DISBURSEMENT_DATE_COL, row, outputFormat.format(date), dateCellStyle,
|
||||
dateFormat);
|
||||
writeDate(LoanRepaymentConstants.LOOKUP_LOAN_DISBURSEMENT_DATE_COL, row, outputFormat.format(loan.getDisbursementDate()),
|
||||
dateCellStyle, dateFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.campaigns.email.api;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
@@ -119,11 +119,11 @@ public class EmailApiResource {
|
||||
@QueryParam("locale") final String locale, @QueryParam("dateFormat") final String dateFormat, @Context final UriInfo uriInfo) {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(this.resourceNameForPermissions);
|
||||
Date fromDate = null;
|
||||
LocalDate fromDate = null;
|
||||
if (fromDateParam != null) {
|
||||
fromDate = fromDateParam.getDate("fromDate", dateFormat, locale);
|
||||
}
|
||||
Date toDate = null;
|
||||
LocalDate toDate = null;
|
||||
if (toDateParam != null) {
|
||||
toDate = toDateParam.getDate("toDate", dateFormat, locale);
|
||||
}
|
||||
|
||||
+26
-52
@@ -20,11 +20,8 @@ package org.apache.fineract.infrastructure.campaigns.email.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -34,9 +31,6 @@ import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.campaigns.email.ScheduledEmailConstants;
|
||||
import org.apache.fineract.infrastructure.campaigns.email.data.EmailCampaignValidator;
|
||||
@@ -86,24 +80,21 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
private String stretchyReportParamMap;
|
||||
|
||||
@Column(name = "closedon_date", nullable = true)
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date closureDate;
|
||||
private LocalDate closureDate;
|
||||
|
||||
@ManyToOne(optional = true)
|
||||
@JoinColumn(name = "closedon_userid", nullable = true)
|
||||
private AppUser closedBy;
|
||||
|
||||
@Column(name = "submittedon_date", nullable = true)
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date submittedOnDate;
|
||||
private LocalDate submittedOnDate;
|
||||
|
||||
@ManyToOne(optional = true)
|
||||
@JoinColumn(name = "submittedon_userid", nullable = true)
|
||||
private AppUser submittedBy;
|
||||
|
||||
@Column(name = "approvedon_date", nullable = true)
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date approvedOnDate;
|
||||
private LocalDate approvedOnDate;
|
||||
|
||||
@ManyToOne(optional = true)
|
||||
@JoinColumn(name = "approvedon_userid", nullable = true)
|
||||
@@ -113,16 +104,13 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
private String recurrence;
|
||||
|
||||
@Column(name = "next_trigger_date")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date nextTriggerDate;
|
||||
private LocalDateTime nextTriggerDate;
|
||||
|
||||
@Column(name = "last_trigger_date")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date lastTriggerDate;
|
||||
private LocalDateTime lastTriggerDate;
|
||||
|
||||
@Column(name = "recurrence_start_date")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date recurrenceStartDate;
|
||||
private LocalDateTime recurrenceStartDate;
|
||||
|
||||
@Column(name = "is_visible", nullable = true)
|
||||
private boolean isVisible;
|
||||
@@ -153,15 +141,15 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
this.emailAttachmentFileFormat = emailAttachmentFileFormat.getValue();
|
||||
this.stretchyReport = stretchyReport;
|
||||
this.stretchyReportParamMap = stretchyReportParamMap;
|
||||
this.submittedOnDate = Date.from(submittedOnDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.submittedOnDate = submittedOnDate;
|
||||
this.submittedBy = submittedBy;
|
||||
this.recurrence = recurrence;
|
||||
LocalDateTime recurrenceStartDate = LocalDateTime.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
this.isVisible = true;
|
||||
if (localDateTime != null) {
|
||||
this.recurrenceStartDate = Date.from(localDateTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.recurrenceStartDate = localDateTime;
|
||||
} else {
|
||||
this.recurrenceStartDate = Date.from(recurrenceStartDate.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.recurrenceStartDate = recurrenceStartDate;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -248,15 +236,13 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
final Locale locale = command.extractLocale();
|
||||
final DateTimeFormatter fmt = DateTimeFormatter.ofPattern(command.dateFormat()).withLocale(locale);
|
||||
|
||||
if (command.isChangeInLocalDateParameterNamed(EmailCampaignValidator.recurrenceStartDate, getRecurrenceStartDate())) {
|
||||
if (command.isChangeInLocalDateTimeParameterNamed(EmailCampaignValidator.recurrenceStartDate, getRecurrenceStartDateTime())) {
|
||||
final String valueAsInput = command.stringValueOfParameterNamed(EmailCampaignValidator.recurrenceStartDate);
|
||||
actualChanges.put(EmailCampaignValidator.recurrenceStartDate, valueAsInput);
|
||||
actualChanges.put(ClientApiConstants.dateFormatParamName, dateFormatAsInput);
|
||||
actualChanges.put(ClientApiConstants.localeParamName, localeAsInput);
|
||||
|
||||
final LocalDateTime newValue = LocalDateTime.parse(valueAsInput, fmt);
|
||||
|
||||
this.recurrenceStartDate = Date.from(newValue.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.recurrenceStartDate = LocalDateTime.parse(valueAsInput, fmt);
|
||||
}
|
||||
|
||||
return actualChanges;
|
||||
@@ -275,7 +261,7 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
|
||||
throw new PlatformApiDataValidationException(dataValidationErrors);
|
||||
}
|
||||
this.approvedOnDate = Date.from(activationLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.approvedOnDate = activationLocalDate;
|
||||
this.approvedBy = currentUser;
|
||||
this.status = EmailCampaignStatus.ACTIVE.getValue();
|
||||
|
||||
@@ -299,7 +285,7 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
this.lastTriggerDate = null;
|
||||
}
|
||||
this.closedBy = currentUser;
|
||||
this.closureDate = Date.from(closureLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.closureDate = closureLocalDate;
|
||||
this.status = EmailCampaignStatus.CLOSED.getValue();
|
||||
validateClosureDate();
|
||||
}
|
||||
@@ -318,7 +304,7 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
throw new PlatformApiDataValidationException(dataValidationErrors);
|
||||
}
|
||||
|
||||
this.approvedOnDate = Date.from(reactivateLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.approvedOnDate = reactivateLocalDate;
|
||||
this.status = EmailCampaignStatus.ACTIVE.getValue();
|
||||
this.approvedBy = currentUser;
|
||||
this.closureDate = null;
|
||||
@@ -457,20 +443,16 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getSubmittedOnDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.submittedOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), null);
|
||||
return this.submittedOnDate;
|
||||
|
||||
}
|
||||
|
||||
public LocalDate getClosureDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.closureDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), null);
|
||||
return this.closureDate;
|
||||
}
|
||||
|
||||
public LocalDate getActivationLocalDate() {
|
||||
LocalDate activationLocalDate = null;
|
||||
if (this.approvedOnDate != null) {
|
||||
activationLocalDate = LocalDate.ofInstant(this.approvedOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return activationLocalDate;
|
||||
return this.approvedOnDate;
|
||||
}
|
||||
|
||||
private boolean isDateInTheFuture(final LocalDate localDate) {
|
||||
@@ -501,36 +483,28 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
return this.recurrence;
|
||||
}
|
||||
|
||||
public LocalDate getRecurrenceStartDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.recurrenceStartDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()),
|
||||
null);
|
||||
}
|
||||
|
||||
public LocalDateTime getRecurrenceStartDateTime() {
|
||||
return ObjectUtils.defaultIfNull(
|
||||
ZonedDateTime.ofInstant(this.recurrenceStartDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()).toLocalDateTime(), null);
|
||||
return this.recurrenceStartDate;
|
||||
}
|
||||
|
||||
public void setLastTriggerDate(Date lastTriggerDate) {
|
||||
public void setLastTriggerDate(LocalDateTime lastTriggerDate) {
|
||||
this.lastTriggerDate = lastTriggerDate;
|
||||
}
|
||||
|
||||
public void setNextTriggerDate(Date nextTriggerDate) {
|
||||
public void setNextTriggerDate(LocalDateTime nextTriggerDate) {
|
||||
this.nextTriggerDate = nextTriggerDate;
|
||||
}
|
||||
|
||||
public LocalDateTime getNextTriggerDate() {
|
||||
return ObjectUtils.defaultIfNull(
|
||||
ZonedDateTime.ofInstant(this.nextTriggerDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()).toLocalDateTime(), null);
|
||||
|
||||
}
|
||||
|
||||
public Date getNextTriggerDateInDate() {
|
||||
return this.nextTriggerDate;
|
||||
}
|
||||
|
||||
public LocalDate getLastTriggerDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.lastTriggerDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), null);
|
||||
public LocalDateTime getNextTriggerDateInDate() {
|
||||
return this.nextTriggerDate;
|
||||
}
|
||||
|
||||
public LocalDateTime getLastTriggerDate() {
|
||||
return this.lastTriggerDate;
|
||||
}
|
||||
|
||||
public void updateIsVisible(boolean isVisible) {
|
||||
|
||||
+4
-7
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.campaigns.email.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import javax.persistence.Column;
|
||||
@@ -26,8 +26,6 @@ import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.campaigns.email.EmailApiConstants;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
@@ -73,8 +71,7 @@ public class EmailMessage extends AbstractPersistableCustom {
|
||||
private String campaignName;
|
||||
|
||||
@Column(name = "submittedon_date", nullable = true)
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date submittedOnDate;
|
||||
private LocalDate submittedOnDate;
|
||||
|
||||
@Column(name = "error_message")
|
||||
private String errorMessage;
|
||||
@@ -107,7 +104,7 @@ public class EmailMessage extends AbstractPersistableCustom {
|
||||
this.emailSubject = emailSubject;
|
||||
this.message = message;
|
||||
this.campaignName = campaignName;
|
||||
this.submittedOnDate = DateUtils.getBusinessDate();
|
||||
this.submittedOnDate = DateUtils.getBusinessLocalDate();
|
||||
}
|
||||
|
||||
public Map<String, Object> update(final JsonCommand command) {
|
||||
@@ -159,7 +156,7 @@ public class EmailMessage extends AbstractPersistableCustom {
|
||||
return this.campaignName;
|
||||
}
|
||||
|
||||
public Date getSubmittedOnDate() {
|
||||
public LocalDate getSubmittedOnDate() {
|
||||
return this.submittedOnDate;
|
||||
}
|
||||
|
||||
|
||||
+26
-40
@@ -38,7 +38,6 @@ import java.time.format.DateTimeFormatterBuilder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -344,33 +343,29 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
|
||||
final EmailCampaign emailCampaign = this.emailCampaignRepository.findById(campaignId)
|
||||
.orElseThrow(() -> new EmailCampaignNotFound(campaignId));
|
||||
LocalDateTime nextTriggerDate = emailCampaign.getNextTriggerDate();
|
||||
emailCampaign.setLastTriggerDate(Date.from(nextTriggerDate.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
emailCampaign.setLastTriggerDate(nextTriggerDate);
|
||||
// calculate new trigger date and insert into next trigger date
|
||||
|
||||
/**
|
||||
* next run time has to be in the future if not calculate a new future date
|
||||
*/
|
||||
LocalDate nextRuntime = CalendarUtils.getNextRecurringDate(emailCampaign.getRecurrence(),
|
||||
emailCampaign.getNextTriggerDate().toLocalDate(), nextTriggerDate.toLocalDate());
|
||||
if (nextRuntime.isBefore(DateUtils.getLocalDateOfTenant())) { // means
|
||||
// next
|
||||
// run
|
||||
// time is
|
||||
// in the
|
||||
// past
|
||||
// calculate
|
||||
// a new
|
||||
// future
|
||||
// date
|
||||
nextRuntime = CalendarUtils.getNextRecurringDate(emailCampaign.getRecurrence(),
|
||||
emailCampaign.getNextTriggerDate().toLocalDate(), DateUtils.getLocalDateOfTenant());
|
||||
LocalDateTime newTriggerDateWithTime = CalendarUtils.getNextRecurringDate(emailCampaign.getRecurrence(),
|
||||
emailCampaign.getNextTriggerDate(), nextTriggerDate);
|
||||
if (newTriggerDateWithTime.isBefore(DateUtils.getLocalDateTimeOfTenant())) { // means
|
||||
// next
|
||||
// run
|
||||
// time is
|
||||
// in the
|
||||
// past
|
||||
// calculate
|
||||
// a new
|
||||
// future
|
||||
// date
|
||||
newTriggerDateWithTime = CalendarUtils.getNextRecurringDate(emailCampaign.getRecurrence(), emailCampaign.getNextTriggerDate(),
|
||||
DateUtils.getLocalDateTimeOfTenant());
|
||||
}
|
||||
final LocalDateTime getTime = emailCampaign.getRecurrenceStartDateTime();
|
||||
final String dateString = nextRuntime.toString() + " " + getTime.getHour() + ":" + getTime.getMinute() + ":" + getTime.getSecond();
|
||||
final DateTimeFormatter simpleDateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
final LocalDateTime newTriggerDateWithTime = LocalDateTime.parse(dateString, simpleDateFormat);
|
||||
|
||||
emailCampaign.setNextTriggerDate(Date.from(newTriggerDateWithTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
emailCampaign.setNextTriggerDate(newTriggerDateWithTime);
|
||||
this.emailCampaignRepository.saveAndFlush(emailCampaign);
|
||||
}
|
||||
|
||||
@@ -402,24 +397,15 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
|
||||
* if recurrence start date is in the future calculate next trigger date if not use recurrence start
|
||||
* date us next trigger date when activating
|
||||
*/
|
||||
LocalDate nextTriggerDate = null;
|
||||
LocalDateTime nextTriggerDateWithTime;
|
||||
if (emailCampaign.getRecurrenceStartDateTime().isBefore(tenantDateTime())) {
|
||||
nextTriggerDate = CalendarUtils.getNextRecurringDate(emailCampaign.getRecurrence(),
|
||||
emailCampaign.getRecurrenceStartDate(), DateUtils.getLocalDateOfTenant());
|
||||
nextTriggerDateWithTime = CalendarUtils.getNextRecurringDate(emailCampaign.getRecurrence(),
|
||||
emailCampaign.getRecurrenceStartDateTime(), DateUtils.getLocalDateTimeOfTenant());
|
||||
} else {
|
||||
nextTriggerDate = emailCampaign.getRecurrenceStartDate();
|
||||
nextTriggerDateWithTime = emailCampaign.getRecurrenceStartDateTime();
|
||||
}
|
||||
// to get time of tenant
|
||||
final LocalDateTime getTime = emailCampaign.getRecurrenceStartDateTime();
|
||||
|
||||
final String dateString = nextTriggerDate.toString() + " " + getTime.getHour() + ":" + getTime.getMinute() + ":"
|
||||
+ getTime.getSecond();
|
||||
final DateTimeFormatter simpleDateFormat = new DateTimeFormatterBuilder().parseCaseInsensitive().parseLenient()
|
||||
.appendPattern("yyyy-MM-dd HH:mm:ss").toFormatter();
|
||||
final LocalDateTime nextTriggerDateWithTime = LocalDateTime.parse(dateString, simpleDateFormat);
|
||||
|
||||
emailCampaign
|
||||
.setNextTriggerDate(Date.from(nextTriggerDateWithTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
emailCampaign.setNextTriggerDate(nextTriggerDateWithTime);
|
||||
this.emailCampaignRepository.saveAndFlush(emailCampaign);
|
||||
}
|
||||
}
|
||||
@@ -554,12 +540,12 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
|
||||
* if recurrence start date is in the future calculate next trigger date if not use recurrence start date us
|
||||
* next trigger date when activating
|
||||
*/
|
||||
LocalDate nextTriggerDate = null;
|
||||
LocalDateTime nextTriggerDate = null;
|
||||
if (emailCampaign.getRecurrenceStartDateTime().isBefore(tenantDateTime())) {
|
||||
nextTriggerDate = CalendarUtils.getNextRecurringDate(emailCampaign.getRecurrence(), emailCampaign.getRecurrenceStartDate(),
|
||||
DateUtils.getLocalDateOfTenant());
|
||||
nextTriggerDate = CalendarUtils.getNextRecurringDate(emailCampaign.getRecurrence(),
|
||||
emailCampaign.getRecurrenceStartDateTime(), DateUtils.getLocalDateTimeOfTenant());
|
||||
} else {
|
||||
nextTriggerDate = emailCampaign.getRecurrenceStartDate();
|
||||
nextTriggerDate = emailCampaign.getRecurrenceStartDateTime();
|
||||
}
|
||||
// to get time of tenant
|
||||
final LocalDateTime getTime = emailCampaign.getRecurrenceStartDateTime();
|
||||
@@ -570,7 +556,7 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
|
||||
.appendPattern("yyyy-MM-dd HH:mm:ss").toFormatter();
|
||||
final LocalDateTime nextTriggerDateWithTime = LocalDateTime.parse(dateString, simpleDateFormat);
|
||||
|
||||
emailCampaign.setNextTriggerDate(Date.from(nextTriggerDateWithTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
emailCampaign.setNextTriggerDate(nextTriggerDateWithTime);
|
||||
this.emailCampaignRepository.saveAndFlush(emailCampaign);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.campaigns.email.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.infrastructure.campaigns.email.data.EmailData;
|
||||
import org.apache.fineract.infrastructure.core.service.Page;
|
||||
@@ -39,7 +39,7 @@ public interface EmailReadPlatformService {
|
||||
|
||||
Collection<EmailData> retrieveAllFailed(SearchParameters searchParameters);
|
||||
|
||||
Page<EmailData> retrieveEmailByStatus(Integer limit, Integer status, Date dateFrom, Date dateTo);
|
||||
Page<EmailData> retrieveEmailByStatus(Integer limit, Integer status, LocalDate dateFrom, LocalDate dateTo);
|
||||
|
||||
List<Long> retrieveExternalIdsOfAllSent(Integer limit);
|
||||
}
|
||||
|
||||
+5
-7
@@ -20,11 +20,8 @@ package org.apache.fineract.infrastructure.campaigns.email.service;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.infrastructure.campaigns.email.data.EmailData;
|
||||
import org.apache.fineract.infrastructure.campaigns.email.domain.EmailMessageEnumerations;
|
||||
@@ -32,6 +29,7 @@ import org.apache.fineract.infrastructure.campaigns.email.domain.EmailMessageSta
|
||||
import org.apache.fineract.infrastructure.campaigns.email.exception.EmailNotFoundException;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.Page;
|
||||
import org.apache.fineract.infrastructure.core.service.PaginationHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.SearchParameters;
|
||||
@@ -172,7 +170,8 @@ public class EmailReadPlatformServiceImpl implements EmailReadPlatformService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EmailData> retrieveEmailByStatus(final Integer limit, final Integer status, final Date dateFrom, final Date dateTo) {
|
||||
public Page<EmailData> retrieveEmailByStatus(final Integer limit, final Integer status, final LocalDate dateFrom,
|
||||
final LocalDate dateTo) {
|
||||
final StringBuilder sqlBuilder = new StringBuilder(200);
|
||||
sqlBuilder.append("select " + sqlGenerator.calcFoundRows() + " ");
|
||||
sqlBuilder.append(this.emailRowMapper.schema());
|
||||
@@ -182,9 +181,8 @@ public class EmailReadPlatformServiceImpl implements EmailReadPlatformService {
|
||||
String fromDateString = null;
|
||||
String toDateString = null;
|
||||
if (dateFrom != null && dateTo != null) {
|
||||
final DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
fromDateString = df.format(dateFrom);
|
||||
toDateString = df.format(dateTo);
|
||||
fromDateString = DateUtils.DEFAULT_DATE_FORMATER.format(dateFrom);
|
||||
toDateString = DateUtils.DEFAULT_DATE_FORMATER.format(dateTo);
|
||||
sqlBuilder.append(" and emo.submittedon_date >= ? and emo.submittedon_date <= ? ");
|
||||
}
|
||||
final String sqlPlusLimit = (limit > 0) ? " " + sqlGenerator.limit(limit) : "";
|
||||
|
||||
+23
-49
@@ -20,11 +20,8 @@ package org.apache.fineract.infrastructure.campaigns.sms.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -34,10 +31,7 @@ import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.campaigns.constants.CampaignType;
|
||||
import org.apache.fineract.infrastructure.campaigns.sms.constants.SmsCampaignStatus;
|
||||
@@ -83,24 +77,21 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
private String message;
|
||||
|
||||
@Column(name = "closedon_date", nullable = true)
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date closureDate;
|
||||
private LocalDate closureDate;
|
||||
|
||||
@ManyToOne(optional = true)
|
||||
@JoinColumn(name = "closedon_userid", nullable = true)
|
||||
private AppUser closedBy;
|
||||
|
||||
@Column(name = "submittedon_date", nullable = true)
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date submittedOnDate;
|
||||
private LocalDate submittedOnDate;
|
||||
|
||||
@ManyToOne(optional = true)
|
||||
@JoinColumn(name = "submittedon_userid", nullable = true)
|
||||
private AppUser submittedBy;
|
||||
|
||||
@Column(name = "approvedon_date", nullable = true)
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date approvedOnDate;
|
||||
private LocalDate approvedOnDate;
|
||||
|
||||
@ManyToOne(optional = true)
|
||||
@JoinColumn(name = "approvedon_userid", nullable = true)
|
||||
@@ -110,16 +101,13 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
private String recurrence;
|
||||
|
||||
@Column(name = "next_trigger_date", nullable = true)
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date nextTriggerDate;
|
||||
private LocalDateTime nextTriggerDate;
|
||||
|
||||
@Column(name = "last_trigger_date", nullable = true)
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date lastTriggerDate;
|
||||
private LocalDateTime lastTriggerDate;
|
||||
|
||||
@Column(name = "recurrence_start_date", nullable = true)
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date recurrenceStartDate;
|
||||
private LocalDateTime recurrenceStartDate;
|
||||
|
||||
@Column(name = "is_visible", nullable = true)
|
||||
private boolean isVisible;
|
||||
@@ -140,15 +128,15 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
this.paramValue = paramValue;
|
||||
this.status = SmsCampaignStatus.PENDING.getValue();
|
||||
this.message = message;
|
||||
this.submittedOnDate = Date.from(submittedOnDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.submittedOnDate = submittedOnDate;
|
||||
this.submittedBy = submittedBy;
|
||||
this.recurrence = recurrence;
|
||||
LocalDateTime recurrenceStartDate = LocalDateTime.now(DateUtils.getDateTimeZoneOfTenant());
|
||||
this.isVisible = true;
|
||||
if (localDateTime != null) {
|
||||
this.recurrenceStartDate = Date.from(localDateTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.recurrenceStartDate = localDateTime;
|
||||
} else {
|
||||
this.recurrenceStartDate = Date.from(recurrenceStartDate.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.recurrenceStartDate = recurrenceStartDate;
|
||||
}
|
||||
this.isNotification = isNotification;
|
||||
}
|
||||
@@ -260,9 +248,7 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
actualChanges.put(SmsCampaignValidator.dateTimeFormat, dateTimeFormatAsInput);
|
||||
actualChanges.put(SmsCampaignValidator.localeParamName, localeAsInput);
|
||||
|
||||
final LocalDateTime newValue = LocalDateTime.parse(valueAsInput, fmt);
|
||||
|
||||
this.recurrenceStartDate = Date.from(newValue.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.recurrenceStartDate = LocalDateTime.parse(valueAsInput, fmt);
|
||||
}
|
||||
|
||||
return actualChanges;
|
||||
@@ -281,7 +267,7 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
|
||||
throw new PlatformApiDataValidationException(dataValidationErrors);
|
||||
}
|
||||
this.approvedOnDate = Date.from(activationLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.approvedOnDate = activationLocalDate;
|
||||
this.approvedBy = currentUser;
|
||||
this.status = SmsCampaignStatus.ACTIVE.getValue();
|
||||
|
||||
@@ -305,7 +291,7 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
this.lastTriggerDate = null;
|
||||
}
|
||||
this.closedBy = currentUser;
|
||||
this.closureDate = Date.from(closureLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.closureDate = closureLocalDate;
|
||||
this.status = SmsCampaignStatus.CLOSED.getValue();
|
||||
validateClosureDate();
|
||||
}
|
||||
@@ -324,7 +310,7 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
throw new PlatformApiDataValidationException(dataValidationErrors);
|
||||
}
|
||||
|
||||
this.approvedOnDate = Date.from(reactivateLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.approvedOnDate = reactivateLocalDate;
|
||||
this.status = SmsCampaignStatus.ACTIVE.getValue();
|
||||
this.approvedBy = currentUser;
|
||||
this.closureDate = null;
|
||||
@@ -467,20 +453,16 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getSubmittedOnDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.submittedOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), null);
|
||||
return this.submittedOnDate;
|
||||
|
||||
}
|
||||
|
||||
public LocalDate getClosureDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.closureDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), null);
|
||||
return this.closureDate;
|
||||
}
|
||||
|
||||
public LocalDate getActivationLocalDate() {
|
||||
LocalDate activationLocalDate = null;
|
||||
if (this.approvedOnDate != null) {
|
||||
activationLocalDate = LocalDate.ofInstant(this.approvedOnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return activationLocalDate;
|
||||
return this.approvedOnDate;
|
||||
}
|
||||
|
||||
private boolean isDateInTheFuture(final LocalDate localDate) {
|
||||
@@ -507,36 +489,28 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
return this.recurrence;
|
||||
}
|
||||
|
||||
public LocalDate getRecurrenceStartDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.recurrenceStartDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()),
|
||||
null);
|
||||
public LocalDateTime getRecurrenceStartDate() {
|
||||
return this.recurrenceStartDate;
|
||||
}
|
||||
|
||||
public LocalDateTime getRecurrenceStartDateTime() {
|
||||
return ObjectUtils.defaultIfNull(
|
||||
ZonedDateTime.ofInstant(this.recurrenceStartDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()).toLocalDateTime(), null);
|
||||
return this.recurrenceStartDate;
|
||||
}
|
||||
|
||||
public void setLastTriggerDate(Date lastTriggerDate) {
|
||||
public void setLastTriggerDate(LocalDateTime lastTriggerDate) {
|
||||
this.lastTriggerDate = lastTriggerDate;
|
||||
}
|
||||
|
||||
public void setNextTriggerDate(Date nextTriggerDate) {
|
||||
public void setNextTriggerDate(LocalDateTime nextTriggerDate) {
|
||||
this.nextTriggerDate = nextTriggerDate;
|
||||
}
|
||||
|
||||
public LocalDateTime getNextTriggerDate() {
|
||||
return ObjectUtils.defaultIfNull(
|
||||
ZonedDateTime.ofInstant(this.nextTriggerDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()).toLocalDateTime(), null);
|
||||
|
||||
}
|
||||
|
||||
public Date getNextTriggerDateInDate() {
|
||||
return this.nextTriggerDate;
|
||||
}
|
||||
|
||||
public LocalDate getLastTriggerDate() {
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.lastTriggerDate.toInstant(), DateUtils.getDateTimeZoneOfTenant()), null);
|
||||
public LocalDateTime getLastTriggerDate() {
|
||||
return this.lastTriggerDate;
|
||||
}
|
||||
|
||||
public void updateIsVisible(boolean isVisible) {
|
||||
|
||||
+25
-46
@@ -32,10 +32,8 @@ import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeFormatterBuilder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
@@ -146,7 +144,7 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
Report report = this.reportRepository.findById(runReportId).orElseThrow(() -> new ReportNotFoundException(runReportId));
|
||||
SmsCampaign smsCampaign = SmsCampaign.instance(currentUser, report, command);
|
||||
if (smsCampaign.getRecurrenceStartDate() != null
|
||||
&& smsCampaign.getRecurrenceStartDate().isBefore(DateUtils.getLocalDateOfTenant())) {
|
||||
&& smsCampaign.getRecurrenceStartDate().isBefore(DateUtils.getLocalDateTimeOfTenant())) {
|
||||
throw new GeneralPlatformDomainRuleException("error.msg.campaign.recurrenceStartDate.in.the.past",
|
||||
"Recurrence start date cannot be the past date.", smsCampaign.getRecurrenceStartDate());
|
||||
}
|
||||
@@ -409,34 +407,29 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
final SmsCampaign smsCampaign = this.smsCampaignRepository.findById(campaignId)
|
||||
.orElseThrow(() -> new SmsCampaignNotFound(campaignId));
|
||||
LocalDateTime nextTriggerDate = smsCampaign.getNextTriggerDate();
|
||||
smsCampaign.setLastTriggerDate(Date.from(nextTriggerDate.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
smsCampaign.setLastTriggerDate(nextTriggerDate);
|
||||
// calculate new trigger date and insert into next trigger date
|
||||
|
||||
/**
|
||||
* next run time has to be in the future if not calculate a new future date
|
||||
*/
|
||||
LocalDate nextRuntime = CalendarUtils.getNextRecurringDate(smsCampaign.getRecurrence(),
|
||||
smsCampaign.getNextTriggerDate().toLocalDate(), nextTriggerDate.toLocalDate());
|
||||
if (nextRuntime.isBefore(DateUtils.getLocalDateOfTenant())) { // means
|
||||
// next
|
||||
// run
|
||||
// time is
|
||||
// in the
|
||||
// past
|
||||
// calculate
|
||||
// a new
|
||||
// future
|
||||
// date
|
||||
nextRuntime = CalendarUtils.getNextRecurringDate(smsCampaign.getRecurrence(), smsCampaign.getNextTriggerDate().toLocalDate(),
|
||||
DateUtils.getLocalDateOfTenant());
|
||||
LocalDateTime nextRuntime = CalendarUtils.getNextRecurringDate(smsCampaign.getRecurrence(), smsCampaign.getNextTriggerDate(),
|
||||
nextTriggerDate);
|
||||
if (nextRuntime.isBefore(DateUtils.getLocalDateTimeOfTenant())) { // means
|
||||
// next
|
||||
// run
|
||||
// time is
|
||||
// in the
|
||||
// past
|
||||
// calculate
|
||||
// a new
|
||||
// future
|
||||
// date
|
||||
nextRuntime = CalendarUtils.getNextRecurringDate(smsCampaign.getRecurrence(), smsCampaign.getNextTriggerDate(),
|
||||
DateUtils.getLocalDateTimeOfTenant());
|
||||
}
|
||||
final LocalDateTime getTime = smsCampaign.getRecurrenceStartDateTime();
|
||||
final String dateString = nextRuntime.toString() + " " + getTime.getHour() + ":" + getTime.getMinute() + ":" + getTime.getSecond();
|
||||
final DateTimeFormatter simpleDateFormat = new DateTimeFormatterBuilder().parseCaseInsensitive().parseLenient()
|
||||
.appendPattern("yyyy-MM-dd HH:mm:ss").toFormatter();
|
||||
final LocalDateTime newTriggerDateWithTime = LocalDateTime.parse(dateString, simpleDateFormat);
|
||||
|
||||
smsCampaign.setNextTriggerDate(Date.from(newTriggerDateWithTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
smsCampaign.setNextTriggerDate(nextRuntime);
|
||||
this.smsCampaignRepository.saveAndFlush(smsCampaign);
|
||||
}
|
||||
|
||||
@@ -466,23 +459,15 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
* if recurrence start date is in the future calculate next trigger date if not use recurrence start date us
|
||||
* next trigger date when activating
|
||||
*/
|
||||
LocalDate nextTriggerDate = null;
|
||||
LocalDateTime nextTriggerDate = null;
|
||||
if (smsCampaign.getRecurrenceStartDateTime().isBefore(tenantDateTime())) {
|
||||
nextTriggerDate = CalendarUtils.getNextRecurringDate(smsCampaign.getRecurrence(), smsCampaign.getRecurrenceStartDate(),
|
||||
DateUtils.getLocalDateOfTenant());
|
||||
DateUtils.getLocalDateTimeOfTenant());
|
||||
} else {
|
||||
nextTriggerDate = smsCampaign.getRecurrenceStartDate();
|
||||
}
|
||||
// to get time of tenant
|
||||
final LocalDateTime getTime = smsCampaign.getRecurrenceStartDateTime();
|
||||
|
||||
final String dateString = nextTriggerDate.toString() + " " + getTime.getHour() + ":" + getTime.getMinute() + ":"
|
||||
+ getTime.getSecond();
|
||||
final DateTimeFormatter simpleDateFormat = new DateTimeFormatterBuilder().parseCaseInsensitive().parseLenient()
|
||||
.appendPattern("yyyy-MM-dd HH:mm:ss").toFormatter();
|
||||
final LocalDateTime nextTriggerDateWithTime = LocalDateTime.parse(dateString, simpleDateFormat);
|
||||
|
||||
smsCampaign.setNextTriggerDate(Date.from(nextTriggerDateWithTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
smsCampaign.setNextTriggerDate(nextTriggerDate);
|
||||
this.smsCampaignRepository.saveAndFlush(smsCampaign);
|
||||
}
|
||||
|
||||
@@ -629,23 +614,17 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
* if recurrence start date is in the future calculate next trigger date if not use recurrence start date us
|
||||
* next trigger date when activating
|
||||
*/
|
||||
LocalDate nextTriggerDate = null;
|
||||
LocalDateTime nextTriggerDate = null;
|
||||
if (smsCampaign.getRecurrenceStartDateTime().isBefore(tenantDateTime())) {
|
||||
nextTriggerDate = CalendarUtils.getNextRecurringDate(smsCampaign.getRecurrence(), smsCampaign.getRecurrenceStartDate(),
|
||||
DateUtils.getLocalDateOfTenant());
|
||||
DateUtils.getLocalDateTimeOfTenant());
|
||||
} else {
|
||||
nextTriggerDate = smsCampaign.getRecurrenceStartDate();
|
||||
}
|
||||
// to get time of tenant
|
||||
final LocalDateTime getTime = smsCampaign.getRecurrenceStartDateTime();
|
||||
|
||||
final String dateString = nextTriggerDate.toString() + " " + getTime.getHour() + ":" + getTime.getMinute() + ":"
|
||||
+ getTime.getSecond();
|
||||
final DateTimeFormatter simpleDateFormat = new DateTimeFormatterBuilder().parseCaseInsensitive().parseLenient()
|
||||
.appendPattern("yyyy-MM-dd HH:mm:ss").toFormatter();
|
||||
final LocalDateTime nextTriggerDateWithTime = LocalDateTime.parse(dateString, simpleDateFormat);
|
||||
|
||||
smsCampaign.setNextTriggerDate(Date.from(nextTriggerDateWithTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
smsCampaign.setNextTriggerDate(nextTriggerDate);
|
||||
}
|
||||
this.smsCampaignRepository.saveAndFlush(smsCampaign);
|
||||
|
||||
@@ -665,8 +644,8 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
LocalDateTime tenantDateNow = tenantDateTime();
|
||||
LocalDateTime nextTriggerDate = smsCampaign.getNextTriggerDate();
|
||||
|
||||
LOG.info("tenant time {} trigger time {} {}",
|
||||
new Object[] { tenantDateNow, nextTriggerDate, JobName.UPDATE_SMS_OUTBOUND_WITH_CAMPAIGN_MESSAGE.name() });
|
||||
LOG.info("tenant time {} trigger time {} {}", tenantDateNow, nextTriggerDate,
|
||||
JobName.UPDATE_SMS_OUTBOUND_WITH_CAMPAIGN_MESSAGE.name());
|
||||
if (nextTriggerDate.isBefore(tenantDateNow)) {
|
||||
insertDirectCampaignIntoSmsOutboundTable(smsCampaign);
|
||||
this.updateTriggerDates(smsCampaign.getId());
|
||||
|
||||
+25
-28
@@ -25,11 +25,11 @@ import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.MonthDay;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.TemporalAccessor;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -255,19 +255,7 @@ public final class JsonCommand {
|
||||
return this.productId;
|
||||
}
|
||||
|
||||
private boolean differenceExistsTime(final LocalDateTime baseValue, final LocalDateTime workingCopyValue) {
|
||||
boolean differenceExists = false;
|
||||
|
||||
if (baseValue != null) {
|
||||
differenceExists = !baseValue.equals(workingCopyValue);
|
||||
} else {
|
||||
differenceExists = workingCopyValue != null;
|
||||
}
|
||||
|
||||
return differenceExists;
|
||||
}
|
||||
|
||||
private boolean differenceExists(final LocalDate baseValue, final LocalDate workingCopyValue) {
|
||||
private boolean differenceExists(final TemporalAccessor baseValue, final TemporalAccessor workingCopyValue) {
|
||||
boolean differenceExists = false;
|
||||
|
||||
if (baseValue != null) {
|
||||
@@ -374,20 +362,29 @@ public final class JsonCommand {
|
||||
return isChangeInLocalDateParameterNamed(parameterName, existingValue);
|
||||
}
|
||||
|
||||
public boolean isChangeInTimeParameterNamed(final String parameterName, final Date existingValue, final String timeFormat) {
|
||||
LocalDateTime time = null;
|
||||
public boolean isChangeInTimeParameterNamed(final String parameterName, final LocalTime existingValue, final String timeFormat) {
|
||||
LocalTime time = null;
|
||||
if (existingValue != null) {
|
||||
DateTimeFormatter timeFormtter = DateTimeFormatter.ofPattern(timeFormat);
|
||||
time = LocalDateTime.parse(existingValue.toString(), timeFormtter);
|
||||
time = LocalTime.parse(existingValue.toString(), timeFormtter);
|
||||
}
|
||||
return isChangeInLocalTimeParameterNamed(parameterName, time);
|
||||
}
|
||||
|
||||
public boolean isChangeInLocalTimeParameterNamed(final String parameterName, final LocalDateTime existingValue) {
|
||||
public boolean isChangeInLocalTimeParameterNamed(final String parameterName, final LocalTime existingValue) {
|
||||
boolean isChanged = false;
|
||||
if (parameterExists(parameterName)) {
|
||||
final LocalDateTime workingValue = localTimeValueOfParameterNamed(parameterName);
|
||||
isChanged = differenceExistsTime(existingValue, workingValue);
|
||||
final LocalTime workingValue = localTimeValueOfParameterNamed(parameterName);
|
||||
isChanged = differenceExists(existingValue, workingValue);
|
||||
}
|
||||
return isChanged;
|
||||
}
|
||||
|
||||
public boolean isChangeInLocalDateTimeParameterNamed(final String parameterName, final LocalDateTime existingValue) {
|
||||
boolean isChanged = false;
|
||||
if (parameterExists(parameterName)) {
|
||||
final LocalTime workingValue = localTimeValueOfParameterNamed(parameterName);
|
||||
isChanged = differenceExists(existingValue, workingValue);
|
||||
}
|
||||
return isChanged;
|
||||
}
|
||||
@@ -405,20 +402,20 @@ public final class JsonCommand {
|
||||
return this.fromApiJsonHelper.extractLocalDateNamed(parameterName, this.parsedCommand);
|
||||
}
|
||||
|
||||
public LocalDateTime localTimeValueOfParameterNamed(final String parameterName) {
|
||||
public LocalTime localTimeValueOfParameterNamed(final String parameterName) {
|
||||
return this.fromApiJsonHelper.extractLocalTimeNamed(parameterName, this.parsedCommand);
|
||||
}
|
||||
|
||||
public LocalDateTime localDateTimeValueOfParameterNamed(final String parameterName) {
|
||||
return this.fromApiJsonHelper.extractLocalDateTimeNamed(parameterName, this.parsedCommand);
|
||||
}
|
||||
|
||||
public MonthDay extractMonthDayNamed(final String parameterName) {
|
||||
return this.fromApiJsonHelper.extractMonthDayNamed(parameterName, this.parsedCommand);
|
||||
}
|
||||
|
||||
public Date dateValueOfParameterNamed(final String parameterName) {
|
||||
final LocalDate localDate = this.fromApiJsonHelper.extractLocalDateNamed(parameterName, this.parsedCommand);
|
||||
if (localDate == null) {
|
||||
return null;
|
||||
}
|
||||
return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
public LocalDate dateValueOfParameterNamed(final String parameterName) {
|
||||
return this.fromApiJsonHelper.extractLocalDateNamed(parameterName, this.parsedCommand);
|
||||
}
|
||||
|
||||
public boolean isChangeInStringParameterNamed(final String parameterName, final String existingValue) {
|
||||
|
||||
+6
-5
@@ -18,9 +18,10 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.core.data;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeFormatterBuilder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public final class ApiParameterError {
|
||||
@@ -91,9 +92,9 @@ public final class ApiParameterError {
|
||||
final List<ApiErrorMessageArg> messageArgs = new ArrayList<>();
|
||||
if (defaultUserMessageArgs != null) {
|
||||
for (final Object object : defaultUserMessageArgs) {
|
||||
if (object instanceof Date) {
|
||||
final SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||
final String formattedDate = dateFormatter.format(object);
|
||||
if (object instanceof LocalDate) {
|
||||
final DateTimeFormatter dateFormatter = new DateTimeFormatterBuilder().appendPattern("yyyy-MM-dd").toFormatter();
|
||||
final String formattedDate = dateFormatter.format((LocalDate) object);
|
||||
messageArgs.add(ApiErrorMessageArg.from(formattedDate));
|
||||
} else {
|
||||
messageArgs.add(ApiErrorMessageArg.from(object));
|
||||
|
||||
+12
-17
@@ -18,13 +18,10 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.core.domain;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Optional;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.MappedSuperclass;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.springframework.data.domain.Auditable;
|
||||
import org.springframework.data.jpa.domain.AbstractAuditable;
|
||||
|
||||
@@ -40,7 +37,7 @@ import org.springframework.data.jpa.domain.AbstractAuditable;
|
||||
* the type of the auditing type's identifier
|
||||
*/
|
||||
@MappedSuperclass
|
||||
public abstract class AbstractAuditableCustom extends AbstractPersistableCustom implements Auditable<Long, Long, Instant> {
|
||||
public abstract class AbstractAuditableCustom extends AbstractPersistableCustom implements Auditable<Long, Long, LocalDateTime> {
|
||||
|
||||
private static final long serialVersionUID = 141481953116476081L;
|
||||
|
||||
@@ -48,15 +45,13 @@ public abstract class AbstractAuditableCustom extends AbstractPersistableCustom
|
||||
private Long createdBy;
|
||||
|
||||
@Column(name = "created_date")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date createdDate;
|
||||
private LocalDateTime createdDate;
|
||||
|
||||
@Column(name = "lastmodifiedby_id")
|
||||
private Long lastModifiedBy;
|
||||
|
||||
@Column(name = "lastmodified_date")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date lastModifiedDate;
|
||||
private LocalDateTime lastModifiedDate;
|
||||
|
||||
@Override
|
||||
public Optional<Long> getCreatedBy() {
|
||||
@@ -69,13 +64,13 @@ public abstract class AbstractAuditableCustom extends AbstractPersistableCustom
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Instant> getCreatedDate() {
|
||||
return null == this.createdDate ? Optional.empty() : Optional.of(this.createdDate.toInstant());
|
||||
public Optional<LocalDateTime> getCreatedDate() {
|
||||
return null == this.createdDate ? Optional.empty() : Optional.of(this.createdDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCreatedDate(final Instant createdDate) {
|
||||
this.createdDate = null == createdDate ? null : Date.from(createdDate);
|
||||
public void setCreatedDate(final LocalDateTime createdDate) {
|
||||
this.createdDate = createdDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,12 +84,12 @@ public abstract class AbstractAuditableCustom extends AbstractPersistableCustom
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Instant> getLastModifiedDate() {
|
||||
return null == this.lastModifiedDate ? Optional.empty() : Optional.of(this.lastModifiedDate.toInstant());
|
||||
public Optional<LocalDateTime> getLastModifiedDate() {
|
||||
return null == this.lastModifiedDate ? Optional.empty() : Optional.of(this.lastModifiedDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLastModifiedDate(final Instant lastModifiedDate) {
|
||||
this.lastModifiedDate = null == lastModifiedDate ? null : Date.from(lastModifiedDate);
|
||||
public void setLastModifiedDate(final LocalDateTime lastModifiedDate) {
|
||||
this.lastModifiedDate = lastModifiedDate;
|
||||
}
|
||||
}
|
||||
|
||||
+17
-3
@@ -28,6 +28,7 @@ import java.math.BigDecimal;
|
||||
import java.security.InvalidParameterException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.MonthDay;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -203,19 +204,32 @@ public class FromJsonHelper {
|
||||
return this.helperDelegator.extractLocalDateNamed(parameterName, element, new HashSet<>());
|
||||
}
|
||||
|
||||
public LocalDateTime extractLocalTimeNamed(final String parameterName, final JsonElement element) {
|
||||
public LocalTime extractLocalTimeNamed(final String parameterName, final JsonElement element) {
|
||||
return this.helperDelegator.extractLocalTimeNamed(parameterName, element, new HashSet<>());
|
||||
}
|
||||
|
||||
public LocalDateTime extractLocalTimeNamed(final String parameterName, final JsonElement element, final String dateFormat,
|
||||
public LocalDateTime extractLocalDateTimeNamed(final String parameterName, final JsonElement element) {
|
||||
return this.helperDelegator.extractLocalDateTimeNamed(parameterName, element, new HashSet<>());
|
||||
}
|
||||
|
||||
public LocalTime extractLocalTimeNamed(final String parameterName, final JsonElement element, final String dateFormat,
|
||||
final Locale locale) {
|
||||
return this.helperDelegator.extractLocalTimeNamed(parameterName, element, dateFormat, locale, new HashSet<>());
|
||||
}
|
||||
|
||||
public LocalDateTime extractLocalTimeNamed(final String parameterName, final JsonElement element, String timeFormat) {
|
||||
public LocalTime extractLocalTimeNamed(final String parameterName, final JsonElement element, String timeFormat) {
|
||||
return this.helperDelegator.extractLocalTimeNamed(parameterName, element, timeFormat, new HashSet<>());
|
||||
}
|
||||
|
||||
public LocalDateTime extractLocalDateTimeNamed(final String parameterName, final JsonElement element, final String dateFormat,
|
||||
final Locale locale) {
|
||||
return this.helperDelegator.extractLocalDateTimeNamed(parameterName, element, dateFormat, locale, new HashSet<>());
|
||||
}
|
||||
|
||||
public LocalDateTime extractLocalDateTimeNamed(final String parameterName, final JsonElement element, String timeFormat) {
|
||||
return this.helperDelegator.extractLocalDateTimeNamed(parameterName, element, timeFormat, new HashSet<>());
|
||||
}
|
||||
|
||||
public LocalDate extractLocalDateNamed(final String parameterName, final JsonElement element, final String dateFormat,
|
||||
final Locale locale) {
|
||||
return this.helperDelegator.extractLocalDateNamed(parameterName, element.getAsJsonObject(), dateFormat, locale, new HashSet<>());
|
||||
|
||||
+62
-4
@@ -29,6 +29,7 @@ import java.text.NumberFormat;
|
||||
import java.text.ParseException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.MonthDay;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeFormatterBuilder;
|
||||
@@ -370,10 +371,10 @@ public class JsonParserHelper {
|
||||
return value;
|
||||
}
|
||||
|
||||
public LocalDateTime extractLocalTimeNamed(final String parameterName, final JsonElement element,
|
||||
public LocalTime extractLocalTimeNamed(final String parameterName, final JsonElement element,
|
||||
final Set<String> parametersPassedInCommand) {
|
||||
|
||||
LocalDateTime value = null;
|
||||
LocalTime value = null;
|
||||
|
||||
if (element.isJsonObject()) {
|
||||
final JsonObject object = element.getAsJsonObject();
|
||||
@@ -382,11 +383,23 @@ public class JsonParserHelper {
|
||||
return value;
|
||||
}
|
||||
|
||||
public LocalDateTime extractLocalTimeNamed(final String parameterName, final JsonElement element, String timeFormat,
|
||||
public LocalDateTime extractLocalDateTimeNamed(final String parameterName, final JsonElement element,
|
||||
final Set<String> parametersPassedInCommand) {
|
||||
|
||||
LocalDateTime value = null;
|
||||
|
||||
if (element.isJsonObject()) {
|
||||
final JsonObject object = element.getAsJsonObject();
|
||||
value = extractLocalDateTimeNamed(parameterName, element, extractTimeFormatParameter(object), parametersPassedInCommand);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public LocalTime extractLocalTimeNamed(final String parameterName, final JsonElement element, String timeFormat,
|
||||
final Set<String> parametersPassedInCommand) {
|
||||
|
||||
LocalTime value = null;
|
||||
|
||||
if (element.isJsonObject()) {
|
||||
final JsonObject object = element.getAsJsonObject();
|
||||
final Locale clientApplicationLocale = extractLocaleParameter(object);
|
||||
@@ -395,7 +408,52 @@ public class JsonParserHelper {
|
||||
return value;
|
||||
}
|
||||
|
||||
public LocalDateTime extractLocalTimeNamed(final String parameterName, final JsonElement element, final String timeFormat,
|
||||
public LocalDateTime extractLocalDateTimeNamed(final String parameterName, final JsonElement element, String timeFormat,
|
||||
final Set<String> parametersPassedInCommand) {
|
||||
|
||||
LocalDateTime value = null;
|
||||
|
||||
if (element.isJsonObject()) {
|
||||
final JsonObject object = element.getAsJsonObject();
|
||||
final Locale clientApplicationLocale = extractLocaleParameter(object);
|
||||
value = extractLocalDateTimeNamed(parameterName, object, timeFormat, clientApplicationLocale, parametersPassedInCommand);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public LocalTime extractLocalTimeNamed(final String parameterName, final JsonElement element, final String timeFormat,
|
||||
final Locale clientApplicationLocale, final Set<String> parametersPassedInCommand) {
|
||||
LocalTime value = null;
|
||||
String timeValueAsString = null;
|
||||
if (element.isJsonObject()) {
|
||||
final JsonObject object = element.getAsJsonObject();
|
||||
if (object.has(parameterName) && object.get(parameterName).isJsonPrimitive()) {
|
||||
parametersPassedInCommand.add(parameterName);
|
||||
|
||||
try {
|
||||
DateTimeFormatter timeFormtter = DateTimeFormatter.ofPattern(timeFormat);
|
||||
final JsonPrimitive primitive = object.get(parameterName).getAsJsonPrimitive();
|
||||
timeValueAsString = primitive.getAsString();
|
||||
if (StringUtils.isNotBlank(timeValueAsString)) {
|
||||
value = LocalTime.parse(timeValueAsString, timeFormtter);
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final String defaultMessage = new StringBuilder("The parameter `" + timeValueAsString + "` is not in correct format.")
|
||||
.toString();
|
||||
final ApiParameterError error = ApiParameterError.parameterError("validation.msg.invalid.TimeFormat", defaultMessage,
|
||||
parameterName);
|
||||
dataValidationErrors.add(error);
|
||||
throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist", "Validation errors exist.",
|
||||
dataValidationErrors, e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public LocalDateTime extractLocalDateTimeNamed(final String parameterName, final JsonElement element, final String timeFormat,
|
||||
final Locale clientApplicationLocale, final Set<String> parametersPassedInCommand) {
|
||||
LocalDateTime value = null;
|
||||
String timeValueAsString = null;
|
||||
|
||||
+2
-46
@@ -18,9 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.core.service;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
@@ -29,8 +26,6 @@ import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeFormatterBuilder;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
@@ -68,26 +63,6 @@ public final class DateUtils {
|
||||
return zone;
|
||||
}
|
||||
|
||||
public static Date getDateOfTenant() {
|
||||
return convertLocalDateToDate(getLocalDateOfTenant());
|
||||
}
|
||||
|
||||
private static Date convertLocalDateToDate(LocalDate localDate) {
|
||||
return createDate(localDate.getYear(), localDate.getMonthValue(), localDate.getDayOfMonth());
|
||||
}
|
||||
|
||||
public static LocalDate convertToLocalDate(final Date dateToConvert, final ZoneId zoneId) {
|
||||
return dateToConvert.toInstant().atZone(zoneId).toLocalDate();
|
||||
}
|
||||
|
||||
public static Date createDate(int year, int month, int day) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(Calendar.YEAR, year);
|
||||
cal.set(Calendar.MONTH, month - 1);
|
||||
cal.set(Calendar.DAY_OF_MONTH, day);
|
||||
return cal.getTime();
|
||||
}
|
||||
|
||||
public static LocalDate getLocalDateOfTenant() {
|
||||
final ZoneId zone = getDateTimeZoneOfTenant();
|
||||
return LocalDate.now(zone);
|
||||
@@ -98,17 +73,8 @@ public final class DateUtils {
|
||||
return LocalDateTime.now(zone).truncatedTo(ChronoUnit.SECONDS);
|
||||
}
|
||||
|
||||
public static Date parseDate(final String stringDate, final String pattern, final ZoneId zoneId) {
|
||||
try {
|
||||
return new SimpleDateFormat(pattern).parse(stringDate);
|
||||
} catch (final ParseException e) {
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
final ApiParameterError error = ApiParameterError.parameterError("validation.msg.invalid.date.pattern",
|
||||
"The parameter date (" + stringDate + ") is invalid w.r.t. pattern " + pattern, "date", stringDate, pattern);
|
||||
dataValidationErrors.add(error);
|
||||
throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist", "Validation errors exist.",
|
||||
dataValidationErrors, e);
|
||||
}
|
||||
public static LocalDateTime getLocalDateTimeOfSystem() {
|
||||
return LocalDateTime.now(ZoneId.systemDefault()).truncatedTo(ChronoUnit.SECONDS);
|
||||
}
|
||||
|
||||
public static LocalDate parseLocalDate(final String stringDate, final String pattern, final ZoneId zoneId) {
|
||||
@@ -136,12 +102,6 @@ public final class DateUtils {
|
||||
return parseLocalDate(stringDate, pattern, getDateTimeZoneOfTenant());
|
||||
}
|
||||
|
||||
public static String formatToSqlDate(final Date date) {
|
||||
final DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
df.setTimeZone(getTimeZoneOfTenant());
|
||||
return df.format(date);
|
||||
}
|
||||
|
||||
public static boolean isDateInTheFuture(final LocalDate localDate) {
|
||||
return localDate.isAfter(getLocalDateOfTenant());
|
||||
}
|
||||
@@ -150,8 +110,4 @@ public final class DateUtils {
|
||||
return ThreadLocalContextUtil.getBusinessDate();
|
||||
}
|
||||
|
||||
public static Date getBusinessDate() {
|
||||
return Date.from(ThreadLocalContextUtil.getBusinessDate().atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+8
-14
@@ -19,10 +19,9 @@
|
||||
|
||||
package org.apache.fineract.infrastructure.creditbureau.domain;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeFormatterBuilder;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
@@ -53,7 +52,7 @@ public class CreditBureauToken extends AbstractPersistableCustom {
|
||||
private String issued;
|
||||
|
||||
@Column(name = "expiry_date")
|
||||
private Date expires;
|
||||
private LocalDate expires;
|
||||
|
||||
public static CreditBureauToken fromJson(final JsonCommand command) {
|
||||
final String userName = command.stringValueOfParameterNamed("userName");
|
||||
@@ -63,19 +62,14 @@ public class CreditBureauToken extends AbstractPersistableCustom {
|
||||
final String issued = command.stringValueOfParameterNamed(".issued");
|
||||
final String expiry = command.stringValueOfParameterNamed(".expires");
|
||||
|
||||
SimpleDateFormat dateformat = new SimpleDateFormat("EEE, dd MMM yyyy kk:mm:ss zzz", Locale.ENGLISH);
|
||||
DateTimeFormatter dateformat = new DateTimeFormatterBuilder().appendPattern("EEE, dd MMM yyyy kk:mm:ss zzz").toFormatter();
|
||||
|
||||
Date expires = null;
|
||||
try {
|
||||
expires = dateformat.parse(expiry);
|
||||
} catch (ParseException Ex) {
|
||||
LOG.error("Error occured while converting Date(String) to SimpleDateFormat", Ex);
|
||||
}
|
||||
LocalDate expires = LocalDate.parse(expiry, dateformat);
|
||||
|
||||
return new CreditBureauToken(userName, accessToken, tokenType, expiresIn, issued, expires);
|
||||
}
|
||||
|
||||
public CreditBureauToken(String userName, String accessToken, String tokenType, String expiresIn, String issued, Date expires) {
|
||||
public CreditBureauToken(String userName, String accessToken, String tokenType, String expiresIn, String issued, LocalDate expires) {
|
||||
this.userName = userName;
|
||||
this.accessToken = accessToken;
|
||||
this.tokenType = tokenType;
|
||||
@@ -109,7 +103,7 @@ public class CreditBureauToken extends AbstractPersistableCustom {
|
||||
this.accessToken = tokens;
|
||||
}
|
||||
|
||||
public Date getTokenExpiryDate() {
|
||||
public LocalDate getTokenExpiryDate() {
|
||||
return this.expires;
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -27,8 +27,8 @@ import com.google.gson.JsonParser;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.MediaType;
|
||||
@@ -45,6 +45,7 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauConfigurations;
|
||||
import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauReportData;
|
||||
import org.apache.fineract.infrastructure.creditbureau.domain.CreditBureauConfiguration;
|
||||
@@ -412,10 +413,10 @@ public class ThitsaWorksCreditBureauIntegrationWritePlatformServiceImpl implemen
|
||||
|
||||
// check the expiry date of the previous token.
|
||||
if (creditBureauToken != null) {
|
||||
Date current = new Date();
|
||||
Date getExpiryDate = creditBureauToken.getTokenExpiryDate();
|
||||
LocalDate current = DateUtils.getLocalDateOfTenant();
|
||||
LocalDate getExpiryDate = creditBureauToken.getTokenExpiryDate();
|
||||
|
||||
if (getExpiryDate.before(current)) {
|
||||
if (getExpiryDate.isBefore(current)) {
|
||||
this.tokenRepositoryWrapper.delete(creditBureauToken);
|
||||
creditBureauToken = null;
|
||||
}
|
||||
|
||||
+6
-6
@@ -19,7 +19,7 @@
|
||||
package org.apache.fineract.infrastructure.entityaccess.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
|
||||
public final class FineractEntityToEntityMappingData implements Serializable {
|
||||
|
||||
@@ -36,10 +36,10 @@ public final class FineractEntityToEntityMappingData implements Serializable {
|
||||
private Long toId;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private Date startDate;
|
||||
private LocalDate startDate;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private Date endDate;
|
||||
private LocalDate endDate;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final String fromEntity;
|
||||
@@ -48,7 +48,7 @@ public final class FineractEntityToEntityMappingData implements Serializable {
|
||||
private final String toEntity;
|
||||
|
||||
private FineractEntityToEntityMappingData(final Long mapId, final Long relationId, final Long fromId, final Long toId,
|
||||
final Date startDate, final Date endDate, final String fromEntity, final String toEntity) {
|
||||
final LocalDate startDate, final LocalDate endDate, final String fromEntity, final String toEntity) {
|
||||
this.mapId = mapId;
|
||||
this.relationId = relationId;
|
||||
this.fromId = fromId;
|
||||
@@ -60,14 +60,14 @@ public final class FineractEntityToEntityMappingData implements Serializable {
|
||||
}
|
||||
|
||||
public static FineractEntityToEntityMappingData getRelatedEntities(final Long mapId, final Long relationId, final Long fromId,
|
||||
final Long toId, final Date startDate, final Date endDate, final String fromEntity, final String toEntity) {
|
||||
final Long toId, final LocalDate startDate, final LocalDate endDate, final String fromEntity, final String toEntity) {
|
||||
|
||||
return new FineractEntityToEntityMappingData(mapId, relationId, fromId, toId, startDate, endDate, fromEntity, toEntity);
|
||||
|
||||
}
|
||||
|
||||
public static FineractEntityToEntityMappingData getRelatedEntities(final Long relationId, final Long fromId, final Long toId,
|
||||
final Date startDate, final Date endDate) {
|
||||
final LocalDate startDate, final LocalDate endDate) {
|
||||
final Long mapId = null;
|
||||
final String fromEntity = null;
|
||||
final String toEntity = null;
|
||||
|
||||
+9
-4
@@ -18,10 +18,11 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.entityaccess.service;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import org.apache.fineract.infrastructure.entityaccess.data.FineractEntityRelationData;
|
||||
import org.apache.fineract.infrastructure.entityaccess.data.FineractEntityToEntityMappingData;
|
||||
import org.apache.fineract.infrastructure.entityaccess.domain.FineractEntityAccessType;
|
||||
@@ -242,7 +243,9 @@ public class FineractEntityAccessReadServiceImpl implements FineractEntityAccess
|
||||
final Long toId = rs.getLong("toId");
|
||||
final Date startDate = rs.getDate("startDate");
|
||||
final Date endDate = rs.getDate("endDate");
|
||||
return FineractEntityToEntityMappingData.getRelatedEntities(relId, fromId, toId, startDate, endDate);
|
||||
final LocalDate startLocalDate = startDate != null ? startDate.toLocalDate() : null;
|
||||
final LocalDate endLocalDate = endDate != null ? endDate.toLocalDate() : null;
|
||||
return FineractEntityToEntityMappingData.getRelatedEntities(relId, fromId, toId, startLocalDate, endLocalDate);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -314,8 +317,10 @@ public class FineractEntityAccessReadServiceImpl implements FineractEntityAccess
|
||||
final String toEntity = rs.getString("to_name");
|
||||
final Date startDate = rs.getDate("startDate");
|
||||
final Date endDate = rs.getDate("endDate");
|
||||
return FineractEntityToEntityMappingData.getRelatedEntities(mapId, relId, fromId, toId, startDate, endDate, fromEntity,
|
||||
toEntity);
|
||||
final LocalDate startLocalDate = startDate != null ? startDate.toLocalDate() : null;
|
||||
final LocalDate endLocalDate = endDate != null ? endDate.toLocalDate() : null;
|
||||
return FineractEntityToEntityMappingData.getRelatedEntities(mapId, relId, fromId, toId, startLocalDate, endLocalDate,
|
||||
fromEntity, toEntity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-8
@@ -18,14 +18,12 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.gcm.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.portfolio.client.domain.Client;
|
||||
@@ -42,15 +40,14 @@ public final class DeviceRegistration extends AbstractPersistableCustom {
|
||||
private String registrationId;
|
||||
|
||||
@Column(name = "updatedon_date", nullable = false)
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date updatedOnDate;
|
||||
private LocalDateTime updatedOnDate;
|
||||
|
||||
private DeviceRegistration() {}
|
||||
|
||||
private DeviceRegistration(final Client client, final String registrationId) {
|
||||
this.client = client;
|
||||
this.registrationId = registrationId;
|
||||
this.updatedOnDate = Date.from(DateUtils.getLocalDateTimeOfTenant().atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.updatedOnDate = DateUtils.getLocalDateTimeOfTenant();
|
||||
}
|
||||
|
||||
public static DeviceRegistration instance(final Client client, final String registrationId) {
|
||||
@@ -73,11 +70,11 @@ public final class DeviceRegistration extends AbstractPersistableCustom {
|
||||
this.registrationId = registrationId;
|
||||
}
|
||||
|
||||
public Date getUpdatedOnDate() {
|
||||
public LocalDateTime getUpdatedOnDate() {
|
||||
return this.updatedOnDate;
|
||||
}
|
||||
|
||||
public void setUpdatedOnDate(Date updatedOnDate) {
|
||||
public void setUpdatedOnDate(LocalDateTime updatedOnDate) {
|
||||
this.updatedOnDate = updatedOnDate;
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.gcm.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDateTime;
|
||||
import org.apache.fineract.portfolio.client.data.ClientData;
|
||||
|
||||
public final class DeviceRegistrationData {
|
||||
@@ -26,9 +26,10 @@ public final class DeviceRegistrationData {
|
||||
public Long id;
|
||||
public ClientData clientData;
|
||||
public String registrationId;
|
||||
public Date updatedOnDate;
|
||||
public LocalDateTime updatedOnDate;
|
||||
|
||||
private DeviceRegistrationData(final Long id, final ClientData clientData, final String registrationId, final Date updatedOnDate) {
|
||||
private DeviceRegistrationData(final Long id, final ClientData clientData, final String registrationId,
|
||||
final LocalDateTime updatedOnDate) {
|
||||
this.id = id;
|
||||
this.clientData = clientData;
|
||||
this.registrationId = registrationId;
|
||||
@@ -36,7 +37,7 @@ public final class DeviceRegistrationData {
|
||||
}
|
||||
|
||||
public static DeviceRegistrationData instance(final Long id, final ClientData clientData, final String registrationId,
|
||||
final Date updatedOnDate) {
|
||||
final LocalDateTime updatedOnDate) {
|
||||
return new DeviceRegistrationData(id, clientData, registrationId, updatedOnDate);
|
||||
}
|
||||
|
||||
|
||||
+3
-6
@@ -20,10 +20,8 @@ package org.apache.fineract.infrastructure.gcm.service;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.apache.fineract.infrastructure.gcm.domain.DeviceRegistrationData;
|
||||
import org.apache.fineract.infrastructure.gcm.exception.DeviceRegistrationNotFoundException;
|
||||
@@ -68,13 +66,12 @@ public class DeviceRegistrationReadPlatformServiceImpl implements DeviceRegistra
|
||||
public DeviceRegistrationData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
||||
|
||||
final Long id = JdbcSupport.getLong(rs, "id");
|
||||
final LocalDate updatedOnDate = JdbcSupport.getLocalDate(rs, "updatedOnDate");
|
||||
final LocalDateTime updatedOnDate = JdbcSupport.getLocalDateTime(rs, "updatedOnDate");
|
||||
final String registrationId = rs.getString("registrationId");
|
||||
final Long clientId = rs.getLong("clientId");
|
||||
final String clientName = rs.getString("clientName");
|
||||
ClientData clientData = ClientData.instance(clientId, clientName);
|
||||
return DeviceRegistrationData.instance(id, clientData, registrationId,
|
||||
Date.from(updatedOnDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
return DeviceRegistrationData.instance(id, clientData, registrationId, updatedOnDate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.gcm.service;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.persistence.EntityExistsException;
|
||||
import javax.persistence.PersistenceException;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
@@ -94,8 +93,7 @@ public class DeviceRegistrationWritePlatformServiceImpl implements DeviceRegistr
|
||||
Client client = this.clientRepositoryWrapper.findOneWithNotFoundDetection(clientId);
|
||||
deviceRegistration.setClient(client);
|
||||
deviceRegistration.setRegistrationId(registrationId);
|
||||
deviceRegistration
|
||||
.setUpdatedOnDate(Date.from(DateUtils.getLocalDateTimeOfTenant().atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant()));
|
||||
deviceRegistration.setUpdatedOnDate(DateUtils.getLocalDateTimeOfTenant());
|
||||
return deviceRegistration;
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -19,10 +19,8 @@
|
||||
package org.apache.fineract.infrastructure.gcm.service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -109,8 +107,7 @@ public class NotificationSenderService {
|
||||
res = s.send(msg, registrationId, 3);
|
||||
if (res.getSuccess() != null && res.getSuccess() > 0) {
|
||||
smsMessage.setStatusType(SmsMessageStatusType.SENT.getValue());
|
||||
smsMessage.setDeliveredOnDate(
|
||||
Date.from(DateUtils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
smsMessage.setDeliveredOnDate(DateUtils.getLocalDateTimeOfTenant());
|
||||
} else if (res.getFailure() != null && res.getFailure() > 0) {
|
||||
smsMessage.setStatusType(SmsMessageStatusType.FAILED.getValue());
|
||||
}
|
||||
|
||||
+18
-32
@@ -19,9 +19,7 @@
|
||||
package org.apache.fineract.infrastructure.reportmailingjob.domain;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import javax.persistence.Column;
|
||||
@@ -29,8 +27,6 @@ import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
@@ -55,8 +51,7 @@ public class ReportMailingJob extends AbstractAuditableCustom {
|
||||
private String description;
|
||||
|
||||
@Column(name = "start_datetime", nullable = false)
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date startDateTime;
|
||||
private LocalDateTime startDateTime;
|
||||
|
||||
@Column(name = "recurrence", nullable = true)
|
||||
private String recurrence;
|
||||
@@ -81,12 +76,10 @@ public class ReportMailingJob extends AbstractAuditableCustom {
|
||||
private String stretchyReportParamMap;
|
||||
|
||||
@Column(name = "previous_run_datetime", nullable = true)
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date previousRunDateTime;
|
||||
private LocalDateTime previousRunDateTime;
|
||||
|
||||
@Column(name = "next_run_datetime", nullable = true)
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date nextRunDateTime;
|
||||
private LocalDateTime nextRunDateTime;
|
||||
|
||||
@Column(name = "previous_run_status", nullable = true)
|
||||
private String previousRunStatus;
|
||||
@@ -129,7 +122,7 @@ public class ReportMailingJob extends AbstractAuditableCustom {
|
||||
this.startDateTime = null;
|
||||
|
||||
if (startDateTime != null) {
|
||||
this.startDateTime = Date.from(startDateTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.startDateTime = startDateTime;
|
||||
}
|
||||
|
||||
this.recurrence = recurrence;
|
||||
@@ -142,13 +135,13 @@ public class ReportMailingJob extends AbstractAuditableCustom {
|
||||
this.previousRunDateTime = null;
|
||||
|
||||
if (previousRunDateTime != null) {
|
||||
this.previousRunDateTime = Date.from(previousRunDateTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.previousRunDateTime = previousRunDateTime;
|
||||
}
|
||||
|
||||
this.nextRunDateTime = null;
|
||||
|
||||
if (nextRunDateTime != null) {
|
||||
this.nextRunDateTime = Date.from(nextRunDateTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.nextRunDateTime = nextRunDateTime;
|
||||
}
|
||||
|
||||
this.previousRunStatus = null;
|
||||
@@ -307,14 +300,12 @@ public class ReportMailingJob extends AbstractAuditableCustom {
|
||||
final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(jsonCommand.dateFormat())
|
||||
.withLocale(jsonCommand.extractLocale());
|
||||
final LocalDateTime newStartDateTime = LocalDateTime.parse(newStartDateTimeString, dateTimeFormatter);
|
||||
final LocalDateTime oldStartDateTime = (this.startDateTime != null)
|
||||
? ZonedDateTime.ofInstant(this.startDateTime.toInstant(), DateUtils.getDateTimeZoneOfTenant()).toLocalDateTime()
|
||||
: null;
|
||||
final LocalDateTime oldStartDateTime = this.startDateTime;
|
||||
|
||||
if ((oldStartDateTime != null) && !newStartDateTime.equals(oldStartDateTime)) {
|
||||
actualChanges.put(ReportMailingJobConstants.START_DATE_TIME_PARAM_NAME, newStartDateTimeString);
|
||||
|
||||
this.startDateTime = Date.from(newStartDateTime.atZone(DateUtils.getDateTimeZoneOfTenant()).toInstant());
|
||||
this.startDateTime = newStartDateTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,9 +365,8 @@ public class ReportMailingJob extends AbstractAuditableCustom {
|
||||
/**
|
||||
* @return the value of the startDateTime property
|
||||
**/
|
||||
public ZonedDateTime getStartDateTime() {
|
||||
return (this.startDateTime != null) ? ZonedDateTime.ofInstant(this.startDateTime.toInstant(), DateUtils.getDateTimeZoneOfTenant())
|
||||
: null;
|
||||
public LocalDateTime getStartDateTime() {
|
||||
return this.startDateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -459,19 +449,15 @@ public class ReportMailingJob extends AbstractAuditableCustom {
|
||||
/**
|
||||
* @return the previousRunDateTime
|
||||
*/
|
||||
public ZonedDateTime getPreviousRunDateTime() {
|
||||
return (this.previousRunDateTime != null)
|
||||
? ZonedDateTime.ofInstant(this.previousRunDateTime.toInstant(), DateUtils.getDateTimeZoneOfTenant())
|
||||
: null;
|
||||
public LocalDateTime getPreviousRunDateTime() {
|
||||
return this.previousRunDateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nextRunDateTime
|
||||
*/
|
||||
public ZonedDateTime getNextRunDateTime() {
|
||||
return (this.nextRunDateTime != null)
|
||||
? ZonedDateTime.ofInstant(this.nextRunDateTime.toInstant(), DateUtils.getDateTimeZoneOfTenant())
|
||||
: null;
|
||||
public LocalDateTime getNextRunDateTime() {
|
||||
return this.nextRunDateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -538,9 +524,9 @@ public class ReportMailingJob extends AbstractAuditableCustom {
|
||||
* -- previous run date
|
||||
*
|
||||
**/
|
||||
public void updatePreviousRunDateTime(final ZonedDateTime previousRunDateTime) {
|
||||
public void updatePreviousRunDateTime(final LocalDateTime previousRunDateTime) {
|
||||
if (previousRunDateTime != null) {
|
||||
this.previousRunDateTime = Date.from(previousRunDateTime.toInstant());
|
||||
this.previousRunDateTime = previousRunDateTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -551,9 +537,9 @@ public class ReportMailingJob extends AbstractAuditableCustom {
|
||||
* -- the next run DateTime
|
||||
*
|
||||
**/
|
||||
public void updateNextRunDateTime(final ZonedDateTime nextRunDateTime) {
|
||||
public void updateNextRunDateTime(final LocalDateTime nextRunDateTime) {
|
||||
if (nextRunDateTime != null) {
|
||||
this.nextRunDateTime = Date.from(nextRunDateTime.toInstant());
|
||||
this.nextRunDateTime = nextRunDateTime;
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
+13
-21
@@ -18,17 +18,13 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.reportmailingjob.domain;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
|
||||
@Entity
|
||||
@Table(name = "m_report_mailing_job_run_history")
|
||||
@@ -41,12 +37,10 @@ public class ReportMailingJobRunHistory extends AbstractPersistableCustom {
|
||||
private ReportMailingJob reportMailingJob;
|
||||
|
||||
@Column(name = "start_datetime", nullable = false)
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date startDateTime;
|
||||
private LocalDateTime startDateTime;
|
||||
|
||||
@Column(name = "end_datetime", nullable = false)
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date endDateTime;
|
||||
private LocalDateTime endDateTime;
|
||||
|
||||
@Column(name = "status", nullable = false)
|
||||
private String status;
|
||||
@@ -65,19 +59,19 @@ public class ReportMailingJobRunHistory extends AbstractPersistableCustom {
|
||||
/**
|
||||
* ReportMailingJobRunHistory private constructor
|
||||
**/
|
||||
private ReportMailingJobRunHistory(final ReportMailingJob reportMailingJob, final ZonedDateTime startDateTime,
|
||||
final ZonedDateTime endDateTime, final String status, final String errorMessage, final String errorLog) {
|
||||
private ReportMailingJobRunHistory(final ReportMailingJob reportMailingJob, final LocalDateTime startDateTime,
|
||||
final LocalDateTime endDateTime, final String status, final String errorMessage, final String errorLog) {
|
||||
this.reportMailingJob = reportMailingJob;
|
||||
this.startDateTime = null;
|
||||
|
||||
if (startDateTime != null) {
|
||||
this.startDateTime = Date.from(startDateTime.toInstant());
|
||||
this.startDateTime = startDateTime;
|
||||
}
|
||||
|
||||
this.endDateTime = null;
|
||||
|
||||
if (endDateTime != null) {
|
||||
this.endDateTime = Date.from(endDateTime.toInstant());
|
||||
this.endDateTime = endDateTime;
|
||||
}
|
||||
|
||||
this.status = status;
|
||||
@@ -90,8 +84,8 @@ public class ReportMailingJobRunHistory extends AbstractPersistableCustom {
|
||||
*
|
||||
* @return ReportMailingJobRunHistory object
|
||||
**/
|
||||
public static ReportMailingJobRunHistory newInstance(final ReportMailingJob reportMailingJob, final ZonedDateTime startDateTime,
|
||||
final ZonedDateTime endDateTime, final String status, final String errorMessage, final String errorLog) {
|
||||
public static ReportMailingJobRunHistory newInstance(final ReportMailingJob reportMailingJob, final LocalDateTime startDateTime,
|
||||
final LocalDateTime endDateTime, final String status, final String errorMessage, final String errorLog) {
|
||||
return new ReportMailingJobRunHistory(reportMailingJob, startDateTime, endDateTime, status, errorMessage, errorLog);
|
||||
}
|
||||
|
||||
@@ -105,17 +99,15 @@ public class ReportMailingJobRunHistory extends AbstractPersistableCustom {
|
||||
/**
|
||||
* @return the startDateTime
|
||||
*/
|
||||
public ZonedDateTime getStartDateTime() {
|
||||
return (this.startDateTime != null) ? ZonedDateTime.ofInstant(this.startDateTime.toInstant(), DateUtils.getDateTimeZoneOfTenant())
|
||||
: null;
|
||||
public LocalDateTime getStartDateTime() {
|
||||
return this.startDateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the endDateTime
|
||||
*/
|
||||
public ZonedDateTime getEndDateTime() {
|
||||
return (this.endDateTime != null) ? ZonedDateTime.ofInstant(this.endDateTime.toInstant(), DateUtils.getDateTimeZoneOfTenant())
|
||||
: null;
|
||||
public LocalDateTime getEndDateTime() {
|
||||
return this.endDateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+26
-35
@@ -23,9 +23,7 @@ import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
@@ -152,8 +150,8 @@ public class ReportMailingJobWritePlatformServiceImpl implements ReportMailingJo
|
||||
// get the recurrence rule string
|
||||
final String recurrence = reportMailingJob.getRecurrence();
|
||||
|
||||
// get the next run ZonedDateTime from the ReportMailingJob entity
|
||||
ZonedDateTime nextRunDateTime = reportMailingJob.getNextRunDateTime();
|
||||
// get the next run LocalDateTime from the ReportMailingJob entity
|
||||
LocalDateTime nextRunDateTime = reportMailingJob.getNextRunDateTime();
|
||||
|
||||
// check if the stretchy report id was updated
|
||||
if (changes.containsKey(ReportMailingJobConstants.STRETCHY_REPORT_ID_PARAM_NAME)) {
|
||||
@@ -169,10 +167,10 @@ public class ReportMailingJobWritePlatformServiceImpl implements ReportMailingJo
|
||||
|
||||
// go ahead if the recurrence is not null
|
||||
if (StringUtils.isNotBlank(recurrence)) {
|
||||
// set the start ZonedDateTime to the current tenant date time
|
||||
ZonedDateTime startDateTime = DateUtils.getLocalDateTimeOfTenant().atZone(DateUtils.getDateTimeZoneOfTenant());
|
||||
// set the start LocalDateTime to the current tenant date time
|
||||
LocalDateTime startDateTime = DateUtils.getLocalDateTimeOfTenant();
|
||||
|
||||
// check if the start ZonedDateTime was updated
|
||||
// check if the start LocalDateTime was updated
|
||||
if (changes.containsKey(ReportMailingJobConstants.START_DATE_TIME_PARAM_NAME)) {
|
||||
// get the updated start DateTime
|
||||
startDateTime = reportMailingJob.getStartDateTime();
|
||||
@@ -181,25 +179,25 @@ public class ReportMailingJobWritePlatformServiceImpl implements ReportMailingJo
|
||||
startDateTime = reportMailingJob.getStartDateTime();
|
||||
|
||||
// get the next recurring DateTime
|
||||
final ZonedDateTime nextRecurringDateTime = this.createNextRecurringDateTime(recurrence, startDateTime);
|
||||
final LocalDateTime nextRecurringDateTime = this.createNextRecurringDateTime(recurrence, startDateTime);
|
||||
|
||||
// update the next run time property
|
||||
reportMailingJob.updateNextRunDateTime(nextRecurringDateTime);
|
||||
|
||||
// check if the next run ZonedDateTime is not empty and the
|
||||
// check if the next run LocalDateTime is not empty and the
|
||||
// recurrence is empty
|
||||
} else if (StringUtils.isBlank(recurrence) && (nextRunDateTime != null)) {
|
||||
// the next run ZonedDateTime should be set to null
|
||||
// the next run LocalDateTime should be set to null
|
||||
reportMailingJob.updateNextRunDateTime(null);
|
||||
}
|
||||
}
|
||||
|
||||
if (changes.containsKey(ReportMailingJobConstants.START_DATE_TIME_PARAM_NAME)) {
|
||||
final ZonedDateTime startDateTime = reportMailingJob.getStartDateTime();
|
||||
final LocalDateTime startDateTime = reportMailingJob.getStartDateTime();
|
||||
|
||||
// initially set the next recurring date time to the new start
|
||||
// date time
|
||||
ZonedDateTime nextRecurringDateTime = startDateTime;
|
||||
LocalDateTime nextRecurringDateTime = startDateTime;
|
||||
|
||||
// ensure that the recurrence pattern string is not empty
|
||||
if (StringUtils.isNotBlank(recurrence)) {
|
||||
@@ -251,9 +249,8 @@ public class ReportMailingJobWritePlatformServiceImpl implements ReportMailingJo
|
||||
.findByIsActiveTrueAndIsDeletedFalse();
|
||||
|
||||
for (ReportMailingJob reportMailingJob : reportMailingJobCollection) {
|
||||
// get the tenant's date as a ZonedDateTime object
|
||||
final ZonedDateTime localDateTimeOftenant = DateUtils.getLocalDateTimeOfTenant().atZone(DateUtils.getDateTimeZoneOfTenant());
|
||||
final ZonedDateTime nextRunDateTime = reportMailingJob.getNextRunDateTime();
|
||||
final LocalDateTime localDateTimeOftenant = DateUtils.getLocalDateTimeOfTenant();
|
||||
final LocalDateTime nextRunDateTime = reportMailingJob.getNextRunDateTime();
|
||||
|
||||
if (nextRunDateTime != null && nextRunDateTime.isBefore(localDateTimeOftenant)) {
|
||||
// get the emailAttachmentFileFormat enum object
|
||||
@@ -310,13 +307,13 @@ public class ReportMailingJobWritePlatformServiceImpl implements ReportMailingJo
|
||||
* @param errorLog
|
||||
* -- StringBuilder object containing the error log if any
|
||||
* @param jobStartDateTime
|
||||
* -- the start ZonedDateTime of the job
|
||||
* -- the start LocalDateTime of the job
|
||||
*
|
||||
**/
|
||||
private void updateReportMailingJobAfterJobExecution(final ReportMailingJob reportMailingJob, final StringBuilder errorLog,
|
||||
final ZonedDateTime jobStartDateTime) {
|
||||
final LocalDateTime jobStartDateTime) {
|
||||
final String recurrence = reportMailingJob.getRecurrence();
|
||||
final ZonedDateTime nextRunDateTime = reportMailingJob.getNextRunDateTime();
|
||||
final LocalDateTime nextRunDateTime = reportMailingJob.getNextRunDateTime();
|
||||
ReportMailingJobPreviousRunStatus reportMailingJobPreviousRunStatus = ReportMailingJobPreviousRunStatus.SUCCESS;
|
||||
|
||||
reportMailingJob.updatePreviousRunErrorLog(null);
|
||||
@@ -339,7 +336,7 @@ public class ReportMailingJobWritePlatformServiceImpl implements ReportMailingJo
|
||||
// job will only run once, no next run time
|
||||
reportMailingJob.updateNextRunDateTime(null);
|
||||
} else if (nextRunDateTime != null) {
|
||||
final ZonedDateTime nextRecurringDateTime = this.createNextRecurringDateTime(recurrence, nextRunDateTime);
|
||||
final LocalDateTime nextRecurringDateTime = this.createNextRecurringDateTime(recurrence, nextRunDateTime);
|
||||
|
||||
// finally update the next run date time property
|
||||
reportMailingJob.updateNextRunDateTime(nextRecurringDateTime);
|
||||
@@ -354,25 +351,19 @@ public class ReportMailingJobWritePlatformServiceImpl implements ReportMailingJo
|
||||
}
|
||||
|
||||
/**
|
||||
* create the next recurring ZonedDateTime from recurrence pattern, start ZonedDateTime and current DateTime
|
||||
* create the next recurring LocalDateTime from recurrence pattern, start LocalDateTime and current DateTime
|
||||
*
|
||||
* @param recurrencePattern
|
||||
* @param startDateTime
|
||||
* @return ZonedDateTime object
|
||||
* @return LocalDateTime object
|
||||
*/
|
||||
private ZonedDateTime createNextRecurringDateTime(final String recurrencePattern, final ZonedDateTime startDateTime) {
|
||||
ZonedDateTime nextRecurringDateTime = null;
|
||||
private LocalDateTime createNextRecurringDateTime(final String recurrencePattern, final LocalDateTime startDateTime) {
|
||||
LocalDateTime nextRecurringDateTime = null;
|
||||
|
||||
// the recurrence pattern/rule cannot be empty
|
||||
if (StringUtils.isNotBlank(recurrencePattern) && startDateTime != null) {
|
||||
final LocalDate nextDayLocalDate = startDateTime.plus(Duration.ofDays(1)).toLocalDate();
|
||||
final LocalDate nextRecurringLocalDate = CalendarUtils.getNextRecurringDate(recurrencePattern, startDateTime.toLocalDate(),
|
||||
nextDayLocalDate);
|
||||
final String nextDateTimeString = nextRecurringLocalDate + " " + startDateTime.getHour() + ":" + startDateTime.getMinute() + ":"
|
||||
+ startDateTime.getSecond();
|
||||
final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(DATETIME_FORMAT);
|
||||
|
||||
nextRecurringDateTime = ZonedDateTime.parse(nextDateTimeString, dateTimeFormatter);
|
||||
final LocalDateTime nextDayLocalDate = startDateTime.plus(Duration.ofDays(1));
|
||||
nextRecurringDateTime = CalendarUtils.getNextRecurringDate(recurrencePattern, startDateTime, nextDayLocalDate);
|
||||
}
|
||||
|
||||
return nextRecurringDateTime;
|
||||
@@ -386,14 +377,14 @@ public class ReportMailingJobWritePlatformServiceImpl implements ReportMailingJo
|
||||
* @param errorLog
|
||||
* -- StringBuilder object containing the error log if any
|
||||
* @param jobStartDateTime
|
||||
* -- the start ZonedDateTime of the job
|
||||
* -- the start LocalDateTime of the job
|
||||
* @param jobRunStatus
|
||||
* -- the status of the job (success/error)
|
||||
*
|
||||
**/
|
||||
private void createReportMailingJobRunHistroryAfterJobExecution(final ReportMailingJob reportMailingJob, final StringBuilder errorLog,
|
||||
final ZonedDateTime jobStartDateTime, final String jobRunStatus) {
|
||||
final ZonedDateTime jobEndDateTime = DateUtils.getLocalDateTimeOfTenant().atZone(DateUtils.getDateTimeZoneOfTenant());
|
||||
final LocalDateTime jobStartDateTime, final String jobRunStatus) {
|
||||
final LocalDateTime jobEndDateTime = DateUtils.getLocalDateTimeOfTenant();
|
||||
final String errorLogToString = (errorLog != null) ? errorLog.toString() : null;
|
||||
final ReportMailingJobRunHistory reportMailingJobRunHistory = ReportMailingJobRunHistory.newInstance(reportMailingJob,
|
||||
jobStartDateTime, jobEndDateTime, jobRunStatus, null, errorLogToString);
|
||||
|
||||
+4
-45
@@ -18,9 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.reportmailingjob.util;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.reportmailingjob.data.ReportMailingJobStretchyReportParamDateOption;
|
||||
|
||||
public final class ReportMailingJobDateUtil {
|
||||
@@ -35,60 +33,21 @@ public final class ReportMailingJobDateUtil {
|
||||
* get the current date as string using the mysql date format yyyy-MM-dd
|
||||
**/
|
||||
public static String getTodayDateAsString() {
|
||||
// get a calendar instance, which defaults to "now"
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
||||
// get a date to represent "today"
|
||||
Date today = calendar.getTime();
|
||||
|
||||
// get a SimpleDateFormat instance, passing the mysql date format as
|
||||
// parameter
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(MYSQL_DATE_FORMAT);
|
||||
|
||||
// return date as string
|
||||
return simpleDateFormat.format(today);
|
||||
return DateUtils.getLocalDateOfTenant().format(DateUtils.DEFAULT_DATE_FORMATER);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the yesterday's date as string using the mysql date format yyyy-MM-dd
|
||||
**/
|
||||
public static String getYesterdayDateAsString() {
|
||||
// get a calendar instance, which defaults to "now"
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
||||
// add one day to the date/calendar
|
||||
calendar.add(Calendar.DAY_OF_YEAR, -1);
|
||||
|
||||
// now get "yesterday"
|
||||
Date yesterday = calendar.getTime();
|
||||
|
||||
// get a SimpleDateFormat instance, passing the mysql date format as
|
||||
// parameter
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(MYSQL_DATE_FORMAT);
|
||||
|
||||
// return date as string
|
||||
return simpleDateFormat.format(yesterday);
|
||||
return DateUtils.getLocalDateOfTenant().minusDays(1).format(DateUtils.DEFAULT_DATE_FORMATER);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the tomorrow's date as string using the mysql date format yyyy-MM-dd
|
||||
**/
|
||||
public static String getTomorrowDateAsString() {
|
||||
// get a calendar instance, which defaults to "now"
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
||||
// add one day to the date/calendar
|
||||
calendar.add(Calendar.DAY_OF_YEAR, 1);
|
||||
|
||||
// now get "tomorrow"
|
||||
Date tomorrow = calendar.getTime();
|
||||
|
||||
// get a SimpleDateFormat instance, passing the mysql date format as
|
||||
// parameter
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(MYSQL_DATE_FORMAT);
|
||||
|
||||
// return date as string
|
||||
return simpleDateFormat.format(tomorrow);
|
||||
return DateUtils.getLocalDateOfTenant().plusDays(1).format(DateUtils.DEFAULT_DATE_FORMATER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+10
-16
@@ -19,15 +19,11 @@
|
||||
package org.apache.fineract.infrastructure.security.domain;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
@@ -46,13 +42,11 @@ public class TFAccessToken extends AbstractPersistableCustom {
|
||||
@JoinColumn(name = "appuser_id", nullable = false)
|
||||
private AppUser user;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "valid_from", nullable = false)
|
||||
private Date validFrom;
|
||||
private LocalDateTime validFrom;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "valid_to", nullable = false)
|
||||
private Date validTo;
|
||||
private LocalDateTime validTo;
|
||||
|
||||
@Column(name = "enabled", nullable = false)
|
||||
private boolean enabled;
|
||||
@@ -60,13 +54,13 @@ public class TFAccessToken extends AbstractPersistableCustom {
|
||||
public TFAccessToken() {}
|
||||
|
||||
public static TFAccessToken create(String token, AppUser user, int tokenLiveTimeInSec) {
|
||||
ZonedDateTime validFrom = DateUtils.getLocalDateTimeOfTenant().atZone(DateUtils.getDateTimeZoneOfTenant());
|
||||
ZonedDateTime validTo = validFrom.plusSeconds(tokenLiveTimeInSec);
|
||||
LocalDateTime validFrom = DateUtils.getLocalDateTimeOfTenant();
|
||||
LocalDateTime validTo = validFrom.plusSeconds(tokenLiveTimeInSec);
|
||||
|
||||
return new TFAccessToken(token, user, Date.from(validFrom.toInstant()), Date.from(validTo.toInstant()), true);
|
||||
return new TFAccessToken(token, user, validFrom, validTo, true);
|
||||
}
|
||||
|
||||
public TFAccessToken(String token, AppUser user, Date validFrom, Date validTo, boolean enabled) {
|
||||
public TFAccessToken(String token, AppUser user, LocalDateTime validFrom, LocalDateTime validTo, boolean enabled) {
|
||||
this.token = token;
|
||||
this.user = user;
|
||||
this.validFrom = validFrom;
|
||||
@@ -96,11 +90,11 @@ public class TFAccessToken extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDateTime getValidFromDate() {
|
||||
return ZonedDateTime.ofInstant(validFrom.toInstant(), DateUtils.getDateTimeZoneOfTenant()).toLocalDateTime();
|
||||
return validFrom;
|
||||
}
|
||||
|
||||
public LocalDateTime getValidToDate() {
|
||||
return ZonedDateTime.ofInstant(validTo.toInstant(), DateUtils.getDateTimeZoneOfTenant()).toLocalDateTime();
|
||||
return validTo;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
@@ -111,11 +105,11 @@ public class TFAccessToken extends AbstractPersistableCustom {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public void setValidFrom(Date validFrom) {
|
||||
public void setValidFrom(LocalDateTime validFrom) {
|
||||
this.validFrom = validFrom;
|
||||
}
|
||||
|
||||
public void setValidTo(Date validTo) {
|
||||
public void setValidTo(LocalDateTime validTo) {
|
||||
this.validTo = validTo;
|
||||
}
|
||||
|
||||
|
||||
+4
-9
@@ -18,9 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.security.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
@@ -149,15 +148,11 @@ public class SpringSecurityPlatformSecurityContext implements PlatformSecurityCo
|
||||
if (this.configurationDomainService.isPasswordForcedResetEnable() && !currentUser.getPasswordNeverExpires()) {
|
||||
|
||||
Long passwordDurationDays = this.configurationDomainService.retrievePasswordLiveTime();
|
||||
final Date passWordLastUpdateDate = currentUser.getLastTimePasswordUpdated();
|
||||
final LocalDate passWordLastUpdateDate = currentUser.getLastTimePasswordUpdated();
|
||||
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTime(passWordLastUpdateDate);
|
||||
c.add(Calendar.DATE, passwordDurationDays.intValue());
|
||||
final LocalDate passwordExpirationDate = passWordLastUpdateDate.plusDays(passwordDurationDays);
|
||||
|
||||
final Date passwordExpirationDate = c.getTime();
|
||||
|
||||
if (DateUtils.getDateOfTenant().after(passwordExpirationDate)) {
|
||||
if (DateUtils.getLocalDateOfTenant().isAfter(passwordExpirationDate)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -19,8 +19,8 @@
|
||||
package org.apache.fineract.infrastructure.sms.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
@@ -121,11 +121,11 @@ public class SmsApiResource {
|
||||
|
||||
final SearchParameters searchParameters = SearchParameters.forSMSCampaign(sqlSearch, offset, limit, orderBy, sortOrder);
|
||||
|
||||
Date fromDate = null;
|
||||
LocalDate fromDate = null;
|
||||
if (fromDateParam != null) {
|
||||
fromDate = fromDateParam.getDate("fromDate", dateFormat, locale);
|
||||
}
|
||||
Date toDate = null;
|
||||
LocalDate toDate = null;
|
||||
if (toDateParam != null) {
|
||||
toDate = toDateParam.getDate("toDate", dateFormat, locale);
|
||||
}
|
||||
|
||||
+8
-11
@@ -18,7 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.sms.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import javax.persistence.Column;
|
||||
@@ -26,8 +27,6 @@ import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.campaigns.sms.domain.SmsCampaign;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
@@ -77,12 +76,10 @@ public class SmsMessage extends AbstractPersistableCustom {
|
||||
// private String campaignName;
|
||||
|
||||
@Column(name = "submittedon_date", nullable = true)
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date submittedOnDate;
|
||||
private LocalDate submittedOnDate;
|
||||
|
||||
@Column(name = "delivered_on_date", nullable = true)
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date deliveredOnDate;
|
||||
private LocalDateTime deliveredOnDate;
|
||||
|
||||
@Column(name = "is_notification", nullable = true)
|
||||
private boolean isNotification;
|
||||
@@ -120,7 +117,7 @@ public class SmsMessage extends AbstractPersistableCustom {
|
||||
this.mobileNo = mobileNo;
|
||||
this.message = message;
|
||||
this.smsCampaign = smsCampaign;
|
||||
this.submittedOnDate = DateUtils.getBusinessDate();
|
||||
this.submittedOnDate = DateUtils.getBusinessLocalDate();
|
||||
this.isNotification = isNotification;
|
||||
}
|
||||
|
||||
@@ -177,15 +174,15 @@ public class SmsMessage extends AbstractPersistableCustom {
|
||||
this.statusType = statusType;
|
||||
}
|
||||
|
||||
public Date getSubmittedOnDate() {
|
||||
public LocalDate getSubmittedOnDate() {
|
||||
return this.submittedOnDate;
|
||||
}
|
||||
|
||||
public Date getDeliveredOnDate() {
|
||||
public LocalDateTime getDeliveredOnDate() {
|
||||
return this.deliveredOnDate;
|
||||
}
|
||||
|
||||
public void setDeliveredOnDate(final Date deliveredOnDate) {
|
||||
public void setDeliveredOnDate(final LocalDateTime deliveredOnDate) {
|
||||
this.deliveredOnDate = deliveredOnDate;
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.sms.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.infrastructure.core.service.Page;
|
||||
import org.apache.fineract.infrastructure.core.service.SearchParameters;
|
||||
@@ -39,7 +39,8 @@ public interface SmsReadPlatformService {
|
||||
|
||||
Collection<SmsData> retrieveAllFailed(Integer limit);
|
||||
|
||||
Page<SmsData> retrieveSmsByStatus(Long campaignId, SearchParameters searchParameters, Integer status, Date dateFrom, Date dateTo);
|
||||
Page<SmsData> retrieveSmsByStatus(Long campaignId, SearchParameters searchParameters, Integer status, LocalDate dateFrom,
|
||||
LocalDate dateTo);
|
||||
|
||||
List<Long> retrieveExternalIdsOfAllSent(Integer limit);
|
||||
|
||||
|
||||
+5
-7
@@ -20,14 +20,13 @@ package org.apache.fineract.infrastructure.sms.service;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.Page;
|
||||
import org.apache.fineract.infrastructure.core.service.PaginationHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.SearchParameters;
|
||||
@@ -203,7 +202,7 @@ public class SmsReadPlatformServiceImpl implements SmsReadPlatformService {
|
||||
|
||||
@Override
|
||||
public Page<SmsData> retrieveSmsByStatus(final Long campaignId, final SearchParameters searchParameters, final Integer status,
|
||||
final Date dateFrom, final Date dateTo) {
|
||||
final LocalDate dateFrom, final LocalDate dateTo) {
|
||||
final StringBuilder sqlBuilder = new StringBuilder(200);
|
||||
final Object[] objectArray = new Object[10];
|
||||
int arrayPos = 0;
|
||||
@@ -219,9 +218,8 @@ public class SmsReadPlatformServiceImpl implements SmsReadPlatformService {
|
||||
String fromDateString = null;
|
||||
String toDateString = null;
|
||||
if (dateFrom != null && dateTo != null) {
|
||||
final DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
fromDateString = df.format(dateFrom);
|
||||
toDateString = df.format(dateTo);
|
||||
fromDateString = DateUtils.DEFAULT_DATE_FORMATER.format(dateFrom);
|
||||
toDateString = DateUtils.DEFAULT_DATE_FORMATER.format(dateTo);
|
||||
sqlBuilder.append(" and smo.submittedon_date >= ? and smo.submittedon_date <= ? ");
|
||||
objectArray[arrayPos] = fromDateString;
|
||||
arrayPos = arrayPos + 1;
|
||||
|
||||
+2
-9
@@ -18,11 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.survey.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.dataqueries.api.DataTableApiConstant;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.DatatableData;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.GenericResultsetData;
|
||||
@@ -137,9 +134,7 @@ public class ReadSurveyServiceImpl implements ReadSurveyService {
|
||||
|
||||
while (rs.next()) {
|
||||
scoresOverviews.add(new ClientScoresOverview(rs.getString("code"), rs.getString("name"), rs.getLong("score"),
|
||||
rs.getDouble("poverty_line"),
|
||||
LocalDate.ofInstant(new Date(rs.getTimestamp("date").getTime()).toInstant(), DateUtils.getDateTimeZoneOfTenant()),
|
||||
rs.getLong("id"), surveyName));
|
||||
rs.getDouble("poverty_line"), rs.getDate("date").toLocalDate(), rs.getLong("id"), surveyName));
|
||||
}
|
||||
|
||||
return scoresOverviews;
|
||||
@@ -168,9 +163,7 @@ public class ReadSurveyServiceImpl implements ReadSurveyService {
|
||||
|
||||
while (rs.next()) {
|
||||
scoresOverviews.add(new ClientScoresOverview(rs.getString("code"), rs.getString("name"), rs.getLong("score"),
|
||||
rs.getDouble("poverty_line"),
|
||||
LocalDate.ofInstant(new Date(rs.getTimestamp("date").getTime()).toInstant(), DateUtils.getDateTimeZoneOfTenant()),
|
||||
rs.getLong("id"), rs.getString("surveyName")));
|
||||
rs.getDouble("poverty_line"), rs.getDate("date").toLocalDate(), rs.getLong("id"), rs.getString("surveyName")));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
-6
@@ -193,12 +193,12 @@ public class InteropRequestData {
|
||||
|
||||
String locale = jsonHelper.extractStringNamed(PARAM_LOCALE, element);
|
||||
LocalDateTime expiration = locale == null
|
||||
? jsonHelper.extractLocalTimeNamed(PARAM_EXPIRATION, element, ISO8601_DATE_TIME_FORMAT, DEFAULT_LOCALE)
|
||||
: jsonHelper.extractLocalTimeNamed(PARAM_EXPIRATION, element); // PARAM_DATE_FORMAT
|
||||
// also
|
||||
// must
|
||||
// be
|
||||
// set
|
||||
? jsonHelper.extractLocalDateTimeNamed(PARAM_EXPIRATION, element, ISO8601_DATE_TIME_FORMAT, DEFAULT_LOCALE)
|
||||
: jsonHelper.extractLocalDateTimeNamed(PARAM_EXPIRATION, element); // PARAM_DATE_FORMAT
|
||||
// also
|
||||
// must
|
||||
// be
|
||||
// set
|
||||
|
||||
JsonArray extensionArray = jsonHelper.extractJsonArrayNamed(PARAM_EXTENSION_LIST, element);
|
||||
ArrayList<ExtensionData> extensionList = null;
|
||||
|
||||
+8
-12
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.interoperation.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -27,8 +27,6 @@ import javax.persistence.Enumerated;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
@@ -57,21 +55,19 @@ public class InteropIdentifier extends AbstractPersistableCustom {
|
||||
@Column(name = "created_by", nullable = false, length = 32)
|
||||
private String createdBy;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "created_on", nullable = false)
|
||||
private Date createdOn;
|
||||
private LocalDateTime createdOn;
|
||||
|
||||
@Column(name = "modified_by", length = 32)
|
||||
private String modifiedBy;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "modified_on")
|
||||
private Date modifiedOn;
|
||||
private LocalDateTime modifiedOn;
|
||||
|
||||
protected InteropIdentifier() {}
|
||||
|
||||
public InteropIdentifier(@NotNull SavingsAccount account, @NotNull InteropIdentifierType type, @NotNull String value, String subType,
|
||||
@NotNull String createdBy, @NotNull Date createdOn) {
|
||||
@NotNull String createdBy, @NotNull LocalDateTime createdOn) {
|
||||
this.account = account;
|
||||
this.type = type;
|
||||
this.value = value;
|
||||
@@ -81,7 +77,7 @@ public class InteropIdentifier extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public InteropIdentifier(@NotNull SavingsAccount account, @NotNull InteropIdentifierType type, @NotNull String createdBy,
|
||||
@NotNull Date createdOn) {
|
||||
@NotNull LocalDateTime createdOn) {
|
||||
this(account, type, null, null, createdBy, createdOn);
|
||||
}
|
||||
|
||||
@@ -113,7 +109,7 @@ public class InteropIdentifier extends AbstractPersistableCustom {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public Date getCreatedOn() {
|
||||
public LocalDateTime getCreatedOn() {
|
||||
return createdOn;
|
||||
}
|
||||
|
||||
@@ -125,11 +121,11 @@ public class InteropIdentifier extends AbstractPersistableCustom {
|
||||
this.modifiedBy = modifiedBy;
|
||||
}
|
||||
|
||||
public Date getModifiedOn() {
|
||||
public LocalDateTime getModifiedOn() {
|
||||
return modifiedOn;
|
||||
}
|
||||
|
||||
public void setModifiedOn(Date modifiedOn) {
|
||||
public void setModifiedOn(LocalDateTime modifiedOn) {
|
||||
this.modifiedOn = modifiedOn;
|
||||
}
|
||||
|
||||
|
||||
+7
-6
@@ -33,7 +33,6 @@ import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Predicate;
|
||||
@@ -285,7 +284,7 @@ public class InteropServiceImpl implements InteropService {
|
||||
AppUser createdBy = getLoginUser();
|
||||
|
||||
InteropIdentifier identifier = new InteropIdentifier(savingsAccount, request.getIdType(), request.getIdValue(),
|
||||
request.getSubIdOrType(), createdBy.getUsername(), DateUtils.getDateOfTenant());
|
||||
request.getSubIdOrType(), createdBy.getUsername(), DateUtils.getLocalDateTimeOfTenant());
|
||||
|
||||
identifierRepository.saveAndFlush(identifier);
|
||||
|
||||
@@ -401,7 +400,8 @@ public class InteropServiceImpl implements InteropService {
|
||||
PaymentDetail paymentDetail = instance(findPaymentType(), savingsAccount.getExternalId(), null, getRoutingCode(), transferCode,
|
||||
null);
|
||||
SavingsAccountTransaction holdTransaction = SavingsAccountTransaction.holdAmount(savingsAccount, savingsAccount.office(),
|
||||
paymentDetail, transactionDate, Money.of(savingsAccount.getCurrency(), total), new Date(), getLoginUser(), false);
|
||||
paymentDetail, transactionDate, Money.of(savingsAccount.getCurrency(), total), DateUtils.getLocalDateTimeOfTenant(),
|
||||
getLoginUser(), false);
|
||||
MonetaryCurrency accountCurrency = savingsAccount.getCurrency().copy();
|
||||
holdTransaction.updateRunningBalance(
|
||||
Money.of(accountCurrency, savingsAccount.getWithdrawableBalance().subtract(holdTransaction.getAmount())));
|
||||
@@ -453,8 +453,8 @@ public class InteropServiceImpl implements InteropService {
|
||||
}
|
||||
|
||||
if (holdTransaction.getReleaseIdOfHoldAmountTransaction() == null) {
|
||||
SavingsAccountTransaction releaseTransaction = savingsAccountTransactionRepository
|
||||
.saveAndFlush(releaseAmount(holdTransaction, transactionDate, new Date(), getLoginUser()));
|
||||
SavingsAccountTransaction releaseTransaction = savingsAccountTransactionRepository.saveAndFlush(
|
||||
releaseAmount(holdTransaction, transactionDate, DateUtils.getLocalDateTimeOfSystem(), getLoginUser()));
|
||||
holdTransaction.updateReleaseId(releaseTransaction.getId());
|
||||
savingsAccount.releaseOnHoldAmount(holdTransaction.getAmount());
|
||||
savingsAccount.addTransaction(releaseTransaction);
|
||||
@@ -492,7 +492,8 @@ public class InteropServiceImpl implements InteropService {
|
||||
SavingsAccountTransaction holdTransaction = findTransaction(savingsAccount, request.getTransferCode(), AMOUNT_HOLD.getValue());
|
||||
|
||||
if (holdTransaction != null && holdTransaction.getReleaseIdOfHoldAmountTransaction() == null) {
|
||||
SavingsAccountTransaction releaseTransaction = releaseAmount(holdTransaction, transactionDate, new Date(), getLoginUser());
|
||||
SavingsAccountTransaction releaseTransaction = releaseAmount(holdTransaction, transactionDate,
|
||||
DateUtils.getLocalDateTimeOfSystem(), getLoginUser());
|
||||
MonetaryCurrency accountCurrency = savingsAccount.getCurrency().copy();
|
||||
releaseTransaction.updateRunningBalance(
|
||||
Money.of(accountCurrency, savingsAccount.getWithdrawableBalance().add(holdTransaction.getAmount())));
|
||||
|
||||
+3
-6
@@ -18,12 +18,10 @@
|
||||
*/
|
||||
package org.apache.fineract.notification.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
|
||||
@Entity
|
||||
@@ -49,13 +47,12 @@ public class Notification extends AbstractPersistableCustom {
|
||||
private String notificationContent;
|
||||
|
||||
@Column(name = "created_at")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date createdAt;
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
public Notification() {}
|
||||
|
||||
public Notification(String objectType, Long objectIdentifier, String action, Long actorId, boolean isSystemGenerated,
|
||||
String notificationContent, Date createdAt) {
|
||||
String notificationContent, LocalDateTime createdAt) {
|
||||
this.objectType = objectType;
|
||||
this.objectIdentifier = objectIdentifier;
|
||||
this.action = action;
|
||||
|
||||
+3
-6
@@ -18,14 +18,12 @@
|
||||
*/
|
||||
package org.apache.fineract.notification.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
|
||||
@@ -45,12 +43,11 @@ public class NotificationMapper extends AbstractPersistableCustom {
|
||||
private boolean isRead;
|
||||
|
||||
@Column(name = "created_at")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date createdAt;
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
public NotificationMapper() {}
|
||||
|
||||
public NotificationMapper(Notification notification, AppUser userId, boolean isRead, Date createdAt) {
|
||||
public NotificationMapper(Notification notification, AppUser userId, boolean isRead, LocalDateTime createdAt) {
|
||||
this.notification = notification;
|
||||
this.userId = userId;
|
||||
this.isRead = isRead;
|
||||
|
||||
+3
-3
@@ -54,7 +54,7 @@ public class NotificationWritePlatformServiceImpl implements NotificationWritePl
|
||||
AppUser appUser = this.appUserRepository.findById(userId).orElse(null);
|
||||
NotificationMapper notificationMapper = new NotificationMapper(
|
||||
this.notificationGeneratorReadRepositoryWrapper.findById(generatedNotificationId), appUser, false,
|
||||
DateUtils.getDateOfTenant());
|
||||
DateUtils.getLocalDateTimeOfSystem());
|
||||
|
||||
this.notificationMapperWritePlatformService.create(notificationMapper);
|
||||
return notificationMapper.getId();
|
||||
@@ -64,7 +64,7 @@ public class NotificationWritePlatformServiceImpl implements NotificationWritePl
|
||||
String notificationContent, boolean isSystemGenerated) {
|
||||
|
||||
Notification notification = new Notification(objectType, objectIdentifier, action, actorId, isSystemGenerated, notificationContent,
|
||||
DateUtils.getDateOfTenant());
|
||||
DateUtils.getLocalDateTimeOfSystem());
|
||||
|
||||
return this.notificationGeneratorWritePlatformService.create(notification);
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public class NotificationWritePlatformServiceImpl implements NotificationWritePl
|
||||
AppUser appUser = this.appUserRepository.findById(userId).orElseThrow();
|
||||
NotificationMapper notificationMapper = new NotificationMapper(
|
||||
this.notificationGeneratorReadRepositoryWrapper.findById(generatedNotificationId), appUser, false,
|
||||
DateUtils.getDateOfTenant());
|
||||
DateUtils.getLocalDateTimeOfSystem());
|
||||
this.notificationMapperWritePlatformService.create(notificationMapper);
|
||||
mappedIds.add(notificationMapper.getId());
|
||||
}
|
||||
|
||||
+3
-3
@@ -30,8 +30,8 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
@@ -208,11 +208,11 @@ public class HolidaysApiResource {
|
||||
|
||||
this.context.authenticatedUser().validateHasReadPermission(HOLIDAY_RESOURCE_NAME);
|
||||
|
||||
Date fromDate = null;
|
||||
LocalDate fromDate = null;
|
||||
if (fromDateParam != null) {
|
||||
fromDate = fromDateParam.getDate("fromDate", dateFormat, locale);
|
||||
}
|
||||
Date toDate = null;
|
||||
LocalDate toDate = null;
|
||||
if (toDateParam != null) {
|
||||
toDate = toDateParam.getDate("toDate", dateFormat, locale);
|
||||
}
|
||||
|
||||
+2
-2
@@ -18,15 +18,15 @@
|
||||
*/
|
||||
package org.apache.fineract.organisation.holiday.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.organisation.holiday.data.HolidayData;
|
||||
|
||||
public interface HolidayReadPlatformService {
|
||||
|
||||
Collection<HolidayData> retrieveAllHolidaysBySearchParamerters(Long officeId, Date fromDate, Date toDate);
|
||||
Collection<HolidayData> retrieveAllHolidaysBySearchParamerters(Long officeId, LocalDate fromDate, LocalDate toDate);
|
||||
|
||||
HolidayData retrieveHoliday(Long holidayId);
|
||||
|
||||
|
||||
+5
-5
@@ -20,15 +20,14 @@ package org.apache.fineract.organisation.holiday.service;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.organisation.holiday.data.HolidayData;
|
||||
import org.apache.fineract.organisation.holiday.domain.RescheduleType;
|
||||
@@ -86,10 +85,11 @@ public class HolidayReadPlatformServiceImpl implements HolidayReadPlatformServic
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<HolidayData> retrieveAllHolidaysBySearchParamerters(final Long officeId, final Date fromDate, final Date toDate) {
|
||||
public Collection<HolidayData> retrieveAllHolidaysBySearchParamerters(final Long officeId, final LocalDate fromDate,
|
||||
final LocalDate toDate) {
|
||||
this.context.authenticatedUser();
|
||||
|
||||
final DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
final DateTimeFormatter df = DateUtils.DEFAULT_DATE_FORMATER;
|
||||
|
||||
final Object[] objectArray = new Object[3];
|
||||
int arrayPos = 0;
|
||||
|
||||
+4
-15
@@ -20,9 +20,7 @@ package org.apache.fineract.organisation.office.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -33,13 +31,10 @@ import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.office.exception.CannotUpdateOfficeWithParentOfficeSameAsSelf;
|
||||
import org.apache.fineract.organisation.office.exception.RootOfficeParentCannotBeUpdated;
|
||||
|
||||
@@ -63,8 +58,7 @@ public class Office extends AbstractPersistableCustom implements Serializable {
|
||||
private String hierarchy;
|
||||
|
||||
@Column(name = "opening_date", nullable = false)
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date openingDate;
|
||||
private LocalDate openingDate;
|
||||
|
||||
@Column(name = "external_id", length = 100)
|
||||
private String externalId;
|
||||
@@ -90,7 +84,7 @@ public class Office extends AbstractPersistableCustom implements Serializable {
|
||||
|
||||
private Office(final Office parent, final String name, final LocalDate openingDate, final String externalId) {
|
||||
this.parent = parent;
|
||||
this.openingDate = Date.from(openingDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.openingDate = openingDate;
|
||||
if (parent != null) {
|
||||
this.parent.addChild(this);
|
||||
}
|
||||
@@ -136,8 +130,7 @@ public class Office extends AbstractPersistableCustom implements Serializable {
|
||||
actualChanges.put("dateFormat", dateFormatAsInput);
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(openingDateParamName);
|
||||
this.openingDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.openingDate = command.localDateValueOfParameterNamed(openingDateParamName);
|
||||
}
|
||||
|
||||
final String nameParamName = "name";
|
||||
@@ -166,11 +159,7 @@ public class Office extends AbstractPersistableCustom implements Serializable {
|
||||
}
|
||||
|
||||
public LocalDate getOpeningLocalDate() {
|
||||
LocalDate openingLocalDate = null;
|
||||
if (this.openingDate != null) {
|
||||
openingLocalDate = LocalDate.ofInstant(this.openingDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return openingLocalDate;
|
||||
return this.openingDate;
|
||||
}
|
||||
|
||||
public void update(final Office newParent) {
|
||||
|
||||
+2
-7
@@ -20,8 +20,6 @@ package org.apache.fineract.organisation.office.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embedded;
|
||||
import javax.persistence.Entity;
|
||||
@@ -29,8 +27,6 @@ import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
|
||||
@@ -49,8 +45,7 @@ public class OfficeTransaction extends AbstractPersistableCustom {
|
||||
private Office to;
|
||||
|
||||
@Column(name = "transaction_date", nullable = false)
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date transactionDate;
|
||||
private LocalDate transactionDate;
|
||||
|
||||
@Embedded
|
||||
private MonetaryCurrency currency;
|
||||
@@ -79,7 +74,7 @@ public class OfficeTransaction extends AbstractPersistableCustom {
|
||||
this.from = fromOffice;
|
||||
this.to = toOffice;
|
||||
if (transactionLocalDate != null) {
|
||||
this.transactionDate = Date.from(transactionLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.transactionDate = transactionLocalDate;
|
||||
}
|
||||
this.currency = amount.getCurrency();
|
||||
this.transactionAmount = amount.getAmount();
|
||||
|
||||
+5
-6
@@ -18,8 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.organisation.provisioning.domain;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@@ -66,13 +65,13 @@ public class ProvisioningCriteria extends AbstractAuditableCustom {
|
||||
|
||||
}
|
||||
|
||||
public ProvisioningCriteria(String criteriaName, AppUser createdBy, ZonedDateTime createdDate, AppUser lastModifiedBy,
|
||||
ZonedDateTime lastModifiedDate) {
|
||||
public ProvisioningCriteria(String criteriaName, AppUser createdBy, LocalDateTime createdDate, AppUser lastModifiedBy,
|
||||
LocalDateTime lastModifiedDate) {
|
||||
this.criteriaName = criteriaName;
|
||||
setCreatedBy(createdBy.getId());
|
||||
setCreatedDate(Instant.ofEpochMilli(createdDate.toInstant().toEpochMilli()));
|
||||
setCreatedDate(createdDate);
|
||||
setLastModifiedBy(lastModifiedBy.getId());
|
||||
setLastModifiedDate(Instant.ofEpochMilli(lastModifiedDate.toInstant().toEpochMilli()));
|
||||
setLastModifiedDate(lastModifiedDate);
|
||||
}
|
||||
|
||||
public void setProvisioningCriteriaDefinitions(Set<ProvisioningCriteriaDefinition> provisioningCriteriaDefinition) {
|
||||
|
||||
+1
-3
@@ -22,7 +22,6 @@ import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -122,8 +121,7 @@ public class ProvisioningCriteriaAssembler {
|
||||
jsonElement);
|
||||
|
||||
ProvisioningCriteria criteria = new ProvisioningCriteria(criteriaName, platformSecurityContext.authenticatedUser(),
|
||||
ZonedDateTime.now(DateUtils.getDateTimeZoneOfTenant()), platformSecurityContext.authenticatedUser(),
|
||||
ZonedDateTime.now(DateUtils.getDateTimeZoneOfTenant()));
|
||||
DateUtils.getLocalDateTimeOfSystem(), platformSecurityContext.authenticatedUser(), DateUtils.getLocalDateTimeOfSystem());
|
||||
return criteria;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -19,10 +19,9 @@
|
||||
package org.apache.fineract.organisation.teller.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
@@ -30,6 +29,7 @@ import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.teller.data.CashierData;
|
||||
import org.apache.fineract.organisation.teller.service.TellerManagementReadPlatformService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -60,7 +60,7 @@ public class CashierApiResource {
|
||||
@QueryParam("staffId") final Long staffId, @QueryParam("date") final String date) {
|
||||
final DateTimeFormatter dateFormatter = DateTimeFormatter.BASIC_ISO_DATE;
|
||||
|
||||
final Date dateRestriction = (date != null ? Date.from(ZonedDateTime.parse(date, dateFormatter).toInstant()) : new Date());
|
||||
final LocalDate dateRestriction = (date != null ? LocalDate.parse(date, dateFormatter) : DateUtils.getBusinessLocalDate());
|
||||
|
||||
final Collection<CashierData> allCashiers = this.readPlatformService.getCashierData(officeId, tellerId, staffId, dateRestriction);
|
||||
|
||||
|
||||
+8
-8
@@ -27,10 +27,9 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
@@ -46,6 +45,7 @@ import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.Page;
|
||||
import org.apache.fineract.infrastructure.core.service.SearchParameters;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
@@ -166,8 +166,8 @@ public class TellerApiResource {
|
||||
@QueryParam("todate") @Parameter(description = "todate") final String toDateStr) {
|
||||
final DateTimeFormatter dateFormatter = DateTimeFormatter.BASIC_ISO_DATE;
|
||||
|
||||
final Date fromDate = fromDateStr != null ? Date.from(ZonedDateTime.parse(fromDateStr, dateFormatter).toInstant()) : new Date();
|
||||
final Date toDate = toDateStr != null ? Date.from(ZonedDateTime.parse(toDateStr, dateFormatter).toInstant()) : new Date();
|
||||
final LocalDate fromDate = fromDateStr != null ? LocalDate.parse(fromDateStr, dateFormatter) : DateUtils.getBusinessLocalDate();
|
||||
final LocalDate toDate = toDateStr != null ? LocalDate.parse(toDateStr, dateFormatter) : DateUtils.getBusinessLocalDate();
|
||||
|
||||
final TellerData teller = this.readPlatformService.findTeller(tellerId);
|
||||
final Collection<CashierData> cashiers = this.readPlatformService.getCashiersForTeller(tellerId, fromDate, toDate);
|
||||
@@ -324,8 +324,8 @@ public class TellerApiResource {
|
||||
final TellerData teller = this.readPlatformService.findTeller(tellerId);
|
||||
final CashierData cashier = this.readPlatformService.findCashier(cashierId);
|
||||
|
||||
final Date fromDate = null;
|
||||
final Date toDate = null;
|
||||
final LocalDate fromDate = null;
|
||||
final LocalDate toDate = null;
|
||||
final SearchParameters searchParameters = SearchParameters.forPagination(offset, limit, orderBy, sortOrder);
|
||||
final Page<CashierTransactionData> cashierTxns = this.readPlatformService.retrieveCashierTransactions(cashierId, false, fromDate,
|
||||
toDate, currencyCode, searchParameters);
|
||||
@@ -350,8 +350,8 @@ public class TellerApiResource {
|
||||
final TellerData teller = this.readPlatformService.findTeller(tellerId);
|
||||
final CashierData cashier = this.readPlatformService.findCashier(cashierId);
|
||||
|
||||
final Date fromDate = null;
|
||||
final Date toDate = null;
|
||||
final LocalDate fromDate = null;
|
||||
final LocalDate toDate = null;
|
||||
|
||||
final SearchParameters searchParameters = SearchParameters.forPagination(offset, limit, orderBy, sortOrder);
|
||||
|
||||
|
||||
+9
-9
@@ -21,8 +21,8 @@ package org.apache.fineract.organisation.teller.api;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import org.apache.fineract.infrastructure.core.service.Page;
|
||||
import org.apache.fineract.organisation.monetary.data.CurrencyData;
|
||||
import org.apache.fineract.organisation.staff.data.StaffData;
|
||||
@@ -343,16 +343,16 @@ final class TellerApiResourceSwagger {
|
||||
public CashierTxnType txnType;
|
||||
@Schema(example = "1000")
|
||||
public BigDecimal txnAmount;
|
||||
@Schema(example = "Feb 25, 2015 12:00:00 AM")
|
||||
public Date txnDate;
|
||||
@Schema(example = "[2015, 02, 25]")
|
||||
public LocalDate txnDate;
|
||||
@Schema(example = "2")
|
||||
public Long entityId;
|
||||
@Schema(example = "loans")
|
||||
public String entityType;
|
||||
@Schema(example = "Disbursement, Loan:2-000000002,Client:1-Test 1")
|
||||
public String txnNote;
|
||||
@Schema(example = "Feb 25, 2015 12:00:00 AM")
|
||||
public Date createdDate;
|
||||
@Schema(example = "[2015, 02, 25, 12, 00, 00]")
|
||||
public LocalDateTime createdDate;
|
||||
@Schema(example = "1")
|
||||
public Long officeId;
|
||||
@Schema(example = "Head Office")
|
||||
@@ -380,8 +380,8 @@ final class TellerApiResourceSwagger {
|
||||
public String locale;
|
||||
@Schema(example = "dd-MM-yyyy")
|
||||
public String dateFormat;
|
||||
@Schema(example = "01 February 2015")
|
||||
public Date txnDate;
|
||||
@Schema(example = "[2015, 02, 01]")
|
||||
public LocalDate txnDate;
|
||||
}
|
||||
|
||||
@Schema(description = "PostTellersTellerIdCashiersCashierIdAllocateResponse")
|
||||
@@ -414,8 +414,8 @@ final class TellerApiResourceSwagger {
|
||||
public String locale;
|
||||
@Schema(example = "dd-MM-yyyy")
|
||||
public String dateFormat;
|
||||
@Schema(example = "20 February 2015")
|
||||
public Date txnDate;
|
||||
@Schema(example = "[2015, 02, 20]")
|
||||
public LocalDate txnDate;
|
||||
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -19,8 +19,8 @@
|
||||
package org.apache.fineract.organisation.teller.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import org.apache.fineract.organisation.staff.data.StaffData;
|
||||
|
||||
/**
|
||||
@@ -39,8 +39,8 @@ public final class CashierData implements Serializable {
|
||||
private final Long officeId;
|
||||
private final Long staffId;
|
||||
private final String description;
|
||||
private final Date startDate;
|
||||
private final Date endDate;
|
||||
private final LocalDate startDate;
|
||||
private final LocalDate endDate;
|
||||
private final Boolean isFullDay;
|
||||
private final String startTime;
|
||||
private final String endTime;
|
||||
@@ -55,7 +55,7 @@ public final class CashierData implements Serializable {
|
||||
* Creates a new cashier.
|
||||
*/
|
||||
private CashierData(final Long id, final Long officeId, String officeName, final Long staffId, final String staffName,
|
||||
final Long tellerId, final String tellerName, final String description, final Date startDate, final Date endDate,
|
||||
final Long tellerId, final String tellerName, final String description, final LocalDate startDate, final LocalDate endDate,
|
||||
final Boolean isFullDay, final String startTime, final String endTime, Collection<StaffData> staffOptions) {
|
||||
this.id = id;
|
||||
this.officeId = officeId;
|
||||
@@ -113,7 +113,7 @@ public final class CashierData implements Serializable {
|
||||
* @return
|
||||
*/
|
||||
public static CashierData instance(final Long id, final Long officeId, String officeName, final Long staffId, final String staffName,
|
||||
final Long tellerId, final String tellerName, final String description, final Date startDate, final Date endDate,
|
||||
final Long tellerId, final String tellerName, final String description, final LocalDate startDate, final LocalDate endDate,
|
||||
final Boolean isFullDay, final String startTime, final String endTime) {
|
||||
return new CashierData(id, officeId, officeName, staffId, staffName, tellerId, tellerName, description, startDate, endDate,
|
||||
isFullDay, startTime, endTime, null);
|
||||
@@ -182,7 +182,7 @@ public final class CashierData implements Serializable {
|
||||
*
|
||||
* @return the valid from date of this cashier
|
||||
*/
|
||||
public Date getStartDate() {
|
||||
public LocalDate getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ public final class CashierData implements Serializable {
|
||||
*
|
||||
* @return the valid to date of this cashier
|
||||
*/
|
||||
public Date getEndDate() {
|
||||
public LocalDate getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
|
||||
+16
-15
@@ -20,8 +20,9 @@ package org.apache.fineract.organisation.teller.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import org.apache.fineract.organisation.monetary.data.CurrencyData;
|
||||
import org.apache.fineract.organisation.teller.domain.CashierTxnType;
|
||||
|
||||
@@ -31,11 +32,11 @@ public final class CashierTransactionData implements Serializable {
|
||||
private final Long cashierId;
|
||||
private final CashierTxnType txnType;
|
||||
private final BigDecimal txnAmount;
|
||||
private final Date txnDate;
|
||||
private final LocalDate txnDate;
|
||||
private final Long entityId;
|
||||
private final String entityType;
|
||||
private final String txnNote;
|
||||
private final Date createdDate;
|
||||
private final LocalDateTime createdDate;
|
||||
|
||||
// Template fields
|
||||
private final Long officeId;
|
||||
@@ -45,8 +46,8 @@ public final class CashierTransactionData implements Serializable {
|
||||
private final String cashierName;
|
||||
|
||||
private final CashierData cashierData;
|
||||
private final Date startDate;
|
||||
private final Date endDate;
|
||||
private final LocalDate startDate;
|
||||
private final LocalDate endDate;
|
||||
|
||||
private final Collection<CurrencyData> currencyOptions;
|
||||
|
||||
@@ -54,9 +55,9 @@ public final class CashierTransactionData implements Serializable {
|
||||
* Creates a new cashier.
|
||||
*/
|
||||
private CashierTransactionData(final Long id, final Long cashierId, CashierTxnType txnType, final BigDecimal txnAmount,
|
||||
final Date txnDate, String txnNote, String entityType, Long entityId, Date createdDate, Long officeId, String officeName,
|
||||
Long tellerId, String tellerName, String cashierName, CashierData cashierData, Date startDate, Date endDate,
|
||||
final Collection<CurrencyData> currencyOptions) {
|
||||
final LocalDate txnDate, String txnNote, String entityType, Long entityId, LocalDateTime createdDate, Long officeId,
|
||||
String officeName, Long tellerId, String tellerName, String cashierName, CashierData cashierData, LocalDate startDate,
|
||||
LocalDate endDate, final Collection<CurrencyData> currencyOptions) {
|
||||
this.id = id;
|
||||
this.cashierId = cashierId;
|
||||
this.txnType = txnType;
|
||||
@@ -81,15 +82,15 @@ public final class CashierTransactionData implements Serializable {
|
||||
}
|
||||
|
||||
public static CashierTransactionData instance(final Long id, final Long cashierId, CashierTxnType txnType, final BigDecimal txnAmount,
|
||||
final Date txnDate, final String txnNote, final String entityType, final Long entityId, final Date createdDate,
|
||||
final LocalDate txnDate, final String txnNote, final String entityType, final Long entityId, final LocalDateTime createdDate,
|
||||
final Long officeId, final String officeName, final Long tellerId, final String tellerName, final String cashierName,
|
||||
final CashierData cashierData, Date startDate, Date endDate) {
|
||||
final CashierData cashierData, LocalDate startDate, LocalDate endDate) {
|
||||
return new CashierTransactionData(id, cashierId, txnType, txnAmount, txnDate, txnNote, entityType, entityId, createdDate, officeId,
|
||||
officeName, tellerId, tellerName, cashierName, cashierData, startDate, endDate, null);
|
||||
}
|
||||
|
||||
public static CashierTransactionData template(final Long cashierId, final Long tellerId, final String tellerName, final Long officeId,
|
||||
final String officeName, final String cashierName, final CashierData cashierData, Date startDate, Date endDate,
|
||||
final String officeName, final String cashierName, final CashierData cashierData, LocalDate startDate, LocalDate endDate,
|
||||
final Collection<CurrencyData> currencyOptions) {
|
||||
return new CashierTransactionData(null, cashierId, null, null, null, null, null, null, null, officeId, officeName, tellerId,
|
||||
tellerName, cashierName, cashierData, startDate, endDate, currencyOptions);
|
||||
@@ -111,7 +112,7 @@ public final class CashierTransactionData implements Serializable {
|
||||
return txnAmount;
|
||||
}
|
||||
|
||||
public Date getTxnDate() {
|
||||
public LocalDate getTxnDate() {
|
||||
return txnDate;
|
||||
}
|
||||
|
||||
@@ -127,7 +128,7 @@ public final class CashierTransactionData implements Serializable {
|
||||
return entityId;
|
||||
}
|
||||
|
||||
public Date getCreatedDate() {
|
||||
public LocalDateTime getCreatedDate() {
|
||||
return createdDate;
|
||||
}
|
||||
|
||||
@@ -151,11 +152,11 @@ public final class CashierTransactionData implements Serializable {
|
||||
return cashierName;
|
||||
}
|
||||
|
||||
public Date getStartDate() {
|
||||
public LocalDate getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
public LocalDate getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
|
||||
+4
-5
@@ -22,7 +22,6 @@ import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Date;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.core.service.SearchParameters;
|
||||
@@ -60,8 +59,8 @@ public class CashierTransactionDataValidator {
|
||||
final Integer limit = null;
|
||||
final String orderBy = null;
|
||||
final String sortOrder = null;
|
||||
final Date fromDate = null;
|
||||
final Date toDate = null;
|
||||
final LocalDate fromDate = null;
|
||||
final LocalDate toDate = null;
|
||||
final SearchParameters searchParameters = SearchParameters.forPagination(offset, limit, orderBy, sortOrder);
|
||||
final CashierTransactionsWithSummaryData cashierTxnWithSummary = this.tellerManagementReadPlatformService
|
||||
.retrieveCashierTransactionsWithSummary(cashierId, false, fromDate, toDate, currencyCode, searchParameters);
|
||||
@@ -78,8 +77,8 @@ public class CashierTransactionDataValidator {
|
||||
|
||||
public void validateCashierAllowedDateAndTime(final Cashier cashier, final Teller teller) {
|
||||
Long staffId = cashier.getStaff().getId();
|
||||
final LocalDate fromDate = LocalDate.ofInstant(cashier.getStartDate().toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
final LocalDate endDate = LocalDate.ofInstant(cashier.getEndDate().toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
final LocalDate fromDate = cashier.getStartDate();
|
||||
final LocalDate endDate = cashier.getEndDate();
|
||||
final LocalDate tellerFromDate = teller.getStartLocalDate();
|
||||
final LocalDate tellerEndDate = teller.getEndLocalDate();
|
||||
/**
|
||||
|
||||
+5
-5
@@ -19,7 +19,7 @@
|
||||
package org.apache.fineract.organisation.teller.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* {@code TellerJournalData} represents an immutable journal data object.
|
||||
@@ -34,7 +34,7 @@ public final class TellerJournalData implements Serializable {
|
||||
|
||||
private final Long officeId;
|
||||
private final Long tellerId;
|
||||
private final Date day;
|
||||
private final LocalDate day;
|
||||
private final Double openingBalance;
|
||||
private final Double settledBalance;
|
||||
private final Double closingBalance;
|
||||
@@ -44,7 +44,7 @@ public final class TellerJournalData implements Serializable {
|
||||
/*
|
||||
* Sole private CTOR to create a new instance.
|
||||
*/
|
||||
private TellerJournalData(final Long officeId, final Long tellerId, final Date day, final Double openingBalance,
|
||||
private TellerJournalData(final Long officeId, final Long tellerId, final LocalDate day, final Double openingBalance,
|
||||
final Double settledBalance, final Double closingBalance, final Double sumReceipts, final Double sumPayments) {
|
||||
this.officeId = officeId;
|
||||
this.tellerId = tellerId;
|
||||
@@ -77,7 +77,7 @@ public final class TellerJournalData implements Serializable {
|
||||
* - sum of all posted payments
|
||||
* @return the new created {@code TellerJournalData}
|
||||
*/
|
||||
public static TellerJournalData instance(final Long officeId, final Long tellerId, final Date day, final Double openingBalance,
|
||||
public static TellerJournalData instance(final Long officeId, final Long tellerId, final LocalDate day, final Double openingBalance,
|
||||
final Double settledBalance, final Double closingBalance, final Double sumReceipts, final Double sumPayments) {
|
||||
return new TellerJournalData(officeId, tellerId, day, openingBalance, settledBalance, closingBalance, sumReceipts, sumPayments);
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public final class TellerJournalData implements Serializable {
|
||||
return tellerId;
|
||||
}
|
||||
|
||||
public Date getDay() {
|
||||
public LocalDate getDay() {
|
||||
return day;
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -19,7 +19,7 @@
|
||||
package org.apache.fineract.organisation.teller.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
|
||||
/**
|
||||
@@ -40,13 +40,13 @@ public final class TellerTransactionData implements Serializable {
|
||||
private final Long clientId;
|
||||
private final EnumOptionData type;
|
||||
private final Double amount;
|
||||
private final Date postingDate;
|
||||
private final LocalDate postingDate;
|
||||
|
||||
/*
|
||||
* Sole private CTOR to create a new instance
|
||||
*/
|
||||
private TellerTransactionData(final Long id, final Long officeId, final Long tellerId, final Long cashierId, final Long clientId,
|
||||
final EnumOptionData type, final Double amount, final Date postingDate) {
|
||||
final EnumOptionData type, final Double amount, final LocalDate postingDate) {
|
||||
this.id = id;
|
||||
this.officeId = officeId;
|
||||
this.tellerId = tellerId;
|
||||
@@ -79,7 +79,7 @@ public final class TellerTransactionData implements Serializable {
|
||||
* @return the new created {@code TellerTransactionData}
|
||||
*/
|
||||
public static TellerTransactionData instance(final Long id, final Long officeId, final Long tellerId, final Long cashierId,
|
||||
final Long clientId, final EnumOptionData type, final Double amount, final Date postingDate) {
|
||||
final Long clientId, final EnumOptionData type, final Double amount, final LocalDate postingDate) {
|
||||
return new TellerTransactionData(id, officeId, tellerId, cashierId, clientId, type, amount, postingDate);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public final class TellerTransactionData implements Serializable {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public Date getPostingDate() {
|
||||
public LocalDate getPostingDate() {
|
||||
return postingDate;
|
||||
}
|
||||
}
|
||||
|
||||
+12
-37
@@ -20,8 +20,6 @@ package org.apache.fineract.organisation.teller.domain;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -31,13 +29,10 @@ import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
import org.apache.fineract.organisation.staff.domain.Staff;
|
||||
|
||||
@@ -69,13 +64,11 @@ public class Cashier extends AbstractPersistableCustom {
|
||||
@Column(name = "description", nullable = true, length = 500)
|
||||
private String description;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "start_date", nullable = false)
|
||||
private Date startDate;
|
||||
private LocalDate startDate;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "end_date", nullable = false)
|
||||
private Date endDate;
|
||||
private LocalDate endDate;
|
||||
|
||||
@Column(name = "full_day", nullable = true)
|
||||
private Boolean isFullDay;
|
||||
@@ -115,8 +108,8 @@ public class Cashier extends AbstractPersistableCustom {
|
||||
this.teller = teller;
|
||||
this.staff = staff;
|
||||
this.description = description;
|
||||
this.startDate = Date.from(startDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.endDate = Date.from(endDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.startDate = startDate;
|
||||
this.endDate = endDate;
|
||||
this.isFullDay = isFullDay;
|
||||
this.startTime = startTime;
|
||||
this.endTime = endTime;
|
||||
@@ -137,25 +130,23 @@ public class Cashier extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
final String startDateParamName = "startDate";
|
||||
if (command.isChangeInLocalDateParameterNamed(startDateParamName, getStartLocalDate())) {
|
||||
if (command.isChangeInLocalDateParameterNamed(startDateParamName, getStartDate())) {
|
||||
final String valueAsInput = command.stringValueOfParameterNamed(startDateParamName);
|
||||
actualChanges.put(startDateParamName, valueAsInput);
|
||||
actualChanges.put("dateFormat", dateFormatAsInput);
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(startDateParamName);
|
||||
this.startDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.startDate = command.localDateValueOfParameterNamed(startDateParamName);
|
||||
}
|
||||
|
||||
final String endDateParamName = "endDate";
|
||||
if (command.isChangeInLocalDateParameterNamed(endDateParamName, getEndLocalDate())) {
|
||||
if (command.isChangeInLocalDateParameterNamed(endDateParamName, getEndDate())) {
|
||||
final String valueAsInput = command.stringValueOfParameterNamed(endDateParamName);
|
||||
actualChanges.put(endDateParamName, valueAsInput);
|
||||
actualChanges.put("dateFormat", dateFormatAsInput);
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(endDateParamName);
|
||||
this.endDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.endDate = command.localDateValueOfParameterNamed(endDateParamName);
|
||||
}
|
||||
|
||||
final Boolean isFullDay = command.booleanObjectValueOfParameterNamed("isFullDay");
|
||||
@@ -341,18 +332,10 @@ public class Cashier extends AbstractPersistableCustom {
|
||||
*
|
||||
* @return the valid from date of this cashier
|
||||
*/
|
||||
public Date getStartDate() {
|
||||
public LocalDate getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public LocalDate getStartLocalDate() {
|
||||
LocalDate startLocalDate = null;
|
||||
if (this.startDate != null) {
|
||||
startLocalDate = LocalDate.ofInstant(this.startDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return startLocalDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the valid from date of this cashier.
|
||||
*
|
||||
@@ -363,7 +346,7 @@ public class Cashier extends AbstractPersistableCustom {
|
||||
* @param startDate
|
||||
* validFrom the valid from date of this cashier
|
||||
*/
|
||||
public void setStartDate(Date startDate) {
|
||||
public void setStartDate(LocalDate startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
@@ -376,18 +359,10 @@ public class Cashier extends AbstractPersistableCustom {
|
||||
*
|
||||
* @return the valid to date of this cashier
|
||||
*/
|
||||
public Date getEndDate() {
|
||||
public LocalDate getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public LocalDate getEndLocalDate() {
|
||||
LocalDate endLocalDate = null;
|
||||
if (this.endDate != null) {
|
||||
endLocalDate = LocalDate.ofInstant(this.endDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return endLocalDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the valid to date of this cashier.
|
||||
*
|
||||
@@ -398,7 +373,7 @@ public class Cashier extends AbstractPersistableCustom {
|
||||
* @param endDate
|
||||
* validTo the valid to date of this cashier
|
||||
*/
|
||||
public void setEndDate(Date endDate) {
|
||||
public void setEndDate(LocalDate endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
|
||||
+9
-19
@@ -20,8 +20,7 @@ package org.apache.fineract.organisation.teller.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import javax.persistence.Column;
|
||||
@@ -30,8 +29,6 @@ import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.Transient;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
@@ -55,9 +52,8 @@ public class CashierTransaction extends AbstractPersistableCustom {
|
||||
@Column(name = "txn_type", nullable = false)
|
||||
private Integer txnType;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "txn_date", nullable = false)
|
||||
private Date txnDate;
|
||||
private LocalDate txnDate;
|
||||
|
||||
@Column(name = "txn_amount", scale = 6, precision = 19, nullable = false)
|
||||
private BigDecimal txnAmount;
|
||||
@@ -71,9 +67,8 @@ public class CashierTransaction extends AbstractPersistableCustom {
|
||||
@Column(name = "entity_id", nullable = true)
|
||||
private Long entityId;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "created_date", nullable = false)
|
||||
private Date createdDate;
|
||||
private LocalDateTime createdDate;
|
||||
|
||||
@Column(name = "currency_code", nullable = true)
|
||||
private String currencyCode;
|
||||
@@ -104,13 +99,13 @@ public class CashierTransaction extends AbstractPersistableCustom {
|
||||
this.cashier = cashier;
|
||||
this.txnType = txnType;
|
||||
if (txnDate != null) {
|
||||
this.txnDate = Date.from(txnDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.txnDate = txnDate;
|
||||
}
|
||||
this.txnAmount = txnAmount;
|
||||
this.entityType = entityType;
|
||||
this.entityId = entityId;
|
||||
this.txnNote = txnNote;
|
||||
this.createdDate = new Date();
|
||||
this.createdDate = DateUtils.getLocalDateTimeOfSystem();
|
||||
this.currencyCode = currencyCode;
|
||||
}
|
||||
|
||||
@@ -135,8 +130,7 @@ public class CashierTransaction extends AbstractPersistableCustom {
|
||||
actualChanges.put("dateFormat", dateFormatAsInput);
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(txnDateParamName);
|
||||
this.txnDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.txnDate = command.localDateValueOfParameterNamed(txnDateParamName);
|
||||
}
|
||||
|
||||
final String txnAmountParamName = "txnAmount";
|
||||
@@ -229,16 +223,12 @@ public class CashierTransaction extends AbstractPersistableCustom {
|
||||
*
|
||||
* @return the transaction date of this cashier transaction
|
||||
*/
|
||||
public Date getTxnDate() {
|
||||
public LocalDate getTxnDate() {
|
||||
return txnDate;
|
||||
}
|
||||
|
||||
public LocalDate getTxnLocalDate() {
|
||||
LocalDate txnLocalDate = null;
|
||||
if (this.txnDate != null) {
|
||||
txnLocalDate = LocalDate.ofInstant(this.txnDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return txnLocalDate;
|
||||
return this.txnDate;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -247,7 +237,7 @@ public class CashierTransaction extends AbstractPersistableCustom {
|
||||
* @param txnDate
|
||||
* transaction date of this cashier transaction
|
||||
*/
|
||||
public void setTxnDate(Date txnDate) {
|
||||
public void setTxnDate(LocalDate txnDate) {
|
||||
this.txnDate = txnDate;
|
||||
}
|
||||
|
||||
|
||||
+15
-36
@@ -19,8 +19,6 @@
|
||||
package org.apache.fineract.organisation.teller.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -31,14 +29,10 @@ import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccount;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
|
||||
@Entity
|
||||
@@ -63,13 +57,11 @@ public class Teller extends AbstractPersistableCustom {
|
||||
@Column(name = "description", nullable = true, length = 500)
|
||||
private String description;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "valid_from", nullable = true)
|
||||
private Date startDate;
|
||||
private LocalDate startDate;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "valid_to", nullable = true)
|
||||
private Date endDate;
|
||||
private LocalDate endDate;
|
||||
|
||||
@Column(name = "state", nullable = false)
|
||||
private Integer status;
|
||||
@@ -84,14 +76,11 @@ public class Teller extends AbstractPersistableCustom {
|
||||
private Teller(final Office staffOffice, final String name, final String description, final LocalDate startDate,
|
||||
final LocalDate endDate, final TellerStatus status) {
|
||||
|
||||
this.name = StringUtils.defaultIfEmpty(name, null);
|
||||
this.description = StringUtils.defaultIfEmpty(description, null);
|
||||
if (startDate != null) {
|
||||
this.startDate = Date.from(startDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
}
|
||||
if (endDate != null) {
|
||||
this.endDate = Date.from(endDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
}
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.startDate = startDate;
|
||||
this.endDate = endDate;
|
||||
|
||||
if (status != null) {
|
||||
this.status = status.getValue();
|
||||
}
|
||||
@@ -152,8 +141,7 @@ public class Teller extends AbstractPersistableCustom {
|
||||
actualChanges.put("dateFormat", dateFormatAsInput);
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(startDateParamName);
|
||||
this.startDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.startDate = command.localDateValueOfParameterNamed(startDateParamName);
|
||||
}
|
||||
|
||||
final String endDateParamName = "endDate";
|
||||
@@ -163,8 +151,7 @@ public class Teller extends AbstractPersistableCustom {
|
||||
actualChanges.put("dateFormat", dateFormatAsInput);
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
|
||||
final LocalDate newValue = command.localDateValueOfParameterNamed(endDateParamName);
|
||||
this.endDate = Date.from(newValue.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.endDate = command.localDateValueOfParameterNamed(endDateParamName);
|
||||
}
|
||||
|
||||
final String statusParamName = "status";
|
||||
@@ -221,35 +208,27 @@ public class Teller extends AbstractPersistableCustom {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Date getStartDate() {
|
||||
public LocalDate getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public LocalDate getStartLocalDate() {
|
||||
LocalDate startLocalDate = null;
|
||||
if (this.startDate != null) {
|
||||
startLocalDate = LocalDate.ofInstant(this.startDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return startLocalDate;
|
||||
return this.startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate) {
|
||||
public void setStartDate(LocalDate startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
public LocalDate getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public LocalDate getEndLocalDate() {
|
||||
LocalDate endLocalDate = null;
|
||||
if (this.endDate != null) {
|
||||
endLocalDate = LocalDate.ofInstant(this.endDate.toInstant(), DateUtils.getDateTimeZoneOfTenant());
|
||||
}
|
||||
return endLocalDate;
|
||||
return this.endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
public void setEndDate(LocalDate endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
|
||||
+4
-7
@@ -18,15 +18,13 @@
|
||||
*/
|
||||
package org.apache.fineract.organisation.teller.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
import org.apache.fineract.portfolio.client.domain.Client;
|
||||
@@ -57,9 +55,8 @@ public class TellerTransaction extends AbstractPersistableCustom {
|
||||
@Column(name = "amount", nullable = false)
|
||||
private Double amount;
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "posting_date", nullable = false)
|
||||
private Date postingDate;
|
||||
private LocalDate postingDate;
|
||||
|
||||
public TellerTransaction() {
|
||||
|
||||
@@ -113,11 +110,11 @@ public class TellerTransaction extends AbstractPersistableCustom {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public Date getPostingDate() {
|
||||
public LocalDate getPostingDate() {
|
||||
return postingDate;
|
||||
}
|
||||
|
||||
public void setPostingDate(Date postingDate) {
|
||||
public void setPostingDate(LocalDate postingDate) {
|
||||
this.postingDate = postingDate;
|
||||
}
|
||||
}
|
||||
|
||||
+11
-11
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.organisation.teller.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import org.apache.fineract.infrastructure.core.service.Page;
|
||||
import org.apache.fineract.infrastructure.core.service.SearchParameters;
|
||||
import org.apache.fineract.organisation.teller.data.CashierData;
|
||||
@@ -37,9 +37,9 @@ public interface TellerManagementReadPlatformService {
|
||||
|
||||
CashierData findCashier(Long cashierId);
|
||||
|
||||
Collection<CashierData> getCashierData(Long officeId, Long tellerId, Long staffId, Date date);
|
||||
Collection<CashierData> getCashierData(Long officeId, Long tellerId, Long staffId, LocalDate date);
|
||||
|
||||
Collection<CashierData> getTellerCashiers(Long tellerId, Date date);
|
||||
Collection<CashierData> getTellerCashiers(Long tellerId, LocalDate date);
|
||||
|
||||
CashierData retrieveCashierTemplate(Long officeId, Long tellerId, boolean staffInSelectedOfficeOnly);
|
||||
|
||||
@@ -47,24 +47,24 @@ public interface TellerManagementReadPlatformService {
|
||||
|
||||
TellerTransactionData findTellerTransaction(Long transactionId);
|
||||
|
||||
Collection<TellerTransactionData> fetchTellerTransactionsByTellerId(Long tellerId, Date fromDate, Date toDate);
|
||||
Collection<TellerTransactionData> fetchTellerTransactionsByTellerId(Long tellerId, LocalDate fromDate, LocalDate toDate);
|
||||
|
||||
Collection<TellerJournalData> getJournals(Long officeId, Long tellerId, Long cashierId, Date dateFrom, Date dateTo);
|
||||
Collection<TellerJournalData> getJournals(Long officeId, Long tellerId, Long cashierId, LocalDate dateFrom, LocalDate dateTo);
|
||||
|
||||
Collection<TellerJournalData> fetchTellerJournals(Long tellerId, Long cashierId, Date fromDate, Date toDate);
|
||||
Collection<TellerJournalData> fetchTellerJournals(Long tellerId, Long cashierId, LocalDate fromDate, LocalDate toDate);
|
||||
|
||||
Collection<TellerData> retrieveAllTellersForDropdown(Long officeId);
|
||||
|
||||
Collection<TellerData> retrieveAllTellers(String sqlSearch, Long officeId, String status);
|
||||
|
||||
Collection<CashierData> getCashiersForTeller(Long tellerId, Date fromDate, Date toDate);
|
||||
Collection<CashierData> getCashiersForTeller(Long tellerId, LocalDate fromDate, LocalDate toDate);
|
||||
|
||||
Collection<CashierData> retrieveCashiersForTellers(String sqlSearch, Long tellerId);
|
||||
|
||||
Page<CashierTransactionData> retrieveCashierTransactions(Long cashierId, boolean includeAllTellers, Date fromDate, Date toDate,
|
||||
String currencyCode, SearchParameters searchParameters);
|
||||
Page<CashierTransactionData> retrieveCashierTransactions(Long cashierId, boolean includeAllTellers, LocalDate fromDate,
|
||||
LocalDate toDate, String currencyCode, SearchParameters searchParameters);
|
||||
|
||||
CashierTransactionsWithSummaryData retrieveCashierTransactionsWithSummary(Long cashierId, boolean includeAllTellers, Date fromDate,
|
||||
Date toDate, String currencyCode, SearchParameters searchParameters);
|
||||
CashierTransactionsWithSummaryData retrieveCashierTransactionsWithSummary(Long cashierId, boolean includeAllTellers, LocalDate fromDate,
|
||||
LocalDate toDate, String currencyCode, SearchParameters searchParameters);
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user