http://jira.mfd.msk:8088/browse/CLS-188 operation B/S BUY SELL
This commit is contained in:
parent
2d3808460e
commit
a9cc2752d0
1 changed files with 42 additions and 4 deletions
|
|
@ -26,6 +26,7 @@ import ru.spcex.clearing.platform.messaging.domain.cud.securitites.MoneyMarketSe
|
|||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||
import ru.spcex.platform.enumeration.Allowed;
|
||||
import ru.spcex.platform.enumeration.Market;
|
||||
import ru.spcex.platform.enumeration.MoneyFlowSide;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgId;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
|
|
@ -154,10 +155,40 @@ public class ExecutionDepositComponent {
|
|||
}
|
||||
|
||||
for (STrade trade : sTrades) {
|
||||
log.trace("Check s_trade[{}].tradeNum={} on date {}", trade.getId(), trade.getTradeNum(), today);
|
||||
boolean existsEDeposit = existTradeNumsOfExecutionDeposit.contains(trade.getTradeNum());
|
||||
log.trace("Check s_trade[{}].tradeNum={} operation={} on date {}", trade.getId(), trade.getTradeNum(), trade.getOperation(), today);
|
||||
boolean existEDeposit;
|
||||
{
|
||||
ImdgPredicateBuilder pb = executionDepositImdg.predicateBuilder();
|
||||
|
||||
if (!existsEDeposit) {
|
||||
ImdgPredicate predicateOperation = pb.equals("side", trade.getOperation());
|
||||
if ("B".equalsIgnoreCase(trade.getOperation())) {
|
||||
predicateOperation = pb.or(predicateOperation, pb.equals("side", MoneyFlowSide.BUY.getKey()));
|
||||
}
|
||||
// if ("BUY".equalsIgnoreCase(trade.getOperation())) {
|
||||
// predicateOperation = pb.or(predicateOperation, pb.equals("side", "B"));
|
||||
// }
|
||||
if ("S".equalsIgnoreCase(trade.getOperation())) {
|
||||
predicateOperation = pb.or(predicateOperation, pb.equals("side", MoneyFlowSide.SELL.getKey()));
|
||||
}
|
||||
// if ("SELL".equalsIgnoreCase(trade.getOperation())) {
|
||||
// predicateOperation = pb.or(predicateOperation, pb.equals("side", "S"));
|
||||
// }
|
||||
|
||||
ImdgPredicate predicate = pb.and(
|
||||
pb.equals("exchangeExecutionId", trade.getTradeNum()),
|
||||
pb.equals("clearingDate", today),
|
||||
predicateOperation
|
||||
);
|
||||
Collection<ExecutionDeposit> existsEDeposit = executionDepositImdg.getCollectionObjectsByPredicate(predicate);
|
||||
// Collection<ExecutionDeposit> existsEDeposit=executionDepositImdg.getCollectionObjectsByFieldValues(Map.of(
|
||||
// "exchangeExecutionId", trade.getTradeNum(),
|
||||
// "clearingDate", today
|
||||
// ));
|
||||
existEDeposit = !existsEDeposit.isEmpty();
|
||||
log.trace("Check exist, SQL \"{}\", found {}, exist {}", predicate, existsEDeposit.size(), existEDeposit);
|
||||
}
|
||||
|
||||
if (!existEDeposit) {
|
||||
log.trace("S_TRADE[{}] new", trade.getId());
|
||||
|
||||
// Проверка secCode
|
||||
|
|
@ -270,7 +301,14 @@ public class ExecutionDepositComponent {
|
|||
eDeposit.setFirstLegAmount(sTrade.getValue());
|
||||
eDeposit.setSecondLegAmount(sTrade.getValue());
|
||||
//eDeposit.setInterestAmount(null);
|
||||
eDeposit.setSide(sTrade.getOperation());//Символьный код по справочнику moneyFlowSide), соответствующий значению из s_trade.operation (sTrade.getOperation())
|
||||
String operation = sTrade.getOperation(); //Символьный код по справочнику moneyFlowSide), соответствующий значению из s_trade.operation (sTrade.getOperation())
|
||||
if ("B".equalsIgnoreCase(operation)) {
|
||||
operation = MoneyFlowSide.BUY.getKey();
|
||||
}
|
||||
if ("S".equalsIgnoreCase(operation)) {
|
||||
operation = MoneyFlowSide.SELL.getKey();
|
||||
}
|
||||
eDeposit.setSide(operation);
|
||||
eDeposit.setSettlementCurrency("RUB"); // (справочник currencyCode)
|
||||
eDeposit.setCompanyId(company.getId());
|
||||
eDeposit.setDuration(sTrade.getDaysToMatDate());
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue