订单 优惠券部分 重写
This commit is contained in:
@@ -2,6 +2,8 @@ package com.czg.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
* @description
|
||||
@@ -15,4 +17,18 @@ public class CzgStrUtils {
|
||||
public static String getStrOrNull(String str) {
|
||||
return StrUtil.isNotBlank(str) ? str : null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取当天是周几
|
||||
* @return 周几
|
||||
*/
|
||||
public static String getStrWeek() {
|
||||
int dayOfWeek = LocalDate.now().getDayOfWeek().getValue();
|
||||
|
||||
// 定义汉字星期数组(索引0不用,从1开始对应周一到周日)
|
||||
String[] chineseWeeks = {"无", "一", "二", "三", "四", "五", "六", "日"};
|
||||
|
||||
return "周" + chineseWeeks[dayOfWeek];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user