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();
|
||||
Account acc = stmtCmpAcc.account();
|
||||
Optional<AssetTrio> asts = createRegistryIfNeeded.apply(stmtCmpAcc);
|
||||
InOutDirection direction = IEnumKey.getEnumByKey(InOutDirection.class, stmt.getInOutDirection());
|
||||
if (accountIsAnlt(acc)) {
|
||||
AnltSearcher.AnltSearch searchResult = anltSearcher.loadByAnlt(stmt.getComment(), sdf57.getPay_val());
|
||||
if (searchResult.isFound()) {
|
||||
|
|
@ -505,11 +506,8 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
|
|||
});
|
||||
//DMAU подразумевает увеличение остатка поля balance и credit registry.code=DMAU
|
||||
String genTime = formatInstant(sdf57.getGenerationTime(), readableDateTime);
|
||||
notification.sendNotification(ObjectType.rgst,
|
||||
("Зачисление средств на регистр невыясненных денежных средств. "
|
||||
+ "Дата и время поступления: %s. "
|
||||
+ "ID платежного поручения: %d").formatted(genTime, sdf57.getDbfId()),
|
||||
Priority.HIGH);
|
||||
String ntfMsg = dmauNotificationText(direction, genTime, sdf57);
|
||||
notification.sendNotification(ObjectType.rgst, ntfMsg, Priority.HIGH);
|
||||
}
|
||||
} else if (OperationStatus.Executed.equalsByKey(stmt.getOperationStatus())) {
|
||||
if (asts.isPresent()) {
|
||||
|
|
@ -555,6 +553,25 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
|
|||
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) {
|
||||
if (account == null) return false;
|
||||
boolean anlt = AccountType.Anlt.getKey().equals(account.getAccountType());
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ public class WithdrawalFundsService {
|
|||
sdf54Imdg.insert(sDf54);
|
||||
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());
|
||||
rgsImdg.insert(d__i);
|
||||
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) {
|
||||
return of(ClearingError.WrongField, "balance");
|
||||
}
|
||||
if (validatedObject.getSenderId() == null) {
|
||||
return of(ClearingError.WrongField, "senderId");
|
||||
}
|
||||
return empty();
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue