Commit 81dedb79 by shenjunjie

Merge branch 'feature' into 'release'

获取索引方法修复

See merge request !446
parents 81b2ec0d 50c8b073
...@@ -58,16 +58,17 @@ public class IndexUtil { ...@@ -58,16 +58,17 @@ public class IndexUtil {
start = truncDate(start, pattern); start = truncDate(start, pattern);
end = truncDate(end, pattern); end = truncDate(end, pattern);
List<String> list = Lists.newArrayList(); List<String> list = Lists.newArrayList();
Period period = new Period(start.getTime(), end.getTime(), PeriodType.months()); Period monthPeriod = new Period(start.getTime(), end.getTime(), PeriodType.months());
Period yearPeriod = new Period(start.getTime(), end.getTime(), PeriodType.years());
switch (pattern) { switch (pattern) {
case "yyyy": { case "yyyy": {
for (int i = 0; i <= period.getYears(); i++) { for (int i = 0; i <= yearPeriod.getYears(); i++) {
list.add(index + "_" + DF_yyyy.format(DateUtils.addYears(start, i))); list.add(index + "_" + DF_yyyy.format(DateUtils.addYears(start, i)));
} }
break; break;
} }
case "yyyyMM": { case "yyyyMM": {
for (int i = 0; i <= period.getMonths(); i++) { for (int i = 0; i <= monthPeriod.getMonths(); i++) {
list.add(index + "_" + DF_yyyyMM.format(DateUtils.addMonths(start, i))); list.add(index + "_" + DF_yyyyMM.format(DateUtils.addMonths(start, i)));
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment