Not using a random id anymore but constructing it from property values that make an account transaction unique
This commit is contained in:
parent
b2374d2ac2
commit
e5da3725de
|
@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIdentityInfo
|
||||||
import com.fasterxml.jackson.annotation.ObjectIdGenerators
|
import com.fasterxml.jackson.annotation.ObjectIdGenerators
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
import java.text.DateFormat
|
import java.text.DateFormat
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,6 +49,11 @@ open class AccountTransaction(
|
||||||
val relatedReferenceNumber: String?
|
val relatedReferenceNumber: String?
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
val IdDateFormat = SimpleDateFormat("yyyy.MM.dd")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
constructor(bankAccount: BankAccount, amount: BigDecimal, unparsedUsage: String, bookingDate: Date,
|
constructor(bankAccount: BankAccount, amount: BigDecimal, unparsedUsage: String, bookingDate: Date,
|
||||||
otherPartyName: String?, otherPartyBankCode: String?, otherPartyAccountId: String?,
|
otherPartyName: String?, otherPartyBankCode: String?, otherPartyAccountId: String?,
|
||||||
bookingText: String?, valueDate: Date)
|
bookingText: String?, valueDate: Date)
|
||||||
|
@ -61,8 +67,7 @@ open class AccountTransaction(
|
||||||
null, "", "", null, null, "", null)
|
null, "", "", null, null, "", null)
|
||||||
|
|
||||||
|
|
||||||
var id: String = UUID.randomUUID().toString()
|
var id: String = "${bankAccount.id} ${IdDateFormat.format(bookingDate)} ${IdDateFormat.format(valueDate)} $amount $currency $unparsedUsage $otherPartyName $otherPartyBankCode $otherPartyAccountId"
|
||||||
protected set
|
|
||||||
|
|
||||||
|
|
||||||
val showOtherPartyName: Boolean
|
val showOtherPartyName: Boolean
|
||||||
|
|
Loading…
Reference in New Issue