revert last fixes
This commit is contained in:
parent
1d0f669c41
commit
d98b2ce176
1 changed files with 33 additions and 35 deletions
|
|
@ -127,6 +127,8 @@ 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;
|
||||||
|
|
@ -151,6 +153,9 @@ 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())) {
|
||||||
|
|
@ -163,6 +168,9 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
@ -196,22 +204,22 @@ public class KSRepCashNettoReportBuilder extends CSVReportBuilder<SessionIdParam
|
||||||
BigDecimal lmtBalance = BigDecimal.ZERO;
|
BigDecimal lmtBalance = BigDecimal.ZERO;
|
||||||
BigDecimal oblValue = BigDecimal.ZERO;
|
BigDecimal oblValue = BigDecimal.ZERO;
|
||||||
BigDecimal reqValue = BigDecimal.ZERO;
|
BigDecimal reqValue = BigDecimal.ZERO;
|
||||||
BigDecimal cmtCurrencyNetto = BigDecimal.ZERO;
|
|
||||||
BigDecimal lmtCurrencyNetto = BigDecimal.ZERO;
|
|
||||||
boolean withValue = false;
|
boolean withValue = false;
|
||||||
boolean withOblReqValue = false;
|
boolean withOblReqValue = false;
|
||||||
boolean withCurrencyNettoValue = false;
|
boolean forUnitSession = 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) {
|
||||||
|
|
@ -219,22 +227,14 @@ public class KSRepCashNettoReportBuilder extends CSVReportBuilder<SessionIdParam
|
||||||
Section section = IEnumKey.getEnumByKey(Section.class, cmtRegistry.getSection());
|
Section section = IEnumKey.getEnumByKey(Section.class, cmtRegistry.getSection());
|
||||||
if (sessionType == null || section == null) continue;
|
if (sessionType == null || section == null) continue;
|
||||||
if (section == Section.FOND || sessionTypeForValue.contains(sessionType)) {
|
if (section == Section.FOND || sessionTypeForValue.contains(sessionType)) {
|
||||||
if (ReportConst.DB_ZERO.compareTo(cmtRegistry.getBalance()) != 0) {
|
|
||||||
cmtBalance = cmtBalance.add(cmtRegistry.getBalance());
|
cmtBalance = cmtBalance.add(cmtRegistry.getBalance());
|
||||||
withValue = true;
|
if (sessionType == SessionType.UNIT && section == Section.CURR) forUnitSession = true;
|
||||||
}
|
else withValue = true;
|
||||||
}
|
}
|
||||||
if (section == Section.MKR || sessionTypeForOblReqValue.contains(sessionType)) {
|
if (section == Section.MKR || sessionTypeForOblReqValue.contains(sessionType)) {
|
||||||
if (ReportConst.DB_ZERO.compareTo(cmtRegistry.getBalance()) != 0) {
|
|
||||||
reqValue = reqValue.add(cmtRegistry.getBalance());
|
reqValue = reqValue.add(cmtRegistry.getBalance());
|
||||||
withOblReqValue = true;
|
if (sessionType == SessionType.UNIT && section == Section.CURR) forUnitSession = true;
|
||||||
}
|
else withOblReqValue = true;
|
||||||
}
|
|
||||||
if (section == Section.CURR || sessionType == SessionType.CURR) {
|
|
||||||
if (ReportConst.DB_ZERO.compareTo(cmtRegistry.getBalance()) != 0) {
|
|
||||||
cmtCurrencyNetto = cmtCurrencyNetto.add(cmtBalance);
|
|
||||||
withCurrencyNettoValue = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -245,20 +245,18 @@ public class KSRepCashNettoReportBuilder extends CSVReportBuilder<SessionIdParam
|
||||||
if (sessionType == null) continue;
|
if (sessionType == null) continue;
|
||||||
if (section == Section.FOND || sessionTypeForValue.contains(sessionType)) {
|
if (section == Section.FOND || sessionTypeForValue.contains(sessionType)) {
|
||||||
lmtBalance = lmtBalance.add(lmtRegistry.getBalance());
|
lmtBalance = lmtBalance.add(lmtRegistry.getBalance());
|
||||||
withValue = true;
|
if (sessionType == SessionType.UNIT && section == Section.CURR) forUnitSession = true;
|
||||||
|
else withValue = true;
|
||||||
}
|
}
|
||||||
if (section == Section.MKR || sessionTypeForOblReqValue.contains(sessionType)) {
|
if (section == Section.MKR || sessionTypeForOblReqValue.contains(sessionType)) {
|
||||||
oblValue = oblValue.add(lmtRegistry.getBalance());
|
oblValue = oblValue.add(lmtRegistry.getBalance());
|
||||||
withOblReqValue = true;
|
if (sessionType == SessionType.UNIT && section == Section.CURR) forUnitSession = true;
|
||||||
}
|
else withOblReqValue = true;
|
||||||
if (section == Section.CURR && sessionType == SessionType.UNIT) {
|
|
||||||
lmtCurrencyNetto = lmtCurrencyNetto.add(lmtCurrencyNetto);
|
|
||||||
withCurrencyNettoValue = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BigDecimal value = cmtBalance.subtract(lmtBalance);
|
BigDecimal value;
|
||||||
BigDecimal currencyNetto = cmtCurrencyNetto.subtract(lmtCurrencyNetto);
|
value = cmtBalance.subtract(lmtBalance);
|
||||||
ksRepCashNettoReport.setLotCurrency(registry.getSecuritySymbol());
|
ksRepCashNettoReport.setLotCurrency(registry.getSecuritySymbol());
|
||||||
if (withValue) {
|
if (withValue) {
|
||||||
KSRepCashNettoReport withoutValueClone = ksRepCashNettoReport.cloneWithoutValues();
|
KSRepCashNettoReport withoutValueClone = ksRepCashNettoReport.cloneWithoutValues();
|
||||||
|
|
@ -271,9 +269,9 @@ public class KSRepCashNettoReportBuilder extends CSVReportBuilder<SessionIdParam
|
||||||
withoutValueClone.setReqValue(reqValue);
|
withoutValueClone.setReqValue(reqValue);
|
||||||
rows.add(withoutValueClone);
|
rows.add(withoutValueClone);
|
||||||
}
|
}
|
||||||
if (withCurrencyNettoValue) {
|
if (forUnitSession) {
|
||||||
KSRepCashNettoReport withoutValueClone = ksRepCashNettoReport.cloneWithoutValues();
|
KSRepCashNettoReport withoutValueClone = ksRepCashNettoReport.cloneWithoutValues();
|
||||||
withoutValueClone.setCurrencyNetto(currencyNetto);
|
withoutValueClone.setCurrencyNetto(currencyNettoCmt.subtract(currencyNettoLmt));
|
||||||
withoutValueClone.setTrExecDate(LocalDate.now());
|
withoutValueClone.setTrExecDate(LocalDate.now());
|
||||||
rows.add(withoutValueClone);
|
rows.add(withoutValueClone);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue