|
|
|
@ -1,12 +1,12 @@
|
|
|
|
|
package com.ibeetl.admin.core.util;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateField;
|
|
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
|
|
|
|
|
public class DateUtil extends cn.hutool.core.date.DateUtil {
|
|
|
|
|
|
|
|
|
@ -115,28 +115,28 @@ public class DateUtil extends cn.hutool.core.date.DateUtil {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 指定时间在时间列表中所在的第几周
|
|
|
|
|
* 根据天数来
|
|
|
|
|
* 根据周来
|
|
|
|
|
*
|
|
|
|
|
* @param date
|
|
|
|
|
* @return
|
|
|
|
|
* @param startTime 开始时间
|
|
|
|
|
* @param date 比对时间
|
|
|
|
|
* @param weekNumber 周次
|
|
|
|
|
* @return 集合所在周次
|
|
|
|
|
* @param <T>
|
|
|
|
|
*/
|
|
|
|
|
public static <T extends Date> Integer weekNumberInList(T startDate, T date, int weekNumber) {
|
|
|
|
|
|
|
|
|
|
AtomicInteger index = new AtomicInteger(0);
|
|
|
|
|
|
|
|
|
|
// int pageTotalNumber = dateTimeList.size() / pageSize;
|
|
|
|
|
//
|
|
|
|
|
// // 分页
|
|
|
|
|
// List<T> list = ListUtil.page(1, pageSize, dateTimeList);
|
|
|
|
|
// page -> {
|
|
|
|
|
// for (int i = 0; i < page.size(); i++) {
|
|
|
|
|
// if(page.get(i).compareTo(date) == 0) {
|
|
|
|
|
// index.set(i + 1);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }); TODO malixiang 这里要写
|
|
|
|
|
|
|
|
|
|
return index.get();
|
|
|
|
|
public static <T extends Date> Integer weekNumberInList(T startTime, T date, int weekNumber) {
|
|
|
|
|
|
|
|
|
|
List<List<T>> lists = new ArrayList<>();
|
|
|
|
|
for (int i = 1; i <= weekNumber; i++) {
|
|
|
|
|
List<T> dateTimes = (List<T>) rangeToList(startTime, offsetWeek(startTime, i), DateField.DAY_OF_YEAR);
|
|
|
|
|
lists.add(dateTimes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < lists.size(); i++) {
|
|
|
|
|
if(((T)lists.get(i)).compareTo(date) == 0) {
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|