This commit is contained in:
AKurakin 2023-08-30 15:27:38 +03:00
parent 38916cdeb1
commit 228b290570

View file

@ -14,6 +14,7 @@ import ru.spcex.platform.enumeration.CompanySymbol;
import ru.spcex.platform.enumeration.WorkflowStatus;
import ru.spcex.platform.imdg.api.Imdg;
import ru.spcex.platform.imdg.api.ImdgProvider;
import ru.spcex.platform.utils.log.ExceptionUtils;
import java.util.Map;
@ -81,19 +82,21 @@ public class CompanyRequestAdapter {
clientCodeNewRequest.setCode(client.getClientCode());
clientCodeNewRequest.setMoneyAccountId(client.getMoneyAccountId());
clientCodeNewRequest.setDepoAccountId(client.getDepoAccountId());
if (client.getMoneyAccount() != null) {
if (client.getMoneyAccount() != null) try {
Account mAccount = accountMap.getSingleObjectByFieldValues(Map.of(
// "accountType", AccountType.Clrn.getKey(), or "accountType", AccountType.Info.getKey(),
"account", client.getDepoAccount()
"account", client.getMoneyAccount()
));
if (mAccount == null) {
log.warn("Money account \"{}\" not found", client.getMoneyAccount());
} else {
log.warn("Money account \"{}\" found with id={}", client.getMoneyAccount(), mAccount.getId());
log.trace("Money account \"{}\" found with id={}", client.getMoneyAccount(), mAccount.getId());
client.setDepoAccountId(mAccount.getId());
}
} catch (Exception e) {
log.warn("Error happened when search money account \"{}\": {}", client.getMoneyAccount(), ExceptionUtils.getStackTrace(e));
}
if (client.getDepoAccount() != null) {
if (client.getDepoAccount() != null) try {
Account dAccount = accountMap.getSingleObjectByFieldValues(Map.of(
"accountType", AccountType.Depo.getKey(),
"account", client.getDepoAccount()
@ -101,9 +104,11 @@ public class CompanyRequestAdapter {
if (dAccount == null) {
log.warn("Depo account \"{}\" not found", client.getDepoAccount());
} else {
log.warn("Depo account \"{}\" found with id={}", client.getDepoAccount(), dAccount.getId());
log.trace("Depo account \"{}\" found with id={}", client.getDepoAccount(), dAccount.getId());
client.setDepoAccountId(dAccount.getId());
}
} catch (Exception e) {
log.warn("Error happened when search depo account \"{}\": {}", client.getMoneyAccount(), ExceptionUtils.getStackTrace(e));
}
return clientCodeNewRequest;
}