fix: paymentDate class
This commit is contained in:
parent
4d47d9b3f2
commit
3c5cdf84cc
3 changed files with 4 additions and 3 deletions
|
@ -60,7 +60,7 @@ public class Expense {
|
||||||
private LocalDate date;
|
private LocalDate date;
|
||||||
|
|
||||||
@Column(name = "PaymentDate")
|
@Column(name = "PaymentDate")
|
||||||
private LocalDateTime paymentDate;
|
private LocalDate paymentDate;
|
||||||
|
|
||||||
@Column(name = "isPaid", nullable = false)
|
@Column(name = "isPaid", nullable = false)
|
||||||
private Boolean isPaid = false;
|
private Boolean isPaid = false;
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class CSVService {
|
||||||
expense.getCost(),
|
expense.getCost(),
|
||||||
expense.getCategory() != null ? expense.getCategory().getName() : "",
|
expense.getCategory() != null ? expense.getCategory().getName() : "",
|
||||||
expense.getDate(),
|
expense.getDate(),
|
||||||
expense.getPaymentDate() != null ? expense.getPaymentDate().toLocalDate() : "Unpaid"
|
expense.getPaymentDate() != null ? expense.getPaymentDate() : "Unpaid"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.Year;
|
import java.time.Year;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -144,7 +145,7 @@ public class ExpenseService {
|
||||||
* @param entity the expense to update
|
* @param entity the expense to update
|
||||||
*/
|
*/
|
||||||
public void update(Expense entity) {
|
public void update(Expense entity) {
|
||||||
if (Boolean.TRUE.equals(entity.getIsPaid())) entity.setPaymentDate(LocalDateTime.now());
|
if (Boolean.TRUE.equals(entity.getIsPaid())) entity.setPaymentDate(LocalDate.now());
|
||||||
this.setExpenseType(entity);
|
this.setExpenseType(entity);
|
||||||
expenseRepository.save(entity);
|
expenseRepository.save(entity);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue