This commit is contained in:
parent
34b0b4c097
commit
13cf973391
3 changed files with 26 additions and 6 deletions
|
|
@ -453,6 +453,7 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
|
||||||
Company cmp = stmtCmpAcc.company();
|
Company cmp = stmtCmpAcc.company();
|
||||||
Account acc = stmtCmpAcc.account();
|
Account acc = stmtCmpAcc.account();
|
||||||
Optional<AssetTrio> asts = createRegistryIfNeeded.apply(stmtCmpAcc);
|
Optional<AssetTrio> asts = createRegistryIfNeeded.apply(stmtCmpAcc);
|
||||||
|
InOutDirection direction = IEnumKey.getEnumByKey(InOutDirection.class, stmt.getInOutDirection());
|
||||||
if (accountIsAnlt(acc)) {
|
if (accountIsAnlt(acc)) {
|
||||||
AnltSearcher.AnltSearch searchResult = anltSearcher.loadByAnlt(stmt.getComment(), sdf57.getPay_val());
|
AnltSearcher.AnltSearch searchResult = anltSearcher.loadByAnlt(stmt.getComment(), sdf57.getPay_val());
|
||||||
if (searchResult.isFound()) {
|
if (searchResult.isFound()) {
|
||||||
|
|
@ -505,11 +506,8 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
|
||||||
});
|
});
|
||||||
//DMAU подразумевает увеличение остатка поля balance и credit registry.code=DMAU
|
//DMAU подразумевает увеличение остатка поля balance и credit registry.code=DMAU
|
||||||
String genTime = formatInstant(sdf57.getGenerationTime(), readableDateTime);
|
String genTime = formatInstant(sdf57.getGenerationTime(), readableDateTime);
|
||||||
notification.sendNotification(ObjectType.rgst,
|
String ntfMsg = dmauNotificationText(direction, genTime, sdf57);
|
||||||
("Зачисление средств на регистр невыясненных денежных средств. "
|
notification.sendNotification(ObjectType.rgst, ntfMsg, Priority.HIGH);
|
||||||
+ "Дата и время поступления: %s. "
|
|
||||||
+ "ID платежного поручения: %d").formatted(genTime, sdf57.getDbfId()),
|
|
||||||
Priority.HIGH);
|
|
||||||
}
|
}
|
||||||
} else if (OperationStatus.Executed.equalsByKey(stmt.getOperationStatus())) {
|
} else if (OperationStatus.Executed.equalsByKey(stmt.getOperationStatus())) {
|
||||||
if (asts.isPresent()) {
|
if (asts.isPresent()) {
|
||||||
|
|
@ -555,6 +553,25 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String dmauNotificationText(InOutDirection direction, String genTime, SDf57 sdf57) {
|
||||||
|
if (direction == null) return "notification error: unknown direction null";
|
||||||
|
switch (direction) {
|
||||||
|
case in -> {
|
||||||
|
return ("Зачисление средств на регистр невыясненных денежных средств. "
|
||||||
|
+ "Дата и время поступления: %s. "
|
||||||
|
+ "ID платежного поручения: %d").formatted(genTime, sdf57.getDbfId());
|
||||||
|
}
|
||||||
|
case out -> {
|
||||||
|
return ("Списание средств с регистра невыясненных денежных средств %s. " +
|
||||||
|
"Дата и время списания: %s. " +
|
||||||
|
"Объем списания: %s").formatted(
|
||||||
|
sdf57.getAcc_deb(), genTime, sdf57.getSum_deb()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
default -> {return "notification error: unknown direction " + direction;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean accountIsAnlt(Account account) {
|
private boolean accountIsAnlt(Account account) {
|
||||||
if (account == null) return false;
|
if (account == null) return false;
|
||||||
boolean anlt = AccountType.Anlt.getKey().equals(account.getAccountType());
|
boolean anlt = AccountType.Anlt.getKey().equals(account.getAccountType());
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ public class WithdrawalFundsService {
|
||||||
sdf54Imdg.insert(sDf54);
|
sdf54Imdg.insert(sDf54);
|
||||||
log.info("created sdf54.id={}", sDf54.getId());
|
log.info("created sdf54.id={}", sDf54.getId());
|
||||||
|
|
||||||
Registry d__i = dmiService.createDmi(payload.getAmount(), assets.a__t());
|
Registry d__i = dmiService.createDmi(payload.getAmount().negate(), assets.a__t());
|
||||||
d__i.setComment(sDf54.getDocnm_ref());
|
d__i.setComment(sDf54.getDocnm_ref());
|
||||||
rgsImdg.insert(d__i);
|
rgsImdg.insert(d__i);
|
||||||
log.debug("created {}.id={}; recalculating assests...", d__i.getRegistryCode(), d__i.getId());
|
log.debug("created {}.id={}; recalculating assests...", d__i.getRegistryCode(), d__i.getId());
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,9 @@ public enum WithdrawalFundsValidationRule implements IValidationRule<ImdgValidat
|
||||||
if (validatedObject.getBalance() == null || validatedObject.getBalance().compareTo(validatedObject.getAmount()) < 0) {
|
if (validatedObject.getBalance() == null || validatedObject.getBalance().compareTo(validatedObject.getAmount()) < 0) {
|
||||||
return of(ClearingError.WrongField, "balance");
|
return of(ClearingError.WrongField, "balance");
|
||||||
}
|
}
|
||||||
|
if (validatedObject.getSenderId() == null) {
|
||||||
|
return of(ClearingError.WrongField, "senderId");
|
||||||
|
}
|
||||||
return empty();
|
return empty();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue