|
|
|
@ -23,6 +23,7 @@ import java.time.LocalDateTime;
|
|
|
|
|
import java.time.ZoneOffset; |
|
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.Locale; |
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.apache.commons.lang3.math.NumberUtils; |
|
|
|
@ -43,8 +44,8 @@ public class AgirStatoolUtils
|
|
|
|
|
{ |
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(ProjectPage.class); |
|
|
|
|
|
|
|
|
|
public static final DateTimeFormatter PATTERN_SHORTDATE = DateTimeFormatter.ofPattern("dd/MM/yyyy"); |
|
|
|
|
public static final DateTimeFormatter PATTERN_LONGDATE = DateTimeFormatter.ofPattern("dd/MM/yyyy hh'h'mm"); |
|
|
|
|
public static final DateTimeFormatter PATTERN_SHORTDATE = DateTimeFormatter.ofPattern("dd/MM/yyyy", Locale.FRANCE); |
|
|
|
|
public static final DateTimeFormatter PATTERN_LONGDATE = DateTimeFormatter.ofPattern("dd/MM/yyyy hh':'mm", Locale.FRANCE); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Normalise week date. |
|
|
|
@ -89,14 +90,14 @@ public class AgirStatoolUtils
|
|
|
|
|
|
|
|
|
|
LocalDate normalizedEnd = normaliseWeekDate(end); |
|
|
|
|
LocalDate date = normaliseWeekDate(start); |
|
|
|
|
int index = source.indexOf(start.format(DateTimeFormatter.ofPattern("yyyyww"))); |
|
|
|
|
int index = source.indexOf(toYearWeek(start)); |
|
|
|
|
if (index == -1) |
|
|
|
|
{ |
|
|
|
|
index = 0; |
|
|
|
|
} |
|
|
|
|
while (date.isBefore(normalizedEnd) || date.isEqual(normalizedEnd)) |
|
|
|
|
{ |
|
|
|
|
String dateToken = date.format(DateTimeFormatter.ofPattern("yyyyww")); |
|
|
|
|
String dateToken = toYearWeek(date); |
|
|
|
|
long count; |
|
|
|
|
if (index < source.size()) |
|
|
|
|
{ |
|
|
|
@ -145,7 +146,7 @@ public class AgirStatoolUtils
|
|
|
|
|
long count = 0; |
|
|
|
|
while (date.isBefore(end) || date.isEqual(end)) |
|
|
|
|
{ |
|
|
|
|
String dateToken = date.format(DateTimeFormatter.ofPattern("yyyyww")); |
|
|
|
|
String dateToken = toYearWeek(date); |
|
|
|
|
DateCount current = source.get(dateToken); |
|
|
|
|
if (current != null) |
|
|
|
|
{ |
|
|
|
@ -398,4 +399,28 @@ public class AgirStatoolUtils
|
|
|
|
|
//
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* To year week. |
|
|
|
|
* |
|
|
|
|
* @param source |
|
|
|
|
* the source |
|
|
|
|
* @return the string |
|
|
|
|
*/ |
|
|
|
|
public static String toYearWeek(final LocalDate source) |
|
|
|
|
{ |
|
|
|
|
String result; |
|
|
|
|
|
|
|
|
|
if (source == null) |
|
|
|
|
{ |
|
|
|
|
result = null; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
result = source.format(DateTimeFormatter.ofPattern("yyyyww", Locale.FRANCE)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|