This commit is contained in:
parent
90edd763f5
commit
dd842dadab
2 changed files with 19 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ import java.math.RoundingMode;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.time.Instant;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
@ -40,6 +41,7 @@ import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
||||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||||
import ru.spcex.platform.enumeration.CurrencyCode;
|
import ru.spcex.platform.enumeration.CurrencyCode;
|
||||||
import ru.spcex.platform.enumeration.ObjectType;
|
import ru.spcex.platform.enumeration.ObjectType;
|
||||||
|
import ru.spcex.platform.enumeration.OrderStatus;
|
||||||
import ru.spcex.platform.enumeration.OvernightType;
|
import ru.spcex.platform.enumeration.OvernightType;
|
||||||
import ru.spcex.platform.enumeration.Priority;
|
import ru.spcex.platform.enumeration.Priority;
|
||||||
import ru.spcex.platform.enumeration.Task;
|
import ru.spcex.platform.enumeration.Task;
|
||||||
|
|
@ -53,6 +55,7 @@ public class TaskListener extends QueueConsumer implements InitializingBean {
|
||||||
protected final Logger log = LoggerFactory.getLogger(getClass());
|
protected final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
private final ImdgQueryService imdgQueryService;
|
private final ImdgQueryService imdgQueryService;
|
||||||
private final Imdg<Registry> registryImdg;
|
private final Imdg<Registry> registryImdg;
|
||||||
|
private final Imdg<OrderCurrency> orderCurrencyImdg;
|
||||||
private final SwapOvernightOrderService swapOvernightOrderService;
|
private final SwapOvernightOrderService swapOvernightOrderService;
|
||||||
private final SpotOvernightOrderService spotOvernightOrderService;
|
private final SpotOvernightOrderService spotOvernightOrderService;
|
||||||
private final OrderCurrencyTriExportService orderCurrencyTriExportService;
|
private final OrderCurrencyTriExportService orderCurrencyTriExportService;
|
||||||
|
|
@ -74,6 +77,7 @@ public class TaskListener extends QueueConsumer implements InitializingBean {
|
||||||
super(kafkaQueue, kafkaProducer);
|
super(kafkaQueue, kafkaProducer);
|
||||||
this.imdgQueryService = imdgQueryService;
|
this.imdgQueryService = imdgQueryService;
|
||||||
this.registryImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Registry, Registry.class);
|
this.registryImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Registry, Registry.class);
|
||||||
|
this.orderCurrencyImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_OrderCurrency, OrderCurrency.class);
|
||||||
this.swapOvernightOrderService = swapOvernightOrderService;
|
this.swapOvernightOrderService = swapOvernightOrderService;
|
||||||
this.spotOvernightOrderService = spotOvernightOrderService;
|
this.spotOvernightOrderService = spotOvernightOrderService;
|
||||||
this.orderCurrencyTriExportService = orderCurrencyTriExportService;
|
this.orderCurrencyTriExportService = orderCurrencyTriExportService;
|
||||||
|
|
@ -96,6 +100,14 @@ public class TaskListener extends QueueConsumer implements InitializingBean {
|
||||||
private void createOrder(BaseRequest<LauncherCommandRequest> newReq) {
|
private void createOrder(BaseRequest<LauncherCommandRequest> newReq) {
|
||||||
log.info("CROR createOrder started, request={}", newReq);
|
log.info("CROR createOrder started, request={}", newReq);
|
||||||
|
|
||||||
|
Collection<Long> cretOrderIds = imdgQueryService.getCretOrderCurrency();
|
||||||
|
for (Long cretOrderId : cretOrderIds) {
|
||||||
|
OrderCurrency orderCurrency = orderCurrencyImdg.getSingleObjectByID(cretOrderId);
|
||||||
|
orderCurrency.setStatus(OrderStatus.REJECTED.getKey());
|
||||||
|
orderCurrency.setUpdated(Instant.now());
|
||||||
|
orderCurrencyImdg.update(orderCurrency);
|
||||||
|
}
|
||||||
|
|
||||||
Collection<Long> registryIds = imdgQueryService.getCurrencyRegistry();
|
Collection<Long> registryIds = imdgQueryService.getCurrencyRegistry();
|
||||||
//todo очередность создания
|
//todo очередность создания
|
||||||
if (registryIds == null || registryIds.isEmpty()) {
|
if (registryIds == null || registryIds.isEmpty()) {
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,13 @@ public class ImdgQueryService {
|
||||||
return registryImdg.getCollectionIdsByPredicate(registryPredicate);
|
return registryImdg.getCollectionIdsByPredicate(registryPredicate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Collection<Long> getCretOrderCurrency() {
|
||||||
|
ImdgPredicateBuilder builder = orderCurrencyImdg.predicateBuilder();
|
||||||
|
return orderCurrencyImdg.getCollectionIdsByPredicate(
|
||||||
|
builder.equals("status", OrderStatus.CREATED.getKey())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public Collection<OrderCurrency> getClccOrderCurrencyIds() {
|
public Collection<OrderCurrency> getClccOrderCurrencyIds() {
|
||||||
ImdgPredicateBuilder builder = orderCurrencyImdg.predicateBuilder();
|
ImdgPredicateBuilder builder = orderCurrencyImdg.predicateBuilder();
|
||||||
CompanyRoleSet companyRoleSet = companyRoleSetImdg.getFirstObjectByPredicate(
|
CompanyRoleSet companyRoleSet = companyRoleSetImdg.getFirstObjectByPredicate(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue