예제 #1
0
  public boolean fillFromForm(BaseForm form) {
    if (form == null) {
      return false;
    }
    // 提取起始、结束日期
    Date t1 = DateUtil.AddDays(DateUtil.trunc(new Date()), -1); // 昨天
    if (form.getDays() != null) {
      endDate = t1;
      form.setEndTime(DateUtil.formatDate(t1, "yyyy-MM-dd"));
      startDate = DateUtil.AddDays(t1, 0 - NumericUtil.tryParse(form.getDays(), 30));
      form.setStartTime(DateUtil.formatDate(startDate, "yyyy-MM-dd"));
    } else {
      startDate = form.getStartDate();
      endDate = form.getEndDate();
    }

    // 判断日期有效性
    if (getEndDate() == null) {
      endDate = t1;
      // 设置回FORM,避免查询数据使用的日期和页面显示日期不一致
      form.setEndTime(DateUtil.formatDate(t1, "yyyy-MM-dd"));
    }
    if (getStartDate() == null || getEndDate().before(getStartDate())) {
      startDate = DateUtil.AddDays(t1, -30);
      // 设置回FORM,避免查询数据使用的日期和页面显示日期不一致
      form.setStartTime(DateUtil.formatDate(startDate, "yyyy-MM-dd"));
    }

    systemID = form.getSystemIDValue();
    model = form.getModel();
    appVersion = form.getAppVersion();

    return true;
  }
예제 #2
0
 /** 缓存KEY */
 public String toString() {
   return String.format(
       "%s_%s_%s_%s",
       this.systemID,
       DateUtil.formatDate(this.startDate, "yyyyMMdd"),
       DateUtil.formatDate(this.endDate, "yyyyMMdd"),
       this.model);
 }
예제 #3
0
 public String getBakTableAffix() {
   if (this.bakTableAffix == null && this.startDate != null) {
     this.bakTableAffix = DateUtil.formatDate(this.startDate, "yyyyMM");
   }
   return bakTableAffix;
 }