report-service fixes
This commit is contained in:
parent
ca3e353e86
commit
b240af4fd1
1 changed files with 23 additions and 30 deletions
|
|
@ -21,7 +21,6 @@ import ru.spcex.clearing.reports.builders.CSVReportBuilder;
|
||||||
import ru.spcex.clearing.reports.builders.PairRegistryId;
|
import ru.spcex.clearing.reports.builders.PairRegistryId;
|
||||||
import ru.spcex.clearing.reports.builders.SessionIdParam;
|
import ru.spcex.clearing.reports.builders.SessionIdParam;
|
||||||
import ru.spcex.clearing.reports.builders.bean.KSRepCashNettoReport;
|
import ru.spcex.clearing.reports.builders.bean.KSRepCashNettoReport;
|
||||||
import ru.spcex.clearing.reports.config.ReportConst;
|
|
||||||
import ru.spcex.platform.enumeration.AccountType;
|
import ru.spcex.platform.enumeration.AccountType;
|
||||||
import ru.spcex.platform.enumeration.RegistryDesignation;
|
import ru.spcex.platform.enumeration.RegistryDesignation;
|
||||||
import ru.spcex.platform.enumeration.RegistryTradingParams;
|
import ru.spcex.platform.enumeration.RegistryTradingParams;
|
||||||
|
|
@ -127,8 +126,6 @@ public class KSRepCashNettoReportBuilder extends CSVReportBuilder<SessionIdParam
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean invalid = false;
|
boolean invalid = false;
|
||||||
BigDecimal currencyNettoCmt = BigDecimal.ZERO;
|
|
||||||
BigDecimal currencyNettoLmt = BigDecimal.ZERO;
|
|
||||||
if (!cmtRegistries.isEmpty() || !lmtRegistries.isEmpty()) {
|
if (!cmtRegistries.isEmpty() || !lmtRegistries.isEmpty()) {
|
||||||
String sourceTradingCode = null;
|
String sourceTradingCode = null;
|
||||||
String sourceTkr = null;
|
String sourceTkr = null;
|
||||||
|
|
@ -153,9 +150,6 @@ public class KSRepCashNettoReportBuilder extends CSVReportBuilder<SessionIdParam
|
||||||
log.warn("Invalid CM_T registries set, tradingClearingRegistry not equals. Registries was skipped");
|
log.warn("Invalid CM_T registries set, tradingClearingRegistry not equals. Registries was skipped");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (currRegistry.getBalance().compareTo(ReportConst.DB_ZERO) != 0) {
|
|
||||||
currencyNettoCmt = currencyNettoCmt.add(currRegistry.getBalance());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
for (Registry currRegistry : lmtRegistries) {
|
for (Registry currRegistry : lmtRegistries) {
|
||||||
if (!Objects.equals(sourceTradingCode, currRegistry.getTradingCode())) {
|
if (!Objects.equals(sourceTradingCode, currRegistry.getTradingCode())) {
|
||||||
|
|
@ -168,9 +162,6 @@ public class KSRepCashNettoReportBuilder extends CSVReportBuilder<SessionIdParam
|
||||||
log.warn("Invalid CM_T registries set, tradingClearingRegistry not equals. Registries was skipped");
|
log.warn("Invalid CM_T registries set, tradingClearingRegistry not equals. Registries was skipped");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (currRegistry.getBalance().compareTo(ReportConst.DB_ZERO) != 0) {
|
|
||||||
currencyNettoLmt = currencyNettoLmt.add(currRegistry.getBalance());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (invalid) continue;
|
if (invalid) continue;
|
||||||
}
|
}
|
||||||
|
|
@ -200,41 +191,42 @@ public class KSRepCashNettoReportBuilder extends CSVReportBuilder<SessionIdParam
|
||||||
ksRepCashNettoReport.setTkr(registry.getTradingClearingRegistry());
|
ksRepCashNettoReport.setTkr(registry.getTradingClearingRegistry());
|
||||||
ksRepCashNettoReport.setDate(nowDate);
|
ksRepCashNettoReport.setDate(nowDate);
|
||||||
|
|
||||||
|
BigDecimal cmtCurrencyNetto = BigDecimal.ZERO;
|
||||||
|
BigDecimal lmtCurrencyNetto = BigDecimal.ZERO;
|
||||||
BigDecimal cmtBalance = BigDecimal.ZERO;
|
BigDecimal cmtBalance = BigDecimal.ZERO;
|
||||||
BigDecimal lmtBalance = BigDecimal.ZERO;
|
BigDecimal lmtBalance = BigDecimal.ZERO;
|
||||||
BigDecimal oblValue = BigDecimal.ZERO;
|
BigDecimal oblValue = BigDecimal.ZERO;
|
||||||
BigDecimal reqValue = BigDecimal.ZERO;
|
BigDecimal reqValue = BigDecimal.ZERO;
|
||||||
boolean withValue = false;
|
boolean withValue = false;
|
||||||
boolean withOblReqValue = false;
|
boolean withOblReqValue = false;
|
||||||
boolean forUnitSession = false;
|
boolean withCurrencyNetto = false;
|
||||||
Set<SessionType> sessionTypeForValue = Set.of(
|
Set<SessionType> sessionTypeForValue = Set.of(
|
||||||
SessionType.IPOT,
|
SessionType.IPOT,
|
||||||
SessionType.TRDT,
|
SessionType.TRDT,
|
||||||
SessionType.LIQU,
|
SessionType.LIQU,
|
||||||
SessionType.IPOB,
|
SessionType.IPOB,
|
||||||
SessionType.IPO0,
|
SessionType.IPO0
|
||||||
SessionType.UNIT
|
|
||||||
);
|
);
|
||||||
Set<SessionType> sessionTypeForOblReqValue = Set.of(
|
Set<SessionType> sessionTypeForOblReqValue = Set.of(
|
||||||
SessionType.FINL,
|
SessionType.FINL,
|
||||||
SessionType.MEDM,
|
SessionType.MEDM,
|
||||||
SessionType.XDEP,
|
SessionType.XDEP
|
||||||
SessionType.UNIT
|
|
||||||
);
|
);
|
||||||
for (Registry cmtRegistry : cmtRegistries) {
|
for (Registry cmtRegistry : cmtRegistries) {
|
||||||
if (cmtRegistry.getBalance() != null) {
|
if (cmtRegistry.getBalance() != null) {
|
||||||
SessionType sessionType = IEnumKey.getEnumByKey(SessionType.class, cmtRegistry.getSessionType());
|
SessionType sessionType = IEnumKey.getEnumByKey(SessionType.class, cmtRegistry.getSessionType());
|
||||||
Section section = IEnumKey.getEnumByKey(Section.class, cmtRegistry.getSection());
|
Section section = IEnumKey.getEnumByKey(Section.class, cmtRegistry.getSection());
|
||||||
if (sessionType == null || section == null) continue;
|
if (section == Section.FOND || sessionTypeForValue.contains(sessionType)) {
|
||||||
if (sessionTypeForValue.contains(sessionType)) {
|
|
||||||
cmtBalance = cmtBalance.add(cmtRegistry.getBalance());
|
cmtBalance = cmtBalance.add(cmtRegistry.getBalance());
|
||||||
if (sessionType == SessionType.UNIT && section == Section.CURR) forUnitSession = true;
|
withValue = true;
|
||||||
else withValue = true;
|
|
||||||
}
|
}
|
||||||
if (sessionTypeForOblReqValue.contains(sessionType)) {
|
if (section == Section.MKR || sessionTypeForOblReqValue.contains(sessionType)) {
|
||||||
reqValue = reqValue.add(cmtRegistry.getBalance());
|
reqValue = reqValue.add(cmtRegistry.getBalance());
|
||||||
if (sessionType == SessionType.UNIT && section == Section.CURR) forUnitSession = true;
|
withOblReqValue = true;
|
||||||
else withOblReqValue = true;
|
}
|
||||||
|
if (section == Section.CURR || sessionType == SessionType.CURR) {
|
||||||
|
cmtCurrencyNetto = cmtCurrencyNetto.add(cmtRegistry.getBalance());
|
||||||
|
withCurrencyNetto = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -242,16 +234,17 @@ public class KSRepCashNettoReportBuilder extends CSVReportBuilder<SessionIdParam
|
||||||
if (lmtRegistry.getBalance() != null) {
|
if (lmtRegistry.getBalance() != null) {
|
||||||
SessionType sessionType = IEnumKey.getEnumByKey(SessionType.class, lmtRegistry.getSessionType());
|
SessionType sessionType = IEnumKey.getEnumByKey(SessionType.class, lmtRegistry.getSessionType());
|
||||||
Section section = IEnumKey.getEnumByKey(Section.class, lmtRegistry.getSection());
|
Section section = IEnumKey.getEnumByKey(Section.class, lmtRegistry.getSection());
|
||||||
if (sessionType == null) continue;
|
if (section == Section.FOND || sessionTypeForValue.contains(sessionType)) {
|
||||||
if (sessionTypeForValue.contains(sessionType)) {
|
|
||||||
lmtBalance = lmtBalance.add(lmtRegistry.getBalance());
|
lmtBalance = lmtBalance.add(lmtRegistry.getBalance());
|
||||||
if (section == Section.CURR) forUnitSession = true;
|
withValue = true;
|
||||||
else withValue = true;
|
|
||||||
}
|
}
|
||||||
if (sessionTypeForOblReqValue.contains(sessionType)) {
|
if (section == Section.MKR || sessionTypeForOblReqValue.contains(sessionType)) {
|
||||||
oblValue = oblValue.add(lmtRegistry.getBalance());
|
oblValue = oblValue.add(lmtRegistry.getBalance());
|
||||||
if (section == Section.CURR) forUnitSession = true;
|
withOblReqValue = true;
|
||||||
else withOblReqValue = true;
|
}
|
||||||
|
if (section == Section.CURR || sessionType == SessionType.CURR) {
|
||||||
|
lmtCurrencyNetto = lmtCurrencyNetto.add(lmtRegistry.getBalance());
|
||||||
|
withCurrencyNetto = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -269,9 +262,9 @@ public class KSRepCashNettoReportBuilder extends CSVReportBuilder<SessionIdParam
|
||||||
withoutValueClone.setReqValue(reqValue);
|
withoutValueClone.setReqValue(reqValue);
|
||||||
rows.add(withoutValueClone);
|
rows.add(withoutValueClone);
|
||||||
}
|
}
|
||||||
if (forUnitSession) {
|
if (withCurrencyNetto) {
|
||||||
KSRepCashNettoReport withoutValueClone = ksRepCashNettoReport.cloneWithoutValues();
|
KSRepCashNettoReport withoutValueClone = ksRepCashNettoReport.cloneWithoutValues();
|
||||||
withoutValueClone.setCurrencyNetto(currencyNettoCmt.subtract(currencyNettoLmt));
|
withoutValueClone.setCurrencyNetto(cmtCurrencyNetto.subtract(lmtCurrencyNetto));
|
||||||
withoutValueClone.setTrExecDate(LocalDate.now());
|
withoutValueClone.setTrExecDate(LocalDate.now());
|
||||||
rows.add(withoutValueClone);
|
rows.add(withoutValueClone);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue