company-service http://jira.mfd.msk:8088/browse/CLS-272 доделал коммент к таску 27/апр/23 16:24
This commit is contained in:
parent
864bbcf125
commit
b6eb7a9d71
3 changed files with 24 additions and 47 deletions
|
|
@ -68,16 +68,6 @@ public class ClientCodeValidationConfig {
|
|||
acc -> Objects.equals(context.getValidatedObject().getCompanyId(), acc.getCompanyId())
|
||||
? null : CompanyErrors.AccountNotFound
|
||||
),
|
||||
IdPresentRule.instance("tradingClearingRegistryId",
|
||||
ClientCodeNewRequest::getTradingClearingRegistryId,
|
||||
IMDGDistributedNames.Map_TradingClearingRegistry,
|
||||
TradingClearingRegistry.class,
|
||||
CompanyErrors.RequiredFieldEmpty,
|
||||
CompanyErrors.TradingClearingRegistryNotFound,
|
||||
false,
|
||||
acc -> Objects.equals(context.getValidatedObject().getCompanyId(), acc.getCompanyId())
|
||||
? null : CompanyErrors.TradingClearingRegistryNotFound
|
||||
),
|
||||
|
||||
|
||||
DictionaryPresentRule.instance("stauts",
|
||||
|
|
@ -139,16 +129,6 @@ public class ClientCodeValidationConfig {
|
|||
acc -> Objects.equals(context.getValidatedObject().getCompanyId(), acc.getCompanyId())
|
||||
? null : CompanyErrors.AccountNotFound
|
||||
),
|
||||
IdPresentRule.instance("tradingClearingRegistryId",
|
||||
ClientCodeUpdateRequest::getTradingClearingRegistryId,
|
||||
IMDGDistributedNames.Map_TradingClearingRegistry,
|
||||
TradingClearingRegistry.class,
|
||||
CompanyErrors.RequiredFieldEmpty,
|
||||
CompanyErrors.TradingClearingRegistryNotFound,
|
||||
false,
|
||||
acc -> Objects.equals(context.getValidatedObject().getCompanyId(), acc.getCompanyId())
|
||||
? null : CompanyErrors.TradingClearingRegistryNotFound
|
||||
),
|
||||
|
||||
DictionaryPresentRule.instance("stauts",
|
||||
ClientCodeUpdateRequest::getStatus,
|
||||
|
|
|
|||
|
|
@ -147,14 +147,6 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
|
|||
}
|
||||
}
|
||||
|
||||
if (req.getTradingClearingRegistryId() == null && req.getMoneyAccountId() != null) {
|
||||
TradingClearingRegistry tradingClearingRegistry = selectTradingClearingRegistry(req.getCompanyId(), req.getMoneyAccountId(), req.getDepoAccountId());
|
||||
if (tradingClearingRegistry == null) {
|
||||
return makeErrorResponse(userRequest, CompanyErrors.TradingClearingRegistryNotFound);
|
||||
} else {
|
||||
req.setTradingClearingRegistryId(tradingClearingRegistry.getId());
|
||||
}
|
||||
}
|
||||
ClientCode newClientCode = buildClientCode(req);
|
||||
clientCodeMap.insert(newClientCode);
|
||||
log.debug("successfully processed, new clientCode id {}", newClientCode.getId());
|
||||
|
|
@ -188,14 +180,6 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
|
|||
}
|
||||
}
|
||||
|
||||
if (req.getTradingClearingRegistryId() == null && req.getMoneyAccountId() != null) {
|
||||
TradingClearingRegistry tradingClearingRegistry = selectTradingClearingRegistry(req.getCompanyId(), req.getMoneyAccountId(), req.getDepoAccountId());
|
||||
if (tradingClearingRegistry == null) {
|
||||
return makeErrorResponse(userRequest, CompanyErrors.TradingClearingRegistryNotFound);
|
||||
} else {
|
||||
req.setTradingClearingRegistryId(tradingClearingRegistry.getId());
|
||||
}
|
||||
}
|
||||
ClientCode newClientCode = buildClientCode(req);
|
||||
clientCodeMap.insert(newClientCode);
|
||||
log.debug("successfully processed, new clientCode id {}", newClientCode.getId());
|
||||
|
|
@ -233,14 +217,6 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
|
|||
}
|
||||
}
|
||||
|
||||
if (req.getTradingClearingRegistryId() == null && req.getMoneyAccountId() != null) {
|
||||
TradingClearingRegistry tradingClearingRegistry = selectTradingClearingRegistry(req.getCompanyId(), req.getMoneyAccountId(), req.getDepoAccountId());
|
||||
if (tradingClearingRegistry == null) {
|
||||
return makeErrorResponse(userRequest, CompanyErrors.TradingClearingRegistryNotFound);
|
||||
} else {
|
||||
req.setTradingClearingRegistryId(tradingClearingRegistry.getId());
|
||||
}
|
||||
}
|
||||
updateClientCode(clientCode, req);
|
||||
|
||||
clientCodeMap.update(clientCode);
|
||||
|
|
@ -392,7 +368,17 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
|
|||
|
||||
clientCode.setCompanyId(req.getCompanyId());
|
||||
clientCode.setCode(req.getCode());
|
||||
clientCode.setTradingClearingRegistryId(req.getTradingClearingRegistryId());
|
||||
|
||||
if (req.getMoneyAccountId() != null) {
|
||||
TradingClearingRegistry tradingClearingRegistry = selectTradingClearingRegistry(req.getCompanyId(), req.getMoneyAccountId(), req.getDepoAccountId());
|
||||
if (tradingClearingRegistry == null) {
|
||||
log.warn("TCR not found: CompanyId {}, MoneyAccountId {}, DepoAccountId {}",
|
||||
req.getCompanyId(), req.getMoneyAccountId(), req.getDepoAccountId());
|
||||
} else {
|
||||
clientCode.setTradingClearingRegistryId(tradingClearingRegistry.getId());
|
||||
}
|
||||
}
|
||||
|
||||
clientCode.setMoneyAccountId(req.getMoneyAccountId());
|
||||
clientCode.setDepoAccountId(req.getDepoAccountId());
|
||||
clientCode.setStatus(req.getStatus());
|
||||
|
|
@ -405,6 +391,17 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
|
|||
|
||||
clientCode.setCompanyId(req.getCompanyId());
|
||||
clientCode.setCode(req.getCode());
|
||||
|
||||
if (req.getMoneyAccountId() != null) {
|
||||
TradingClearingRegistry tradingClearingRegistry = selectTradingClearingRegistry(req.getCompanyId(), req.getMoneyAccountId(), req.getDepoAccountId());
|
||||
if (tradingClearingRegistry == null) {
|
||||
log.warn("TCR not found: CompanyId {}, MoneyAccountId {}, DepoAccountId {}",
|
||||
req.getCompanyId(), req.getMoneyAccountId(), req.getDepoAccountId());
|
||||
} else {
|
||||
clientCode.setTradingClearingRegistryId(tradingClearingRegistry.getId());
|
||||
}
|
||||
}
|
||||
|
||||
clientCode.setTradingClearingRegistryId(req.getTradingClearingRegistryId());
|
||||
clientCode.setMoneyAccountId(req.getMoneyAccountId());
|
||||
clientCode.setDepoAccountId(req.getDepoAccountId());
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ class ClientCodeServiceTest {
|
|||
predictableClientCode.setCompanyId(COMPANY_ID);
|
||||
// predictableClientCode.setMoneyAccountId(131L);
|
||||
// predictableClientCode.setDepoAccountId(132L);
|
||||
predictableClientCode.setTradingClearingRegistryId(TCR_ID);
|
||||
// predictableClientCode.setTradingClearingRegistryId(TCR_ID);
|
||||
|
||||
//ACT
|
||||
String jsonString = getJsonStringForNew(clientCodeNewRequest, ID);
|
||||
|
|
@ -222,7 +222,7 @@ class ClientCodeServiceTest {
|
|||
predictableClientCode.setCompanyId(COMPANY_ID);
|
||||
// predictableClientCode.setMoneyAccountId(131L);
|
||||
// predictableClientCode.setDepoAccountId(132L);
|
||||
predictableClientCode.setTradingClearingRegistryId(TCR_ID);
|
||||
// predictableClientCode.setTradingClearingRegistryId(TCR_ID);
|
||||
|
||||
//ACT
|
||||
String jsonString = getJsonStringForNew(clientCodeNewRequest, ID);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue