account-service http://jira.mfd.msk:8088/browse/CLS-272 исправления ClientCode, TradingClearingRegistry
This commit is contained in:
parent
0d01940b42
commit
d3069db920
2 changed files with 31 additions and 3 deletions
|
|
@ -229,11 +229,13 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
|
|||
|
||||
ClientCode clientCode = clientCodeMap.getSingleObjectByID(req.getId());
|
||||
if (clientCode.getMoneyAccountId() != null) {
|
||||
log.debug("Delete clientCode.id = {}: send message to account-service", clientCode.getId());
|
||||
log.debug("Blocking clientCode.id = {}: send message to account-service", clientCode.getId());
|
||||
sendBlockTCR(clientCode.getTradingClearingRegistryId(), clientCode.getMoneyAccountId());
|
||||
}
|
||||
log.debug("Delete clientCode.id={}", clientCode.getId());
|
||||
clientCodeMap.delete(clientCode);
|
||||
log.debug("Blocking clientCode.id={}", clientCode.getId());
|
||||
clientCode.setUpdated(Instant.now());
|
||||
clientCode.setStatus(WorkflowStatus.Blocked.getKey());
|
||||
clientCodeMap.update(clientCode);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,6 +153,14 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
|||
// Пока что она соответствует ТЗ, но возможно будет правиться, поэтому расписана без выноса кода в методы и
|
||||
// прочих методов сокращения кода. В дальнейшем, после тестирования и окончательного выяснения вида проверки,
|
||||
// её стоит вынести на этап валидации запроса.
|
||||
if (req.getMoneyAccountId() == null && (req.getMoneyAccountId() == null || req.getDepoAccountId() == null)) {
|
||||
TradingClearingRegistry registryByCompany = tradingClearingRegistryImdg.getSingleObjectByFieldValues(Map.of("companyId", req.getCompanyId()));
|
||||
if (registryByCompany == null) {
|
||||
return requestHelper.makeErrorResponse(userRequest,
|
||||
AccountError.TradingClearingRegistryNotFound,
|
||||
req.getCompanyId());
|
||||
}
|
||||
}
|
||||
Relation relation = relationImdg.getSingleObjectByFieldValues(Map.of("consumerId", req.getCompanyId()));
|
||||
if (ru.spcex.platform.enumeration.Service.MKR.equalsByKey(relation.getService())) {
|
||||
TradingClearingRegistry registry = tradingClearingRegistryImdg.getSingleObjectByFieldValues(Map.of("companyId", req.getCompanyId()));
|
||||
|
|
@ -281,6 +289,15 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
|||
}
|
||||
|
||||
TradingClearingRegistryNewRequest req = userRequest.getRequestPayload();
|
||||
// Дополнительная проверка
|
||||
if (req.getMoneyAccountId() == null && (req.getMoneyAccountId() == null || req.getDepoAccountId() == null)) {
|
||||
TradingClearingRegistry registryByCompany = tradingClearingRegistryImdg.getSingleObjectByFieldValues(Map.of("companyId", req.getCompanyId()));
|
||||
if (registryByCompany == null) {
|
||||
return requestHelper.makeErrorResponse(userRequest,
|
||||
AccountError.TradingClearingRegistryNotFound,
|
||||
"companyId=" + req.getCompanyId());
|
||||
}
|
||||
}
|
||||
|
||||
Long id = tradingClearingRegistryImdg.nextIDSequenceFor();
|
||||
TradingClearingRegistry tradingClearingRegistry = new TradingClearingRegistry();
|
||||
|
|
@ -335,6 +352,15 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
|||
|
||||
TradingClearingRegistryUpdateRequest req = userRequest.getRequestPayload();
|
||||
TradingClearingRegistry tradingClearingRegistry = tradingClearingRegistryImdg.getSingleObjectByID(req.getId());
|
||||
// Дополнительная проверка
|
||||
if (req.getMoneyAccountId() == null && (req.getMoneyAccountId() == null || req.getDepoAccountId() == null)) {
|
||||
TradingClearingRegistry registryByCompany = tradingClearingRegistryImdg.getSingleObjectByFieldValues(Map.of("companyId", req.getCompanyId()));
|
||||
if (registryByCompany == null) {
|
||||
return requestHelper.makeErrorResponse(userRequest,
|
||||
AccountError.TradingClearingRegistryNotFound,
|
||||
"companyId=" + req.getCompanyId());
|
||||
}
|
||||
}
|
||||
|
||||
if (req.getStatus() != null) tradingClearingRegistry.setStatus(req.getStatus());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue