FINERACT-826 Migrate to java.time from Joda API
This commit is contained in:
committed by
Awasum Yannick
parent
5f42112278
commit
43ef6e1983
@@ -45,7 +45,6 @@ dependencies {
|
||||
'com.sun.jersey.contribs:jersey-spring',
|
||||
'com.sun.jersey.contribs:jersey-multipart',
|
||||
|
||||
'joda-time:joda-time',
|
||||
'com.google.guava:guava',
|
||||
'com.google.code.gson:gson',
|
||||
'com.sun.jersey:jersey-core',
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ public class AccountNumberPreferencesTest {
|
||||
private final String loanPrincipalAmount = "100000.00";
|
||||
private final String numberOfRepayments = "12";
|
||||
private final String interestRatePerPeriod = "18";
|
||||
private final String dateString = "4 September 2014";
|
||||
private final String dateString = "04 September 2014";
|
||||
private final String minBalanceForInterestCalculation = null;
|
||||
private final String minRequiredBalance = null;
|
||||
private final String enforceMinRequiredBalance = "false";
|
||||
|
||||
+15
-14
@@ -30,6 +30,9 @@ import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
@@ -58,8 +61,6 @@ import org.apache.fineract.integrationtests.common.recurringdeposit.RecurringDep
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
||||
import org.joda.time.Days;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -81,7 +82,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
private static final String LP_REPAYMENT_PERIOD = "2";
|
||||
private static final String LP_INTEREST_RATE = "1";
|
||||
private static final String EXPECTED_DISBURSAL_DATE = "04 March 2011";
|
||||
private static final String LOAN_APPLICATION_SUBMISSION_DATE = "3 March 2011";
|
||||
private static final String LOAN_APPLICATION_SUBMISSION_DATE = "03 March 2011";
|
||||
private static final String TRANSACTION_DATE = "01 March 2013";
|
||||
private static final String LOAN_TERM_FREQUENCY = "10";
|
||||
private static final String INDIVIDUAL_LOAN = "individual";
|
||||
@@ -786,18 +787,18 @@ public class AccountingScenarioIntegrationTest {
|
||||
final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, responseSpec, loanID);
|
||||
// MAKE 1
|
||||
List fromDateList = (List) loanSchedule.get(1).get("fromDate");
|
||||
LocalDate fromDateLocal = LocalDate.now();
|
||||
LocalDate fromDateLocal = LocalDate.now(ZoneId.systemDefault());
|
||||
fromDateLocal = fromDateLocal.withYear((int) fromDateList.get(0));
|
||||
fromDateLocal = fromDateLocal.withMonthOfYear((int) fromDateList.get(1));
|
||||
fromDateLocal = fromDateLocal.withMonth((int) fromDateList.get(1));
|
||||
fromDateLocal = fromDateLocal.withDayOfMonth((int) fromDateList.get(2));
|
||||
|
||||
List dueDateList = (List) loanSchedule.get(1).get("dueDate");
|
||||
LocalDate dueDateLocal = LocalDate.now();
|
||||
LocalDate dueDateLocal = LocalDate.now(ZoneId.systemDefault());
|
||||
dueDateLocal = dueDateLocal.withYear((int) dueDateList.get(0));
|
||||
dueDateLocal = dueDateLocal.withMonthOfYear((int) dueDateList.get(1));
|
||||
dueDateLocal = dueDateLocal.withMonth((int) dueDateList.get(1));
|
||||
dueDateLocal = dueDateLocal.withDayOfMonth((int) dueDateList.get(2));
|
||||
|
||||
int totalDaysInPeriod = Days.daysBetween(fromDateLocal, dueDateLocal).getDays();
|
||||
int totalDaysInPeriod = Math.toIntExact(ChronoUnit.DAYS.between(fromDateLocal, dueDateLocal));
|
||||
|
||||
float totalInterest = (float) loanSchedule.get(1).get("interestOriginalDue");
|
||||
DecimalFormat numberFormat = new DecimalFormat("#.00", new DecimalFormatSymbols(Locale.US));
|
||||
@@ -890,18 +891,18 @@ public class AccountingScenarioIntegrationTest {
|
||||
final ArrayList<HashMap> loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, responseSpec, loanID);
|
||||
// MAKE 1
|
||||
List fromDateList = (List) loanSchedule.get(1).get("fromDate");
|
||||
LocalDate fromDateLocal = LocalDate.now();
|
||||
LocalDate fromDateLocal = LocalDate.now(ZoneId.systemDefault());
|
||||
fromDateLocal = fromDateLocal.withYear((int) fromDateList.get(0));
|
||||
fromDateLocal = fromDateLocal.withMonthOfYear((int) fromDateList.get(1));
|
||||
fromDateLocal = fromDateLocal.withMonth((int) fromDateList.get(1));
|
||||
fromDateLocal = fromDateLocal.withDayOfMonth((int) fromDateList.get(2));
|
||||
|
||||
List dueDateList = (List) loanSchedule.get(1).get("dueDate");
|
||||
LocalDate dueDateLocal = LocalDate.now();
|
||||
LocalDate dueDateLocal = LocalDate.now(ZoneId.systemDefault());
|
||||
dueDateLocal = dueDateLocal.withYear((int) dueDateList.get(0));
|
||||
dueDateLocal = dueDateLocal.withMonthOfYear((int) dueDateList.get(1));
|
||||
dueDateLocal = dueDateLocal.withMonth((int) dueDateList.get(1));
|
||||
dueDateLocal = dueDateLocal.withDayOfMonth((int) dueDateList.get(2));
|
||||
|
||||
int totalDaysInPeriod = Days.daysBetween(fromDateLocal, dueDateLocal).getDays();
|
||||
int totalDaysInPeriod = Math.toIntExact(ChronoUnit.DAYS.between(fromDateLocal, dueDateLocal));
|
||||
|
||||
float totalInterest = (float) loanSchedule.get(1).get("interestOriginalDue");
|
||||
DecimalFormat numberFormat = new DecimalFormat("#.00", new DecimalFormatSymbols(Locale.US));
|
||||
@@ -1041,7 +1042,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
|
||||
private LocalDate getDateAsLocalDate(String dateAsString) throws ParseException {
|
||||
DateFormat df = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
LocalDate date = new LocalDate(df.parse(dateAsString));
|
||||
LocalDate date = LocalDate.ofInstant(df.parse(dateAsString).toInstant(), ZoneId.systemDefault());
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
+21
-19
@@ -31,9 +31,12 @@ import java.math.BigDecimal;
|
||||
import java.text.DateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -54,7 +57,6 @@ import org.apache.fineract.integrationtests.common.savings.AccountTransferHelper
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -755,7 +757,7 @@ public class ClientLoanIntegrationTest {
|
||||
final Integer loanProductID = createLoanProduct(true, NONE);
|
||||
|
||||
List<HashMap> tranches = new ArrayList<>();
|
||||
tranches.add(createTrancheDetail("1 March 2014", "25000"));
|
||||
tranches.add(createTrancheDetail("01 March 2014", "25000"));
|
||||
tranches.add(createTrancheDetail("23 April 2014", "20000"));
|
||||
|
||||
final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, null, null, "45,000.00", tranches);
|
||||
@@ -765,12 +767,12 @@ public class ClientLoanIntegrationTest {
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan("1 March 2014", loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan("01 March 2014", loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
|
||||
// DISBURSE first Tranche
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan("1 March 2014", loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan("01 March 2014", loanID);
|
||||
LOG.info("DISBURSE {}", loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
@@ -798,7 +800,7 @@ public class ClientLoanIntegrationTest {
|
||||
MINIMUM_OPENING_BALANCE);
|
||||
|
||||
List<HashMap> tranches = new ArrayList<>();
|
||||
tranches.add(createTrancheDetail("1 March 2014", "25000"));
|
||||
tranches.add(createTrancheDetail("01 March 2014", "25000"));
|
||||
tranches.add(createTrancheDetail("23 April 2014", "20000"));
|
||||
|
||||
final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, null, savingsId.toString(), "45,000.00",
|
||||
@@ -809,7 +811,7 @@ public class ClientLoanIntegrationTest {
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan("1 March 2014", loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan("01 March 2014", loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
|
||||
@@ -818,7 +820,7 @@ public class ClientLoanIntegrationTest {
|
||||
assertEquals(balance, summary.get("accountBalance"), "Verifying opening Balance");
|
||||
|
||||
// DISBURSE first Tranche
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoanToSavings("1 March 2014", loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoanToSavings("01 March 2014", loanID);
|
||||
LOG.info("DISBURSE {}", loanStatusHashMap.toString());
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
@@ -949,8 +951,8 @@ public class ClientLoanIntegrationTest {
|
||||
.withAmortizationTypeAsEqualPrincipalPayments() //
|
||||
.withInterestTypeAsDecliningBalance() //
|
||||
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod() //
|
||||
.withPrincipalGrace(graceOnPrincipalPayment).withExpectedDisbursementDate("2 June 2014") //
|
||||
.withSubmittedOnDate("2 June 2014") //
|
||||
.withPrincipalGrace(graceOnPrincipalPayment).withExpectedDisbursementDate("02 June 2014") //
|
||||
.withSubmittedOnDate("02 June 2014") //
|
||||
.build(clientID.toString(), loanProductID.toString(), null);
|
||||
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||
}
|
||||
@@ -989,9 +991,9 @@ public class ClientLoanIntegrationTest {
|
||||
.withAmortizationTypeAsEqualInstallments() //
|
||||
.withInterestTypeAsDecliningBalance() //
|
||||
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod() //
|
||||
.withExpectedDisbursementDate("1 March 2014") //
|
||||
.withExpectedDisbursementDate("01 March 2014") //
|
||||
.withTranches(tranches) //
|
||||
.withSubmittedOnDate("1 March 2014") //
|
||||
.withSubmittedOnDate("01 March 2014") //
|
||||
|
||||
.withCharges(charges).build(clientID.toString(), loanProductID.toString(), savingsId);
|
||||
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||
@@ -3089,7 +3091,7 @@ public class ClientLoanIntegrationTest {
|
||||
final HashMap repayment = loanSchedule.get(i);
|
||||
|
||||
final ArrayList<Integer> dueDateAsArray = (ArrayList<Integer>) repayment.get("dueDate");
|
||||
final LocalDate transactionDate = new LocalDate(dueDateAsArray.get(0), dueDateAsArray.get(1), dueDateAsArray.get(2));
|
||||
final LocalDate transactionDate = LocalDate.of(dueDateAsArray.get(0), dueDateAsArray.get(1), dueDateAsArray.get(2));
|
||||
|
||||
final Float interestPortion = BigDecimal.valueOf(Double.valueOf(repayment.get("interestDue").toString()))
|
||||
.subtract(BigDecimal.valueOf(Double.valueOf(repayment.get("interestWaived").toString())))
|
||||
@@ -4487,7 +4489,7 @@ public class ClientLoanIntegrationTest {
|
||||
|
||||
// FINERACT-885: As loan may not have started exactly four months ago,
|
||||
// make final payment today and not four months from start (as that may be in the future)
|
||||
fourMonthsfromNowCalendar.setTime(Utils.getLocalDateOfTenant().toDate());
|
||||
fourMonthsfromNowCalendar.setTime(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
final String now = Utils.convertDateToURLFormat(fourMonthsfromNowCalendar);
|
||||
|
||||
this.loanTransactionHelper.makeRefundByCash(now, Float.valueOf("20"), loanID);
|
||||
@@ -4656,7 +4658,7 @@ public class ClientLoanIntegrationTest {
|
||||
|
||||
// FINERACT-885: As loan may not have started exactly four months ago,
|
||||
// make final payment today and not four months from start (as that may be in the future)
|
||||
fourMonthsfromNowCalendar.setTime(Utils.getLocalDateOfTenant().toDate());
|
||||
fourMonthsfromNowCalendar.setTime(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
final String now = Utils.convertDateToURLFormat(fourMonthsfromNowCalendar);
|
||||
|
||||
this.loanTransactionHelper.makeRefundByCash(now, Float.valueOf("20"), loanID);
|
||||
@@ -4847,7 +4849,7 @@ public class ClientLoanIntegrationTest {
|
||||
|
||||
// FINERACT-885: As loan may not have started exactly four months ago,
|
||||
// make final payment today and not four months from start (as that may be in the future)
|
||||
fourMonthsfromNowCalendar.setTime(Utils.getLocalDateOfTenant().toDate());
|
||||
fourMonthsfromNowCalendar.setTime(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
final String now = Utils.convertDateToURLFormat(fourMonthsfromNowCalendar);
|
||||
|
||||
final String FROM_LOAN_ACCOUNT_TYPE = "1";
|
||||
@@ -5056,8 +5058,8 @@ public class ClientLoanIntegrationTest {
|
||||
.withRepaymentFrequencyTypeAsMonths() //
|
||||
.withInterestRatePerPeriod("2") //
|
||||
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod() //
|
||||
.withExpectedDisbursementDate("1 March 2014") //
|
||||
.withSubmittedOnDate("1 March 2014") //
|
||||
.withExpectedDisbursementDate("01 March 2014") //
|
||||
.withSubmittedOnDate("01 March 2014") //
|
||||
.build(clientID.toString(), loanProductID.toString(), null);
|
||||
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||
}
|
||||
@@ -5080,8 +5082,8 @@ public class ClientLoanIntegrationTest {
|
||||
.withRepaymentFrequencyTypeAsMonths() //
|
||||
.withInterestRatePerPeriod("2") //
|
||||
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod() //
|
||||
.withExpectedDisbursementDate("1 March 2014") //
|
||||
.withSubmittedOnDate("1 March 2014") //
|
||||
.withExpectedDisbursementDate("01 March 2014") //
|
||||
.withSubmittedOnDate("01 March 2014") //
|
||||
.build(clientID.toString(), loanProductID.toString(), null);
|
||||
|
||||
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||
|
||||
+11
-11
@@ -30,6 +30,9 @@ import java.text.DateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
@@ -48,9 +51,6 @@ import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
||||
import org.apache.fineract.portfolio.charge.domain.ChargeTimeType;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -649,8 +649,8 @@ public class ClientSavingsIntegrationTest {
|
||||
HashMap paidCharge = this.savingsAccountHelper.getSavingsCharge(savingsId, (Integer) savingsChargeForPay.get("id"));
|
||||
assertEquals(savingsChargeForPay.get("amount"), paidCharge.get("amountPaid"));
|
||||
List nextDueDates = (List) paidCharge.get("dueDate");
|
||||
LocalDate nextDueDate = new LocalDate((Integer) nextDueDates.get(0), (Integer) nextDueDates.get(1), (Integer) nextDueDates.get(2));
|
||||
LocalDate expectedNextDueDate = new LocalDate((Integer) dates.get(0), (Integer) dates.get(1), (Integer) dates.get(2))
|
||||
LocalDate nextDueDate = LocalDate.of((Integer) nextDueDates.get(0), (Integer) nextDueDates.get(1), (Integer) nextDueDates.get(2));
|
||||
LocalDate expectedNextDueDate = LocalDate.of((Integer) dates.get(0), (Integer) dates.get(1), (Integer) dates.get(2))
|
||||
.plusWeeks((Integer) paidCharge.get("feeInterval"));
|
||||
assertEquals(expectedNextDueDate, nextDueDate);
|
||||
}
|
||||
@@ -1787,10 +1787,10 @@ public class ClientSavingsIntegrationTest {
|
||||
|
||||
savingsList.add(savingsId);
|
||||
|
||||
final DateTimeFormatter formatter = DateTimeFormat.forPattern("dd MMMM yyyy");
|
||||
LocalDate transactionDate = new LocalDate();
|
||||
final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd MMMM yyyy");
|
||||
LocalDate transactionDate = LocalDate.now(ZoneId.systemDefault());
|
||||
for (int i = 0; i < 4; i++) {
|
||||
String transactionDateValue = formatter.print(transactionDate);
|
||||
String transactionDateValue = formatter.format(transactionDate);
|
||||
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsList.get(i), DEPOSIT_AMOUNT,
|
||||
transactionDateValue, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
transactionDate = transactionDate.minusDays(30);
|
||||
@@ -1821,7 +1821,7 @@ public class ClientSavingsIntegrationTest {
|
||||
balance -= chargeAmt;
|
||||
assertEquals(balance, summary.get("accountBalance"), "Verifying account Balance");
|
||||
|
||||
String transactionDateValue = formatter.print(new LocalDate());
|
||||
String transactionDateValue = formatter.format(LocalDate.now(ZoneId.systemDefault()));
|
||||
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsList.get(1), DEPOSIT_AMOUNT,
|
||||
transactionDateValue, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(1));
|
||||
@@ -1840,7 +1840,7 @@ public class ClientSavingsIntegrationTest {
|
||||
balance -= chargeAmt;
|
||||
assertEquals(balance, summary.get("accountBalance"), "Verifying account Balance");
|
||||
|
||||
transactionDateValue = formatter.print(new LocalDate());
|
||||
transactionDateValue = formatter.format(LocalDate.now(ZoneId.systemDefault()));
|
||||
depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsList.get(2), DEPOSIT_AMOUNT,
|
||||
transactionDateValue, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(2));
|
||||
@@ -2030,7 +2030,7 @@ public class ClientSavingsIntegrationTest {
|
||||
error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
Integer releaseTransactionId = this.savingsAccountHelper.releaseAmount(savingsId, holdTransactionId);
|
||||
Date today = Utils.getLocalDateOfTenant().toDate();
|
||||
Date today = Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
String todayDate = today.toString();
|
||||
SimpleDateFormat dt1 = new SimpleDateFormat("dd MMM yyyy");
|
||||
todayDate = dt1.format(today).toString();
|
||||
|
||||
+5
-4
@@ -27,6 +27,7 @@ import io.restassured.specification.RequestSpecification;
|
||||
import io.restassured.specification.ResponseSpecification;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -123,7 +124,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
|
||||
ClientStatusChecker.verifyClientPending(status);
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
Date todaysDate = Utils.getLocalDateOfTenant().toDate();
|
||||
Date todaysDate = Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
final String undoRejectDate = dateFormat.format(todaysDate);
|
||||
|
||||
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoRejectedclient(clientId,
|
||||
@@ -155,7 +156,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
|
||||
status = this.clientHelper.rejectClient(clientId);
|
||||
ClientStatusChecker.verifyClientRejected(status);
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
Date tomorrowsDate = Utils.getLocalDateOfTenant().plusDays(1).toDate();
|
||||
Date tomorrowsDate = Date.from(Utils.getLocalDateOfTenant().plusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
final String undoRejectDate = dateFormat.format(tomorrowsDate);
|
||||
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId,
|
||||
CommonConstants.RESPONSE_ERROR, undoRejectDate);
|
||||
@@ -231,7 +232,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
|
||||
HashMap<String, Object> status = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
|
||||
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
Date todaysDate = Utils.getLocalDateOfTenant().toDate();
|
||||
Date todaysDate = Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
final String undoWithdrawDate = dateFormat.format(todaysDate);
|
||||
|
||||
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId,
|
||||
@@ -263,7 +264,7 @@ public class ClientUndoRejectAndWithdrawalIntegrationTest {
|
||||
status = this.clientHelper.withdrawClient(clientId);
|
||||
ClientStatusChecker.verifyClientWithdrawn(status);
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
Date tomorrowsDate = Utils.getLocalDateOfTenant().plusDays(1).toDate();
|
||||
Date tomorrowsDate = Date.from(Utils.getLocalDateOfTenant().plusDays(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
final String undoWithdrawDate = dateFormat.format(tomorrowsDate);
|
||||
ArrayList<HashMap<String, Object>> clientErrorData = validationErrorHelper.undoWithdrawclient(clientId,
|
||||
CommonConstants.RESPONSE_ERROR, undoWithdrawDate);
|
||||
|
||||
+9
-8
@@ -29,6 +29,9 @@ import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
@@ -54,8 +57,6 @@ import org.apache.fineract.integrationtests.common.fixeddeposit.FixedDepositProd
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Months;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -1565,12 +1566,12 @@ public class FixedDepositTest {
|
||||
Calendar activationDate = Calendar.getInstance();
|
||||
activationDate.add(Calendar.MONTH, -1);
|
||||
activationDate.add(Calendar.DAY_OF_MONTH, -1);
|
||||
DateTime startDate = new DateTime(activationDate.getTime());
|
||||
ZonedDateTime startDate = ZonedDateTime.ofInstant(activationDate.getTime().toInstant(), ZoneId.systemDefault());
|
||||
|
||||
Calendar prematureClosureDate = Calendar.getInstance();
|
||||
DateTime endDate = new DateTime(prematureClosureDate.getTime());
|
||||
ZonedDateTime endDate = ZonedDateTime.ofInstant(prematureClosureDate.getTime().toInstant(), ZoneId.systemDefault());
|
||||
|
||||
Integer depositedPeriod = Months.monthsBetween(startDate, endDate).getMonths();
|
||||
Integer depositedPeriod = Math.toIntExact(ChronoUnit.MONTHS.between(startDate.toLocalDate(), endDate.toLocalDate()));
|
||||
|
||||
Float interestRate = FixedDepositAccountHelper.getInterestRate(interestRateChartData, depositedPeriod);
|
||||
interestRate -= preClosurePenalInterestRate;
|
||||
@@ -1679,12 +1680,12 @@ public class FixedDepositTest {
|
||||
Calendar activationDate = Calendar.getInstance();
|
||||
activationDate.add(Calendar.MONTH, -1);
|
||||
activationDate.add(Calendar.DAY_OF_MONTH, -1);
|
||||
DateTime startDate = new DateTime(activationDate.getTime());
|
||||
ZonedDateTime startDate = ZonedDateTime.ofInstant(activationDate.getTime().toInstant(), ZoneId.systemDefault());
|
||||
|
||||
Calendar prematureClosureDate = Calendar.getInstance();
|
||||
DateTime endDate = new DateTime(prematureClosureDate.getTime());
|
||||
ZonedDateTime endDate = ZonedDateTime.ofInstant(prematureClosureDate.getTime().toInstant(), ZoneId.systemDefault());
|
||||
|
||||
Integer depositedPeriod = Months.monthsBetween(startDate, endDate).getMonths();
|
||||
Integer depositedPeriod = Math.toIntExact(ChronoUnit.MONTHS.between(startDate.toLocalDate(), endDate.toLocalDate()));
|
||||
|
||||
Float interestRate = FixedDepositAccountHelper.getInterestRate(interestRateChartData, depositedPeriod);
|
||||
interestRate -= preClosurePenalInterestRate;
|
||||
|
||||
+6
-4
@@ -28,8 +28,11 @@ import io.restassured.specification.ResponseSpecification;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -43,7 +46,6 @@ import org.apache.fineract.integrationtests.common.charges.ChargesHelper;
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -754,13 +756,13 @@ public class GroupSavingsIntegrationTest {
|
||||
paidCharge = this.savingsAccountHelper.getSavingsCharge(savingsId, (Integer) savingsChargeForPay.get("id"));
|
||||
assertEquals(savingsChargeForPay.get("amount"), paidCharge.get("amountPaid"));
|
||||
List nextDueDates = (List) paidCharge.get("dueDate");
|
||||
LocalDate nextDueDate = new LocalDate((Integer) nextDueDates.get(0), (Integer) nextDueDates.get(1), (Integer) nextDueDates.get(2));
|
||||
LocalDate expectedNextDueDate = new LocalDate((Integer) dates.get(0), (Integer) dates.get(1), (Integer) dates.get(2))
|
||||
LocalDate nextDueDate = LocalDate.of((Integer) nextDueDates.get(0), (Integer) nextDueDates.get(1), (Integer) nextDueDates.get(2));
|
||||
LocalDate expectedNextDueDate = LocalDate.of((Integer) dates.get(0), (Integer) dates.get(1), (Integer) dates.get(2))
|
||||
.plusWeeks((Integer) paidCharge.get("feeInterval"));
|
||||
assertEquals(expectedNextDueDate, nextDueDate);
|
||||
|
||||
this.savingsAccountHelper.closeSavingsAccountAndGetBackRequiredField(savingsId, "true", null,
|
||||
sdf.format(Utils.getLocalDateOfTenant().toDate()));
|
||||
sdf.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant())));
|
||||
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -126,7 +126,7 @@ public class LoanApplicationApprovalTest {
|
||||
public void loanApplicationApprovalAndValidationForMultiDisburseLoans() {
|
||||
|
||||
List<HashMap> createTranches = new ArrayList<>();
|
||||
createTranches.add(createTrancheDetail("1 March 2014", "1000"));
|
||||
createTranches.add(createTrancheDetail("01 March 2014", "1000"));
|
||||
createTranches.add(createTrancheDetail("23 March 2014", "4000"));
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
||||
@@ -146,11 +146,11 @@ public class LoanApplicationApprovalTest {
|
||||
private void trancheLoansApprovedAmountLesserThanProposedAmount(Integer clientID, Integer loanProductID, List<HashMap> createTranches) {
|
||||
final String proposedAmount = "5000";
|
||||
final String approvalAmount = "2000";
|
||||
final String approveDate = "1 March 2014";
|
||||
final String expectedDisbursementDate = "1 March 2014";
|
||||
final String approveDate = "01 March 2014";
|
||||
final String expectedDisbursementDate = "01 March 2014";
|
||||
|
||||
List<HashMap> approveTranches = new ArrayList<>();
|
||||
approveTranches.add(createTrancheDetail("1 March 2014", "1000"));
|
||||
approveTranches.add(createTrancheDetail("01 March 2014", "1000"));
|
||||
approveTranches.add(createTrancheDetail("23 March 2014", "1000"));
|
||||
|
||||
final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, proposedAmount, createTranches);
|
||||
@@ -175,26 +175,26 @@ public class LoanApplicationApprovalTest {
|
||||
final String approvalAmount3 = "400";
|
||||
final String approvalAmount4 = "200";
|
||||
|
||||
final String approveDate = "1 March 2014";
|
||||
final String expectedDisbursementDate = "1 March 2014";
|
||||
final String approveDate = "01 March 2014";
|
||||
final String expectedDisbursementDate = "01 March 2014";
|
||||
|
||||
List<HashMap> approveTranche1 = new ArrayList<>();
|
||||
approveTranche1.add(createTrancheDetail("1 March 2014", "5000"));
|
||||
approveTranche1.add(createTrancheDetail("01 March 2014", "5000"));
|
||||
approveTranche1.add(createTrancheDetail("23 March 2014", "5000"));
|
||||
|
||||
List<HashMap> approveTranche2 = new ArrayList<>();
|
||||
approveTranche2.add(createTrancheDetail("1 March 2014", "1000"));
|
||||
approveTranche2.add(createTrancheDetail("01 March 2014", "1000"));
|
||||
approveTranche2.add(createTrancheDetail("23 March 2014", "1000"));
|
||||
approveTranche2.add(createTrancheDetail("23 March 2014", "1000"));
|
||||
|
||||
List<HashMap> approveTranche3 = new ArrayList<>();
|
||||
approveTranche3.add(createTrancheDetail("1 March 2014", "100"));
|
||||
approveTranche3.add(createTrancheDetail("01 March 2014", "100"));
|
||||
approveTranche3.add(createTrancheDetail("23 March 2014", "100"));
|
||||
approveTranche3.add(createTrancheDetail("24 March 2014", "100"));
|
||||
approveTranche3.add(createTrancheDetail("25 March 2014", "100"));
|
||||
|
||||
List<HashMap> approveTranche4 = new ArrayList<>();
|
||||
approveTranche4.add(createTrancheDetail("1 March 2014", "100"));
|
||||
approveTranche4.add(createTrancheDetail("01 March 2014", "100"));
|
||||
approveTranche4.add(createTrancheDetail("23 March 2014", "100"));
|
||||
approveTranche4.add(createTrancheDetail("24 March 2014", "100"));
|
||||
|
||||
@@ -263,10 +263,10 @@ public class LoanApplicationApprovalTest {
|
||||
//
|
||||
.withNumberOfRepayments("5").withRepaymentEveryAfter("1").withRepaymentFrequencyTypeAsMonths() //
|
||||
.withInterestRatePerPeriod("2") //
|
||||
.withExpectedDisbursementDate("1 March 2014") //
|
||||
.withExpectedDisbursementDate("01 March 2014") //
|
||||
.withTranches(tranches) //
|
||||
.withInterestTypeAsDecliningBalance() //
|
||||
.withSubmittedOnDate("1 March 2014") //
|
||||
.withSubmittedOnDate("01 March 2014") //
|
||||
.build(clientID.toString(), loanProductID.toString(), null);
|
||||
|
||||
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||
|
||||
+7
-7
@@ -62,9 +62,9 @@ public class LoanApplicationUndoLastTrancheTest {
|
||||
|
||||
final String proposedAmount = "5000";
|
||||
final String approvalAmount = "2000";
|
||||
final String approveDate = "1 March 2014";
|
||||
final String expectedDisbursementDate = "1 March 2014";
|
||||
final String disbursalDate = "1 March 2014";
|
||||
final String approveDate = "01 March 2014";
|
||||
final String expectedDisbursementDate = "01 March 2014";
|
||||
final String disbursalDate = "01 March 2014";
|
||||
|
||||
// CREATE CLIENT
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
|
||||
@@ -79,12 +79,12 @@ public class LoanApplicationUndoLastTrancheTest {
|
||||
|
||||
// CREATE TRANCHES
|
||||
List<HashMap> createTranches = new ArrayList<>();
|
||||
createTranches.add(this.loanApplicationApprovalTest.createTrancheDetail("1 March 2014", "1000"));
|
||||
createTranches.add(this.loanApplicationApprovalTest.createTrancheDetail("01 March 2014", "1000"));
|
||||
createTranches.add(this.loanApplicationApprovalTest.createTrancheDetail("23 June 2014", "4000"));
|
||||
|
||||
// APPROVE TRANCHES
|
||||
List<HashMap> approveTranches = new ArrayList<>();
|
||||
approveTranches.add(this.loanApplicationApprovalTest.createTrancheDetail("1 March 2014", "1000"));
|
||||
approveTranches.add(this.loanApplicationApprovalTest.createTrancheDetail("01 March 2014", "1000"));
|
||||
approveTranches.add(this.loanApplicationApprovalTest.createTrancheDetail("23 June 2014", "1000"));
|
||||
|
||||
// APPLY FOR LOAN WITH TRANCHES
|
||||
@@ -141,10 +141,10 @@ public class LoanApplicationUndoLastTrancheTest {
|
||||
//
|
||||
.withNumberOfRepayments("5").withRepaymentEveryAfter("1").withRepaymentFrequencyTypeAsMonths() //
|
||||
.withInterestRatePerPeriod("2") //
|
||||
.withExpectedDisbursementDate("1 March 2014") //
|
||||
.withExpectedDisbursementDate("01 March 2014") //
|
||||
.withTranches(tranches) //
|
||||
.withInterestTypeAsDecliningBalance() //
|
||||
.withSubmittedOnDate("1 March 2014") //
|
||||
.withSubmittedOnDate("01 March 2014") //
|
||||
.build(clientID.toString(), loanProductID.toString(), null);
|
||||
|
||||
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||
|
||||
+2
-2
@@ -61,7 +61,7 @@ public class LoanDisbursalDateValidationTest {
|
||||
public void loanApplicationValidateDisbursalDate() {
|
||||
|
||||
final String proposedAmount = "5000";
|
||||
final String approveDate = "1 March 2014";
|
||||
final String approveDate = "01 March 2014";
|
||||
final String disbursalDate = "02 March 2014";
|
||||
|
||||
// CREATE CLIENT
|
||||
@@ -102,7 +102,7 @@ public class LoanDisbursalDateValidationTest {
|
||||
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID, final String proposedAmount) {
|
||||
final String loanApplication = new LoanApplicationTestBuilder().withPrincipal(proposedAmount).withLoanTermFrequency("5")
|
||||
.withLoanTermFrequencyAsMonths().withNumberOfRepayments("5").withRepaymentEveryAfter("1")
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("2").withExpectedDisbursementDate("1 March 2014")
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("2").withExpectedDisbursementDate("01 March 2014")
|
||||
.withSubmittedOnDate("26 February 2014").build(clientID.toString(), loanProductID.toString(), null);
|
||||
return this.loanTransactionHelper.getLoanId(loanApplication);
|
||||
}
|
||||
|
||||
+2
-2
@@ -382,8 +382,8 @@ public class LoanDisbursementDetailsIntegrationTest {
|
||||
String id = null;
|
||||
addTranches.add(this.loanTransactionHelper.createTrancheDetail(disbursementDetails.get(0).get("id").toString(), date,
|
||||
disbursementDetails.get(0).get("principal").toString()));
|
||||
addTranches.add(this.loanTransactionHelper.createTrancheDetail(id, "3 March 2014", "2000"));
|
||||
addTranches.add(this.loanTransactionHelper.createTrancheDetail(id, "4 March 2014", "500"));
|
||||
addTranches.add(this.loanTransactionHelper.createTrancheDetail(id, "03 March 2014", "2000"));
|
||||
addTranches.add(this.loanTransactionHelper.createTrancheDetail(id, "04 March 2014", "500"));
|
||||
|
||||
/* Add disbursement detail */
|
||||
this.loanTransactionHelper.addAndDeleteDisbursementDetail(this.loanID, this.approvalAmount, this.expectedDisbursementDate,
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public class LoanRescheduleRequestTest {
|
||||
private final String loanPrincipalAmount = "100000.00";
|
||||
private final String numberOfRepayments = "12";
|
||||
private final String interestRatePerPeriod = "18";
|
||||
private final String dateString = "4 September 2014";
|
||||
private final String dateString = "04 September 2014";
|
||||
|
||||
@BeforeEach
|
||||
public void initialize() {
|
||||
|
||||
+15
-15
@@ -95,7 +95,7 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
LOG.info("-----------------------------------RE-APPROVE LOAN-----------------------------------------");
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan("1 October 2010", loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan("01 October 2010", loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
|
||||
@@ -106,7 +106,7 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
|
||||
// PERFORM REPAYMENTS AND CHECK LOAN STATUS
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(1, 4000.0F, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("1 January 2011", 540.0f, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("01 January 2011", 540.0f, loanID);
|
||||
|
||||
// UNDO DISBURSE LOAN
|
||||
loanStatusHashMap = this.loanTransactionHelper.undoDisbursal(loanID);
|
||||
@@ -122,20 +122,20 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
final float repayment_without_interest = 500.0f;
|
||||
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(1, 4000.0F, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("1 January 2011", repayment_with_interest, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("1 March 2011", repayment_with_interest, loanID);
|
||||
this.loanTransactionHelper.waiveInterest("1 May 2011", INTEREST_VALUE_AMOUNT, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("1 May 2011", repayment_without_interest, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("1 July 2011", repayment_with_interest, loanID);
|
||||
this.loanTransactionHelper.waiveInterest("1 September 2011", INTEREST_VALUE_AMOUNT, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("1 September 2011", repayment_without_interest, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("1 November 2011", repayment_with_interest, loanID);
|
||||
this.loanTransactionHelper.waiveInterest("1 January 2012", INTEREST_VALUE_AMOUNT, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("1 January 2012", repayment_without_interest, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("01 January 2011", repayment_with_interest, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("01 March 2011", repayment_with_interest, loanID);
|
||||
this.loanTransactionHelper.waiveInterest("01 May 2011", INTEREST_VALUE_AMOUNT, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("01 May 2011", repayment_without_interest, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("01 July 2011", repayment_with_interest, loanID);
|
||||
this.loanTransactionHelper.waiveInterest("01 September 2011", INTEREST_VALUE_AMOUNT, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("01 September 2011", repayment_without_interest, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("01 November 2011", repayment_with_interest, loanID);
|
||||
this.loanTransactionHelper.waiveInterest("01 January 2012", INTEREST_VALUE_AMOUNT, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("01 January 2012", repayment_without_interest, loanID);
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(7, 1000.0f, loanID);
|
||||
|
||||
// WRITE OFF LOAN AND CHECK ACCOUNT IS CLOSED
|
||||
LoanStatusChecker.verifyLoanAccountIsClosed(this.loanTransactionHelper.writeOffLoan("1 March 2012", loanID));
|
||||
LoanStatusChecker.verifyLoanAccountIsClosed(this.loanTransactionHelper.writeOffLoan("01 March 2012", loanID));
|
||||
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
final float repayment_with_interest = 680.0f;
|
||||
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(1, 4000.0F, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("1 January 2011", repayment_with_interest, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("01 January 2011", repayment_with_interest, loanID);
|
||||
|
||||
HashMap toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID);
|
||||
Assertions.assertTrue(Float.valueOf("500.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("principalPaid")))) == 0,
|
||||
@@ -179,7 +179,7 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
"Checking for total paid ");
|
||||
|
||||
// WRITE OFF LOAN AND CHECK ACCOUNT IS CLOSED
|
||||
LoanStatusChecker.verifyLoanAccountIsClosed(this.loanTransactionHelper.writeOffLoan("1 January 2011", loanID));
|
||||
LoanStatusChecker.verifyLoanAccountIsClosed(this.loanTransactionHelper.writeOffLoan("01 January 2011", loanID));
|
||||
toLoanSummaryAfter = this.loanTransactionHelper.getLoanSummary(requestSpec, responseSpec, loanID);
|
||||
Assertions.assertTrue(
|
||||
Float.valueOf("4000.0").compareTo(Float.valueOf(String.valueOf(toLoanSummaryAfter.get("principalWrittenOff")))) == 0,
|
||||
|
||||
+4
-4
@@ -58,7 +58,7 @@ public class MinimumDaysBetweenDisbursalAndFirstRepaymentTest {
|
||||
private final String loanPrincipalAmount = "100000.00";
|
||||
private final String numberOfRepayments = "12";
|
||||
private final String interestRatePerPeriod = "18";
|
||||
private final String groupActivationDate = "1 August 2014";
|
||||
private final String groupActivationDate = "01 August 2014";
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
@@ -80,7 +80,7 @@ public class MinimumDaysBetweenDisbursalAndFirstRepaymentTest {
|
||||
// create all required entities
|
||||
this.createRequiredEntities();
|
||||
|
||||
final String disbursalDate = "4 September 2014";
|
||||
final String disbursalDate = "04 September 2014";
|
||||
final String firstRepaymentDate = "11 September 2014";
|
||||
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(loanPrincipalAmount)
|
||||
@@ -130,8 +130,8 @@ public class MinimumDaysBetweenDisbursalAndFirstRepaymentTest {
|
||||
// server
|
||||
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpecForStatusCode403);
|
||||
|
||||
final String disbursalDate = "4 September 2014";
|
||||
final String firstRepaymentDate = "5 September 2014";
|
||||
final String disbursalDate = "04 September 2014";
|
||||
final String firstRepaymentDate = "05 September 2014";
|
||||
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(loanPrincipalAmount)
|
||||
.withLoanTermFrequency(numberOfRepayments).withLoanTermFrequencyAsWeeks().withNumberOfRepayments(numberOfRepayments)
|
||||
|
||||
+9
-8
@@ -27,6 +27,9 @@ import io.restassured.specification.RequestSpecification;
|
||||
import io.restassured.specification.ResponseSpecification;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
@@ -53,8 +56,6 @@ import org.apache.fineract.integrationtests.common.recurringdeposit.RecurringDep
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
|
||||
import org.apache.fineract.integrationtests.common.savings.SavingsStatusChecker;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Months;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -1917,12 +1918,12 @@ public class RecurringDepositTest {
|
||||
Calendar activationDate = Calendar.getInstance();
|
||||
activationDate.add(Calendar.MONTH, -1);
|
||||
activationDate.add(Calendar.DAY_OF_MONTH, -1);
|
||||
DateTime start = new DateTime(activationDate.getTime());
|
||||
ZonedDateTime start = ZonedDateTime.ofInstant(activationDate.getTime().toInstant(), ZoneId.systemDefault());
|
||||
|
||||
Calendar prematureClosureDate = Calendar.getInstance();
|
||||
DateTime end = new DateTime(prematureClosureDate.getTime());
|
||||
ZonedDateTime end = ZonedDateTime.ofInstant(prematureClosureDate.getTime().toInstant(), ZoneId.systemDefault());
|
||||
|
||||
Integer depositedPeriod = Months.monthsBetween(start, end).getMonths();
|
||||
Integer depositedPeriod = Math.toIntExact(ChronoUnit.MONTHS.between(start.toLocalDate(), end.toLocalDate()));
|
||||
|
||||
Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId,
|
||||
DEPOSIT_AMOUNT, expectedFirstDepositOnDate);
|
||||
@@ -2058,12 +2059,12 @@ public class RecurringDepositTest {
|
||||
Calendar activationDate = Calendar.getInstance();
|
||||
activationDate.add(Calendar.MONTH, -1);
|
||||
activationDate.add(Calendar.DAY_OF_MONTH, -1);
|
||||
DateTime start = new DateTime(activationDate.getTime());
|
||||
ZonedDateTime start = ZonedDateTime.ofInstant(activationDate.getTime().toInstant(), ZoneId.systemDefault());
|
||||
|
||||
Calendar prematureClosureDate = Calendar.getInstance();
|
||||
DateTime end = new DateTime(prematureClosureDate.getTime());
|
||||
ZonedDateTime end = ZonedDateTime.ofInstant(prematureClosureDate.getTime().toInstant(), ZoneId.systemDefault());
|
||||
|
||||
Integer depositedPeriod = Months.monthsBetween(start, end).getMonths();
|
||||
Integer depositedPeriod = Math.toIntExact(ChronoUnit.MONTHS.between(start.toLocalDate(), end.toLocalDate()));
|
||||
|
||||
Integer transactionIdForDeposit = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId,
|
||||
DEPOSIT_AMOUNT, expectedFirstDepositOnDate);
|
||||
|
||||
+3
-1
@@ -19,7 +19,9 @@
|
||||
package org.apache.fineract.integrationtests.common;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -153,7 +155,7 @@ public class CenterDomain implements Comparable<CenterDomain> {
|
||||
} else {
|
||||
map.put("active", "false");
|
||||
if (submittedDate == null) {
|
||||
map.put("submittedOnDate", Utils.getLocalDateOfTenant().toDate());
|
||||
map.put("submittedOnDate", Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
} else {
|
||||
map.put("submittedOnDate", submittedDate);
|
||||
}
|
||||
|
||||
+3
-1
@@ -27,6 +27,7 @@ import io.restassured.specification.ResponseSpecification;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@@ -235,7 +236,8 @@ public class ProvisioningIntegrationTest {
|
||||
DateFormat formatter = new SimpleDateFormat("MMM dd, yyyy");
|
||||
Date date1 = formatter.parse(date);
|
||||
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy");
|
||||
String formattedString = simple.format(Utils.getLocalDateOfTenant().toDate());
|
||||
String formattedString = simple
|
||||
.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
Date currentDate = simple.parse(formattedString);
|
||||
if (date1.getTime() == currentDate.getTime()) {
|
||||
provisioningetryAlreadyCreated = true;
|
||||
|
||||
+5
-5
@@ -33,14 +33,14 @@ import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Calendar;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
import java.util.TimeZone;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.conn.HttpHostConnectException;
|
||||
import org.joda.time.DateTimeZone;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -231,10 +231,10 @@ public final class Utils {
|
||||
}
|
||||
|
||||
public static LocalDate getLocalDateOfTenant() {
|
||||
LocalDate today = new LocalDate();
|
||||
final DateTimeZone zone = DateTimeZone.forID(TENANT_TIME_ZONE);
|
||||
LocalDate today = LocalDate.now(ZoneId.systemDefault());
|
||||
final ZoneId zone = ZoneId.of(TENANT_TIME_ZONE);
|
||||
if (zone != null) {
|
||||
today = new LocalDate(zone);
|
||||
today = LocalDate.now(zone);
|
||||
}
|
||||
return today;
|
||||
}
|
||||
|
||||
+2
-2
@@ -28,6 +28,7 @@ import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -38,7 +39,6 @@ import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -647,7 +647,7 @@ public class LoanTransactionHelper {
|
||||
|
||||
if (isAccrualTransaction) {
|
||||
ArrayList<Integer> accrualEntryDateAsArray = (ArrayList<Integer>) transactions.get(i).get("date");
|
||||
LocalDate accrualEntryDate = new LocalDate(accrualEntryDateAsArray.get(0), accrualEntryDateAsArray.get(1),
|
||||
LocalDate accrualEntryDate = LocalDate.of(accrualEntryDateAsArray.get(0), accrualEntryDateAsArray.get(1),
|
||||
accrualEntryDateAsArray.get(2));
|
||||
|
||||
if (transactionDate.equals(accrualEntryDate)) {
|
||||
|
||||
+6
-4
@@ -25,11 +25,13 @@ import com.google.gson.Gson;
|
||||
import io.restassured.path.json.JsonPath;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
import io.restassured.specification.ResponseSpecification;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.report.ReportData;
|
||||
import org.joda.time.LocalDateTime;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -86,7 +88,7 @@ public class CampaignsHelper {
|
||||
LOG.info("------------------------------PERFORM ACTION ON CAMPAIGN DETAILS------------------------------------\n");
|
||||
final String SMS_CAMPAIGNS_ACTION_URL = SMS_CAMPAIGNS_URL + "/" + generatedCampaignId + "?command=" + command + "&"
|
||||
+ Utils.TENANT_IDENTIFIER;
|
||||
String actionDate = Utils.getLocalDateOfTenant().toString(DATE_FORMAT);
|
||||
String actionDate = Utils.getLocalDateOfTenant().format(DateTimeFormatter.ofPattern(DATE_FORMAT));
|
||||
return Utils.performServerPost(requestSpec, responseSpec, SMS_CAMPAIGNS_ACTION_URL, getJSONForCampaignAction(command, actionDate),
|
||||
"resourceId");
|
||||
}
|
||||
@@ -107,7 +109,7 @@ public class CampaignsHelper {
|
||||
map.put("providerId", 1);
|
||||
map.put("triggerType", triggerType);
|
||||
if (2 == triggerType) {
|
||||
map.put("recurrenceStartDate", LocalDateTime.now().toString(DATE_TIME_FORMAT));
|
||||
map.put("recurrenceStartDate", LocalDateTime.now(ZoneId.systemDefault()).format(DateTimeFormatter.ofPattern(DATE_TIME_FORMAT)));
|
||||
map.put("frequency", 1);
|
||||
map.put("interval", "1");
|
||||
}
|
||||
@@ -134,7 +136,7 @@ public class CampaignsHelper {
|
||||
map.put("providerId", 1);
|
||||
map.put("triggerType", triggerType);
|
||||
if (2 == triggerType) {
|
||||
map.put("recurrenceStartDate", LocalDateTime.now().toString(DATE_TIME_FORMAT));
|
||||
map.put("recurrenceStartDate", LocalDateTime.now(ZoneId.systemDefault()).format(DateTimeFormatter.ofPattern(DATE_TIME_FORMAT)));
|
||||
}
|
||||
map.put("campaignName", Utils.randomNameGenerator("Campaign_Name_", 5));
|
||||
map.put("campaignType", 1);
|
||||
|
||||
+4
-2
@@ -27,6 +27,7 @@ import io.restassured.builder.ResponseSpecBuilder;
|
||||
import io.restassured.http.ContentType;
|
||||
import io.restassured.specification.RequestSpecification;
|
||||
import io.restassured.specification.ResponseSpecification;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
@@ -206,7 +207,8 @@ public class CampaignsTest {
|
||||
// activating campaign with failure
|
||||
ArrayList<HashMap<String, Object>> campaignDateValidationData = (ArrayList<HashMap<String, Object>>) campaignsHelperWithError
|
||||
.performActionsOnCampaignWithFailure(campaignId, ACTIVATE_COMMAND,
|
||||
Utils.getLocalDateOfTenant().plusDays(1).toString(DATE_FORMAT), CommonConstants.RESPONSE_ERROR);
|
||||
Utils.getLocalDateOfTenant().plusDays(1).format(DateTimeFormatter.ofPattern(DATE_FORMAT)),
|
||||
CommonConstants.RESPONSE_ERROR);
|
||||
assertEquals("error.msg.campaign.activationDate.in.the.future",
|
||||
campaignDateValidationData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
@@ -218,7 +220,7 @@ public class CampaignsTest {
|
||||
// activating campaign with failure
|
||||
ArrayList<HashMap<String, Object>> campaignErrorData = (ArrayList<HashMap<String, Object>>) campaignsHelperWithError
|
||||
.performActionsOnCampaignWithFailure(activatedCampaignId, ACTIVATE_COMMAND,
|
||||
Utils.getLocalDateOfTenant().toString(DATE_FORMAT), CommonConstants.RESPONSE_ERROR);
|
||||
Utils.getLocalDateOfTenant().format(DateTimeFormatter.ofPattern(DATE_FORMAT)), CommonConstants.RESPONSE_ERROR);
|
||||
assertEquals("error.msg.campaign.already.active", campaignErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
// closing campaign again for deletion
|
||||
|
||||
+4
-4
@@ -459,8 +459,8 @@ public class EntityDatatableChecksIntegrationTest {
|
||||
.withAmortizationTypeAsEqualPrincipalPayments() //
|
||||
.withInterestTypeAsDecliningBalance() //
|
||||
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod() //
|
||||
.withPrincipalGrace(graceOnPrincipalPayment).withExpectedDisbursementDate("2 June 2014") //
|
||||
.withSubmittedOnDate("2 June 2014") //
|
||||
.withPrincipalGrace(graceOnPrincipalPayment).withExpectedDisbursementDate("02 June 2014") //
|
||||
.withSubmittedOnDate("02 June 2014") //
|
||||
.withDatatables(getTestDatatableAsJson(registeredTableName)) //
|
||||
.build(clientID.toString(), loanProductID.toString(), null);
|
||||
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||
@@ -480,8 +480,8 @@ public class EntityDatatableChecksIntegrationTest {
|
||||
.withAmortizationTypeAsEqualPrincipalPayments() //
|
||||
.withInterestTypeAsDecliningBalance() //
|
||||
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod() //
|
||||
.withPrincipalGrace(graceOnPrincipalPayment).withExpectedDisbursementDate("2 June 2014") //
|
||||
.withSubmittedOnDate("2 June 2014") //
|
||||
.withPrincipalGrace(graceOnPrincipalPayment).withExpectedDisbursementDate("02 June 2014") //
|
||||
.withSubmittedOnDate("02 June 2014") //
|
||||
.build(clientID.toString(), loanProductID.toString(), null);
|
||||
return this.validationErrorHelper.getLoanError(loanApplicationJSON, responseAttribute);
|
||||
}
|
||||
|
||||
+5
-3
@@ -21,7 +21,9 @@ package org.apache.fineract.integrationtests.common.provisioning;
|
||||
import com.google.gson.Gson;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
@@ -40,7 +42,7 @@ public final class ProvisioningHelper {
|
||||
map.put("loanProducts", addLoanProducts(loanProducts));
|
||||
map.put("definitions", addProvisioningCategories(categories, liability, expense));
|
||||
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy");
|
||||
String formattedString = simple.format(Utils.getLocalDateOfTenant().toDate());
|
||||
String formattedString = simple.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant()));
|
||||
Random rand = new Random();
|
||||
String criteriaName = "General Provisioning Criteria" + formattedString + rand.nextLong();
|
||||
map.put("criteriaName", criteriaName);
|
||||
@@ -54,7 +56,7 @@ public final class ProvisioningHelper {
|
||||
map.put("locale", "en");
|
||||
map.put("dateFormat", "dd MMMM yyyy");
|
||||
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy");
|
||||
map.put("date", simple.format(Utils.getLocalDateOfTenant().toDate()));
|
||||
map.put("date", simple.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant())));
|
||||
String provisioningEntryCreateJson = new Gson().toJson(map);
|
||||
return provisioningEntryCreateJson;
|
||||
}
|
||||
@@ -65,7 +67,7 @@ public final class ProvisioningHelper {
|
||||
map.put("locale", "en");
|
||||
map.put("dateFormat", "dd MMMM yyyy");
|
||||
DateFormat simple = new SimpleDateFormat("dd MMMM yyyy");
|
||||
map.put("date", simple.format(Utils.getLocalDateOfTenant().toDate()));
|
||||
map.put("date", simple.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant())));
|
||||
String provisioningEntryCreateJson = new Gson().toJson(map);
|
||||
return provisioningEntryCreateJson;
|
||||
}
|
||||
|
||||
+10
-4
@@ -26,6 +26,7 @@ import io.restassured.specification.RequestSpecification;
|
||||
import io.restassured.specification.ResponseSpecification;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@@ -200,7 +201,9 @@ public class ShareAccountIntegrationTests {
|
||||
} else if (transactionType.equals("charge.payment")) {
|
||||
Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount")));
|
||||
Assertions.assertEquals("0", String.valueOf(transaction.get("amountPaid")));
|
||||
Assertions.assertEquals(simple.format(Utils.getLocalDateOfTenant().toDate()), simple.format(date));
|
||||
Assertions.assertEquals(
|
||||
simple.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant())),
|
||||
simple.format(date));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +252,8 @@ public class ShareAccountIntegrationTests {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(dateList.get(0), dateList.get(1) - 1, dateList.get(2));
|
||||
Date rejectedDate = cal.getTime();
|
||||
Assertions.assertEquals(simple.format(Utils.getLocalDateOfTenant().toDate()), simple.format(rejectedDate));
|
||||
Assertions.assertEquals(simple.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant())),
|
||||
simple.format(rejectedDate));
|
||||
|
||||
List<Map<String, Object>> transactions = (List<Map<String, Object>>) shareAccountData.get("purchasedShares");
|
||||
Assertions.assertNotNull(transactions);
|
||||
@@ -272,7 +276,7 @@ public class ShareAccountIntegrationTests {
|
||||
} else if (transactionType.equals("charge.payment")) {
|
||||
Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount")));
|
||||
Assertions.assertEquals("0", String.valueOf(transaction.get("amountPaid")));
|
||||
Date transactionDate = Utils.getLocalDateOfTenant().toDate();
|
||||
Date transactionDate = Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
Assertions.assertEquals(simple.format(transactionDate), simple.format(date));
|
||||
}
|
||||
}
|
||||
@@ -358,7 +362,9 @@ public class ShareAccountIntegrationTests {
|
||||
} else if (transactionType.equals("charge.payment")) {
|
||||
Assertions.assertEquals("2.0", String.valueOf(transaction.get("amount")));
|
||||
Assertions.assertEquals("0", String.valueOf(transaction.get("amountPaid")));
|
||||
Assertions.assertEquals(simple.format(Utils.getLocalDateOfTenant().toDate()), simple.format(date));
|
||||
Assertions.assertEquals(
|
||||
simple.format(Date.from(Utils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant())),
|
||||
simple.format(date));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -21,13 +21,13 @@ package org.apache.fineract.integrationtests.common.shares;
|
||||
import com.google.gson.Gson;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
+1
-1
@@ -24,6 +24,7 @@ import static org.apache.fineract.accounting.accrual.api.AccrualAccountingConsta
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import java.lang.reflect.Type;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
@@ -40,7 +41,6 @@ import org.apache.fineract.infrastructure.core.serialization.FromApiJsonDeserial
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.command.GuarantorCommand;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
+1
-1
@@ -22,6 +22,7 @@ import static org.apache.fineract.accounting.accrual.api.AccrualAccountingConsta
|
||||
import static org.apache.fineract.accounting.accrual.api.AccrualAccountingConstants.PERIODIC_ACCRUAL_ACCOUNTING_RESOURCE_NAME;
|
||||
import static org.apache.fineract.accounting.accrual.api.AccrualAccountingConstants.accrueTillParamName;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.accounting.accrual.serialization.AccrualAccountingDataValidator;
|
||||
@@ -32,7 +33,6 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.MultiException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.portfolio.loanaccount.service.LoanAccrualPlatformService;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
package org.apache.fineract.accounting.closure.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.joda.time.LocalDate;
|
||||
import java.time.LocalDate;
|
||||
|
||||
final class GLClosuresApiResourceSwagger {
|
||||
|
||||
|
||||
+1
-1
@@ -18,13 +18,13 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.closure.command;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.accounting.closure.api.GLClosureJsonInputParams;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
/**
|
||||
* Immutable command for adding an accounting closure
|
||||
|
||||
+1
-1
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.closure.data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import org.apache.fineract.organisation.office.data.OfficeData;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
/**
|
||||
* Immutable object representing a General Ledger Account
|
||||
|
||||
+1
-1
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.closure.exception;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
/**
|
||||
* A {@link RuntimeException} thrown when a GL Closure for a given date and Office combination is already present
|
||||
|
||||
+1
-1
@@ -21,6 +21,7 @@ package org.apache.fineract.accounting.closure.serialization;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import java.lang.reflect.Type;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -31,7 +32,6 @@ import org.apache.fineract.infrastructure.core.serialization.AbstractFromApiJson
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromApiJsonDeserializer;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.command.GuarantorCommand;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
+1
-1
@@ -20,13 +20,13 @@ package org.apache.fineract.accounting.closure.service;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.accounting.closure.data.GLClosureData;
|
||||
import org.apache.fineract.accounting.closure.exception.GLClosureNotFoundException;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
+4
-2
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.closure.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.accounting.closure.api.GLClosureJsonInputParams;
|
||||
@@ -36,7 +38,6 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuild
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
import org.apache.fineract.organisation.office.domain.OfficeRepositoryWrapper;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -149,7 +150,8 @@ 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()),
|
||||
new LocalDate(command.dateValueOfParameterNamed(GLClosureJsonInputParams.CLOSING_DATE.getValue())));
|
||||
LocalDate.ofInstant(command.dateValueOfParameterNamed(GLClosureJsonInputParams.CLOSING_DATE.getValue()).toInstant(),
|
||||
ZoneId.systemDefault()));
|
||||
}
|
||||
|
||||
LOG.error("Error occured.", dve);
|
||||
|
||||
+3
-2
@@ -18,11 +18,12 @@
|
||||
*/
|
||||
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;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
/**
|
||||
* Class for parsing dates sent as query parameters
|
||||
@@ -40,6 +41,6 @@ public class DateParam {
|
||||
public Date 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 localDate.toDate();
|
||||
return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -19,13 +19,13 @@
|
||||
package org.apache.fineract.accounting.journalentry.command;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.accounting.journalentry.api.JournalEntryJsonInputParams;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
/**
|
||||
* Immutable command for adding an accounting closure
|
||||
|
||||
+1
-1
@@ -19,11 +19,11 @@
|
||||
package org.apache.fineract.accounting.journalentry.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.organisation.monetary.data.CurrencyData;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
/**
|
||||
* Immutable object representing a General Ledger Account
|
||||
|
||||
+1
-1
@@ -18,9 +18,9 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.journalentry.data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
public final class OfficeOpeningBalancesData {
|
||||
|
||||
|
||||
+1
-1
@@ -24,6 +24,7 @@ import com.google.gson.JsonObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
@@ -36,7 +37,6 @@ import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.AbstractFromApiJsonDeserializer;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromApiJsonDeserializer;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
+7
-5
@@ -19,6 +19,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.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -72,7 +74,6 @@ import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionEnumD
|
||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccountTransaction;
|
||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccountTransactionRepository;
|
||||
import org.apache.fineract.portfolio.shareaccounts.data.ShareAccountTransactionEnumData;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -131,7 +132,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 = ((LocalDate) map.get("date")).toDate();
|
||||
final Date transactionDate = Date.from(((LocalDate) map.get("date")).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
final LoanTransactionEnumData transactionType = (LoanTransactionEnumData) map.get("type");
|
||||
final BigDecimal amount = (BigDecimal) map.get("amount");
|
||||
final BigDecimal principal = (BigDecimal) map.get("principalPortion");
|
||||
@@ -198,7 +199,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 = ((LocalDate) map.get("date")).toDate();
|
||||
final Date transactionDate = Date.from(((LocalDate) map.get("date")).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
final SavingsAccountTransactionEnumData transactionType = (SavingsAccountTransactionEnumData) map.get("type");
|
||||
final BigDecimal amount = (BigDecimal) map.get("amount");
|
||||
final boolean reversed = (Boolean) map.get("reversed");
|
||||
@@ -267,7 +268,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 = ((LocalDate) map.get("date")).toDate();
|
||||
final Date transactionDate = Date.from(((LocalDate) map.get("date")).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
final ShareAccountTransactionEnumData transactionType = (ShareAccountTransactionEnumData) map.get("type");
|
||||
final ShareAccountTransactionEnumData transactionStatus = (ShareAccountTransactionEnumData) map.get("status");
|
||||
final BigDecimal amount = (BigDecimal) map.get("amount");
|
||||
@@ -303,7 +304,8 @@ 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 = ((LocalDate) accountingBridgeData.get("date")).toDate();
|
||||
final Date transactionDate = Date
|
||||
.from(((LocalDate) accountingBridgeData.get("date")).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
final EnumOptionData transactionType = (EnumOptionData) accountingBridgeData.get("type");
|
||||
final BigDecimal amount = (BigDecimal) accountingBridgeData.get("amount");
|
||||
final boolean reversed = (Boolean) accountingBridgeData.get("reversed");
|
||||
|
||||
+1
-1
@@ -23,6 +23,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
@@ -60,7 +61,6 @@ import org.apache.fineract.portfolio.paymentdetail.data.PaymentDetailData;
|
||||
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
|
||||
import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionEnumData;
|
||||
import org.apache.fineract.portfolio.savings.service.SavingsEnumerations;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
+3
-2
@@ -19,6 +19,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;
|
||||
@@ -76,7 +78,6 @@ import org.apache.fineract.portfolio.client.domain.ClientTransaction;
|
||||
import org.apache.fineract.portfolio.paymentdetail.domain.PaymentDetail;
|
||||
import org.apache.fineract.portfolio.paymentdetail.service.PaymentDetailWritePlatformService;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -592,7 +593,7 @@ 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 = entryLocalDate.toDateTimeAtStartOfDay().toDate();
|
||||
final Date transactionDate = Date.from(entryLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
// shouldn't be in the future
|
||||
final Date todaysDate = new Date();
|
||||
if (transactionDate.after(todaysDate)) {
|
||||
|
||||
+1
-1
@@ -21,6 +21,7 @@ package org.apache.fineract.accounting.provisioning.serialization;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import java.lang.reflect.Type;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
@@ -36,7 +37,6 @@ import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidati
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.provisioning.exception.ProvisioningCriteriaCannotBeCreatedException;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
+4
-3
@@ -19,6 +19,8 @@
|
||||
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;
|
||||
@@ -58,7 +60,6 @@ import org.apache.fineract.organisation.provisioning.service.ProvisioningCriteri
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRepository;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -150,13 +151,13 @@ public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements
|
||||
|
||||
private Date parseDate(JsonCommand command) {
|
||||
LocalDate localDate = this.fromApiJsonHelper.extractLocalDateNamed("date", command.parsedJson());
|
||||
return localDate.toDate();
|
||||
return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
}
|
||||
|
||||
@Override
|
||||
@CronTarget(jobName = JobName.GENERATE_LOANLOSS_PROVISIONING)
|
||||
public void generateLoanLossProvisioningAmount() {
|
||||
Date currentDate = DateUtils.getLocalDateOfTenant().toDate();
|
||||
Date currentDate = Date.from(DateUtils.getLocalDateOfTenant().atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
boolean addJournalEntries = true;
|
||||
try {
|
||||
Collection<ProvisioningCriteriaData> criteriaCollection = this.provisioningCriteriaReadPlatformService
|
||||
|
||||
+10
-10
@@ -18,12 +18,12 @@
|
||||
*/
|
||||
package org.apache.fineract.adhocquery.data;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import org.apache.fineract.adhocquery.domain.ReportRunFrequency;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* Immutable data object represent note or case information AdHocData
|
||||
@@ -46,13 +46,13 @@ public class AdHocData {
|
||||
@SuppressWarnings("unused")
|
||||
private final boolean isActive;
|
||||
@SuppressWarnings("unused")
|
||||
private final DateTime createdOn;
|
||||
private final ZonedDateTime createdOn;
|
||||
@SuppressWarnings("unused")
|
||||
private final Long createdById;
|
||||
@SuppressWarnings("unused")
|
||||
private final Long updatedById;
|
||||
@SuppressWarnings("unused")
|
||||
private final DateTime updatedOn;
|
||||
private final ZonedDateTime updatedOn;
|
||||
@SuppressWarnings("unused")
|
||||
private final String createdBy;
|
||||
|
||||
@@ -62,12 +62,12 @@ public class AdHocData {
|
||||
|
||||
private final Long reportRunEvery;
|
||||
|
||||
private final DateTime lastRun;
|
||||
private final ZonedDateTime lastRun;
|
||||
|
||||
public AdHocData(final Long id, final String name, final String query, final String tableName, final String tableFields,
|
||||
final boolean isActive, final DateTime createdOn, final Long createdById, final Long updatedById, final DateTime updatedOn,
|
||||
final String createdBy, final String email, final List<EnumOptionData> reportRunFrequencies, final Long reportRunFrequency,
|
||||
final Long reportRunEvery, final DateTime lastRun) {
|
||||
final boolean isActive, final ZonedDateTime createdOn, final Long createdById, final Long updatedById,
|
||||
final ZonedDateTime updatedOn, final String createdBy, final String email, final List<EnumOptionData> reportRunFrequencies,
|
||||
final Long reportRunFrequency, final Long reportRunEvery, final ZonedDateTime lastRun) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.query = query;
|
||||
@@ -123,7 +123,7 @@ public class AdHocData {
|
||||
return this.isActive;
|
||||
}
|
||||
|
||||
public DateTime getCreatedOn() {
|
||||
public ZonedDateTime getCreatedOn() {
|
||||
return this.createdOn;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ public class AdHocData {
|
||||
return this.updatedById;
|
||||
}
|
||||
|
||||
public DateTime getUpdatedOn() {
|
||||
public ZonedDateTime getUpdatedOn() {
|
||||
return this.updatedOn;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public class AdHocData {
|
||||
return this.reportRunEvery;
|
||||
}
|
||||
|
||||
public DateTime getLastRun() {
|
||||
public ZonedDateTime getLastRun() {
|
||||
return this.lastRun;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -20,12 +20,12 @@ package org.apache.fineract.adhocquery.service;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Collection;
|
||||
import org.apache.fineract.adhocquery.data.AdHocData;
|
||||
import org.apache.fineract.adhocquery.exception.AdHocNotFoundException;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
import org.joda.time.DateTime;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
@@ -81,15 +81,15 @@ public class AdHocReadPlatformServiceImpl implements AdHocReadPlatformService {
|
||||
final String tableName = rs.getString("tableName");
|
||||
final String tableFields = rs.getString("tableField");
|
||||
final Boolean isActive = rs.getBoolean("isActive");
|
||||
final DateTime createdDate = JdbcSupport.getDateTime(rs, "createdDate");
|
||||
final ZonedDateTime createdDate = JdbcSupport.getDateTime(rs, "createdDate");
|
||||
final Long createdById = JdbcSupport.getLong(rs, "createdById");
|
||||
final Long updatedById = JdbcSupport.getLong(rs, "updatedById");
|
||||
final DateTime updatedOn = JdbcSupport.getDateTime(rs, "updatedOn");
|
||||
final ZonedDateTime updatedOn = JdbcSupport.getDateTime(rs, "updatedOn");
|
||||
final String createdByUsername = rs.getString("createdBy");
|
||||
final String email = rs.getString("email");
|
||||
final Long reportRunFrequency = JdbcSupport.getLong(rs, "report_run_frequency_code");
|
||||
final Long reportRunEvery = JdbcSupport.getLong(rs, "report_run_every");
|
||||
final DateTime lastRun = JdbcSupport.getDateTime(rs, "last_run");
|
||||
final ZonedDateTime lastRun = JdbcSupport.getDateTime(rs, "last_run");
|
||||
|
||||
return new AdHocData(id, name, query, tableName, tableFields, isActive, createdDate, createdById, updatedById, updatedOn,
|
||||
createdByUsername, email, AdHocData.template().getReportRunFrequencies(), reportRunFrequency, reportRunEvery, lastRun);
|
||||
|
||||
+10
-11
@@ -18,6 +18,10 @@
|
||||
*/
|
||||
package org.apache.fineract.adhocquery.service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import org.apache.fineract.adhocquery.data.AdHocData;
|
||||
@@ -26,11 +30,6 @@ import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||
import org.apache.fineract.infrastructure.jobs.annotation.CronTarget;
|
||||
import org.apache.fineract.infrastructure.jobs.service.JobName;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Days;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.Months;
|
||||
import org.joda.time.Years;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -65,27 +64,27 @@ public class AdHocScheduledJobRunnerServiceImpl implements AdHocScheduledJobRunn
|
||||
if (adhoc.getReportRunFrequency() != null) {
|
||||
if (adhoc.getLastRun() != null) {
|
||||
LocalDate start = adhoc.getLastRun().toLocalDate();
|
||||
LocalDate end = new DateTime().toLocalDate();
|
||||
LocalDate end = ZonedDateTime.now(ZoneId.systemDefault()).toLocalDate();
|
||||
switch (ReportRunFrequency.fromId(adhoc.getReportRunFrequency())) {
|
||||
case DAILY:
|
||||
next = start.plusDays(1);
|
||||
run = Days.daysBetween(start, end).getDays() >= 1;
|
||||
run = Math.toIntExact(ChronoUnit.DAYS.between(start, end)) >= 1;
|
||||
break;
|
||||
case WEEKLY:
|
||||
next = start.plusDays(7);
|
||||
run = Days.daysBetween(start, end).getDays() >= 7;
|
||||
run = Math.toIntExact(ChronoUnit.DAYS.between(start, end)) >= 7;
|
||||
break;
|
||||
case MONTHLY:
|
||||
next = start.plusMonths(1);
|
||||
run = Months.monthsBetween(start, end).getMonths() >= 1;
|
||||
run = Math.toIntExact(ChronoUnit.MONTHS.between(start, end)) >= 1;
|
||||
break;
|
||||
case YEARLY:
|
||||
next = start.plusYears(1);
|
||||
run = Years.yearsBetween(start, end).getYears() >= 1;
|
||||
run = Math.toIntExact(ChronoUnit.YEARS.between(start, end)) >= 1;
|
||||
break;
|
||||
case CUSTOM:
|
||||
next = start.plusDays((int) (long) adhoc.getReportRunEvery());
|
||||
run = Days.daysBetween(start, end).getDays() >= adhoc.getReportRunEvery();
|
||||
run = Math.toIntExact(ChronoUnit.DAYS.between(start, end)) >= adhoc.getReportRunEvery();
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException();
|
||||
|
||||
+3
-3
@@ -19,11 +19,11 @@
|
||||
package org.apache.fineract.commands.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.commands.data.ProcessingResultLookup;
|
||||
import org.apache.fineract.useradministration.data.AppUserData;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
* Created by sanyam on 27/7/17.
|
||||
@@ -47,9 +47,9 @@ final class MakercheckersApiResourceSwagger {
|
||||
public Long resourceId;
|
||||
public Long subresourceId;
|
||||
public String maker;
|
||||
public DateTime madeOnDate;
|
||||
public ZonedDateTime madeOnDate;
|
||||
public String checker;
|
||||
public DateTime checkedOnDate;
|
||||
public ZonedDateTime checkedOnDate;
|
||||
public String processingResult;
|
||||
public String commandAsJson;
|
||||
public String officeName;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.commands.data;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
/**
|
||||
* Immutable data object representing client data.
|
||||
@@ -37,11 +37,11 @@ public final class AuditData {
|
||||
@SuppressWarnings("unused")
|
||||
private final String maker;
|
||||
@SuppressWarnings("unused")
|
||||
private final DateTime madeOnDate;
|
||||
private final ZonedDateTime madeOnDate;
|
||||
@SuppressWarnings("unused")
|
||||
private final String checker;
|
||||
@SuppressWarnings("unused")
|
||||
private final DateTime checkedOnDate;
|
||||
private final ZonedDateTime checkedOnDate;
|
||||
@SuppressWarnings("unused")
|
||||
private final String processingResult;
|
||||
private String commandAsJson;
|
||||
@@ -65,7 +65,7 @@ public final class AuditData {
|
||||
private final String url;
|
||||
|
||||
public AuditData(final Long id, final String actionName, final String entityName, final Long resourceId, final Long subresourceId,
|
||||
final String maker, final DateTime madeOnDate, final String checker, final DateTime checkedOnDate,
|
||||
final String maker, final ZonedDateTime madeOnDate, final String checker, final ZonedDateTime checkedOnDate,
|
||||
final String processingResult, final String commandAsJson, final String officeName, final String groupLevelName,
|
||||
final String groupName, final String clientName, final String loanAccountNo, final String savingsAccountNo, final Long clientId,
|
||||
final Long loanId, final String url) {
|
||||
|
||||
+9
-8
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.commands.domain;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -30,7 +32,6 @@ 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.useradministration.domain.AppUser;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
@Entity
|
||||
@Table(name = "m_portfolio_command_source")
|
||||
@@ -102,7 +103,7 @@ public class CommandSource extends AbstractPersistableCustom {
|
||||
|
||||
public static CommandSource fullEntryFrom(final CommandWrapper wrapper, final JsonCommand command, final AppUser maker) {
|
||||
return new CommandSource(wrapper.actionName(), wrapper.entityName(), wrapper.getHref(), command.entityId(), command.subentityId(),
|
||||
command.json(), maker, DateTime.now());
|
||||
command.json(), maker, ZonedDateTime.now(ZoneId.systemDefault()));
|
||||
}
|
||||
|
||||
protected CommandSource() {
|
||||
@@ -110,7 +111,7 @@ public class CommandSource extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
private CommandSource(final String actionName, final String entityName, final String href, final Long resourceId,
|
||||
final Long subresourceId, final String commandSerializedAsJson, final AppUser maker, final DateTime madeOnDateTime) {
|
||||
final Long subresourceId, final String commandSerializedAsJson, final AppUser maker, final ZonedDateTime madeOnDateTime) {
|
||||
this.actionName = actionName;
|
||||
this.entityName = entityName;
|
||||
this.resourceGetUrl = href;
|
||||
@@ -118,7 +119,7 @@ public class CommandSource extends AbstractPersistableCustom {
|
||||
this.subresourceId = subresourceId;
|
||||
this.commandAsJson = commandSerializedAsJson;
|
||||
this.maker = maker;
|
||||
this.madeOnDate = madeOnDateTime.toDate();
|
||||
this.madeOnDate = Date.from(madeOnDateTime.toInstant());
|
||||
this.processingResult = CommandProcessingResultType.PROCESSED.getValue();
|
||||
}
|
||||
|
||||
@@ -138,15 +139,15 @@ public class CommandSource extends AbstractPersistableCustom {
|
||||
this.organisationCreditBureauId = organisationCreditBureauId;
|
||||
}
|
||||
|
||||
public void markAsChecked(final AppUser checker, final DateTime checkedOnDate) {
|
||||
public void markAsChecked(final AppUser checker, final ZonedDateTime checkedOnDate) {
|
||||
this.checker = checker;
|
||||
this.checkedOnDate = checkedOnDate.toDate();
|
||||
this.checkedOnDate = Date.from(checkedOnDate.toInstant());
|
||||
this.processingResult = CommandProcessingResultType.PROCESSED.getValue();
|
||||
}
|
||||
|
||||
public void markAsRejected(final AppUser checker, final DateTime checkedOnDate) {
|
||||
public void markAsRejected(final AppUser checker, final ZonedDateTime checkedOnDate) {
|
||||
this.checker = checker;
|
||||
this.checkedOnDate = checkedOnDate.toDate();
|
||||
this.checkedOnDate = Date.from(checkedOnDate.toInstant());
|
||||
this.processingResult = CommandProcessingResultType.REJECTED.getValue();
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -24,6 +24,7 @@ import com.google.gson.JsonObject;
|
||||
import java.lang.reflect.Type;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
@@ -63,7 +64,6 @@ import org.apache.fineract.portfolio.savings.service.SavingsProductReadPlatformS
|
||||
import org.apache.fineract.useradministration.data.AppUserData;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.apache.fineract.useradministration.service.AppUserReadPlatformService;
|
||||
import org.joda.time.DateTime;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -157,9 +157,9 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
|
||||
final Long loanId = JdbcSupport.getLong(rs, "loanId");
|
||||
final Long subresourceId = JdbcSupport.getLong(rs, "subresourceId");
|
||||
final String maker = rs.getString("maker");
|
||||
final DateTime madeOnDate = JdbcSupport.getDateTime(rs, "madeOnDate");
|
||||
final ZonedDateTime madeOnDate = JdbcSupport.getDateTime(rs, "madeOnDate");
|
||||
final String checker = rs.getString("checker");
|
||||
final DateTime checkedOnDate = JdbcSupport.getDateTime(rs, "checkedOnDate");
|
||||
final ZonedDateTime checkedOnDate = JdbcSupport.getDateTime(rs, "checkedOnDate");
|
||||
final String processingResult = rs.getString("processingResult");
|
||||
final String resourceGetUrl = rs.getString("resourceGetUrl");
|
||||
String commandAsJson;
|
||||
|
||||
+3
-2
@@ -19,6 +19,8 @@
|
||||
package org.apache.fineract.commands.service;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Random;
|
||||
import org.apache.fineract.commands.domain.CommandSource;
|
||||
import org.apache.fineract.commands.domain.CommandSourceRepository;
|
||||
@@ -33,7 +35,6 @@ import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
|
||||
import org.apache.fineract.infrastructure.jobs.service.SchedulerJobRunnerReadService;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.joda.time.DateTime;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -186,7 +187,7 @@ public class PortfolioCommandSourceWritePlatformServiceImpl implements Portfolio
|
||||
final CommandSource commandSourceInput = validateMakerCheckerTransaction(makerCheckerId);
|
||||
validateIsUpdateAllowed();
|
||||
final AppUser maker = this.context.authenticatedUser();
|
||||
commandSourceInput.markAsRejected(maker, DateTime.now());
|
||||
commandSourceInput.markAsRejected(maker, ZonedDateTime.now(ZoneId.systemDefault()));
|
||||
this.commandSourceRepository.save(commandSourceInput);
|
||||
return makerCheckerId;
|
||||
}
|
||||
|
||||
+3
-2
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.commands.service;
|
||||
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Map;
|
||||
import org.apache.fineract.commands.domain.CommandSource;
|
||||
import org.apache.fineract.commands.domain.CommandSourceRepository;
|
||||
@@ -36,7 +38,6 @@ import org.apache.fineract.infrastructure.hooks.event.HookEvent;
|
||||
import org.apache.fineract.infrastructure.hooks.event.HookEventSource;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.joda.time.DateTime;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -86,7 +87,7 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
|
||||
CommandSource commandSourceResult = null;
|
||||
if (command.commandId() != null) {
|
||||
commandSourceResult = this.commandSourceRepository.findById(command.commandId()).orElse(null);
|
||||
commandSourceResult.markAsChecked(maker, DateTime.now());
|
||||
commandSourceResult.markAsChecked(maker, ZonedDateTime.now(ZoneId.systemDefault()));
|
||||
} else {
|
||||
commandSourceResult = CommandSource.fullEntryFrom(wrapper, command, maker);
|
||||
}
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.bulkimport.data;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import java.time.LocalDate;
|
||||
|
||||
public final class ImportData {
|
||||
|
||||
|
||||
+6
-5
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.bulkimport.domain;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -30,7 +32,6 @@ import javax.persistence.TemporalType;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.infrastructure.documentmanagement.domain.Document;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.joda.time.LocalDateTime;
|
||||
|
||||
@Entity
|
||||
@Table(name = "m_import_document")
|
||||
@@ -77,7 +78,7 @@ public class ImportDocument extends AbstractPersistableCustom {
|
||||
final Boolean completed = Boolean.FALSE;
|
||||
final Integer successCount = 0;
|
||||
final Integer failureCount = 0;
|
||||
final LocalDateTime endTime = LocalDateTime.now();
|
||||
final LocalDateTime endTime = LocalDateTime.now(ZoneId.systemDefault());
|
||||
|
||||
return new ImportDocument(document, importTime, endTime, completed, entityType, createdBy, totalRecords, successCount,
|
||||
failureCount);
|
||||
@@ -87,8 +88,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 = importTime.toDate();
|
||||
this.endTime = endTime.toDate();
|
||||
this.importTime = Date.from(importTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.endTime = Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.completed = completed;
|
||||
this.entityType = entityType;
|
||||
this.createdBy = createdBy;
|
||||
@@ -99,7 +100,7 @@ public class ImportDocument extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public void update(final LocalDateTime endTime, final Integer successCount, final Integer errorCount) {
|
||||
this.endTime = endTime.toDate();
|
||||
this.endTime = Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||
this.completed = Boolean.TRUE;
|
||||
this.successCount = successCount;
|
||||
this.failureCount = errorCount;
|
||||
|
||||
+3
-2
@@ -20,6 +20,8 @@ package org.apache.fineract.infrastructure.bulkimport.importhandler;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.Iterables;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
@@ -37,7 +39,6 @@ import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.SheetVisibility;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.ss.util.CellReference;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
public final class ImportHandlerUtils {
|
||||
|
||||
@@ -144,7 +145,7 @@ public final class ImportHandlerUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
LocalDate localDate = new LocalDate(c.getDateCellValue());
|
||||
LocalDate localDate = LocalDate.ofInstant(c.getDateCellValue().toInstant(), ZoneId.systemDefault());
|
||||
return localDate;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -21,6 +21,7 @@ package org.apache.fineract.infrastructure.bulkimport.importhandler.center;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.lang.reflect.Type;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -45,7 +46,6 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+1
-1
@@ -20,6 +20,7 @@ package org.apache.fineract.infrastructure.bulkimport.importhandler.client;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -42,7 +43,6 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+1
-1
@@ -20,6 +20,7 @@ package org.apache.fineract.infrastructure.bulkimport.importhandler.client;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -40,7 +41,6 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+1
-1
@@ -23,6 +23,7 @@ import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
@@ -47,7 +48,6 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+1
-1
@@ -21,6 +21,7 @@ package org.apache.fineract.infrastructure.bulkimport.importhandler.fixeddeposit
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
@@ -41,7 +42,6 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+1
-1
@@ -21,6 +21,7 @@ package org.apache.fineract.infrastructure.bulkimport.importhandler.group;
|
||||
import com.google.common.reflect.TypeToken;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.lang.reflect.Type;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -45,7 +46,6 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+1
-1
@@ -22,6 +22,7 @@ import com.google.common.base.Splitter;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
@@ -40,7 +41,6 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+3
-2
@@ -23,7 +23,8 @@ import com.google.gson.JsonPrimitive;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import java.lang.reflect.Type;
|
||||
import org.joda.time.LocalDate;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class DateSerializer implements JsonSerializer<LocalDate> {
|
||||
|
||||
@@ -35,6 +36,6 @@ public class DateSerializer implements JsonSerializer<LocalDate> {
|
||||
|
||||
@Override
|
||||
public JsonElement serialize(LocalDate src, Type typeOfSrc, JsonSerializationContext context) {
|
||||
return new JsonPrimitive(src.toString(dateFormat));
|
||||
return new JsonPrimitive(src.format(DateTimeFormatter.ofPattern(dateFormat)));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -20,6 +20,7 @@ package org.apache.fineract.infrastructure.bulkimport.importhandler.journalentry
|
||||
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.accounting.journalentry.data.CreditDebit;
|
||||
@@ -41,7 +42,6 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+1
-1
@@ -23,6 +23,7 @@ import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -48,7 +49,6 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+1
-1
@@ -22,6 +22,7 @@ import com.google.common.base.Splitter;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
@@ -40,7 +41,6 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+1
-1
@@ -19,6 +19,7 @@
|
||||
package org.apache.fineract.infrastructure.bulkimport.importhandler.office;
|
||||
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
@@ -37,7 +38,6 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+1
-1
@@ -21,6 +21,7 @@ package org.apache.fineract.infrastructure.bulkimport.importhandler.recurringdep
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
@@ -44,7 +45,6 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+1
-1
@@ -21,6 +21,7 @@ package org.apache.fineract.infrastructure.bulkimport.importhandler.recurringdep
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
@@ -42,7 +43,6 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+1
-1
@@ -21,6 +21,7 @@ package org.apache.fineract.infrastructure.bulkimport.importhandler.savings;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -45,7 +46,6 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+1
-1
@@ -21,6 +21,7 @@ package org.apache.fineract.infrastructure.bulkimport.importhandler.savings;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
@@ -41,7 +42,6 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+1
-1
@@ -20,6 +20,7 @@ package org.apache.fineract.infrastructure.bulkimport.importhandler.sharedaccoun
|
||||
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
@@ -39,7 +40,6 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+1
-1
@@ -19,6 +19,7 @@
|
||||
package org.apache.fineract.infrastructure.bulkimport.importhandler.staff;
|
||||
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
@@ -37,7 +38,6 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+2
-4
@@ -104,10 +104,8 @@ public abstract class AbstractWorkbookPopulator implements WorkbookPopulator {
|
||||
for (OfficeData office : offices) {
|
||||
Row row = sheet.createRow(++rowIndex);
|
||||
writeString(officeNameCol, row, office.name().trim().replaceAll("[ )(]", "_"));
|
||||
writeDate(
|
||||
activationDateCol, row, "" + office.getOpeningDate().getDayOfMonth() + "/"
|
||||
+ office.getOpeningDate().getMonthOfYear() + "/" + office.getOpeningDate().getYear(),
|
||||
dateCellStyle, dateFormat);
|
||||
writeDate(activationDateCol, row, "" + office.getOpeningDate().getDayOfMonth() + "/"
|
||||
+ office.getOpeningDate().getMonthValue() + "/" + office.getOpeningDate().getYear(), dateCellStyle, dateFormat);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -211,7 +211,7 @@ public class FixedDepositTransactionWorkbookPopulator extends AbstractWorkbookPo
|
||||
}
|
||||
writeDate(TransactionConstants.LOOKUP_SAVINGS_ACTIVATION_DATE_COL, row,
|
||||
"" + savingsAccount.getTimeline().getActivatedOnDate().getDayOfMonth() + "/"
|
||||
+ savingsAccount.getTimeline().getActivatedOnDate().getMonthOfYear() + "/"
|
||||
+ savingsAccount.getTimeline().getActivatedOnDate().getMonthValue() + "/"
|
||||
+ savingsAccount.getTimeline().getActivatedOnDate().getYear(),
|
||||
dateCellStyle, dateFormat);
|
||||
}
|
||||
|
||||
+1
-1
@@ -212,7 +212,7 @@ public class RecurringDepositTransactionWorkbookPopulator extends AbstractWorkbo
|
||||
}
|
||||
writeDate(TransactionConstants.LOOKUP_SAVINGS_ACTIVATION_DATE_COL, row,
|
||||
"" + savingsAccount.getTimeline().getActivatedOnDate().getDayOfMonth() + "/"
|
||||
+ savingsAccount.getTimeline().getActivatedOnDate().getMonthOfYear() + "/"
|
||||
+ savingsAccount.getTimeline().getActivatedOnDate().getMonthValue() + "/"
|
||||
+ savingsAccount.getTimeline().getActivatedOnDate().getYear(),
|
||||
dateCellStyle, dateFormat);
|
||||
}
|
||||
|
||||
+1
-1
@@ -211,7 +211,7 @@ public class SavingsTransactionsWorkbookPopulator extends AbstractWorkbookPopula
|
||||
}
|
||||
writeDate(TransactionConstants.LOOKUP_SAVINGS_ACTIVATION_DATE_COL, row,
|
||||
"" + savingsAccount.getTimeline().getActivatedOnDate().getDayOfMonth() + "/"
|
||||
+ savingsAccount.getTimeline().getActivatedOnDate().getMonthOfYear() + "/"
|
||||
+ savingsAccount.getTimeline().getActivatedOnDate().getMonthValue() + "/"
|
||||
+ savingsAccount.getTimeline().getActivatedOnDate().getYear(),
|
||||
dateCellStyle, dateFormat);
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,6 +27,7 @@ import java.io.InputStream;
|
||||
import java.net.URLConnection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import javax.ws.rs.core.Response;
|
||||
import org.apache.fineract.infrastructure.bulkimport.data.BulkImportEvent;
|
||||
@@ -51,7 +52,6 @@ import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.tika.Tika;
|
||||
import org.apache.tika.io.IOUtils;
|
||||
import org.apache.tika.io.TikaInputStream;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
+10
-10
@@ -18,9 +18,9 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.campaigns.email.data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZonedDateTime;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
public final class EmailCampaignData {
|
||||
|
||||
@@ -47,22 +47,22 @@ public final class EmailCampaignData {
|
||||
@SuppressWarnings("unused")
|
||||
private final String stretchyReportParamMap;
|
||||
@SuppressWarnings("unused")
|
||||
private final DateTime nextTriggerDate;
|
||||
private final ZonedDateTime nextTriggerDate;
|
||||
@SuppressWarnings("unused")
|
||||
private final LocalDate lastTriggerDate;
|
||||
@SuppressWarnings("unused")
|
||||
private final EmailCampaignTimeLine emailCampaignTimeLine;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final DateTime recurrenceStartDate;
|
||||
private final ZonedDateTime recurrenceStartDate;
|
||||
|
||||
private final String recurrence;
|
||||
|
||||
private EmailCampaignData(final Long id, final String campaignName, final Integer campaignType, final Long businessRuleId,
|
||||
final String paramValue, final EnumOptionData campaignStatus, final String emailSubject, final String message,
|
||||
final String emailAttachmentFileFormat, final Long stretchyReportId, final String stretchyReportParamMap,
|
||||
final DateTime nextTriggerDate, final LocalDate lastTriggerDate, final EmailCampaignTimeLine emailCampaignTimeLine,
|
||||
final DateTime recurrenceStartDate, final String recurrence) {
|
||||
final ZonedDateTime nextTriggerDate, final LocalDate lastTriggerDate, final EmailCampaignTimeLine emailCampaignTimeLine,
|
||||
final ZonedDateTime recurrenceStartDate, final String recurrence) {
|
||||
this.id = id;
|
||||
this.campaignName = campaignName;
|
||||
this.campaignType = campaignType;
|
||||
@@ -92,8 +92,8 @@ public final class EmailCampaignData {
|
||||
public static EmailCampaignData instance(final Long id, final String campaignName, final Integer campaignType, final Long runReportId,
|
||||
final String paramValue, final EnumOptionData campaignStatus, final String emailSubject, final String message,
|
||||
final String emailAttachmentFileFormat, final Long stretchyReportId, final String stretchyReportParamMap,
|
||||
final DateTime nextTriggerDate, final LocalDate lastTriggerDate, final EmailCampaignTimeLine emailCampaignTimeLine,
|
||||
final DateTime recurrenceStartDate, final String recurrence) {
|
||||
final ZonedDateTime nextTriggerDate, final LocalDate lastTriggerDate, final EmailCampaignTimeLine emailCampaignTimeLine,
|
||||
final ZonedDateTime recurrenceStartDate, final String recurrence) {
|
||||
return new EmailCampaignData(id, campaignName, campaignType, runReportId, paramValue, campaignStatus, emailSubject, message,
|
||||
emailAttachmentFileFormat, stretchyReportId, stretchyReportParamMap, nextTriggerDate, lastTriggerDate,
|
||||
emailCampaignTimeLine, recurrenceStartDate, recurrence);
|
||||
@@ -131,7 +131,7 @@ public final class EmailCampaignData {
|
||||
return this.emailMessage;
|
||||
}
|
||||
|
||||
public DateTime getNextTriggerDate() {
|
||||
public ZonedDateTime getNextTriggerDate() {
|
||||
return this.nextTriggerDate;
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ public final class EmailCampaignData {
|
||||
return this.recurrence;
|
||||
}
|
||||
|
||||
public DateTime getRecurrenceStartDate() {
|
||||
public ZonedDateTime getRecurrenceStartDate() {
|
||||
return this.recurrenceStartDate;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.campaigns.email.data;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class EmailCampaignTimeLine {
|
||||
|
||||
|
||||
+1
-1
@@ -21,6 +21,7 @@ package org.apache.fineract.infrastructure.campaigns.email.data;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import java.lang.reflect.Type;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
@@ -34,7 +35,6 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
+1
-1
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.campaigns.email.data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.dataqueries.data.ReportData;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
/**
|
||||
* Immutable data object representing a SMS message.
|
||||
|
||||
+4
-5
@@ -22,6 +22,8 @@ import com.google.common.base.Splitter;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import java.lang.reflect.Type;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -41,9 +43,6 @@ import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidati
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.type.TypeReference;
|
||||
import org.joda.time.LocalDateTime;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -127,7 +126,7 @@ public final class EmailDataValidator {
|
||||
if (StringUtils.isNotEmpty(dateFormat)) {
|
||||
|
||||
try {
|
||||
final DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(dateFormat).withLocale(jsonCommand.extractLocale());
|
||||
final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(dateFormat).withLocale(jsonCommand.extractLocale());
|
||||
|
||||
// try to parse the date time string
|
||||
LocalDateTime.parse(startDateTime, dateTimeFormatter);
|
||||
@@ -224,7 +223,7 @@ public final class EmailDataValidator {
|
||||
if (StringUtils.isNotEmpty(dateFormat)) {
|
||||
|
||||
try {
|
||||
final DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(dateFormat)
|
||||
final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(dateFormat)
|
||||
.withLocale(jsonCommand.extractLocale());
|
||||
|
||||
// try to parse the date time string
|
||||
|
||||
+27
-24
@@ -18,6 +18,11 @@
|
||||
*/
|
||||
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;
|
||||
@@ -43,10 +48,6 @@ import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.infrastructure.dataqueries.domain.Report;
|
||||
import org.apache.fineract.portfolio.client.api.ClientApiConstants;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.LocalDateTime;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
|
||||
@Entity
|
||||
@Table(name = "scheduled_email_campaign")
|
||||
@@ -152,15 +153,15 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
this.emailAttachmentFileFormat = emailAttachmentFileFormat.getValue();
|
||||
this.stretchyReport = stretchyReport;
|
||||
this.stretchyReportParamMap = stretchyReportParamMap;
|
||||
this.submittedOnDate = submittedOnDate.toDate();
|
||||
this.submittedOnDate = Date.from(submittedOnDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.submittedBy = submittedBy;
|
||||
this.recurrence = recurrence;
|
||||
LocalDateTime recurrenceStartDate = new LocalDateTime();
|
||||
LocalDateTime recurrenceStartDate = LocalDateTime.now(ZoneId.systemDefault());
|
||||
this.isVisible = true;
|
||||
if (localDateTime != null) {
|
||||
this.recurrenceStartDate = localDateTime.toDate();
|
||||
this.recurrenceStartDate = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||
} else {
|
||||
this.recurrenceStartDate = recurrenceStartDate.toDate();
|
||||
this.recurrenceStartDate = Date.from(recurrenceStartDate.atZone(ZoneId.systemDefault()).toInstant());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -184,16 +185,16 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
} else {
|
||||
emailAttachmentFileFormat = ScheduledEmailAttachmentFileFormat.instance(2);
|
||||
}
|
||||
LocalDate submittedOnDate = new LocalDate();
|
||||
LocalDate submittedOnDate = LocalDate.now(ZoneId.systemDefault());
|
||||
if (command.hasParameter(EmailCampaignValidator.submittedOnDateParamName)) {
|
||||
submittedOnDate = command.localDateValueOfParameterNamed(EmailCampaignValidator.submittedOnDateParamName);
|
||||
}
|
||||
|
||||
final String recurrence = command.stringValueOfParameterNamed(EmailCampaignValidator.recurrenceParamName);
|
||||
final Locale locale = command.extractLocale();
|
||||
final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale);
|
||||
final DateTimeFormatter fmt = DateTimeFormatter.ofPattern(command.dateFormat()).withLocale(locale);
|
||||
|
||||
LocalDateTime recurrenceStartDate = new LocalDateTime();
|
||||
LocalDateTime recurrenceStartDate = LocalDateTime.now(ZoneId.systemDefault());
|
||||
if (EmailCampaignType.fromInt(campaignType.intValue()).isSchedule()) {
|
||||
if (command.hasParameter(EmailCampaignValidator.recurrenceStartDate)) {
|
||||
recurrenceStartDate = LocalDateTime.parse(command.stringValueOfParameterNamed(EmailCampaignValidator.recurrenceStartDate),
|
||||
@@ -245,7 +246,7 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
final String dateFormatAsInput = command.dateFormat();
|
||||
final String localeAsInput = command.locale();
|
||||
final Locale locale = command.extractLocale();
|
||||
final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale);
|
||||
final DateTimeFormatter fmt = DateTimeFormatter.ofPattern(command.dateFormat()).withLocale(locale);
|
||||
|
||||
if (command.isChangeInLocalDateParameterNamed(EmailCampaignValidator.recurrenceStartDate, getRecurrenceStartDate())) {
|
||||
final String valueAsInput = command.stringValueOfParameterNamed(EmailCampaignValidator.recurrenceStartDate);
|
||||
@@ -255,7 +256,7 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
|
||||
final LocalDateTime newValue = LocalDateTime.parse(valueAsInput, fmt);
|
||||
|
||||
this.recurrenceStartDate = newValue.toDate();
|
||||
this.recurrenceStartDate = Date.from(newValue.atZone(ZoneId.systemDefault()).toInstant());
|
||||
}
|
||||
|
||||
return actualChanges;
|
||||
@@ -267,14 +268,14 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
// handle errors if already activated
|
||||
final String defaultUserMessage = "Cannot activate campaign. Campaign is already active.";
|
||||
final ApiParameterError error = ApiParameterError.parameterError("error.msg.campaign.already.active", defaultUserMessage,
|
||||
EmailCampaignValidator.activationDateParamName, activationLocalDate.toString(formatter));
|
||||
EmailCampaignValidator.activationDateParamName, activationLocalDate.format(formatter));
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||
dataValidationErrors.add(error);
|
||||
|
||||
throw new PlatformApiDataValidationException(dataValidationErrors);
|
||||
}
|
||||
this.approvedOnDate = activationLocalDate.toDate();
|
||||
this.approvedOnDate = Date.from(activationLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.approvedBy = currentUser;
|
||||
this.status = EmailCampaignStatus.ACTIVE.getValue();
|
||||
|
||||
@@ -298,7 +299,7 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
this.lastTriggerDate = null;
|
||||
}
|
||||
this.closedBy = currentUser;
|
||||
this.closureDate = closureLocalDate.toDate();
|
||||
this.closureDate = Date.from(closureLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.status = EmailCampaignStatus.CLOSED.getValue();
|
||||
validateClosureDate();
|
||||
}
|
||||
@@ -317,7 +318,7 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
throw new PlatformApiDataValidationException(dataValidationErrors);
|
||||
}
|
||||
|
||||
this.approvedOnDate = reactivateLocalDate.toDate();
|
||||
this.approvedOnDate = Date.from(reactivateLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.status = EmailCampaignStatus.ACTIVE.getValue();
|
||||
this.approvedBy = currentUser;
|
||||
this.closureDate = null;
|
||||
@@ -456,18 +457,18 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getSubmittedOnDate() {
|
||||
return ObjectUtils.defaultIfNull(new LocalDate(this.submittedOnDate), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.submittedOnDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
|
||||
}
|
||||
|
||||
public LocalDate getClosureDate() {
|
||||
return ObjectUtils.defaultIfNull(new LocalDate(this.closureDate), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.closureDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
}
|
||||
|
||||
public LocalDate getActivationLocalDate() {
|
||||
LocalDate activationLocalDate = null;
|
||||
if (this.approvedOnDate != null) {
|
||||
activationLocalDate = LocalDate.fromDateFields(this.approvedOnDate);
|
||||
activationLocalDate = LocalDate.ofInstant(this.approvedOnDate.toInstant(), ZoneId.systemDefault());
|
||||
}
|
||||
return activationLocalDate;
|
||||
}
|
||||
@@ -501,11 +502,12 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getRecurrenceStartDate() {
|
||||
return ObjectUtils.defaultIfNull(new LocalDate(this.recurrenceStartDate), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.recurrenceStartDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
}
|
||||
|
||||
public LocalDateTime getRecurrenceStartDateTime() {
|
||||
return ObjectUtils.defaultIfNull(new LocalDateTime(this.recurrenceStartDate), null);
|
||||
return ObjectUtils.defaultIfNull(
|
||||
ZonedDateTime.ofInstant(this.recurrenceStartDate.toInstant(), ZoneId.systemDefault()).toLocalDateTime(), null);
|
||||
}
|
||||
|
||||
public void setLastTriggerDate(Date lastTriggerDate) {
|
||||
@@ -517,7 +519,8 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDateTime getNextTriggerDate() {
|
||||
return ObjectUtils.defaultIfNull(new LocalDateTime(this.nextTriggerDate), null);
|
||||
return ObjectUtils
|
||||
.defaultIfNull(ZonedDateTime.ofInstant(this.nextTriggerDate.toInstant(), ZoneId.systemDefault()).toLocalDateTime(), null);
|
||||
|
||||
}
|
||||
|
||||
@@ -526,7 +529,7 @@ public class EmailCampaign extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getLastTriggerDate() {
|
||||
return ObjectUtils.defaultIfNull(new LocalDate(this.lastTriggerDate), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.lastTriggerDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
}
|
||||
|
||||
public void updateIsVisible(boolean isVisible) {
|
||||
|
||||
+3
-2
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.campaigns.email.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@@ -35,7 +37,6 @@ import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.organisation.staff.domain.Staff;
|
||||
import org.apache.fineract.portfolio.client.domain.Client;
|
||||
import org.apache.fineract.portfolio.group.domain.Group;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
@Entity
|
||||
@Table(name = "scheduled_email_messages_outbound")
|
||||
@@ -107,7 +108,7 @@ public class EmailMessage extends AbstractPersistableCustom {
|
||||
this.emailSubject = emailSubject;
|
||||
this.message = message;
|
||||
this.campaignName = campaignName;
|
||||
this.submittedOnDate = LocalDate.now().toDate();
|
||||
this.submittedOnDate = Date.from(LocalDate.now(ZoneId.systemDefault()).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
}
|
||||
|
||||
public Map<String, Object> update(final JsonCommand command) {
|
||||
|
||||
+4
-4
@@ -20,6 +20,8 @@ package org.apache.fineract.infrastructure.campaigns.email.service;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@@ -37,8 +39,6 @@ import org.apache.fineract.infrastructure.campaigns.email.exception.EmailCampaig
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
@@ -138,7 +138,7 @@ public class EmailCampaignReadPlatformServiceImpl implements EmailCampaignReadPl
|
||||
|
||||
final Integer statusId = JdbcSupport.getInteger(rs, "statusEnum");
|
||||
final EnumOptionData status = EmailCampaignStatusEnumerations.status(statusId);
|
||||
final DateTime nextTriggerDate = JdbcSupport.getDateTime(rs, "nextTriggerDate");
|
||||
final ZonedDateTime nextTriggerDate = JdbcSupport.getDateTime(rs, "nextTriggerDate");
|
||||
final LocalDate lastTriggerDate = JdbcSupport.getLocalDate(rs, "lastTriggerDate");
|
||||
|
||||
final LocalDate closedOnDate = JdbcSupport.getLocalDate(rs, "closedOnDate");
|
||||
@@ -150,7 +150,7 @@ public class EmailCampaignReadPlatformServiceImpl implements EmailCampaignReadPl
|
||||
final LocalDate activatedOnDate = JdbcSupport.getLocalDate(rs, "activatedOnDate");
|
||||
final String activatedByUsername = rs.getString("activatedByUsername");
|
||||
final String recurrence = rs.getString("recurrence");
|
||||
final DateTime recurrenceStartDate = JdbcSupport.getDateTime(rs, "recurrenceStartDate");
|
||||
final ZonedDateTime recurrenceStartDate = JdbcSupport.getDateTime(rs, "recurrenceStartDate");
|
||||
final EmailCampaignTimeLine emailCampaignTimeLine = new EmailCampaignTimeLine(submittedOnDate, submittedByUsername,
|
||||
activatedOnDate, activatedByUsername, closedOnDate, closedByUsername);
|
||||
|
||||
|
||||
+26
-24
@@ -28,9 +28,15 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
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.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -85,11 +91,6 @@ import org.apache.fineract.portfolio.savings.domain.SavingsAccountRepository;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.type.TypeReference;
|
||||
import org.joda.time.DateTimeZone;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.LocalDateTime;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -313,7 +314,7 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
|
||||
final EmailCampaign emailCampaign = this.emailCampaignRepository.findById(campaignId)
|
||||
.orElseThrow(() -> new EmailCampaignNotFound(campaignId));
|
||||
LocalDateTime nextTriggerDate = emailCampaign.getNextTriggerDate();
|
||||
emailCampaign.setLastTriggerDate(nextTriggerDate.toDate());
|
||||
emailCampaign.setLastTriggerDate(Date.from(nextTriggerDate.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
// calculate new trigger date and insert into next trigger date
|
||||
|
||||
/**
|
||||
@@ -335,12 +336,11 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
|
||||
emailCampaign.getNextTriggerDate().toLocalDate(), DateUtils.getLocalDateOfTenant());
|
||||
}
|
||||
final LocalDateTime getTime = emailCampaign.getRecurrenceStartDateTime();
|
||||
final String dateString = nextRuntime.toString() + " " + getTime.getHourOfDay() + ":" + getTime.getMinuteOfHour() + ":"
|
||||
+ getTime.getSecondOfMinute();
|
||||
final DateTimeFormatter simpleDateFormat = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
|
||||
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(newTriggerDateWithTime.toDate());
|
||||
emailCampaign.setNextTriggerDate(Date.from(newTriggerDateWithTime.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
this.emailCampaignRepository.saveAndFlush(emailCampaign);
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
|
||||
.orElseThrow(() -> new EmailCampaignNotFound(campaignId));
|
||||
|
||||
final Locale locale = command.extractLocale();
|
||||
final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale);
|
||||
final DateTimeFormatter fmt = DateTimeFormatter.ofPattern(command.dateFormat()).withLocale(locale);
|
||||
final LocalDate activationDate = command.localDateValueOfParameterNamed("activationDate");
|
||||
|
||||
emailCampaign.activate(currentUser, fmt, activationDate);
|
||||
@@ -382,12 +382,13 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
|
||||
// to get time of tenant
|
||||
final LocalDateTime getTime = emailCampaign.getRecurrenceStartDateTime();
|
||||
|
||||
final String dateString = nextTriggerDate.toString() + " " + getTime.getHourOfDay() + ":" + getTime.getMinuteOfHour() + ":"
|
||||
+ getTime.getSecondOfMinute();
|
||||
final DateTimeFormatter simpleDateFormat = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
|
||||
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(nextTriggerDateWithTime.toDate());
|
||||
emailCampaign.setNextTriggerDate(Date.from(nextTriggerDateWithTime.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
this.emailCampaignRepository.saveAndFlush(emailCampaign);
|
||||
}
|
||||
}
|
||||
@@ -413,7 +414,7 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
|
||||
.orElseThrow(() -> new EmailCampaignNotFound(campaignId));
|
||||
|
||||
final Locale locale = command.extractLocale();
|
||||
final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale);
|
||||
final DateTimeFormatter fmt = DateTimeFormatter.ofPattern(command.dateFormat()).withLocale(locale);
|
||||
final LocalDate closureDate = command.localDateValueOfParameterNamed("closureDate");
|
||||
|
||||
emailCampaign.close(currentUser, fmt, closureDate);
|
||||
@@ -513,7 +514,7 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
|
||||
.orElseThrow(() -> new EmailCampaignNotFound(campaignId));
|
||||
|
||||
final Locale locale = command.extractLocale();
|
||||
final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale);
|
||||
final DateTimeFormatter fmt = DateTimeFormatter.ofPattern(command.dateFormat()).withLocale(locale);
|
||||
final LocalDate reactivationDate = command.localDateValueOfParameterNamed("activationDate");
|
||||
emailCampaign.reactivate(currentUser, fmt, reactivationDate);
|
||||
if (emailCampaign.isSchedule()) {
|
||||
@@ -532,12 +533,13 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
|
||||
// to get time of tenant
|
||||
final LocalDateTime getTime = emailCampaign.getRecurrenceStartDateTime();
|
||||
|
||||
final String dateString = nextTriggerDate.toString() + " " + getTime.getHourOfDay() + ":" + getTime.getMinuteOfHour() + ":"
|
||||
+ getTime.getSecondOfMinute();
|
||||
final DateTimeFormatter simpleDateFormat = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
|
||||
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(nextTriggerDateWithTime.toDate());
|
||||
emailCampaign.setNextTriggerDate(Date.from(nextTriggerDateWithTime.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
this.emailCampaignRepository.saveAndFlush(emailCampaign);
|
||||
}
|
||||
|
||||
@@ -555,13 +557,13 @@ public class EmailCampaignWritePlatformCommandHandlerImpl implements EmailCampai
|
||||
}
|
||||
|
||||
private LocalDateTime tenantDateTime() {
|
||||
LocalDateTime today = new LocalDateTime();
|
||||
LocalDateTime today = LocalDateTime.now(ZoneId.systemDefault());
|
||||
final FineractPlatformTenant tenant = ThreadLocalContextUtil.getTenant();
|
||||
|
||||
if (tenant != null) {
|
||||
final DateTimeZone zone = DateTimeZone.forID(tenant.getTimezoneId());
|
||||
final ZoneId zone = ZoneId.of(tenant.getTimezoneId());
|
||||
if (zone != null) {
|
||||
today = new LocalDateTime(zone);
|
||||
today = LocalDateTime.now(zone);
|
||||
}
|
||||
}
|
||||
return today;
|
||||
|
||||
+1
-1
@@ -22,6 +22,7 @@ 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;
|
||||
@@ -35,7 +36,6 @@ import org.apache.fineract.infrastructure.core.service.Page;
|
||||
import org.apache.fineract.infrastructure.core.service.PaginationHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
import org.apache.fineract.infrastructure.core.service.SearchParameters;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
+12
-12
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.campaigns.sms.data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Collection;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public final class SmsCampaignData {
|
||||
@@ -35,10 +35,10 @@ public final class SmsCampaignData {
|
||||
private final EnumOptionData campaignStatus;
|
||||
private final EnumOptionData triggerType;
|
||||
private final String campaignMessage;
|
||||
private final DateTime nextTriggerDate;
|
||||
private final ZonedDateTime nextTriggerDate;
|
||||
private final LocalDate lastTriggerDate;
|
||||
private final SmsCampaignTimeLine smsCampaignTimeLine;
|
||||
private final DateTime recurrenceStartDate;
|
||||
private final ZonedDateTime recurrenceStartDate;
|
||||
private final String recurrence;
|
||||
private final Long providerId;
|
||||
private final boolean isNotification;
|
||||
@@ -61,8 +61,8 @@ public final class SmsCampaignData {
|
||||
|
||||
private SmsCampaignData(final Long id, final String campaignName, final EnumOptionData campaignType, final EnumOptionData triggerType,
|
||||
final Long runReportId, final String reportName, final String paramValue, final EnumOptionData campaignStatus,
|
||||
final String message, final DateTime nextTriggerDate, final LocalDate lastTriggerDate,
|
||||
final SmsCampaignTimeLine smsCampaignTimeLine, final DateTime recurrenceStartDate, final String recurrence,
|
||||
final String message, final ZonedDateTime nextTriggerDate, final LocalDate lastTriggerDate,
|
||||
final SmsCampaignTimeLine smsCampaignTimeLine, final ZonedDateTime recurrenceStartDate, final String recurrence,
|
||||
final Long providerId, final Collection<SmsBusinessRulesData> businessRulesOptions,
|
||||
final Collection<SmsProviderData> smsProviderOptions, final Collection<EnumOptionData> campaignTypeOptions,
|
||||
final Collection<EnumOptionData> triggerTypeOptions, final Collection<EnumOptionData> months,
|
||||
@@ -104,8 +104,8 @@ public final class SmsCampaignData {
|
||||
|
||||
public static SmsCampaignData instance(final Long id, final String campaignName, final EnumOptionData campaignType,
|
||||
final EnumOptionData triggerType, final Long runReportId, final String reportName, final String paramValue,
|
||||
final EnumOptionData campaignStatus, final String message, final DateTime nextTriggerDate, final LocalDate lastTriggerDate,
|
||||
final SmsCampaignTimeLine smsCampaignTimeLine, final DateTime recurrenceStartDate, final String recurrence,
|
||||
final EnumOptionData campaignStatus, final String message, final ZonedDateTime nextTriggerDate, final LocalDate lastTriggerDate,
|
||||
final SmsCampaignTimeLine smsCampaignTimeLine, final ZonedDateTime recurrenceStartDate, final String recurrence,
|
||||
final Long providerId, final boolean isNotification) {
|
||||
final Collection<SmsBusinessRulesData> businessRulesOptions = null;
|
||||
final Collection<SmsProviderData> smsProviderOptions = null;
|
||||
@@ -134,10 +134,10 @@ public final class SmsCampaignData {
|
||||
final String paramValue = null;
|
||||
final EnumOptionData campaignStatus = null;
|
||||
final String message = null;
|
||||
final DateTime nextTriggerDate = null;
|
||||
final ZonedDateTime nextTriggerDate = null;
|
||||
final LocalDate lastTriggerDate = null;
|
||||
final SmsCampaignTimeLine smsCampaignTimeLine = null;
|
||||
final DateTime recurrenceStartDate = null;
|
||||
final ZonedDateTime recurrenceStartDate = null;
|
||||
final String recurrence = null;
|
||||
final EnumOptionData triggerType = null;
|
||||
final String reportName = null;
|
||||
@@ -177,7 +177,7 @@ public final class SmsCampaignData {
|
||||
return this.campaignMessage;
|
||||
}
|
||||
|
||||
public DateTime getNextTriggerDate() {
|
||||
public ZonedDateTime getNextTriggerDate() {
|
||||
return this.nextTriggerDate;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ public final class SmsCampaignData {
|
||||
return this.recurrence;
|
||||
}
|
||||
|
||||
public DateTime getRecurrenceStartDate() {
|
||||
public ZonedDateTime getRecurrenceStartDate() {
|
||||
return this.recurrenceStartDate;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.infrastructure.campaigns.sms.data;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class SmsCampaignTimeLine {
|
||||
|
||||
+27
-24
@@ -18,6 +18,11 @@
|
||||
*/
|
||||
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;
|
||||
@@ -47,10 +52,6 @@ import org.apache.fineract.infrastructure.dataqueries.domain.Report;
|
||||
import org.apache.fineract.portfolio.calendar.domain.CalendarFrequencyType;
|
||||
import org.apache.fineract.portfolio.calendar.domain.CalendarWeekDaysType;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.LocalDateTime;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
|
||||
@Entity
|
||||
@Table(name = "sms_campaign", uniqueConstraints = { @UniqueConstraint(columnNames = { "campaign_name" }, name = "campaign_name_UNIQUE") })
|
||||
@@ -139,15 +140,15 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
this.paramValue = paramValue;
|
||||
this.status = SmsCampaignStatus.PENDING.getValue();
|
||||
this.message = message;
|
||||
this.submittedOnDate = submittedOnDate.toDate();
|
||||
this.submittedOnDate = Date.from(submittedOnDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.submittedBy = submittedBy;
|
||||
this.recurrence = recurrence;
|
||||
LocalDateTime recurrenceStartDate = new LocalDateTime();
|
||||
LocalDateTime recurrenceStartDate = LocalDateTime.now(ZoneId.systemDefault());
|
||||
this.isVisible = true;
|
||||
if (localDateTime != null) {
|
||||
this.recurrenceStartDate = localDateTime.toDate();
|
||||
this.recurrenceStartDate = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||
} else {
|
||||
this.recurrenceStartDate = recurrenceStartDate.toDate();
|
||||
this.recurrenceStartDate = Date.from(recurrenceStartDate.atZone(ZoneId.systemDefault()).toInstant());
|
||||
}
|
||||
this.isNotification = isNotification;
|
||||
}
|
||||
@@ -169,19 +170,19 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
final String paramValue = command.jsonFragment(SmsCampaignValidator.paramValue);
|
||||
|
||||
final String message = command.stringValueOfParameterNamed(SmsCampaignValidator.message);
|
||||
LocalDate submittedOnDate = new LocalDate();
|
||||
LocalDate submittedOnDate = LocalDate.now(ZoneId.systemDefault());
|
||||
if (command.hasParameter(SmsCampaignValidator.submittedOnDateParamName)) {
|
||||
submittedOnDate = command.localDateValueOfParameterNamed(SmsCampaignValidator.submittedOnDateParamName);
|
||||
}
|
||||
String recurrence = null;
|
||||
|
||||
LocalDateTime recurrenceStartDate = new LocalDateTime();
|
||||
LocalDateTime recurrenceStartDate = LocalDateTime.now(ZoneId.systemDefault());
|
||||
if (SmsCampaignTriggerType.fromInt(triggerType.intValue()).isSchedule()) {
|
||||
final Locale locale = command.extractLocale();
|
||||
String dateTimeFormat = null;
|
||||
if (command.hasParameter(SmsCampaignValidator.dateTimeFormat)) {
|
||||
dateTimeFormat = command.stringValueOfParameterNamed(SmsCampaignValidator.dateTimeFormat);
|
||||
final DateTimeFormatter fmt = DateTimeFormat.forPattern(dateTimeFormat).withLocale(locale);
|
||||
final DateTimeFormatter fmt = DateTimeFormatter.ofPattern(dateTimeFormat).withLocale(locale);
|
||||
if (command.hasParameter(SmsCampaignValidator.recurrenceStartDate)) {
|
||||
recurrenceStartDate = LocalDateTime.parse(command.stringValueOfParameterNamed(SmsCampaignValidator.recurrenceStartDate),
|
||||
fmt);
|
||||
@@ -252,7 +253,7 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
final String dateTimeFormatAsInput = command.stringValueOfParameterNamed(SmsCampaignValidator.dateTimeFormat);
|
||||
final String localeAsInput = command.locale();
|
||||
final Locale locale = command.extractLocale();
|
||||
final DateTimeFormatter fmt = DateTimeFormat.forPattern(dateTimeFormatAsInput).withLocale(locale);
|
||||
final DateTimeFormatter fmt = DateTimeFormatter.ofPattern(dateTimeFormatAsInput).withLocale(locale);
|
||||
final String valueAsInput = command.stringValueOfParameterNamed(SmsCampaignValidator.recurrenceStartDate);
|
||||
actualChanges.put(SmsCampaignValidator.recurrenceStartDate, valueAsInput);
|
||||
actualChanges.put(SmsCampaignValidator.dateFormatParamName, dateFormatAsInput);
|
||||
@@ -261,7 +262,7 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
|
||||
final LocalDateTime newValue = LocalDateTime.parse(valueAsInput, fmt);
|
||||
|
||||
this.recurrenceStartDate = newValue.toDate();
|
||||
this.recurrenceStartDate = Date.from(newValue.atZone(ZoneId.systemDefault()).toInstant());
|
||||
}
|
||||
|
||||
return actualChanges;
|
||||
@@ -273,14 +274,14 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
// handle errors if already activated
|
||||
final String defaultUserMessage = "Cannot activate campaign. Campaign is already active.";
|
||||
final ApiParameterError error = ApiParameterError.parameterError("error.msg.campaign.already.active", defaultUserMessage,
|
||||
SmsCampaignValidator.activationDateParamName, activationLocalDate.toString(formatter));
|
||||
SmsCampaignValidator.activationDateParamName, activationLocalDate.format(formatter));
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
dataValidationErrors.add(error);
|
||||
|
||||
throw new PlatformApiDataValidationException(dataValidationErrors);
|
||||
}
|
||||
this.approvedOnDate = activationLocalDate.toDate();
|
||||
this.approvedOnDate = Date.from(activationLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.approvedBy = currentUser;
|
||||
this.status = SmsCampaignStatus.ACTIVE.getValue();
|
||||
|
||||
@@ -304,7 +305,7 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
this.lastTriggerDate = null;
|
||||
}
|
||||
this.closedBy = currentUser;
|
||||
this.closureDate = closureLocalDate.toDate();
|
||||
this.closureDate = Date.from(closureLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.status = SmsCampaignStatus.CLOSED.getValue();
|
||||
validateClosureDate();
|
||||
}
|
||||
@@ -323,7 +324,7 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
throw new PlatformApiDataValidationException(dataValidationErrors);
|
||||
}
|
||||
|
||||
this.approvedOnDate = reactivateLocalDate.toDate();
|
||||
this.approvedOnDate = Date.from(reactivateLocalDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
this.status = SmsCampaignStatus.ACTIVE.getValue();
|
||||
this.approvedBy = currentUser;
|
||||
this.closureDate = null;
|
||||
@@ -466,18 +467,18 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getSubmittedOnDate() {
|
||||
return ObjectUtils.defaultIfNull(new LocalDate(this.submittedOnDate), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.submittedOnDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
|
||||
}
|
||||
|
||||
public LocalDate getClosureDate() {
|
||||
return ObjectUtils.defaultIfNull(new LocalDate(this.closureDate), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.closureDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
}
|
||||
|
||||
public LocalDate getActivationLocalDate() {
|
||||
LocalDate activationLocalDate = null;
|
||||
if (this.approvedOnDate != null) {
|
||||
activationLocalDate = LocalDate.fromDateFields(this.approvedOnDate);
|
||||
activationLocalDate = LocalDate.ofInstant(this.approvedOnDate.toInstant(), ZoneId.systemDefault());
|
||||
}
|
||||
return activationLocalDate;
|
||||
}
|
||||
@@ -507,11 +508,12 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getRecurrenceStartDate() {
|
||||
return ObjectUtils.defaultIfNull(new LocalDate(this.recurrenceStartDate), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.recurrenceStartDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
}
|
||||
|
||||
public LocalDateTime getRecurrenceStartDateTime() {
|
||||
return ObjectUtils.defaultIfNull(new LocalDateTime(this.recurrenceStartDate), null);
|
||||
return ObjectUtils.defaultIfNull(
|
||||
ZonedDateTime.ofInstant(this.recurrenceStartDate.toInstant(), ZoneId.systemDefault()).toLocalDateTime(), null);
|
||||
}
|
||||
|
||||
public void setLastTriggerDate(Date lastTriggerDate) {
|
||||
@@ -523,7 +525,8 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDateTime getNextTriggerDate() {
|
||||
return ObjectUtils.defaultIfNull(new LocalDateTime(this.nextTriggerDate), null);
|
||||
return ObjectUtils
|
||||
.defaultIfNull(ZonedDateTime.ofInstant(this.nextTriggerDate.toInstant(), ZoneId.systemDefault()).toLocalDateTime(), null);
|
||||
|
||||
}
|
||||
|
||||
@@ -532,7 +535,7 @@ public class SmsCampaign extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public LocalDate getLastTriggerDate() {
|
||||
return ObjectUtils.defaultIfNull(new LocalDate(this.lastTriggerDate), null);
|
||||
return ObjectUtils.defaultIfNull(LocalDate.ofInstant(this.lastTriggerDate.toInstant(), ZoneId.systemDefault()), null);
|
||||
}
|
||||
|
||||
public void updateIsVisible(boolean isVisible) {
|
||||
|
||||
+1
-1
@@ -21,6 +21,7 @@ package org.apache.fineract.infrastructure.campaigns.sms.serialization;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import java.lang.reflect.Type;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
@@ -39,7 +40,6 @@ import org.apache.fineract.infrastructure.gcm.domain.DeviceRegistration;
|
||||
import org.apache.fineract.infrastructure.gcm.domain.DeviceRegistrationRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.calendar.domain.CalendarFrequencyType;
|
||||
import org.apache.fineract.portfolio.client.domain.Client;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
+7
-8
@@ -21,6 +21,7 @@ package org.apache.fineract.infrastructure.campaigns.sms.service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.InvalidParameterException;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@@ -54,8 +55,6 @@ import org.apache.fineract.portfolio.savings.domain.SavingsAccount;
|
||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccountTransaction;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.type.TypeReference;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -312,8 +311,8 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
|
||||
throw new InvalidParameterException("");
|
||||
}
|
||||
|
||||
DateTimeFormatter timeFormatter = DateTimeFormat.forPattern("HH:mm");
|
||||
DateTimeFormatter dateFormatter = DateTimeFormat.forPattern("MMM:d:yyyy");
|
||||
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm");
|
||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("MMM:d:yyyy");
|
||||
|
||||
smsParams.put("id", loanTransaction.getLoan().getClientId());
|
||||
smsParams.put("firstname", client.getFirstname());
|
||||
@@ -334,8 +333,8 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
|
||||
}
|
||||
|
||||
smsParams.put("repaymentAmount", loanTransaction.getAmount(loan.getCurrency()));
|
||||
smsParams.put("RepaymentDate", loanTransaction.getCreatedDateTime().toLocalDate().toString(dateFormatter));
|
||||
smsParams.put("RepaymentTime", loanTransaction.getCreatedDateTime().toLocalTime().toString(timeFormatter));
|
||||
smsParams.put("RepaymentDate", loanTransaction.getCreatedDateTime().toLocalDate().format(dateFormatter));
|
||||
smsParams.put("RepaymentTime", loanTransaction.getCreatedDateTime().toLocalTime().format(timeFormatter));
|
||||
|
||||
if (loanTransaction.getPaymentDetail() != null) {
|
||||
smsParams.put("receiptNumber", loanTransaction.getPaymentDetail().getReceiptNumber());
|
||||
@@ -355,7 +354,7 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
|
||||
// transactionDate
|
||||
HashMap<String, Object> smsParams = new HashMap<String, Object>();
|
||||
SavingsAccount savingsAccount = savingsAccountTransaction.getSavingsAccount();
|
||||
DateTimeFormatter dateFormatter = DateTimeFormat.forPattern("MMM:d:yyyy");
|
||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("MMM:d:yyyy");
|
||||
smsParams.put("clientId", client.getId());
|
||||
smsParams.put("firstname", client.getFirstname());
|
||||
smsParams.put("middlename", client.getMiddlename());
|
||||
@@ -368,7 +367,7 @@ public class SmsCampaignDomainServiceImpl implements SmsCampaignDomainService {
|
||||
smsParams.put("depositAmount", savingsAccountTransaction.getAmount(savingsAccount.getCurrency()));
|
||||
smsParams.put("balance", savingsAccount.getWithdrawableBalance());
|
||||
smsParams.put("officeId", client.getOffice().getId());
|
||||
smsParams.put("transactionDate", savingsAccountTransaction.getTransactionLocalDate().toString(dateFormatter));
|
||||
smsParams.put("transactionDate", savingsAccountTransaction.getTransactionLocalDate().format(dateFormatter));
|
||||
smsParams.put("savingsTransactionId", savingsAccountTransaction.getId());
|
||||
|
||||
if (client.getStaff() != null) {
|
||||
|
||||
+4
-4
@@ -20,6 +20,8 @@ package org.apache.fineract.infrastructure.campaigns.sms.service;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@@ -41,8 +43,6 @@ import org.apache.fineract.infrastructure.core.service.PaginationHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
|
||||
import org.apache.fineract.infrastructure.core.service.SearchParameters;
|
||||
import org.apache.fineract.portfolio.calendar.service.CalendarDropdownReadPlatformService;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
@@ -250,7 +250,7 @@ public class SmsCampaignReadPlatformServiceImpl implements SmsCampaignReadPlatfo
|
||||
final Integer triggerType = JdbcSupport.getInteger(rs, "triggerType");
|
||||
final EnumOptionData triggerTypeEnum = SmsCampaignTriggerType.triggerType(triggerType);
|
||||
|
||||
final DateTime nextTriggerDate = JdbcSupport.getDateTime(rs, "nextTriggerDate");
|
||||
final ZonedDateTime nextTriggerDate = JdbcSupport.getDateTime(rs, "nextTriggerDate");
|
||||
final LocalDate lastTriggerDate = JdbcSupport.getLocalDate(rs, "lastTriggerDate");
|
||||
|
||||
final LocalDate closedOnDate = JdbcSupport.getLocalDate(rs, "closedOnDate");
|
||||
@@ -262,7 +262,7 @@ public class SmsCampaignReadPlatformServiceImpl implements SmsCampaignReadPlatfo
|
||||
final LocalDate activatedOnDate = JdbcSupport.getLocalDate(rs, "activatedOnDate");
|
||||
final String activatedByUsername = rs.getString("activatedByUsername");
|
||||
final String recurrence = rs.getString("recurrence");
|
||||
final DateTime recurrenceStartDate = JdbcSupport.getDateTime(rs, "recurrenceStartDate");
|
||||
final ZonedDateTime recurrenceStartDate = JdbcSupport.getDateTime(rs, "recurrenceStartDate");
|
||||
final SmsCampaignTimeLine smsCampaignTimeLine = new SmsCampaignTimeLine(submittedOnDate, submittedByUsername, activatedOnDate,
|
||||
activatedByUsername, closedOnDate, closedByUsername);
|
||||
final String reportName = rs.getString("reportName");
|
||||
|
||||
+27
-24
@@ -25,8 +25,14 @@ import com.google.gson.JsonElement;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
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;
|
||||
@@ -80,11 +86,6 @@ import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.codehaus.jackson.JsonParseException;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.type.TypeReference;
|
||||
import org.joda.time.DateTimeZone;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.joda.time.LocalDateTime;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -408,7 +409,7 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
final SmsCampaign smsCampaign = this.smsCampaignRepository.findById(campaignId)
|
||||
.orElseThrow(() -> new SmsCampaignNotFound(campaignId));
|
||||
LocalDateTime nextTriggerDate = smsCampaign.getNextTriggerDate();
|
||||
smsCampaign.setLastTriggerDate(nextTriggerDate.toDate());
|
||||
smsCampaign.setLastTriggerDate(Date.from(nextTriggerDate.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
// calculate new trigger date and insert into next trigger date
|
||||
|
||||
/**
|
||||
@@ -430,12 +431,12 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
DateUtils.getLocalDateOfTenant());
|
||||
}
|
||||
final LocalDateTime getTime = smsCampaign.getRecurrenceStartDateTime();
|
||||
final String dateString = nextRuntime.toString() + " " + getTime.getHourOfDay() + ":" + getTime.getMinuteOfHour() + ":"
|
||||
+ getTime.getSecondOfMinute();
|
||||
final DateTimeFormatter simpleDateFormat = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
|
||||
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(newTriggerDateWithTime.toDate());
|
||||
smsCampaign.setNextTriggerDate(Date.from(newTriggerDateWithTime.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
this.smsCampaignRepository.saveAndFlush(smsCampaign);
|
||||
}
|
||||
|
||||
@@ -450,7 +451,7 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
.orElseThrow(() -> new SmsCampaignNotFound(campaignId));
|
||||
|
||||
final Locale locale = command.extractLocale();
|
||||
final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale);
|
||||
final DateTimeFormatter fmt = DateTimeFormatter.ofPattern(command.dateFormat()).withLocale(locale);
|
||||
final LocalDate activationDate = command.localDateValueOfParameterNamed("activationDate");
|
||||
|
||||
smsCampaign.activate(currentUser, fmt, activationDate);
|
||||
@@ -475,12 +476,13 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
// to get time of tenant
|
||||
final LocalDateTime getTime = smsCampaign.getRecurrenceStartDateTime();
|
||||
|
||||
final String dateString = nextTriggerDate.toString() + " " + getTime.getHourOfDay() + ":" + getTime.getMinuteOfHour() + ":"
|
||||
+ getTime.getSecondOfMinute();
|
||||
final DateTimeFormatter simpleDateFormat = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
|
||||
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(nextTriggerDateWithTime.toDate());
|
||||
smsCampaign.setNextTriggerDate(Date.from(nextTriggerDateWithTime.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
this.smsCampaignRepository.saveAndFlush(smsCampaign);
|
||||
}
|
||||
|
||||
@@ -505,7 +507,7 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
.orElseThrow(() -> new SmsCampaignNotFound(campaignId));
|
||||
|
||||
final Locale locale = command.extractLocale();
|
||||
final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale);
|
||||
final DateTimeFormatter fmt = DateTimeFormatter.ofPattern(command.dateFormat()).withLocale(locale);
|
||||
final LocalDate closureDate = command.localDateValueOfParameterNamed("closureDate");
|
||||
|
||||
smsCampaign.close(currentUser, fmt, closureDate);
|
||||
@@ -616,7 +618,7 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
.orElseThrow(() -> new SmsCampaignNotFound(campaignId));
|
||||
|
||||
final Locale locale = command.extractLocale();
|
||||
final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale);
|
||||
final DateTimeFormatter fmt = DateTimeFormatter.ofPattern(command.dateFormat()).withLocale(locale);
|
||||
final LocalDate reactivationDate = command.localDateValueOfParameterNamed("activationDate");
|
||||
smsCampaign.reactivate(currentUser, fmt, reactivationDate);
|
||||
if (smsCampaign.isDirect()) {
|
||||
@@ -637,12 +639,13 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
// to get time of tenant
|
||||
final LocalDateTime getTime = smsCampaign.getRecurrenceStartDateTime();
|
||||
|
||||
final String dateString = nextTriggerDate.toString() + " " + getTime.getHourOfDay() + ":" + getTime.getMinuteOfHour() + ":"
|
||||
+ getTime.getSecondOfMinute();
|
||||
final DateTimeFormatter simpleDateFormat = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
|
||||
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(nextTriggerDateWithTime.toDate());
|
||||
smsCampaign.setNextTriggerDate(Date.from(nextTriggerDateWithTime.atZone(ZoneId.systemDefault()).toInstant()));
|
||||
}
|
||||
this.smsCampaignRepository.saveAndFlush(smsCampaign);
|
||||
|
||||
@@ -679,13 +682,13 @@ public class SmsCampaignWritePlatformServiceJpaImpl implements SmsCampaignWriteP
|
||||
}
|
||||
|
||||
private LocalDateTime tenantDateTime() {
|
||||
LocalDateTime today = new LocalDateTime();
|
||||
LocalDateTime today = LocalDateTime.now(ZoneId.systemDefault());
|
||||
final FineractPlatformTenant tenant = ThreadLocalContextUtil.getTenant();
|
||||
|
||||
if (tenant != null) {
|
||||
final DateTimeZone zone = DateTimeZone.forID(tenant.getTimezoneId());
|
||||
final ZoneId zone = ZoneId.of(tenant.getTimezoneId());
|
||||
if (zone != null) {
|
||||
today = new LocalDateTime(zone);
|
||||
today = LocalDateTime.now(zone);
|
||||
}
|
||||
}
|
||||
return today;
|
||||
|
||||
+1
-1
@@ -21,6 +21,7 @@ package org.apache.fineract.infrastructure.configuration.data;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import java.lang.reflect.Type;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
@@ -35,7 +36,6 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
+6
-5
@@ -23,19 +23,20 @@ import com.google.gson.JsonPrimitive;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import java.lang.reflect.Type;
|
||||
import org.joda.time.DateTime;
|
||||
import java.time.ZonedDateTime;
|
||||
|
||||
/**
|
||||
* Serializer for Joda Time {@link DateTime} that returns the date as long to match previous (Jackson) functionality.
|
||||
* Serializer for Joda Time {@link ZonedDateTime} that returns the date as long to match previous (Jackson)
|
||||
* functionality.
|
||||
*/
|
||||
public class JodaDateTimeAdapter implements JsonSerializer<DateTime> {
|
||||
public class JodaDateTimeAdapter implements JsonSerializer<ZonedDateTime> {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unused")
|
||||
public JsonElement serialize(final DateTime src, final Type typeOfSrc, final JsonSerializationContext context) {
|
||||
public JsonElement serialize(final ZonedDateTime src, final Type typeOfSrc, final JsonSerializationContext context) {
|
||||
JsonElement element = null;
|
||||
if (src != null) {
|
||||
element = new JsonPrimitive(src.getMillis());
|
||||
element = new JsonPrimitive(src.toInstant().toEpochMilli());
|
||||
}
|
||||
|
||||
return element;
|
||||
|
||||
+4
-3
@@ -24,7 +24,8 @@ import com.google.gson.JsonPrimitive;
|
||||
import com.google.gson.JsonSerializationContext;
|
||||
import com.google.gson.JsonSerializer;
|
||||
import java.lang.reflect.Type;
|
||||
import org.joda.time.LocalDate;
|
||||
import java.time.LocalDate;
|
||||
import java.time.temporal.ChronoField;
|
||||
|
||||
/**
|
||||
* Serializer for Joda Time {@link LocalDate} that returns the date in array format to match previous Jackson
|
||||
@@ -38,8 +39,8 @@ public class JodaLocalDateAdapter implements JsonSerializer<LocalDate> {
|
||||
JsonArray array = null;
|
||||
if (src != null) {
|
||||
array = new JsonArray();
|
||||
array.add(new JsonPrimitive(src.getYearOfEra()));
|
||||
array.add(new JsonPrimitive(src.getMonthOfYear()));
|
||||
array.add(new JsonPrimitive(src.get(ChronoField.YEAR_OF_ERA)));
|
||||
array.add(new JsonPrimitive(src.getMonthValue()));
|
||||
array.add(new JsonPrimitive(src.getDayOfMonth()));
|
||||
}
|
||||
return array;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user