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;
|
||||
|
||||
@Column(name = "PaymentDate")
|
||||
private LocalDateTime paymentDate;
|
||||
private LocalDate paymentDate;
|
||||
|
||||
@Column(name = "isPaid", nullable = false)
|
||||
private Boolean isPaid = false;
|
||||
|
|
|
@ -27,7 +27,7 @@ public class CSVService {
|
|||
expense.getCost(),
|
||||
expense.getCategory() != null ? expense.getCategory().getName() : "",
|
||||
expense.getDate(),
|
||||
expense.getPaymentDate() != null ? expense.getPaymentDate().toLocalDate() : "Unpaid"
|
||||
expense.getPaymentDate() != null ? expense.getPaymentDate() : "Unpaid"
|
||||
);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.Year;
|
||||
import java.util.ArrayList;
|
||||
|
@ -144,7 +145,7 @@ public class ExpenseService {
|
|||
* @param entity the expense to update
|
||||
*/
|
||||
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);
|
||||
expenseRepository.save(entity);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue