mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-15 03:25:06 +08:00
code review:拼团、秒杀活动的代码
This commit is contained in:
@ -27,6 +27,7 @@ public class CollectionUtils {
|
||||
return Arrays.stream(collections).anyMatch(CollectionUtil::isEmpty);
|
||||
}
|
||||
|
||||
// TODO @puhui999:anyMatch 更统一点
|
||||
public static <T> boolean isAny(Collection<T> from, Predicate<T> predicate) {
|
||||
return from.stream().anyMatch(predicate);
|
||||
}
|
||||
|
@ -84,11 +84,11 @@ public class LocalDateTimeUtils {
|
||||
|
||||
public static boolean isOverlap(LocalTime startTime1, LocalTime endTime1, LocalTime startTime2, LocalTime endTime2) {
|
||||
// 日期部分使用了当前日期LocalDate.now()
|
||||
// TODO @puhui999:LocalDate.now() 抽一个变量,啊哈;然后注释写下;之后 4 个变量不用,直接调方法的时候,直接计算作为入参;
|
||||
LocalDateTime startDateTime1 = LocalDateTime.of(LocalDate.now(), startTime1);
|
||||
LocalDateTime endDateTime1 = LocalDateTime.of(LocalDate.now(), endTime1);
|
||||
LocalDateTime startDateTime2 = LocalDateTime.of(LocalDate.now(), startTime2);
|
||||
LocalDateTime endDateTime2 = LocalDateTime.of(LocalDate.now(), endTime2);
|
||||
|
||||
return LocalDateTimeUtil.isOverlap(startDateTime1, endDateTime1, startDateTime2, endDateTime2);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user