我需要以下规则的帮助:
多个连续存款的帐户,并且在4小时后立即进行多次提取,其金额等于使用同一银行中的不同ATM存入的相同金额。 (最后一次存款和第一次提取之间没有中间操作)
我有班级操作:帐户,金额,操作,ATM,时间戳。
我有这条规则:
<div class="item flex">
<!-- First flex item -->
<div>very long text very long text very long text Lorem ipsum dolor sit amet, consectetur adipisicing elit. Saepe, praesentium omnis, iusto eveniet ut, harum commodi distinctio cumque animi quae eaque culpa repellat? Dolores voluptatem minus sit aperiam
expedita corporis.</div>
<!-- Second flex item and is also flex-direction: column for vertical centering -->
<div>
<!-- The following div is a flex column, which is vertically centered -->
<div>
<button class="btn-done">
<i class="fa fa-check" aria-hidden="true"></i>
</button>
<button class="btn-done">
<i class="fa fa-check" aria-hidden="true"></i>
</button>
</div>
</div>
</div>
之前的规则返回在同一家银行的不同ATM中进行了4次以上操作的账户的存款总和,我怀疑的是如何考虑它们是连续的以及4小时后比较之前的与该帐户提取的总和相加。
答案 0 :(得分:0)
如果此规则触发,
rule "set up Monitor"
when
$op1: Operation( $a:account, $b:bank, $amt1:amount, operation=="CREDIT", $atm1: atm )
$op2: Operation( account==$a, bank==$b, $amt2:amount, operation=="CREDIT", atm!= $atm1 )
not Operation(account == $acc, atm != $atm1, bank == $b,
this before $op2, this after $op1 )
not Monitor( bank == $bank, account == $acc )
then
insert( new Monitor( $bank, $acc, $amt1 + $amt2, "CREDIT" );
end
您已插入显示器。监视器具有明显的字段和状态字段,设置为“CREDIT”。
rule "add deposit"
when
$op1: Operation( $a:account, $b:bank, $amt1:amount, operation=="CREDIT", $atm1: atm )
$mon: Monitor( account==$a, bank==$b, $bal: balance, state == "CREDIT" )
then
// another deposit
modify( $op1 ){ setAmount( $bal + $amt1 ) }
end
通过此事件,州将变为退出。
rule "state changes to withdrawal"
when
$op1: Operation( $a:account, $b:bank, $amt1: amount, operation=="WITHDRAW", $atm1: atm )
$mon: Monitor( account==$a, bank==$b, $bal: balance, state == "CREDIT" )
then
// switch to withdraw
modify( $op1 ){ setAmount( $bal + $amt1 ),
setState( "WITHDRAW" ) }
end
这里开始变得凌乱。我们需要检查这(第一次)提款是否兑现所有存款(balance == $amt1
)或仅减少余额或提取超过之前的存款顺序。
我退出了这里,但我想我已经表明这不可能用一条规则来做。