我想为以下用例构建规则: 具有多个连续存款(> 10)并且在最后一次存款之后(最多4小时后)的账户,提取存入金额的总和。 为此,我有一个Transaction类
public class Transaction
{
private String Id_Event;
private Date Date_Time;
private String Id_Account;
private String Operation_Type;
private Double Amount;
}
我开发了这个规则,但它不适用于序列事件。
rule "Account"
when
$t1:Transaction($id:Id_Account,Operation_Type=="CREDIT")
$t2:Transaction(Id_Account==$id,Operation_Type=="CREDIT",this after $t1)
not (Transaction(Id_Account==$id,Operation_Type=="CREDIT", this after $t1, this before $t2))
not (Transaction(Id_Account==$id,Operation_Type=="CREDIT", this after $t2))
then
......
end
我有以下一系列事件:
T1: A1, Operation_Type: CREDIT, Amount: 100
T2: A1, Operation_Type: CREDIT, Amount: 250
T3: A1, Operation_Type: CREDIT, Amount: 150
T4: A2, Operation_Type: CREDIT, Amount: 800
T5: A1, Operation_Type: CREDIT, Amount: 565
其中T是交易,C是账户。该规则作为最后一个T5返回,当它应该是T3连续存款的最后一个。
提前致谢!!!