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.SessionIdParam;
|
||||
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.RegistryDesignation;
|
||||
import ru.spcex.platform.enumeration.RegistryTradingParams;
|
||||
|
|
@ -127,8 +126,6 @@ public class KSRepCashNettoReportBuilder extends CSVReportBuilder<SessionIdParam
|
|||
}
|
||||
|
||||
boolean invalid = false;
|
||||
BigDecimal currencyNettoCmt = BigDecimal.ZERO;
|
||||
BigDecimal currencyNettoLmt = BigDecimal.ZERO;
|
||||
if (!cmtRegistries.isEmpty() || !lmtRegistries.isEmpty()) {
|
||||
String sourceTradingCode = 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");
|
||||
break;
|
||||
}
|
||||
if (currRegistry.getBalance().compareTo(ReportConst.DB_ZERO) != 0) {
|
||||
currencyNettoCmt = currencyNettoCmt.add(currRegistry.getBalance());
|
||||
}
|
||||
}
|
||||
for (Registry currRegistry : lmtRegistries) {
|
||||
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");
|
||||
break;
|
||||
}
|
||||
if (currRegistry.getBalance().compareTo(ReportConst.DB_ZERO) != 0) {
|
||||
currencyNettoLmt = currencyNettoLmt.add(currRegistry.getBalance());
|
||||
}
|
||||
}
|
||||
if (invalid) continue;
|
||||
}
|
||||
|
|
@ -200,41 +191,42 @@ public class KSRepCashNettoReportBuilder extends CSVReportBuilder<SessionIdParam
|
|||
ksRepCashNettoReport.setTkr(registry.getTradingClearingRegistry());
|
||||
ksRepCashNettoReport.setDate(nowDate);
|
||||
|
||||
BigDecimal cmtCurrencyNetto = BigDecimal.ZERO;
|
||||
BigDecimal lmtCurrencyNetto = BigDecimal.ZERO;
|
||||
BigDecimal cmtBalance = BigDecimal.ZERO;
|
||||
BigDecimal lmtBalance = BigDecimal.ZERO;
|
||||
BigDecimal oblValue = BigDecimal.ZERO;
|
||||
BigDecimal reqValue = BigDecimal.ZERO;
|
||||
boolean withValue = false;
|
||||
boolean withOblReqValue = false;
|
||||
boolean forUnitSession = false;
|
||||
boolean withCurrencyNetto = false;
|
||||
Set<SessionType> sessionTypeForValue = Set.of(
|
||||
SessionType.IPOT,
|
||||
SessionType.TRDT,
|
||||
SessionType.LIQU,
|
||||
SessionType.IPOB,
|
||||
SessionType.IPO0,
|
||||
SessionType.UNIT
|
||||
SessionType.IPO0
|
||||
);
|
||||
Set<SessionType> sessionTypeForOblReqValue = Set.of(
|
||||
SessionType.FINL,
|
||||
SessionType.MEDM,
|
||||
SessionType.XDEP,
|
||||
SessionType.UNIT
|
||||
SessionType.XDEP
|
||||
);
|
||||
for (Registry cmtRegistry : cmtRegistries) {
|
||||
if (cmtRegistry.getBalance() != null) {
|
||||
SessionType sessionType = IEnumKey.getEnumByKey(SessionType.class, cmtRegistry.getSessionType());
|
||||
Section section = IEnumKey.getEnumByKey(Section.class, cmtRegistry.getSection());
|
||||
if (sessionType == null || section == null) continue;
|
||||
if (sessionTypeForValue.contains(sessionType)) {
|
||||
if (section == Section.FOND || sessionTypeForValue.contains(sessionType)) {
|
||||
cmtBalance = cmtBalance.add(cmtRegistry.getBalance());
|
||||
if (sessionType == SessionType.UNIT && section == Section.CURR) forUnitSession = true;
|
||||
else withValue = true;
|
||||
withValue = true;
|
||||
}
|
||||
if (sessionTypeForOblReqValue.contains(sessionType)) {
|
||||
if (section == Section.MKR || sessionTypeForOblReqValue.contains(sessionType)) {
|
||||
reqValue = reqValue.add(cmtRegistry.getBalance());
|
||||
if (sessionType == SessionType.UNIT && section == Section.CURR) forUnitSession = true;
|
||||
else withOblReqValue = true;
|
||||
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) {
|
||||
SessionType sessionType = IEnumKey.getEnumByKey(SessionType.class, lmtRegistry.getSessionType());
|
||||
Section section = IEnumKey.getEnumByKey(Section.class, lmtRegistry.getSection());
|
||||
if (sessionType == null) continue;
|
||||
if (sessionTypeForValue.contains(sessionType)) {
|
||||
if (section == Section.FOND || sessionTypeForValue.contains(sessionType)) {
|
||||
lmtBalance = lmtBalance.add(lmtRegistry.getBalance());
|
||||
if (section == Section.CURR) forUnitSession = true;
|
||||
else withValue = true;
|
||||
withValue = true;
|
||||
}
|
||||
if (sessionTypeForOblReqValue.contains(sessionType)) {
|
||||
if (section == Section.MKR || sessionTypeForOblReqValue.contains(sessionType)) {
|
||||
oblValue = oblValue.add(lmtRegistry.getBalance());
|
||||
if (section == Section.CURR) forUnitSession = true;
|
||||
else withOblReqValue = true;
|
||||
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);
|
||||
rows.add(withoutValueClone);
|
||||
}
|
||||
if (forUnitSession) {
|
||||
if (withCurrencyNetto) {
|
||||
KSRepCashNettoReport withoutValueClone = ksRepCashNettoReport.cloneWithoutValues();
|
||||
withoutValueClone.setCurrencyNetto(currencyNettoCmt.subtract(currencyNettoLmt));
|
||||
withoutValueClone.setCurrencyNetto(cmtCurrencyNetto.subtract(lmtCurrencyNetto));
|
||||
withoutValueClone.setTrExecDate(LocalDate.now());
|
||||
rows.add(withoutValueClone);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue