Xsd 字符串到日期+;治疗+;日期字符串

Xsd 字符串到日期+;治疗+;日期字符串,xsd,business-rules,ilog,jrules,Xsd,Business Rules,Ilog,Jrules,我正在使用WODM规则设计器V7.5,我的XOM是一个XSD 我应该将交易日期与当前日期进行比较,因此如果客户进行交易,其帐户的到期日期应增加一年 我的XOM中的日期是字符串,因此在我的BOM的BOM-TO-XOM映射部分中,我创建了两种方法: 一种以字符串形式返回实际日期的方法,在日历上表示为:今天 DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); String s = da

我正在使用WODM规则设计器V7.5,我的XOM是一个XSD

我应该将交易日期与当前日期进行比较,因此如果客户进行交易,其帐户的到期日期应增加一年

我的XOM中的日期是字符串,因此在我的BOMBOM-TO-XOM映射部分中,我创建了两种方法:

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

    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


有人能帮忙吗?谢谢。

您拆分字符串的方法是错误的,因为年份被输入为第一个字段,并且您试图从该字段获取日期,这是字段的顺序

基本上,您的代码应该包含(注意索引):

int month=Integer.parseInt(splitdata[1]); 
int day=Integer.parseInt(splitdata[2]); 
int year=Integer.parseInt(splitdata[0]);