1

我正在使用 WODM 规则设计器 V7.5,我的XOMXSD

我应该将交易日期与当前日期进行比较,所以如果客户进行交易,他的帐户到期日期应该增加一年!

我的XOM中的日期是字符串,因此在我的 BOM 的BOM TO XOM MAPPING部分中,我创建了 2 个方法:

  • 以字符串形式返回实际日期的一个,表示为:日历上的今天

    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    Date date = new Date();
    String s = dateFormat.format(date);
    return s;
    
  • 接受一个字符串,将其转换为日期格式,将年份加 1 并返回一个字符串,表示为:{this} NewDate ({0})

    String[] splitdata = d1.split("-");
    int month = Integer.parseInt(splitdata[0]);
    int day = Integer.parseInt(splitdata[1]);
    int year = Integer.parseInt(splitdata[2]);
    Calendar cal = Calendar.getInstance();
    cal.set(year, month, day);
    Date date = cal.getTime();
    date.setYear(date.getYear() + 1);
    DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    String s = dateFormat.format(date);
    return s;
    

规则如下:

definitions 
set 'variable1' to calendar NewDate (the transaction date of transaction) ; 
if 
    the transaction date of transaction is today on the calendar 
    then 
        set the expiration date of account to variable1 ; 

我像这样输入交易日期:“2013-05-13”,我期待:“2014-05-13”在到期日期变量中,但我得到了这个0181-10-05

任何人都可以帮忙吗?谢谢。

4

1 回答 1

2

Your way of splitting the string is wrong as the year is entered as the 1st field and you are trying to obtain the date from this field, that is the order of the fields matter.

Essentially, your code should contain (notice the indexes):

int month=Integer.parseInt(splitdata[1]); 
int day=Integer.parseInt(splitdata[2]); 
int year=Integer.parseInt(splitdata[0]);
于 2013-09-25T07:12:36.643 回答