当规则的一部分时,Drools日期比较

时间:2017-09-04 10:59:27

标签: java drools-guvnor

我需要在规则的一部分写下以下条件。

start_date< = end_date + 3个月 其中start_date和end_date是Date类型的字段。

有人请告诉我该怎么做?

1 个答案:

答案 0 :(得分:0)

首先,感觉这是一个非常奇怪的规则。当start_date晚于end_date然后执行后果三个月时,start_date

我假设end_dateFoo是类rule "I am checking if the start_date of Foo is more than or exactly three month after the end_date of Foo" when Foo($start: start_date, $end: end_date, $end_plus_3_month: DateUtils.addMonths($end, 3), $start.compareTo($end_plus_3_month) <= 0) then System.out.printf("The start_date %tD is more that or exactly 3 month after %tD.%n", $start, $end); end 的字段,规则如下:

    $content .= '</td><td style=" text-align:left !important;"><p>' 
. $boardCodeAndName[$room['BoardOption']] . '</p></td><td><b>&pound;' 
. round($cost_per_person) . '</b></td><td><input onClick="avg_value(' 
. $final_hotel_count . ',' . $cost_per_person 
. ');" type="radio" name="hotel_' . $final_hotel_count 
. $final_room_count . '" class="hotel_' . $final_hotel_count