[update] 修改app实名,修改施工进度计划和填报逻辑
This commit is contained in:
@ -9,6 +9,7 @@ import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.*;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@ -341,4 +342,22 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
return Date.from(combinedInstant);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验日期范围
|
||||
*
|
||||
* @param startStr 开始日期字符串,格式为 "yyyy-MM-dd"
|
||||
* @param endStr 结束日期字符串,格式为 "yyyy-MM-dd"
|
||||
* @return true 表示日期范围有效,false 表示日期范围无效
|
||||
*/
|
||||
public static boolean isValidDateRange(String startStr, String endStr) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
try {
|
||||
LocalDate startDate = LocalDate.parse(startStr, formatter);
|
||||
LocalDate endDate = LocalDate.parse(endStr, formatter);
|
||||
return !startDate.isAfter(endDate); // start <= end
|
||||
} catch (DateTimeParseException e) {
|
||||
return false; // 格式非法
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -339,4 +339,16 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断字符串是否全为数字
|
||||
*
|
||||
* @param str 字符串
|
||||
* @return 是否为数字
|
||||
*/
|
||||
public static boolean isAllDigits(String str) {
|
||||
if (str == null) return false;
|
||||
String noSpaces = str.replaceAll(" ", "");
|
||||
return noSpaces.matches("\\d+");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user