-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from frankfreedom/feature-rundate
系统静态变量--properties支持${run_date}
- Loading branch information
Showing
6 changed files
with
412 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
...common/src/main/java/com/webank/wedatasphere/schedulis/common/jobExecutor/utils/Date.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.webank.wedatasphere.schedulis.common.jobExecutor.utils; | ||
|
||
import java.util.Arrays; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
|
||
public enum Date { | ||
|
||
RUN_TODAY("run_today", "day", "yyyyMMdd"), | ||
RUN_TODAY_STD("run_today_std", "day", "yyyy-MM-dd"), | ||
RUN_DATE("run_date", "day", "yyyyMMdd"), | ||
RUN_DATE_STD("run_date_std", "day", "yyyy-MM-dd"), | ||
RUN_MONTH_BEGIN("run_month_begin", "month", "yyyyMMdd"), | ||
RUN_MONTH_BEGIN_STD("run_month_begin_std", "month", "yyyy-MM-dd"), | ||
RUN_MONTH_END("run_month_end", "month", "yyyyMMdd"), | ||
RUN_MONTH_END_STD("run_month_end_std", "month", "yyyy-MM-dd"), | ||
|
||
RUN_QUARTER_BEGIN("run_quarter_begin", "quarter", "yyyyMMdd"), | ||
RUN_QUARTER_END("run_quarter_end", "quarter", "yyyyMMdd"), | ||
RUN_HALF_YEAR_BEGIN("run_half_year_begin", "halfYear", "yyyyMMdd"), | ||
RUN_HALF_YEAR_END("run_half_year_end", "halfYear", "yyyyMMdd"), | ||
RUN_YEAR_BEGIN("run_year_begin", "year", "yyyyMMdd"), | ||
RUN_YEAR_END("run_year_end", "year", "yyyyMMdd"), | ||
RUN_LAST_MONTH_END("run_last_month_end", "month", "yyyyMMdd"), | ||
RUN_LAST_QUARTER_END("run_last_quarter_end", "quarter", "yyyyMMdd"), | ||
RUN_LAST_YEAR_END("run_last_year_end", "year", "yyyyMMdd"), | ||
|
||
RUN_QUARTER_BEGIN_STD("run_quarter_begin_std", "quarter", "yyyy-MM-dd"), | ||
RUN_QUARTER_END_STD("run_quarter_end_std", "quarter", "yyyy-MM-dd"), | ||
RUN_HALF_YEAR_BEGIN_STD("run_half_year_begin_std", "halfYear", "yyyy-MM-dd"), | ||
RUN_HALF_YEAR_END_STD("run_half_year_end_std", "halfYear", "yyyy-MM-dd"), | ||
RUN_YEAR_BEGIN_STD("run_year_begin_std", "year", "yyyy-MM-dd"), | ||
RUN_YEAR_END_STD("run_year_end_std", "year", "yyyy-MM-dd"), | ||
RUN_LAST_MONTH_END_STD("run_last_month_end_std", "month", "yyyy-MM-dd"), | ||
RUN_LAST_QUARTER_END_STD("run_last_quarter_end_std", "quarter", "yyyy-MM-dd"), | ||
RUN_LAST_YEAR_END_STD("run_last_year_end_std", "year", "yyyy-MM-dd"); | ||
|
||
private String value; | ||
private String calRule; | ||
private String format; | ||
|
||
private static Map<String, Date> DATE_MAP = Arrays.stream(Date.values()).collect(Collectors.toMap(x -> x.getValue(), x -> x)); | ||
|
||
|
||
Date(String value, String calRule, String format) { | ||
this.value = value; | ||
this.calRule = calRule; | ||
this.format = format; | ||
} | ||
|
||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
public String getCalRule() { | ||
return calRule; | ||
} | ||
|
||
public String getFormat() { | ||
return format; | ||
} | ||
|
||
public static Map<String, Date> getDateMap() { | ||
return DATE_MAP; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return this.value; | ||
} | ||
} |
Oops, something went wrong.