Merge branch 'dev' into plan_balance_dmx_dmt
This commit is contained in:
commit
96b5e90ebf
22 changed files with 200 additions and 359 deletions
|
|
@ -13,6 +13,10 @@ public class NotificationUpdateAction implements IAction<NotificationUpdateReque
|
|||
@ApiModelProperty(value = "Наименование статуса сообщения", example = "ACTV")
|
||||
@JsonProperty
|
||||
public String notificationStatus;
|
||||
@ApiModelProperty(value = "Наименование отправителя (не исопльзуется)", example = "1234")
|
||||
@JsonProperty(required = false)
|
||||
@Deprecated
|
||||
public Long senderId;
|
||||
|
||||
@Override
|
||||
public NotificationUpdateRequest toRequest() {
|
||||
|
|
@ -43,4 +47,12 @@ public class NotificationUpdateAction implements IAction<NotificationUpdateReque
|
|||
public void setNotificationStatus(String notificationStatus) {
|
||||
this.notificationStatus = notificationStatus;
|
||||
}
|
||||
|
||||
public Long getSenderId() {
|
||||
return senderId;
|
||||
}
|
||||
|
||||
public void setSenderId(Long senderId) {
|
||||
this.senderId = senderId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -466,7 +466,7 @@
|
|||
<errorCode id="5423" code="CLRN" name="Новые сделки отсутствуют."/>
|
||||
<errorCode id="5424" code="CLRN" name="Идентифицированные средства по возврату депозита превышают обязательства"/>
|
||||
<errorCode id="5425" code="CLRN" name="Запрещена идентификация средства по рассчитанным обязательствам."/>
|
||||
<errorCode id="5426" code="CLRN" name="Режим списаний и зачислений отключен в настройках модуля."/>
|
||||
<errorCode id="5426" code="CLRN" name="Дата оплаты вклада депозита меньше новой даты возврата."/>
|
||||
<errorCode id="5427" code="CLRN" name="Найдено больше одной записи %s."/>
|
||||
<errorCode id="5428" code="CLRN" name="Активная клиринговая сессия уже существует."/>
|
||||
<errorCode id="5429" code="CLRN" name="ДФ57 Счет %s не соответствует компании %s"/>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
{
|
||||
"version": "3.8.0.55",
|
||||
"version": "3.8.0.57",
|
||||
|
||||
"enums": {
|
||||
|
||||
|
|
@ -6961,11 +6961,11 @@
|
|||
}
|
||||
,
|
||||
{"code": "updatedAt",
|
||||
"field": "updated","type": 4,"webtype": "5","dbname": "Дата-время изменения записи","name": "Время прочтения записи","shortname": "Прочитано","searchable": true,"sortable": true
|
||||
"field": "updated","type": 4,"webtype": "5","dbname": "Дата-время изменения записи","name": "Время изменения записи","shortname": "Изменено","searchable": true,"sortable": true
|
||||
}
|
||||
,
|
||||
{"code": "senderId",
|
||||
"type": 1,"dbname": "Идентификатор компании-отправителя","name": "Наименование компании-отправителя","shortname": "Отправитель","searchable": true,"sortable": true,"link": "company","ignore": true
|
||||
"type": 1,"dbname": "Идентификатор отправителя","name": "Наименование отправителя","shortname": "Отправитель","searchable": true,"sortable": true,"visible": true,"link": "userCls","linkCode": "identifier"
|
||||
}
|
||||
,
|
||||
{"code": "addresseeId",
|
||||
|
|
@ -6981,7 +6981,7 @@
|
|||
}
|
||||
,
|
||||
{"code": "notificationStatus",
|
||||
"type": 12,"dbname": "Код статуса сообщения","name": "Наименование статуса сообщения","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "notificationStatus","ignore": true
|
||||
"type": 12,"dbname": "Код статуса сообщения","name": "Наименование статуса сообщения","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "notificationStatus"
|
||||
}
|
||||
,
|
||||
{"code": "comment",
|
||||
|
|
@ -6997,6 +6997,8 @@
|
|||
|
||||
"name": "Изменение статуса сообщения",
|
||||
|
||||
"class": "ru.spcex.clearing.backendapi.controller.request.cud.registry.NotificationUpdateAction",
|
||||
|
||||
"fields": [
|
||||
{"code": "id",
|
||||
"type": 1,"name": "Идентификатор записи","shortname": "ID","link": "notification","linkCode": "id","required": true
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--?xml-stylesheet type="text/xsl" href="\..\corp-reports\src\data\meta\meta.server.xslt"?-->
|
||||
<meta version="3.8.0.55">
|
||||
<meta version="3.8.0.57">
|
||||
<!-- _xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" _xsi:noNamespaceSchemaLocation="file:///E:/d/projects/meta/from/meta.xsd" -->
|
||||
<!--Здесь словари-->
|
||||
<enums>
|
||||
|
|
@ -1610,16 +1610,16 @@
|
|||
<id type="1" name="Идентификатор записи" shortname="ID" searchable="true" sortable="true"/>
|
||||
<clearingDate type="6" name="Дата" shortname="Дата" searchable="true" sortable="true" visible="true"/>
|
||||
<createdAt field="created" type="4" webtype="5" dbname="Дата-время создания записи" name="Время создания записи" shortname="Создано" searchable="true" sortable="true" visible="true"/>
|
||||
<updatedAt field="updated" type="4" webtype="5" dbname="Дата-время изменения записи" name="Время прочтения записи" shortname="Прочитано" searchable="true" sortable="true"/>
|
||||
<senderId type="1" dbname="Идентификатор компании-отправителя" name="Наименование компании-отправителя" shortname="Отправитель" searchable="true" sortable="true" link="company" ignore="true"/>
|
||||
<updatedAt field="updated" type="4" webtype="5" dbname="Дата-время изменения записи" name="Время изменения записи" shortname="Изменено" searchable="true" sortable="true"/>
|
||||
<senderId type="1" dbname="Идентификатор отправителя" name="Наименование отправителя" shortname="Отправитель" searchable="true" sortable="true" visible="true" link="userCls" linkCode="identifier"/>
|
||||
<addresseeId type="1" dbname="Идентификатор компании-получателя" name="Наименование компании-получателя" shortname="Получатель" searchable="true" sortable="true" link="company" ignore="true"/>
|
||||
<objectType type="12" dbname="Код типа объекта" name="Наименование типа объекта" shortname="Объект" searchable="true" sortable="true" link="objectType" ignore="true"/>
|
||||
<objectId type="1" name="Идентификатор объекта" shortname="ID объекта" searchable="true" sortable="true" ignore="true"/>
|
||||
<notificationStatus type="12" dbname="Код статуса сообщения" name="Наименование статуса сообщения" shortname="Статус" searchable="true" sortable="true" visible="true" link="notificationStatus" ignore="true"/>
|
||||
<notificationStatus type="12" dbname="Код статуса сообщения" name="Наименование статуса сообщения" shortname="Статус" searchable="true" sortable="true" visible="true" link="notificationStatus"/>
|
||||
<comment type="2" length="255" name="Текст сообщения" shortname="Сообщение" searchable="true" sortable="true" visible="true"/>
|
||||
<priority type="12" dbname="Код приоритета отображения" name="Наименование приоритета отображения" shortname="Приоритет отображения" searchable="true" sortable="true" link="priority"/>
|
||||
<actions>
|
||||
<put name="Изменение статуса сообщения">
|
||||
<put name="Изменение статуса сообщения" class="ru.spcex.clearing.backendapi.controller.request.cud.registry.NotificationUpdateAction">
|
||||
<id type="1" name="Идентификатор записи" shortname="ID" link="notification" linkCode="id" required="true"/>
|
||||
<notificationStatus type="12" name="Наименование статуса сообщения" shortname="Статус" link="notificationStatus" required="true"/>
|
||||
</put>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
{
|
||||
"version": "3.8.0.55",
|
||||
"version": "3.8.0.57",
|
||||
|
||||
"enums": {
|
||||
|
||||
|
|
@ -6961,11 +6961,11 @@
|
|||
}
|
||||
,
|
||||
{"code": "updatedAt",
|
||||
"field": "updated","type": 4,"webtype": "5","dbname": "Дата-время изменения записи","name": "Время прочтения записи","shortname": "Прочитано","searchable": true,"sortable": true
|
||||
"field": "updated","type": 4,"webtype": "5","dbname": "Дата-время изменения записи","name": "Время изменения записи","shortname": "Изменено","searchable": true,"sortable": true
|
||||
}
|
||||
,
|
||||
{"code": "senderId",
|
||||
"type": 1,"dbname": "Идентификатор компании-отправителя","name": "Наименование компании-отправителя","shortname": "Отправитель","searchable": true,"sortable": true,"link": "company","ignore": true
|
||||
"type": 1,"dbname": "Идентификатор отправителя","name": "Наименование отправителя","shortname": "Отправитель","searchable": true,"sortable": true,"visible": true,"link": "userCls","linkCode": "identifier"
|
||||
}
|
||||
,
|
||||
{"code": "addresseeId",
|
||||
|
|
@ -6981,7 +6981,7 @@
|
|||
}
|
||||
,
|
||||
{"code": "notificationStatus",
|
||||
"type": 12,"dbname": "Код статуса сообщения","name": "Наименование статуса сообщения","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "notificationStatus","ignore": true
|
||||
"type": 12,"dbname": "Код статуса сообщения","name": "Наименование статуса сообщения","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "notificationStatus"
|
||||
}
|
||||
,
|
||||
{"code": "comment",
|
||||
|
|
@ -6997,6 +6997,8 @@
|
|||
|
||||
"name": "Изменение статуса сообщения",
|
||||
|
||||
"class": "ru.spcex.clearing.backendapi.controller.request.cud.registry.NotificationUpdateAction",
|
||||
|
||||
"fields": [
|
||||
{"code": "id",
|
||||
"type": 1,"name": "Идентификатор записи","shortname": "ID","link": "notification","linkCode": "id","required": true
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ public enum ClearingError implements IErrorEnumId {
|
|||
NewDealsNotFound(5423L),
|
||||
IdentifiedFundsExceedObligations(5424L),
|
||||
ObligationsAlreadyCalculated(5425L),
|
||||
RefundDtLessThatValueDt(5426L),
|
||||
ActiveSessionIsPresent(5428L),
|
||||
AccountIsNotMatchedWithCompany(5429L),
|
||||
RgsWrongCode(5430L),
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public enum RefundDateValidationRule implements IValidationRule<ImdgValidationCo
|
|||
}
|
||||
for (Registry rgs : rgss) {
|
||||
if (!validatedObject.getRefundDate().isAfter(rgs.getValueDate())) { // если request.RefundDate <= ValueDate - то ошибка
|
||||
return of(ClearingError.WrongField, "refundDate");
|
||||
return of(ClearingError.RefundDtLessThatValueDt, "refundDate");
|
||||
}
|
||||
}
|
||||
context.storeObject(ValidationStored.RefundDateChangeRegistries, rgss);
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ public class IntermediateMkrSession extends AbstractSession implements Initializ
|
|||
inspectionObligations.setSessionType(sessionType());
|
||||
inspectionObligations.setSection(section());
|
||||
formingPaymentInstructionDeals.setSection(section());
|
||||
formingPaymentInstructionDeals.setSessionType(sessionType());
|
||||
imdgProvider.waitAvailable();
|
||||
initSessionIfPresent();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ public class FormingPaymentInstructionAssets implements ISessionStage {
|
|||
|
||||
private StageResult<?> formingPaymentInstructions(FormingPaymentInstructionPayload payload) {
|
||||
Long sessionId = payload.getSessionId();
|
||||
if (SessionType.FINL.equals(sessionType)) {
|
||||
if (SessionType.FINL.equals(sessionType) || SessionType.MEDM.equals(sessionType)) {
|
||||
dmvSrv.createDmv(sessionId);
|
||||
}
|
||||
Collection<Registry> AMBregistries = selectAMBRegistries(sessionId);
|
||||
|
|
|
|||
|
|
@ -902,7 +902,7 @@ INSERT INTO ERROR_CODE_DICTIONARY(ID, CODE, NAME) values (5424, 'CLRN', 'Иде
|
|||
|
||||
INSERT INTO ERROR_CODE_DICTIONARY(ID, CODE, NAME) values (5425, 'CLRN', 'Запрещена идентификация средства по рассчитанным обязательствам.') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
|
||||
|
||||
INSERT INTO ERROR_CODE_DICTIONARY(ID, CODE, NAME) values (5426, 'CLRN', 'Режим списаний и зачислений отключен в настройках модуля.') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
|
||||
INSERT INTO ERROR_CODE_DICTIONARY(ID, CODE, NAME) values (5426, 'CLRN', 'Дата оплаты вклада депозита меньше новой даты возврата.') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
|
||||
|
||||
INSERT INTO ERROR_CODE_DICTIONARY(ID, CODE, NAME) values (5427, 'CLRN', 'Найдено больше одной записи %s.') ON CONFLICT (ID) DO UPDATE SET CODE = EXCLUDED.CODE, NAME = EXCLUDED.NAME;
|
||||
|
||||
|
|
|
|||
|
|
@ -53,12 +53,14 @@ public class Journal extends Stage implements InitializingBean {
|
|||
|
||||
//удалим временный файл
|
||||
File dbfFile = resultContainer.getFileForExport();
|
||||
try {
|
||||
log.debug("Uuid {}, delete tem file \"{}\"", resultContainer.getUuid(), dbfFile);
|
||||
Files.deleteIfExists(dbfFile.toPath());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// try {
|
||||
// log.debug("Uuid {}, delete temp file \"{}\"", resultContainer.getUuid(), dbfFile);
|
||||
// Files.deleteIfExists(dbfFile.toPath());
|
||||
// } catch (IOException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// Надо сохранять для разбора истории и отладки по логам
|
||||
log.debug("Uuid {}, save temp file \"{}\"", resultContainer.getUuid(), dbfFile);
|
||||
return StageResult.COMPLETE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import ru.spcex.platform.enumeration.RegistryStatus;
|
|||
import ru.spcex.platform.enumeration.RegistryUnit;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.api.predicate.specific.SecuritySelector;
|
||||
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
||||
import ru.spcex.platform.utils.validation.IValidator;
|
||||
|
||||
|
|
@ -42,7 +43,7 @@ public class AdmittedLiabilitiesRegisterService extends QueueConsumer implements
|
|||
private final Imdg<AdmittedLiabilitiesRegister> admittedLiabilitiesRegisterMap;
|
||||
private final Imdg<Registry> registryMap;
|
||||
private final Imdg<Company> companyMap;
|
||||
private final Imdg<Security> securityMap;
|
||||
private final SecuritySelector<Security> securitySelector;
|
||||
private final Function<Map<String, ?>, IValidator> fieldValuesValidator;
|
||||
|
||||
@Autowired
|
||||
|
|
@ -54,7 +55,7 @@ public class AdmittedLiabilitiesRegisterService extends QueueConsumer implements
|
|||
this.admittedLiabilitiesRegisterMap = imdgProvider.getImdg(IMDGDistributedNames.Map_AdmittedLiabilitiesRegister, AdmittedLiabilitiesRegister.class);
|
||||
this.registryMap = imdgProvider.getImdg(IMDGDistributedNames.Map_Registry, Registry.class);
|
||||
this.companyMap = imdgProvider.getImdg(IMDGDistributedNames.Map_Company, Company.class);
|
||||
this.securityMap = imdgProvider.getImdg(IMDGDistributedNames.Map_Security, Security.class);
|
||||
this.securitySelector = new SecuritySelector<>(imdgProvider, Security.class);
|
||||
this.fieldValuesValidator = fieldValuesValidator;
|
||||
}
|
||||
|
||||
|
|
@ -90,13 +91,12 @@ public class AdmittedLiabilitiesRegisterService extends QueueConsumer implements
|
|||
log.trace("Started generating AdmittedLiabilitiesRegister entity...");
|
||||
AdmittedLiabilitiesRegister admittedLiabilitiesRegister = new AdmittedLiabilitiesRegister();
|
||||
Company company = companyMap.getFirstObjectByFieldValues(Map.of("id", 1L));
|
||||
Security security = securityMap.getFirstObjectByFieldValues(Map.of("id", registry.getSecurityId()));
|
||||
String securitySymbol = security != null ? security.getSecuritySymbol() : null;
|
||||
String securityFullName = security != null ? security.getShortName() : null;
|
||||
String companyFullName = security != null ? company.getFullName() : null;
|
||||
Security security = securitySelector.selectSecurityById(registry.getSecurityId());
|
||||
String securityFullName = security != null ? security.getFullName() : null;
|
||||
String companyFullName = company != null ? company.getFullName() : null;
|
||||
admittedLiabilitiesRegister.setCompanyFullName(companyFullName);
|
||||
admittedLiabilitiesRegister.setSessionId(registry.getSessionId());
|
||||
admittedLiabilitiesRegister.setSecuritySymbol(securitySymbol);
|
||||
admittedLiabilitiesRegister.setSecuritySymbol(registry.getSecuritySymbol());
|
||||
admittedLiabilitiesRegister.setSecurityFullName(securityFullName);
|
||||
admittedLiabilitiesRegister.setCompanyId(registry.getCompanyId());
|
||||
admittedLiabilitiesRegister.setClearingCode(registry.getClearingCode());
|
||||
|
|
@ -113,7 +113,7 @@ public class AdmittedLiabilitiesRegisterService extends QueueConsumer implements
|
|||
return String.format("registryDesignation = '%s' and " +
|
||||
"registryInstrumentType in ('%s','%s') and " +
|
||||
"registryUnit = '%s' and " +
|
||||
"registryStatus in ('%s','%s','%s','%s','%s')"
|
||||
"registryStatus in ('%s','%s','%s','%s','%s', '%s')"
|
||||
,
|
||||
RegistryDesignation.O.getKey(),
|
||||
RegistryInstrumentType.S.getKey(),
|
||||
|
|
@ -123,19 +123,27 @@ public class AdmittedLiabilitiesRegisterService extends QueueConsumer implements
|
|||
RegistryStatus.NACK.getKey(),
|
||||
RegistryStatus.UNCV.getKey(),
|
||||
RegistryStatus.NACC.getKey(),
|
||||
RegistryStatus.FAIL.getKey()
|
||||
RegistryStatus.FAIL.getKey(),
|
||||
RegistryStatus.CLRD.getKey()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<AdmittedLiabilitiesRegister> isDuplicateInMap(Registry entity) {
|
||||
Map<String, ? extends Comparable<?>> fieldValues = Map.of("companyId", entity.getCompanyId(), "sessionId", entity.getSessionId());
|
||||
Optional<EnumMessage> message = fieldValuesValidator.apply(fieldValues).tillFirstError();
|
||||
if (message.isPresent()) {
|
||||
log.warn("Illegal value in map for request to imdg: {}", message.get());
|
||||
throw new IllegalArgumentException(MessageFormat.format("Illegal value in request to imdg: {0}", message.get()));
|
||||
}
|
||||
return Optional.ofNullable(admittedLiabilitiesRegisterMap.getFirstObjectByFieldValues(fieldValues));
|
||||
return Optional.empty();
|
||||
// Map<String, ? extends Comparable<?>> fieldValues = Map.of(
|
||||
// "companyId", entity.getRegistryCode(),
|
||||
// "sessionId", entity.getSessionId(),
|
||||
// "securitySymbol", entity.getSecuritySymbol(),
|
||||
// "clearingDate", entity.getClearingDate(),
|
||||
// "account", entity.getAccount()
|
||||
// );
|
||||
// Optional<EnumMessage> message = fieldValuesValidator.apply(fieldValues).tillFirstError();
|
||||
// if (message.isPresent()) {
|
||||
// log.warn("Illegal value in map for request to imdg: {}", message.get());
|
||||
// throw new IllegalArgumentException(MessageFormat.format("Illegal value in request to imdg: {0}", message.get()));
|
||||
// }
|
||||
// return Optional.ofNullable(admittedLiabilitiesRegisterMap.getFirstObjectByFieldValues(fieldValues));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import ru.spcex.platform.enumeration.RegistryStatus;
|
|||
import ru.spcex.platform.enumeration.RegistryUnit;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.api.predicate.specific.SecuritySelector;
|
||||
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
||||
import ru.spcex.platform.utils.validation.IValidator;
|
||||
|
||||
|
|
@ -42,7 +43,7 @@ public class CoveredLiabilitiesRegisterService extends QueueConsumer implements
|
|||
private final Imdg<CoveredLiabilitiesRegister> coveredLiabilitiesRegisterMap;
|
||||
private final Imdg<Registry> registryMap;
|
||||
private final Imdg<Company> companyMap;
|
||||
private final Imdg<Security> securityMap;
|
||||
private final SecuritySelector<Security> securitySelector;
|
||||
private final Function<Map<String, ?>, IValidator> fieldValuesValidator;
|
||||
|
||||
@Autowired
|
||||
|
|
@ -54,7 +55,7 @@ public class CoveredLiabilitiesRegisterService extends QueueConsumer implements
|
|||
this.coveredLiabilitiesRegisterMap = imdgProvider.getImdg(IMDGDistributedNames.Map_CoveredLiabilitiesRegister, CoveredLiabilitiesRegister.class);
|
||||
this.registryMap = imdgProvider.getImdg(IMDGDistributedNames.Map_Registry, Registry.class);
|
||||
this.companyMap = imdgProvider.getImdg(IMDGDistributedNames.Map_Company, Company.class);
|
||||
this.securityMap = imdgProvider.getImdg(IMDGDistributedNames.Map_Security, Security.class);
|
||||
this.securitySelector = new SecuritySelector<>(imdgProvider, Security.class);
|
||||
this.fieldValuesValidator = fieldValuesValidator;
|
||||
}
|
||||
|
||||
|
|
@ -91,13 +92,12 @@ public class CoveredLiabilitiesRegisterService extends QueueConsumer implements
|
|||
log.trace("insert CoveredLiabilitiesRegister in map...");
|
||||
CoveredLiabilitiesRegister coveredLiabilitiesRegister = new CoveredLiabilitiesRegister();
|
||||
Company company = companyMap.getFirstObjectByFieldValues(Map.of("id", 1L));
|
||||
Security security = securityMap.getFirstObjectByFieldValues(Map.of("id", registry.getSecurityId()));
|
||||
String securitySymbol = security != null ? security.getSecuritySymbol() : null;
|
||||
String securityFullName = security != null ? security.getShortName() : null;
|
||||
String companyFullName = security != null ? company.getFullName() : null;
|
||||
Security security = securitySelector.selectSecurityById(registry.getSecurityId());
|
||||
String securityFullName = security != null ? security.getFullName() : null;
|
||||
String companyFullName = company != null ? company.getFullName() : null;
|
||||
coveredLiabilitiesRegister.setCompanyFullName(companyFullName);
|
||||
coveredLiabilitiesRegister.setSessionId(registry.getSessionId());
|
||||
coveredLiabilitiesRegister.setSecuritySymbol(securitySymbol);
|
||||
coveredLiabilitiesRegister.setSecuritySymbol(registry.getSecuritySymbol());
|
||||
coveredLiabilitiesRegister.setSecurityFullName(securityFullName);
|
||||
coveredLiabilitiesRegister.setCompanyId(registry.getCompanyId());
|
||||
coveredLiabilitiesRegister.setClearingCode(registry.getClearingCode());
|
||||
|
|
@ -114,22 +114,25 @@ public class CoveredLiabilitiesRegisterService extends QueueConsumer implements
|
|||
return String.format("registryDesignation = '%s' and " +
|
||||
"registryInstrumentType in ('%s','%s') and " +
|
||||
"registryUnit = '%s' and " +
|
||||
"registryStatus = '%s'",
|
||||
"registryStatus in ('%s', '%s')",
|
||||
RegistryDesignation.O.getKey(),
|
||||
RegistryInstrumentType.S.getKey(),
|
||||
RegistryInstrumentType.M.getKey(),
|
||||
RegistryUnit.T.getKey(),
|
||||
RegistryStatus.OK.getKey());
|
||||
RegistryStatus.OK.getKey(),
|
||||
RegistryStatus.CLRD.getKey()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<CoveredLiabilitiesRegister> isDuplicateInMap(Registry entity) {
|
||||
Map<String, ? extends Comparable<?>> fieldValues = Map.of("companyId", entity.getCompanyId(), "sessionId", entity.getSessionId());
|
||||
Optional<EnumMessage> message = fieldValuesValidator.apply(fieldValues).tillFirstError();
|
||||
if (message.isPresent()) {
|
||||
log.warn("Illegal value in map for request to imdg: {}", message.get());
|
||||
throw new IllegalArgumentException(MessageFormat.format("Illegal value in request to imdg: {0}", message.get()));
|
||||
}
|
||||
return Optional.ofNullable(coveredLiabilitiesRegisterMap.getFirstObjectByFieldValues(fieldValues));
|
||||
return Optional.empty();
|
||||
// Map<String, ? extends Comparable<?>> fieldValues = Map.of("companyId", entity.getCompanyId(), "sessionId", entity.getSessionId());
|
||||
// Optional<EnumMessage> message = fieldValuesValidator.apply(fieldValues).tillFirstError();
|
||||
// if (message.isPresent()) {
|
||||
// log.warn("Illegal value in map for request to imdg: {}", message.get());
|
||||
// throw new IllegalArgumentException(MessageFormat.format("Illegal value in request to imdg: {0}", message.get()));
|
||||
// }
|
||||
// return Optional.ofNullable(coveredLiabilitiesRegisterMap.getFirstObjectByFieldValues(fieldValues));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,10 +60,6 @@ public class DepoBalanceRegisterService extends QueueConsumer implements Initial
|
|||
|
||||
public void depoBalanceRegisterNew(BaseRequest<LauncherCommandRequest> userRequest) {
|
||||
log.debug("LauncherCommandRequest received from {}", createRegistry_GRRT.topic());
|
||||
if (userRequest.getRequestPayload().getCompanyId() == null) {
|
||||
log.debug("No companyId in LauncherCommandRequest.id={}", userRequest.getId());
|
||||
return;
|
||||
}
|
||||
ImdgPredicate prdctForRegistries = getPredicateForRegistries(userRequest.getRequestPayload().getCompanyId());
|
||||
Collection<Registry> registries = registryMap.getCollectionObjectsByPredicate(prdctForRegistries);
|
||||
log.trace("Started searching depoBalanceRegister in register by '{}'", prdctForRegistries);
|
||||
|
|
@ -84,14 +80,12 @@ public class DepoBalanceRegisterService extends QueueConsumer implements Initial
|
|||
log.trace("Started generating DepoBalanceRegister entity...");
|
||||
DepoBalanceRegister depoBalanceRegister = new DepoBalanceRegister();
|
||||
depoBalanceRegister.setUpdated(Instant.now());
|
||||
depoBalanceRegister.setCreated(Instant.now());
|
||||
depoBalanceRegister.setCreated(depoBalanceRegister.getUpdated());
|
||||
depoBalanceRegister.setCompanyId(registry.getCompanyId());
|
||||
depoBalanceRegister.setSessionId(registry.getSessionId());
|
||||
depoBalanceRegister.setDepoCode(registry.getAccountType());
|
||||
depoBalanceRegister.setQuantity(registry.getCloseBalance());
|
||||
depoBalanceRegister.setSecuritySymbol(registry.getSecuritySymbol());
|
||||
depoBalanceRegister.setCreated(Instant.now());
|
||||
depoBalanceRegister.setUpdated(Instant.now());
|
||||
depoBalanceRegisterMap.insert(depoBalanceRegister);
|
||||
log.debug("inserted successfully DepoBalanceRegister entity with id: {}", depoBalanceRegister.getId());
|
||||
}
|
||||
|
|
@ -99,20 +93,24 @@ public class DepoBalanceRegisterService extends QueueConsumer implements Initial
|
|||
private ImdgPredicate getPredicateForRegistries(Long companyId) {
|
||||
ImdgPredicateBuilder pb = registryMap.predicateBuilder();
|
||||
RegistryCodeSqlBuilder codeSql = RegistryCodeSqlBuilder.getInstance(RegistryTradingParams.AS_T);
|
||||
return pb.and(
|
||||
pb.equals("companyId", companyId),
|
||||
pb.sql(codeSql.build())
|
||||
);
|
||||
if (companyId == null) // default use case
|
||||
return pb.sql(codeSql.build());
|
||||
else
|
||||
return pb.and(
|
||||
pb.equals("companyId", companyId),
|
||||
pb.sql(codeSql.build())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<DepoBalanceRegister> isDuplicateInMap(Registry entity) {
|
||||
Map<String, ? extends Comparable<?>> fieldValues = Map.of("companyId", entity.getCompanyId(), "sessionId", entity.getSessionId());
|
||||
Optional<EnumMessage> message = fieldValuesValidator.apply(fieldValues).tillFirstError();
|
||||
if (message.isPresent()) {
|
||||
log.warn("Illegal value in map for request to imdg: {}", message.get());
|
||||
throw new IllegalArgumentException(MessageFormat.format("Illegal value in request to imdg: {0}", message.get()));
|
||||
}
|
||||
return Optional.ofNullable(depoBalanceRegisterMap.getFirstObjectByFieldValues(fieldValues));
|
||||
return Optional.empty();
|
||||
// Map<String, ? extends Comparable<?>> fieldValues = Map.of("companyId", entity.getCompanyId(), "sessionId", entity.getSessionId());
|
||||
// Optional<EnumMessage> message = fieldValuesValidator.apply(fieldValues).tillFirstError();
|
||||
// if (message.isPresent()) {
|
||||
// log.warn("Illegal value in map for request to imdg: {}", message.get());
|
||||
// throw new IllegalArgumentException(MessageFormat.format("Illegal value in request to imdg: {0}", message.get()));
|
||||
// }
|
||||
// return Optional.ofNullable(depoBalanceRegisterMap.getFirstObjectByFieldValues(fieldValues));
|
||||
}
|
||||
}
|
||||
|
|
@ -89,34 +89,38 @@ public class DepoPaymentInstructionRegisterService extends QueueConsumer impleme
|
|||
private void insertDepoPaymentInstructionRegister(PaymentInstruction paymentInstruction) {
|
||||
log.trace("Started generating DepoPaymentInstructionRegister entity...");
|
||||
DepoPaymentInstructionRegister depoPaymentInstructionRegister = new DepoPaymentInstructionRegister();
|
||||
TradingClearingRegistry tradingClearingRegistry = tradingClearingRegistryMap.getFirstObjectByFieldValues(Map.of("depoAccountId", paymentInstruction.getCreditLeg_accountId()));
|
||||
TradingClearingRegistry tradingClearingRegistry = paymentInstruction.getSenderId() == null ? null : tradingClearingRegistryMap.getFirstObjectByFieldValues(Map.of("companyId", paymentInstruction.getSenderId()));
|
||||
InOutDirectionDictionary inOutDirectionDictionary = InOutDirectionDictionaryMap.getFirstObjectByFieldValues(Map.of("code", paymentInstruction.getCreditLeg_direction()));
|
||||
depoPaymentInstructionRegister.setCreated(Instant.now());
|
||||
depoPaymentInstructionRegister.setUpdated(Instant.now());
|
||||
depoPaymentInstructionRegister.setCompanyId(paymentInstruction.getSenderId());
|
||||
depoPaymentInstructionRegister.setTradingClearingRegistryType(tradingClearingRegistry.getTradingClearingRegistryType());
|
||||
depoPaymentInstructionRegister.setTradingClearingRegistry(tradingClearingRegistry.getCode());
|
||||
if (tradingClearingRegistry == null) {
|
||||
log.warn("For paymentInstruction[{}].CreditLeg_accountId={} can not find TradingClearingRegistry.",
|
||||
paymentInstruction.getId(), paymentInstruction.getCreditLeg_accountId());
|
||||
} else {
|
||||
depoPaymentInstructionRegister.setTradingClearingRegistryType(tradingClearingRegistry.getTradingClearingRegistryType());
|
||||
depoPaymentInstructionRegister.setTradingClearingRegistry(tradingClearingRegistry.getCode());
|
||||
}
|
||||
depoPaymentInstructionRegister.setCbCode("RNCB-BE-01");
|
||||
depoPaymentInstructionRegister.setQuantity(paymentInstruction.getCreditLeg_amount());
|
||||
depoPaymentInstructionRegister.setDirection(inOutDirectionDictionary.getId());
|
||||
depoPaymentInstructionRegister.setSessionId(paymentInstruction.getSessionId());
|
||||
depoPaymentInstructionRegister.setCreated(Instant.now());
|
||||
depoPaymentInstructionRegister.setUpdated(Instant.now());
|
||||
depoPaymentInstructionRegisterMap.insert(depoPaymentInstructionRegister);
|
||||
log.debug("inserted successfully DepoBalanceRegister entity with id: {}", depoPaymentInstructionRegister.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<DepoPaymentInstructionRegister> isDuplicateInMap(PaymentInstruction entity) {
|
||||
Map<String, ? extends Comparable<?>> fieldValues = Map.of(
|
||||
"companyId", entity.getSenderId(),
|
||||
"sessionId", entity.getSessionId()
|
||||
);
|
||||
Optional<EnumMessage> message = fieldValuesValidator.apply(fieldValues).tillFirstError();
|
||||
if (message.isPresent()) {
|
||||
log.warn("Illegal value in map for request to imdg: {}", message.get());
|
||||
throw new IllegalArgumentException(MessageFormat.format("Illegal value in request to imdg: {0}", message.get()));
|
||||
}
|
||||
return Optional.ofNullable(depoPaymentInstructionRegisterMap.getFirstObjectByFieldValues(fieldValues));
|
||||
return Optional.empty();
|
||||
// Map<String, ? extends Comparable<?>> fieldValues = Map.of(
|
||||
// "companyId", entity.getSenderId(),
|
||||
// "sessionId", entity.getSessionId()
|
||||
// );
|
||||
// Optional<EnumMessage> message = fieldValuesValidator.apply(fieldValues).tillFirstError();
|
||||
// if (message.isPresent()) {
|
||||
// log.warn("Illegal value in map for request to imdg: {}", message.get());
|
||||
// throw new IllegalArgumentException(MessageFormat.format("Illegal value in request to imdg: {0}", message.get()));
|
||||
// }
|
||||
// return Optional.ofNullable(depoPaymentInstructionRegisterMap.getFirstObjectByFieldValues(fieldValues));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,10 +7,12 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import ru.clearing.classes.statics.data.instrument.issue.FixedIncomeSecurity;
|
||||
import ru.clearing.classes.statics.data.misc.Session;
|
||||
import ru.clearing.classes.statics.data.register.ExcludeLiabilitiesRegister;
|
||||
import ru.clearing.classes.statics.data.registry.Registry;
|
||||
import ru.clearing.classes.statics.data.security.MoneyMarketSecurity;
|
||||
import ru.clearing.classes.statics.data.security.Security;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
|
||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||
|
|
@ -20,6 +22,7 @@ import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
|||
import ru.spcex.platform.enumeration.*;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.imdg.api.predicate.specific.SecuritySelector;
|
||||
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
||||
import ru.spcex.platform.utils.time.TimeUtil;
|
||||
import ru.spcex.platform.utils.validation.IValidator;
|
||||
|
|
@ -42,7 +45,7 @@ public class ExcludeLiabilitiesRegisterService extends QueueConsumer implements
|
|||
private final Imdg<Registry> registryMap;
|
||||
private final Imdg<Session> sessionMap;
|
||||
private final Imdg<ru.clearing.classes.statics.data.company.CompanySymbols> companySymbolMap;
|
||||
private final Imdg<MoneyMarketSecurity> moneyMarketSecurityMap;
|
||||
private final SecuritySelector<Security> securitySelector;
|
||||
private final Function<Map<String, ?>, IValidator> fieldValuesValidator;
|
||||
|
||||
@Autowired
|
||||
|
|
@ -55,7 +58,7 @@ public class ExcludeLiabilitiesRegisterService extends QueueConsumer implements
|
|||
this.registryMap = imdgProvider.getImdg(IMDGDistributedNames.Map_Registry, Registry.class);
|
||||
this.sessionMap = imdgProvider.getImdg(IMDGDistributedNames.Map_Session, Session.class);
|
||||
this.companySymbolMap = imdgProvider.getImdg(IMDGDistributedNames.Map_CompanySymbols, ru.clearing.classes.statics.data.company.CompanySymbols.class);
|
||||
this.moneyMarketSecurityMap = imdgProvider.getImdg(IMDGDistributedNames.Map_MoneyMarketSecurity, MoneyMarketSecurity.class);
|
||||
this.securitySelector = new SecuritySelector<>(imdgProvider, Security.class);
|
||||
this.fieldValuesValidator = fieldValuesValidator;
|
||||
}
|
||||
|
||||
|
|
@ -97,17 +100,30 @@ public class ExcludeLiabilitiesRegisterService extends QueueConsumer implements
|
|||
Map<String, ? extends Comparable<?>> innPredicates = Map.of("companySymbol", CompanySymbol.INN.getKey(),
|
||||
"companyId", registry.getCompanyId());
|
||||
ru.clearing.classes.statics.data.company.CompanySymbols companySymbol = companySymbolMap.getFirstObjectByFieldValues(innPredicates);
|
||||
MoneyMarketSecurity moneyMarketSecurity = moneyMarketSecurityMap.getFirstObjectByFieldValues(Map.of("securityId", registry.getSecurityId()));
|
||||
Security security = securitySelector.selectSecurityById(registry.getSecurityId());
|
||||
|
||||
excludeLiabilitiesRegister.setSessionId(registry.getSessionId());
|
||||
excludeLiabilitiesRegister.setValidFromDate(sessionBySessionId.getClearingDate());
|
||||
excludeLiabilitiesRegister.setValidToDate(validToDate);
|
||||
excludeLiabilitiesRegister.setCompanyId(registry.getCompanyId());
|
||||
excludeLiabilitiesRegister.setCompanyFullName(registry.getFullName());
|
||||
excludeLiabilitiesRegister.setInn(companySymbol.getCompanySymbolValue());
|
||||
excludeLiabilitiesRegister.setRegistryCode(registry.getRegistryCode());
|
||||
excludeLiabilitiesRegister.setAccount(registry.getAccount());
|
||||
excludeLiabilitiesRegister.setRegistryStatus(registry.getRegistryStatus());
|
||||
excludeLiabilitiesRegister.setCurrency(moneyMarketSecurity.getNominalCurrency());
|
||||
if (security == null) {
|
||||
log.warn("Security id={} not found for registry id={}", registry.getSecurityId(), registry.getId());
|
||||
} else {
|
||||
if (InstrumentType.RATE.equalsByKey(security.getInstrumentType())) {
|
||||
excludeLiabilitiesRegister.setCurrency(((MoneyMarketSecurity) security).getNominalCurrency());
|
||||
} else if (InstrumentType.BOND.equalsByKey(security.getInstrumentType())) {
|
||||
excludeLiabilitiesRegister.setCurrency(((FixedIncomeSecurity) security).getNominalCurrency());
|
||||
} else if (InstrumentType.EQTY.equalsByKey(security.getInstrumentType())) {
|
||||
// не заполняется Currency
|
||||
} else { // never
|
||||
log.warn("Unexpected security[{}] type {}", security.getId(), security.getInstrumentType());
|
||||
}
|
||||
}
|
||||
excludeLiabilitiesRegister.setSumLiabilities(registry.getBalance());
|
||||
excludeLiabilitiesRegister.setSettlementDate(registry.getSettlementDate());
|
||||
excludeLiabilitiesRegister.setCreated(Instant.now());
|
||||
|
|
@ -120,22 +136,25 @@ public class ExcludeLiabilitiesRegisterService extends QueueConsumer implements
|
|||
return String.format("registryDesignation = '%s' and " +
|
||||
"registryInstrumentType in ('%s','%s') and " +
|
||||
"registryUnit = '%s' and " +
|
||||
"registryStatus = '%s'",
|
||||
"registryStatus in ('%s', '%s')",
|
||||
RegistryDesignation.O.getKey(),
|
||||
RegistryInstrumentType.S.getKey(),
|
||||
RegistryInstrumentType.M.getKey(),
|
||||
RegistryUnit.T.getKey(),
|
||||
RegistryStatus.FAIL.getKey());
|
||||
RegistryStatus.FAIL.getKey(),
|
||||
RegistryStatus.UNCV.getKey()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<ExcludeLiabilitiesRegister> isDuplicateInMap(Registry entity) {
|
||||
Map<String, ? extends Comparable<?>> fieldValues = Map.of("companyId", entity.getCompanyId(), "sessionId", entity.getSessionId());
|
||||
Optional<EnumMessage> message = fieldValuesValidator.apply(fieldValues).tillFirstError();
|
||||
if (message.isPresent()) {
|
||||
log.warn("Illegal value in map for request to imdg: {}", message.get());
|
||||
throw new IllegalArgumentException(MessageFormat.format("Illegal value in request to imdg: {0}", message.get()));
|
||||
}
|
||||
return Optional.ofNullable(excludeLiabilitiesRegisterMap.getFirstObjectByFieldValues(fieldValues));
|
||||
return Optional.empty();
|
||||
// Map<String, ? extends Comparable<?>> fieldValues = Map.of("companyId", entity.getCompanyId(), "sessionId", entity.getSessionId());
|
||||
// Optional<EnumMessage> message = fieldValuesValidator.apply(fieldValues).tillFirstError();
|
||||
// if (message.isPresent()) {
|
||||
// log.warn("Illegal value in map for request to imdg: {}", message.get());
|
||||
// throw new IllegalArgumentException(MessageFormat.format("Illegal value in request to imdg: {0}", message.get()));
|
||||
// }
|
||||
// return Optional.ofNullable(excludeLiabilitiesRegisterMap.getFirstObjectByFieldValues(fieldValues));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -283,14 +283,15 @@ public class ExecutionRegisterService extends QueueConsumer implements Initializ
|
|||
|
||||
@Override
|
||||
public Optional<ExecutionRegister> isDuplicateInMap(ExecutionCommon entity) {
|
||||
Map<String, ? extends Comparable<?>> map = Map.of("exchangeExecutionId", entity.getExchangeExecutionId(),
|
||||
"tradingDate", LocalDate.now()); //clarify timezone
|
||||
Optional<EnumMessage> message = fieldValuesValidator.apply(map).tillFirstError();
|
||||
if (message.isPresent()) {
|
||||
log.warn("Illegal value in map for request to imdg: {}", message.get());
|
||||
throw new IllegalArgumentException(MessageFormat.format("Illegal value in request to imdg: {0}", message.get()));
|
||||
}
|
||||
return Optional.ofNullable(executionRegisterMap.getSingleObjectByFieldValues(map));
|
||||
return Optional.empty();
|
||||
// Map<String, ? extends Comparable<?>> map = Map.of("exchangeExecutionId", entity.getExchangeExecutionId(),
|
||||
// "tradingDate", LocalDate.now()); //clarify timezone
|
||||
// Optional<EnumMessage> message = fieldValuesValidator.apply(map).tillFirstError();
|
||||
// if (message.isPresent()) {
|
||||
// log.warn("Illegal value in map for request to imdg: {}", message.get());
|
||||
// throw new IllegalArgumentException(MessageFormat.format("Illegal value in request to imdg: {0}", message.get()));
|
||||
// }
|
||||
// return Optional.ofNullable(executionRegisterMap.getSingleObjectByFieldValues(map));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -150,12 +150,13 @@ public class LiabilitiesRegisterService extends QueueConsumer implements Initial
|
|||
|
||||
@Override
|
||||
public Optional<LiabilitiesRegister> isDuplicateInMap(Registry entity) {
|
||||
Map<String, ? extends Comparable<?>> fieldValues = Map.of("companyId", entity.getCompanyId(), "sessionId", entity.getSessionId());
|
||||
Optional<EnumMessage> message = fieldValuesValidator.apply(fieldValues).tillFirstError();
|
||||
if (message.isPresent()) {
|
||||
log.warn("Illegal value in map for request to imdg: {}", message.get());
|
||||
throw new IllegalArgumentException(MessageFormat.format("Illegal value in request to imdg: {0}", message.get()));
|
||||
}
|
||||
return Optional.ofNullable(liabilitiesRegisterMap.getFirstObjectByFieldValues(fieldValues));
|
||||
return Optional.empty();
|
||||
// Map<String, ? extends Comparable<?>> fieldValues = Map.of("companyId", entity.getCompanyId(), "sessionId", entity.getSessionId());
|
||||
// Optional<EnumMessage> message = fieldValuesValidator.apply(fieldValues).tillFirstError();
|
||||
// if (message.isPresent()) {
|
||||
// log.warn("Illegal value in map for request to imdg: {}", message.get());
|
||||
// throw new IllegalArgumentException(MessageFormat.format("Illegal value in request to imdg: {0}", message.get()));
|
||||
// }
|
||||
// return Optional.ofNullable(liabilitiesRegisterMap.getFirstObjectByFieldValues(fieldValues));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import ru.spcex.platform.utils.validation.IValidator;
|
|||
import java.text.MessageFormat;
|
||||
import java.time.Instant;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
|
@ -69,10 +70,6 @@ public class MoneyBalanceRegisterService extends QueueConsumer implements Initia
|
|||
|
||||
public void moneyBalanceRegisterNew(BaseRequest<LauncherCommandRequest> userRequest) {
|
||||
log.debug("LauncherCommandRequest received from {}", createRegistry_GBRR.topic());
|
||||
if (userRequest.getRequestPayload().getCompanyId() == null) {
|
||||
log.warn("LauncherCommandRequest.id={} without companyId", userRequest.getId());
|
||||
return;
|
||||
}
|
||||
ImdgPredicate sqlConditionForRegistry = getSqlForRegistries(userRequest.getRequestPayload().getCompanyId());
|
||||
Collection<Registry> registries = registryMap.getCollectionObjectsByPredicate(sqlConditionForRegistry);
|
||||
if (registries == null) {
|
||||
|
|
@ -128,10 +125,15 @@ public class MoneyBalanceRegisterService extends QueueConsumer implements Initia
|
|||
|
||||
private ImdgPredicate getSqlForRegistries(Long companyId) {
|
||||
ImdgPredicateBuilder pb = registryMap.predicateBuilder();
|
||||
ImdgPredicate prdct = pb.and(
|
||||
pb.equals("companyId", companyId),
|
||||
pb.sql(RegistryCodeSqlBuilder.getInstance(RegistryTradingParams.AM__).build())
|
||||
);
|
||||
ImdgPredicate prdct;
|
||||
if (companyId == null) {
|
||||
prdct = pb.sql(RegistryCodeSqlBuilder.getInstance(RegistryTradingParams.AM__).build());
|
||||
} else {
|
||||
prdct = pb.and(
|
||||
pb.equals("companyId", companyId),
|
||||
pb.sql(RegistryCodeSqlBuilder.getInstance(RegistryTradingParams.AM__).build())
|
||||
);
|
||||
}
|
||||
log.trace("sql predicate for registries {}", prdct);
|
||||
return prdct;
|
||||
}
|
||||
|
|
@ -171,17 +173,15 @@ public class MoneyBalanceRegisterService extends QueueConsumer implements Initia
|
|||
|
||||
@Override
|
||||
public Optional<MoneyBalanceRegister> isDuplicateInMap(Registry entity) {
|
||||
Map<String, ? extends Comparable<?>> fieldValues = Map.of(
|
||||
"companyId",
|
||||
entity.getCompanyId(),
|
||||
"sessionId",
|
||||
entity.getSessionId()
|
||||
);
|
||||
Optional<EnumMessage> message = fieldValuesValidator.apply(fieldValues).tillFirstError();
|
||||
if (message.isPresent()) {
|
||||
log.warn("Illegal value in map for request to imdg: {}", message.get());
|
||||
throw new IllegalArgumentException(MessageFormat.format("Illegal value in request to imdg: {0}", message.get()));
|
||||
}
|
||||
return Optional.ofNullable(moneyBalanceRegisterMap.getFirstObjectByFieldValues(fieldValues));
|
||||
return Optional.empty();
|
||||
// Map<String, Long> fieldValues = new HashMap<>();
|
||||
// fieldValues.put("companyId", entity.getCompanyId());
|
||||
// fieldValues.put("sessionId", entity.getSessionId());
|
||||
// Optional<EnumMessage> message = fieldValuesValidator.apply(fieldValues).tillFirstError();
|
||||
// if (message.isPresent()) {
|
||||
// log.warn("Illegal value in map for request to imdg: {}", message.get());
|
||||
// throw new IllegalArgumentException(MessageFormat.format("Illegal value in request to imdg: {0}", message.get()));
|
||||
// }
|
||||
// return Optional.ofNullable(moneyBalanceRegisterMap.getFirstObjectByFieldValues(fieldValues));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,12 +92,13 @@ public class MoneyPaymentInstructionRegisterService extends QueueConsumer implem
|
|||
|
||||
@Override
|
||||
public Optional<MoneyPaymentInstructionRegister> isDuplicateInMap(PaymentInstruction entity) {
|
||||
Map<String, ? extends Comparable<?>> fieldValuesCompanyIdSessionId = Map.of("senderId", entity.getSenderId(), "date", entity.getClearingDate());
|
||||
Optional<EnumMessage> message = fieldValuesValidator.apply(fieldValuesCompanyIdSessionId).tillFirstError();
|
||||
if (message.isPresent()) {
|
||||
log.warn("Illegal value in map for request to imdg: {}", message.get());
|
||||
throw new IllegalArgumentException(MessageFormat.format("Illegal value in request to imdg: {0}", message.get()));
|
||||
}
|
||||
return Optional.ofNullable(moneyPaymentInstructionRegisterMap.getFirstObjectByFieldValues(fieldValuesCompanyIdSessionId));
|
||||
return Optional.empty();
|
||||
// Map<String, ? extends Comparable<?>> fieldValuesCompanyIdSessionId = Map.of("senderId", entity.getSenderId(), "date", entity.getClearingDate());
|
||||
// Optional<EnumMessage> message = fieldValuesValidator.apply(fieldValuesCompanyIdSessionId).tillFirstError();
|
||||
// if (message.isPresent()) {
|
||||
// log.warn("Illegal value in map for request to imdg: {}", message.get());
|
||||
// throw new IllegalArgumentException(MessageFormat.format("Illegal value in request to imdg: {0}", message.get()));
|
||||
// }
|
||||
// return Optional.ofNullable(moneyPaymentInstructionRegisterMap.getFirstObjectByFieldValues(fieldValuesCompanyIdSessionId));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,12 +62,13 @@ public class NotificationService extends QueueConsumer implements InitializingBe
|
|||
private void notificationUpdateRequest(BaseRequest<NotificationUpdateRequest> notificationUpdateRequestBaseRequest) {
|
||||
NotificationUpdateRequest request = notificationUpdateRequestBaseRequest.getRequestPayload();
|
||||
Long id = request == null ? null : request.getId();
|
||||
log.info("Starting notificationUpdateRequest {} processing by id: {} ...", notificationUpdateRequestBaseRequest.getId(), id);
|
||||
log.info("Starting notificationUpdateRequest {} processing by id: {} from user {}", notificationUpdateRequestBaseRequest.getId(), id, notificationUpdateRequestBaseRequest.getUserId());
|
||||
Notification notification = notificationMap.getSingleObjectByID(id);
|
||||
if (notification == null) {
|
||||
throw new NullPointerException("Notification by id:{" + id + "} is null!");
|
||||
}
|
||||
notification.setNotificationStatus(request.getNotificationStatus());
|
||||
notification.setSenderId(notificationUpdateRequestBaseRequest.getUserId());
|
||||
notification.setUpdated(Instant.now());
|
||||
notificationMap.update(notification);
|
||||
sendFeedbackString(notification);
|
||||
|
|
|
|||
|
|
@ -1,215 +0,0 @@
|
|||
package ru.spcex.clearing.platform.messaging.domain.cud.registry;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import ru.spcex.clearing.platform.messaging.domain.json.deserialize.InstantDateTimeDeserializer;
|
||||
import ru.spcex.clearing.platform.messaging.domain.json.deserialize.LocalDateDeserializer;
|
||||
import ru.spcex.clearing.platform.messaging.domain.json.serialize.InstantDateTimeSerializer;
|
||||
import ru.spcex.clearing.platform.messaging.domain.json.serialize.LocalDateSerializer;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Deprecated // Не используется. Возможно артефакт мёржа.
|
||||
public class ContractRegisterNewRequest {
|
||||
|
||||
@JsonProperty
|
||||
private String name;
|
||||
|
||||
@JsonProperty
|
||||
private String number;
|
||||
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
@JsonProperty
|
||||
private LocalDate issueDate;
|
||||
|
||||
@JsonProperty
|
||||
private String companyFullName;
|
||||
|
||||
@JsonProperty
|
||||
private Long companyId;
|
||||
|
||||
@JsonProperty
|
||||
private String documentType;
|
||||
|
||||
@JsonProperty
|
||||
private String issuePlace;
|
||||
|
||||
@JsonProperty
|
||||
private String issuer;
|
||||
|
||||
@JsonProperty
|
||||
private String issuerCode;
|
||||
|
||||
@JsonProperty
|
||||
private String place;
|
||||
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
@JsonProperty
|
||||
private LocalDate validFromDate;
|
||||
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
@JsonProperty
|
||||
private LocalDate validToDate;
|
||||
|
||||
@JsonSerialize(using = LocalDateSerializer.class)
|
||||
@JsonDeserialize(using = LocalDateDeserializer.class)
|
||||
@JsonProperty
|
||||
private LocalDate closeDate;
|
||||
|
||||
@JsonProperty
|
||||
private String comment;
|
||||
|
||||
@JsonProperty
|
||||
private Long id;
|
||||
|
||||
@JsonSerialize(using = InstantDateTimeSerializer.class)
|
||||
@JsonDeserialize(using = InstantDateTimeDeserializer.class)
|
||||
@JsonProperty
|
||||
private Instant createdAt;
|
||||
|
||||
@JsonSerialize(using = InstantDateTimeSerializer.class)
|
||||
@JsonDeserialize(using = InstantDateTimeDeserializer.class)
|
||||
@JsonProperty
|
||||
private Instant updatedAt;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public LocalDate getCloseDate() {
|
||||
return closeDate;
|
||||
}
|
||||
|
||||
public void setCloseDate(LocalDate closeDate) {
|
||||
this.closeDate = closeDate;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Instant getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Instant createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public Instant getUpdatedAt() {
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(Instant updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public String getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(String number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public LocalDate getIssueDate() {
|
||||
return issueDate;
|
||||
}
|
||||
|
||||
public void setIssueDate(LocalDate issueDate) {
|
||||
this.issueDate = issueDate;
|
||||
}
|
||||
|
||||
public String getCompanyFullName() {
|
||||
return companyFullName;
|
||||
}
|
||||
|
||||
public void setCompanyFullName(String companyFullName) {
|
||||
this.companyFullName = companyFullName;
|
||||
}
|
||||
|
||||
public Long getCompanyId() {
|
||||
return companyId;
|
||||
}
|
||||
|
||||
public void setCompanyId(Long companyId) {
|
||||
this.companyId = companyId;
|
||||
}
|
||||
|
||||
public String getDocumentType() {
|
||||
return documentType;
|
||||
}
|
||||
|
||||
public void setDocumentType(String documentType) {
|
||||
this.documentType = documentType;
|
||||
}
|
||||
|
||||
public String getIssuePlace() {
|
||||
return issuePlace;
|
||||
}
|
||||
|
||||
public void setIssuePlace(String issuePlace) {
|
||||
this.issuePlace = issuePlace;
|
||||
}
|
||||
|
||||
public String getIssuer() {
|
||||
return issuer;
|
||||
}
|
||||
|
||||
public void setIssuer(String issuer) {
|
||||
this.issuer = issuer;
|
||||
}
|
||||
|
||||
public String getIssuerCode() {
|
||||
return issuerCode;
|
||||
}
|
||||
|
||||
public void setIssuerCode(String issuerCode) {
|
||||
this.issuerCode = issuerCode;
|
||||
}
|
||||
|
||||
public String getPlace() {
|
||||
return place;
|
||||
}
|
||||
|
||||
public void setPlace(String place) {
|
||||
this.place = place;
|
||||
}
|
||||
|
||||
public LocalDate getValidFromDate() {
|
||||
return validFromDate;
|
||||
}
|
||||
|
||||
public void setValidFromDate(LocalDate validFromDate) {
|
||||
this.validFromDate = validFromDate;
|
||||
}
|
||||
|
||||
public LocalDate getValidToDate() {
|
||||
return validToDate;
|
||||
}
|
||||
|
||||
public void setValidToDate(LocalDate validToDate) {
|
||||
this.validToDate = validToDate;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue