reports-service http://jira.mfd.msk:8088/browse/CLS-497 ksRepCashRegisterSums fix

This commit is contained in:
AKurakin 2023-09-22 13:54:20 +03:00
parent 2d7a1f452e
commit 0db32aac36
2 changed files with 17 additions and 16 deletions

View file

@ -78,23 +78,17 @@ public class KSRepCashRegisterSumsReportBuilder extends CSVReportBuilder<EmptyPa
pb.less("created", instantNow.plus(1, ChronoUnit.DAYS).truncatedTo(ChronoUnit.DAYS)),
pb.equals("inOutSDfType", InOutSDfType.type57.getKey()),
pb.equals("operationStatus", OperationStatus.Executed.getKey())
// ,pb.notNull("amount")
);
Collection<Statement> statements = statementImdg.getCollectionObjectsByPredicate(finalPredicate);
rows = new ArrayList<>(statements.size());
for (Statement statement : statements) {
if (statement.getAmount() == null) {
log.warn("Statement id={} has null amount, statement was skipped", statement.getId());
continue;
}
try {
// Company company = companyImdg.getSingleObjectByID(statement.getAddresseeId());
// if (company == null) {
// log.warn("For statement id = {} company with id = {} not found, statement was skipped",
// statement.getId(),
// statement.getAddresseeId());
// continue;
// }
// if (!WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus())) continue;
// Long accountId = statement.getAccountId();
boolean searchTCRAsInfo=false;
if (Arrays.asList(1L,2L).contains(statement.getAccountId())) {
boolean searchTCRAsInfo;
if (Arrays.asList(1L, 2L).contains(statement.getAccountId())) {
searchTCRAsInfo = true;
} else {
Account account = accountImdg.getSingleObjectByID(statement.getAccountId());
@ -110,7 +104,7 @@ public class KSRepCashRegisterSumsReportBuilder extends CSVReportBuilder<EmptyPa
if (i >= 0) {
code = code.substring(i + 3).trim();
}
if (i<0 || code.isBlank()) {
if (i < 0 || code.isBlank()) {
log.warn("For statement id = {} empty or unparseable code=\"{}\" (comment \"{}\"), statement was skipped",
code, statement.getComment(), statement.getId());
continue;
@ -145,7 +139,7 @@ public class KSRepCashRegisterSumsReportBuilder extends CSVReportBuilder<EmptyPa
Company company;
if (searchTCRAsInfo) {
company = companyImdg.getSingleObjectByID(tkr.getCompanyId());
company = companyImdg.getSingleObjectByID(tkr.getCompanyId());
if (company == null) {
log.warn("For statement id = {}, tcr.id={}, company with id = {} not found, statement was skipped",
statement.getId(),
@ -154,7 +148,7 @@ public class KSRepCashRegisterSumsReportBuilder extends CSVReportBuilder<EmptyPa
continue;
}
} else {
company = companyImdg.getSingleObjectByID(statement.getAddresseeId());
company = companyImdg.getSingleObjectByID(statement.getAddresseeId());
if (company == null) {
log.warn("For statement id = {}, company with id = {} not found, statement was skipped",
statement.getId(),
@ -206,7 +200,13 @@ public class KSRepCashRegisterSumsReportBuilder extends CSVReportBuilder<EmptyPa
KSRepCashRegisterSumsReport ksRepCashRegisterSumsReport = new KSRepCashRegisterSumsReport();
ksRepCashRegisterSumsReport.setFirmId(company.getTradingCode());
if (searchTCRAsInfo) {
ksRepCashRegisterSumsReport.setAccount(company.getTradingCode());
Account account = accountImdg.getSingleObjectByID(tkr.getMoneyAccountId());
if (account == null) {
log.debug("statement id={}, moneyAccount not found with id={}",
statement.getId(), tkr.getMoneyAccountId());
} else {
ksRepCashRegisterSumsReport.setAccount(account.getAccount());
}
} else {
ksRepCashRegisterSumsReport.setAccount(statement.getAccount());
}

View file

@ -82,6 +82,7 @@ public class KSRepCashRegistersReportBuilder extends CSVReportBuilder<EmptyParam
)
);
Collection<Registry> registries = registryImdg.getCollectionObjectsByPredicate(finalPredicate);
log.trace("Found {} Registry by query: {}", registries.size(), finalPredicate);
rows = new ArrayList<>(registries.size());
for (Registry registry : registries) {
try {