优化
This commit is contained in:
@ -0,0 +1,33 @@
|
||||
package com.ruoyi.common.enums;
|
||||
|
||||
/**
|
||||
* 用户状态
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public enum BgtMessageType
|
||||
{
|
||||
TASK("1", "包工头同意"),
|
||||
SETTLEMENT("2", "包工头拒绝"),
|
||||
OTHER("3", "务工者同意"),
|
||||
;
|
||||
|
||||
private final String code;
|
||||
private final String info;
|
||||
|
||||
BgtMessageType(String code, String info)
|
||||
{
|
||||
this.code = code;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getInfo()
|
||||
{
|
||||
return info;
|
||||
}
|
||||
}
|
@ -5,6 +5,8 @@ import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@ -157,4 +159,19 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||
// long sec = diff % nd % nh % nm / ns;
|
||||
return day + "天" + hour + "小时" + min + "分钟";
|
||||
}
|
||||
|
||||
|
||||
public static LocalDate str2Localdate(String time,String format){
|
||||
// 定义日期格式
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);
|
||||
LocalDate localDate = null;
|
||||
try {
|
||||
// 将字符串转换为 LocalDate
|
||||
localDate = LocalDate.parse(time, formatter);
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("日期格式不正确,转换失败: " + e.getMessage());
|
||||
}
|
||||
return localDate;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user