clearing-service SDF_01 поправил сверку баланса для инфосчетов
This commit is contained in:
parent
317b24748c
commit
cd67d0b113
3 changed files with 14 additions and 7 deletions
|
|
@ -323,14 +323,17 @@ public class Sdf01Executor extends AbstractExecutor<SDf01> {
|
|||
|
||||
private void calcBalance(Registry rgs, Statement statement) {
|
||||
rgs.setCheckBalance(BigDecimalUtil.safeBD(statement.getAmount()));
|
||||
rgs.setDiffBalance(BigDecimalUtil.safeBD(rgs.getCheckBalance()).negate());
|
||||
if (!AccountType.Info.equalsByKey(rgs.getAccountType()))
|
||||
rgs.setDiffBalance(BigDecimalUtil.safeBD(rgs.getCheckBalance()).negate());
|
||||
}
|
||||
|
||||
private void updateReg(Statement s, Registry r) {
|
||||
r.setCheckBalance(s.getAmount());
|
||||
BigDecimal balance = BigDecimalUtil.safeBD(r.getBalance());
|
||||
BigDecimal checkBalance = BigDecimalUtil.safeBD(r.getCheckBalance());
|
||||
r.setDiffBalance(balance.subtract(checkBalance));
|
||||
if (!AccountType.Info.equalsByKey(r.getAccountType())) {
|
||||
BigDecimal balance = BigDecimalUtil.safeBD(r.getBalance());
|
||||
r.setDiffBalance(balance.subtract(checkBalance));
|
||||
}
|
||||
r.setUpdated(Instant.now());
|
||||
}
|
||||
|
||||
|
|
@ -340,11 +343,12 @@ public class Sdf01Executor extends AbstractExecutor<SDf01> {
|
|||
);
|
||||
String sql = RegistryCodeSqlBuilder.getInstance(p).build();
|
||||
ImdgPredicateBuilder pb = registryImdg.predicateBuilder();
|
||||
ImdgPredicate rgstrPredicate = pb.and(pb.sql(sql),
|
||||
ImdgPredicate rgstrPredicate = pb.and(
|
||||
pb.sql(sql),
|
||||
pb.equals("accountId", s.getAccountId()),
|
||||
pb.equals("companyId", s.getAddresseeId())
|
||||
);
|
||||
log.debug("Reg search query: {}", rgstrPredicate);
|
||||
return Optional.ofNullable(registryImdg.getSingleObjectByPredicate(rgstrPredicate));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -506,7 +506,6 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
|
|||
if (!AccountType.Info.equals(accType)) {
|
||||
rgs.setDiffBalance(safeBD(rgs.getBalance()).subtract(safeBD(rgs.getCheckBalance())));
|
||||
}
|
||||
rgs.setDiffBalance(safeBD(rgs.getBalance()).subtract(safeBD(rgs.getCheckBalance())));
|
||||
rgs.setBalanceDimension(BalanceDimension.MONY.getKey()); //fixme ! смотри описание и ссылка на начало html'ки
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import ru.clearing.classes.statics.data.sdf.SDf01;
|
|||
import ru.spcex.clearing.error.ClearingError;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.platform.enumeration.AccType;
|
||||
import ru.spcex.platform.enumeration.AccountType;
|
||||
import ru.spcex.platform.enumeration.CurrencyCode;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.validation.ImdgValidationContext;
|
||||
|
|
@ -51,8 +52,11 @@ public enum Sdf01NewValidationRule implements IValidationRule<ImdgValidationCont
|
|||
public Optional<EnumMessage> validate(ImdgValidationContext<SDf01> context) {
|
||||
SDf01 sdf01 = context.getValidatedObject();
|
||||
Imdg<Account> accountImdg = context.obtainMap(IMDGDistributedNames.Map_Account, Account.class);
|
||||
Account acc = accountImdg.getFirstObjectBySQL("account = '" + sdf01.getAccount()
|
||||
+ "' and accountType='" + ru.spcex.platform.enumeration.AccountType.Clrn.getKey() + "'");
|
||||
Account acc = accountImdg.getFirstObjectBySQL("account = '" + sdf01.getAccount() + "' and (" +
|
||||
"accountType='" + ru.spcex.platform.enumeration.AccountType.Clrn.getKey() + "' or "+
|
||||
"accountType='" + ru.spcex.platform.enumeration.AccountType.Tran.getKey() + "' or "+
|
||||
"accountType='" + ru.spcex.platform.enumeration.AccountType.Anlt.getKey() + "' )"
|
||||
);
|
||||
if (acc == null) {
|
||||
return of (ClearingError.AccountNotPresent, sdf01.getAccount());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue