时间工具类-- LocalDateTimeUtil (修正版)

修正版(V2)

1.1、工具类 API

API方法说明方法参数使用返回备注
LocalDateTime.now()获取当前时间-
isBefore (t1,t2)判断时间 小于t1 < t2 = true
isAfter (t1,t2)判断时间 大于t1 > t2 = true
of (省略…)时间构建year 年
month 月
dayOfMonth 日
hour 时
minute 分
of (省略…)时间构建year 年
month 月
dayOfMonth 日
hour 时
minute 分
second 秒
nanoOfSecond 毫秒
getDayStart (time)天的开始时间
time = 指定天
返回指定天的 00:00:00
getDayEnd (time)天的结束时间
time = 指定天
返回指定天的 23:59:59.999999
week (time)周几time = 指定天
返回 1到7
plus (time, number ,field)获取之后日期参数1: time = 指定时间
参数2: number = 增加值,根据field不同增加时间
参数3: field = 时间单位
ChronoUnit.MILLIS – 毫秒
ChronoUnit.SECONDS – 秒
MINUTES – 分
HOURS – 时
HALF_DAYS – 半天=12小时
DAYS – 天
YEARS – 年
加N 天/时/分/秒/毫秒 后的时间
subtract (time, number ,field)获取之前日期参数同 plus 方法 (此方法为减少时间)减N 天/时/分/秒/毫秒 后的时间
betweenTwoTime (省略…)获取两个日期的时间差参数1: startTime 时间1
参数2: endTime 时间2
参数3: field 时间差单位,同 plus 方法
时间差 (天/时/分/秒/毫秒)
weekFirstDay (time,num)±N周 的第一天
参数1: time = 指定时间
参数2: num = ±N
第一天 00:00:00
weekLastDay(time,num)±N周 的最后一天
参数1: time = 指定时间
参数2: num = ±N
最后一天 23:59:59:999999
monthFirstDay(time,num)±N月 的第一天
参数1: time = 指定时间
参数2: num = ±N
第一天00:00:00
monthLastDay(time,num)±N月 的最后一天
参数1: time = 指定时间
参数2: num = ±N
最后一天 23:59:59:999999
yearFirstDay(time,num)±N年 年的第一天
参数1: time = 指定时间
参数2: num = ±N
第一天 00:00:00
yearLastDay(time,num)±N年 最后一天
参数1: time = 指定时间
参数2: num = ±N
最后一天 23:59:59:999999
getNo()获取编号-获取17位时间戳字符串+3位随机数的 20 位编号
getTheHour (time)获取整点
-把指定时间的 分+秒设置为0 (舍弃)
getTheMinute(time)获取整分
-把指定时间的 秒设置为0 (舍弃)
parseDayInt (time)今天是几号
-01 - 31
parseLdt (date)Date 转 LocalDateTime
-
parseDate (time)LocalDateTime 转 Date
-
parseMillisecond (time)LocalDateTime 转 毫秒
-
parseSecond (time)LocalDateTime 转 秒
-
parseTimestamp (time)时间戳 转 LocalDateTime
-
parseTimestamp (timestamp)时间戳 转 LocalDateTime
-
parseTimestamp (time)LocalDateTime 转 时间戳
-
parse (timeStr)时间字符串 转 LocalDateTime
-完整格式 yyyy-MM-dd HH:mm:ss
parse (timeStr,pattern)时间字符串 转 LocalDateTime
-指定时间格式
parse (time)LocalDateTime 转 String 时间字符串
-完整格式 yyyy-MM-dd HH:mm:ss
parse (time,pattern)LocalDateTime 转 String 时间字符串
-指定时间格式
parse (time,pattern)Date 转 String 时间字符串
-指定时间格式
getDay24Hour (t)获取指定天的24 小数
-yyyy-MM-dd HH 格式 (0点到23点集合)
getBetweenDaysUpListByMonth (省略…)获取指定 N± 月的每一天的时间
time = 指定时间月
startNum = 指定时间前N月第一天
endNum = 指定时间后 N 月最后一天
时间 + 周几 集合列表
getBetweenDaysUpList (省略…)获取每一天的时间startTime = 开始天时间
endTime= 结束天时间
type = 1-包含开始和结束时间
type = 2-包含结束-不包含开始时间
type = 3-包含开始-不包含结束时间
type = 4-不包含开始和结束时间
时间 + 周几 集合列表
getBetweenDaysList (省略…)获取每一天的时间
同 getBetweenDaysUpList 方法参数LocalDateTime 集合列表
getBetweenMonthsList(省略…)获取每月时间
startTime = 开始月时间
endTime = 结束月时间
包含开始月和结束月, 若不需要自行剔除
(yyyy-MM 格式字符串

1.2、LocalDateTimeUtil 工具类

/**
 * 时间处理工具类
 *
 * @author ws
 * @mail 1720696548@qq.com
 * @date 2020/4/24 0024 9:54
 * @return
 */
public class LocalDateTimeUtil{

	/**
	 * 时间格式
	 */
	private static final String YYYY_MM_DD_HH_MM_SS_SSS = "yyyy-MM-dd HH:mm:ss.SSS";
	private static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
	private static final String YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm";
	private static final String YYYY_MM_DD_HH = "yyyy-MM-dd HH";
	private static final String YYYY_MM_DD = "yyyy-MM-dd";
	private static final String YYYY_MM = "yyyy-MM";
	private static final String YYYY = "yyyy";

	/**
	 * 获取时间类型
	 * 1-包含开始和结束时间(默认)
	 * 2-包含结束-不包含开始时间   // 开始时间+1天
	 * 3-包含开始-不包含结束时间   // 结束时间-1天
	 * 4-不包含开始和结束时间 // 开始时间+1天  or 结束时间-1天
	 */
	private static final int BETWEEN_TYPE_ONE = 1;
	private static final int BETWEEN_TYPE_TWO = 2;
	private static final int BETWEEN_TYPE_THREE = 3;
	private static final int BETWEEN_TYPE_FOUR = 4;

	private static Random random;

	static {
		try {
			random = SecureRandom.getInstanceStrong();
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		}
	}

	/**
	 * 判断时间 小于
	 * <P>   t1 < t2 = true (如:2019-10-13 11:11:00 < 2020-11-13 13:13:00 = true)  </P>
	 *
	 * @author wangsong
	 */
	public static boolean isBefore(LocalDateTime t1, LocalDateTime t2) {
		return t1.isBefore(t2);
	}

	/**
	 * 判断时间 大于
	 * <P>   t1 > t2 = true  </P>
	 *
	 * @author wangsong
	 */
	public static boolean isAfter(LocalDateTime t1, LocalDateTime t2) {
		return t1.isAfter(t2);
	}


	/**
	 * 自构建 LocalDateTime ==> 年,月,日,时,分
	 *
	 * @author wangsong
	 */
	public static LocalDateTime of(int year, int month, int dayOfMonth, int hour, int minute) {
		return LocalDateTime.of(year, month, dayOfMonth, hour, minute);
	}

	/**
	 * 自构建 LocalDateTime ==> 年,月,日,时,分,秒,毫秒(精确到9位数)
	 *
	 * @author wangsong
	 */
	public static LocalDateTime of(int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond) {
		return LocalDateTime.of(year, month, dayOfMonth, hour, minute, second, nanoOfSecond);
	}


	//========================================================================================================
	//========================================================================================================
	//========================================================================================================
	//============================================== 时间获取 =================================================
	//========================================================================================================
	//========================================================================================================

	/**
	 * 获取指定某一天的开始时间 00:00:00
	 *
	 * @param time
	 * @return java.time.LocalDateTime
	 * @author wangsong
	 * @date 2020/12/24 0024 15:10
	 * @version 1.0.1
	 */
	public static LocalDateTime getDayStart(LocalDateTime time) {
		return time.withHour(0)
				.withMinute(0)
				.withSecond(0)
				.withNano(0);
	}


	/**
	 * 获取指定某一天的结束时间  23:59:59.999999
	 *
	 * @author wangsong
	 */
	public static LocalDateTime getDayEnd(LocalDateTime time) {
		// 年 月  天 时 分 秒 毫秒(这里精确到6位数)
		return time.withHour(23)
				.withMinute(59)
				.withSecond(59)
				.withNano(999999);
	}

	/**
	 * 获取指定时间是周几  1到7
	 *
	 * @author wangsong
	 */
	public static int week(LocalDateTime time) {
		return time.getDayOfWeek().getValue();
	}



	/**
	 * 获取指定时间之后的日期
	 * <P>  根据field不同加不同值 , field为ChronoUnit.*
	 * 秒   ChronoUnit.SECONDS
	 * 分   ChronoUnit.MINUTES
	 * 时   ChronoUnit.HOURS
	 * 半天  ChronoUnit.HALF_DAYS
	 * 天    ChronoUnit.DAYS
	 * 月    ChronoUnit.MONTHS
	 * 年    ChronoUnit.YEARS
	 * </P>
	 *
	 * @author wangsong
	 */
	public static LocalDateTime plus(LocalDateTime time, long number, TemporalUnit field) {
		return time.plus(number, field);
	}


	/**
	 * 获取两个日期的时间差
	 *
	 * @param startTime 开始时间
	 * @param endTime   计算时间
	 * @param field     根据field不同减不同值 , field 为 ChronoUnit.*
	 * @return startTime小 endTime大 返回正数,则反之
	 * @author wangsong
	 * <p>
	 * 秒    ChronoUnit.SECONDS
	 * 分    ChronoUnit.MINUTES
	 * 时    ChronoUnit.HOURS
	 * 半天  ChronoUnit.HALF_DAYS
	 * 天    ChronoUnit.DAYS
	 * 月    ChronoUnit.MONTHS
	 * 年    ChronoUnit.YEARS
	 * </P>
	 */
	public static long betweenTwoTime(LocalDateTime startTime, LocalDateTime endTime, ChronoUnit field) {
		Period period = Period.between(LocalDate.from(startTime), LocalDate.from(endTime));
		if (field == ChronoUnit.YEARS) {
			return period.getYears();
		}
		if (field == ChronoUnit.MONTHS) {
			return period.getYears() * 12L + period.getMonths();
		}
		return field.between(startTime, endTime);
	}


	/**
	 * 获取指定时间之前的日期
	 *
	 * @author wangsong
	 * <P> 根据field不同减不同值, field 为 ChronoUnit.*
	 * 秒   ChronoUnit.SECONDS
	 * 分   ChronoUnit.MINUTES
	 * 时   ChronoUnit.HOURS
	 * 半天  ChronoUnit.HALF_DAYS
	 * 天    ChronoUnit.DAYS
	 * 月    ChronoUnit.MONTHS
	 * 年    ChronoUnit.YEARS
	 * </P>
	 * @version 1.0.1
	 */
	public static LocalDateTime subtract(LocalDateTime time, long number, TemporalUnit field) {
		return time.minus(number, field);
	}



	/**
	 * 获取指定时间 加或减N周的第一天 00:00:00
	 *
	 * @author wangsong
	 */
	public static LocalDateTime weekFirstDay(LocalDateTime time, int num) {
		int week = week(LocalDateTime.now());
		LocalDateTime newTime = subtract(LocalDateTime.now(), week - 1L, ChronoUnit.DAYS);
		newTime = plus(newTime, num * 7L, ChronoUnit.DAYS);
		return getDayStart(newTime);
	}


	/**
	 * 获取指定时间 加或减N周的最后一天  23:59:59:999999
	 *
	 * @author wangsong
	 */
	public static LocalDateTime weekLastDay(LocalDateTime time, int num) {
		int week = week(LocalDateTime.now());
		LocalDateTime newTime = plus(LocalDateTime.now(), 7L - week, ChronoUnit.DAYS);
		newTime = plus(newTime, num * 7L, ChronoUnit.DAYS);
		return getDayEnd(newTime);
	}


	/**
	 * 获取指定月 加或减N月的第一天 00:00:00
	 *
	 * @author wangsong
	 */
	public static LocalDateTime monthFirstDay(LocalDateTime time, int num) {
		LocalDateTime newTime = plus(time, num, ChronoUnit.MONTHS);
		newTime = newTime.with(TemporalAdjusters.firstDayOfMonth());
		return getDayStart(newTime);
	}

	/**
	 * 获取指定月 加或减N月的最后一天 23:59:59:999999
	 *
	 * @author wangsong
	 */
	public static LocalDateTime monthLastDay(LocalDateTime time, int num) {
		LocalDateTime newTime = plus(time, num, ChronoUnit.MONTHS);
		newTime = newTime.with(TemporalAdjusters.lastDayOfMonth());
		return getDayEnd(newTime);
	}



	/**
	 * 获取指定年 加或减N年的第一天 00:00:00
	 *
	 * @author wangsong
	 */
	public static LocalDateTime yearFirstDay(LocalDateTime time, int num) {
		LocalDateTime newTime = plus(time, num, ChronoUnit.YEARS);
		int year = newTime.getYear();
		// 年 月  天 时 分 秒 毫秒(这里精确到9位数)
		return LocalDateTime.of(year, 1, 1, 0, 0, 0);
	}

	/**
	 * 获取指定年 加或减N年最后一天  23:59:59:999999
	 *
	 * @author wangsong
	 */
	public static LocalDateTime yearLastDay(LocalDateTime time, int num) {
		LocalDateTime newTime = subtract(time, num, ChronoUnit.YEARS);
		int year = newTime.getYear();
		// 年 月  天 时 分 秒 毫秒(这里精确到6位数)
		return LocalDateTime.of(year, 12, 31, 23, 59, 59, 999999);
	}


	/**
	 * 获取17位时间戳字符串+3位随机数
	 * <p>  这里增加了线程锁和延时一毫秒,单体项目100%不会重复,可用于生成订单号  </p>
	 * 20200101125959999  2020-01-01 12:59:59:999
	 *
	 * @return
	 * @author wangsong
	 */
	public static synchronized String getNo() {
		String timeStamp = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date());
		timeStamp += (random.nextInt(10) + "") + (random.nextInt(10) + "") + (random.nextInt(10) + "");
		return timeStamp;
	}


	/**
	 * 获取整点--  把指定时间的 分+秒设置为0
	 *
	 * @param time time
	 * @return java.time.LocalDateTime
	 * @author wangsong
	 * @date 2020/12/24 0024 15:10
	 * @version 1.0.1
	 */
	public static LocalDateTime getTheHour(LocalDateTime time) {
		// 分   // 秒   // 毫秒(这里精确到9位数)
		return time.withMinute(0)
				.withSecond(0)
				.withNano(0);
	}


	/**
	 * 获取整分--  把指定时间的 秒设置为0
	 * <p>
	 //	 * 如:
	 //	 * 2020-01-01 12:10  ===>  等于 2020-01-01 12:20
	 //	 * 2020-01-01 12:11  ===>  等于 2020-01-01 12:20
	 //	 * 2020-01-01 12:19  ===>  等于 2020-01-01 12:20
	 * </P>
	 *
	 * @param time
	 * @return java.time.LocalDateTime
	 * @author wangsong
	 * @date 2020/12/24 0024 15:21
	 * @version 1.0.1
	 */
	public static LocalDateTime getTheMinute(LocalDateTime time) {
		// 秒    // 毫秒(这里精确到9位数)
		return time.withSecond(0).withNano(0);
	}


	//========================================================================================================
	//========================================================================================================
	//========================================================================================================
	//============================================== 转换相关 =================================================
	//========================================================================================================
	//========================================================================================================

	/**
	 * LocalDateTime 转为 天 的字符串,如 1号返回 01
	 *
	 * @author wangsong
	 */
	public static Integer parseDayInt(LocalDateTime time) {
		return Integer.parseInt(parse(time, "dd"));
	}


	/**
	 * Date 转 LocalDateTime
	 *
	 * @author wangsong
	 */
	public static LocalDateTime parseLdt(Date date) {
		return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
	}

	/**
	 * LocalDateTime 转 Date
	 *
	 * @author wangsong
	 */
	public static Date parseDate(LocalDateTime time) {
		return Date.from(time.atZone(ZoneId.systemDefault()).toInstant());
	}

	/**
	 * LocalDateTime 转 毫秒
	 *
	 * @author wangsong
	 */
	public static Long parseMillisecond(LocalDateTime time) {
		return time.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
	}

	/**
	 * LocalDateTime 转 秒
	 *
	 * @author wangsong
	 */
	public static Long parseSecond(LocalDateTime time) {
		return time.atZone(ZoneId.systemDefault()).toInstant().getEpochSecond();
	}


	/**
	 * 将时间戳转 为 LocalDateTime
	 *
	 * @param timestamp
	 * @return java.lang.String
	 * @author wangsong
	 * @date 2021/5/12 0012 17:13
	 * @version 1.0.1
	 */
	public static LocalDateTime parseTimestamp(Long timestamp) {
		return LocalDateTime.ofEpochSecond(timestamp / 1000, 0, ZoneOffset.ofHours(8));
	}

	/**
	 * 将LocalDateTime 转 为时间戳
	 *
	 * @return java.lang.String
	 * @author wangsong
	 * @date 2021/5/12 0012 17:13
	 * @version 1.0.1
	 */
	public static Long parseTimestamp(LocalDateTime time) {
		return time.toEpochSecond(ZoneOffset.ofHours(8));
	}





	/**
	 * String 类型转成 LocalDateTime ,必须为完整时间,如:2020-01-20 00:00:00
	 *
	 * @param timeStr 时间字符串
	 * @return java.time.LocalDateTime
	 */
	public static LocalDateTime parse(String timeStr) {
		return parse(timeStr, YYYY_MM_DD_HH_MM_SS);
	}


	/**
	 * String (2020-01-20 00:00:00)类型转成 LocalDateTime
	 *
	 * @param timeStr timeStr 时间字符串
	 * @param pattern pattern 格式
	 * @return java.time.LocalDateTime
	 */
	public static LocalDateTime parse(String timeStr, String pattern) {
		if (pattern.equals(YYYY)) {
			timeStr += "-01-01 00:00:00";
		} else if (pattern.equals(YYYY_MM)) {
			timeStr += "-01 00:00:00";
		} else if (pattern.equals(YYYY_MM_DD)) {
			timeStr += " 00:00:00";
		} else if (pattern.equals(YYYY_MM_DD_HH)) {
			timeStr += ":00:00";
		} else if (pattern.equals(YYYY_MM_DD_HH_MM)) {
			timeStr += ":00";
		}
		DateTimeFormatter dtf = DateTimeFormatter.ofPattern(YYYY_MM_DD_HH_MM_SS);
		return LocalDateTime.parse(timeStr, dtf);
	}


	/**
	 * LocalDateTime 转完整 String 类型的时间 如:2020-01-20 00:00:00
	 *
	 * @param time time
	 * @return java.lang.String
	 */
	public static String parse(LocalDateTime time) {
		return parse(time, YYYY_MM_DD_HH_MM_SS);
	}

	/**
	 * LocalDateTime 转指定类型的字符串
	 *
	 * @param time    time    时间
	 * @param pattern pattern 格式
	 *
	 * @return java.lang.String
	 * @author wangsong
	 */
	public static String parse(LocalDateTime time, String pattern) {
		if (time == null) {
			return null;
		}
		DateTimeFormatter df = DateTimeFormatter.ofPattern(pattern);
		return df.format(time);
	}


	/**
	 * Date 转指定格式的字符串
	 *
	 * @param time
	 * @author wangsong
	 */
	public static String parse(Date time, String pattern) {
		if (time == null) {
			return null;
		}
		SimpleDateFormat format = new SimpleDateFormat(pattern);
		return format.format(time);
	}



	/**
	 * 获取指定天的24小时(0-23)  |  yyyy-MM-dd HH 格式
	 *
	 * @param t 开始月
	 * @return
	 */
	public static List<String> getDay24Hour(LocalDateTime t) {
		if (t == null) {
			return new ArrayList<>();
		}
		List<String> times = new ArrayList<>();
		String time = parse(t, YYYY_MM_DD);
		int hourNum = 24;
		for (int i = 0; i < hourNum; i++) {
			if (i < 10) {
				times.add(time + " 0" + i);
			} else {
				times.add(time + " " + i);
			}
		}
		return times;
	}


	/**
	 * 获取每一天的时间 (指定时间 前n月前的第一天 到 n月后的最后一天的所有时间)
	 * <P>  一天一条数据 List<DateDays>  </P>
	 *
	 * @param startNum 前n月,当前月开始为 0
	 * @param endNum   后n月,当前月就是为 0
	 * @return java.util.List<com.lplb.common.utils.LocalDateTimeUtil.DateDays>
	 * @author wangsong
	 */
	public static List<DateDays> getBetweenDaysUpListByMonth(LocalDateTime time, Integer startNum, Integer endNum) {
		// 本月第一天  00:00:00
		LocalDateTime startTime = monthFirstDay(time, startNum);
		// n月后的最后一天 23:59:59.999
		LocalDateTime endTime = monthLastDay(time, endNum);
		return getBetweenDaysUpList(startTime, endTime, BETWEEN_TYPE_ONE);
	}


	/**
	 * 获取每一天的时间 (指定开始时间和结束时间)
	 * <P>
	 *     一天一条数据 List<DateDays>
	 *     返回数据包括 开始时间 和 结束时间 的当天数据
	 *  </P>
	 *
	 * @param startTime 开始时间 (时分秒已开始时间位为准)
	 * @param endTime   结束时间
	 * @param type    1-包含开始和结束时间  2-包含结束-不包含开始时间  3-包含开始-不包含结束时间  4-不包含开始和结束时间
	 * @return java.util.List<com.lplb.common.utils.LocalDateTimeUtil.DateDays>
	 * @author wangsong
	 */
	public static List<DateDays> getBetweenDaysUpList(LocalDateTime startTime, LocalDateTime endTime, Integer type) {
		List<DateDays> dateDaysList = new ArrayList<>();
		List<LocalDateTime> betweenList = getBetweenDaysList(startTime, endTime, type);
		for (LocalDateTime localDateTime : betweenList) {
			dateDaysList.add(new DateDays(localDateTime, week(localDateTime)));
		}
		return dateDaysList;
	}


	/**
	 * 获取指定开始时间到指定结束时间的每一天, 包括开始时间,不包括结束时间,如:2020-5-16到2020-5-18 获得时间为:[2020-5-16,2020-5-17]
	 *
	 * @param startTime
	 * @param endTime
	 * @param type    1-包含开始和结束时间  2-包含结束-不包含开始时间  3-包含开始-不包含结束时间  4-不包含开始和结束时间
	 * @return java.util.List<java.time.LocalDateTime>
	 * @author wangsong
	 * @date 2020/12/24 0024 15:16
	 * @version 1.0.1
	 */
	public static List<LocalDateTime> getBetweenDaysList(LocalDateTime startTime, LocalDateTime endTime, Integer type) {
		// 指定开始时间  00:00:00  // 指定结束时间  00:00:00
		LocalDateTime oldStartTime = getDayStart(startTime);
		LocalDateTime oldEndTime = getDayStart(endTime);
		// 1-包含开始和结束时间(默认) BetweenType
		// 2-包含结束-不包含开始时间   // 开始时间+1天
		// 3-包含开始-不包含结束时间   // 结束时间-1天
		// 4-不包含开始和结束时间 // 开始时间+1天  or 结束时间-1天
		if (type == BETWEEN_TYPE_TWO) {
			oldStartTime = plus(oldStartTime, 1, ChronoUnit.DAYS);
		} else if (type == BETWEEN_TYPE_THREE) {
			oldEndTime = subtract(endTime, 1, ChronoUnit.DAYS);
		} else if (type == BETWEEN_TYPE_FOUR) {
			oldStartTime = plus(oldStartTime, 1, ChronoUnit.DAYS);
			oldEndTime = subtract(endTime, 1, ChronoUnit.DAYS);
		}
		// 返回数据
		List<LocalDateTime> everyDays = new ArrayList<>();
		// 第一天数据
		everyDays.add(oldStartTime);
		while (true) {
			// 获取之后的每一天时间
			LocalDateTime nextDay = plus(everyDays.get(everyDays.size() - 1), 1, ChronoUnit.DAYS);
			// 大于最后一天-跳出循环
			if (isAfter(nextDay, oldEndTime)) {
				break;
			}
			everyDays.add(nextDay);
		}
		return everyDays;
	}


	/**
	 * 获取月 (返回每一个月的字串, yyyy-MM 格式)
	 * <p> 包含结束月,不包含开始月 </>
	 *
	 * @param startTime 开始月
	 * @param endTime   结束月
	 * @return
	 */
	public static List<String> getBetweenMonthsList(LocalDateTime startTime, LocalDateTime endTime) {
		List<String> times = new ArrayList<>();
		if (startTime != null && endTime != null) {
			// 获取开始月的第一天
			endTime = monthFirstDay(endTime, 0);
			times.add(parse(startTime, YYYY_MM));
			while (isBefore(startTime, endTime)) {
				startTime = plus(startTime, 1, ChronoUnit.MONTHS);
				times.add(parse(startTime, YYYY_MM));
			}
		}
		return times;
	}


	/**
	 * 获取日期端的数据保存对象
	 *
	 * @author ws
	 * @mail 1720696548@qq.com
	 * @date 2020/5/7 0007 9:41
	 */
	public static class DateDays {
		// 当天时间- 年月日/00:00:00
		private LocalDateTime dayTime;
		// 当天是周几
		private int week;

		public DateDays(LocalDateTime dayTime, int week) {
			this.dayTime = dayTime;
			this.week = week;
		}

		public LocalDateTime getDayTime() {
			return dayTime;
		}

		public void setDayTime(LocalDateTime dayTime) {
			this.dayTime = dayTime;
		}

		public int getWeek() {
			return week;
		}

		public void setWeek(int week) {
			this.week = week;
		}
	}
}

原(v1)

2.1、工具类 API

API说明
LocalDateTime.now()当前时间
getMilliByTime( LocalDateTime.now())当前时间秒数
getSecondsByTime( LocalDateTime.now())当前时间毫秒数
getDayStart( LocalDateTime.now())指定任意一天的开始时间 (00:00:00)
getDayEnd(LocalDateTime.now())指定任意一天的结束时间 (23:59:59:999999999)
of(2020, 1, 1, 12, 00, 00, 999999999)构建自定义时间
formatTime(time, “yyyy-MM-dd HH:mm:ss:SSS”)指定格式
subtract(LocalDateTime.now(), N, ChronoUnit…)N 秒/分/时/天/月/年前 (ChronoUnit 单位)

ChronoUnit.MILLIS – 毫秒
ChronoUnit.SECONDS – 秒
MINUTES – 分
HOURS – 时
HALF_DAYS – 半天=12小时
DAYS – 天
YEARS – 年
plus(LocalDateTime.now(), N, ChronoUnit…)N 秒/分/时/天/月/年后 (ChronoUnit 单位同上)
betweenTwoTime(t1, t2, ChronoUnit…))两个时间的时间差(ChronoUnit 单位同上)
isBefore(t1, t2)时间大小 - ( t1 < t2 = true )
isAfter(t1, t2)时间大小 - ( t1 > t2 = true )
week(time)周几
weekFirst(N)N周前 / 后的周一

上周的周一 weekFirst(-1)
本周的周一 weekFirst(0)
下周的周一 weekFirst(1)
weekLast(N)N周前 / 后的周末 (同上)
monthFirst(N)N月前 / 后月初 = 1号

上月初 weekFirst(-1)
本月初 weekFirst(0)
下月初 weekFirst(1)
monthLast(N)N月前 / 后月位(同上) 30/31/2月28/2月29
LocalDateTimeUtil.getDateDaysUpList(N)当前月初到下N月底的每一天

List< DateDays(dayTime,week)
Time:每天时间
week:周几

2.2、LocalDateTimeUtil 工具类

package com.rely.base.utils;

import lombok.AllArgsConstructor;
import lombok.Data;

import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.time.temporal.TemporalUnit;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * TODO 时间处理工具类
 *
 * @author ws
 * @mail 1720696548@qq.com
 * @date 2020/4/24 0024 9:54
 * @return
 */
public class LocalDateTimeUtil {

    //获取当前时间的LocalDateTime对象
    //LocalDateTime.now();

    //根据年月日构建LocalDateTime
    //LocalDateTime.of();

    //比较日期先后
    //LocalDateTime.now().isBefore(),
    //LocalDateTime.now().isAfter(),

    // TODO  获取当前时间
    public static LocalDateTime now() {
        return LocalDateTime.now();
    }

    // TODO  获取指定时间是周几
    public static int week(LocalDateTime time) {
        return time.getDayOfWeek().getValue();
    }

    // TODO  获取加或减N月的第一天
    public static LocalDateTime monthFirst(int num) {
        LocalDateTime newTime = plus(LocalDateTime.now(), num, ChronoUnit.MONTHS);
        newTime = newTime.with(TemporalAdjusters.firstDayOfMonth());
        return getDayStart(newTime);
    }

    // TODO  获取加或减N月的最后天
    public static LocalDateTime monthLast(int num) {
        LocalDateTime newTime = plus(LocalDateTime.now(), num, ChronoUnit.MONTHS);
        newTime = newTime.with(TemporalAdjusters.lastDayOfMonth());
        return getDayEnd(newTime);
    }


    // TODO 获取加或减N周的第一天
    public static LocalDateTime weekFirst(int num) {
        int week = week(LocalDateTime.now());
        LocalDateTime newTime = subtract(LocalDateTime.now(), week - 1, ChronoUnit.DAYS);
        newTime = plus(newTime, num * 7, ChronoUnit.DAYS);
        //formatTime(, "yyyy-MM-dd HH:mm:ss:SSS");
        return getDayStart(newTime);
    }

    // TODO  获取加或减N周的最后一天
    public static LocalDateTime weekLast(int num) {
        int week = week(LocalDateTime.now());
        LocalDateTime newTime = plus(LocalDateTime.now(), 7 - week, ChronoUnit.DAYS);
        newTime = plus(newTime, num * 7, ChronoUnit.DAYS);
        return getDayEnd(newTime);
    }


    // TODO  判断时间 ==>  t1 < t2 = true (2019-10-13 11:11:00 < 2020-11-13 13:13:00 = true)
    public static boolean isBefore(LocalDateTime t1, LocalDateTime t2) {
        return t1.isBefore(t2);
    }

    // TODO  判断时间 ==>  t1 > t2 = true(2019-10-13 11:11:00 > 2020-11-13 13:13:00 = false)
    public static boolean isAfter(LocalDateTime t1, LocalDateTime t2) {
        return t1.isAfter(t2);
    }

    // TODO  自构建 LocalDateTime ==> 年,月,日,时,分
    public static LocalDateTime of(int year, int month, int dayOfMonth, int hour, int minute) {
        return LocalDateTime.of(year, month, dayOfMonth, hour, minute);
    }

    // TODO  自构建 LocalDateTime ==> 年,月,日,时,分,秒,毫秒(精确到9位数)
    public static LocalDateTime of(int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond) {
        return LocalDateTime.of(year, month, dayOfMonth, hour, minute, second, nanoOfSecond);
    }

    // TODO  Date 转 LocalDateTime
    public static LocalDateTime convertDateToLDT(Date date) {
        return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());
    }

    // TODO  LocalDateTime 转 Date
    public static Date convertLDTToDate(LocalDateTime time) {
        return Date.from(time.atZone(ZoneId.systemDefault()).toInstant());
    }

    // TODO  获取指定日期的毫秒
    public static Long getMilliByTime(LocalDateTime time) {
        return time.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
    }

    // TODO  获取指定日期的秒
    public static Long getSecondsByTime(LocalDateTime time) {
        return time.atZone(ZoneId.systemDefault()).toInstant().getEpochSecond();
    }

    // TODO 获取指定时间的指定格式 ==> yyyy-MM-dd HH:mm:ss:SSS  (HH是24小时制,而hh是12小时制, ss是秒,SSS是毫秒)
    public static String formatTime(LocalDateTime time, String pattern) {
        return time.format(DateTimeFormatter.ofPattern(pattern));
    }

    // TODO 日期加上一个数,根据field不同加不同值,field为ChronoUnit.*
    public static LocalDateTime plus(LocalDateTime time, long number, TemporalUnit field) {
        return time.plus(number, field);
    }

    // TODO 日期减去一个数,根据field不同减不同值,field参数为ChronoUnit.*
    public static LocalDateTime subtract(LocalDateTime time, long number, TemporalUnit field) {
        return time.minus(number, field);
    }


    /**
     * TODO 获取两个日期的差  field参数为ChronoUnit.*
     *
     * @param startTime
     * @param endTime
     * @param field     单位(年月日时分秒)
     **/
    public static long betweenTwoTime(LocalDateTime startTime, LocalDateTime endTime, ChronoUnit field) {
        Period period = Period.between(LocalDate.from(startTime), LocalDate.from(endTime));
        if (field == ChronoUnit.YEARS) {
            return period.getYears();
        }
        if (field == ChronoUnit.MONTHS) {
            return period.getYears() * 12 + period.getMonths();
        }
        return field.between(startTime, endTime);
    }


    // TODO  获取指定某一天的开始时间 00:00:00
    public static LocalDateTime getDayStart(LocalDateTime time) {
        return time.withHour(0)
                .withMinute(0)
                .withSecond(0)
                .withNano(0);
    }


    // TODO 获取指定某一天的结束时间  23:59:59.999
    public static LocalDateTime getDayEnd(LocalDateTime time) {
        return time
                //.withDayOfMonth(1)    // 月
                //.withDayOfYear(2)     // 天
                .withHour(23)           // 时
                .withMinute(59)         // 分
                .withSecond(59)         // 秒
                .withNano(999999999);   // 毫秒(这里精确到9位数)
    }

    //获取本周周一
    public static LocalDateTime getWeekOfFirst(LocalDateTime time){
        return time.with(TemporalAdjusters.previous(DayOfWeek.SUNDAY)).
                plusDays(1).withHour(0).withMinute(0).withSecond(0);
    }

    //获取本周周日
    public static LocalDateTime getWeekOfLast(LocalDateTime time){
        return time.with(TemporalAdjusters.next(DayOfWeek.MONDAY)).
                minusDays(1).withHour(23).withMinute(59).withSecond(59);
    }

    //获取本月第一天
    public static LocalDateTime getMonthOfFirst(LocalDateTime time){
        LocalDateTime firstday = time.with(TemporalAdjusters.firstDayOfMonth());
        return LocalDateTime.of(firstday.toLocalDate(), LocalTime.MIN);
    }

    //获取本月最后一天
    public static LocalDateTime getMonthOfLast(LocalDateTime time){
        LocalDateTime lastDay = time.with(TemporalAdjusters.lastDayOfMonth());
        return LocalDateTime.of(lastDay.toLocalDate(),LocalTime.MAX);
    }

    // TODO 获取当前时间月到 +N月的所有时间,一天一条数据 List<DateDays>
    public static List<DateDays> getDateDaysUpList(Integer num) {
        LocalDateTime startTime = monthFirst(0);        // 本月第一天  00:00:00
        LocalDateTime entTime = monthLast(num);              // 两月后的最后一天 23:59:59.999
        // 3个月的数据
        List<DateDays> everyDays = new ArrayList<>();
        // 第一天数据
        everyDays.add(new DateDays(startTime, week(startTime)));
        while (true) {
            // 获取一天后时间
            LocalDateTime nextDay = plus(everyDays.get(everyDays.size() - 1).dayTime, 1, ChronoUnit.DAYS);
            //大于两月后最后一天-跳出循环
            if (isAfter(nextDay, entTime)) {
                break;
            }
            everyDays.add(new DateDays(nextDay, week(nextDay)));
        }
        return everyDays;
    }

    /**
     * TODO  获取日期端的数据保存对象
     *
     * @author ws
     * @mail 1720696548@qq.com
     * @date 2020/5/7 0007 9:41
     */
    @Data
    @AllArgsConstructor
    public static class DateDays {
        //当天时间- 年月日/00:00:00
        private LocalDateTime dayTime;
        //当天是周几
        private int week;

    }

 

三、工具类测试

    /**
     * TODO  测试方法
     *
     * @param args
     * @return void
     * @author ws
     * @mail 1720696548@qq.com
     * @date 2020/4/24 0024 15:54
     */
    public static void main(String[] args) {
        System.out.println("当前时间 ==> " + LocalDateTime.now());
        System.out.println("当前时间秒数 ==> " + getMilliByTime(LocalDateTime.now()));
        System.out.println("当前时间毫秒数 ==> " + getSecondsByTime(LocalDateTime.now()));
        System.out.println("===========================================================");

        System.out.println("今天开始时间 ==> " + getDayStart(LocalDateTime.now()));
        System.out.println("今天结束时间 ==> " + getDayEnd(LocalDateTime.now()));
        System.out.println("构建自定义时间 ==> " + of(2020, 1, 1, 12, 00, 00, 999999999));
        System.out.println("指定格式 ==>  " + formatTime(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss:SSS"));

        System.out.println("=========================" + LocalDateTime.now() + " 之前 ==================================");
        System.out.println("10秒前 ==> " + subtract(LocalDateTime.now(), 10, ChronoUnit.SECONDS));
        System.out.println("10分前 ==> " + subtract(LocalDateTime.now(), 10, ChronoUnit.MINUTES));
        System.out.println("一小时前 ==> " + subtract(LocalDateTime.now(), 1, ChronoUnit.HOURS));
        System.out.println("半天前 ==> " + subtract(LocalDateTime.now(), 1, ChronoUnit.HALF_DAYS));
        System.out.println("一天前 ==> " + subtract(LocalDateTime.now(), 1, ChronoUnit.DAYS));
        System.out.println("一月前 ==> " + subtract(LocalDateTime.now(), 1, ChronoUnit.MONTHS));
        System.out.println("一年前 ==> " + subtract(LocalDateTime.now(), 1, ChronoUnit.YEARS));
        System.out.println("==========================" + LocalDateTime.now() + " 之后 ===================================");
        System.out.println("10秒后 ==> " + plus(LocalDateTime.now(), 10, ChronoUnit.SECONDS));
        System.out.println("10分后 ==> " + plus(LocalDateTime.now(), 10, ChronoUnit.MINUTES));
        System.out.println("一小时后 ==> " + plus(LocalDateTime.now(), 1, ChronoUnit.HOURS));
        System.out.println("半天后 ==> " + plus(LocalDateTime.now(), 1, ChronoUnit.HALF_DAYS));
        System.out.println("一天后 ==> " + plus(LocalDateTime.now(), 1, ChronoUnit.DAYS));
        System.out.println("一月后 ==> " + plus(LocalDateTime.now(), 1, ChronoUnit.MONTHS));
        System.out.println("一年后 ==> " + plus(LocalDateTime.now(), 1, ChronoUnit.YEARS));
        System.out.println("================================= 时间差 =====================================");
        //  输出 ====>
        LocalDateTime start = LocalDateTime.of(2019, 10, 13, 11, 11);
        LocalDateTime end = LocalDateTime.of(2020, 11, 13, 13, 13);
        System.out.println("输出:" + formatTime(start, "yyyy-MM-dd HH:mm:ss") + " -到- " + formatTime(end, "yyyy-MM-dd HH:mm:ss") + "的时间差");                                     //====> 年:1
        System.out.println("年:" + betweenTwoTime(start, end, ChronoUnit.YEARS));      // ====> 年:1
        System.out.println("月:" + betweenTwoTime(start, end, ChronoUnit.MONTHS));     // ====> 月:13
        System.out.println("日:" + betweenTwoTime(start, end, ChronoUnit.DAYS));       // ====> 日:396
        System.out.println("半日:" + betweenTwoTime(start, end, ChronoUnit.HALF_DAYS));// ====> 半日:792
        System.out.println("小时:" + betweenTwoTime(start, end, ChronoUnit.HOURS));    // ====> 小时:9506
        System.out.println("分钟:" + betweenTwoTime(start, end, ChronoUnit.MINUTES));  // ====> 分钟:570362
        System.out.println("秒:" + betweenTwoTime(start, end, ChronoUnit.SECONDS));    // ====> 秒:34221720
        System.out.println("毫秒:" + betweenTwoTime(start, end, ChronoUnit.MILLIS));   // ====> 毫秒:34221720000
        System.out.println("================================== 时间大小 ===================================");
        System.out.println("2019-10-13 11:11:00 < 2020-11-13 13:13:00 = " + isBefore(start, end)); //t1 < t2 = true
        System.out.println("2019-10-13 11:11:00 > 2020-11-13 13:13:00 = " + isAfter(start, end));  //t1 > t2 = true

        System.out.println("================================== 周几 ===================================");
        LocalDateTime of1 = LocalDateTime.of(2020, 4, 20, 0, 0);
        LocalDateTime of2 = LocalDateTime.of(2020, 4, 21, 0, 0);
        LocalDateTime of3 = LocalDateTime.of(2020, 4, 22, 0, 0);
        LocalDateTime of4 = LocalDateTime.of(2020, 4, 23, 0, 0);
        LocalDateTime of5 = LocalDateTime.of(2020, 4, 24, 0, 0);
        LocalDateTime of6 = LocalDateTime.of(2020, 4, 25, 0, 0);
        LocalDateTime of7 = LocalDateTime.of(2020, 4, 26, 0, 0);
        System.out.println(formatTime(of1, "yyyy-MM-dd") + " 是周 " + week(of1));
        System.out.println(formatTime(of2, "yyyy-MM-dd") + " 是周 " + week(of2));
        System.out.println(formatTime(of3, "yyyy-MM-dd") + " 是周 " + week(of3));
        System.out.println(formatTime(of4, "yyyy-MM-dd") + " 是周 " + week(of4));
        System.out.println(formatTime(of5, "yyyy-MM-dd") + " 是周 " + week(of5));
        System.out.println(formatTime(of6, "yyyy-MM-dd") + " 是周 " + week(of6));
        System.out.println(formatTime(of7, "yyyy-MM-dd") + " 是周 " + week(of7));
        System.out.println("=========================== 周开头和结束 ===============================");
        System.out.println(" 上周的周一是 " + weekFirst(-1));
        System.out.println(" 上周的周末是 " + weekLast(-1));
        System.out.println(" 本周的周一是 " + weekFirst(0));
        System.out.println(" 本周的周末是 " + weekLast(0));
        System.out.println(" 下周的周一是 " + weekFirst(1));
        System.out.println(" 下周的周末是 " + weekLast(1));
        System.out.println("=========================== 月开头和结束 ===============================");
        System.out.println(" 上月的月初是 " + monthFirst(-1));
        System.out.println(" 上月的月位是 " + monthLast(-1));
        System.out.println(" 本月的月初是 " + monthFirst(0));
        System.out.println(" 本月的月位是 " + monthLast(0));
        System.out.println(" 下月的月初是 " + monthFirst(1));
        System.out.println(" 下月的月位是 " + monthLast(1));
        System.out.println("==================== 当前月1好到下N月底的每天数据 ===============================");
        System.out.println(" 当前月初好到下N月底 " + LocalDateTimeUtil.getDateDaysUpList(2).toString());
    }
}

package com.aapoint.util; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.time.temporal.TemporalAdjusters; public class LocalDateTimeUtil { /** * 比较 localDateTime2 是否在localDateTime1之前(比较大小) * @param localDateTime1 * @param localDateTime2 * @return */ public static Boolean compare(LocalDateTime localDateTime1,LocalDateTime localDateTime2){ return localDateTime1.isBefore(localDateTime2); } /** * 获取当前月份前/后的月份的第一天 * @param i 指定距离当前月份的时间 * @param state 状态 0.当月 1.前 2.后 * @return */ public static String firstDay(Integer state,Integer i){ LocalDateTime date = null; //type 类型 0.月 1.天 2.小时 3.分钟 4.秒 date = getLocalDateTime(state,0,i); //获取该月份的第一天 String firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); // System.out.println("第一天为:"+firstDay); return firstDay; } /** * 获取当前月份前/后的月份的最后一天 * @param i 指定距离当前月份的时间 * @param state 状态 0.当月 1.前 2.后 * @return */ public static String lastDay(Integer state,Integer i){ LocalDateTime date = null; //type 类型 0.月 1.天 2.小时 3.分钟 4.秒 date = getLocalDateTime(state,0,i); //获取该月份的最后一天 String lastDay = date.with(TemporalAdjusters.lastDayOfMonth()).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); // System.out.println("最后一天为:"+lastDay); return lastDay; } /** * 获取当时间前/后的时间() * @param i 指定距离当前月份的时间 * @param state 状态 0.当月 1.前 2.后 * @return */ public static String obtainDay(Integer state,Integer i){ LocalDateTime date = null; //type 类型 0.月 1.天 2.小时 3.分钟 4.秒 date = getLocalDateTime(state,1,i); //获取天 String day = date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); // System.out.println("获取的时间为():"+day); return day; } /** * 获取当时间前/后的时间(小时) * @param i 指定距离当前月份的时间 * @param state 状态 0.当月 1.前 2.后 * @return */ public static String obtainHours(Integer state,Integer i){ LocalDateTime date = null; //type 类型 0.月 1.天 2.小时 3.分钟 4.秒 date = getLocalDateTime(state,2,i); //获取该月份的最后一天 String hours = date.format(DateTimeFormatter.ofPattern("HH:mm:ss")); // System.out.println("获取的时间为(小时):"+hours); return hours; } /** * 获取当时间前/后的时间(小时) * @param i 指定距离当前月份的时间 * @param state 状态 0.当月 1.前 2.后 * @return */ public static String obtainMinutes(Integer state,Integer i){ LocalDateTime date = null; //type 类型 0.月 1.天 2.小时 3.分钟 4.秒 date = getLocalDateTime(state,3,i); //获取该月份的最后一天 String minutes = date.format(DateTimeFormatter.ofPattern("HH:mm:ss")); // System.out.println("获取的时间为(分钟):"+minutes); return minutes; } /** * 获取当时间前/后的时间(小时) * @param i 指定距离当前月份的时间 * @param state 状态 0.当月 1.前 2.后 * @return */ public static String obtainSeconds(Integer state,Integer i){ LocalDateTime date = null; //type 类型 0.月 1.天 2.小时 3.分钟 4.秒 date = getLocalDateTime(state,4,i); //获取该月份的最后一天 String seconds = date.format(DateTimeFormatter.ofPattern("HH:mm:ss")); // System.out.println("获取的时间为():"+seconds); return seconds; } public static void main(String[] args) { System.out.println("当前时间为:"+LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); System.out.println("前一个月份的第一天为:"+LocalDateTimeUtil.firstDay(1,1)); System.out.println("前一个月份的最后一天为:"+LocalDateTimeUtil.lastDay(1,1)); System.out.println("当前时间的前一天为:"+LocalDateTimeUtil.obtainDay(1,1)); System.out.println("当前时间的后一天为:"+LocalDateTimeUtil.obtainDay(2,1)); System.out.println("当前时间的前一小时为:"+LocalDateTimeUtil.obtainHours(1,1)); System.out.println("当前时间的后一小时为:"+LocalDateTimeUtil.obtainHours(2,1)); System.out.println("当前时间的前一分钟为:"+LocalDateTimeUtil.obtainMinutes(1,1)); System.out.println("当前时间的后一分钟为:"+LocalDateTimeUtil.obtainMinutes(2,1)); System.out.println("当前时间的前一秒为:"+LocalDateTimeUtil.obtainSeconds(1,1)); System.out.println("当前时间的后一秒为:"+LocalDateTimeUtil.obtainSeconds(2,1)); } private static LocalDateTime getLocalDateTime(Integer state,Integer type,Integer i) { LocalDateTime date; if(state == 0){ date = LocalDateTime.now(); }else if(state == 1){ if(type == 0) { //获取月 date = LocalDateTime.now().minusMonths(i); }else if(type == 1){ //获取天 date = LocalDateTime.now().minusDays(i); }else if(type == 2){ //获取小时 date = LocalDateTime.now().minusHours(i); }else if(type == 3){ //获取分钟 date = LocalDateTime.now().minusMinutes(i);
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值