Search in sources :

Example 1 with TDateTime

use of cn.cerc.jdb.core.TDateTime in project summer-bean by cn-cerc.

the class BookDataList method check.

public void check(IBookData data) {
    TDateTime dateFrom = section.getDateFrom();
    TDateTime dateTo = section.getDateTo();
    String s1 = dateFrom.getDate();
    String s2 = dateTo.getDate();
    String s3 = data.getDate().getDate();
    if (s1.compareTo(s3) > 0)
        throw new RuntimeException(String.format("日期错误:对象日期 %s 不能小于起始日期 %s", data.getDate(), dateFrom));
    if (s2.compareTo(s3) < 0)
        throw new RuntimeException(String.format("日期错误:对象日期 %s 不能大于结束日期 %s", data.getDate(), dateTo));
    if (!data.check())
        throw new RuntimeException("对象记录有误,无法作业:" + new Gson().toJson(data));
}
Also used : TDateTime(cn.cerc.jdb.core.TDateTime) Gson(com.google.gson.Gson)

Example 2 with TDateTime

use of cn.cerc.jdb.core.TDateTime in project summer-bean by cn-cerc.

the class BookDataList method main.

public static void main(String[] args) {
    TDateTime dateFrom = TDateTime.Now().incDay(1);
    System.out.println(TDateTime.Now().compareDay(dateFrom));
}
Also used : TDateTime(cn.cerc.jdb.core.TDateTime)

Example 3 with TDateTime

use of cn.cerc.jdb.core.TDateTime in project summer-mis by cn-cerc.

the class AbstractField method getDate.

public TDate getDate() {
    String val = this.getString();
    if (val == null)
        return null;
    TDateTime obj = TDateTime.fromDate(val);
    if (obj == null)
        return null;
    return new TDate(obj.getData());
}
Also used : TDate(cn.cerc.jdb.core.TDate) TDateTime(cn.cerc.jdb.core.TDateTime)

Aggregations

TDateTime (cn.cerc.jdb.core.TDateTime)3 TDate (cn.cerc.jdb.core.TDate)1 Gson (com.google.gson.Gson)1