a
This commit is contained in:
@@ -25,7 +25,7 @@ public class UserAccount implements Serializable {
|
||||
@Column(name = "name")
|
||||
private String name;
|
||||
|
||||
@ManyToMany(fetch = FetchType.EAGER)
|
||||
@ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
|
||||
@JoinTable(
|
||||
name = "rel_user_account__user",
|
||||
joinColumns = @JoinColumn(name = "user_account_id"),
|
||||
|
||||
@@ -185,9 +185,10 @@ public class EventService {
|
||||
.forEach(registration -> {
|
||||
String login = registration.getUser().getLogin();
|
||||
UserAccount userAccount = accountsByLogin.get(login);
|
||||
if (userAccount != null) {
|
||||
if (userAccount == null) {
|
||||
userAccount = new UserAccount();
|
||||
userAccount.setName(registration.getUser().getName());
|
||||
userAccount.getUsers().add(registration.getUser());
|
||||
userAccount = userAccountRepository.save(userAccount);
|
||||
}
|
||||
accountsToCharge.add(userAccount);
|
||||
@@ -202,7 +203,7 @@ public class EventService {
|
||||
TransactionItem playerCharge = new TransactionItem();
|
||||
playerCharge.setEvent(event);
|
||||
playerCharge.setAmount(event.getCost().divide(BigDecimal.valueOf(-accountsToCharge.size()), 2, RoundingMode.HALF_UP));
|
||||
playerCharge.setUserAccount(accountsByAccountName.get(fieldServiceAccountName));
|
||||
playerCharge.setUserAccount(userAccount);
|
||||
playerCharge.setTransaction(transaction);
|
||||
transaction.getTransactionItems().add(playerCharge);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user