refactor: 优化过滤逻辑

This commit is contained in:
junjun 2024-03-08 15:56:32 +08:00
parent c3b8d39fa6
commit 9b90f24a20

View File

@ -287,30 +287,50 @@ public class Utils {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy" + split + "MM" + split + "dd HH:mm:ss");
startTime = simpleDateFormat.parse(value).getTime();
endTime = startTime + 999;
map.put("startTime", startTime);
map.put("endTime", endTime);
return map;
} catch (Exception e) {
}
try {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy" + split + "MM" + split + "dd HH:mm");
startTime = simpleDateFormat.parse(value).getTime();
endTime = startTime + (60 * 1000 - 1);
map.put("startTime", startTime);
map.put("endTime", endTime);
return map;
} catch (Exception e) {
}
try {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy" + split + "MM" + split + "dd HH");
startTime = simpleDateFormat.parse(value).getTime();
endTime = startTime + (60 * 60 * 1000 - 1);
map.put("startTime", startTime);
map.put("endTime", endTime);
return map;
} catch (Exception e) {
}
try {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm:ss");
startTime = simpleDateFormat.parse(value).getTime();
endTime = startTime + 999;
map.put("startTime", startTime);
map.put("endTime", endTime);
return map;
} catch (Exception e) {
}
try {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy" + split + "MM" + split + "dd");
startTime = simpleDateFormat.parse(value).getTime();
endTime = startTime + (24 * 60 * 60 * 1000 - 1);
map.put("startTime", startTime);
map.put("endTime", endTime);
return map;
} catch (Exception e) {
}
try {
@ -321,6 +341,10 @@ public class Utils {
calendar.setTime(parse);
calendar.add(Calendar.MONTH, 1);
endTime = calendar.getTime().getTime() - 1;
map.put("startTime", startTime);
map.put("endTime", endTime);
return map;
} catch (Exception e) {
}
try {
@ -331,6 +355,10 @@ public class Utils {
calendar.setTime(parse);
calendar.add(Calendar.YEAR, 1);
endTime = calendar.getTime().getTime() - 1;
map.put("startTime", startTime);
map.put("endTime", endTime);
return map;
} catch (Exception e) {
}