@@ -18,7 +18,6 @@ public class AccountInfo {
|
||||
private long balance;
|
||||
private List<AccountChangeInfo> changes;
|
||||
private Map<String, AccountTransactionInfo> transactions;
|
||||
private Map<String, TransferState> transferStates;
|
||||
private String version;
|
||||
private Date date;
|
||||
|
||||
@@ -77,12 +76,4 @@ public class AccountInfo {
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public Map<String, TransferState> getTransferStates() {
|
||||
return transferStates;
|
||||
}
|
||||
|
||||
public void setTransferStates(Map<String, TransferState> transferStates) {
|
||||
this.transferStates = transferStates;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,10 +55,12 @@ public class AccountInfoUpdateService {
|
||||
|
||||
|
||||
public void addTransaction(String accountId, AccountTransactionInfo ti) {
|
||||
System.out.println("Start addTransaction for: "+ti.toString());
|
||||
mongoTemplate.upsert(new Query(where("id").is(accountId)),
|
||||
new Update().
|
||||
set("transactions." + ti.getTransactionId(), ti),
|
||||
AccountInfo.class);
|
||||
System.out.println("End addTransaction for: "+ti.toString());
|
||||
}
|
||||
|
||||
|
||||
@@ -72,9 +74,11 @@ public class AccountInfoUpdateService {
|
||||
}
|
||||
|
||||
public void updateTransactionStatus(String accountId, String transactionId, TransferState status) {
|
||||
System.out.println("Start updateTransactionStatus "+accountId +" "+transactionId+" "+status);
|
||||
mongoTemplate.upsert(new Query(where("id").is(accountId)),
|
||||
new Update().
|
||||
set("transferStates." + transactionId, status),
|
||||
set("transactions." + transactionId + ".status", status),
|
||||
AccountInfo.class);
|
||||
System.out.println("End updateTransactionStatus "+accountId +" "+transactionId+" "+status);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@ public class AccountQueryService {
|
||||
if (account == null)
|
||||
throw new AccountNotFoundException(accountId);
|
||||
else
|
||||
if(account.getTransferStates()!=null)
|
||||
account.getTransactions().stream().forEach(ati -> ati.setStatus(account.getTransferStates().get(ati.getTransactionId())));
|
||||
return account;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user