Not using a random id anymore but constructing it from property values that make an account transaction unique

This commit is contained in:
dankito 2020-05-27 12:24:27 +02:00
parent b2374d2ac2
commit e5da3725de
1 changed files with 7 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIdentityInfo
import com.fasterxml.jackson.annotation.ObjectIdGenerators
import java.math.BigDecimal
import java.text.DateFormat
import java.text.SimpleDateFormat
import java.util.*
@ -48,6 +49,11 @@ open class AccountTransaction(
val relatedReferenceNumber: String?
) {
companion object {
val IdDateFormat = SimpleDateFormat("yyyy.MM.dd")
}
constructor(bankAccount: BankAccount, amount: BigDecimal, unparsedUsage: String, bookingDate: Date,
otherPartyName: String?, otherPartyBankCode: String?, otherPartyAccountId: String?,
bookingText: String?, valueDate: Date)
@ -61,8 +67,7 @@ open class AccountTransaction(
null, "", "", null, null, "", null)
var id: String = UUID.randomUUID().toString()
protected set
var id: String = "${bankAccount.id} ${IdDateFormat.format(bookingDate)} ${IdDateFormat.format(valueDate)} $amount $currency $unparsedUsage $otherPartyName $otherPartyBankCode $otherPartyAccountId"
val showOtherPartyName: Boolean