implemented showing members of companies

This commit is contained in:
2025-08-08 12:50:26 +02:00
parent c4b4088620
commit edeffc572c
4 changed files with 40 additions and 11 deletions

View File

@@ -9,10 +9,7 @@ import de.srsoftware.tools.Mappable;
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Currency;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.*;
import org.json.JSONException;
import org.json.JSONObject;
@@ -23,6 +20,7 @@ public class Company implements Mappable {
private long lastCustomerNumber;
private int decimals;
private final Set<String> dirtyFields = new HashSet<>();
private final Map<Long,UmbrellaUser> members;
private Company(long id){
this(id,null,null,null,null,null,null,null,0,2,null,null,null,null);
@@ -43,6 +41,7 @@ public class Company implements Mappable {
this.currency = currency;
this.email = email;
this.bankAccount = bankAccount;
this.members = new HashMap<>();
}
public String address(){
@@ -98,6 +97,10 @@ public class Company implements Mappable {
return lastCustomerNumber;
}
public Map<Long, UmbrellaUser> members(){
return members;
}
public String name(){
return name;
}
@@ -175,6 +178,10 @@ public class Company implements Mappable {
@Override
public Map<String, Object> toMap() {
var memberMap = new HashMap<Long,Map<String,Object>>();
if (members != null) for (var entry : members.entrySet()){
memberMap.put(entry.getKey(),entry.getValue().toMap());
}
return Map.ofEntries(
entry(ID,id),
entry(NAME,name),
@@ -189,7 +196,8 @@ public class Company implements Mappable {
entry(CUSTOMER_NUMBER_PREFIX,emptyIfNull(customerNumberPrefix)),
entry(FIELD_CURRENCY,emptyIfNull(currency)),
entry(EMAIL,emptyIfNull(email)),
entry(FIELD_BANK_ACCOUNT,emptyIfNull(bankAccount))
entry(FIELD_BANK_ACCOUNT,emptyIfNull(bankAccount)),
entry(MEMBERS,memberMap)
);
}