12/18
This commit is contained in:
@@ -640,45 +640,14 @@ public class LpkGiftCardService extends MybatisBaseService<LpkGiftCardMapper, Lp
|
|||||||
sunday = sunday.plus(Period.ofDays(7));
|
sunday = sunday.plus(Period.ofDays(7));
|
||||||
System.out.println(sunday.compareTo(endD));
|
System.out.println(sunday.compareTo(endD));
|
||||||
} while (sunday.compareTo(endD) < 1);
|
} while (sunday.compareTo(endD) < 1);
|
||||||
weekMap.add("2024-01-01");
|
String nextYear = DateUtil.offsetMonth(new Date(), 12).toString();
|
||||||
|
int y=DateUtil.year(DateUtil.parse(nextYear));
|
||||||
|
weekMap.add(String.valueOf(y)+"-01-01");
|
||||||
Object[] array = weekMap.stream().sorted().toArray();
|
Object[] array = weekMap.stream().sorted().toArray();
|
||||||
return rb.success().setData(array);
|
return rb.success().setData(array);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String startDate = "2023-12-16";
|
|
||||||
String endDate = "2024-12-14";
|
|
||||||
LocalDate now = DateUtil.parse(startDate).toSqlDate().toLocalDate();
|
|
||||||
LocalDate endD = DateUtil.parse(endDate).toSqlDate().toLocalDate();
|
|
||||||
List<String> weekMap = new ArrayList<>();
|
|
||||||
// 第一个星期六
|
|
||||||
// LocalDate saturday = now.with(firstInMonth(DayOfWeek.SATURDAY));
|
|
||||||
LocalDate saturday = now.with(DayOfWeek.SATURDAY);
|
|
||||||
do {
|
|
||||||
if (CollectionUtils.isEmpty(weekMap)) {
|
|
||||||
weekMap.add(saturday.toString());
|
|
||||||
} else {
|
|
||||||
weekMap.add(saturday.toString());
|
|
||||||
}
|
|
||||||
// 迭代一个星期
|
|
||||||
saturday = saturday.plus(Period.ofDays(7));
|
|
||||||
System.out.println(saturday.compareTo(endD));
|
|
||||||
} while (saturday.compareTo(endD) < 1);
|
|
||||||
// 第一个星期天
|
|
||||||
LocalDate sunday = now.with(DayOfWeek.SUNDAY);
|
|
||||||
do {
|
|
||||||
if (CollectionUtils.isEmpty(weekMap)) {
|
|
||||||
weekMap.add(saturday.toString());
|
|
||||||
} else {
|
|
||||||
weekMap.add(sunday.toString());
|
|
||||||
}
|
|
||||||
// 迭代一个星期
|
|
||||||
sunday = sunday.plus(Period.ofDays(7));
|
|
||||||
System.out.println(sunday.compareTo(endD));
|
|
||||||
} while (sunday.compareTo(endD) < 1);
|
|
||||||
Object[] array = weekMap.stream().sorted().toArray();
|
|
||||||
|
|
||||||
System.out.println(array);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
|||||||
Reference in New Issue
Block a user