!804 update 优化登录提示语

* update 优化登录提示语
This commit is contained in:
AprilWind
2025-12-15 03:10:49 +00:00
committed by 疯狂的狮子Li
parent e23d99d85b
commit 1a461f7d3d
2 changed files with 26 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
package org.dromara.common.core.utils;
import cn.hutool.core.date.DateUtil;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.dromara.common.core.enums.FormatsType;
import org.dromara.common.core.exception.ServiceException;
@@ -297,4 +298,25 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
}
}
/**
* 根据指定日期时间获取时间段(凌晨 / 上午 / 中午 / 下午 / 晚上)
*
* @param date 日期时间
* @return 时间段描述
*/
public static String getTodayHour(Date date) {
int hour = DateUtil.hour(date, true);
if (hour <= 6) {
return "凌晨";
} else if (hour < 12) {
return "上午";
} else if (hour == 12) {
return "中午";
} else if (hour <= 18) {
return "下午";
} else {
return "晚上";
}
}
}